07-21-2022 02:14 PM
Hello,
I wrote an object for a temperature control unit.
There is a command set parameters , start and stop.
This means it is possible that the temperature control unit is running but the unit is in ExecState ready.
In OnUnitOperational, I evaluate the status of the device and, if necessary, trigger an error message.
The error message can be seen in the HMI and the ExecState of the Object unit goes to Error, but automatic mode continues.
How can I stop the operating mode from inside the object?
I thought there is a Cancel through the Backbone...
Solved! Go to Solution.
07-22-2022 06:49 AM
In general, Cancel is propagated from the top to the bottom. So if you want to use the cancel mechanism, then the command handler first has to issue it (or be triggered by its parent handler) and then this will reach the object. But this is not what you want anyway. You want the object to throw the error and then this error to propagate from bottom to the top.
The error _event_ is propagated upwards automatically, but this is really only for showing the event. This has no control effect. For this you need to look at the ExecState of your hierarchy, like you correctly do, and investigate what happens to the states and how they switch to error (the unit state OpconUnitState.ERROR and events of type OpconEventClass.ERROR are two separate and only loosely connected concepts).
If a unit switches to error, then this is _not_ automatically propagated upwards. In your normal station application this seems to happen but this is a feature that comes from your handlers' command chains using ExecuteUnit(RepeatOnError := FALSE, ..) or CheckUnitDone(RepeatOnError := FALSE, ...). The application guideline has some very detailed description about this mechanism. Everyone should be familiar with this.
But the application guideline will not have a straight answer to your problem. Here are some things that you can do:
Maybe somebody else has some other suggestions? I would probably pick option 1 and delegate the problem to the parent command handler. When programming an object, it is not that object's task to manipulate the control flow of the entire station's application it is embedded in. That is the business of the handlers, which are programmed by the application engineers. You may want to put some hints and possibly examples in your object documentation to inform your object users that this is a common pattern they might need in their application.
07-22-2022 12:24 PM
Thank you very much for the detailed explanation
07-22-2022 01:24 PM - edited 07-28-2022 10:02 AM
Very Good answer by MarvinW!
Option 3 is for example implemented in the Set Event add-on (NexeedSetEventAddon):
The add-on sets ModeHandler.Unit.Cancel / StopRequest / RunEmptyRequest.
You should keep in mind that it can be very difficult in an application to find the reason of a cancel. At least you should make this very clear to the programmer (and operator by showing an error message).
Currently the safety add-ons (ControlOn, MainValve, SafetyValve, SafetyDoor) and the Set Event add-on can cause a global cancel on the ModeForwarder/ModeHandler (depending on which one the add-ons are located).