You are on page 1of 13

Simulation and Modeling

Chapter -3(General principles)


Ques: Example 3.3: Single Chanel Queue
Reconsider the grocery store with one checkout counter . The system consist of those
customers in the waiting line plus the one(if any) checking out. A stopping time of 60
minutes is set for this example. Prepare a simulation table using event scheduling algorithm
for single channel queue for 7 customers. The model has the following components:
Inter-arrival times 1 1 6 3 7 5 2 4 1
Service time 4 2 5 4 1 5 4 1 4

Solution:
Step :1 Compute Departure time
Inter- Arrival Service Time service begin Time service
arrival time time = Compare (Previous value of Time Ends/Departure
time Service End and current value of time(Service time + time
Arrival Time )= Greater of two values service begin)
0 0 4 0 4 -D1
1 1 – A1 2 4 6 – D2
1 2 – A2 5 6 11- D3
6 8 – A3 4 11 15 –D4
3 11 –A4 1 15 16 -D5
7 18 –A5 5 18 23 -D6
5 23 –A6 4 23 27 -D7
2 25 –A7 1 27 28 -D8
4 29 –A8 4 29 33 -D9
1 30 –A9 33

1
System State Cumulative Statistics
Clk Event LQ(t) LS(t)
type [Numbe B MQ
[Numb r of Future Event List Comment (Total (Maximu
er of custome server m queue
custom r being busy length)
ers in served] time)
waiting
line]

0 0 0 1 (A1,1)(D1,4)(E,60) First A occurs 0 0


Schedule next
Arrival (A1)
Next departure
(D1)
1 A1 1 1 (A2,2)(D1,4)(E,60) 2nd A occurs 1 1
:(A1,1)
next Arrival(A2)
Next departure
(D1)
2 A2 2 1 (D1,4)(A3,8)(E,60) 3rd A occurs 2 2
(A3):(A2,2)
4 D1 1 1 (D2,6)(A3,8)(E,60) 1st D 4 2
occurs:(D1,4)
6 D2 0 1 (D3,11)(A3,8)(E,60) 2nd D occurs 6 2
:(D2,6)
8 A3 1 1 (A4,11)(D3,11)(E,60) 4th A occurs: 8 2
(A3,8)
11 A4/D3 1 1 (D4,15)(A5,18)(E,60) 3rd D occurs 11 2
:(D3,11)
5th A occurs
:(A4,11)
15 D4 0 1 (D5,16)(A5,18)(E,60) 4th D occurs: 15 2
(D4,14)
16 D5 0 0 (A5,18)(E,60) 5th D occurs: 16 2
(D5,16)
18 A5 0 1 (A6,23)(D6,23)(E,60) 6th A occurs 16 2
23 A6/D6 0 1 (A7,25)(D7,27)(E,60) 7th A occurs: 21 2
(A6,23)
6th D occurs:
(D6,23)
25 A7
27 D7
28 D8
29 A8
30 A9
33 D9

2
Formula:
Arrival event occurs at clock (t): Is LS (t) =1= yes then increase LQ (t) by 1 . If no then
set LS (t) =1
Departure event occurs at clock (t): Is LQ (t) >0 =yes then reduce LQ (t) by 1 .IF no then
set LS (t) =0

3
4
5
6
Explanation:
When Clock time =0
First customer arrive at time 0 and begin service.
LQ (0) =0, which is number of customers in waiting line at time t=0
LS (0) =1, which is number (0 or 1) being serve at time t=0
Inter-arrival time a* =1, which defined (A, 1)
Service time s* =4, which defined (D, 4)
Simulation is scheduled to stop at time 60(sec/min), which defined (E, 60)

Total server busy time B, Maximum queue length MQ

7
When Clock time =1
Second customer arrive at Clock time=1 and wait in the queue.
LS (1) =1, which is number of customer is (0 or 1) being serve at clock time t=1
LQ(1) =1, which is number of customer waiting in the queue at clock time t=1

Total server busy time B= 1


8
Number of people waiting in the queue MQ=1
When Clock time =2

Total server busy time B= 2


Number of people waiting in the queue MQ=2

9
When Clock time =4

When Clock time =6

10
When Clock time =8

When clock time =11

11
When clock time =15

When clock time =16

When clock time =18

12
When clock time =23

13

You might also like