Script Timing, PAUSE and WAIT

Normally Omniscope processes about 17 lines each second. It takes exactly as much time to execute any kind of command - including comments. Therefore, you can get a short pause in a script simply by adding a series of comments.

This can be important, since it takes time for devices to respond on the network. When monitoring devices on the network some care must be taken to ensure that the devices have had a chance to reply to commands and messages.

For example, the following script will not work reliably.


DEFINE GENSTATUS 1FFDC [B1]
IF [GENSTATUS == 0] {"The genset is off}

It will fail because the script only spends 1/17 of a second waiting for the generator status to come from the genset. But if the genset is off, it will only send the generator status once every five seconds. Most likely the GENSTATUS value is N/D when the script checks it.

You can force the script to wait for five seconds by inserting 65 blank lines, or by adding a WAIT command.


DEFINE GENSTATUS 1FFDC [B1]
: Wait for five seconds.
WAIT 5
IF [GENSTATUS == 0] {"The genset is off}

This will work much more reliably. Even more reliable is using the MAKE command, which is fully explained in its own entry.


DEFINE GENSTATUS 1FFDC [B1]
MAKE [GENSTATUS != N/D] BYSENDING EAFF DC FF 01 FF FF FF FF FF
IF [GENSTATUS == 0] {"The genset is off}

Sometimes a script needs to pause for the user to perform an action. The PAUSE command suspends the script until the user clicks on the "Continue" button.


DEFINE GENSTATUS 1FFDC [B1]
"Please Start the Genset and Click the Continue Button
PAUSE
IF [GENSTATUS == 0] {"The genset is still off}