Trigger Options
Trigger - On Value Change
Watch the videoIt is often useful to execute a group only when a certain condition is met or as a bit turns on or off. Triggers allow Transaction Groups to run based on values changing in various ways.
Execute on Value Change​
A group can execute when the group's tags have changed, or when a particular tag within the group has changed. In either case, the Transaction Group will execute every time the value or values change.
- In the Trigger tab, select at the very top the Only evaluate when values have changed checkbox. Now the group will execute if any of the tags change.
- To execute when only one tag changes, from the Tags to watch for change dropdown, select Custom, click on Select Tags, select the tag from the pop-up window, and click OK. You can select more than one tag at a time in order to monitor more than one tag for value changes.
- From the Trigger on item dropdown, select the appropriate tag to execute the tag on a trigger.
- Select the Active on value change radio button.
- Save the Project to start the Transaction Group.
Execute while Condition is True​
Groups can execute while a condition is true resulting in the Transaction Group continuing to execute for the duration of this condition.
- Create a Transaction Group, and drag a numeric or boolean Tag into the Basic OPC/Group Items section.
- From the Target Name column dropdown, select Read Only if you do not want the trigger value to be written to the database.
- Go to the Trigger tab, and select the Execute this group on a trigger checkbox.
- In the Trigger conditions area, set the trigger conditions which will determine under what condition the group executes.
- Save the Project to start the Transaction Group.
Execute on a Rising Edge​
Groups can execute when the trigger becomes True. This is known as a rising edge trigger and it will only execute once and will not execute again until the trigger repeats the same cycle.
- Create a standard Transaction Group with any number of tags as long as one of them is a boolean tag that will serve at the trigger for the group.
- Set the Write Target for the boolean tag to Read-only by selecting read-only from its drop down in the Target Name column. You do not need to do this if you want the trigger value to be written to the database.
- Go to the Trigger tab and select the check box to Execute this group on a trigger. Select the boolean tag from the drop down menu and select to have the group only execute once while the trigger is active.
- Save the Project to start the Transaction Group.
Reset Trigger​
Resetting a trigger after execution of a triggered Transaction Group will result in the Transaction Group writing once to the targets followed by writing back to the trigger to reset it.
To reset the trigger after execution:
- Create a Transaction Group with a boolean Tag. The Target Name column for the trigger Tag can be read-only, though this is not mandatory.
- Select the Trigger tab and select the Execute this group on a trigger check box.
- Select the Reset trigger after execution check box.
- Save the Project to start the Transaction Group.
Handshakes​
When a group executes, it either completes successfully or an error prevents its execution. The outcome of an execution can be handled in the handshake section of the trigger section of the Transaction Group. When a group executes successfully or fails to execute, the handshake can write a value back to a tag to alert the user that the group executed successfully or unsuccessfully.
To set handshake values for alerting the user:
- Create a Transaction Group with a boolean tag and a numeric tag.
- Set the boolean and the numeric tag to read only.
- Go to the Trigger tab and choose to Execute this group on a trigger.
- Select the boolean tag as the trigger In the Trigger on item drop down, and select the appropriate execution conditions.
- In the bottom section, select Write handshake on success, select the numeric tag to write to, and choose a number that signifies success.
- Likewise, in the bottom section, select Write handshake on failure, select the numeric tag to write to, and choose a number that signifies failure.
- Save the Project to start the Transaction Group.