Advanced SCADA Tag Expression Configuration

Basic SCADA tag configuration has been covered in previous training. Let’s explore more to utilize the configuration for SCADA tags in the advanced way.

For Ecava IGX, there is an useful feature in tag configuration, in which user can easily set some logical expression or conditions to the desired tag, then it will behave accordingly in runtime. By using this SCADA tag expression, user can avoid the hassle of writing unnecessary scripts to burden the SCADA engine.

When a tag value has been read from the PLC, it can be manipulated by IGX Server to the desired value before it is displayed on the Watch window in IGX Server. The input expression is used for this purpose. Similarly, if a PLC register supports write operation, the corresponding tag in IGX can be modified to set the register value in PLC. The output value can also be manipulated by IGX to reflect the desired value in the PLC register with the use of an output expression.

In this training, you will learn to configure I/O tag expressions. Besides Project Editor and Server, you need a Modbus simulator. We will be running Server and the Modbus simulator on the same computer. The Modbus simulator used in the following example is MODBUS PLC Simulator.

Configure I/O Port

On the left menu in the Project Editor, select ‘IO Driver’ to open the port settings. Add a new row of data as shown in the screenshot below. The port name in this example is ‘MODBUS’. The address ‘’ means that IGX Server will connect to the Modbus simulator which listens to port 502 on localhost ( Save the configuration.

SCADA training SCADA tag configuration expression create IO driver

Configure I/O Device

On the left menu, open the ‘MODBUS’ item under the ‘IO Driver’ item. There is only one device for this example. We shall name it as ‘modbus_device’. Set its timer (polling interval) to SEC01 (one second). Choose Modbus as the driver protocol. Keep other settings unchanged. Save the changes.

Select the first row of data and the right pane will display the properties. Please take note that the default address offset is 0, which is the intended value.

SCADA training SCADA tag configuration expression create IO device

Configure Tags and Tag Expressions

Expand the ‘MODBUS’ item on the left menu and you will notice the ‘modbus_device’ item. Click to open it. We will add two tags. Let’s start with the first tag. It is called ‘pressure’. For this training, we will set the type as int16 (16-bit or equivalently 2-byte integer), which refers to a holding register in the Modbus protocol. The address is not an absolute address, but is an offset from the address of the first register. Since the address offset is 0 and the register type is holding register, an address of 0 refers to the address of the first holding register.

Next, we will add an input expression. We will scale the value from the Modbus register by 10 times. In order to specify the scaling factor, click the entry corresponding to the ‘Input Expression’ column and enter ’10’ (without the quotes).

SCADA training SCADA tag configuration input expression

After entering the scaling factor and pressing the Enter key, the entry value will change to ‘$ * (10)’. The symbol $ refers to the tag value. You will notice that the entry corresponding to the ‘Output Expression’ column has been filled with the value ‘$ / (10)’ and cannot be modified. This means that any tag value written to the Modbus register will be scaled down by 10.

SCADA training SCADA tag configuration output expression

We shall add one more tag. Let’s call it ‘temperature’. Its address is set to 1 and its type is int16 (Modbus holding register). The ‘temperature’ tag stores the temperature value in degree Fahrenheit, while the value retrieved from the Modbus simulator is in degree Celsius. We will perform the necessary conversion from degree Celsius to degree Fahrenheit. Enter ‘$*(9/5)+32’ (without the quotes) for the Input Expression.

SCADA training SCADA tag configure complex input expression

You will notice that the ‘Output Expression’ is not automatically updated. It works for only simple scaling expressions. You have to provide the expression to convert from degree Fahrenheit to degree Celsius. Enter ‘($-32)*5/9’ (without the quotes) for the Output Expression. Save all the changes.

SCADA training SCADA tag configure complex output expression

Test and Run the Project

Now we are ready to run the project in Server. Before running the project, we shall run the Modbus simulator first. Adjust the simulator setting to display holding registers and disable automatic modification of register values. Set all the register contents to 0. The first holding register is located at address 40001 and stores the pressure. The second holding register is at address 40002 and stores the temperature.

After running the project in Server, open the Watch window by selecting ‘Watch’ at the bottom left corner. Use the search box on top to find the tag ‘pressure’ and mark it as a favourite tag. To mark a tag as favourite, click the star icon on the left side of the tag. Mark both ‘pressure’ and ‘temperature’ as favourite tags. By doing so, you can view your favourite tags by selecting the star icon next to the magnifying glass icon on the Watch window. The screenshot below shows the tag values in IGX Server and the register values in the Modbus simulator. You will notice that the pressure is 0 and the temperature is 32.

SCADA training SCADA tag expression run project and modbus simulator

On the Modbus simulator, change the value of the holding register at 40001 to 1. Notice that the pressure tag is changed to 10. Change the value of the register at 40002 to 100. The temperature tag is updated to 212. In our example, the Modbus registers support read and write operations. You can also modify the tag values in the Watch window and the Modbus register values will be updated to reflect the changes.

SCADA training SCADA tag expression run project and modbus simulator test value reflect

Download Ecava IGX today and fully utilize your SCADA tag configuration by setting tag expressions.

← Back to SCADA Training