The code I have below will return a list of basic alarm events which looks like a list of dictionaries when printed. Before you can do anything with the returned object you’ll have to iterate through the list of dictionaries to get down to the individual alarm objects. I would need to see your full code to give you a complete answer, so I’ll give you an example and see if you can’t work through it.
I created a UDT with three OPC tags that are float8. Each of those tags have one alarm configured called “Alarm”.
status = system.alarm.queryStatus(source= [’*Alarm’]) ‘’‘returns as status all alarm objects that end in ‘Alarm’ as a list of dictionaries–each dictionary represents one alarm.’’’
for dict in status:
print dict ‘’‘this will iterate through each dictionary in your list and print it you can then you can see what the object looks like’’’
for dict in status:
print dict.getDisplayPathorSource() ‘’‘this will iterate through the dictionaries and return the source or path for each object’’’
Returns:
UDTs/alarmTest/sine1/Alarm
UDTs/alarmTest/sine0/Alarm
UDTs/alarmTest/sine1/Alarm
UDTs/alarmTest/sine0/Alarm
UDTs/alarmTest/sine0/Alarm
UDTs/alarmTest/sine2/Alarm
UDTs/alarmTest/sine0/Alarm
UDTs/alarmTest/sine1/Alarm
UDTs/alarmTest/sine1/Alarm
UDTs/alarmTest/sine1/Alarm
UDTs/alarmTest/sine0/Alarm
for dict in status:
print dict.priority ‘’‘will print the priority level of each alarm’’’
Returns:
Critical
Critical
Critical
Critical
Critical
Critical
Critical
Critical
Critical
Critical
Critical
for dict in status:
print dict.getState() ‘’‘will print the state of each alarm returned’’’
Returns:
Cleared, Unacknowledged
Cleared, Unacknowledged
Active, Unacknowledged
Active, Unacknowledged
Cleared, Unacknowledged
Cleared, Unacknowledged
Cleared, Unacknowledged
Cleared, Unacknowledged
Cleared, Unacknowledged
Cleared, Unacknowledged
Cleared, Unacknowledged
The full list of methods and extension functions available for the basic alarm event object are below. You can just append them to your object variable and play around.
ackData
acked
acknowledge
active
activeData
addPropertyChangeListener
class
clear
cleared
clearedData
contains
count
displayPath
displayPathOrSource
equals
forEach
get
getAckData
getActiveData
getClass
getClearedData
getCount
getDisplayPath
getDisplayPathOrSource
getId
getLastEventState
getName
getNotes
getOrDefault
getOrElse
getPriority
getProperties
getRawValueMap
getSource
getState
getValues
hashCode
id
isAcked
isCleared
isExtended
isInherited
isShelved
iterator
lastEventState
merge
name
notes
notify
notifyAll
of
priority
properties
propertyChange
propertyChangeListener
rawValueMap
remove
removePropertyChangeListener
set
setDirect
setRawValueMap
shelved
source
spliterator
state
toString
values
wait
Good luck!