MODBUS Communication Protocol in RSCAD
The script language supports a set of standard MODBUS commands to allow communication with external equipment.
A computer running RSCAD poses as the master, and will interact with and control an external slave device. A typical scenario would include configuring an external device (a relay for example) and then running a set of tests and documenting the behavior of the relay. With the addition of the MODBUS script commands, equipment testing can be automated even further because the relay can be controlled directly from the script. This allows the script to change the relay settings and continue testing without any manual intervention. Both MODBUS TCP and serial commands are supported.
In order to implement an example case of MODBUS communication, MODBUS slave test tool is used. A script file is developed to send/receive information to/from slave test tool (For more information about RTDS script files, please refer to Chapter 7 of the RSCAD tutorial). Figure 1 shows the script which is used in this particular example.

As can be seen from Figure 1, the script has three sections. First, the necessary connection preparation is done and connection to the slave test tool is established. The IP address of the slave should be entered here. Information is sent to the slave test tool and finally the same information is read from the slave tool and sent to the RSCAD runtime. Note, the slave test tool can be replaced by any MODBUS slave device and commands can be sent/received to/from the device.
For more information regarding the MODBUS commands, please refer to the RSCAD runtime help as shown in Figure 2.

Author: Mayssam Amiri [rtds.com]