TimeOut

(Engine-Level Function)

Description: Returns true when the uninterrupted time that an expression is true reaches the specified value.
Returns: Boolean
Usage: Steady State only.
Function Groups: Time and Date
Related to: AbsTime | Now | RTimeOut | TimeArrived
Format: TimeOut(Enable, Time)
Parameters:  
Enable
Required. Any numeric expression giving the condition that results in the timer counting. When this parameter is true (not 0), the timer is "running." When this parameter is false (0), the timer stops and the timer is reset to 0.
Time
Required. Any numeric expression giving the time-out limit in seconds. When the cumulative time that Enable is true reaches this value, the function becomes true (1). If this value is 0 the function will trigger immediately and will continue to trigger as long as the state containing this function is active.
Comments:

This function is reset when either parameter becomes invalid, the Enable becomes false, or when the state containing the function is started. When the function is reset, counting starts at 0 and the returned value is false (0).
Note that this function is reset automatically when it occurs in a true action trigger or function parameter of a function which resets its parameters after evaluation (e.g. Latch, Toggle & Save).

VTScada includes an application property at the \Code level named SecondFlasher. The value of this property changes from 0 to 1 once a second, as near as possible to the change of the second. In most cases, it is better to watch for the change of \SecondFlasher than to burden the system with an additional function to calculate one-second intervals.

Example:

A common usage of the TimeOut function is as an action trigger for a script:

  If TimeOut(1, 5) NextState;
  [
     ...
  ]

This script will be executed 5 seconds after entering the state, and then a state change to NextState will occur.

 

  ZText(10, 10 { Lower left corner of text },
        "Emergency!" { Text to display },
        Cond(Toggle(TimeOut(1, 0.5)), 12, 4
             { Toggle light red/dark red every 0.5 secs }),
        0 { Default font });

This displays a message that flashes bright red and dark red every 0.5 seconds. Note that this example makes poor use of system resources.

Latching and Resetting Functions