I already posted this a while ago to the ScadaBR developers mailing list. For those who are not subscribed there, here it is again:
Dear ScadaBR Users and Developers,
I would like to implement an "action" that is run when a user
acknowledges (green check mark) an alarm. For a start, I looked into
the active and inactive actions of the SET_POINT event handler type.
Ideally, there should be a target point (similar to active and
inactive actions) that gets set when a user acknowledges an alarm.
At the end I think I will need to alter the EventHandlerVO class. This
class is rather big and kind of intimidating for a beginner. Now I
wanted to ask: Do you think my approach is feasible? Do you see big
problems with it or would it just take some time? Do other solutions
pop up your mind?
Best Regards,
Michael Bach
Hello Michael,
Recently we added the Script feature to ScadaBR, it also was added a new treatment to eventHandler. But I guess the approach would be a little different, since your are trying to create a whole new event from a alarm.
This should create 2 events from 1 alarm set - the configured event/alarm, and the acknoledgement event. And you should treat as the events existing... I guess this would be the easyest way.
Take a look at DataPointDao, DataPointVO, PointEventDetectorVO classes... It should be easy to add a new type of Event TYPE, and automatycally add a ack event detector.
I recommend you to add a checkbox in the event for creating a ACK Event for that alarm. Check dataPointEdit.jsp for that, and dataPointEdit.dwr also.
So, this is how I would do it... =]
Thanks Michael, get back to us, please. I´d like to know how it goes =]
Hi Diego,
good to hear from you :)
Yes, 2 events from one alarm would be it. This way, the acknowledge event would be listed in the "Alarms" as well, serving as a kind of an "acknowledgements log".
I get your point with the ACK event check box from the "Event detectors" editor. But then I would need to manually add an ack event handler that is associated only with the data point (from which the event was created) in the "Event handlers" menu (not with the alarm). So there would be an acknowledge event for each point event (logically on the same level) and the mapping would be difficult - i.e. which acknowledge event belongs to which point event?
I thought of handling the ack event, e.g. action to set point, inside the point event handler, similar to active and inactive actions where I could use the existing "Set Point" functionality. For the user it would be more logical to have the handling of actions concerning one data point and one alarm in the same submenu. E.g. "Define what happens when the alarm gets active (mostly set point action) and define what happens when I acknowledge that alarm (again set point action)."
Does that make sense?
Best,
Michael
Yes Michael,
I see your point! guess you are in the right track then.
My thoughs on it, would be creating a new ack event, for each event configured. But i guess you´re right. This makes more sense. But wich actions would be available?
Do you know which classes to change?
This could be an interesting feature for ScadaBR. We are also thinking in a "must comment" attribute for events acknowledge. What do you think?
Cya
The "must comment" attribute could be necessary for some events (critical or whatever) in certain applications - so I would make that mandatory for some events only... i.e. an admin defines which events need comments.
Back to Ack :) : Right now I am trying a more "hacky" solution, since I do not feel very comfortable with the classes involved for new event generation and later 'orchestration' :)
I managed to add an acknowledged action to EventHandlerVO (on the basis of existing active and inactive actions). I also managed to save and serialize the new event handler instances and adapted the eventHandlers.jsp to include the necessary selections.
The next step is to modify the ackEvent js function to call a MiscDwr.runAckEventAction(eventId) that executes the defined action(s). I am just looking for a method that returns all event handlers defined for an eventId. I could then traverse the list of event handlers and call their SET_POINT actions.
Do you know of such a function offhand?
Just to let you know: I managed to solve my problem without using another event.
I used the EventManager and my existing acknowledge actions. The 'missing link' was my misunderstanding that the private EventManager.setHandlers() is not a 'simple' setter, but instead creates the runtimes from EventHandlerVO's for a given EventInstance. With it, I was able to generate a Map<Integer, List<EventHandlerRT>> that maps events to their handlers. The acknowledge actions of the EventHandlerRT's matching a given eventId are then run in the manner of the existing actions.
If you are interested in the implementation, I can send you a diff.
Best Regards,
Michael
That´s great! Of course we´d be interest in the diff. Let me check if we can add this feature to ScadaBR.
Have you managed to create the propor interface for this feature?
Thanks once again
The interface is just a third row with a select box in the eventHandlers.jsp in the fashion of 'active' and 'inactive' actions.
Can you give me an email address to send the diff to? My address is the same as the one I am registered with on the ScadaBR dev mailing list, so feel free to contact me on that one (see ml archives).
Cheers,
Michael Bach
Hello back Michael,
Sure, you can send the diff to contato@scadabr.org.br. I´l receive it, and test it.
Thanks