Cicode Programming Reference > Cicode Function Categories > Alarm Functions > AlarmCountEquipment

AlarmCountEquipment

Counts the available alarms for specified equipment and referenced equipment in conjunction with the selected filter criteria.

Syntax

LONG AlarmCountEquipment(INT Type [,STRING EquipmentFilter, [STRING FilterCriteria [, LONG KeepAliveSeconds [, INT CachedMode, [INT IncludingReference]]]]])

nType:

The type of alarms to display:

Non-hardware alarms

0 - All active alarms, that is Types 1 and 2

1 - All unacknowledged alarms, ON and OFF

2 - All acknowledged ON alarms

3 - All disabled alarms

4 - All configured (non-hardware) alarms, that is Types 0 to 3, plus acknowledged OFF alarms.

Hardware alarms

5 - All active alarms, that is Types 6 and 7

6 - All unacknowledged alarms, ON and OFF

7 - All acknowledged ON alarms

8 - All disabled alarms

9 - All configured alarms, that is Types 5 to 8

Alarm Summary

10 - All summary alarms

15 – Sequence of events with configuration events filtered out

16 - Sequence of events

Alarm General

11 - All ON alarms

12 - All OFF alarms

13 - All ON hardware alarms

14 - All OFF hardware alarms

17 - All unacknowledged ON alarms

18 - All unacknowledged OFF alarms

If you omit the Type, the default is 1.

EquipmentFilter:

A comma-separated list of equipment names or categories (RefCat) to filter alarms prior to applying the other filter specified on the FilterCriteria argument. This field has been extended to support wildcards, and hence accept partial filter strings.

Filtering using an equipment name or category (RefCat):

Expression has been extended to allow:

What this means is:

Note: FIlters that take the form “XYZ” should no longer be used. It is recommended you use the “EQUIPMENT=XYZ” form, further “XYZ” can now be expressed as “EQUIPMENT=XYZ,EQUIPMENT=XYZ.*” as this will include all items on the “XYZ” equipment and all items on sub-equipment of the “XYZ” equipment.

FilterCriteria:

A filter name OR filter text.

See the topic Implementing Alarm Filters Using Cicode in the main Citect SCADA help for more information about filter syntax.

KeepAliveSeconds:

Optional length of time (in seconds) that the count will remain in memory. Default is 30 seconds.

CachedMode:

Optional flag that causes the current cached value to be supplied even when the value is being refreshed. This makes the function non-blocking. If the property has not yet been cached, an error is set.

0 - Do not force cached read. Cicode is blocking

1 - Force cached read. Cicode is non-blocking

Default value is 1 (true).

A count in memory will be accessed when its filter criteria matches a subsequent filter criteria and the count’s "KeepAliveSeconds" period will be extended.

A count will stay in the cache for 'at least' the duration specified by "KeepAliveSeconds", and may stay in the cache for an unspecified period of time before being discarded.

The period set for an existing count will be overridden in the event a longer duration is set using 'KeepAliveSeconds".

A count that is added to the cache is not immediately available for reading, so a foreground call to AlarmCount that causes a new count to be added will return a value of -1 and an error of 345 (Data not ready).

IncludingReference:

0 - Do not include alarms belonging to referenced equipment in Alarm Count for current equipment

1 - Include alarms belonging to referenced equipment in Alarm Count for current equipment. This is set by default.

Return Value

Returns counted alarms for the selected filter criteria. Returns -1 when an error is detected.

Example


// counts all unacknowledged alarms, ON and OFF (default non-blocking Cicode) in Plant.Area.Room* equipment and any lower-level equipment.
iRet = AlarmCountEquipment(1, "Plant.Area.Room");

// counts all disabled alarms (default non-blocking Cicode) in any lower-level equipment from Plant.Area.
iRet = AlarmCountEquipment(3, "Plant.Area.");

// counts all unacknowledged alarms in Plant.Area.Room*, Plant.Area.Flat* equipment and any lower-level equipment with category 10 (non-blocking Cicode)
iRet = AlarmCountEquipment(1, "Plant.Area.Room, Plant.Area.Flat", "Category=10", 1, 1);

// counts all unacknowledged alarms in Plant.Area.Room.*, Plant.Area.Flat.* equipment and any lower-level equipment with category 10 (non-blocking Cicode). 
// Note that Plant.Area.Room and Plat.Area.Flat equipment themselves do not count as a period is given at the end of each expression.
iRet = AlarmCountEquipment(1, "Plant.Area.Room., Plant.Area.Flat.", "Category=10", 1, 1);

					

Related Functions

AlarmCount, AlarmCountList

See Also

Alarm Functions

Published June 2018