7.6

Simulation Model for a Queuing System (An Example of a Queuing Simulation)

A common application of simulation is to examine the behaviour of queues in circumstances where the use of queuing formulae is not possible. Example 7.3 A service station has two attendants A and B who serve customers as they arrive. Over the past few years the service times (in minutes) for A and B have followed the probability distributions shown in the table below: Table 7.5

Probability Distributions of Service Times for Example 7.3

Service time for A (min.) 3 4 5 6 7

Probability 0.25 0.30 0.20 0.15 0.10

Service time for B (min.) 5 6 7 8 9

Probability 0.15 0.20 0.35 0.20 0.10

The probability distribution of the time (in minutes) between the arrivals of customers is shown in the table below: Table 7.6

Probability Distribution of Time between Arrivals Time between arrivals (min.) 1 2 3 4 5 6

Probability 0.05 0.20 0.30 0.36 0.06 0.03

When customers arrive for service, they proceed to whichever attendant is available. If both A and B are available, then it is equally likely that they will proceed to A or B. If both A and B are busy, then the customers form a queue and are served in order of arrival. Simulate the situation in the service station for a period starting at time t = 0 and ending when the thirtieth customer has been served, using the following random numbers: Time between arrivals: 17 26 93 23 62 02 98 41 10 51 88 35 69 50 73 92 98 29 56 74 96 04 84 81 42 03 22 20 73 84 Service times: 26 42 10 47 18 71 62 45 47 70 25 20 85 81 52 95 12 50 44 16 28 09 30 43 37 85 28 56 16 72 From the simulation estimate: (i) The proportion of time that attendant A is idle. (ii) The proportion of time that attendant B is idle. (iii) The average time that a customer spends in a queue (assuming that they have queued). (iv) The average time that a customer spends in the system.

For the service times (A and B) and time between arrivals, the random numbers would be allocated as in Table 7.7. The simulation process (30 customers) is illustrated in Table 7.8. Table 7.7

Allocation of Random Numbers for Example 7.3

Service time for A (min.) 3 4 5 6 7 Time between arrivals (min.) 1 2 3 4 5 6

Prob. 0.25 0.30 0.20 0.15 0.10

Cum. Prob. 0.25 0.55 0.75 0.90 1.00

Prob. 0.05 0.20 0.30 0.36 0.06 0.03

Random numbers 01-25 26-55 56-75 76-90 91-00 Cum. Prob. 0.05 0.25 0.55 0.91 0.97 1.00

Service time for B (min.) 5 6 7 8 9

Random numbers 01-05 06-25 26-55 56-91 92-97 98-00

Prob. 0.15 0.20 0.35 0.20 0.10

Cum. Prob. 0.15 0.35 0.70 0.90 1.00

Random numbers 01-15 16-35 36-70 71-90 91-00

Table 7.8

Thirty Simulations for Service Station Problem in Example 7.3

Time to next Clock time Clock time Idle time Service time (min.) Time spends in arrival (min.) at which at which arrival Time service is Random Time Random A B queue system occurs number (min.) number A B completed 17 2 2 26 4 6 2 0 4 26 3 5 42 7 12 5 0 7 93 5 10 10 3 13 4 0 3 23 2 12 47 7 19 0 0 7 62 4 16 18 3 19 3 0 3 02 1 17 71 8 27 0 2 10 98 6 23 62 5 28 4 0 5 41 3 26 45 7 34 0 1 8 10 2 28 47 4 32 0 0 4 51 3 31 70 5 37 0 1 6 88 4 35 25 6 41 1 0 6 35 3 38 20 3 41 1 0 3 69 4 42 85 8 50 1 0 8 50 3 45 81 6 51 4 0 6 73 4 49 52 7 57 0 1 8 92 5 54 95 7 61 3 0 7 98 6 60 12 5 65 3 0 5 29 3 63 50 4 67 2 0 4 56 4 67 44 7 74 2 0 7 74 4 71 16 3 74 4 0 3 96 5 76 28 6 82 2 0 6 04 1 77 09 3 80 3 0 3 84 4 81 30 4 85 1 0 4 81 4 85 43 7 92 3 0 7 42 3 88 37 4 92 3 0 4 03 1 89 85 8 100 0 3 11 22 2 91 28 4 96 0 1 5 20 2 93 56 5 101 0 3 8 73 4 97 16 6 106 0 3 9 84 4 101 72 5 106 0 0 5 34 17 15 176 (i)

The proportion of time that attendant A is idle = 34/106 = 0.32 (32%).

(ii)

The proportion of time that attendant B is idle = 17/106 = 0.16 (16%).

(iii) The average time that a customer spends in a queue = 15/30 = 0.5 minute. (iv) The average time that a customer spends in the system = 176/30 = 5.87 minutes.