0% found this document useful (0 votes)
34 views32 pages

Chapter 02 Queueing Simulation

Uploaded by

440802539
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views32 pages

Chapter 02 Queueing Simulation

Uploaded by

440802539
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Chapter 2

Queueing Simulation

Topics
Exercises
Queueing Simulation: Topics
Introduction

2.1) Introduction Simulation of a Single-Server Queueing System

2.2) Simulation of a Single-Server Queueing System


Simulation of
a
Single-Server
Queueing
System
Queueing Simulation

2.1) Introduction
Queueing Simulation

2.1) Introduction
2.1) Introduction (cont’d.)
• Discrete-event simulation: Modeling of a system as
it evolves over time by a representation where the
state variables change instantaneously at separated
points in time
– More precisely, state can change at only a countable
number of points in time
– These points in time are when events occur
• Event: Instantaneous occurrence that may change the
state of the system
– Sometimes get creative about what an “event” is … e.g.,
end of simulation, make a decision about a system’s
operation
• Can in principle be done by hand, but usually done on
computer
2.1) Introduction (cont’d.)

• Example: Single-server queue


– Estimate expected average delay in queue (line,
not service)
– State variables
▪ Status of server (idle, busy) – needed to decide what to
do with an arrival
▪ Current length of the queue – to know where to store
an arrival that must wait in line
▪ Time of arrival of each customer now in queue –
needed to compute time in queue when service starts
– Events
▪ Arrival of a new customer
▪ Service completion (and departure) of a customer
▪ Maybe – end-simulation event (a “fake” event) –
whether this is an event depends on how simulation
terminates (a modeling decision)
2.1.1) Time-advance mechanisms

• Next-event time advance for the single-server queue


ti = time of arrival of ith customer (t0 = 0)
Ai = ti – ti-1 = interarrival time between (i-1)st and ith customers
(usually assumed to be a random variable from some probability
distribution)
Si = service-time requirement of ith customer (another random variable)
Di = delay in queue of ith customer
Ci = ti + Di + Si = time ith customer completes service and departs
ej = time of occurrence of the jth event (of any type), j = 1, 2, 3, …
Queueing Simulation

2.2) Simulation of a Single-


Server Queueing System
2.2) Simulation of a Single-Server Queueing
System(cont’d.)
Can you name at least three queuing systems that you interact
with every day?

System Servers Customers


Bank Tellers Customers
Hospital Doctors, nurses, beds Patients
Computer System Central processing unit, Jobs
input/output devices

Manufacturing System Machines, workers Parts


Airport Runways, gates, security Airplanes, travelers
check-in-stations

Communications network Nodes, links Messages, Packets


2.2) Simulation of a Single-Server Queueing
System(cont’d.)

➢ interarrival times (service times)


→ A1, A2, A3, …. (S1, S2, S3, ….)
→ iid (independent and identically distributed) random variables

➢ arriving customer (served FCFS/FIFO)


→ who finds the server idle: is served immediately
→ who finds the server busy: joins the end of a single queue
➢ upon completion of service
→ queue: first customer in queue will be served
→ no queue: server is idle again

➢ start of simulation: empty and idle


2.2) Simulation of a Single-Server Queueing
System(cont’d.)

➢ “Expected” average delay in ^ 1 n


queue (excluding service
time) of the n customers
d (n) =  Di
completing their delays
n i =1

➢ Expected average number of ^ 1


T (n)
1 
customers in queue
(excluding any in service)
q ( n) =
T ( n)  Q(t ) = 
T (n) i =1
iTi
0
→ A continuous-time average

➢ Expected utilization T (n)


^ 1
 B(t )
(proportion of time busy) of
the server u ( n) =
→ Another continuous-time T ( n) 0
average
2.2) Simulation of a Single-Server Queueing
System(cont’d.)

Where:

o Q(t) : Number of customers in queue at time t.

o T(n) : The time required to observe the n delays in queue.

1 if the server is busy at time t


o B(t) = 
0 if the server is idle at time t

o Ti : The total time during the simulation that the queue is of length i.

o T(n) = T0 + T1 + T2 + ....

12
2.2) Simulation of a Single-Server Queueing
System(cont’d.)
Flowchart of an arrival event

An Arrival

Idle Busy
Status of
Server

Customer enters service Customer joins queue


2.2) Simulation of a Single-Server Queueing
System(cont’d.)
Flowchart of a Departure event

A Departure

NO Queue Yes
Empty ?

Remove customer from Set system status to


Queue and begin service idle
2.2) Simulation of a Single-Server Queueing
System(cont’d.)
Simulation “by hand”

necessary random variables


(generated from their corresponding probability distribution)

➢ interarrival times
A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2
A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9
➢ service times
S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7
S6 = 0.6

initializiation (t = 0)
system starts emtpy (no customers yet) and idle (server not busy)
A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2
A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

Q(t)

t
B(t)

t
Events

0 9 t
1 5

ea1 = 0.4
Arrivals
Departure
initialize system at t = 0
16
A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2
A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

Q(t)

t
B(t)

t
Events

0 9 t
1 5

ea1 = 0.4 ea2= 1.6 ea = 2.1


3 Arrivals
Departure
ed1= 2.4
17
A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2
A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

Q(t)

t
B(t)

t
Events

0 9 t
1 5

ea1 = 0.4 ea2= 1.6 ea = 2.1 ea4= 3.8


3 Arrivals
Departure
ed1= 2.4
18
A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2
A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

Q(t)

t
B(t)

t
Events

0 9 t
1 5

ea1 = 0.4 ea2= 1.6 ea = 2.1 ea4= 3.8


3 Arrivals
Departure
ed1= 2.4 ed2= 3.1
19
A1 = 0.4 A2 = 1.2 A3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= 0.2
A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

Q(t)

t
B(t)

t
Events

0 9 t
1 5
ea5= 4.0
ea1 = 0.4 ea2= 1.6 ea = 2.1 ea4= 3.8 ea6= 5.6
3 Arrivals
ed3= 3.3 Departure
ed1= 2.4 ed2= 3.1 ed4= 4.9 ed5= 8.6
24
Q(t)

t
B(t)

t
Events

0 9 t
1 5
ea5= 4.0 ea7= 5.8
ea1 = 0.4 ea2= 1.6 ea = 2.1 ea4= 3.8 ea6= 5.6 ea8= 7.2
3 Arrivals
ed3= 3.3 Departure
ed1= 2.4 ed2= 3.1 ed4= 4.9 ed5= 8.6
Average waiting time d(n)

Events

0 x x 9 t
1 5
ea5= 4.0 ea7= 5.8
ea1 = 0.4 ea2= 1.6 ea = 2.1 ea4= 3.8 ea6= 5.6 ea8= 7.2
3 Arrivals
ed3= 3.3 Departure
ed1= 2.4 ed2= 3.1 ed4= 4.9 ed5= 8.6
Average number in queue q(n)
Q(t)
0.0

1.6

2.1
2.4

3.1

4.0

4.9

5.6
5.8

7.2

8.6
27
Average utilization u(n)

B(t)
0.0

0.4

3.3

3.8

8.6
fraction of
time server
is busy

28
Simulation table

customer Inter arrival Service Time Time in Time Idle


arrival time Ser. queue ser. time
time Duration Begins ends service

Total
Average
Q(t)

B(t)

Events

0 9 t
1 5

Arrivals
Departure
Simulation table : Bank teller example

custome Inter arrival Time Service Time Time Time Idle


r arrival Ser. time ser. in cust. time
Begins Duration ends queue Spends service
in sys.

Total
Average

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy