AdHocAlarm
(Alarm Manager module)
Description: | Evaluates an ad hoc alarm |
Returns: | Nothing |
Usage: | Script Only. |
Function Groups: | Alarm |
Related to: | EvaluateAlarm |
Format: | \AlarmManager\AdHocAlarm(AlarmObj, CfgStructure, Value[, Timestamp, AlarmDB]) |
Parameters: |
AlarmObj |
Required. The object value of the tag this alarm is for. This is used to find the AlarmDatabase associated with the tag. If no AlarmDatabase is found within the scope of AlarmObj, it will default to using the SystemAlarmDB. Services may leave this parameter invalid. |
CfgStructure |
Required. A structure of alarm configuration parameters. Normally obtained by a call to \AlarmManager\GetAlarmConfiguration. |
Value |
Required. The new value to be checked against the alarm Setpoint. |
Timestamp |
Optional UTC timestamp of the value. Defaults to the current time. |
AlarmDB |
Optional name or object. The alarm database to be used for this alarm. Not necessary if the alarm object is valid. Defaults to the VTScada Alarm DB. |
Comments: |
You should not call Commission() or EvaluateAlarm() on an ad hoc alarm. You can call Ack() and SetShelved() on an ad hoc alarm. To activate/trip an ad hoc alarm, call AdHocAlarm() with a value that meets the alarm condition as defined by its Setpoint and Function. If you activate a (non-trip) ad hoc alarm, you are responsible for clearing it by calling AdHocAlarm() with a value that doesn't meet the alarm condition. If there is no known Setpoint, a Setpoint of 1 is often used, where a Value of 1 and 0 will activate and clear the alarm respectively. (Assuming the Function is ==) To activate, trip, clear and acknowledge a unique instance of an ad hoc alarm, you must refer to the alarm using the same Name. At a minimum, you need to configure Name, Area, Description, Priority and Setpoint. Other alarm configuration options are available such as Function, Trip, OnDelay, Deadband, Units, Custom, etc. It is not necessary to set the AdHoc field since that is set by AdHocAlarm(). The Name field must be unique among all alarms, including ad hoc alarms. A FriendlyName should not be specified for an ad hoc alarm since it is not logged or distributed to other servers. If the Name is the UniqueID of a tag, the current name of the tag will be shown on the Alarm Page. Otherwise, only the Name field will be shown, not the FriendlyName. |
Example:
Example of an ad hoc alarm with the minimum amount of configuration. It will activate when the value is equal to 1. To clear this alarm, call AdHocAlarm() again using the same Cfg but with a Value of 0.
Cfg = \AlarmManager.GetAlarmConfiguration(); Cfg.Name = "My Ad Hoc Alarm"; Cfg.Area = "My Area"; Cfg.DescPhraseID = PickValid(Description, Cfg.DescPhraseID); Cfg.Priority = 1; Cfg.Setpoint = 1; \AlarmManager.AdHocAlarm(Self(), Cfg, 1 { value });
Alarm API Structure Definitions - Alarm configuration structures