Lesson 3
Lesson 3
https://collegenote.pythonanywhere.com 1
SIMULATION OF
CONTINUOUS SYSTEMS
UNIT 3
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 2
Queuing system:
• Queuing system are the waiting lines in which the
system attribute are waiting for a service.
• The queue may be of the customer waiting for the server
or server waiting for customer.
• The waiting line situation arises either there is too much
demand on the service facility so that customer have to
wait for getting service or there is too less demand in
which service facility have to wait for the customer.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 3
Queuing system:
• The line where the entities or customers wait is generally
known as queue.
• The combination of all entities in system being served and
being waiting for services will be called a queuing system.
• The general diagram of queuing system can be shown as a
queuing system involves customers arriving at a constant or
variable time rate for service at a service station.
• Customers can be students waiting for registration in college,
airplane queuing for landing at airfield, or jobs waiting in
machines shop.
• They remain in queue till they are provided the service.
Sometimes queue being too long, they will leave the queue
and go, it results a loss of customer.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 4
Queuing system:
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 5
Queuing system:
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 6
Queuing system:
• The basic concept of queuing theory is the optimization of
wait time, queue length, and the service available to
those standing in a queue.
• Cost is one of the important factors in the queuing
problem.
• Waiting in queues incur cost, whether human are waiting
for services or machines waiting in a machine shop. On
the other hand if service counter is waiting for customers
that also involves cost.
• In order to reduce queue length, extra service centers
are to be provided but for extra service centers, cost
of service becomes higher.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 7
Queuing discipline:
• It explains how the customer is solved by the server or the
way in which queue is organized. It is the rule by which
customer enters and exits the queue. Some queuing
discipline are
FIFO – First In First Out
LIFO – Last In First Out
SIRO – Serial In Random Out
SPTF – Shortest Processing Time First
PR – Service According to Priority
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 18
Queuing Notation
• Recognizing the diversity of queuing systems, Kendall
[1953] proposed a notational system for parallel server
systems which has been widely adopted.
• Kendall classify a queuing notation system as
𝐴/𝐵/𝑠/𝑞/𝑐/𝑃
Where,
𝐴 𝑖𝑠 𝑡ℎ𝑒 𝐴𝑟𝑟𝑖𝑣𝑎𝑙 𝑝𝑎𝑡𝑡𝑒𝑟𝑛
𝐵 𝑖𝑠 𝑡ℎ𝑒 𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑝𝑎𝑡𝑡𝑒𝑟𝑛
𝑠 𝑖𝑠 𝑁𝑜. 𝑜𝑓 𝑠𝑒𝑟𝑣𝑒𝑟
𝑞 is 𝑄𝑢𝑒𝑢𝑖𝑛𝑔 𝑑𝑖𝑠𝑐𝑖𝑝𝑙𝑖𝑛𝑒
c 𝑖𝑠 𝑆𝑦𝑠𝑡𝑒𝑚 𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦
𝑃 𝑖𝑠 𝑃𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑠𝑖𝑧𝑒
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 19
Queuing Notation..
Arrival and service pattern uses the following notations.
𝐷 − 𝐷𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑖𝑠𝑡𝑖𝑐 𝑜𝑟 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡
𝐺 − 𝐺𝑒𝑛𝑒𝑟𝑎𝑙 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝐺𝐼 − 𝐺𝑒𝑛𝑒𝑟𝑎𝑙 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛 𝑤𝑖𝑡ℎ 𝐼𝑛𝑑𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑡 𝑅𝑎𝑛𝑑𝑜𝑚 𝑉𝑎𝑙𝑢𝑒𝑠
𝑀 − 𝑃𝑜𝑖𝑠𝑠𝑜𝑛 (𝑀𝑎𝑟𝑘𝑜𝑣𝑖𝑎𝑛) 𝑝𝑟𝑜𝑐𝑒𝑠𝑠 𝑜𝑟 𝐸𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝐸𝑚 − 𝐸𝑟𝑙𝑎𝑛𝑔 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝐻 − 𝐻𝑦𝑝𝑒𝑟 𝑒𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙 𝑑𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 20
𝐸𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝐸𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝐸𝑟𝑙𝑎𝑛𝑔𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
Probability density function
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 23
𝐸𝑟𝑙𝑎𝑛𝑔𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
Queuing Notation..
Example:
1. 𝐷 / 𝑀 / 1
𝐴𝑟𝑟𝑖𝑣𝑎𝑙 𝑝𝑎𝑡𝑡𝑒𝑟𝑛 − 𝐷𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑖𝑠𝑡𝑖𝑐
𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑝𝑎𝑡𝑡𝑒𝑟𝑛 − 𝐸𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝑁𝑜. 𝑜𝑓 𝑆𝑒𝑟𝑣𝑒𝑟 − 1
𝑄𝑢𝑒𝑢𝑖𝑛𝑔 𝑑𝑖𝑠𝑐𝑖𝑝𝑙𝑖𝑛𝑒 − 𝐹𝐼𝐹𝑂
𝑆𝑦𝑠𝑡𝑒𝑚 𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦 − 𝐼𝑛𝑓𝑖𝑛𝑖𝑡𝑒
𝑃𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑠𝑖𝑧𝑒 − 𝐼𝑛𝑓𝑖𝑛𝑖𝑡𝑒
Queuing Notation..
Example:
2. 𝑀 / 𝐷 / 2 / 𝐿𝐼𝐹𝑂
𝐴𝑟𝑟𝑖𝑣𝑎𝑙 𝑝𝑎𝑡𝑡𝑒𝑟𝑛 − 𝐸𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑝𝑎𝑡𝑡𝑒𝑟𝑛 − 𝐷𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑖𝑠𝑡𝑖𝑐
𝑁𝑜. 𝑜𝑓 𝑆𝑒𝑟𝑣𝑒𝑟 − 2
𝑄𝑢𝑒𝑢𝑖𝑛𝑔 𝑑𝑖𝑠𝑐𝑖𝑝𝑙𝑖𝑛𝑒 − 𝐿𝐼𝐹𝑂
𝑆𝑦𝑠𝑡𝑒𝑚 𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦 − 𝐼𝑛𝑓𝑖𝑛𝑖𝑡𝑒
𝑃𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑠𝑖𝑧𝑒 − 𝐼𝑛𝑓𝑖𝑛𝑖𝑡𝑒
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 26
Queuing Notation..
Example:
3. 𝐺 / 𝐸𝑚 / 1 / 20
𝐴𝑟𝑟𝑖𝑣𝑎𝑙 𝑝𝑎𝑡𝑡𝑒𝑟𝑛 − 𝐺𝑒𝑛𝑒𝑟𝑎𝑙 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑝𝑎𝑡𝑡𝑒𝑟𝑛 − 𝐸𝑟𝑙𝑎𝑛𝑔 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛
𝑁𝑜. 𝑜𝑓 𝑆𝑒𝑟𝑣𝑒𝑟 − 1
𝑄𝑢𝑒𝑢𝑖𝑛𝑔 𝑑𝑖𝑠𝑐𝑖𝑝𝑙𝑖𝑛𝑒 − 𝐹𝐼𝐹𝑂
𝑆𝑦𝑠𝑡𝑒𝑚 𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦 − 20
𝑃𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑠𝑖𝑧𝑒 − 𝐼𝑛𝑓𝑖𝑛𝑖𝑡𝑒
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 27
Queuing Notation..
Example:
4. M / M / 1 / œ /œ
indicates a single-server system that has unlimited queue
capacity and an infinite population of potential arrivals. The
inter arrival times and service times are exponentially
distributed. When C and P are infinite, they may be
dropped from the notation. For example, M / M / 1 / œ / œ
is often shortened to M/M/l.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 28
Queuing Notation..
Example
a) M/D/2/5/∞ stands for a queuing system having
exponential arrival times, deterministic service time, 2
servers, capacity of 5 customers, and infinite
population.
b) If notation is given as M/D/2 means exponential arrival
time, deterministic service time, 2 servers, infinite
service capacity, and infinite population.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 29
Queuing Notation..
Examples:
i. D/M/1 =
Deterministic (known) input, one exponential server,
one unlimited FIFO or unspecified queue, unlimited
customer population.
i. M/G/3/20 =
Poisson input, three servers with any distribution, maximum
number of customers 20, 32 unlimited customer population.
ii. D/M/1/LIFO/10/50 =
Deterministic arrivals, one exponential server, queue is a stack
of the maximum size 9, total number of customers 50.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 30
Queuing Notation..
Examples:
1. D / 𝐷 / 2 / 𝐿𝐼𝐹𝑂
2. D / M / 1 / 2
3. Gi / H / 2 / SIRO / ∞ / 20
4. D / G / 3 / 20
5. H / Em / 2 / FIFO / 15 / 20
6. Gi / G / 4
7. D / M / 1 / 2 / 30
8. Gi / H / 2 / LIFO / 20
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 31
Queuing Notation..
Table: Queuing Notation for Parallel Server Systems:
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 32
Queuing Model
• Single Server
• Multiple Server
Within these single server and multiple server there
are two types:
• Finite queue length : restriction in queue length
• Infinite queue length : no restriction in queue length
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 34
Queuing Model
Balking:
Balking is a queue behavior wherein people leave as soon as they
realize that they will to wait.
So if an arrival doesn’t join the system and leave is said to be
Balking.
Balking can also be two types
• Forced balking
• Unforced balking
Reneging:
Reneging refer to a queue behavior wherein people leave a queue
after they are tired of waiting .
Queuing Model
Polling:
When there are more than one queue forming (establishing) for
same service, the action of sharing service between the queues is called
polling.
A bus picking up passengers from different stoppage along its route is
an example of polling service.
Separate queue for ladies and gents at ticket window, is another
example of polling service.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 36
Queuing Model
1) Single server queue:
A queuing system is described by its calling
population, the nature of arrivals, the service mechanism,
system capacity and the queuing discipline.
A single channel queuing system is portrayed in fig
below.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 37
Queuing Model
So in a single server queue,
Calling population is infinite
Arrival rate does not change
Units are served according to FIFO
Arrivals are defined by the distribution of time
between arrivals
Inter-arrival time
Service time are according to distribution
Arrival rate must be less than service rate
Stable system
Otherwise waiting line will grow unbounded
Unstable system
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 38
Queuing Model
Arrival event:
• If server idle unit gets service, otherwise unit enters
queue.
NO YES
Queuing Model
Departure event:
• If queue is not empty begin servicing next unit, otherwise
service will be idle.
NO YES
Queuing Model
2) Multi-server Queue
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 41
Queuing Model
Multi-server Queue
Figure shows a generalization of the simple model
we have been discussing for multiple servers, all sharing a
common queue.
If an item arrives and at least one server is available,
then the item is immediately dispatched to that server.
It is assumed that all servers are identical; thus, if
more than one server is available, it makes no difference
which server is chosen for the item.
If all servers are busy, a queue begins to form. As
soon as one server becomes free, an item is dispatched
from the queue using the dispatching discipline in force.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 42
Multi-server Queue…
Queuing Model
Multi-server Queue
The total server utilization in case of Multi-server queue for N
server system is
(server utilization)
Queuing Model
Multi-server Queue
There is another concept which is called multiple single server
queue system as shown below
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 45
Queuing Model
Some notation or Formula used to Measure the different
parameter of queue
Two principal measures of queuing system are;
1. The mean number of customers waiting and
2. The mean time the customer spend waiting
Both these quantities may refer to the total number
of entities in the system, those waiting and those being
served or they may refer only to customer in the waiting
line.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 46
Queuing Model
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 47
Queuing Model
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 48
Queuing Model
Example 1
Q.N > At the ticket counter of football stadium, people come in queue and
purchase tickets. Arrival rate of customers is 1/min. It takes at the average
20 seconds to purchase the ticket.
(a) If a sport fan arrives 2 minutes before the game starts and if he takes
exactly 1.5 minutes to reach the correct seat after he purchases a ticket,
can the sport fan expects to be seated for the kick-off?
Solution:
(a) A minute is used as unit of time. Since ticket is disbursed in 20
seconds, this means, three customers enter the stadium per minute, that is
service rate is 3 per minute.
Therefore,
λ = 1 arrival/min
μ = 3 arrivals/min
𝑾𝑺 = waiting time in the system = 1/( μ- λ)=0.5 minutes
The average time to get the ticket plus the time to reach the correct seat is 2
minutes exactly, so the sports fan can expect to be seated for the kick-off.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 49
Queuing Model
Example 2
Q.N > At the Bank counter, people come in queue for service. Arrival rate of
customers is 2/min. It takes at the average 15 seconds to take service.
(a) If bank will close 2 minutes and if he takes exactly 1 minutes to reach the
door, can the customer leave bank in time?
Solution:
(a) A minute is used as unit of time. Therefore,
λ = 2 arrival/min
μ = 4 arrivals/min
𝑾𝑺 = waiting time in the system=1/( μ- λ)= 1/(4-2) = 0.5 minutes
• Now total time will be 1+0.5 = 1.5 minutes.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 50
Queuing Model
Example 3
Q.N > At the orchid college, student come in queue for service. Arrival rate of
customers is 1/min. It takes at the average 22 seconds to take service.
(a) If college will close 3 minutes and if he takes exactly 1.5 minutes to reach
the door, can the student leave college in time?
Solution:
(a) A minute is used as unit of time. Therefore,
λ = 1 arrival/min
μ = 2 arrivals/min
𝑾𝑺 = waiting time in the system=1/( μ- λ)= 1/(2-1) = 1 minutes
• Now total time will be 1+1.5 = 2.5 minutes.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 51
Queuing Model
Example 4
Q.N > Customers arrive in a bank according to a Poisson's process with
mean inter arrival time of 10 minutes. Customers spend an average of 5
minutes on the single available counter, and leave.
(a) What is the probability that a customer will not have to wait at the
counter?
(b) What is the expected number of customers in the bank?
(c) How much time can a customer expect to spend in the bank?
Solution:
We will take an hour as the unit of time. Thus, λ = 6 customers/hour,
μ = 12 customers/hour.
The customer will not have to wait if there are no customers in the bank.
Thus, P0 = 1 – λ/μ= 1− 6/12 = 0.5
Expected numbers of customers in the bank are given by
𝑳𝑺 = λ /( μ - λ )=6/6=1
Expected time to be spent in the bank is given by
𝑾𝑺 =1/( μ – λ)= 1/(12-6) = 1/6 hour = 10 minutes.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 52
Queuing Model
Example 5
Q.N. > At the Banking, people come in queue . Arrival rate of customers is
1/min. It takes at the average 30 seconds to take the token. If a customer
arrives 5 minutes before the bank closed and if he takes exactly 4.5
minutes to reach the correct counter after he take a token, can the
customer expects to take banking service?
Solution :
A minute is used as unit of time. Since token takes 30 seconds, this
means, two customers enter the bank per minute, that is service rate is 2
per minute.
Therefore,
λ = 1 arrival/min
μ = 2 arrivals/min
𝑾𝑺 = waiting time in the system=1/( μ- λ)=1 minutes
and if he takes exactly 4.5 minutes to reach the correct counter after he
take a token, so bank is closed because 4.5+1=5.5
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 53
Queuing Model
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 54
Queuing Model
3.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 55
the system
or in the system
𝐿 = λ𝑤
Where, 𝐿 is the long-run in the system, λ is the
arrival rate and 𝑤 is the long-run time in the system.
Often called as Little’s equation.
Simulation and Modeling / [Chapter 3] Nipun Thapa
https://collegenote.pythonanywhere.com 61
CHAPTER 3
Finished !!!