Starting the event instance on object value (or state) change
Configuration for starting the event instance on a object value change consists of
- definition of an object (trigger), value changes of which are monitored
- conditions, which describe the state of a value, which causes the event start (value validity / invalidity, limit value states, value changes, process alarm presence, ...).
As a trigger for starting the event instance can be used:
- simple value (object name e.g. Sec, structure item e.g. SV.Record[2]^Item)
- whole structure (SV.Record), structure row (SV.Record[2]), structure column (SV.Record[0]^Item)
The first alternative monitors one value and if needed (the condition for the value state is met) generates the request to start the event.
The second alternative monitors several values. For each value, the test to meet the start condition is carried out, based on which request to start the event instance is generated. Sometimes a situation may happen that several changes occur at the same time in the monitored area. If these changes must be processed in successive steps, the option Sequential execution of several changed values must be checked in the event configuration. If not checked, a change of several values generates only one request to start the event, and it can result in loss of monitored changes.
Generated request includes information about
- the previous value of the monitored area - after the event instance start, the value is copied into the local variable _TRIGGER_VALUE_OLD, that must be defined appropriately
- a new value of the monitored area - after the event instance start, the value is copied into the local variable _TRIGGER_VALUE, that must be appropriately defined
- position of the change [row, column] - for simple value (for example the name of the object Sec) it is always [0,0]. For structured variables is the change position relative to the first row and the first column (for example on change of SV.Persons[2]^Name it will be [2,1]). Values are copied into the predefined local variables [_TRIGGER_ROW, _TRIGGER_COL] after starting the event.
If the request to start the event has been generated, the process D2000 Event Handler proceeds according to the option Create queue for event start requests in the event configuration:
- if the option is not checked and no event instance is running, the request will be accepted (event instance start)
- if the option is not checked and at least one event instance is running, in dependence on the fact, whether some of the running instances performed the action ENABLE, that allows to run several instances of the given event at the same time. If the action ENABLE was not used, the request to start the event instance will be ignored.
- if the option is checked and no event instance is running, the request will be accepted (event instance start)
- if the option is checked and at least one event instance is running, then the request will be inserted into the queue of requests. The request will be applied after termination of the current instance, or if the instance executes the action ENABLE. The effect is, that if the event do not use the action ENABLE, only one event instance will be always running and all the request to start the event will be processed in successive steps in the order as they occurred. Instance can detect the number of the current requests to start the event by calling the function %GetTriggerQueueLen.
The following figure scheme represents the described procedure.
Pridať komentár