GetAlarmStateStats

(Alarm Manager module)

Description:

Returns a structure containing the cumulative alarm state statistics for the specified tag. (See following notes.)

If the tag is the ancestor of multiple alarm tags, the stats will be the accumulation of all descendent alarms.

Returns: Structure
Usage: Script or steady state.
Function Groups: Alarm
Related to: GetAlarmObject
Format: \AlarmManager.GetAlarmStateStats(TagInstance)
Parameters:  
TagName
Required object reference. The tag for which statistics are to be gathered.
Comments:

TagName may be a context or other parent, in which case statistics will be gathered for all of the child tags.

It may also be Code, in order to retrieve statistics about the whole application.

Information returned by this function is not limited by realm-area filtering.

The return structure includes the following elements:

ActiveCount { Total Active alarms including descendents };
UnackedCount { Total Unacked alarms including descendents };
ShelvedCount { Total Shelved alarms including descendents };
DisabledCount { Total Disabled alarms including descendents };
SuppressedCount { Total Suppressed alarms including descendents };
HighestActivePriority { Highest priority of active alarms including descendents };
HighestUnackedPriority { Highest priority of unacked alarms including descendents };
ActivePriorities { Dictionary of counts of active alarms for each priority, including descendents };
UnackedPriorities { Dictionary of counts of unacked alarms for each priority, including descendents }

 

The dictionaries, ActivePriorities and UnackedPriorities are keyed by alarm priority numbers, which are padded with zeros. For example, the key to access the count of Critical active alarms is "0001".

These dictionaries will return an invalid if there are no alarms that match your query. A valid value will not be returned until a specified alarm has been generated. To protect against an invalid return from the expression, especially if value returned is to be included in reports or displayed on a screen, the expression should be wrapped in a PickValid() so a valid value will always be returned. For example: PickValid(\AlarmManager.GetAlarmStateStats(\Root).ActivePriorities["0001"], 0)

Example 1:

  TotalStats           = \AlarmManager.GetAlarmStateStats(MyContextTagName);
  TotalUnackedPriority = TotalStats.HighestUnackedPriority;

If there are two active critical alarms and three active high alarms, then...

  \AlarmManager.GetAlarmStateStats(\Root).ActiveCount 

returns 5

  \AlarmManager.GetAlarmStateStats(\Root).HighestActivePriority

returns 1

  \AlarmManager.GetAlarmStateStats(\Root).ActivePriorities["0001"] 

returns 2

(Refer to the note in the comments: Invalid will be returned until there are alarms that match the query.)

Example 2:

Given an application where the only current alarm is from a Roster Alarm Test, the following statement:

  AlmStats = \AlarmManager.GetAlarmStateStats(\Code);

will set AlmStats to: