Page 62 - DCAP601_SIMULATION_AND_MODELING
P. 62
Simulation and Modelling
Notes NUMBER-OF-CUSTOMERS-IN-THE-QUEUE (an integer from 0 to n) and TELLER-STATUS (busy
or idle). The random variables that need to be characterized to model this system stochastically
are CUSTOMER-INTERARRIVAL-TIME and TELLER-SERVICE-TIME.
A number of mechanisms have been proposed for carrying out discrete-event simulation; among
them are the event-based, activity-based, process-based and three-phase approaches (Pidd, 1998).
The three-phase approach is used by a number of commercial simulation software packages, but
from the user’s point of view, the specifics of the underlying simulation method are generally
hidden.
4.1.1 Components of a Discrete-event Simulation
In addition to the representation of system state variables and the logic of what happens when
system events occur, discrete event simulations include the following:
Clock
The simulation must keep track of the current simulation time, in whatever measurement units
are suitable for the system being modeled. In discrete-event simulations, as opposed to real
time simulations, time ‘hops’ because events are instantaneous – the clock skips to the next event
start time as the simulation proceeds.
Events List
The simulation maintains at least one list of simulation events. This is sometimes called the
pending event set because it lists events that are pending as a result of previously simulated
event but have yet to be simulated themselves. An event is described by the time at which it
occurs and a type, indicating the code that will be used to simulate that event. It is common for
the event code to be parameterised, in which case, the event description also contains parameters
to the event code.
When events are instantaneous, activities that extend over time are modeled as sequences of
events. Some simulation frameworks allow the time of an event to be specified as an interval,
giving the start time and the end time of each event.
Single-threaded simulation engines based on instantaneous events have just one current event.
In contrast, multi-threaded simulation engines and simulation engines supporting an interval-
based event model may have multiple current events. In both cases, there are significant problems
with synchronization between current events.
The pending event set is typically organized as a priority queue, sorted by event time. That is,
regardless of the order in which events are added to the event set, they are removed in strictly
chronological order. Several general-purpose priority queue algorithms have proven effective
for discrete-event simulation, most notably, the splay tree. More recent alternatives include
skip lists and calendar queues.
Typically, events are scheduled dynamically as the simulation proceeds.
Example: In the bank example noted above, the event CUSTOMER-ARRIVAL at time t
would, if the CUSTOMER_QUEUE was empty and TELLER was idle, include the creation of the
subsequent event CUSTOMER-DEPARTURE to occur at time t+s, where s is a number generated
from the SERVICE-TIME distribution.
56 LOVELY PROFESSIONAL UNIVERSITY