Watch
(Engine-Level Function)
Description: | Watches its parameters and returns true when any of their values change. |
Returns: | Boolean |
Usage: | Steady State only. |
Function Groups: | Variable |
Related to: | Change | Edge | WatchArray |
Format: | Watch(Start[, Parm1 [, Parm2, ...]) |
Parameters: |
Start |
Required. Any expression which evaluates to a false (0) or true (non-0) value. This will be the initial return value of the function. |
Parm1, Parm2, ... |
Are any number of optional variables that are to be monitored by this function. |
Comments: |
This is a reset-able function whose initial return value will be set by the first parameter. This parameter is ignored after the initial evaluation of the function. A change in type (from 5 to "5") will also trigger the Watch. In accordance with the VTScada Coding Standards, do not use Watch(0, ...). |
Examples:
If Watch(1); [ ...; ]
This script will be executed once only, and then the function will be reset to false (i.e. the script will not again execute unless the module, or containing state, is stopped and restarted).
If Watch(1, Xvalue); [ ...; ]
This script will be executed once during the initial run-through of the state, and then again whenever Xvalue changes by any amount (unless the function is used inside a call to Latch).
Note that the behavior will differ depending on whether you use this function in a script code module or in a tag expression. In script code, the function will be reset as described, and will wait for the next trigger to occur.
In a tag expression, this function will not be reset after triggering.