2. Basic principle:
The model of system in which
state variable changes only at a
discrete set of points in times is
called Discrete event simulation.
3. The simulation models are analyzed by
numerical rather than by analytical methods.
Analytical methods employ the deductive
reasoning of mathematics to solve the
model.
E.g.: Differential calculus can be used to
determine the minimum cost policy for some
inventory models.
4. Numerical methods use computational
procedures and are ‘runs’, which is generated
based on the model assumptions and
observations are collected to be analyzed and
to estimate the true system performance
measures.
5. The basic building blocks of all discrete-event
simulation models:
entities and attributes,
activities and events.
6. A system is modeled in terms of
Its state at each point in time
The entities that pass through the system and
the entities that represent system resources
The activities and events that cause system
state to change.
7. Discrete-event models are appropriate for
those systems for which changes in system
state occur only at discrete points in time.
DES deals with dynamic, stochastic systems
(i.e., involving time and containing random
elements) which change in a discrete manner.
8. components of discrete event
Simulation
1. System: A collection of entities (e.g., people
and machines) that together over time to
accomplish one or more goals.
2. Model: An abstract representation of a
system, usually containing structural, logical, or
mathematical relationships which describe a
system in terms of state, entities and their
attributes, sets, processes, events, activities, and
delays.
3. System state: A collection of variables that
contain all the information necessary to describe
the system at any time.
9. 4. Entity: Any object or component in the system which
requires explicit representation in the model (e.g., a
server, a customer, a machine).
5. Attributes: The properties of a given entity (e.g., the
priority of a v customer, the routing of a job through a
job shop).
6. List: A collection of (permanently or temporarily)
associated entities ordered in some logical fashion (such
as all customers currently in a waiting line, ordered by
first come, first served, or by priority).
7. Event: An instantaneous occurrence that changes the
state of a system (as an arrival of a new customer).
10. 8. Event notice: A record of an event to occur at
the current or some future time, along with any
associated data necessary to execute the event; at
a minimum, the record includes the event type and
the event time.
9. Event list: A list of event notices for future
events, ordered by time of occurrence; also known
as the future event list (FEL).
10. Activity: A duration of time of specified length
(e.g., a service time or arrival time), which is known
when it begins (although it may be defined in terms
of a statistical distribution).
11. 11. Delay: A duration of time of unspecified
indefinite length, which is not known until it
ends(e.g., a customer's delay in a last-in, first-
out waiting line which, when it begins,
depends on future arrivals).
12. Clock: A variable representing simulated
time.
12. Simulation of Queuing Systems
Simulation is often used in the analysis of
queuing models.
A simple but typical queuing model
Queuing models provide the analyst with a
powerful tool for designing and evaluating
the performance of queuing systems.
13. Typical measures of system performance,
Server utilization, length of waiting lines, and
delays of customers.
For relatively simple systems: compute
mathematically
For realistic models of complex systems:
simulation is usually required
14. A queuing system is described by
Calling population
Arrival rate
Service mechanism
System capacity
Queuing discipline
15. Calling population
Calling population: the population of potential
customers, may be assumed to be finite or
infinite.
Finite population model: if arrival rate depends
on the number of customers being served and
waiting, e.g., model of corporate jet, if it is being
repaired, the repair arrival rate becomes zero.
Infinite population model: if arrival rate is not
affected by the number of customers being
served and waiting, e.g., systems with large
population of potential customers.
16. System Capacity
System Capacity: A limit on the number of
customers that may be in the waiting line or
system.
Limited capacity, e.g., an automatic car wash
only has room for 10,cars to wait in line to enter
the mechanism.
If system is full no customers are accepted
anymore
Unlimited capacity, e.g., concert ticket sales with
no limit on the
number of people allowed to wait to purchase
tickets.
17. Arrival Process
For infinite-population models:
• In terms of interarrival times of successive customers.
• Arrival types:
Random arrivals: interarrival times usually
characterized by a probability distribution.
Scheduled arrivals: interarrival times can be constant or
constant plus or minus a small random amount to
represent early or late arrivals.
• Example: patients to a physician or scheduled airline
flight arrivals to an airport
At least one customer is assumed to always be
present,so the server is never idle, e.g., sufficient raw
material for a machine.
18. Queue Behavior and Queue
Discipline
Queue behavior: the actions of customers while in a queue
waiting for service to begin, for example: leave when they
see that the line is too long, leave after being in the line
when its moving too slowly , move from one line to a
shorter line
Queue discipline: the logical ordering of customers in a
queue that determines which customer is chosen for
service when a server becomes free, for example:
• First-in-first-out (FIFO)
• Last-in-first-out (LIFO)
• Service in random order (SIRO)
• Shortest processing time first (SPT)
• Service according to priority (PR)
19. Service Times and Service
Mechanism
Service times of successive arrivals are
denoted by S1, S2, S3.
May be constant or random.
A queuing system consists of a number of
service centers and interconnected queues.
• Each service center consists of some
number of servers (c) working in parallel,
upon getting to the head of the line, a
customer takes the 1st available server.
20. Simulation of Queueing Systems
Single server queue
• Calling population is infinite
Arrival rate does not change
•Units are served according FIFO
• Arrivals are defined by the distribution of the
time between
arrivals
inter-arrival time
• Service times are according to distribution
• Arrival rate must be less than service rate
• Otherwise waiting line will grow
21. Simulation of Queueing Systems
Arrival Event
• If server idle unit gets
service, otherwise unit
enters queue.
Departure Event
• If queue is not empty
begin servicing next unit,
otherwise server will be
idle.
25. A sample of 100 arrivals of a customer at a retail sales depot which has
single queue is according to following distribution
Time between
arrival(min)
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Frequency 2 6 10 25 20 14 10 7 4 2
A study of time required to service customers by adding up the bills,receiving
payments and placing packages yields the following
ServiceTime 0.5 1.0 1.5 2.0 2.5 3.0
Frequency 12 21 36 19 7 5
Consider the Arrival of first customer at time 4.Estimate the average % of
customer waiting time and avg % of idle time of server by simulation for next
10 arrivals. Consider the following random numbers
93,22,53,64,39,07,10,63,76,35.
26. Step 1: Generate Tag values for inter arrival time
Time between
arrival
Frequency Probability Cumulative
probability
Tag values
0.5 2 2/100=0.02 0.02 00-01
1.0 6 0.06 0.08 02-07
1.5 10 0.10 0.18 08-17
2.0 25 0.25 0.43 18-42
2.5 20 0.20 0.63 43-62
3.0 14 0.14 0.77 63-76
3.5 10 0.10 0.87 77-86
4.0 7 0.07 0.94 87-93
4.5 4 0.04 0.98 94-97
5.0 2 0.02 1.00 98-99
Total=100
Step 2: tag values for service time
Service time frequency Probability Cumulative
probability
Tag values
0.5 12 12/100=0.12 0.12 00-11
1.0 21 0.21 0.33 12-32
1.5 36 0.36 0.69 33-68
2.0 19 0.19 0.88 69-87
2.5 7 0.07 0.95 88-94
3.0 5 0.05 1.00 95-99
Total=100
27. Step 3: simulation, assumption server is available from time 0,since the
arrival of first customer is specified in the problem, it starts at 4 else, always
it is assumed first customer arrives at time 0.
Customer
num
Random
num
Inter
arrival
time
Arrival
time(AT)
Service
time(ST)
Service time Waiting time of
(WT)customer
Idle time
of server
begin end
1 93 4.0 4.0 2.5 4 6.5(4
+2.5)
- 4
2 22 2.0 6.0 1.0 6.5 7.5 0.5(6.5-6.0) -
3 53 2.5 8.5 1.5 8.5 10.0 - 1
4 64 3.0 11.5 1.5 11.5 13 - 1.5
5 39 2.0 13.5 1.5 13.5 15 - 0.5
6 07 1.0 14.5 0.5 15 15.5 0.5 -
7 10 1.5 16 0.5 16 16.5 - 0.5
8 63 3.0 19 1.5 19 20.5 - 2.5
9 76 3.0 22 2.0 22 24 - 1.5
10 35 2.0 24 1.5 24 25.5 - -
28. Idle time of server= service begin time next customer-service end time of previous
customer
service start time=max(arrival time, end time of previous customer)
waiting time of customer=|arrival time-service time beginning|
avgWT=1/10=0.10
avg idle time of server=11.5/10
29. An airport entry has only one checkin counter,customers arrive at this
counter at random from 1 to 6 min,each interarrival time has same
probability of occurance.The probability for service time is given below.
Service
time(ST)
1 2 3 4 5 6
Probabili
ty
0.10 0.20 0.25 0.30 0.10 0.05
Develop a simulation table for 10 customers.Consider the random
number for inter arrival time(IAT) as 13,27,15,48,9,22,53,35,2 and RN
for ST as 84,10,74,53,17,91,79,67,38,89.
1.Calculate avg ST, avg time between arrival, waiting time of customer,
avg time spent by customer in system,avg waiting time of customers
those who wait.
30. step 1:tag values for service time
Service time probability Cumulative probability Tag values
1 0.10 0.10 00-09
2 0.20 0.30 10-29
3 0.25 0.55 30-54
4 0.30 0.85 55-84
5 0.10 0.95 85-94
6 0.05 1.00 95-99
Step 2: tag values for IAT, equal probability of occurance[out of 6 option any one
can occur, 1/6=0.166666667=0.17(approx.)]
Inter arrival time probability Cumulative probability Tag values
1 1/6=0.17 0.17 00-16
2 0.17 0.34 17-33
3 0.17 0.51 34-50
4 0.17 0.68 51-67
5 0.17 0.85 68-84
6 0.17 1.00 85-99
31. Simulation for 10 customers
Customer
no
RN for
IAT
IAT AT RN for
ST
Service
time
Service time WT for
customer
Time spent
by customer
in system
begin end
1 - - 0 84 4 0 4 - (4-0)=4
2 13 1 1 10 2 4 6 (4-1)=3 (6-1)=5
3 27 2 3 74 4 6 10 (6-3)=3 (10-3)=7
4 15 1 4 53 3 10 13 6 (13-4)=9
5 48 3 7 17 2 13 15 6 (15-7)=8
6 9 1 8 91 5 15 20 7 (20-8)=12
7 22 2 10 79 4 20 24 10 (24-10)=14
8 53 4 14 67 4 24 28 10 (28-14)=14
9 35 3 17 38 3 28 31 11 (31-17)=14
10 2 1 18 89 5 31 36 13 (36-18)=18
Total=18 Total=36 Total=69 Total=105
32. Time spent by customer in the system=
(service end time-arrival time)
Avg waiting time=totalWT/total
customers=69/10=6.9min
Avg time spent by the customer in the
system=105/10=10.5
Avg service time=36/10=3.6≈4min
Avg time between arrival=18/10=1.8≈2min
Avg waiting time of customers those who
wait=69/9=7.66=total waiting time of
customers/number of customers waiting
33. A Grocery store has only one checkout counter counter,customers arrive at
this counter at random from 1 to 8 min,each interarrival time has same
probability of occurance.The probability for service time is given below
Service
time(ST)
1 2 3 4 5 6
probability 0.10 0.20 0.30 0.25 0.10 0.05
Simulate the arrival for 10 customers. Consider the random number for
inter arrival time(IAT) as 913,727,015,948,309,922,753,235,302 and RN for
ST as 84,10,74,53,17,91,79,67,89,38.
1.Calculate avg WT, avg ST,avg time between arrival, avg time spent by
customer in queue, avg waiting time of customers those who wait.
34. Step1: Generate tag vales for service time
,
Service time(ST) probabilit
y
Cumulative
probability
Tag values
1 0.10 0.10 00-09
2 0.20 0.30 10-29
3 0.30 0.60 30-59
4 0.25 0.85 60-84
5 0.10 0.95 85-94
6 0.05 1.00 95-99
Step 2: Generate tag values for IAT, Given that P=1/8=0.125
Inter arrival time probability Cumulative probability Tag values
1 0.125 0.125 000-124
2 0.125 0.250 125-249
3 0.125 0.375 250-374
4 0.125 0.500 375-499
5 0.125 0.625 500-624
6 0.125 0.750 625-749
7 0.125 0.875 750-874
8 0.125 1.000 875-999
35. Step 3:simulation for 10 customers
Customer
no
RN for
IAT
IAT AT RN for
ST
ST Service time Time in
Queue
Time spent
in system
Idle time
for server
Begin End
1 - - 0 84 4 0 4 - (4-0)=4 -
2 913 8 8 10 2 8 10 - (10-8)=2 (8-4)=4
3 727 6 14 74 4 14 18 - 4 (14-10)=4
4 15 1 15 53 3 18 21 (18-15)=3 6 -
5 948 8 23 17 2 23 25 - 2 2
6 309 3 26 91 5 26 31 - 5 1
7 922 8 34 79 4 34 38 - 4 3
8 753 7 41 67 4 41 45 - 4 3
9 235 2 43 89 5 45 50 (45-43)=2 7 -
10 302 3 46 38 3 50 53 (50-
46)=4
7 -
Total 46 36 9 45 17
36. Avg ST=36/10=3.6min
Avg time between arrival=46/10=4.6 min
Avg time spent by customer in the
queue(WT)=9/10=0.9min
Avg time spent by customer in the
system=45/10=4.5min
Avg idle time of server=17/10
Avg waiting time of those who wait=9/3=3min
37. Consider a store with one checkout counter.
Prepare a simulation table and find the
average waiting time of customers in queue,
average idle time of server,avg service time.
Consider the following data.
IAT 3 2 6 4 4 5 8 7
Sevice
time
4 5 5 8 4 6 2 3 4
38. Customer
no
IAT Arrival time ST Service time WT Idle time of
serv
er
Time spent
in
syst
em
Begin End
1 - 0 4 0 4 - - 4
2 3 3 5 4 9 1 - 6
3 2 5 5 9 14 4 - 9
4 6 11 8 14 22 3 - 11
5 4 15 4 22 26 7 - 11
6 4 19 6 26 32 7 - 13
7 5 24 2 32 34 8 - 10
8 8 32 3 34 37 2 - 5
9 7 39 4 39 43 - 2 4
41 Total=32 73
Since the inter arrival time and service time are specified in the problem,
simulation for 9 customers is given in the following table
Avg waiting time of those who wait=32/7=4.57
Avg service time=41/9=4.55
AvgWaitingTime=32/9
Idle time of server=2/9=0.22
Avg time spent in the system=73/9=8.1
39. The Event-Scheduling/Time-Advance Algorithm-
Introduction
Event scheduling simulation is modeling over time of a system whose state
changes at discrete points in time.
A discrete event simulation proceeds by producing a sequence of system
snapshots that represent the evolution of the system through time.A given
snapshot at a given time includes system state at time t and future event list
(FEL).
The FEL contains all previously scheduled future events and their associated
event times. Events in FEL are arranged according to chronological order- that
is, the event times must satisfy t<=t1<=t2<=t3<=…tn.
Time t is the value of CLOCK, the current value of simulated time.The event
associated with time t1 is called imminent event i.e t1 is the next event that will
occur.
After the system snapshot at simulation time CLOCK=t has been updated , the
CLOCK is advanced to simulation time CLOCK=t1.
The sequence of actions that a simulator must perform to advance the clock and
build a new system snapshot is called the event-scheduling/ time –advance
algorithm.
40. Future Event List
All event notices are chronologically ordered in the FEL
•At current time t, the FEL contains all scheduled events
•The event times satisfy: t < t1 ≤ t2 ≤ t3 ≤ ... ≤ tn
•The event associated with t1 is the imminent event, i.e.,
the next event to occur
Scheduling of an event
•At the beginning of an activity the duration is computed
and an end-of-activity event is placed on the future event
list
•The content of the FEL is changing during simulation run .
• Efficient management of the FEL has a major impact on
the performance of a simulation run
41. Event Scheduling/ time advance algorithm
Step 1. Remove the event notice for the imminent
event (event , time t1) from FEL.
Step 2. Advance CLOCK to imminent event time (i.e.
advance CLOCK from t tot1t1)
Step 3. Execute imminent event: update system
state, change entity attributes, and set membership
as needed.
Step 4. Generate future events (if necessary) and
place their event notice on FEL, ranked by event
time. (Example: Event 4 to occur at time t+,
where t2<t+<t3 )
Step 5. Update cumulative statistics and counters.
42. The model has the following components:
System state (LQ (t), LS (t)), where LQ (t) is the number of
customers in the waiting line, and LS (t) is the number being
served (0 or 1) at time t.
Entities: The server and customers are not explicitly modeled,
except in terms of the state variables above.
Events
Arrival(A)
Departure(D)
Stopping event (E), scheduled to occur at time tn.
Event notices
(A, t). Representing an arrival event to occur at future time t
(D, t), representing a customer departure at future time t
(E, tn), representing the simulation-stop event at future time tn
Activities
Interarrival time, Service time.
43. Initially LQ(t)=0,LS(t)=1
• Arrival: if LS(t)=1,then increment LQ(t) by 1,else LS(t)=1
• Departure: if LQ(t)>0,then decrement LQ(t) by 1,else LS(t)=0
• If both arrival and departure occurs simultaneously, keep LQ(t) and
LS(t) same as previous clock value.
44. Consider a grocery store with one checkout
counter.The IAT between the customers and
service time is given in the table. Perform the
simulation until clock time is 23[stopping
time is 23],using event scheduling algorithm
find server utilization and max queue length.
Inter arrival time - 1 1 6 3 7 5 2
Service time 4 2 5 4 1 5 4 1
45. Inter arrival
time
Arrival time Service time Service time
Begin End=DT Departure
time
- 0 A1 4 0 4 4 D1
1 1 A2 2 4 6 6 D2
1 2 A3 5 6 11 11 D3
6 8 A4 4 11 15 15 D4
3 11 A5 1 15 16 16 D5
7 18 A6 5 18 23 23 D6
5 23 A7 4 23 27 27 D7
2 25 A8 1 27 28 28 d8
Step 1:Find the departure time using IAT and service time the given
Step 2: simulation for 8 customers, arrange clock variable in
chronological order of arrivals and departure, accordingly
specify the type of event .
Step 3:Fill the state variables LS(t) and LQ(t) according to
event scheduling algorithm, and calculate the cumulative
statistics.
47. Example 2: Consider a single channel queue .
The IAT between the customers and service
time is given in the table. Perform the
simulation until clock time is 30[stopping
time is 30],using event scheduling algorithm
find server utilization and max queue length.
IAT - 8 6 1 8 2
Service
Time
4 1 4 3 2 4
48. Customer
number
IAT AT ST Service time Departure
time
Begin End=DT
1 - 0 A1 4 0 4 4 D1
2 8 8 A2 1 8 9 9 D2
3 6 14 4 14 18 18
4 1 15 3 18 21 21
5 8 23 2 23 25 25
6 2 25 4 25 29 29
Step 1:Find the departure time using IAT and service time the given
Step 2:Event scheduling/Time advance algorithm ,simulations for 6
customers
Type of event Clock LQ(t) LS(t) Future event list Cumulative statistics Illustratio
n
Server busy Max
len Q
A1 0 0 1 (A2,8)(D1,4)(E,30) 0 0 C1
D1 4 0 0 (A2,8)(D2,9)(E,30) (4-0)=4 0 -
A2 8 0 1 (A3,14)(D2,9)(E,30) 4+0=4 0 C2
D2 9 0 0 (A3,14)(D3,18)(E,30) 4+(9-8)=5 0 -
A3 14 0 1 (A4,15)(D3,18)(E,30) 5+0=5 0 C3
A4 15 1 1 (A5,23)(D3,18)(E,30) 5+(15-14)=6 1 C4 C3
D3 18 0 1 (A5,23)(D4,21)(E,30) 6+(18-15)=9 1 C4
D4 21 0 0 (A5,23)(D5,25)(E,30) 9+(21-18)=12 1 -
A5 23 0 1 (A6,25)(D5,25)(E,30) 12+0=12 1 C5
A6/D5 25 0 1 (D6,29)(E,30) 12+(25-23)=14 1 C6
D6 29 0 0 (E,30) 14+(29-25)=18 1 -
49. Consider a single channel queue .The IAT
between the customers and service time is
given in the table. Perform the simulation
until clock time is 30[stopping time is
30],using event scheduling algorithm find
server utilization and max queue length.
IAT - 2 4 3 1 2 6
Service
Time
4 3 2 5 2 1
51. Consider a single channel queue .The IAT
between the customers and service time is
given in the table. Perform the simulation
until clock time is 35[stopping time is
35],using event scheduling algorithm find
server utilization and max queue length.
IAT 1,1,6,3,7,5,2,4,1
ST: 4,2,5,4,1,5,4,1,4
52. Customer
num
IAT AT ST Service time Departure
time
Begin End
1 - 0 4 0 4 4
2 1 1 2 4 6 6
3 1 2 5 6 11 11
4 6 8 4 11 15 15
5 3 11 1 15 16 16
6 7 18 5 18 23 23
7 5 23 4 23 27 27
8 2 25 1 27 28 28
9 4 29 4 29 33 33
10 1 30 -
Step 1:calculate departure time
54. Prepare a simulation table using ES/TA
algorithm, let the stopping time is
24,consider the following Inter ArrivalTime
and ServiceTime,Also find the customers
who spent more than 4 min.
IAT:1,1,8,6,8
ST:4,2,3,4,1,2
55. Customer no IAT AT ST Service time Departure time
Begin End
1 - 0 4 0 4 4
2 1 1 2 4 6 6
3 1 2 3 6 9 9
4 8 10 4 10 14 14
5 6 16 1 16 17 17
6 8 24 2 24 26 26
Step 1:calculate departure time
Step 2:simulate using ES/TA algorithm
Type event clock LQ(t) LS(t) Future Event list Cumulative statistics Checkout
time
illustr
ation
Server busy Max queue
A1 0 0 1 (A2,1)(D1,4)(E,24) 0 0 - C1
A2 1 1 1 (A3,2)(D1,4)(E,24) 1 1 - C2 C1
A3 2 2 1 (A4,10)(D1,4)(E,24) 1+(2-1)=2 2 - C3 C2
C1
D1 4 1 1 (A4,10)(D2,6)(E,24) 2+(4-2)=4 2 (4-0)=4 C3 C2
D2 6 0 1 (A4,10)(D3,9)(E,24) 4+(6-4)=6 2 (6-1)=5 C3
D3 9 0 0 (A4,10)(d4,14)(E,24) 6+(9-6)=9 2 (9-2)=7 -
A4 10 0 1 (A5,16)(D4,14)(E,24) 9+0=9 2 C4
D4 14 0 0 (A5,16)(d5,17)(E,24) 9+(14-10)=13 2 (14-10)=4 -
A5 16 0 1 (A6,24)(D5,17)(E,24) 13+0=13 2 C5
D5 17 0 0 (A6,24)(D6,26)(E,24) 13+(17-16)=14 2 (17-16)=1 -
A6 24 0 1 (D6,26)(E,24) 14+0=14 2 C6
D6 26 (26-24)=2
Customer3 and 4 are in the system for more than 4minutes.
56. Consider a single server queue with one
checkout counter using ES/TA algorithm, find
the customers who spent 5 or more minutes
in the system. let the stopping time is
32,consider the following Inter ArrivalTime
and ServiceTime.
IAT :4,2,8,1,8,3,6,8
ST:4,6,5,2,3,4,4,1
57. Customer no IAT AT ST Service time Departure time
Begin End
1 - 0 4 0 4 4
2 4 4 6 4 10 10
3 2 6 5 10 15 15
4 8 14 2 15 17 17
5 1 15 3 17 20 20
6 8 23 4 23 27 27
7 3 26 4 27 31 31
8 6 32 1 32 33 33
9 8 40 -
Step 1:find the departure time
Step 2:simulate for 8 customers