Starting the event instance on object value (or state) change
Configuration for starting the event instance on an 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 to 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 simultaneously 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.
The 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, which 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, which 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 D2000 Event Handler process proceeds according to the option Create a 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 running 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 the termination of the current instance, or if the instance executes the action ENABLE. The effect is, that if the event does not use the action ENABLE, only one event instance will always be running and all the requests to start the event will be processed in successive steps in the order as they occurred. The 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