I need an advice about a new feature I have to implement in WinCC OA: we would like to introduce a new very critical alert class.
If at least one alert of this class is active (came and not acknowledged) an action is executed (set a specified DPE to true or/and something else). When there are no more active alerts of this class another action is excetuted (set a dpe to false or/and something else) to reset the critical condition.
what do you think is the best way to do this ?
I thought to use the action functionality of _alert_class to keep a list of all active alerts on a special DPE. When a new alert come the script adds it on the list and executes the action for a critical situation. When the alert is gone or is acknowledged the script removes it from the list. If the list is empty the scripts resets the critical condition.
What do you think about this solution?
AUTOMATIC ACTION FOR CRITICAL ALERTS
- riccardo.crociani
- Posts:34
- Joined: Tue Mar 31, 2015 12:52 pm
AUTOMATIC ACTION FOR CRITICAL ALERTS
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: AUTOMATIC ACTION FOR CRITICAL ALERTS
I would approach this issue like this:
First make an alert class for the critical alerts and assign all require datapoints to it.
Then make a controls script with a dpConnect with a dyn_string containing the names of all of the critical alert DPs that you want to monitor then each time any of them changes state the work function will be called and it has a dyn variable containing the state of each datapoint. Using dynContains you can check if any of the have the state "came and not acknowledged" then proceed accordingly.
First make an alert class for the critical alerts and assign all require datapoints to it.
Then make a controls script with a dpConnect with a dyn_string containing the names of all of the critical alert DPs that you want to monitor then each time any of them changes state the work function will be called and it has a dyn variable containing the state of each datapoint. Using dynContains you can check if any of the have the state "came and not acknowledged" then proceed accordingly.
- Gertjan van Schijndel
- Posts:634
- Joined: Mon Aug 02, 2010 10:37 am
Re: AUTOMATIC ACTION FOR CRITICAL ALERTS
Rudi Kreiner wrote:
A.) Use the top level SumAlertPanel datapoint. It should contain at least all your own important alerts. Perhaps you have to change the priority ranges, so the very critical alerts are in a separate range. And dpConnect to this sumalert for your action.
B.) Create a dpe with a sumalert (with a filter for very critical) with all required datapoints. And dpConnect to this sumalert for your action.
C.) Use a dpQueryConnectSingle to connect to all alerts with the very critical priority and include the visible attribute. Store/update the alerts in a list and remove them when they are not visible anymore and/or acknowledged. When the conditions are met execute the action(s).
I think this is a bad idea. Better would be to either:Then make a controls script with a dpConnect with a dyn_string containing the names of all of the critical alert DPs that you want to monitor then each time any of them changes state the work function will be called and it has a dyn variable containing the state of each datapoint. Using dynContains you can check if any of the have the state "came and not acknowledged" then proceed accordingly.
A.) Use the top level SumAlertPanel datapoint. It should contain at least all your own important alerts. Perhaps you have to change the priority ranges, so the very critical alerts are in a separate range. And dpConnect to this sumalert for your action.
B.) Create a dpe with a sumalert (with a filter for very critical) with all required datapoints. And dpConnect to this sumalert for your action.
C.) Use a dpQueryConnectSingle to connect to all alerts with the very critical priority and include the visible attribute. Store/update the alerts in a list and remove them when they are not visible anymore and/or acknowledged. When the conditions are met execute the action(s).
- riccardo.crociani
- Posts:34
- Joined: Tue Mar 31, 2015 12:52 pm
Re: AUTOMATIC ACTION FOR CRITICAL ALERTS
Thank you very much for your solutions.
I've thought to create a dedicated control script with a dpQueryConnect or something like that, but since it is related to very critical situations I would not base the solution over a custom control script.
There is always the possibility that the script stops working for any reasons (crash of the script, switch on the redundant system that is not aligned, etc...). I know that it should never happen something like that, but it does! trust me, we have a lot of scripts :S
That is why I proposed to use the "Alert Action" functionality of the _alert_class: the script it's executed by the Event itself, isn't it ? Once I've tested the code for the "alert come", "alert gone", "alert acknowledged" I just have to associate the right alert class to the critical datapoints.
Moreover I don't want to modify the script to add or remove a critical datapoint, and the set of critical datapoints could change dynamically.
Do you think is a bad approach ?
I've thought to create a dedicated control script with a dpQueryConnect or something like that, but since it is related to very critical situations I would not base the solution over a custom control script.
There is always the possibility that the script stops working for any reasons (crash of the script, switch on the redundant system that is not aligned, etc...). I know that it should never happen something like that, but it does! trust me, we have a lot of scripts :S
That is why I proposed to use the "Alert Action" functionality of the _alert_class: the script it's executed by the Event itself, isn't it ? Once I've tested the code for the "alert come", "alert gone", "alert acknowledged" I just have to associate the right alert class to the critical datapoints.
Moreover I don't want to modify the script to add or remove a critical datapoint, and the set of critical datapoints could change dynamically.
Do you think is a bad approach ?
- nmnogueira
- Posts:125
- Joined: Thu May 05, 2011 12:59 pm
Re: AUTOMATIC ACTION FOR CRITICAL ALERTS
I would follow Gertjan's advices.
Pay attention that if you have a script that is run by the Event manager and that script crashes, it can lead to a crash of the Event manager itself (which is a bit worse than a crash of a simple script...).
Also, with your approach you would still need to keep track of the active alarms, which would be hard to do that way.
Pay attention that if you have a script that is run by the Event manager and that script crashes, it can lead to a crash of the Event manager itself (which is a bit worse than a crash of a simple script...).
Also, with your approach you would still need to keep track of the active alarms, which would be hard to do that way.
- riccardo.crociani
- Posts:34
- Joined: Tue Mar 31, 2015 12:52 pm
Re: AUTOMATIC ACTION FOR CRITICAL ALERTS
Hi Nuno,
thanks for your remark.
thanks for your remark.