Sound buzzer on new alarm generated

Hi,

I have looked through some older posts and managed to get a script together to list currently active alarms that match certain ‘machine area’ properties by using system.alarm.queryStatus.
But i can’t quite figure out how to get a boolean trigger when a NEW alarm is detected.
I could examine the oldCount and the newCount from when the script was run last, but that wouldn’t work if one alarm is created, and one alarm is cleared in between script calls, as the counts would be the same.

Is there Ignition in-built trigger on new alarm entering the alarm journal or something that we could use?

I imagine someone has done something similar, could someone point me in the right direction?

I’ve just tested using an Alarm Pipeline which has achieved what i wanted, but i’m not sure that will allow for the flexibility i might want in future.

Cheers.

I guess most people just use that count, and possibly activate the alarm buzzer every x minutes while there are alarms active (or at least unacked alarms, so the operators can silence the buzzer).

If you really want, the result of system.alarm.queryStatus contains a lot of details about the alarms. So you could store that in a global variable (see system.util.getGlobals), and compare the list element by element in the script.

You could keep track of the latest time of the alarm events.

# read tag that holds latest event time
lastAlarmTime = system.tag.read('[default]path/to/latest/alarm/time').value

# get the underlying dataset from alarm status
alarmDataIn = system.alarm.queryStatus().getDataset()
# get the column names of the dataset
columnNames = alarmDataIn.getColumnNames()
# get the event times as a list
eventTimes = alarmDataIn.getColumnAsList(columnNames.indexOf('EventTime'))

# find the latest event time
maxEventTime = max(eventTimes)

if maxEventTime != lastAlarmTime:
	# Make some nooooooise!
	# write latest time back to tag
	system.tag.write('[default]path/to/latest/alarm/time', maxEventTime)
1 Like