Triggering a Group
It is often useful to execute a group only when a certain condition is met or as a bit turns on or off. Triggers allow 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.
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.
- 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.
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.
- 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 transaction group to start the group.
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 write target for this tag should be read only.
- Select the Trigger tab and select the Execute this group on a trigger check box.
- Select the Reset trigger after execution check box.
- Press save to start the transaction group.
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 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.
- No labels