Coding a script with intermessage delays

The following example illustrates a network definition and two message generation decks that show the coding required to define and change intermessage delays. This example demonstrates how to create simulations that represent actual message traffic with the system under test.
NET1    NTWRK   UTI=1           Beginning of NET1, specifies user time
*                               interval equal to 0.01 seconds.
*
*                         Sample WSim Script
*   This script illustrates the coding required to define and change
*   intermessage delays with operands on network definition and
*   message generation statements.
*
         .
         .                      Network definition statements.
         .
PATH1   PATH    DECK1           Defines a path for a device to follow
*                               during message generation.
PATH2   PATH    DECK2           Defines a path for a device to follow
*                               during message generation.
UTI1    UTI     100             Defines UTI1.
UTI2    UTI     500             Defines UTI2.
TCP1    TCPIP
DEV1    DEV     DELAY=R(1,10),  Defines delay for DEV1.
                THKTIME=UNLOCK, Determines the start of the delay for DEV1.
                PATH=(PATH1)    Specifies that DEV1 process the decks
*                               defined by PATH1.
DEV2    DEV     THKTIME=IMMED,  Starts the delay for DEV2 immediately.
                PATH=(PATH2)    Specifies that DEV2 process the decks
*                               defined by PATH2.
         .
         .                      Network definition statements.
         .
*
DECK1   MSGTXT
*                               Beginning of DECK1 for DEV1.
DELAY1  DELAY   UTI=UTI2,       Changes the active intermessage delay for
                TIME=F30        the next message by specifying the user time
*                               interval coded on UTI2 and a new delay value.
*                               WSim then calculates the intermessage delay
*                               specified by DELAY1.
MSG1    TEXT    (PW5)           Places PW5 into the buffer.
MSG2    TEXT    (USER5)         Interrupts message generation and sends MSG1.
*                               When all conditions for message generation
*                               have been met and after the delay expires,
*                               WSim reenters message generation and places
*                               USER5 into the buffer.
         .
         .                      Message generation statements.
         .
        ENDTXT                  End of DECK1.
*
DECK2   MSGTXT
*                               Beginning of DECK2 for DEV2.
SETUTI1 SETUTI  UTI=UTI1        Overrides NTWRK user time interval and
*                               sets DEV2 UTI to UTI1.
         .
         .                      Message generation  statements.
         .
        ENDTXT                  End of DECK2.
In this example, the UTI operand on the NTWRK statement defines a user time interval equal to 0.01 seconds for all resources on the network. In addition, a UTI statement named UTI1 provides an alternate user time interval equal to 1 second; UTI2 provides a user time interval equal to 5 seconds.

The network definition also provides two DEV statements, DEV1 and DEV2. The DELAY operand on DEV1 changes the active delay value to a random number 1 - 10. WSim uses this delay value to calculate intermessage delays for device 1. Also on DEV1, THKTIME=UNLOCK specifies that the intermessage delay does not start until DEV1 is ready to generate messages. On DEV2, THKTIME=IMMED specifies that WSim starts intermessage delays for device 2 immediately after ending message generation.

DECK1 is the message generation deck for device 1. WSim calculates the active intermessage delay for this device by multiplying the delay value defined on DEV1 by the user time interval specified on the NTWRK statement. The DELAY statement named DELAY1 changes this intermessage delay, however, during MSG2. Because THKTIME=UNLOCK for this device, WSim calculates the intermessage delay defined by the DELAY statement before it reenters message generation following MSG1: 5 seconds (UTI=UTI2) multiplied by 30 (TIME=F30). This calculation results in an intermessage delay equal to 150 seconds (2.5 minutes). This intermessage delay is active only for MSG1.

DECK2 provides a SETUTI statement that overrides the active user time interval specified on the NTWRK statement. The SETUTI statement specifies that WSim calculate the intermessage delay with the user time interval defined by UTI1, which is equal to 100 or 1 second, and the default delay value, F1. Every time WSim sends a message generated by DECK2, it delays 1 second before sending the next message (1 second X 1).

WSim processes the decks as follows:

Steps:
  1. During message generation for DECK1, WSim processes MSG1, placing PW5 into the buffer. Then, WSim processes MSG2. Because this statement is a conditional delimiter, WSim exits message generation for device 1 and sends PW5 to the system under test. WSim then calculates the delay specified by DELAY1.
  2. WSim begins processing DECK2. When WSim processes SETUTI1, the user time interval defined by UTI1 becomes the active user time interval for device 2. WSim continues to process DECK2 until it reaches a delimiter and exits message generation for device 2.
  3. If all conditions for message generation were satisfied for device 1 and DELAY1 expired, WSim reenters message generation for device 1, places MSG2 (USER5) into the buffer, and resumes message generation. The intermessage delay defined by DELAY1 is no longer active. The user time interval now active for device 1 is calculated using the interval coded on the NTWRK statement and the delay value coded on DEV1.