This is the simulation of a port that has three types of piers to receive different types of ships:
The port has an entry channel in which only a ship at a time is allowed to pass. The same channel is used to enter to the piers and to exit, once the operation in the port is finished.
Model of a Port. (C. Domingo 2/23/96)
Ships arrive at a port with interval times with exponential
distribution with mean Tbarr.
There are 3 types of ships. The type is selected from an empirical
random distribution by means of a function FTyp.
According to the type they go to the piers 1, 2 or 3.
The ships are queued before the entry channel. A ship is allowed to
pass only if the channel is free and the ship has a place in the pier
of its type.
The time spent in passing the channel is a fixed value TChannel.
In the pier the ship remains a time taken from a Gamma distribution
The mean TPier depends on the type. The deviation is 10\% of the mean.
Each ship uses only one position in the pier.
To the served ships the type 4 is assigned and they are sent to the
channel to exit the system.
Make a frequency table of the mean time in the system.
Experiment with different serving times in the piers.
NETWORK
Entrance (I) :: IT := EXPO(Tbarr); ShiTyp := FTyp;
Control(G) :: IF (F_Pier[ShiTyp] > 0) and (F_Channel > 0)
THEN SENDTO(Channel);
Channel (R) Pier[ShiTyp], Departure ::
RELEASE IF ShiTyp = 4 THEN SENDTO(Exit)
ELSE SENDTO(Pier[ShiTyp]);
STAY := TChannel;
Pier (R) [1..3] Channel ::
STAY := GAMMA(TPier[ShiTyp], 0.1 * TPier[ShiTyp]);
USE := 1; ShiTyp := 4;
Departure (E) :: TinSys := TIME - GT; TAB(TinSys, TabTSys);
INIT
TSIM := 1200; ACT(Entrance, 0);
Tbarr := 4; (*Mean time between arrivals *)
TChannel := 0.2; (*Time to pass the channel *)
FTyp := 1, 50 / 2, 40 / 3, 10; (*Values of frequency of types *)
ASSI Pier[1..3] := (4, 2, 1); (*Capacities of the piers *)
ASSI TPier[1..3] := (20, 12, 28); (*Mean time spent in the piers *)
TabTSys := 0, 15, 5; (*Parameters of the frequency table*)
TITLE := 'Port. Basic experiment';
INTI TPier: 7: 2: Time in the Pier ;
DECL
VAR Tbarr, TinSys, TChannel: REAL;
TPier: ARRAY[1..3] OF REAL;
MESSAGES Entrance(ShiTyp: INTEGER); (*structure of the messages *)
TABLES TinSys: TabTSys; (*table of frequencies for TinSys *)
GFUNCTIONS FTyp FREQ (INTEGER): REAL: 3; (*frequency function *)
STATISTICS ALLNODES;
END.