Next: The event-based approach
Up: Program structure
Previous: The event scheduling
When an event is activated it can be manipulated in various ways. The
event can be appended to a queue, it can be put back in the scheduler and
so on. On its way it changes state. We identify the following states
an event can be in (based on the simula states) :
- passive -
indicating that the event is currently not available
for any processing.
- active - indicating that this is the event currently being
processed.
- queued - the event is in a queue.
- pending - the event is in the scheduler.
- conditional - indicating the event is on the conditional list.
- closed - the event is on the conditional list but unavailable.
The various primitives that manipulate the event and cause the change
of state are then:
- passivate - which takes an event out of the simulation but does not
destroy the event.
- hold - which takes a passive or active event and adds it to the conditional
list. This event then fires after each activated event.
- schedule - which takes a passive event and adds it to the scheduler.
This event then executes after a specified period.
- wait - which puts the event currently executing on the scheduler.
- activate - which takes a passive, pending or conditional event
and schedules it to become active at the current simulation time.
A typical use is to bring forward the activation of an event at present time.
- terminate - which terminates an active or passive event.
- append, prepend - which add passive and active events to a
queue.
- extract, removefront, removeback - these functions obtain events
from the queue.
- withdraw, reinstate - which respectively prevent a conditional event from executing
by changing its state to closed and put a closed event back in its conditional state.
The invoking of a primitive has not always effect.
The event should be in the correct state first. The invoking of the
hold primitive for example assumes a passive or active event. This
state can be obtained by first passivating or activating the event.
Consider the following transition diagram that shows the different states
an event can be in, in relationship with the different functions, that
manipulate them.
The central state of an event is the passive state.
Most events should first be passivated before they continue.
Notice that an event also changes state if it is pending
and is due to execute.
This event (the first event in the scheduler) is
extracted from the scheduler and becomes active. An event
that is on the conditional list stays conditional
while executing until it is explicitly passivated.

An entity (that combines several related events) has the same states
and primitives as an event. The difference is in the use of an additional phase,
as is explained in section 3.4.
Next: The event-based approach
Up: Program structure
Previous: The event scheduling
A Eliens
Tue Oct 31 09:27:21 MET 1995