The execution of the program starts with the INIT section. The total simulation time is assigned to the GLIDER variable TSIM. The GLIDER variable TIME, that keeps the value of the time during the simulation, is initialized to 0. The user could put explicitly other assignation (even a negative number).
The GLIDER procedure ACT schedules an activation for the actual time plus the second argument (here also 0, but it may be a real expression) so the first activation will happen at TIME = 0 in this example. The other instructions of the INIT section assign values to the parameters. .
Then the execution of the NETWORK section starts.
The components of the simulated system: entrance, window and exit are
represented by the nodes Entry
, Window
, and Exit
in the NETWORK.
The patrons are represented by the messages that each node may
send to its successor.
The node Entry
is of I type. Its successor (node to which messages
can be sent) is the node Window
.
In this case we could omit the explicit indication of successor,
the GLIDER system takes the following node as successor by default.
An I type node (or more exactly the procedure into which the
compiler translates it), when activated, generates a message,
and sends it to the end of the EL of the successor node. This is
done automatically by the GLIDER system. In this
node a next arrival event (i.e., the next activation of
the node Entry) may also be scheduled. This is done by assigning
a value to the system variable IT (Interval Time). This value is
interpreted as the time that has to pass until the
next arrival. In this case, this interval is the value computed by the
function EXPO, that generates a pseudorandom value taken from an
exponential distribution (see Chapter 8 for further explanations).
So the GLIDER schedules a new activation of Entry
.
This activation will occur at a time that
is equal to the actual value of TIME plus the value assigned to IT.
The user can also control the sending
of the message to other nodes by means of a
SENDTO instruction. Values to the fields of the message can also be
assigned in the code of this node.
The node Window
simulates a resource, in this case the window where
the patrons are served. The capacity is 1 by default
(no other capacity was assigned) so that only
one message can enter the IL.
The messages enter the EL of the node. This EL represents
the queue of patrons at the window. The IL
represents the patron being served.
When the node Window
is activated during the scanning
process of the network
(and this will happen because the node Entry started such a scanning),
the procedure of the node type R, if the IL is empty, searches
the EL. If it is empty nothing is further done. If it has messages,
the procedure takes the first message to pass
it to the IL. If the IL was occupied (it contains a message
representing a patron using the resource) the incoming
message remains in the EL. When a message is
introduced in the IL, that means that a new service starts. Then
the GLIDER system schedules an event of end of service. That is, a
future activation of the node Window
at a time equal to the actual
value of TIME plus the value assigned to the variable STAY. In this
case the value is taken at random from a gaussian distribution. That
time is also kept in a field of the message as its exit time.
When that future activation takes place, the node Window
is again
activated, but now by the event that refers to it. In this case, the
procedure searches the IL for a message having an exit time equal
to the time of the event (that is, the actual time). In this simple
case only one message may be in the IL. The message is then extracted
and sent to the EL of the successor node Exit
.
As this message movement
triggers a new scanning of the network, the node Window is now
activated by the scanning process with is IL empty. So it searches
again
to see if there are in the EL other message to be passed to the IL.
If it is so, a storage process as the explained above will happen.
Otherwise, the Window
remains idle.
The node Exit
is of E type (when the type is not declared, the
compiler assumes that the type is indicated by the first letter
of its name). When it is activated (as a consequence of the
scanning of the network started by the extraction event in the node
Window
), the procedure of the node Exit
removes the message of its EL and
destroys it, restoring the freed memory to a free memory pool.
During all these operations statistics are recorded of the lists,
and the use of the resources.