Advanced Modelling FeaturesRes
The Model Trace |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Finally, let us have a look into the model trace, to see how the ship processes interact with the Res object. We jump right to simulation time 15.9412, because it provides us with a perfect example of the behaviour of the Res construct.
At simulation time 15.9412 Ship#9 enters the harbour where no more berths are available. It tries to acquire 2 berths and the Res object automatically inserts Ship#9 into its internal waiting queue and passivates the process. Control passes back to the scheduler which activates the next process on the event list, in this case the ship generator again. Since no resources have been released in the meantime, the new Ship#10 has to wait in the Res object's internal queue as well. The same holds true for the next ship, Ship#11. At simulation time 20.6818 Ship#8 has finished unloading and releases its resources (2 berths) before it terminates, i.e. leaves the system. The Res object now automatically activates Ship#9, the first ship waiting in the internal queue, since its request of 2 berths can now be satisfied. You may download the full source code of this example if you want to try it out yourself. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
http://desmoj.sourceforge.net/tutorial/advanced/res4.html |