Global Expressions

The Unified Data Manager (UDM) provides a centralized management of commonly used expressions, groups, value sets, registers, and event triggers across the GENESIS64 suite. This topic helps shows how to configure global expressions and demonstrates how they are used.

You create an expression using the UDM and can then use that expression in all other GENESIS64 applications. Each global expression is implemented as a single expression data tag, which recalculates on input values or on trigger data tags. Client applications can access these expression data tags as read/write data tags. Expressions can also accept parameters. To understand how expressions can be used, refer to the Expressions in the Data Browser topic.

Unified Data Manager with an Expression Configuration

Creating a New Expression

  1. Launch the UDM by going to Start > Programs > ICONICS > Tools > Unified Data Manager. The Workbench opens with the UDM provider selected.

  2. Create a new configuration database by right-clicking on your server at the root of the tree and select New Database.

  3. Follow the Create Database Wizard instructions to create a new configuration database. You can check or uncheck Include Sample Data check box.

  4. You should now have a new configuration database. Right-click it and select Make Active.

  5. In the tree-control in the Project Explorer, expand this new configuration, right-click on Expressions, and select Expression, as shown below.

Adding a new expression

NOTE: Alternatively, you can create a new Folder and then add your new Expression to the folder. Use folders to organize the expressions that you have defined.

  1. Enter SumExample in the Name field of the expression.

  2. Continue to the next section of this topic.

Simple Read Expression

Next, you are going to create a simple expression that calculates a sum of three data points (for example, FastL000, FastL001, and FastL002).

  1. Once you have created the expression, select the Read Expression tab and click the Expression Editor button.

  2. Write the point names enclosed with double curly brackets {{ }} or browse for them one-by-one using the Variables button, (which opens OPC UA Browser). Add them by using the addition sign + (which you can type, or select by clicking the Arithmetic button and selecting +). Your expression should look similar to the one shown below.

  3. Click OK to close the Expression Editor.

Example Read Expression

NOTE: At this point, you can also specify a tag to enable/disable this expression based on a condition. To do this, you would put a check mark in the Use Trigger Tags check box. Enabling this check box lets you specify tags and the method or condition under which the expression is to be used. For additional information, refer to the Read Expressions Tab topic.

  1. Click the Apply button to save your changes.

Using the Expression

  1. Launch GraphWorX64 by going to Start > Programs > ICONICS > GENESIS64 > GraphWorX64 > GraphWorX64.

  2. Insert a Process Point and open the Data Browser.

  3. Navigate to OPC Servers > My Server > Global Expressions and select the expression you just created.

  4. Click OK to close the Data Browser.

  5. Save the GraphWorX64 display.

Selecting an Expression from Data Browser

  1. Enter Runtime and you will see results of the read expression you configured.

Read/Write Expression Used for Scaling

One of the most common uses of global expressions is scaling and conversion of values. The steps below describe how to create an expression that will scale an OPC tag value by 10.

  1. Create a new expression as described in the previous example and enter ScaledExample as the Name.

  2. On the Read Expression tab, open the Expression Editor and select a Simulation tag OPC UA. You will see its syntax in double curly brackets. Append “/10” at the end of the line to divide it by 10. This expression will divide a value that comes from the selected source by 10.

  3. Select the Write Expression tab and put a check mark in the Enable Write Expression check box.

  4. Click the Expression Editor button, type manually {{input}}. This is a keyword used to represent the input coming from the Write action performed from a client. Append “*10” at the end of line. This expression will multiply the input by 10.

  5. Click OK to close the Expression Editor. The result will look something like the following:

Multiplying the Input by 10

  1. In the Output Tag section at the bottom of the Write Expression tab, click the Browse button and select the point you selected in Step 2. Select OK to close the Data Browser.

NOTE: Keep in mind that the Output Tag can be only a single point. If you use a complex write calculation involving more tags, you can select only a single point where the result will be written to.

  1. Click Apply to save the new expression.

Expression with Parameters

You can create expressions that are more complex than the ones created in the prior examples. You can create expressions that take multiple parameters in their calculations. In this example, you will use two parameters that take in two OPC Tag strings. The Read Expression will add the two resulting OPC values.

  1. Create a new expression and enter Addition as its Name.

  2. On the Expression Properties tab add two Parameters called tag1 and tag2.

  3. Select String as their Type from the drop-down list, as shown below.

Adding Two New String Parameters

  1. Go to the Read Expression tab and enter the following expression:

x= {{<<tag1>>}}+{{<<tag2>>}}

NOTE: When you refer to a parameter in an expression, the parameter's name must be enclosed in double carets << >>.

  1. Click Apply. The expression is now ready for use. When you browse for the tag in the Data Browser it will have the following syntax:

@exp64:Addition("tag1","tag2").Value

  1. You need to substitute the “Tag1” and “Tag2” parameters with OPC Tag names in your client.

NOTE: Parameters can be used in all previous examples instead of constants.

See Also:

Unified Data Manager

Unified Data Browser

Expression Editor

Rules/Expression Editor

Expressions in the Data Browser