Description: This function defines and activates alarm events.
Returns: Nothing
Usage: Steady State
Format: Alarm(Trigger, Acknowledge, Enable, Disable, Option, Level, Category, Message1, Value, Message2)
Parameters: Trigger { numeric } { required } { no default: }
Trigger is any numeric expression that triggers the alarm when true (non-zero), and resets the alarm when false (0).
Acknowledge { Boolean } { required } { no default: }
A control value that acknowledges the alarm. A false to true transition after the alarm has occurred acknowledges alarm. The alarm remains in the unacknowledged list until it is acknowledged. If the alarm is already in the unacknowledged alarm list when the alarm occurs, it is not placed in the list twice. The Acknowledge parameter is automatically reset when it becomes true in a valid Alarm statement.
Enable { Boolean } { required } { no default: }
Enable is a control value. A false to true transition enables the alarm. The Enable parameter is automatically reset when it becomes true in a valid Alarm statement.
Disable { Boolean } { required } { no default: }
Disable is a control value. A false to true transition disables the alarm. The Disable parameter is automatically reset when it becomes true in a valid Alarm statement.
Option { numeric } { required } { no default: }
The selected options are chosen by adding together all the numbers associated with each option from the following table:
|
Option |
Bit No. |
Attribute |
|
1 |
0 |
Print message when alarm occurs & clears |
|
2 |
1 |
Print enables and disables |
|
4 |
2 |
Print acknowledges |
|
8 |
3 |
Place alarm in log list |
|
16 |
4 |
Place enables and disables in log list |
|
32 |
5 |
Place acknowledges in log list |
|
64 |
6 |
Place alarm in file |
|
128 |
7 |
Place enables and disables in file |
|
256 |
8 |
Place acknowledges in file |
|
512 |
9 |
Place alarm in active list |
|
1024 |
10 |
Place alarm in unacknowledged list |
|
2048 |
11 |
Beep when alarm occurs |
|
4096 |
12 |
Beep when alarm clears |
|
8192 |
13 |
Include value in the alarm message |
|
16384 |
14 |
Place alarm occurrences and disables in log list |
Level { numeric } { required } { no default: }
Gives the level of the alarm. The alarm level is generally used to assign a priority to the alarm message. The valid Level values are 0 to 15 inclusive. The values for the Level descriptions are:
|
Level |
Meaning |
|
0 |
Information |
|
1 |
Caution |
|
2 |
Warning |
|
3 |
CRITICAL |
|
4 |
**URGENT** |
|
5 |
**URGENT** |
|
6 |
**URGENT** |
|
7 |
**URGENT** |
|
8 |
**URGENT** |
|
9 |
**URGENT** |
|
10 |
**URGENT** |
|
11 |
**URGENT** |
|
12 |
**URGENT** |
|
13 |
**URGENT** |
|
14 |
**URGENT** |
|
15 |
**URGENT** |
Category { numeric } { required } { no default: }
Any numeric expression giving the category of the alarm. Category is generally used to indicate the area of the plant or process in which the alarm is located. The valid alarm categories are 0 to 255 inclusive. There are no default categories; all categories must be defined using the AlmCatName function.
Message1 { text } { required } { no default: }
Any text expression giving the first alarm message. This message is generally the main alarm message.
Value { numeric } { required } { no default: }
Any numeric expression giving a value to be included in the alarm message. This value is often the value of the parameter causing the alarm. Value is frozen at the time the alarm is triggered so it can be used to determine the value at the time of the alarm.
Message2 { text } { required } { no default: }
A text expression giving the second alarm message. This message is often the units for the Value parameter or an alternate description of the alarm. If this parameter is not required, an empty text string may be used (i.e. " ").
Comments: Alarm may be used either as a statement or a function. As a function, its value is the acknowledge status of the alarm (true indicates acknowledged, false indicates unacknowledged). The last option in the Option list (16384) is intended for use with combined alarm lists where only the alarm occurrence and alarm disables need to be included in the log list. When the alarm printing option is chosen, the alarms are printed using the default Windows™ system printer.
Alarms generated using this statement work in conjunction with the other alarm functions and statements to complete the alarm system. Please refer to Alarm System for more information on alarms and alarm log files. You may also refer to the Save statement for a description of the file format, and the Get statement for information on how to retrieve data from that file.
Warning: If you have 2 applications in the same directory or launch another application without specifying a parent, you may corrupt the log file for the alarms.
Alarm lists are always maintained in chronological order.
For an example on how to set a rate of change alarm, see the Deriv function.
Example:
levelAck = Alarm(level > 36 { Alarm condition },
ackAll { Acknowledges all alarms },
0 { Don't allow enable },
0 { Don't allow disable },
32767 { Select all options in list },
2 { Priority level is WARNING },
0 { Category zero },
"High level:" { Message 1 },
level { Value },
" inches" { Message 2, units descriptor });
In the example displayed above, the statement sounds an alarm when the Level variable is strictly above 36. The alarm message is generated and placed in all 4 alarm lists (active, current, unacknowledged, and log), as well as written to the ALARMS.DAT file. If the Level should drop below 36, the message will be removed from the active list, and a new message will be entered in the log list and written to ALARMS.DAT. When the alarm is acknowledged, it will be removed from the unacknowledged list, and from the current list if Level is 36 or less.
The Enable and Disable parameters are 0; since alarms default to enabled, this means that this alarm may be enabled or disabled only with the AlmEnable statement.
This alarm may be acknowledged when AckAll changes from a 0 to a 1 (or any number other than 0), or by the AlmAck statement.
See Also:
AlarmCat | AlarmInst | AlmAck | AlmAckID | AlmArray | AlmCatName | AlmColor | AlmEnable | AlmList | AlmTone | Deriv | Get | NumAlarm | Redirect | Save