|
Events describe discrete state transitions which are discontinuous changes in values at well defined points in time.
The time of an event is defined by a condition that may contain arbitrary model quantities as well as the system time T.
Example: Minute and Hour Counter
TIMEUNIT = [s]
STATE VARIABLES
minute (INT) := 0,
hour (INT) := 0
WHENEVER T >= 60 * (minute + 1)
DO
minute^ = minute + 1;
END
WHENEVER minute >= 60 * (hour + 1)
DO
hour^ = hour + 1;
END
|
|
The time unit of the system time is defined as seconds. Every 60 seconds and respectively every 60 minutes, the minute and respectively the hour counter are increased by 1.
Please observe that the event condition is invalidated during the execution of the event in order to avoid an infinite repetition of the event.
The change of a discrete variable may trigger another event. This mechanism is called event propagation .
|