0% found this document useful (0 votes)
19 views27 pages

6 Queueing Theory and Analysis: Part Iii: System Analysis and Design Evaluation Chapter 6: Queuing Theory and Analysis

This document discusses queuing theory, focusing on the balance between waiting costs and service facility idle time. It outlines key parameters of queuing systems, such as arrival and service patterns, and introduces various terminologies and concepts like jockeying, balking, and reneging. Additionally, it presents governing equations for single-server queuing systems and explores the minimum-cost service rate for effective system management.

Uploaded by

Blue Phase
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)
19 views27 pages

6 Queueing Theory and Analysis: Part Iii: System Analysis and Design Evaluation Chapter 6: Queuing Theory and Analysis

This document discusses queuing theory, focusing on the balance between waiting costs and service facility idle time. It outlines key parameters of queuing systems, such as arrival and service patterns, and introduces various terminologies and concepts like jockeying, balking, and reneging. Additionally, it presents governing equations for single-server queuing systems and explores the minimum-cost service rate for effective system management.

Uploaded by

Blue Phase
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/ 27

PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION

Chapter 6: Queuing Theory and Analysis

6 QUEUEING THEORY AND ANALYSIS

6.1 Introduction

A queuing problem is essentially a problem of balancing the cost of waiting against the cost
of idle time for the service facilities in the system. This balancing requires an analysis of the
queuing system, which means determining various statistics such as the facility idle time,
average waiting time, queue length, etc., for various conditions. The problem arises due to
the stochastic nature of the times between the arrivals of customers as well as the time it
takes to serve each customer.

In any service system/manufacturing system involving queueing situation, the objective is


to design the system in such a manner that the average waiting time of the customers is
minimized and the percentage utilization of the server is maintained above a desired level.

The important parameters in a queuing system are: (i) the arrival pattern of customers, i.e.,
frequency distribution of inter-arrival times; (ii) the service pattern, i.e., frequency
distribution of service times; (iii) the number of servers (or service counters or service
channels); and (iv) the queue discipline, i.e., the order in which service is provided, such
as, first-come-first-served, last-come-first-served (in a stack of dishes the last dish put is
picked first), or some priority system (such as, giving hospital beds to emergency patients
ahead of regular patients, unloading a ship carrying perishable goods ahead of other ships,
etc.).

The various types of queueing system in many service/manufacturing situations are


described in Table 6.1.

Table 6.1: Application areas of queueing system


Example Members of queue Server(s)
Bank counter Account holders Counter clerk
Toll gate Vehicles Toll collectors
Ration shop Ration card holders Shop clerk
Main frame computer centre Programs Computer
Library Students Counter clerk
University cafeteria Student or staff Counter clerk
Traffic signal Vehicles Signal point
Final inspection station of TV assembly line Assembled TV. sets Inspector
Airport runways Planes Runways
Telephone booth Customers Telephones
Maintenance shop Breakdown machines Mechanics
Shopping mall/super markets Members of public Counter clerk

In addition to these examples, many subsystems of production, finance, personnel and


marketing functions of an organization can be modelled as queueing systems for
management decision making.

1
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

6.2 Terminologies of Queueing System

A schematic representation of a simple queueing system that consists of a queue and a


service station is shown in Figure 6.1.

Figure 6.1: Queueing system.

Customers who come to the system to get the required service will directly enter the service
station without waiting in the queue if the server is free at that point of time. Otherwise, they
will wait in the queue till the server becomes free. But in reality, there may be variations of
the system as given below.

1. The number of queues may be more than one. If there is a queue for male as well as
for female customers, then generally, alternate mode of selecting customers from each
queue is followed.
2. The number of servers may be more than one. This is an example of parallel counters
for providing service.
3. Sometimes, the service may be provided in multi-stages in sequential order. This type
of system is known as queues in tandem.

Bulk arrival. Generally, it is assumed that the customers arrive into the system one by one.
But, in' some reality, customers may arrive in groups. Such arrival is called as bulk arrival.

Jockeying. If there is more than one queue, the customers from one queue will be tempted
to join another queue because of its smaller size. This behaviour of the customers is known
as queue jockeying.

Balking. If the queue length appears very large to a customer he/she may not join the
queue. This property is known as balking of customers.

Reneging. Sometimes, a customer who is already in the queue will leave the queue in
anticipation of longer waiting time. This kind of departure from the queue without receiving
the service is known as reneging.

The list of variables which is used in queueing models is presented below:

n Number of customers in the system


C Number of servers in the system
pn(t) Probability of having n customers in the system at time t
pn Steady-state probability of having n customers in the system
P0 Probability of having 0 customer in the system
Lq Average number of customers waiting in the queue
Ls Average number of customers waiting in the system (in the queue and in the
service station)
Wq Average waiting time of customers in the queue
Ws Average waiting time of customers in the system (in the queue and in the service
station)

2
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

 Arrival rate of customers


 Utilization factor of the server
µ Service rate of the server
eff Effective arrival rate of customers
M Poisson distribution
N Maximum number of customers permitted in the system. Also, it denotes the size
of the calling source of the customers
GD General discipline for service. This may be first-in-first-serve (FIFS), last-in-first-
serve (LIFS), random order (RO), etc.

6.3 Governing Equations for a Single-Server Queuing System

Assume that the population of units that may demand service is infinite with the number of
arrivals per period a random variable with a Poisson distribution. It is also assumed that the
time required to service each unit is a random variable with an exponential distribution.
Events are recognized to have occurred at the time of arrival of a unit or at the time of
completion of a service.

The expected number of arrivals per period may be expressed as , and the expected
number of service completions per period may be expressed as .

Probability of n Units in the System

Under the foregoing assumptions, the probability that an arrival occurs between the time t
and time t + t is t. Similarly, the probability that a service completion occurs between
time t and time t + t, given that a unit is being serviced at time t, is t. Let;

n = number of units in the system at time t, including the unit being served, if any

pn(t) = probability of n units in the system at time t.

Because the time interval t is small, it can be assumed that the probability of more than
one arrival or service completion during the interval is negligible. Consider the event that
there are n units in the system at time t + t with n ≥ 1 expressed as;

Event {n units in the system at time t + t}

= Event {n units in the system at time t, no arrivals during interval t, and no service
completions during interval t}, or
Event {n + 1 units in the system at time t, no arrivals during interval t, and one service
completion during interval t}, or
Event {n – 1 units in the system at time t, one arrival during interval t, and no service
completion during interval t}

The probability of the event n units in the system at time t + t can be written as the sum of
the probabilities of these three mutually exclusive events as;

pn(t + t) = {pn(t)[1 – t][1 – t]} + {pn+1(t)[1 – t] t} + {pn-1(t) t[1 – t]}
= pn(t) – ( + ) pn(t) t + pn(t)(t)2 + pn+1(t)(t) – pn+1(t)(t)2
+ pn-1(t) (t) – pn-1(t) (t)2 (6.1)

Terms involving (t)2 can be neglected. Subtracting pn(t) from both sides and dividing by t
yields

3
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

𝑝𝑛 (𝑡 + ∆𝑡) − 𝑝𝑛 (𝑡)
= −(𝛿 + 𝜇)𝑝𝑛 (𝑡) + 𝜇𝑝𝑛+1 (𝑡) + 𝛿𝑝𝑛−1 (𝑡)
∆𝑡

In the limit,
𝑙𝑖𝑚 𝑝𝑛 (𝑡+∆𝑡)−𝑝𝑛 (𝑡) 𝑑
∆𝑡 → 0 ∆𝑡
= 𝑑𝑡 𝑝𝑛 (𝑡) = −(𝛿 + 𝜇)𝑝𝑛 (𝑡) + 𝜇𝑝𝑛+1 (𝑡) + 𝛿𝑝𝑛−1 (𝑡) (6.2)

For the special case n = 0,

Event (0 units in the system at time t + t}

= Event (0 units in the system at time t and no arrivals during the interval t}, or
Event (1 unit in the system at time t, no arrivals during the interval t, and one service
completion during the interval t]

The probability of no units in the system at time t + t can be written as the sum of the
probabilities of these two mutually exclusive events as;

p0(t + t) = {p0(t)[1 – t]} + {p1(t)[1 – t]t}


= p0(t) – p0(t)t + p1(t) t – p1(t)(t)2 (6.3)

Again neglecting terms involving (t)2, subtracting p0(t) from both sides, and dividing by (t),
we obtain;

𝑝0 (𝑡 + ∆𝑡) − 𝑝0 (𝑡)
= −𝛿𝑝0 (𝑡) + 𝜇𝑝1 (𝑡)
∆𝑡

In the limit,

𝑑 𝑙𝑖𝑚 𝑝0 (𝑡+∆𝑡)−𝑝0 (𝑡)


𝑝 (𝑡) =∆𝑡 → 0 = −𝛿𝑝0 (𝑡) + 𝜇𝑝1 (𝑡) (6.4)
𝑑𝑡 𝑛 ∆𝑡

Equations (6.2) and (6.4) are called the governing equations of a Poisson arrival and
exponential service for a single-server queue. The differential equations constitute an
infinite system for which the general solution is rather difficult to obtain. Figure 6.2 shows
an example of the nature of the solution for a particular case.

As long as the probabilities pn(t) are changing with time, the queue is considered to be in a
transient state. From Figure 6.2 it should be noted that this change in pn(t) becomes smaller
and smaller as the time increases. Eventually, there will be little change in pn(t), and the
queue will have reached a steady state. In the steady state the rate of change dpn(t)/dt can
be considered to be zero and the probabilities considered to be independent of time. The
steady-state governing equations can be written as;

( + )pn = pn+1 + pn-1 (6.5)

And,

p0 = p1 (6.6)

4
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Figure 6.2: Transient solution to governing equations.

Equations (6.5) and (6.6) constitute an infinite system of algebraic equations that can be
solved by substituting pn+1 = pn. into Equation (6.5) giving;

pn = pn-1

And,

( + )pn-1 = pn + pn-1


= pn-1 + pn-1

( + )pn-1 = (2 + )pn-1

or
( + ) = 2 + 

𝛿
Where: ∅ = 𝜇

 is an important ratio. It is called ‘the utilization factor of the service facility’. Substitution in
Equation (6.6) gives the same result. Using this substitution, the general solution can be
written as;

p1 = p0, and (i)

pn = pn-1 = np0 (ii)

However, because

∑ 𝑝𝑛 = 1, …
𝑛=0

5
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

∞ ∞
1
1 = ∑ 𝑝0 ∅ = 𝑝0 ∑ ∅𝑛 = 𝑝0 (
𝑛
)
1−∅
𝑛=0 𝑛=0

Hence,
𝛿
𝑝0 = 1 − (iii)
𝜇

And,
𝛿 𝛿 𝑛
𝑝𝑛 = (1 − 𝜇) (𝜇) (iv)

𝑛
𝛿
𝑛=0( ⁄𝜇) is that / be less than 1. This
The requirement for the convergence of the sum ∑∞
means that the arrival rate  must be less than the service rate  for the queue to reach
steady state.

Minimum-Cost Service Rate

The expected total system cost per period is the sum of the expected waiting cost per period
and the expected facility cost per period, that is,

𝑇𝐶𝑚 = 𝑊𝐶𝑚 + 𝐹𝐶𝑚 (v)

The expected waiting cost per period is obtained as the product of cost of waiting per period,
the expected number of units arriving per period, and the average time each unit spends in
the system, or

1 𝐶𝑤 𝛿
𝑊𝐶𝑚 = 𝐶𝑤 (𝛿) = (vi)
𝜇−𝛿 𝜇−𝛿

Alternatively, the expected waiting cost per period can be obtained as the product of cost
of waiting per period and the mean number of units in the system during the period, or;

𝐶𝑤 𝛿
𝑊𝐶𝑚 = 𝐶𝑤 (𝑛𝑚 ) = (vii)
𝜇−𝛿

The expected service cost per period is the product of the cost of servicing one unit and the
service rate in units per period, or

𝐹𝐶𝑚 = 𝐶𝑓 (𝜇) (viii)

The expected total system cost per period is the sum of these cost components and may
be expressed as

𝐶𝑤 𝛿
𝑇𝐶𝑚 = + 𝐶𝑓 (𝜇) (ix)
𝜇−𝛿

A minimum-cost service rate may be found by differentiating with respect to , setting the
result equal to zero, and solving for , as follows:

𝑑𝑇𝐶𝑚 −𝐶𝑤 𝛿
= + 𝐶𝑓 = 0
𝑑𝜇 (𝜇 − 𝛿)2

(𝜇 − 𝛿)2 𝐶𝑓 = 𝛿𝐶𝑤

6
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

𝛿𝐶
𝜇 = 𝛿 + √ 𝐶𝑤 (x)
𝑓

Example 6.1
As an application of the preceding model, consider the following Poisson arrival and
exponential service-time situation. The mean time between arrivals is eight periods, the
cost of waiting is $0.10 per unit per period, and the facility cost for serving 1 unit is $0.165.
The expected waiting cost per period, the expected facility cost per period, and the expected
total system cost per period are exhibited as a function of  in Table 6.1. The expected
waiting cost per period is infinite when  =  and decreases as  increases. The expected
facility cost per period increases with increasing values of . The minimum expected total
system cost occurs when  is 0.4 unit per period.

Table 6.1: Cost components for exponential service duration


 WCm FCm TCm
0.125 $∞ $0.0206 $∞
0.150 0.5000 0.0248 0.5248
0.200 0.1667 0.0330 0.1997
0.250 0.1000 0.0413 0.1413
0.300 0.0714 0.0495 0.1209
0.400 0.0455 0.0660 0.1115
0.500 0.0333 0.0825 0.1158
0.600 0.0263 0.0990 0.1253
0.800 0.0185 0.1320 0.1505
1.000 0.0143 0.1650 0.1793

The minimum-cost service rate may be found directly as follows:

(0.125)($0.10)
 = 0.125 + = 0.400 unit per period
0.165

These and similar other statistics about the queue are called the operating characteristics
of the queuing system. Usually one is interested in only some of these quantities.

6.4 Empirical Queueing Models

The basic queueing models can be classified into six categories using Kendall notation
which in turn uses six parameters to define a model such as (P/Q/R): (X/Y/Z). The
parameters of this notation are:

P = Arrival rate distribution


Q = Service rate distribution
R = Number of servers
X = Service discipline
Y = Maximum number of customers permitted in the system
Z = Size of the calling source of the customers

The basic six queueing models as per this classification are as shown in Table 6.2.

7
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Table 6.2: Classification of queueing models


Kendall notation Parameter Description
(M/M/1):(GD//) P Poisson arrival rate
Q Poisson service rate
R Single server
X General discipline
Y Infinite number of customers is permitted in the system
Z Size of the calling source is infinite
(M/M/C):(GD//) P Poisson arrival rate
Q Poisson service rate
R Multiple servers
X General discipline
Y Infinite number of customers is permitted in the system
Z Size of the calling source is infinite
(M/M/1):(GD/N/) P Poisson arrival rate
Q Poisson service rate
R Single server
X General discipline
Y Finite number of customers is permitted in the system
Z Size of the calling source is infinite
(M/M/C):(GD/N/) P Poisson arrival rate
Q Poisson service rate
R Multiple servers
X General discipline
Y Finite number of customers is permitted in the system
Z Size of the calling source is infinite
(M/M/1):(GD/N/N) P Poisson arrival rate
Q Poisson service rate
R Single server
X General discipline
Y Finite number of customers is permitted in the system
Z Size of the calling source is finite
(M/M/C):(GD/N/N) P Poisson arrival rate
Q Poisson service rate
R Multiple servers
X General discipline
Y Finite number of customers is permitted in the system
Z Size of the calling source is finite

6.4.1 (M/M/1): (GD//) Model

The parameters of this model are given as follows:

(i) Arrival rate follows Poisson distribution.


(ii) Service rate follows Poisson distribution.
(iii) Number of servers is one.
(iv) Service discipline is general discipline.
(v) Maximum number of customers permitted in the system is infinite.
(vi) Size of the calling source is infinite.

The steady-state formula to obtain the probability of having n customers in the system Pn,
and the formulae for p0, Lq, Ls, Wq and Ws are presented below:

𝛿
𝑝𝑛 = (1 − ∅)∅𝑛 , n = 0, 1, 2, 3, …,  where, ∅ = 𝜇
<1


𝐿𝑠 =
1−∅

8
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

𝛿 ∅2
𝐿𝑞 = 𝐿𝑠 − 𝜇 = 1−∅

𝐿𝑠 1 1
𝑊𝑠 = = =
𝛿 (1 − ∅)𝜇 𝜇 − 𝛿

𝐿𝑞 ∅
𝑊𝑞 = =
𝛿 𝜇−𝛿

Example 6.2
The arrival rate of customers at a banking counter follows Poisson distribution with a mean
of 45 per hour. The service rate of the counter clerk also follows Poisson distribution with a
mean of 60 per hour.

a) What is the probability of having 0 customer in the system (p0)?


b) What is the probability of having 5 customers in the system (p5)?
c) What is the probability of having 10 customers in the system (p10)?
d) Find Ls, Lq, Ws and Wq.

Solution
Arrival rate,  = 45 per hour
Service rate, µ = 60 per hour
𝛿 45
Utilization factor, ∅ = 𝜇 = 60 = 0.75

a) 𝑝0 = (1 − 0.75)0.750 = 0.25

b) 𝑝5 = (1 − 0.75)0.755 = 0.059

c) 𝑝10 = (1 − 0.75)0.7510 = 0.014

∅ 0.75
d) 𝐿𝑠 = = = 3 customers
1−∅ 1−0.75

∅2 0.752
𝐿𝑞 = 1−∅ = 1−0.75 = 2.25 customers

1 1
𝑊𝑠 = = = 0.067 hours
𝜇 − 𝛿 60 − 45

∅ 0.75
𝑊𝑞 = = = 0.050 hours
𝜇−𝛿 60 − 45

Example 6.3
Vehicles pass through a toll gate at a rate of 90 per hour. The average time to pass through
the gate is 36 seconds. The arrival rate and service rate follow Poisson distribution. There
is a complaint that the vehicles wait for long duration. The authorities are willing to install
one more gate to reduce the average time to pass through the toll gate to 30 seconds if the
idle time of the toll gate is less than 10% and the average queue length at the gate is more
than 5 vehicles. Check whether the installation of the second gate is justified.

9
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Solution
Arrival rate of vehicles at the toll gate,  = 90 per hour and the time taken to pass through
the gate = 36 seconds. Therefore,
1
The service rate, 𝜇 = 36 x 3600 = 100 vehicles per hour

𝛿 90
Utilization factor, ∅ = 𝜇 = 100 = 0.90

a) Number of vehicles waiting in the queue,

∅2 0.902
𝐿𝑞 = 1−∅ = 1−0.90 = 8.1 vehicles

b) Revised time taken to pass through


1
The service rate, 𝜇 = 30 x 3600 = 120 vehicles per hour

𝛿 90
Utilization factor, ∅ = 𝜇 = 120 = 0.75

Percentage idle time of the gate = 1 –  = 1 – 0.75 = 0.25 = 25%

From the above results, it is clear that the average waiting number of vehicles in the queue
is more than 5 but the idle time of the toll gate is not less than 10%. Hence, the installation
of another gate is not justified.

Example 6.4
The arrival rate of customers at the single window booking counter of a two wheeler agency
follows Poisson distribution and the service time follows exponential (negative) distribution
and hence, the service rate also follows Poisson distribution. The arrival rate and the service
rate are 25 customers per hour and 35 customers per hour, respectively. Find the following:

a) Utilization of the booking clerk.


b) Average number of customers waiting in the queue.
c) Average number of customers waiting in the system
d) Average waiting time per customer in the queue.
e) Average waiting time per customer in the system

Solution
The arrival rate of customers at the booking counter,  = 25 customers per hour
The service rate of the booking clerk, µ = 35 customers per hour
The problem comes under (M/M/1): (GD//).

𝛿 25
a) Utilization of the booking clerk, ∅ = 𝜇 = 35 = 0.71429

∅2 0.714292
b) Average number of customers waiting in the queue, 𝐿𝑞 = 1−∅ = 1−0.71429 =
1.786 customers

∅ 0.71429
Average number of customers waiting in the system, 𝐿𝑠 = 1−∅ = 1−0.71249 =
2.5 customers

10
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

∅ 0.71249
c) Average waiting time per customer in the queue, 𝑊𝑞 = 𝜇−𝛿 = 35−25
=
0.07143 hours = 4.286 minutes
1 1
Average waiting time per customer in the system, 𝑊𝑠 = 𝜇−𝛿 = 35−25 = 0.1 hours =
6 minutes

Example 6.5
A harbour has single dock to unload the containers from the incoming ships. The arrival
rate of ships at the harbour follows Poisson distribution and the unloading time for the ships
follows exponential (negative) distribution and hence, the service rate also follows Poisson
distribution.

The arrival rate and the service rate are 8 ships per week and 14 ships per week,
respectively. Find the following:

a) Utilization of the dock.


b) Average number of ships waiting in the queue.
c) Average number of ships waiting in the system.
d) Average waiting time per ship in the queue.
e) Average waiting time per ship in the system.

Solution
The arrival rate of ships at the harbour,  = 8 ships per week
The service rate of the dock, µ = 14 ships per week
This problem comes under (M/M/1): (GD//).

𝛿 8
a) Utilization of the dock, ∅ = 𝜇 = 14 = 0.57143

∅2 0.571432
b) Average number of ships waiting in the queue, 𝐿𝑞 = 1−∅ = 1−0.57143 = 0.762 ships

∅ 0.57143
c) Average number of ships waiting in the system, 𝐿𝑠 = 1−∅ = 1−0.57143 = 1.333 ships

∅ 0.57143
d) Average waiting time per ship in the queue, 𝑊𝑞 = 𝜇−𝛿 = 14−8
= 0.095 weeks =
0.6667 days
1 1
e) Average waiting time per ship in the system, 𝑊𝑠 = 𝜇−𝛿 = 14−8 = 0.167 weeks =
01.167 days

6.4.2 (M/M/C): (GD//) Model

The parameters of this model are as follows:

(i) Arrival rate follows Poisson distribution.


(ii) Service rate follows Poisson distribution.
(iii) Number of servers is C.
(iv) Service discipline is general discipline.
(v) Maximum number of customers permitted in the system is infinite.
(vi) Size of the calling source is infinite.

11
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

The steady-state formula to obtain the probability of having n customers in the system pn
and the formulae for p0, Lq, Ls, Wq and Ws are presented below.

∅𝑛
𝑝𝑛 = 𝑝 , 0≤𝑛≤𝐶
𝑛! 0

∅𝑛
𝑝𝑛 = 𝑝0 𝑛>𝐶
𝐶 𝑛−𝐶 𝐶!

Where,

∅ 𝛿
< 1 or <1
𝐶 𝜇𝐶

𝐶−1 −1
∅𝑛 ∅𝐶
𝑝0 = {∑ + }
𝑛! 𝐶! [1 − (∅⁄𝐶 )]
𝑛=0

∅𝐶+1
𝐿𝑞 = 𝑝
(𝐶 − 1)! (𝐶 − ∅)2 0

𝐿𝑠 = 𝐿𝑞 + ∅

𝐿𝑞
𝑊𝑞 =
𝛿
1
𝑊𝑠 = 𝑊𝑞 +
𝜇

Now the formulae for p0 and Lq under special conditions are:

∅𝐶+1
𝑝0 = 1 − ∅, 𝐿𝑞 ≈ , where ∅ ≪ 1
𝐶2
And

(𝐶 − ∅)(𝐶 − 1)! ∅ ∅
𝑝0 = 𝑐
and 𝐿𝑞 = , where ≈ 1.
𝐶 𝐶−∅ 𝐶

Example 6.6
At a central warehouse, vehicles arrive at the rate of 18 per hour and the arrival rate follows
Poisson distribution. The unloading time of the vehicles follows exponential distribution and
the unloading rate is 6 vehicles per hour. There are 4 unloading crews. Find the following:

a) p0 and p3.
b) Lq, Ls, Wq and Ws.

Solution
Arrival rate,  = 18 per hour
Unloading rate, µ = 6 per hour
Number of unloading crews, C = 4

And,

12
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

𝛿 18
= = 0.75 < 1 and ∅ = 𝛿 ⁄𝜇 = 18⁄6 = 3
𝜇𝐶 6 ∗ 4

a) Therefore, p0 is computed as:

𝐶−1 −1 3 −1
∅𝑛 ∅𝐶 3𝑛 34
𝑝0 = {∑ + } = {∑ + }
𝑛! 𝐶! [1 − (∅⁄𝐶 )] 𝑛! 4! [1 − (3⁄4)]
𝑛=0 𝑛=0

−1
30 31 32 33 34
𝑝0 = { + + + + } = 0.0377 = 0.038
0! 1! 2! 3! 4! [1 − (3⁄4)]

Now to compute p3, we have

∅𝑛
𝑝𝑛 = 𝑝 0≤𝑛≤𝐶
𝑛! 0,

33
𝑝3 = ∗ 0.038 = 0.1697 = 0.170
3!

b) Lq, Ls, Wq and Ws. are computed as under.

∅𝐶+1 35
𝐿𝑞 = 𝑝0 = ∗ 0.038 = 1.53 ≈ 2 vehicles
(𝐶 − 1)! (𝐶 − ∅)2 (4 − 1)! (4 − 3)2

𝐿𝑠 = 𝐿𝑞 + ∅ = 1.53 + 3 = 4.53 ≈ 5 vehicles

𝐿𝑞 1.53
𝑊𝑞 = = = 0.085 hours = 5.1 minutes
𝛿 18
1 1
𝑊𝑠 = 𝑊𝑞 + = 0.085 + = 0.252 hours = 15.12 minutes
𝜇 6

Example 6.7
The arrival rate of breakdown machines at a maintenance shop follows Poisson distribution
with a mean of 4 per hour. The service rate of machines by a maintenance mechanic also
follows Poisson distribution with a mean of 3 per hour. The downtime cost per hour of a
breakdown machine is Kshs 200. The labour rate per hour is Kshs 50. Determine the
optimal number of maintenance mechanics to be employed to repair the machines such
that the total cost is minimized.

Solution
The following are given:

Arrival rate,  = 4 per hour


Service rate, µ = 3 per hour
Downtime cost of machine = Kshs 200 per hour
Labour cost = Kshs 50 per hour
Since,  > µ, a minimum of 2 mechanics will be required. Therefore,

𝛿 4
∅= = = 1.33
𝜇 3

13
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Whatever may be the number of mechanics, the breakdown machines have to wait for the
same amount of time in the service station. So, the value of Lq is alone used to compute
the cost of down-time of machines.

Case 1: When C = 2

𝐶−1 −1 1 −1
∅𝑛 ∅𝐶 1.33𝑛 1.332
𝑝0 = {∑ + } = {∑ + }
𝑛! 𝐶! [1 − (∅⁄𝐶 )] 𝑛! 2! [1 − (1.33/2)]
𝑛=0 𝑛=0

−1
1.330 1.331 1.332
𝑝0 = { + + } = 0.2
0! 1! 2! [1 − (1.33⁄2)]

And
∅𝐶+1 1.333
𝐿𝑞 = 𝑝0 = ∗ 0.2 = 1.048 = 1.05
(𝐶 − 1)! (𝐶 − ∅)2 (2 − 1)! (2 − 1.33)2

Therefore,
Downtime cost per hour = Lq x 200 = 1.05 x 200 = Kshs 210
Wage paid to 2 mechanics/hour = 2 x 50 = Kshs 100
Total cost = 210 + 100 = Kshs 310

Case 2: When C = 3

𝐶−1 −1 2 −1
∅𝑛 ∅𝐶 1.33𝑛 1.333
𝑝0 = {∑ + } = {∑ + }
𝑛! 𝐶! [1 − (∅⁄𝐶 )] 𝑛! 3! [1 − (1.33/3)]
𝑛=0 𝑛=0

−1
1.330 1.331 1.332 1.333
𝑝0 = { + + + } = 0.255
0! 1! 2! 3! [1 − (1.33⁄3)]

And,
∅𝐶+1 1.334
𝐿𝑞 = 𝑝0 = ∗ 0.255 = 0.143
(𝐶 − 1)! (𝐶 − ∅)2 (3 − 1)! (3 − 1.33)2

Therefore,

Downtime cost per hour = Lq x 200 = 0.143 x 200 = Kshs 28.60


Wage paid to 3 mechanics/hour = 3 x 50 = Kshs 150.00
Total cost = 28.60 + 150.00 = Kshs 178.60

Case 3: When C = 4, the total wage for 4 mechanics itself is Kshs 200. Hence, the total
cost with respect to 4 mechanics will be greater than Kshs 200. The minimum total cost is
Kshs 178.60, when the number of maintenance mechanics is 3. Therefore, the optimal
number of mechanics to be employed is 3.

Example 6.8
There are three clerks in the loan section of a bank to process the initial queries of
customers. The arrival rate of customers follows Poisson distribution and it is 20 per hour.
The service rate also follows Poisson distribution and it is 9 customers per hour. Find the
following:

a) Average number of customers waiting in the queue as well as in the system.

14
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

b) Average waiting time per customer in the queue as well as in the system.

Solution
The arrival rate of customers in the loan section of the bank,  = 20 customers per hour
The service rate, µ = 9 customers per hour
Number of clerks, C = 3
This problem comes under (M/M/C): (GD//).

𝛿 20
Therefore, ∅ = 𝜇 = 9
= 2.222

p0 is computed as:

𝐶−1 −1 2 −1
∅𝑛 ∅𝐶 2.222𝑛 2.2223
𝑝0 = {∑ + } = {∑ + }
𝑛! 𝐶! [1 − (∅⁄𝐶 )] 𝑛! 3! [1 − (2.222/3)]
𝑛=0 𝑛=0

−1
2.2220 2.2221 2.2222 2.2223
𝑝0 = { + + + } = 0.0788 = 0.079
0! 1! 2! 3! [1 − (2.222/3

a) Average number of customers waiting in the queue, Lq is computed as:

∅𝐶+1 2.2224
𝐿𝑞 = 𝑝 = ∗ 0.079 = 1.581 customers
(𝐶 − 1)! (𝐶 − ∅)2 0 (3 − 1)! (3 − 2.222)2

Therefore, the average number of customers waiting in the system, Ls = Lq + 

Ls = 1.581 + 2.222 = 3.803 customers


𝐿𝑞 1.581
b) Average waiting time per customer in the queue, 𝑊𝑞 = = = 0.079 =
𝛿 20
4.744 minutes
1 1
Average waiting time per customer in the system, 𝑊𝑠 = 𝑊𝑞 + 𝜇 = 0.079 + 9
=
0.190 hours = 11.41 minutes

Example 6.9
There are four booking counters in a railway station. The arrival rate of customers follows
Poisson distribution and it is 30 per hour. The service rate also follows Poisson distribution
and it is 10 customers per hour. Find the following:

a) Average number of customers waiting in the queue as well as in the system.


b) Average waiting time per customer in the queue as well as in the system.

Solution
The arrival rate of customers at booking counters of a railway station,  = 30 customers
per hour
The service rate, µ = 10 customers per hour
Number of booking counters, C = 4
This problem comes under (M/M/C): (GD//).

𝛿 30
Therefore, ∅ = 𝜇 = 10 = 3

15
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

p0 is computed as:

𝐶−1 −1 3 −1
∅𝑛 ∅𝐶 3𝑛 34
𝑝0 = {∑ + } = {∑ + }
𝑛! 𝐶! [1 − (∅⁄𝐶 )] 𝑛! 4! [1 − (3/4)]
𝑛=0 𝑛=0

−1
30 31 32 33 34
𝑝0 = { + + + + } = 0.037736 = 0.038
0! 1! 2! 3! 4! [1 − (3/4

a) Average number of customers waiting in the queue, Lq is computed as:

∅𝐶+1 35
𝐿𝑞 = 𝑝 = ∗ 0.038 = 1.528 customers
(𝐶 − 1)! (𝐶 − ∅)2 0 (4 − 1)! (4 − 3)2

Therefore, the average number of customers waiting in the system, Ls = Lq + 

Ls = 1.528 + 3 = 4.528 customers


𝐿𝑞 1.528
b) Average waiting time per customer in the queue, 𝑊𝑞 = 𝛿
= 30
= 0.051 =
3.057 minutes
1 1
Average waiting time per customer in the system, 𝑊𝑠 = 𝑊𝑞 + 𝜇 = 0.051 + 9
=
0.151 hours = 9.057 minutes

6.5 Simulation

Simulation is an experiment conducted on a model of some system to collect necessary


information on the behaviour of that system. Some of the systems on which the simulation
experiment can be carried out are: reservation counter of a transport corporation, bank
counters, and inspection station of an assembly line, automobile assembly line, computer
network, toll gate, and berths in a harbour.

6.5.1 Need for Simulation

Consider an example of the queueing system, namely the reservation system of a transport
corporation. The elements of the system are booking counter (server) and waiting
customers (queue). Generally, the arrival rate of the customers follows Poisson distribution
and the service time follows exponential distribution. If the reservation system has the
above combination of distributions for its elements, then the queueing model, namely
(M/M/1): (GD//) can be used to find the standard results. But in reality, the following
combinations of distributions may exist.

1. Arrival rate does not follow Poisson distribution but the service time follows exponential
distribution.
2. Arrival rate follows Poisson distribution but the service time does not follow exponential
distribution.
3. Arrival rate does not follow Poisson distribution and the service time also does not follow
exponential distribution.

In each of the above cases, the non-standard distribution for the queueing system may be
discrete distribution, uniform distribution, normal distribution, etc. Under such situation, the

16
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

standard model (M/M/1): (GD//) cannot be used. The last resort to find the solution for
the non-standard queueing model is to use simulation. Similarly, if there is a deviation from
other standard models of queueing system, one can use simulation. In practice, a system
with any kind of assumptions can be tackled using simulation.

To quote a few of them, the variations of the queueing system-bulk arrival, jockeying,
balking, reneging, priority are provided. Under these variations, simulation is the only
method to find solution for a given problem.

Model is an abstraction of a reality and it is used for experimentation. For example, the
maintenance shop of a manufacturing industry; the shop can be modelled as a queueing
system with maintenance mechanics as servers and the breakdown machines as
customers. Later, this model can be experimented to obtain the standard results as:

• Percentage utilization of servers,


• Average waiting number of breakdown machines,
• Average waiting time per breakdown machine.

6.5.2 Types of Simulation

There are four types of simulation, discussed as follows:

Identity simulation. This is the observance of the behaviour of the real system under as
many operational configurations as possible to get an insight into system behaviour. But
the identity simulation is very expensive, seldom feasible, time consuming and permits little
control over parameters that affect the response of the system.

Quasi-identity simulation. In quasi-identity simulation, aspects of the real-world system


are preserved while some elements, whose presence would make the identity simulation
impossible, are excluded. Simulation of an air attack over a country by its enemy aircraft is
an example of quasi-identity simulation.

Laboratory simulation. This is a cheaper method than the other two methods described
earlier. Consider an example of an operational gaming in which the business system is
represented by its entities such as production, personnel, finance, marketing, logistics and
its players (executives) within its competing environment. In this type of simulation,
transactions are carried over a specified period and then the operating performance of the
business is reviewed.

Computer simulation. If we remove people from the laboratory simulation with a well-
designed computer logic and retain other aspects, then it is called as 'computer simulation'.

Advantages of simulation

1. The time for experimentation can be compressed.


2. The system performance can be studied under all possible conditions.
3. The success or failure of a system can be tested using a conceptual system.

Since the use of simulation is a costly exercise, it should be used as the last resort.

17
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Figure 6.3: Major steps of simulation experiment.

6.5.3 Simulation of a Single-Server Queue

Let us simulate the arrival and servicing of N customers by a single server. Let these
customers be marked 1, 2,… N. Let the inter-arrival time ATk denote the time gap between
the arrivals of the (k-1)th customer and the kth customer into the system. These times will
be generated, as samples from some specified probability distribution, by means of an
appropriate random number generator. Similarly, let STk denote the service time of the kth
customer, k = 1, 2,…, N. The service times are also generated as samples from some
specified probability distribution. We will use CATk to denote the cumulative arrival time of
the kth customer.

We will assume that initially there is no queue, and the server is free. As the first customer
arrives, at time zero, he goes directly to the service counter. After service, this customer
departs from the service counter (and, therefore, from the system) at time ST1. The second
customer will arrive at;

CAT2 = AT2

If ST1 > CAT2, the second customer has to wait (forming a queue of length 1) for a period

WT2 = ST1 – CAT2

(WTk denotes the waiting time of the kth customer in the queue). On the other hand, if
CAT2 > ST1 then the first customer departs before the second customer arrives. Thus, the
service counter remains idle awaiting the arrival of the second customer for a period

IDT2 = CAT2 – ST1

(IDTk denotes the idle time of the server awaiting the arrival of the kth customer).

To consider the general situation let us assume that so far (i – 1) customers have arrived
into the system and (j – 1) customers have left. T1 is, the next customer due to arrive is the
ith and the next customer due to depart is the jth. Note that,

1≤j≤i≤N

and the queue length is given by (i – j – 1), if i > j. The next arrival time NAT = CATi.. The
next departure time (NDT), i.e., the cumulated departure time CDTj of the jth customer is
given by

18
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

NDT = CDTj = cumulative arrival time of j + waiting time of j + service time of j


CDTj = CATj + WTj + STj

We must now determine which event would take place–whether i would arrive first or j
would depart first. This is decided by comparing NAT with NDT. If the difference

DIF = NAT – NDT

is negative, an arrival would take place first, and the length of the queue would increase by
1. If DIF is positive and the queue length (i – j – 1) is also positive then a departure would
take place first, reducing the length of queue by 1. In both these cases there is no idle time
for the service counter. However, if DIF is positive and the queue length is zero, then the
service counter will lie idle waiting for the ith customer for the duration

IDTi = DIF

Finally, DIF = 0 implies that both events–the next arrival and departure–will take place
simultaneously, leaving the queue length unaltered.

This next-event simulation procedure for this simple queuing situation is shown in
Figure 6.4.

In the flowchart, the inter-arrival times ATi's and the service times STi's can be generated
by calling the suitable subroutines. From the inter-arrival times, the cumulative arrival times
are easily calculated using the relationship

CATk = CATk-1 + ATk,

And CAT1 = AT1 = 0

The event times are indicated by the variable CLOCK.

One can calculate many different statistics, as regards the output, such as:
• Maximum queue length
• Average queue length (averaged over all queue lengths, including zero)
• Average length of nonempty queue (averaged over only non-zero queue lengths)
• Average number of customers in the system
• Probability that there are m customers in the system
• Average waiting time (averaged over all customers)
• Average waiting time of customers that wait (averaged over only those customers
• that wait in the queue).
• Maximum waiting time
• Average time spent by a customer in the system.
• Total idle time
• Percentage of the time the service counter is idle
• Percentage of the time the service counter is busy (utilization)
• Average fraction of the time a customer spends waiting in the
queue.

Because of the very divergent nature of statistics required, they have not been included in
the flowchart.

19
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Figure 6.4: Flowchart for one server queue simulation.

In the flowchart we have obtained the vector QL(I) the queue length immediately after the
ith arrival, for i = 1, 2, ... , N. From this one could compute the average queue length, and
the maximum queue length. Similarly, we have produced an array IDT(I), giving the idle
time of the service counter while waiting for the ith arrival i = 1, 2, …, N. From the array
one could get the maximum idle time, the total idle time, or the average idle time. The
waiting time of the ith customer is given by

WTI = CDTi – STi – CATi.

Since the three terms on the right-hand side are available to us, the left-hand side can be
easily computed. From WTi's we can find the total waiting time, or maximum waiting time,
or average waiting time. The average may be computed over all customers, or over only
those customers that had to wait in the queue. In some experiments we may be interested
not in the waiting time, but the total time spent by the customer in the system, i.e., in quantity
WTi + STi.

If several of the statistics are required, it is best to write a separate subroutine and call it at
the completion of the portion of the program shown in the flowchart.

20
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Example 6.22
To illustrate the procedure for simulating this queuing situation let us consider the following
example.

Let N = 8, and let the generated inter arrival times and service times be

ATi's = (0, 10, 15, 35, 30, 10, 5, 5)


STi's = (20, 15, 10, 5, 15, 15, 10, 10)

Therefore, the operating statistics are as indicated in Table 6.3.

Table 6.3: Operating statistics for the single server queuing problem
k ATk CATk STk CDTk IDTk WTk QLk
1 0 0 20 20 0 0 0
2 10 10 15 35 0 10 1
3 15 25 10 45 0 10 1
4 35 60 5 65 15 0 0
5 30 90 15 105 25 0 0
6 10 100 15 120 0 5 1
7 5 105 10 130 0 15 1
8 5 110 10 140 0 20 1
Note: CDTk = CATk + WTk + STk

The realization of this queuing process is depicted in Figure 6.5. Each arrival event is shown
as a cross and each departure as a dot on the time axis.

Arrays generated by the procedure are:

Cumulative departure times,

CDTi’s = (20, 35, 45, 65, 105, 120, 130, 140);

queue lengths immediately after each arrival,

QLi's = (0, 1, 1, 0, 0, 1, 1, 2)

and the idle times,

IDTi's = (0, 0, 0, 15, 25, 0, 0, 0).

The program terminates at time 140, when the last departure takes place. Note that on one
occasion two events occur simultaneously–the departure of customer No. 5 and the arrival
of customer No. 7, at time 105.

21
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Figure 6.5: Server queue.

6.5.4 Simulation of a Two-Server Queue

Let us consider the following situation: Ships arrive at a harbour according to the given
probability distribution for inter-arrival times. There are two docking facilities, 1 and 2, at the
harbour. When a ship arrives at the system both facilities are checked to determine if either
of them is free. The ship goes directly to whichever facility is free. If both are free then the
ship goes to the facility that has been idle for a longer period. If both are occupied then the
ship joins the common queue, causing a waiting time for itself and increasing the queue
length by one. The ships in the queue are serviced (unloaded, loaded, and dispatched) on
a first-come-first-served basis. The service times for each docking facility can be viewed as
independent samples from some specified distributions. When a service facility becomes
vacant before the next ship arrives, idle time occurs until a ship arrives and enters the
vacant docking facility. We are interested in determining the usual operating characteristics
(such as queue lengths, waiting times, idle times, etc.) of this system through simulation.

Example 6.23
Before formulating the general problem let us first acquire an understanding of this system
through a small example given in a tabular form (Table 6.4).

We have six ships arriving at times 0, 10, 48, 55, 65, 85 hours. The simulation starts at time
zero. At that time there are no ships in the system.

The first column in the table is ships serial number, k. The second column gives the ATk's,
the inter-arrival times. That is, ATk = time gap between the arrival of (k – 1)th ship and the
kth ship. Therefore,

AT1 = 0

The third column contains the cumulative arrival times CATk's of the ships. Hence,

CATk= CATk-1 + ATk

CAT1 = AT1 = 0

22
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Table 6.4
Facility 1 Facility 2
k ATk CATk STk,1 CDTk,1 IDTk,1 STK,2 CDTk,2 IDTk,2 WTk QLk
1 0 0 25 25 0 - - - 0 0
2 10 10 - - - 30 40 10 0 0
3 38 48 22 70 23 - - - 0 0
4 7 55 - - - 50 105 15 0 0
5 10 65 45 115 0 - - - 5 1
6 20 85 - - - 15 120 0 20 1
Note: CDTk = CATk + WTk + STk

As the first ship arrives at time zero, it goes directly to Facility 1. The service time of Ship
1 at Facility 1 turns out to be 25 hours. Therefore, at 25 hours Ship 1 leaves the system.
Column 4 gives STk,1 the service time for the kth ship at Facility 1. Column 5 contains the
cumulative departure time, that is, the time elapsed (since time 0) at the departure of the
kth ship from Facility 1. This time is denoted by CDTk,1. In the sixth column is the idle time
IDTk,1 of Facility 1, while waiting for Ship k to arrive. The next three columns give the
corresponding three numbers for Facility 2. The tenth column gives the waiting time (in the
queue) WTk for the kth ship. The last column contains the queue length QLk immediately
after the arrival of ship K.

At time 10 hours, the second ship arrives and goes directly to Facility 2. Since the service
time of Ship No. 2 at Facility 2 is 30 hours, it leaves the system at time 40, i.e.,
CDT2,2 = 40. Before Ship No. 2 arrived, Facility 2 was idle for 10 hours.

When the third ship arrives, we check to see which of the two facilities is vacant or will fall
vacant earlier. This is done by comparing the latest values of the cumulative departure
times CDT1,1 and CDT2,2. For these are the instants when the facilities would be free next.
The smaller of the two indicates the time when the next earliest departure from the system
would take place. Thus, the next departure time is

MNDT = min{25, 40} = 25

This gives the earliest time when the service for the Ship No. 3 can be started. Since

CAT3> MNDT

Ship No. 3 has not arrived at time 25, and therefore


CAT3 – MNDT = 48 – 25 = 23 = IDT3,1

is the amount of idle time Facility 1 spends while waiting for Ship No. 3 to arrive.

The cumulative departure time at Facility 1 of Ship No. 3 is given by

CDT3,1 = Cumulative arrival time for Ship No. 3 + Service time for Ship No. 3
= CAT3 + ST3,1
= 48 + 22 = 70

Before Ship No. 4 arrives at time 55, Facility 2 would have been released at time 40,
because

min {70, 40} = 40

and therefore the idle time IDT4,2 = 55 – 40 = 15. Since the service time ST4,2 = 50, Ship
No. 4 departs from Facility 2 at

23
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

CDT4,2 = CAT4 + ST4,2 = 55 + 50 = 105

Next, Ship No. 5 arrives and both facilities are busy. For

MNDT = min {70, 105} = 70 and CAT5 = 65.

Therefore, Ship No. 5 will form a queue and wait there for a period

MNDT – CAT5 = 70 – 65 = 5 hours

At the end of this period it would be serviced by Facility 1.

From time 70 to 105 hours, Facilities 1 and 2 will both be busy servicing Ship No. 5 and 4,
respectively. Therefore, Ship No. 6, arriving at CAT6 = 85, will have to wait in the queue for
20 hours to be serviced by Facility 2 at time 105.

The flowchart for the simulation of a 2-server queuing system is shown in Figure 6.6. It is
instructive to compare the flowchart of the 1-server system with that of the 2-server system.
In the former case we needed only one variable NDT to denote the next departure time. In
the case of a 2-server queue we require two next departure times NDT(1) and NDT(2), one
for each server. The minimum of these two, MNDT, tells us the time when a server would
be free next. It is MNDT that has to be compared with the next arrival time NAT to determine
whether an arrival or a departure takes place.

Figure 6.6: Simulation of two server queue.

24
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Moreover, we must know not only MNDT, the time of the next departure, but also which of
the two facilities will fall vacant at time MNDT. This is denoted by a variable M.

In case of a 1-server queue, it was sufficient to know the serial number of the customer
due to arrive next, i, and the serial number of the customer due to depart next, j. in order
to determine queue length as I – j – 1. This simple relationship does not hold in the case
of a multi-server queue, because the customers need not depart in the same order in which
they arrived. We therefore keep another pair of variables SERV(1) and SERV(2) to tell us
which customer is currently being served by Server 1 and Server 2, respectively. The larger
of these two numbers plus 1 is the customer to be served next (i.e., customer at the head
of the queue). This is taken care of by setting

SERV(M) = MAX{SERV(1), SERV(2)} + 1

in case of a departure in the presence of a queue.

The current queue length is denoted by the variable QLT, which is incremented by 1 if the
next event is an arrival; decremented by 1 (if positive) if the next event is a departure; and
left unaltered if both arrival and departure occur simultaneously. As in the case of a 1-
server, the queue lengths QL(I)'s are stored as a vector of size N for computation of needed
statistics at the end. The rest of the logic in this flowchart is the same as in the case of the
1-server queue.

Data generation and initialization: The inter-arrival times and service times can be
generated from any desired distribution by means of an appropriate subroutine, GENRAT
(AT, ST). Initialization and computation of cumulative arrival time AT(I)'s can also be done
by calling another subroutine INIT. Initialization consists of the following:

IDT(K, L) = 0 and CDT(K, L) = 0, for K = 1, N and L = 1,2 QL(K) = 0 for K


= 1, N
QLT= O.

Since the first ship goes to Facility 1 and the second to Facility 2, the next ship due to
arrive is the third. Therefore, we set

I=3
and
NAT = CAT(3)

The next departure time from Facility 1 is the service time of Ship 1, and this is also the
cumulative departure time of Ship 1 from Facility 1. Thus

NDT(1) = CDT(1,1) = ST(1)

Likewise, NDT(2) = CDT(2,2) = CAT(2) + ST(2)

Initial idle time for Facility 2 (in waiting for the arrival of Ship 2 is

IDT(2,2) = CAT(2)

Also initially,

SERV(1) = 1
SERV(2) = 2

25
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

Like the initialization, and data generation, the required statistics for the queuing system
can also be obtained by means of a subroutine

STAT (CAT, CDT, IDT, QL)

which uses the four arrays produced by the main program CAT(I), CDT(I,J), IDT(I, J) and
QL(I) for I = 1, N and J = 1, 2.

The following is a format-free FORTRAN program for simulating this 2-server queuing
system. The arrays have dimensions to handle up to 500 customers, but this could be
changed to any number desired.

INTEGER AT(500), ST(500), CAT(500), CDT(500, 2), QL(500), SERV(2)


INTEGER lDT(500, 2), NDT(2), ISER(500), QLT

C DATA GENERATION AND INITIALIZATION


CALL GENRAT (AT, ST)
CALL INIT(CAT, AT, QL, QLT, lDT, CDT, NAT, NDT, SERV, ISER)
I=1
READ, N
10 M= 1
MNDT = NDT(1)
IF (NDT(1). LE. NDT(2)) GO TO 20
M=2
MNDT = NDT(2)

20 IF (I. GT. N) GO TO 60
DIF = NAT – MNDT
IF (DIF) 30, 40, 50
C ARRIVAL TAKES PLACE

30 CLOCK = NAT
QLT = QL+1
QL(l) = QLT
I=I+1
NAT = CAT(I)
GO TO 70

C SIMULTANEOUS ARRIVAL AND DEPARTURE

40 CLOCK = NAT
SERV(M) = SERV(1) + 1
IF (SERV(2). GT. SERV(1)) SERV(M) = SERV(2) + 1
IJ = SERV(M)
ISER(IJ) = M
NDT(M) = NAT + ST(IJ)
CDT(IJ, M) = NDT(M)
I=I+1
NAT = CAT(l)
GO TO 70

C DEPARTURE TAKES PLACE

50 IF(QLT. GT. 0) GO TO 60

C FACILITY IDLES TILL NEXT ARRIVAL

IDT(I, M) = DIF
CLOCK = NAT

26
PART III: SYSTEM ANALYSIS AND DESIGN EVALUATION
Chapter 6: Queuing Theory and Analysis

SERV(M) = I
ISER(I) = M
NDT(M) = NAT + ST(I)
CDT(I, M) = NDT(M)
I=I+1
NAT = CAT(I)
GO TO 70

C HEAD OF THE QUEUE IS SERVED

60 CLOCK = MNDT
QLT = QLT – 1
SERV(M) = SERV(I) + 1
IF (SERV(2). GT. SERV(1)) SERV(M) = SERV(2) + 1
II = SERV(M)
ISER(II) = M
NDT(M) = NDT(M) + ST(ll)
CDT(II, M) = NDT(M)
C END OF SIMULATION RUN

70 IF (SERV(M). LT. N) GO TO 10
CALL STAT (CAT, CDT, IDT, QL)
STOP
END

27

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