Previous Page Discrete Control of Time During Propagation of Events Next Page
Variables changed by events can trigger further events.

Example: Upward and Downward Counters

STATE VARIABLES
Z1 (INT) := 0,
Z2 (INT) := 0

WHENEVER Z1 > 0
DO
Z1^ := Z1 - 1;
END

WHENEVER Z1 = 0 AND Z2 < 10
DO
Z2^ := Z2 + 1;
Z1^ := 10;
END
Roll Pendulum

The counter Z1 is decreased regularily down to zero. When this happens, the counter Z2 is increased by one until it reaches the value of 10.

In order to be able to discriminate events, after every state transition an event counter (cycle) is increased. This counter is reported together with the results.

But if at a point in time no further events are to be executed, the system time continues to elapse.