Advanced Modelling Features

Interrupts

The Model Trace

   
 

Let us now take a look at the trace output of this example to see how interrupting a process's execution works. We start at simulation time 29.2158 where the van carrier finishes loading Truck#6 and starts service on Truck#7. Note that the end of service (the hold()) is scheduled to happen at 35.4954. At simulation time 31.6672 though, the first urgent truck (Truck#17) arrives and interrupts VanCarrier#1. The van carrier then inserts the truck it is currently serving (Truck#7) back into the truck queue and immediately starts service on the urgent Truck#17 until simulation time 36.3058.

In the meantime, two more trucks arrive and wait in line. When the van carrier has finished service for the urgent truck it resumes servicing Truck#7 whose service got interrupted. This shows that we implemented the service order correctly.

InterruptsExampleExperiment - Trace

model
time
event
entity
action(s)
InterruptsExample0.0TraceOn#1----Trace switched on
... ......
29.2158 VanCarrier#1activates 'Truck#6' now
removes Truck#7 from 'Truck Queue'
inserts itself into 'busy VC Queue'
holds for 6.2796 until 35.4954
Truck#6Truck was serviced and leaves system.
Truck#6 terminates
31.6672 TruckArrival#1activates 'Truck#17' after 'TruckArrival#1'
Truck#17TruckQueuelength: 10
removes VanCarrier#1 from 'busy VC Queue'
interrupts 'VanCarrier#1', with reason Urgent Truck Arrived [1]
passivates
VanCarrier#1interrupted!
inserts Truck#7 into 'Truck Queue'
removes Truck#17 from 'Truck Queue'
inserts itself into 'busy VC Queue'
holds for 4.6386 until 36.3058
32.4497 TruckArrival#1activates 'Truck#18' after 'TruckArrival#1'
Truck#18TruckQueuelength: 11
passivates
35.4435 TruckArrival#1activates 'Truck#19' after 'TruckArrival#1'
Truck#19TruckQueuelength: 12
passivates
36.3058 VanCarrier#1activates 'Truck#17' now
removes Truck#7 from 'Truck Queue'
inserts itself into 'busy VC Queue'
holds for 4.5527 until 40.8586
Truck#17Truck was serviced and leaves system.
Truck#17 terminates

You may download the full source code of this example if you want to try it out yourself.



   
  http://desmoj.sourceforge.net/tutorial/advanced/interrupt5.html