Professional Documents
Culture Documents
Example :-
A common exercise in learning how to build discrete-event simulations is to model aqueue
, such as customers arriving at a bank to be served by a teller. In this example, the
system entities areCustomer-queueandTellers. The system events areCustomer-
ArrivalandCustomer-Departure.
Introduction
Events occur at the points in time at which at least one state variable changes value.
An event is an instantaneous occurrence in the discrete event model.
No simulated time passes when an event occurs; simulated time passes only between the
occurrence of events.
About events
The timing of the occurrence of events is controlled by the Future Event List
Whenever an event is scheduled to occur, an event notice is created and stored on the future
events list.
Every event notice contains two pieces of information:
(1) what event is being scheduled
(2) the (simulated) time at which the event is to occur.
Event List keeps the event notices in order by ranking them based on the lowest scheduled
time..
About events
At each iteration the algorithm examines the event list to see if there are any scheduled
events.
An empty list means there is nothing to do, so the simulation terminates (i.e. the
simulation run ends).
If the event list is not empty, the simulated clock is updated to the time of the first event
and the associated event is executed - that is, the state transitions associated with that
event are performed.
Note that the terminating condition (empty event list) means the simulation must be
initiated with at least one scheduled event for any event to actually occur.
About events
By convention, when an event occurs, all state changes associated with that event are first
performed.
Next, all further events are scheduled, and finally the event notice is removed from the
Event List.
The events scheduled are specified by the occurring event itself and may be conditional on
certain values of the current state
The order of execution for these three steps could be altered and different, but equivalent,
models would result.
Event-graph
In the graph,
events are represented as vertices (nodes)
A
the relationships between events are represented as edges (arrows)
connecting pairs of event vertices
A B
Example-single server system
A
The thin jagged arrow indicate the initialization of an event.
Example-single server system
A
the arrival event schedules another future occurrence of itself and
some other event(possibly departure).
Represented by heavy, smooth arrows.
Example-single server system
A D
the departure event schedules another future occurrence of itself (if a departure leaves
behind someone else in queue).
Example-single server system
Enter
A Servic
e
D
Adding another event enter service
Thin smooth arrows shows occurrence of immediate events without any delay.
Straight thin arrow refers to a customer who arrives to an empty system and whose
enter service event is scheduled immediately.
Curved thin arrow refers to a customer departing with a queue left behind, and so
the first customer in the queue would be scheduled to enter service immediately.
Simplification
Not only simplifies model conceptualization, but also speed its execution.
Single event process
A model with a single event (Arrival) and a single state variable, the cumulative number of
arrivals (N).
The time between arrivals is modeled as a sequence of inter arrival times {tA} that can be
constant or a sequence of variables.
The state transition for the Arrival event is that the cumulative number of arrivals (N) be
incremented by 1.
Condition and time delay
For each edge in the graph we will need to define under what condition and after how
long
one event might schedule another event to occur.
Conditions and time delays
i
t
A B
Conditions and time delays
i
t
A B
i
t
A B
i
t
A B
t i
A B
Sigma
Sigma is a windows program that allows the modeler to draw the Event Graph in a palette,
then add state variables and parameters to events and edges in dialog boxes.
A very useful feature is the ability to generate the C code for the model so it can be run as
an independent program.
Simkit
Simkit is a set of Java packages that support building discrete-event models from an Event
Graph perspective.
It does not currently have any built-in graphic capabilities, such as the Event Graph palette
in Sigma. However, it is Open Source and freely available under the GNU Public License.
Event graphs with state variables
SERVER = the status of the washing bay (busy, idle), initially set idle.
QUEUE = the number of cars waiting in line, initially set equal to zero.
We also define the constants, IDLE=1 and BUSY=0
Event graphs with state variables
The simulation RUN is started by making the washing bay at the carwash available for use
{IDLE=1,BUSY=0,SERVER=IDLE}.
Each time a car ENTERs the line, the length of the waiting line is incremented
{QUEUE=QUEUE+1}.
When service STARTs, the washing bay is made busy {SERVER=BUSY} and the length of the
line is decremented {QUEUE=QUEUE-1}.
Whenever a car has been washed and LEAVEs the washing bay, the washing bay is again
made available {SERVER=IDLE} to wash other cars.
With condition
Our carwash model with edge conditions and delay times is shown in below.
The state variables SERVER and QUEUE are now denoted by S and Q, respectively, and the
status of S is indicated by 1 or 0 ( IDLE=1, BUSY=0 ). In addition, the time between
successive car arrivals (probably random) is denoted by ta and the service time required to
wash a car is denoted by ts.
With condition
At the start of the simulation RUN, the first car will ENTER the system.
Successive cars ENTER the system every ta minutes. If ENTERing cars find that the server is
available (S>0), they can START service.
Once cars START service, ts minutes later they can LEAVE.
Whenever a car LEAVEs, if the queue is not empty (Q>0), the server will START with the next
car.
Multiple server queue
Description
Customers arrive to a service facility according to an arrival process and are served by one
of k servers.
Customers arriving to find all servers busy wait in a single queue and are served in order of
their arrival.
Parameters
{tA} = interarrival times;
{tS} = service times; k = total number of servers.
State Variables
Q = no. of customers in queue; S = no. of available servers
Multiple server queue
Event graph
Tandem queue
Description
Arriving customers are processed by one workstation consisting of a multiple-server queue.
Upon completion of service at the first workstation, a customer proceeds with probability to a second
workstation or departs the system with probability 1- p.
Parameters
{tA} = interarrival times; {tSi} = service times at workstation i (i=1,2);
ki = total number of servers at workstation i;
p = probability of customer proceeding to second workstation;
{U} a sequence of random variables (0,1).
State Variables
Qi = no. of customers in queue for workstation i;
Si = no. of available servers at workstation i.
Tandem queue
Event graph