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

AVEVA™ Historian

Counter retrieval

  • Last UpdatedMar 03, 2025
  • 3 minute read

Counter retrieval allows you to accurately retrieve the delta change of a tag’s value over a period of time even for tags that are reset upon reaching a "rollover value." The rollover value is defined in the AVEVA Historian for each tag.

This retrieval mode is useful for determining how much of an item was produced during a particular time period. For example, you might have an integer counter that keeps track of how many cartons were produced. The counter has an indicator like this:

Counter retrieval mode indicatior window.

The next value after the highest value that can be physically shown by the counter is called the rollover value. In this example, the rollover value is 10,000. When the counter reaches the 9,999th value, the counter rolls back to 0. Therefore, a counter value of 9,900 at one time and a value of 100 at a later time means that you have produced 200 units during that period, even though the counter value has dropped by 9,800 (9,900 minus 100). Counter retrieval allows you to handle this situation and receive the correct value. For each cycle, the counter retrieval mode shows the increase in that counter during the cycle, including rollovers.

Note: If Historian receives a data tag value that is outside of the specified engineering unit boundaries, Historian ignores the received value and instead returns a 0. For example, if a value can be an integer between 1 and 8, and the received value is 9, Historian returns 0 as the value for that tag during that cycle.

Counter retrieval also works with floating point counters, which is useful for flow meter data. Similar to the carton counter, some flow meters "roll over" after a certain amount of flow accumulates. For both examples, the need is to convert the accumulating measure to a "delta change" value over a given period.

Counter retrieval is a true cyclic mode. It returns one row for each tag in the query for each cycle. The number of cycles is based on the specified resolution or cycle count.

The counter algorithm is only applied to analog tags and to discrete tags. For integer analog tags, the result will be an integer returned as a float data type. For a real analog tag, the rollover value and the result may be real values and can include fractional values. If a query contains tags of other types, then no rows are returned for those tags. For discrete tags, the rollover value is assumed to be 2.

The rules used to determine the OPCQuality returned with a counter value are the same as for a time weighted average query. For more information, see Quality rule (wwQualityRule). When a rollover has occurred in the calculation cycle, a special quality detail of 212 is returned in all non-NULL cases.

CTU counters will default to "signed integer" tags when imported into the Historian, giving a normal range of -2147483648 to 2147483647 (for a 32-bit integer). In operation, these counters will count up to the upper limit and "rollover" to the lower limit on the next increment. If these tags are changed to be "unsigned integers" the normal range will be 0 to 4294967295 and values will rollover to "0", conforming to the expected behavior of a tag used with "counter" retrieval. When used with a 16-bit CTU counter, the same rules apply, but the range of values is -32768 to 32767 as "signed" and 0 to 65535 for an "unsigned".

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