I am using the system.alarm.shelve script in a gateway timer script to hide unwanted alarms. The problem is that this script takes alot of the CPU (between 1.4% and 5%), creating clock drifts. Here is what I see in the gateway log:
ClockDriftDetector 23Feb2018 08:59:04 Clock drift, degraded performance, or pause-the-world detected. Max allowed deviation=1000ms, actual deviation=1814ms
The script runs every 3 seconds, here is the script:
import re
listToShelve = []
stringToShelve = system.tag.read("stringTag").value
if stringToShelve != "":
for path in re.split("[,;]",stringToShelve):
if len(path):
listToShelve.append("*"+path+"*")
if len(listToShelve)>0:
system.alarm.shelve(path=listToShelve,timeoutSeconds=10)
How many alarms are you trying to shelve every 3 seconds? I don't think this a good approach to unwanted alarms. From the docs:
Shelving alarms allows you to temporarily silence an alarm for a fixed period of time. This feature is extremely handy when an alarm is already active and you want to temporarily silence the alarm while you're working on the issue.
Why not simple disable those alarms instead of playing whac-a-mole with them? Barring that, you might consider increasing the timeoutSeconds and rate of the timer event. Or you could create an Alarm Notification Pipeline for those undesired alarms that triggers the automatic shelving.
we have approximatly 50 alarms that we want to hide. We use this feature to allow the maintenance team to work on our system without showing the alarms to the operator using only a client, so no access to the designer.
Also, I thought at the beginning that using this function would allow us to see the alarms in the shelved section of the Alarm Journal, but we noticed they didnât appear there just after implementing it. Even the script âsystem.alarm.getShelvedPathsâ doesnât show the alarms shelved with âsystem.alarm.shelveâ.
Iâll try the automatic shelving with an Alarm Notification Pipeline.
@pturmel,
we use the wildcards because we want to hide the alarm from multiple equipment easily.
If the alarms arenât active to begin with then your script wonât shelve them. Do you know whether or not they stay shelved if they transition to âclearâ while in the shelf? Iâm not sure if they do or if theyâre evictedâŚ
Seems like you might want to have a Boolean client tag for âmaintenance modeâ. In your pipeline you can check the status of that tag before deciding to shelve the alarms that are raised.
I would classify them as low priority or even diagnostic, then on the alarm summary page just filter for Priority>Diagnostic when normal users are logged in, and remove the filter when Maintenance is logged in.
This way the alarms will still go through normal workflow without the operators having to deal with them.
I donât know precisely how it works, but no, I donât think it has an optimized list in gateway memory of active alarms.
You can test this yourself. In the top level of your script module (which runs just once), use the tag browse functions to search the tree and expand your wildcards into a list of tag objects. Then your timed script can iterate that list to find the alarms to shelve, and submit an explicit list to shelve().
I did an alarm pipeline in which I redirected half of the alarm in the project, this caused the gateway to monitor clock drifts again.
After that, I tried to shelve a specific list of alarm like @pturmel suggested. This method works fine from the script console of the designer, but not in a gateway timer script.
Here is the script:
import re
activeAlarms = system.alarm.queryStatus(state = ["ActiveUnacked", "ActiveAcked"],includeShelved = True)
stringToShelve = system.tag.read("[DomInter]AppsConfiguration/BHS/AlarmsToShelve").value
listShelving = []
source = ""
displayPath = ""
alarmsToShelve = []
if stringToShelve != "":
for word1 in re.split("[,;]",stringToShelve):
listShelving.append(str(word1))
for alarm in activeAlarms:
source = str(alarm.getSource())
displayPath = str(alarm.getDisplayPath())
for word2 in listShelving:
if source.find(word2) != -1 or displayPath.find(word2) != -1:
alarmsToShelve.append(source)
break
system.alarm.shelve(path = alarmsToShelve,timeoutSeconds = 30)
When I run this in a gateway timer script, the ShelfExpiration property doesnât update.
I think my last resort is to create a custom alarm journal. This will allow me to have full control on what the operators can see.