Working on a feature where the user wants to be able to able to print a report for an entire day to see all the alarms that happened in that day, including who acknowledged the alarm.
Right now, I have something like to generate the start/end dates of my alarm query
def generateAlarmFileForFullDay(day):
"""
Get's all alarms for a specified day and creates a report that is put into a mapped drive folder.
Args:
day: datetime object from a calendar component that will be used to determine what days to use in calculation
Returns:
Creates file in specified place or throws an error
"""
beginningOfDay = system.date.midnight(day)
endOfDay = system.date.midnight(system.date.addDays(day, 1))
print beginningOfDay, endOfDay
alarmData = system.alarm.queryJournal(startDate=beginningOfDay, endDate=endOfDay)
for x in alarmData:
print x
And doing this prints data like :
{Source: 'prov:default:/tag:machine/PLC/Alarms/SFTY_Status:/alm:Safety Relay Opened', Display Path: '', UUID: '002523a5-d71b-4b3a-9f96-374cc5ac5b5b', Current State: 'Active, Acknowledged', Priority: 'Critical', Active Data: {systemAck=true, eventTime=Thu Jun 02 07:18:48 EDT 2022}, Clear Data: null, Ack Data: {ackUser=tag:Auto-Ack, eventTime=Thu Jun 02 07:18:48 EDT 2022}, Runtime Data: {eventState=Active}}
{Source: 'prov:default:/tag:machine/PLC/Alarms/SFTY_Door_Left:/alm:Left Door Open', Display Path: '', UUID: '5f1f05f4-4ef5-4401-ab97-4e4ffb53f7ee', Current State: 'Active, Acknowledged', Priority: 'Critical', Active Data: {systemAck=true, eventTime=Thu Jun 02 07:18:48 EDT 2022}, Clear Data: null, Ack Data: {ackUser=tag:Auto-Ack, eventTime=Thu Jun 02 07:18:48 EDT 2022}, Runtime Data: {eventState=Active}}
{Source: 'evt:System Startup', Display Path: '', UUID: 'c4542634-99e8-4c42-82ea-a80550d1ec48', Current State: 'Active, Unacknowledged', Priority: 'Low', Active Data: {eventTime=Thu Jun 02 13:28:54 EDT 2022}, Clear Data: null, Ack Data: null, Runtime Data: {eventState=Active, isSystemEvent=true}}
{Source: 'evt:System Startup', Display Path: '', UUID: '9365239f-2bb0-41aa-b2c6-feec4162466a', Current State: 'Active, Unacknowledged', Priority: 'Low', Active Data: {eventTime=Thu Jun 02 13:32:53 EDT 2022}, Clear Data: null, Ack Data: null, Runtime Data: {eventState=Active, isSystemEvent=true}}
{Source: 'evt:System Startup', Display Path: '', UUID: 'fdaa4e7a-cb21-4b33-87ec-14eacb804f4f', Current State: 'Active, Unacknowledged', Priority: 'Low', Active Data: {eventTime=Thu Jun 02 13:35:59 EDT 2022}, Clear Data: null, Ack Data: null, Runtime Data: {eventState=Active, isSystemEvent=true}}
I need some help interpreting the dictionaries here-
In the first two rows, I see the alarm was active and then acknowledged, I assume automatically due to ackUser=tag:Auto-Ack
. Is that a fair assumption? I can’t find any examples yet in this particular system where ackUser is anything other than tag:Auto-Ack
- what would I expect for a user manually acknowledging an alarm, the user name?
Further, inside the AckData dictionary, I assume the eventTime is when the alarm was acknowledged - is that right? In my example the activeData eventTime and the ackData eventTime are identical - presuming this is due to auto-acknowledging, but if a user took a few minutes the ackData would be whenever the user clicked “acknowledged”.
If someone can confirm (or revise) my understanding of what the data in these dictionaries represent that would very helpful. Thank you