Hello, I am using the Alarm Status Table in Perspective, and I want to make it so that operators can only shelf an alarm once. After the shelf time passes, the alarm cannot be shelved again while its still active. Any help is much appreciated, thank you!
The Alarm Status table is a great starting point for many (most) use cases. However, there is a limit to the customization that can be added to it.
You might be at a point where building your own Alarm Status table would be preferred. You can query the alarms, handle each alarm as a PyAlarmEvent object, and ultimately display all of these in a standard table component. Doing so provides much more control over specific needs - like scripting your own shelving.
Or the middle ground here might simply be to use the built-in Alarm Status table, but disable the ability to shelve/unshelve alarms from the table itself. Then add your own shelving button elsewhere that allows you to script your own shelving with your custom needs.
disable shelving on the table. Then provide a button which process the request, using system.alarm.shelve()
to shelve the alarm if the action should be permitted.
So I made by own button to shelve an alarm, but I'm still having trouble with the script part. I'm using: system.alarm.shelve(path=alarmPath,timeoutMinutes=3)
and it works great, but I need a way to disable the shelvingAllowed
property for the alarm, so that they cannot be shelved again. The AlarmQueryResult object doesn't seem to have any methods for changing the properties of the alarm. Any advise is much appreciated!
You'll want to do something with the alarm tag to track if it's been previously shelved and then check that condition before the call to shelve()
on your custom button.
My big question would be, how does the shelving for an alarm get re-enabled?
Thanks for the reply, I think I would need to edit the properties of the alarm instance, instead of the tag. After the alarm clears, a new alarm can be raised with the default settings if the alarm condition gets met again. I am not sure if it works like this though.
If I have the button event script change the shelvingAllowed
property on the tag, I would need a way to have it be reset when the alarm clears. Any tips on this would be most welcome!
I think you're going to need a custom property on the tag, or a custom memory tag as part of a UDT for the alarm tag.
I'd try something like this:
custom bool prop "shelving allowed" - default to true when it gets shelved toggle this to false. Then when the alarm clears, set it back to true. Check this prop for each tag before the call to shelve()
.
You'll have some edge cases that you'll have to decide how to handle - for example, an alarm can clear while it's shelved.
Thanks! I'm super close now, I just need a way for the alarm to write back to the tag when it gets cleared. Any ideas on how to do that? Thank you so much for your help so far!
There should be an alarm clear change script in the tag. Make sure to check if it's currently shelved before you re-toggle your shelving allowed prop.
Also worth noting that this approach works when you have a single alarm per tag. If you're doing multiple alarms per tag you would need to do some more work. Maybe using each bit of an INT for each alarm.
Got it working! Thank you so much!
As for the details discussed here on how to monitor if the alarm has been shelved previously, I believe Ignition already has a built-in method for this. Using this method requires less custom work, less edge cases, proven reliability, and scalability across many alarms.
I would always leave the shelvingAllowed property enabled. Then, store the shelved events (see screenshot below). Toggling this should store a shelved event to the alarm journal tables. When running a script to shelve an alarm, I would check these tables for the uuid of the alarm to see if a shelved event has already been logged.
This system works on the individual instance of an alarm and doesn't require a bunch of change scripts to maintain the configuration of the alarm itself.