Alarm Conditions
Registers a critical fault with a 5-second trigger delay using alm.e(),
prints its live value each loop, and shows the group/summary queries
(alm.v, alm.fV, alm.list, alm.max) plus resetting and acknowledging
faults with alm.rst/alm.ack.
let startTime = now();
while(run()){
// Set the current alarm group
alm.g("UV");
// Evaluate an alarm condition (also returns the current priority of the alarm (if active) or 0 if not alarming
let value = alm.e(
alm.crit, // alarm priority
"Reactor A Run Failure", // alarm title
startTime.sAgo() > 5 && startTime.sAgo() < 12, // alarm condition
5, // Alarm trigger delay (Condition must be true for this many seconds before the alarm activates)
true, // Alarm automatically clearable?
0, // Alarm clearing delay (Condition must be (false) AND alarm clearable (true) for this many seconds before the alarm automatically clears)
startTime // Optional argument, the current value e.g. reservoir level etc. Included in log messages which are automatically recorded when faults change states
);
print("Run Time: ", startTime.sAgo(), " Fault Value:", value);
let groupValue = alm.v("UV"); // If multiple faults exist per group this will return the highest priority active alarm. Multiple groups can be included as additional arguments
let faultValue = alm.fV("UV","Reactor A Run Failure"); // Get the value of a specific fault under the "UV" category
let faults = alm.list(); // Return an object with the status of all the registered alarms {"UV":{"Reactor A Run Failure":0}}
let max = alm.max(); // return the highest alarming priority across all groups
waitMS(1000);
}
// Resetting Faults
alm.rst(); // reset all the faults
alm.ack(); // acknowledge all the faults
alm.rst("UV","Reactor A Run Failure"); // Reset a specific fault
alm.ack("UV","Reactor A Run Failure"); // Acknowledge a specific fault.. An optional false argument can be appended to cancel the acknowledgement