Top | Previous | Next |
Tag Event Scripts |
Tag event scripts provide you with the chance to write Jython scripts in response to events in the tag. The events are either based on value, or alarm status. The events are written by filling in the provided stub functions. The scripts written may use any scripting libraries available in the gateway scope, as tags are always executed in the gateway. The exception to this are Client tags, which are executed in the clients and may only used Client-scoped scripting resources.
Type of Events Value Change Fired when some aspect of the tag's value has changed. This includes the quality component of the value. In other words, despite the separate Quality Change event, a quality change will also trigger the value change event.
Quality Change Fired any time the quality of the tag changes.
Alarm Active / Cleared Fired when an alarm on the tag transitions to the specified state.
Alarm Acknowledged Fired when an alarm on the tag is acknowledged by a user. The user path is included in the event data.
Script Execution When the specified event fires, the system queues the evaluation to take place in the tag scripting manager. In other words, script execution is asynchronous, and will not block scan class execution. Therefore, it is important to recognize that multiple script executions may be outstanding at one time for a particular tag (for example, imagine a script that executes a sql query that takes 1 second to return, and the tag is changing every 200 ms).
The events for a tag will be executed in order, but are limited to 5 outstanding events. When additional events are fired, the oldest previous event is dropped, and the "missedEvents" flag is set for the next execution. In this way, the last value known to the tag is always processed.
Scripts and UDTs Scripts are compatible with data types, and references to parameters are parsed and replaced before the script is compiled. Important note: For performance reasons, a single compiled script may be used between multiple UDT instances. This means that their "global" scripting scope will be shared, and therefore special care should be taken when using "global" variables from inside of tag event scripts. |