Modbus Devices Example: Setting OnlineOffline and LocalRemote GEM VIDs from PLC Registers
It is a requirement of SECS/GEM that physical buttons or switches (or HMI UI elements exist serving this purpose) are available on the tool so that the operator has control of when the host may connect to (online/offline) and control (local/remote) the tool. Read more about this here: TransSECS VIDs.
See also: Using Modbus 4x to monitor the ControlState VID value.
The example below shows a simple way to use Modbus PLC 0x registers for this purpose. It is assumed that each coil is connected to the button controlling the Online/Offline or Local/Remote options. Any register type (4x,3x,1x or 0x) treated as a boolean (on/off or true/false) can be used for the OnlineOfflineState and LocalRemoteState data, but this example uses 0x (Coil) Modbus registers.
Online/Offline and Local/Remote VIDs
In the TransSECS tool project you will automatically have the GEM variables “OnlineOfflineState” and “LocalRemoteState” defined. These are GEM variables and you can change the VID ID value but may not change the VID name as it is used internally in the ErgoTech SECS/GEM software as a variable used in the Control State model.
Adding the 0x Registers to the Project
In the Devices node of the tool project add and configure your PLC device server. In this example we have added a ModbusTCP device server and configured it to connect to a PLC.
Right click on the ModbusTCP device and add a “Modbus 0x Reg”. Rename this from “Modbus 0x Reg” to “OnlineOffline”. Repeat this for the second coil register, and rename it “LocalRemote”. Configure each of these to use a valid register in your PLC. In this example these are configured to use 0x1 and 0x2. Make sure the Timebase is set to a non-zero value, such as 1.0 (to read the value from the PLC every 1.0 seconds). These registers are referred to as “Device Tags” by the names “OnlineOffline” and “LocalRemote” in the next step.
Configuring OnlineOfflineState and LocalRemoteState to Use the Device Tags
The last step is to connect the 0x registers set up in the previous step to the GEM variables OnlineOfflineState and LocalRemoteState. First select the LocalRemoteState VID and find the property “Device Name” and select the “ModbusTCP” Device Server. For the Tag Name select “LocalRemote” from the list. Likewise for the OnlineOfflineState, select ModbusTCP for the Device and “OnlineOffline” for the tag.
Now the project is ready to test, so build and deploy, and then run the tool. You should see a change in the GEM ControlState as you toggle the values in the 0x registers for OnlineOfflineState and LocalRemoteState.