Modeling and Simulation (308-522A)
I am assuming the following:
ATOM3 was used to draw the model and generate the GPSS code.
A screen grab of the model is shown below. It may be easier to read the numbers in the postscript version: model.ps.
Each time unit corresponds to 1 minute. This gives enough precision to express the half hours quantities in integers.
The arrival process of ships is modeled by the generator blocks. A new ship arrives at every hour plus minus one half (60 plus minus 30 minutes).
Storage 1 of size 6 restricts the number of ships in the harbour to the number of berth (available space). Queue 1 represents the ships waiting outside the harbour for a free berth.
After a ship was able to get inside, it starts to be unloaded if one crane is available (represented as Storage 2 of size 5, five cranes). Otherwise, it waits for a free crane (Queue 2). Note that there can be at most one ship in Queue 2 as there can be no more than six ready to unload. Unloading takes 7 1/2 plus minus 3 hours (450 plus minus 180 in minutes). This is represented by an ADVANCE block.
After a ship is unloaded, the crane is free to service the next ship waiting. This explains the LEAVE block for storage 2. Now, 10% of the ships may need to be refueled. The decision is done by a TRANSFER block. Refueling takes 1 plus minus 1/2 hours (60 plus minus 30 minutes), modeled by an ADVANCE block. When a ship leaves the harbour (refueled or not), it leaves it places to the next one (a LEAVE for Storage 1).
Finally, we want to simulate for 100 ships leaving the harbour. A TERMINATE block that increments the counter by 1 every time a ship leaves is added.
Runs were done using the Web GPSS Simulator.
Complete output is here.
Simulation begins. RELATIVE CLOCK: 9458.6161 ABSOLUTE CLOCK: 9458.6161
The clock time makes sense. Unloading takes on average 450 minutes per crane. If the work is equally divided, then each crane unloads 20 ships (450 * 20 = 9000). Plus some time before cranes can be get busy. Plus some delay due to refueling.
BLOCK CURRENT TOTAL BLOCK CURRENT TOTAL L0 158 FUEL 12 L1 53 158 L10 12 L2 105 DONE 100 L3 105 L11 100 L5 1 105 L4 104 L6 104 L7 4 104 L8 100 L9 100
L1 makes sense. L1 is the numbers of ships queued, waiting for a berth. 53 makes sense as ships arrive much faster than they can be unloaded. Assuming the last five ships are being unloaded and 750 * 5 = 3750 minutes = 62.5 hours to unload the ships, around 62 (usually less as ships may be already half unloaded) may arrived.
L5 is the queue for the crane. It must be at most 1 as 5 cranes are available and at most 6 ships may be ready (in a berth) at any time.
L7 is the advance block for unloading. There can be at most 5 ships unloading at the same time. Four is ok.
There could be some ships in the FUEL block when the simulation ends. In this run there are none (see run 3).
The total of ships (transition) that went through the blocks also makes sense. Note the 12 in FUEL is about 10% (10% is 10 ships). Also, there are no more than 100 that went through the TERMINATE block as this was the terminating condition.
--AVG-UTIL-DURING-- STORAGE TOTAL AVAIL UNAVL ENTRIES AVERAGE CURRENT PERCENT CAPACITY AVERAGE CURRENT MAXIMUM TIME TIME TIME TIME/UNIT STATUS AVAIL CONTENTS CONTENTS CONTENTS 1 0.979 105 529.320 AVAIL 100.0 6 5.876 5 6 2 0.982 104 446.610 AVAIL 100.0 5 4.911 4 5 QUEUE MAXIMUM AVERAGE TOTAL ZERO PERCENT AVERAGE $AVERAGE QTABLE CURRENT CONTENTS CONTENTS ENTRIES ENTRIES ZEROS TIME/UNIT TIME/UNIT NUMBER CONTENTS 1 53 26.673 158 6 3.8 1596.783 1659.814 53 2 1 0.881 105 12 11.4 79.345 89.583 1 RANDOM ANTITHETIC INITIAL CURRENT SAMPLE CHI-SQUARE STREAM VARIATES POSITION POSITION COUNT UNIFORMITY 1 OFF 100000 100375 375 0.96
The average contents of storage 1 and and storage 2 is almost equal to their respective capacities. The arrival rates being small compared to the processing rate, the berth and cranes are almost always kept busy (except at the beginning). Both have reach their maximum content.
The average contents for the crane queue is 0.881 out of a maximum of 1. For the berth it is 26.673 and it reaches a maximum of 53. The $average time/unit is 1659.814 minutes waiting for a berth. This is 27.65 hours! Once a ship has a berth, it waits 89.583 minutes (1.5 hours) on $average to get a crane.
The simulation was runned 3 times consecutively without reseting the random number generator. Similar results were obtain in all three meaning that the results are consistent through the runs. Nothing really interesting.
Complete output is here.
Complete output is here.
As previously explained, it is possible to have one or more ships in the FUEL block when the simulation ends. The simulation was runned several times and it was obtained. Note that there is no ship waiting for a crane. This can be explained as follows. Just before the end, 5 ships were unloading and one ship was done unloading and was getting refueled. No ships were waiting in the crane queue as no berth were available. Then 1 ship finished unloading and left. The simulation terminated. No ship entered in the berth freed.
BLOCK CURRENT TOTAL BLOCK CURRENT TOTAL L0 150 FUEL 1 13 L1 45 150 L10 12 L2 105 DONE 100 L3 105 L11 100 L5 105 L4 105 L6 105 L7 4 105 L8 101 L9 101