### Notes of Simulation and Modelling [CT 753]

#### Queuing system

Elements of Queuing System

Queuing System

- In many real world scenario, queue is prevalent. The problem with the queue is that if it is not managed properly, the customers should wait a long time that causes chaos within the customers. To prevent customer from being unsatisfied with the provided service, queuing system is managed. For eg: During cash withdraw in bank, you have to stay in queue and if it is not managed properly then you will surely be disappointed from the bank service even if that bank is one of the finest one in the city.

Elements/Characteristics of Queuing System

1. Calling Population:
- The population of potential customers of the service is called calling population.
- It may be finite or infinite.
- The system of the restaurant, bank and so on are considered to be open system i.e. with infinite calling population.
- The system of repairing certain number of machines by a service man is considered to be closed system i.e. with finite calling population.

2. Arrival:
- The way in which the customers enter into the system is called arrival.
- In most of the cases, the arrival of the customer is random, so the inter-arrival between two customers is described by a random distribution of interval known as arrival pattern.

3. Queue:
- Queue represents the number of customers that have entered into the system and are waiting for the service.
- The customer being serviced is not considered to be in queue.
- The two main properties of queue are as follows:
a) Maximum Size:
- Queue, in practice, is always limited.
- Maximum size represents the maximum number of customers that can accommodate in the queue.
b) Queue Discipline:
- Queue discipline represents the rules in which the customers are inserted or removed to or from the queue.
- It can be organized in various ways like FIFO, LIFO, Serve In Random Order(SIRO), Priority Queue, etc.

4. Service time:
- Service represents the activity that takes some time and the customers are waiting for.
- Service time represents the time needed to provide service to a customer by a server.
- Service time may be of constant duration or of random duration.

5. Number of Servers:
- Servers represent the entity that provides service to the customer.
- A system may consist of single server or multiple servers.
- A system with multiple servers is able to provide parallel services to the customers.

Types of queuing system

- Channel is the number of parallel servers.
- Phase is the number of servers in sequence.

- Based on numbers of channel and phase, Queuing system is categorized as:
1. Single Channel Single Phase
2. Multiple Channels Single Phase
3. Single Channel Multiple Phases
4. Multiple Channels Multiple Phases

Queuing notation (Kendall's Notation)

- Kendall’s notation is used for parallel server systems.
- The basic format of this notation is of form: A / B / c / D / N / K
- A represents the inter-arrival time distribution.
- B represents the service time distribution.
- c represents the number of parallel servers.
- D represents the queue discipline.
- N represents the system capacity.
- K represents the size of the calling population.
- The symbols used for A and B are M (exponential or Markov), D (constant or deterministic), Ek (Erlang of order k), G (Arbitrary or general), GI (General Independent) and PH (Phase type).
- If arrival time is Poisson Distribution, then the inter-arrival time is exponential distribution.

Q. What is the meaning of D/M/1/LIFO/20/510 in queuing system?
- This notation indicates that the system consists of single parallel server with inter-arrival time of constant distribution and service time of exponential distribution.
- It also indicates that the system follows queue of capacity 20 out of 510 calling population and the queue follows Last In First Out queue discipline.

Q. What is the meaning of M/M/8/15/LIFO in queuing system?
- The system consists of 8 parallel system with inter-arrival and service times exponentially distributed and have queue size of 15 with discipline LIFO.

Measurement of system performance

The various parameters used to measure the performance of queuing system are as follows:
1. Average no of customers in the system
2. Average no of customers in the queue
3. Percentage of time server to be busy
4. Percentage of time server to be idle
5. Length of queue

Network of queues

- Some system may consists of multiple queues.
- The customers from one queue may be routed to another queue as per necessity.
- Such queue system is known as network of queues.
- For Eg: In a bank with two queues, the customer are routed from queue with large no of customers to queue with less no of customers.

Applications of queuing system

Q. A shop has only one counter. Customers arrive at this counter at random at 4.5 (+ or -) 3.5 mins. Each possible value of inter-arrival time has the same probability of occurrence. The service time may vary from 1 to 6 minutes with the following probabilities. Simulate the arrival and service of six customers and find performance of the system by calculating average waiting time, probability that the customer has to wait, % of server to be idle, average service time, average time between arrivals, average waiting time of waiting customers and average time spent by customer in the system.
Use the following sequence for random:
Customer Probability Arrival Time Service Time
1 0.1 913 84
2 0.2 727 10
3 0.3 15 74
4 0.25 948 53
5 0.1 309 17
6 0.05 922 79

Customer Arrival Time = 4.5 (+ or -) 3.5 = 1 to 8 minutes
Service Time = 1 to 6 minutes

So, we can get the probability distribution of arrival at different inter-arrival time is: (table 1)
Time Probability Cumulative Probability Random Digit assignment
1 0.125 0.125 1 – 125
2 0.125 0.250 126 - 250
3 0.125 0.375 251 - 375
4 0.125 0.500 376 – 500
5 0.125 0.625 501 – 625
6 0.125 0.750 626 – 750
7 0.125 0.875 751 – 875
8 0.125 1 875 – 1000

The random probability distribution as given in the question can be stated as: (table 2)
ST P CP RDA
1 0.1 0.1 1-10
2 0.2 0.3 11-30
3 0.3 0.6 31-60
4 0.25 0.85 61-85
5 0.1 0.95 86-95
6 0.05 1 95-100

From the given arrival time and table 1, we get: (table 3)
Customer RD IAT
1 - 0
2 913 8
3 727 6
4 15 1
5 948 8
6 309 3

From the given service time and table 2, we get: (table 4)
Customer RD ST
1 84 4
2 10 1
3 74 4
4 53 3
5 17 2
6 79 4

From table 3 and table 4, we can conclude that:
Cust Inter-arrival Arrival Service Start Wait End Time in Queue Idle
No Time Time Time Time Time Time System Length Time
1 0 0 4 0 0 4 4 0 0
2 8 8 1 8 0 9 1 0 4
3 6 14 4 14 0 18 4 0 5
4 1 15 3 18 3 21 6 1 0
5 8 23 2 23 0 25 2 0 2
6 3 26 4 26 0 30 4 0 1

Now,
1. Simulation Run Length = End time of last customer = 30
2. Average waiting time = Total Waiting Time / No of Customer = 3 / 6 = 0.5
3. P(Customer waits) = Total queue length / No of Customer = 1 / 6 = 0.167
4. P(Server idle) = Total idle time / Simulation run length = 12 / 30 = 0.4
5. Average Service Time = Total service time / No of Customer = 18 / 6 = 3
6. Average Inter-arrival Time = Total IAT / (No of Customer – 1) = 26 / 5 = 5.2
7. Average waiting time of waiting customer = Total waiting time / Queue length = 3 / 1 = 3
8. Average time spent by customer in system = Total time in system / No of Customer = 21 / 6 = 3.5

Q. In a petrol pump, Customer arrival time is given by Poison distribution within arrival rate of 2 Customer/hr and they get exponentially served at the rate of 3 Customer/hr. Find:
a) Probability of zero Customer
b) Probability of 1 Customer
c) Probability of 4 or more Customers
d) Server Busy Time
e) Server Idle Time
f) Average no of Customer in system
g) Average time spent in system
h) Average waiting time
i) Average no of customers in queue