|
A mobile component may be
Example: Creation of an Arriving Passenger
WHENEVER T >= TArrival
DO
BusStop^ : ADD 1 NEW Passenger;
TArrival^ := T + TRandom;
END
The arrival times TArrival are determined by successive addition of a random intermediate arrival time. At every arrival, a passenger reaches the bus stop.
|
|
Example: Arrival of a Bus
WHENEVER
NUMBER(Road) > 0 AND
T >= Road:Bus[1].TArrival
DO
BusLane^ : GET Road:Bus[1];
END
Whenever the arrival time of the bus is reached that is the first on the road, this bus is moved to the bus lane of the bus stop.
Example: Deletion of a Bus
WHENEVER
NUMBER(BusLane) > 0 AND
T >= BusLane:Bus[1].TFinish
DO
BusLane: REMOVE Bus[1];
END
Buses on the bus lane that reach their end of operation, are deleted.
|