Hello Ignition Forums!
Excuse my lack of scripting knowledge, still a nube in training
I have been given a task that requires me to prioritize the visibility of alarms based on low to critical priority. What I have done so far is set all the individual priorities for all the of the alarms in the Alarm Configuration in the UDT’s. If there is a way to group the Alarms through a script based on priority number that would be optimal, for now I will be manually grouping them through the alarm config.
What I believe needs to be done in technical terms
I need to be able to pull the Priority of the alarm from the alarm table and group it in Group A, B or C.
Based on which ‘Group’ of alarms are showing (Whether its 1 or 100 alarms), I want only the greatest priority to show.
I have designated my alarms in such groups below (the numbers are based on the system.alarm.queryStatus Ignition Doc).
Critical / 4 / Group A
High / 3 / Group B
Low / 1 / Group C
Thank you for the read! Any feed back is appreciated,
Best Regards,
Thomas Shank
Hey, how’s it going man?
I would love to be able to help! I’ve been working on something similar. But I have a few questions for clarity before I’m sure I have a solution.
First, what component are you using to view these alarms? (Since you mentioned visibility, I assume your using either an Alarm Status Table or Alarm Journal Table?)
Second, are you using another component to set a priority level you would like to see? For example, a dropdown component with all of the priorities (Diagnostic, Low, Medium, etc.) and whichever is selected only show alarms of that priority?
Or
Are you just looking to show them all at once but organized in a specific order by priority? For example, Critical alarms all at the top and Diagnostic alarms all at the bottom?
Thanks!
Edit : Also This table is accessed through a button, if I’m not mistaken this is important to activate the event or something.
Its going well! I thought I was close to getting it but my code looks like chicken scratch …
Thank you the reply, First I am using a Alarm Status Table, for the second question I don’t believe so. This is how the Alarm Table was originally setup. however I don’t think the priority column is a separate component that was integrated. I was handed this Alarm Table and was told what to do.
And this is what I was told to do, Simply display Only the most important alarms at the top. We have a system that is based off of 3 Levels of alarms. 1 (the highest) Communications, 2 Safety, and 3 (The lowest) Motion. The idea behind showing only Communications alarms even if there are safety and motion alarms active is because there’s no point in trying to solve a safety or motion alarm if you have no communications over the machines. Or these is no point in solving a motion fault if a Safety fault is in place. It is meant for maintenance efficiency.
I have been playing around trying to use getPriority and if statements to organize them into specific tables with event.alarmQuery but I don’t even want to post my sample code its quite bad. Taking a python course on Udemy as of 12PM rofl.
Thank you for the help!
Best regards,
Thomas Shank
Can you use the built in sorting on the alarm status table component? You can change the sort order property to order by priority first. In your screenshot it is ordering by state before priority.
1 Like
Im not worried about the order that the information is displayed, Active Time/Display Path/Current State/Priority is what we wanted. I’m looking for a solution that will allow us to disable visability all other alarms below the critical level so we can focus primarily on the critical level alarms, then fix the high level, then to the low and so fourth.
Haha I totally understand, man. We all have to start somewhere lol. Don’t worry it gets a lot easier, and you’ll get better!
But okay, I think I’m getting the concept of what you are trying to do. It sounds to me that you basically have to go through all active alarms checking for the ones with the highest priority and displaying only the alarms with that priority.
For example, if you have 5 Communications alarms, 2 Safety alarms and 2 Motion alarms you would only like to display the 5 Communications alarms. Similarly, if you have 0 Communications alarms and 2 Safety alarms and 2 Motion alarms, you would only like to display the 2 Safety alarms.
Is this correct?
If this is the solution you’re looking for, I think I can help you!
1 Like
Correct!
Thank you so much xD!
The lower level alarms still need to be shown after fixing the higher level ones. So we can’t be disabling any alarms just using a viability property of some sort
1 Like
Also, do you only want to see Active and Unacknowledged alarms?
1 Like
Yes please, this is going to help so much.
No problem!
Okay I see, you mentioned that you set up alarms for these tags already correct? And when you did so did you set the priorities for them correctly? i.e. a Communications alarm sounds to me like it would have a priority of ‘Critical’ or ‘High’
Also, are you familiar with the Property Editor in Ignition and know where to find it? I believe I see it up in the left corner of the photo you provided.
1 Like
I have set all the priorities and alarms already. That was the first step I was given
I am familiar, I have done a little bit of simple scripting before but I usually only use it for window navigation
Do you think you could post a picture of the bottom section of the Property Editor under the subsection called ‘Filters’? Because I believe that Ignition has a default ordering system for alarms where the highest priority alarms should already be at the top and since you would like to see the alarms with lower priorities simultaneously you shouldn’t have to make much of a change.
But if you could send a photo of that subsection of the Property Editor that will help me diagnose the problem!
1 Like
It’s just for cleanliness. The visibility is important because people here will not try to focus on critical alarms first. I know that sounds illogical but there is not a lot of that around so we have to make it as easy as possible.
Sometimes if something very wrong happens a bunch of alarms will pop up at once and people begin trying to fix what they can rather then trying to fix whats important and end up screwing things up even more.
And I’ve also noticed that they don’t organize themselves by priority by default. heres another picture.
You can bind your minimum priority property on the alarm status table to an expression runScript and in the script try something like this
def getHighestPriority():
alarmStatusInfo = system.alarm.queryStatus()
alarmPriorities = {'Diagnostic': 0, 'Low': 1, 'Medium': 2, 'High': 3, 'Critical': 4}
highestPriority = 0
for alarm in alarmStatusInfo:
priority = str(alarm.getPriority())
if alarmPriorities[priority] > highestPriority:
highestPriority = alarmPriorities[priority]
return highestPriority
This will return the highest priority of all the alarms queried. You can do more filtering if you only want to look at specific alarms or groups of alarms with the system.alarm.queryStatus function.
Based on your screenshot you will need to use the displayPath filter when calling queryStatus, if you go this route.
https://docs.inductiveautomation.com/display/DOC79/system.alarm.queryStatus
1 Like
I will definitely play around with this a little bit, Do you think it would be wise to group the alarms first before using a visibility property or??
Still fairly iffy about how this works, Jeez building this from scratch would have been a nightmare. This is really a wake-up call to learn some python lmao
Okay, hold on. So after reading your reply to the other person, I think I misunderstood a little.This is a little bit of a difficult task but I think I can still help you!
Unfortunately, I have a meeting but I will get back to you as soon as I can if you have not found a solution yet.
1 Like
Is there anyway to say in python something along the lines of Display highest priority only ? So for example if I have 4 high alarms and 2 critical alarms, the 2 critical alarms will only show until theyre both acknowledged and cleared, and then the 4 high alarms will appear.
If yes, Ill try to figure it out. If I can’t find a solution on my own ill come back to this thread but I would like to do some picking to see if I can figure it out
Yes, that filtering would be done using the filtering parameters of system.alarm.queryStatus. You will have to make use of the filters or my code will not work right. I did not see your screenshot before I replied so it will defiantly not work right if you don’t use the displayPath filter you are using in the table. Also I didn’t include a state filter which you probably will want to.
1 Like
Hello jordan I’m really glad you found my post. I’ve made some edits to your code and attempted to add a state filter. This is what I’ve managed to come up with. I feel like there is more I needed to get the displayPath filter to work and on top of that I really have no idea where to start on the visibility section of the script. Any hints that could point in the right direction and not give it away ? here is what I have so far