Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Add a Calculated Variable

  • Last UpdatedFeb 21, 2025
  • 3 minute read

Calculated Variables allows you to generate a tag value at runtime that is the result of a Cicode expression.

Note: A calculated variable will contribute to the point count if it refers to variable tag(s) in its Cicode expression that has been configured in it's address field. If the calculated variable only refers to Cicode functions, and these functions do not refer to variable tags, then it will not contribute to the point count.

To configure calculated variables, you need to perform two procedures:

  • Create an I/O device with its protocol set to "CICODE".

  • Create a variable tag on a Cicode I/O device that has a Cicode expression as its address.

Projects created from a starter project in Plant SCADA 2016 (or later) will include a pre-configured Cicode I/O device.

Note: When a primary I/O server is starting up, it loads and initializes all of its I/O devices. For large projects, this process can have a heavy impact on system performance especially when there are Cicode devices supporting calculated variables. To minimize the potential impact on display client updates, you can apply a delay that will stop client tag subscriptions from switching to a primary device while the I/O server it is still starting up. See Delay Client Tag Subscription Switching for Cicode Devices.

Create a Cicode I/O Device

You can use one of the following methods to create a Cicode I/O device:

Create a Cicode I/O device in the Topology activity

  1. In the Topology activity, select I/O Devices.

    The I/O devices list will display in the Grid Editor.

  2. In the Project field, select the project that will host the Cicode I/O device.

  3. In the Server Name field, select the I/O server that will host the Cicode I/O device.

  4. In the Name field, enter a name for the Cicode I/O device. The name needs to be unique to the selected I/O server.

  5. In the Number field, enter a unique number for the Cicode I/O device (0-16383).

  6. In the Protocol field, select "CICODE".

  7. The remaining fields are not required for a Cicode I/O device.

  8. Click Save.

Create a Cicode I/O device using the Device Communications Wizard.

  1. In the Topology activity, select I/O Devices.

  2. On the Command Bar, select New Device.

    The Using the Device Communications Wizard will display.

  3. When asked to select the "type of the I/O Device", select Persisted Memory I/O Device.

  4. When asked to select the "manufacturer, model and method of communication" for the I/O device, select Cicode Protocol.

  5. When you have finished stepping through the wizard, the Cicode I/O device will appear in the I/O Devices list.

    Note: The Startup Mode field should be configured appropriately if device redundancy is required for the Cicode I/O device you have created.

    Create a Calculated Variable on a Cicode I/O Device

    To create a calculated variable on a Cicode I/O device:

    1. In the System Model activity, select Variables.

    2. On the menu below the Command Bar, select Variables.

    3. The variables list will display in the Grid Editor.

    4. Add a row to the Grid Editor.

    5. In the Tag Name field, enter a name that describes the calculated variable.

    6. In the I/O Device field, select the name of the Cicode I/O device you would like to use.

    7. In the Data Type field, select a data type that is appropriate to the value that will be returned by the specified calculation or Cicode expression.

    8. In the Address field, enter a valid Cicode expression.

      Note: Cicode functions used for calculated variables need to be non-blocking functions.

    9. Click Save.

      Note: If an error is trapped in the Cicode that has been placed in the Address field of a calculated variable (either internally via a built-in Cicode function or by calling the function ErrTrap), the variable tag will have bad quality and will raise a Cicode error when the tag is read. After reading the tag, call IsError() to get the error number and clear it.

      See Also

      Configure Variable Tags

      TitleResults for “How to create a CRG?”Also Available in