The ships are represented by messages generated by the I type node
Entrance
. The messages have a field ShiTyp
.
To declare, that the
messages must have this field, a declaration is issued in the
subsection MESSAGES of the DECL section with reference to the
generating node.
The Entrance
node assign value (1, 2 or 3) to
the ShiTyp
parameter of the generated message.
The value is given by the function FTyp
defined in the GFUNCTIONS declaration. The values of the frequencies
are given in the INIT (value 1 frequency 50, value 2 frequency 40,
value 3 frequency 10). The function FTyp
produces a random number
1, 2, or 3 according to those frequencies. It is assigned to
the field ShiTyp
of the message. The messages are sent to the EL
of the node Control
.
In the Control
node, that represents the control of entry to the
port, the GLIDER generated variable F_Pier[ShiTyp]
holds at each moment the value of the free capacity of the node
Pier[ShiTyp]
. The maximum capacities are assigned in the INIT
section: 4 for the Pier
1, 3 for the Pier
2,
1 for the Pier 3
.
F_Channel
has the same meaning for the resource Channel
.
In this case it is 1 if the channel is free and 0 if it is engaged.
When the Control
node, that is a type G node, scans the
EL of messages and executes the code for each message. Only if
it find a message for which is true the condition of the if
(there is free capacity
in the Pier
of its type and the Channel
is free), the SENDTO
instruction is executed. This extracts the message from the EL
and sends it to the EL of the node Channel
.
The channel is represented by the resource type node Channel
. When
activated by the scanning of the network, this node takes the
message in its EL and passes it to the IL (this will be empty because
the Control only allows to pass a message if F_Channel = 1
, that
means that no message is using the resource. The exit from the
channel is scheduled for a later time given by the user defined
variable TChannel
.
When the message abandons the resource, it is not automatically
managed, because there is a RELEASE instruction that takes care
of the outgoing message. In the instruction associated to the
RELEASE the message is disposed according to its type. If it is
1, 2, or 3 it is send respectively to the Pier[1], Pier[2], or
Pier[3]. If it has type 4 (that is the type that will be assigned
to the ships abandoning the piers) it is sent to the Departure
node.
The node Pier
is a multiple node of dimension 3. Each node
represents a different pier; each may receive the corresponding type
of ship. The capacity of each node is assigned in the INIT section
as said above. When the capacity is different of 1, the user has to
define the quantity of resource used by each message. This is done
by the instruction USE := 1, i.e., it is assumed that all the ships use
the same space, equal to 1 unit of the resource.
This would be different with ship of very different size.
The operation time in the pier is
taken from a Gamma distribution; for different types of ships the
mean value used is different. The values of the means are assigned
in the INIT section. Notice that the type of the received ship is
put to 4. After the operation it is sent to Channel
and after
passing the channel, the ship of type 4 is sent to Departure.
The departure node is of E type. It takes each message of its EL,
executes the code and destroys the message. The code is the
computation of the time spent in the system. The GT is a
GLIDER defined field of the message that keeps its generation time.
As TIME is the value of the actual time, TIME - GT is the
total time that the message remained in the system. The procedure
TAB put this value in the frequency table TabTSys
. This table
was declared in the DECL section. The parameters of the table
are assigned in INIT. In this case the initial value of the
table is 0, and there will be 15 intervals of length 5.
The table and a histogram is shown when requested by the user.
The instruction INTI in the INIT section allows for interactive
change of the values of TPier
for different experiments.