Hour and Event Meters
Hour and Event Meters
Watch the videoHour meter and Event meter refer to the Value Mode option settings on tags in Transaction Groups. The Value mode drives values that are used to create values that determine how long a value was true. While the selected Value Mode for most transactions is Direct however, the Hour meter mode accumulates value for the duration of a condition, and the Event meter accumulates count in response to the condition.
Hour Meter​
It is common to write to a tag during the time when a tag's value is true. An hour meter simplifies this effort. Hour meters can be meters that accumulate the millisecond, second, minute, hour, or day.
Count the Duration of a Tag Being True​
From the Tag Browser, drag a boolean tag into the Basic OPC/Groups Items area of a Standard Transaction Group.
From OPC Browser or Tag Browser, drag a memory tag or OPC tag (must be a numeric data type) into the Basic OPC/Groups Items portion of the Standard Transaction Group.
Right-click on the boolean tag in the Transaction Group and select Edit. The Edit group tag window is displayed.
In the Edit group tag window, for Value Mode, select Hour meter.
In the Edit group tag window, for Target Type, select Other tag from the dropdown menu. In Target Name enter the name of the memory tag as the target, and click OK.
In the Basic OPC/Groups Items area where the tags are located, go to the Target Name column, left-click on each tag to get the dropdown menu, and set the following:
For the boolean tag, select the memory tag from the dropdown which is set previously as the target tag to write the hour meter to.
For the memory tag, select Read-only from the dropdown.
Click Enabled at the top of the page, and do a File > Save to start the group.
Set the boolean tag to true to the start of the Hour meter.
Event Meter​
Another common scenario is to count the number of times an event occurred, where an event represents a value change to the tag. For instance, the Event meter targeting a boolean tag would count each value change from false to true. Notice that this is different from the Hour meter as it counts the amount the value changes from false to true, instead of the duration the tag value is true. This count will total the number of cycles the boolean tag has experienced.
The data type must be set to integer when using an Event meter regardless of the OPC Item type.
Count in Response to a Tag Being True​
From OPC Browser or Tag Browser, drag a boolean tag into the Basic OPC/Groups Items area of a Standard Transaction Group.
From OPC Browser or Tag Browser, drag a memory tag or OPC tag into the Basic OPC/Groups Items portion of the Standard Transaction Group.
Right-click on the boolean tag in the Transaction Group and select Edit.
In the Edit group tag window, set the following:
- Value Mode: Event meter
- Target Type: Other Tag
- Target Name: _Sim_New_Programmable_/Events (or name of the tag you are using)
Click OK.
In the Basic OPC/Groups Items area where the Tags are located, go to the Target Name column. Left-click on each tag to get the dropdown menu, and set the following:
For the boolean tag, select the memory tag from the dropdown which is set previously as the target tag to write the hour meter to.
For the memory tag, select Read-only from the dropdown.
Click Enabled at the top of the page, and do a File > Save All to start the group.
Set the boolean tag to true to start the Event meter. You'll see the Event Tag update in the Tag Browser.
Reset an Hour or Event Meter Based on a Condition​
Resetting Hour and Event Meters
Watch the videoYou can set the hour or event meter based on a condition.
In the Basic OPC/Group Items section, right-click and Edit a Tag that is serving as the Hour or Event meter. The Edit group tag window is displayed.
In the Value Mode area, select the Reset on condition check box.
Click the Tag icon to display the Choose Tag window, and select a Group Tag from the popup window.
Click OK.
Next to the Tag icon, choose the operator sign (for example >), and enter a number. In the example we entered 9.
Click OK. The target tag will now reset in response to the condition (after nine occurrences in our example).