Expression Items

Expression Items are used for executing comparisons, simple math and querying additional database tables. They get their values from an expression made up of static values or other items, or from SQL Queries. They can have alarms and can be executed when the trigger is active or every time the group executes.

Expression items are items in groups that handle an expression much like an expression tag. The main difference between the two is that expression items in transaction groups only exist within the transaction group and they only update at the rate of the transaction group. You can use expression items to perform calculations and create complex triggers.

To create an Expression Item

  1. From the Transaction Groups node of the Project Browser, select a group.

  2. In the white area of Basic OPC/Group Items, Run-Always or Triggered Expression Items, right-click and select New Item > New Expression Item.
    The Edit group tag window is displayed and you can set the following properties:

    Expression Item General Properties

    General Properties

    Name

    The name of the OPC item in the group. There cannot be duplicate names within a group.

    Value

    The static value of this Expression item. This will be overwritten by an Expression/SQL binding.

    Datatype

    The datatype values are stored as.

    Value Mode

    Property

    Which property of the OPC item you want to use.

    • Value - Item value

    • Quality - Quality code of the expression/SQL Query (192 = GOOD_DATA)

    • Timestamp - The last time the item value changed

    • Name - The SQLBridge Item Name property of this Item.

    Mode

    Options for displaying values based on the Item value.

    • Direct Value - Item value

    • Hour Meter - Record the amount of time the Item value is non-zero. This accumulation will reset to zero when the item value goes to zero. The datatype should be set to integer or
      float when using an Hour Meter regardless of the OPC Item type.
      On Zero - Use a zero value to accumulate time instead of a non-zero value
      Retentive - Retain the Hour Meter value when it is not accumulating.
      Units - The time units to display.

    • Event Meter - Record the number or times the Item value is non-zero. The datatype should be set to integer when using an Event Meter regardless of the OPC Item type.
      On Zero - Use a zero value to accumulate events instead of a non-zero value

    Evaluation Mode

    Run-always (ignore Trigger) - When selected, this causes the group to evaluate at each group interval, before the trigger state is evaluated.

    Write Target

    Target Type - This is the selection for what the Item will write to when the group executes.

    • None, read-only item - Do not write this value to the database.

    • Database field - Write the Item value to the specified column in the database table.

    • Other tag - Write the Expression Item's value back to an OPC item or Tag Reference.

    Target Name

    The name of the column in the database that this Item will write to when the group executes. The Target Name list will populate with all the OPC Item and Tag Reference names from this Group, or the column names from the Group's target table depending on the Target Type selected.

    Numeric

    These are the Numeric properties for Expression Items. For a full description, see Tag Scaling Properties .

    Alarming

    These are the Alarming settings for the OPC items. See Alarming Properties for a full explanation.

    Expression

    These are the Expression/SQL Query options for Expression Items. See Expression/SQL Properties for a full explanation.


  3. Select the Expression/SQL tab from the menu on the left of the Edit group tag window.

  4. Select Expression from the dropdown menu.
    Expression items can use the same functions as other expression items in Ignition. An expression item returns in accordance with the created expression. The resulting value can be written to a transaction group Item such as a tag or it can be written to a database.

  5. Select the General tab and configure the Write target to instruct the transaction group what to do after the expression is complete.

To use an Expression Item as a transaction group trigger

  1. In the Run-Always Expression Items location of the transaction group, right-click and select New Item > New Expression Item.

  2. On the Edit group tag window, set the following properties to create a new expression item that returns a boolean true or false depending on the result of the expression item:
    Data Type: Boolean
    Mode: Direct value

  3. Select the Trigger tab of the transaction group's properties on the right of the transaction group.

  4. Select the Execute this group on a trigger box, and from the drop-down of Trigger on Item select the name of the new expression item.

  5. Properly configure the Trigger conditions.