0% found this document useful (0 votes)
15 views33 pages

Chapter 2 - Simulation by Hand

Uploaded by

alemu7230
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views33 pages

Chapter 2 - Simulation by Hand

Uploaded by

alemu7230
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

T wo

pt er
C h a h m
… o r i t
A l g
n c e l )
d v a n u a
e A ( m a
T i m n d
y H a
o n b
u l ati
Si m
Time Advance Algorithm
Example (Single Server Queue)
 A small grocery store has only one checkout counter.
 Customers arrive at this checkout counter at random from 1 to 8
minutes apart.
 Each possible value of interarrival time has the same probability
of occurrence.
 The service time vary from 1 to 6 minutes with the probability
shown below. (…given)

Service time (minutes) Probability

1 0.10
2 0.20
3 0.30
4 0.25
5 0.10
6 0.05
 The problem is to analyze the system by simulating the arrival and service
of 20 customers and determine:

1. Average waiting time

2. The probability that a customer has to wait

3. The proportion of idle time of the server

4. The average service time

5. The average time between arrival

6. The average waiting time of those who wait

7. The average time a customer spent in the system


 Generate Time Between Arrival (TBA)
– Determine the range of random digits for each
possible interarrival time.
 Interarrival time means TBA

Distribution of Time Between Arrivals


Time Between Probability Cumulative Random Digit
Arrival (…given) (…given) Probability Assignment
1 0.125 0.125 001-125
2 0.125 0.250 126-250
3 0.125 0.375 251-375
4 0.125 0.500 375-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.000 876-000
Random Digit (Taken from Discrete-Event System Simulation Book –(Jerry Banks..)

By: Muluken A. Slide 5


 Generate TBA
– Draw random digits from table and generate Time Between
Arrival.
 From the random digit table, numbers are taken blindly in between
001 to 876 (3 digit).
Time Time
between between
Customer Random arrivals Customer Random arrivals
Digits (Minutes) Digits (Minutes)
1 - - 11 109 1
2 913 8 12 093 1
3 727 6 13 607 5
4 015 1 14 738 6
5 948 8 15 359 3
6 309 3 16 888 8
7 922 8 17 106 1
8 753 7 18 212 2
9 235 2 19 493 4
10 302 3 20 535 5

• The random digits were taken from the table in the previous slide but Dr Fentahu D. (Prof.) personally disagree with the
author the way he read the table (I believe that we have to follow a certain specific order in reading the table, otherwise
we may be biased such as not choosing small numbers, avoiding large number etc..
 Generate service times (ST)
– Determine the range of random digits for each possible
service time

Service-Time Distribution Table


Time Between Cumulative Random Digit
Arrival Probability Probability Assignment
1 0.10 0.10 01-10
2 0.20 0.30 11-30
3 0.30 0.60 31-60
4 0.25 0.85 61-85
5 0.10 0.95 86-95
6 0.05 1.00 96-00
 Generate service times
– Draw random digits from table and generate service times

Service Service
Customer Random Digits Time Customer Random Digits Time
(Minutes) (Minutes)
1 84 4 11 32 3
2 10 1 12 94 5
3 74 4 13 79 4
4 53 3 14 05 1
5 17 2 15 79 5
6 79 4 16 84 4
7 91 5 17 52 3
8 67 4 18 55 3
9 89 5 19 30 2
10 38 3 20 50 3
Simulation Table Preparation (the required)
Time Since Arrival Service Time Time Time Time Idle Time
Customer Last Time Time Service Customer Service Customer of Server
Arrival (Clock) (Minutes) Begin Waite in Ends Spends in (Minutes)
(Minutes) (Clock) Queue (Clock) System
(Minutes) (Minutes)

1 -- 0 4 0 0 4 4 0
2 8 1 8 0 9 1 4
3 8 14 4 14 0 18 4 5
4 6 15 3 18 3 21 6 0
5 1 23 2 23 0 25 2 2
6 8 26 4 26 0 30 4 1
7 3 34 5 34 0 39 5 4
8 8 41 4 41 0 45 4 2
9 7 43 5 45 2 50 7 0
10 2 46 3 50 4 53 7 0
11 3 47 3 53 6 56 9 0
12 1 48 5 56 8 61 13 0
13 1 53 4 61 8 65 12 0
14 5 59 1 65 6 66 7 0
15 6 62 5 66 4 71 9 0
16 3 70 4 71 1 75 5 0
17 8 71 3 75 4 78 7 0
18 1 73 3 78 5 81 8 0
19 2 77 2 81 4 83 6 0
20 4 82 3 83 1 86 4 0
5 56 124 18
68
 The recursive equation to calculate Time Service Begin
• AT(i) = Arrival time for customer i
• ST(i) = Service time for customer i

• TSB(i) = Time service Begin for customer I for i equal to 1, we have


• TSB(1) = 0

• For i greater than 1, we use the recursive (sequential) equation


… cont’d
Time Advance Algorithm
Example_2: Machine (Server)

Arriving Departing
7 6 5 4
(Blank Parts) (Finished Parts)
Queue Part in Service
(FIFO)

• General intent:
 Estimate expected production
 Waiting time in queue, queue length
 Proportion of time machine is busy

• Time units
 Can use different units in different places … must declare
 Be careful to check the units when specifying inputs
 Declare base time units for internal calculations, outputs
 Be reasonable (interpretation, roundoff error)
Model Specifics
 Initially (time 0) empty and idle
 Base time units: minutes
 Input data (assume given for now …), in minutes:

Part Number Arrival Time Interarrival Time Service Time


1 0.00 1.73 2.90
2 1.73 1.35 1.76
3 3.08 0.71 3.39
4 3.79 0.62 4.52
5 4.41 14.28 4.46
6 18.69 0.70 4.36
7 19.39 15.52 2.07
8 34.91 3.15 3.36
9 38.06 1.76 2.37
10 39.82 1.00 5.38

 Stop when 20 minutes of (simulated) time have passed


Goals of the Study: Output Performance Measures

• Total production of parts over the run (P)


• Average waiting time of parts in queue:

N
WQi N = no. of parts completing queue wait WQi = waiting time
i 1 in queue of ith part Know:
WQ1 = 0 (why?) N > 1 (why?)
N

• Maximum waiting time of parts in queue:

Max WQi
i 1,...,N
… cont’d

 Time-average number of parts in queue:


Q(t) = number of parts in queue at time t
 20
0 Q(t )
dt 20
max Q(t )
 Maximum number of parts in queue: 0t 20

 Average and maximum total time in system of parts:

TSi
i 1 max TSi TSi = time in system of part i
P , i 1,...,P
… cont’d

 Utilization of the machine (proportion of time busy)

20
0 B(t ) dt , B(t )  1
if the machine is busy at time t
if the machine is idle at time t
20 0

Simulation by Hand (the required part)

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in
queue

Number of Total of Area under Area under


completed waiting times in queue Q(t) B(t)
waiting
times in queue

4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 0.00, Initialize

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [1, 0.00, Arr]
0.00 0 0 queue [–, 20.00, End]
<em
pty>
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting
times in 0.00 0.00 0.00
queue 0
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 0.00, Arrival of Part 1

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [2, 1.73, Arr]
1 0.00 1 0 queue [1, 2.90, Dep]
<em [–, 20.00, End]
pty>
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting
times in 0.00 0.00 0.00
queue 1
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 1.73, Arrival of Part 2

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [1, 2.90, Dep]
2 1.73 1 1 queue [3, 3.08, Arr]
(1 [–, 20.00, End]
1 .7
3)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting
times in 0.00 0.00 1.73
queue 1
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 2.90, Departure of Part 1

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [3, 3.08, Arr]
2 2.90 1 0 queue [2, 4.66, Dep]
<em [–, 20.00, End]
pty>
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting
times in 1.17 1.17 2.90
queue 2
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 3.08, Arrival of Part 3

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [4, 3.79, Arr]
3 3.08 1 1 queue [2, 4.66, Dep]
(3 [–, 20.00, End]
2 .0
8)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting
times in 1.17 1.17 3.08
queue 2
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 3.79, Arrival of Part 4

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [5, 4.41, Arr]
4 3 3.79 1 2 queue [2, 4.66, Dep]
2 (3.79, [–, 20.00, End]
3.08)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting
times in 1.17 1.88 3.79
queue 2
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 4.41, Arrival of Part 5

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [2, 4.66, Dep]
5 4 3 2 4.41 1 3 queue [6, 18.69, Arr]
(4.41, 3.79, [–, 20.00, End]
3.08)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 1.17 3.12 4.41
2
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 4.66, Departure of Part 2

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [3, 8.05, Dep]
5 4 4.66 1 2 queue [6, 18.69, Arr]
3 (4.41, [–, 20.00, End]
3.79)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 2.75 3.87 4.66
3
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 8.05, Departure of Part 3

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [4, 12.57, Dep]
5 8.05 1 1 queue [6, 18.69, Arr]
(4 [–, 20.00, End]
4 .4
1)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 7.01 10.65 8.05
4
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 12.57, Departure of Part 4

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [5, 17.03, Dep]
5 12.57 1 0 queue [6, 18.69, Arr]
( [–, 20.00, End]
)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 15.17 15.17 12.57
5
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 17.03, Departure of Part 5

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [6, 18.69, Arr]
17.03 0 0 queue () [–, 20.00, End]

Number of Total of Area under Area under


completed waiting times in queue Q(t) B(t)
waiting times in
queue 15.17 15.17 17.03
5
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 18.69, Arrival of Part 6

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [7, 19.39, Arr]
6 18.69 1 0 queue () [–, 20.00, End]
[6, 23.05, Dep]
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 15.17 15.17 17.03
6
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 19.39, Arrival of Part 7

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [–, 20.00, End]
7 19.39 1 1 queue [6, 23.05, Dep]
(19 [8, 34.91, Arr]
6 .39
)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 15.17 15.17 17.73
6
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
t = 20.00, The End

System Clock B(t) Q(t) Arrival times Event calendar


of custs. in [6, 23.05, Dep]
7 20.00 1 1 queue [8, 34.91, Arr]
(19
6 .39
)
Number of Total of Area under Area under
completed waiting times in queue Q(t) B(t)
waiting times in
queue 15.17 15.78 18.34
6
4
3
Q(t) graph 2
1
0
0 5 10 15 20
2
B(t) graph 1
0
0 5 10 15 20

Time (Minutes)

Interarrival times 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times 2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Summary
 Average waiting time in queue:

Total of times in queue 15.17


  2.53 minutes per part
No. of times in queue 6

 Time-average number in queue:


Area under Q(t ) curve 15.78
  0.79 part
Final clock value 20

 Utilization of drill press:


Area under B(t ) curve 18.34
  0.92 (dimension less)
Final clock value 20
Th
an
kY
ou

================= Chapter 2 _End ================

You might also like