Single Server Queue Simulation
A small grocery shop, customers arrive random times that range from 1 to 8 minutes apart.
Assume that inter-arrival times are integer values with each of the 8 values having equal
probability. The service times vary from 1 to 6 minutes – also integer values – with
probabilities shown in the table .
1. Analyze the system by simulating the arrival and departure of 11 customers.
2. Compute the measures of performance of the queuing model.
Given:
Given:
Random numbers for inter-arrival times:
883, 913, 420, 200, 117, 350, 768, 129, 57, 544
Random numbers for service time:
52, 46, 91, 33, 78, 19, 58, 11, 86, 83, 89
Solution
Random Interarrival time
Disterbution of Time between arrivals Customer
digits (min)
Time between Probability Cumulative Random 1 - 0
arrivals (min) probability Number 2 883 8
Assignment 3 913 8
1 0.125 0.125 0 : 124 420
4 4
2 0.125 0.250 125 : 249
5 200 2
3 0.125 0.375 250 : 374
6 117 1
4 0.125 0.500 375 : 499
5 0.125 0.625 500 : 624 7 350 3
6 0.125 0.750 625 : 749 8 768 7
7 0.125 0.875 750 : 874 9 129 2
8 0.125 1.000 875 : 999 10 57 1
11 544 5
Disterbution of Time services:
Given:
Service Probability Cumulative Random Customer Random digits Service time (min)
Times Probability Number 1 52 3
(min) Assignment 2 46 3
3 91 5
1 0.10 0.10 0:9
4 33 3
2 0.20 0.30 10 : 29 5 78 4
6 19 2
3 0.30 0.60 30 : 59
7 58 3
4 0.25 0.85 60 : 84 8 11 2
9 86 5
5 0.10 0.95 85 : 94 10 83 4
6 0.05 1.00 95 : 99 11 89 5
Step Activity Clock Activity Clock Clock Output Output Output
Time Time Time customer
Interarrival time Arrival Service Waiting time in Idle time
Customer service service spends in
(min) time time (min) queue (min) of server
begins ends system
1 0 0 3 0 3 0 3 0
2 8 8 3 8 11 0 3 5
3 8 16 5 16 21 0 5 5
4 4 20 3 21 24 1 4 0
5 2 22 4 24 28 2 6 0
6 1 23 2 28 30 5 7 0
7 3 26 3 30 33 4 7 0
8 7 33 2 33 35 0 2 0
9 2 35 5 35 40 0 5 0
10 1 36 4 40 44 4 8 0
11 5 41 5 44 49 3 8 0
Total Run Time of simulation
Service time End = Service time begin + Service time
Time spend = Service time + Waiting
Waiting = Service time begin - Arrival time
Idle Time = Service time begin (n) - Service time end (n – 1)
𝑇𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤𝑎𝑖𝑡 𝑖𝑛 𝑞𝑢𝑒𝑢𝑒 (𝑚𝑖𝑛)
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑊𝑎𝑖𝑡𝑖𝑛𝑔 𝑇𝑖𝑚𝑒 = =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
19
= 1.73 𝑚𝑖𝑛
11
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤ℎ𝑜 𝑤𝑎𝑖𝑡 6
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 (𝑤𝑎𝑖𝑡) = = = 0.55
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 11
𝑇𝑜𝑡𝑎𝑙 𝑖𝑑𝑙𝑒 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑠𝑒𝑟𝑣𝑒𝑟 (𝑚𝑖𝑛) 10
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑖𝑑𝑙𝑒 𝑠𝑒𝑟𝑣𝑒𝑟 = =
𝑇𝑜𝑡𝑎𝑙 𝑟𝑢𝑛 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑠𝑖𝑚𝑢𝑙𝑎𝑡𝑖𝑜𝑛 49
𝑇𝑜𝑡𝑎𝑙 𝑠𝑒𝑟𝑣𝑖𝑐𝑒 𝑡𝑖𝑚𝑒 (𝑚𝑖𝑛. ) 44
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑠𝑒𝑟𝑣𝑖𝑐𝑒 𝑡𝑖𝑚𝑒 = = = 4 𝑚𝑖𝑛
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 11
𝑆𝑢𝑚 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒𝑠 (𝑚𝑖𝑛.)
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑡𝑖𝑚𝑒 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 𝑎𝑟𝑟𝑖𝑣𝑎𝑙𝑠 =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 −1
41
= = 4.1 𝑚𝑖𝑛
10
𝑇𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
𝑤𝑎𝑖𝑡 𝑖𝑛 𝑞𝑢𝑒𝑢𝑒 (𝑚𝑖𝑛. )
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑤𝑎𝑖𝑡𝑖𝑛𝑔 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑡ℎ𝑜𝑠𝑒 𝑤ℎ𝑜 𝑤𝑎𝑖𝑡 =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓
𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤ℎ𝑜 𝑤𝑎𝑖𝑡
19
= = 3.16 𝑚𝑖𝑛
6
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑡𝑖𝑚𝑒 𝑎 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟 𝑠𝑝𝑒𝑛𝑑𝑠 𝑖𝑛 𝑡ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚
𝑇𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
𝑠𝑝𝑒𝑛𝑑 𝑖𝑛 𝑡ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 (𝑚𝑖𝑛. ) 58
= = = 5.3 𝑚𝑖𝑛
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 11