Advanced Modelling FeaturesWaitQueue
The Model Trace |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Let us now take a look at the trace output of this example to see how the simulation processes interact via the WaitQueue construct.
The first train arrives at the harbour, schedules the arrival of the next train for simulation time 1.3117, and then waits in the internal slave queue (coal transfer_S) of the wait queue for ships to arrive. The first ship also schedules the arrival of its successor and then proceeds to cooperate with Train#1. The transfer of coal from Train#1 to Ship#1 will take until simulation time 62.4310. The same happens for the second train and ship, they are paired off by the wait queue and their cooperation will be finished at simulation time 154.7567. When Ship#3 arrives at 21.0152 though, there is no train available so it has to wait in the internal master queue (coal transfer_M) until Train#3 arrives at 59.9158. At simulation time 62.4310 the (un)loading of Train#1 and Ship#1 is completed which results in the slave process (Train#1) being scheduled for activation after the master process (Ship#1). The master process gains control and, since ships need two train loads of coal, requests another cooperation, which results in Ship#1 being enqueued in the wait queue and automatically passivated. Now Train#1 (the former slave) is activated to leave the system. Trains and ships then continue to arrive and wait on each other to transfer coal. You may download the full source code of this example if you want to try it out yourself. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
http://desmoj.sourceforge.net/tutorial/advanced/waitqueue6.html |