Accumulate

(Hierarchical Accumulator module)

Description: Adds a tag and a value to be counted for that tag, to a named accumulator.
Returns: Invalid
Usage: Script or steady state.
Function Groups: Variable
Related to: GetValue | GetContainerNumActive | GetContainerNumUnacked
Format: \HierarchicalAccumulator.Accumulate(TagObj, AccumulatorName, Value [,LocalUniqueID]);
Parameters:  
TagObj
Required. The tag object that is contributing to the count
AccumulatorName
Required. The name of the accumulator that the tag is contributing to. For example, two accumulator names in use by the Alarm Manager are, "AlarmUnacked" and "AlarmActive". If creating your own accumulator, you may use any name you wish.
Value
Required. The current value to count for the TagObj\LocalUniqueID. Commonly a 1 or 0.
LocalUniqueID
Optional. If one tag contains items to be accumulated, use this field to provide a locally unique identifier for each.
Example: for accumulation of active alarms in Analog Status tag, this parameter will be "Hi" or "Lo", depending on which built-in alarm is being counted.
Comments:

The Accumulate function always returns Invalid. It may be called in steady state (for concise code), or as a subroutine call in a script to save RAM.
This function is part of the HierarchicalAccumulator module, so must always be called as shown in the format. You will need this function if creating a new type of tag, which also contains its own built-in alarms. You may create an accumulator for any property of your tag.

The accumulator enables a fresh count to be generated at different levels in a tag tree, and as tags are moved or disabled.

Access to the accumulation of active and unacknowledged alarms is provided by the Alarm Manager's GetContainerNumUnacked and GetContainerNumActive functions.
To access accumulations of your own creation, use the \HierarchicalAccumulator.GetValue function.

Examples:

  If Watch(1, AlarmLoUnacked);
  [
    \HierarchicalAccumulator.Accumulate(Root, "AlarmUnacked", AlarmLoUnacked != 0, "Lo");
  ]