Day 3 - Events, Statistics, and SIMGRAPHICS
Download
Report
Transcript Day 3 - Events, Statistics, and SIMGRAPHICS
Day 3
F
•
Section 5 - Event Approach to Simulation
– Events
– Implementation of the Event Approach
– Canceling Events
– Exercise 5
•
Section 6 - Simulation Output Analysis
– Random Numbers and Statistics
– Modernizing a Bank - with replications
– Presentation Graphics
– Exercise 6
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-1
Section 6 - Simulation Output Analysis
Part 1 - Random Numbers and Statistics
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-2
Generating Random Numbers
• Multiplicative congruent technique
• Single stream of numbers between 0.0 and 1.0.
• Provide a number called a seed
• Do the arithmetic
– Results are the random value and the seed for the next draw.
– Period > 2 billion numbers on a 32 bit machine
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-3
Multiple Random Number Streams
• Seed.v is a 1-dimensional, integer array of size 10.
• It holds the current value of seeds for 10 different streams.
Let .PROBABILITY = random.f(3)
List seed.v(3)
• Seeds are 100,000 numbers apart
• Can access and change seed.v
Release seed.v
Reserve seed.v as 200
For I = 1 to 200
Do
Read seed.v(I)
Loop ''I = 1 to 200 do
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-4
Reproducibility of Random Numbers
Let .SAVE.SEED.1 = seed.v(1)
<statements>
Let seed.v(1) = .SAVE.SEED.1
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-5
Replications
• No stop statements
Let event set empty
All resources relinquished
• Reset output variables
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-6
1
2
3
4
5
6
7
Main
Define I as an integer variable
Call INITIALIZE
Print 6 lines thus
Pacific Port Problem with Replications
Number of
Ships Unloaded
-----------14
15
16
17
18
19
20
21
22
24
25
26
27
28
29
30
31
32
Average
Delay Time
----------
Maximum
Delay Time
----------
For I = 1 to 20 do
Use unit 6 for output
Activate a GENERATOR now
Start simulation
Print 1 line with NO.OF.SHIPS.SERVED,
SUM.SHIP.DELAY / NO.OF.SHIPS.SERVED and
MAX.SHIP.DELAY thus
***
**.**
**.**
Let
Let
Let
Let
time.v = 0
NO.OF.SHIPS.SERVED = 0
SUM.SHIP.DELAY
= 0
MAX.SHIP.DELAY
= 0
Loop ''I = 1 to 20 do
End
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-7
Pacific Port Problem with Replications
Number of
Ships Unloaded
-----------795
805
813
819
793
792
801
807
786
800
821
795
781
799
789
805
797
810
793
789
Average
Delay Time
---------4.10
4.53
5.28
5.25
4.67
4.08
4.32
5.72
4.31
4.91
4.74
4.13
3.73
4.81
5.08
4.49
4.60
4.94
4.45
4.38
Maximum
Delay Time
---------26.15
34.71
41.34
40.86
51.97
24.56
23.63
33.99
34.84
39.13
26.23
24.88
22.56
31.45
42.28
32.27
35.30
34.32
34.14
29.54
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-8
Collecting Statistics
•
•
•
•
•
•
•
•
•
•
Number of occurrences
Sum
Mean
Sum of squares
Mean square
Variance
Standard deviation
Maximum
Minimum
Histogram
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-9
Collecting Statistics (continued)
•
Select a global variable or attribute you want statistics on.
•
Write one statement in the preamble to collect them.
– In Preamble
Accumulate SHORTEST.LINE.LENGTH
as
LONGEST.LINE.LENGTH
as
AVERAGE.LINE.LENGTH
as
SPREAD
as
LINE.HISTOGRAM (0 to 20 by 1)
of N.Q.RUNWAY
the minimum,
the maximum,
the mean,
the std.dev and
as the histogram
– In another routine
List SHORTEST.LINE.LENGTH,
LONGEST.LINE.LENGTH,
AVERAGE.LINE.LENGTH and
SPREAD
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-10
Collecting Statistics (continued)
• SIMSCRIPT II.5 will set up the required counters to collect
the required statistics
• SIMSCRIPT II.5 will monitor the global variable
N.Q.RUNWAY
• Every time N.Q.RUNWAY is about to change, SIMSCRIPT II.5
will intercept control and pass it to the library routines that
update the counters.
• Then it lets N.Q.RUNWAY change.
• When you want a value of a statistic, SIMSCRIPT II.5 calls a
function that calculates it using the current values of the
counters.
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-11
Collecting Statistics (continued)
•
Suppose you want to collect daily and weekly statistics on the
same variable.
– In Preamble
Accumulate
DAILY.AVERAGE.LINE.LENGTH as the DAILY mean and
WEEKLY.AVERAGE.LINE.LENGTH as the WEEKLY mean
of N.Q.RUNWAY
– In another routine
For I = 1 to 7 do ''days
Start simulation
List DAILY.AVERAGE.LINE.LENGTH
Reset DAILY totals of N.Q.RUNWAY
Loop ''I = 1 to 7 do
List WEEKLY.AVERAGE.LINE.LENGTH
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-12
Using Statistics to Make Decisions
• May need to look at all possibilities before making a
decision
• Length of shortest line
For each RUNWAY do
Compute SHORTEST.LINE as the minimum
of N.Q.RUNWAY(RUNWAY)
Loop ''each RUNWAY
•
Runway with shortest line
For each RUNWAY do
Compute BEST.RUNWAY as the minimum(RUNWAY)
of N.Q.RUNWAY(RUNWAY)
Loop ''each RUNWAY
Request 1 RUNWAY (BEST.RUNWAY)
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-13
Accumulate and Tally
• Accumulate gives the time averaged statistic. Used when the length
of time spent at a value is important, as for example, in queue
lengths.
• Tally does not time average, as for example, in time waited in
queue.
2
X
1
0
Time
t
• Accumulate gives a value of almost 2.0
• Tally gives a value of 1.5
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-14
This page is intentionally blank
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-15
Section 6 - Simulation Output Analysis
Part 2 - Modernizing a Bank - with Replications
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-16
Bank Teller Problem
• Model bank with single line or multiple lines for tellers
• Look at range of tellers for each case
• Run replications for each case and number of tellers
• Customer inter-arrival times and service times are
exponentially distributed
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-17
Bank Teller Problem (continued)
• In the multi-line system, an arriving customer will go to any
available teller. If no teller is available, the customer will
choose the shortest line and wait there until served. When
the bank closes, no more customers are admitted, but all
are served before the tellers leave.
• Results will be printed after each replication as well as
overall.
• The results desired are:
1.
2.
3.
4.
5.
Average utilization of tellers
Average and maximum waiting line length
A histogram of waiting line length
Average waiting time of customers
A histogram of the waiting time in five minute increments
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Preamble
'' Modernizing a Bank - CACI Products Company
'' files: SIMBANK.SRC
Normally mode is undefined
Processes include
GENERATOR and
CUSTOMER
Resources include
TELLER
Define CASE as a text variable
Define MIN.TELLERS,
MAX.TELLERS and
NO.OF.REPLICATIONS
as integer variables
Define MEAN.INTERARRIVAL.TIME,
MEAN.SERVICE.TIME,
DAY.LENGTH and
WAITING.TIME
as real variables
Accumulate DLY.UTILIZATION as the DAILY average of N.X.TELLER
Accumulate DLY.AVG.QUEUE.LENGTH as the DAILY average and
DLY.MAX.QUEUE.LENGTH as the DAILY maximum
of N.Q.TELLER
Tally DLY.MEAN.WAITING.TIME as the DAILY mean of WAITING.TIME
Accumulate UTILIZATION as the average of N.X.TELLER
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-19
37
38
39
40
41
42
43
44
45
46
47
Accumulate AVG.QUEUE.LENGTH as the average,
MAX.QUEUE.LENGTH as the maximum and
QUEUE.HISTOGRAM (0 to 20 by 1) as the histogram
of N.Q.TELLER
Tally MEAN.WAITING.TIME as the mean and
WAIT.HISTOGRAM (0 to 100 by 5) as the histogram
of WAITING.TIME
End
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Main
Define .NO.OF.TELLERS,
.REPLICATION,
.SAVESEED1 and
.SAVESEED2
as integer variables
Define .START.TIME as a real variable
Let .SAVESEED1 = seed.v(1)
Let .SAVESEED2 = seed.v(2)
Call READ.DATA
For .NO.OF.TELLERS = MIN.TELLERS to MAX.TELLERS
Do
Call INITIALIZE.TELLERS
Given
.NO.OF.TELLERS
For .REPLICATION = 1 to NO.OF.REPLICATIONS
Do
Let .START.TIME = time.v
Activate a GENERATOR now
Start simulation
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-21
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Call DAILY.REPORT
Given
.REPLICATION,
.START.TIME and
.NO.OF.TELLERS
For each TELLER
Do
Reset DAILY totals of N.X.TELLER(TELLER),
N.Q.TELLER(TELLER) and
WAITING.TIME
Loop ''each TELLER
Loop ''.REPLICATION = 1 to NO.OF.REPLICATIONS
Call FINAL.REPORT
Let time.v = 0.0
Let seed.v(1) = .SAVESEED1
Let seed.v(2) = .SAVESEED2
For each TELLER
Do
Reset totals of N.X.TELLER(TELLER),
N.Q.TELLER(TELLER) and
WAITING.TIME
Loop ''each TELLER do
Loop ''.NO.OF.TELLERS = MIN.TELLERS to MAX.TELLERS
End
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-22
1
2
3
Routine READ.DATA
Print 1 line thus
Enter case to be run (Single-queue (S) or Multi-queue (M):
5
Read CASE
6
Let CASE = upper.f(CASE)
7
8
Print 1 line thus
Enter minimum number of tellers:
10
Read MIN.TELLERS
11
12
Print 1 line thus
Enter maximum number of tellers:
14
Read MAX.TELLERS
15
16
Print 1 line thus
Enter number of replications:
18
Read NO.OF.REPLICATIONS
19
20
Print 1 line thus
Enter mean time between customer arrivals (in minutes):
22
Read MEAN.INTERARRIVAL.TIME
23
24
Print 1 line thus
Enter mean time for servicing a customer (in minutes):
26
Read MEAN.SERVICE.TIME
27
28
Print 1 line thus
Enter length of time that bank is open for one day (in hours):
30
Read DAY.LENGTH
31
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-23
32
33
34
35
36
37
38
39
50
51
52
Skip 2 output lines
Print 10 lines with MIN.TELLERS,
MAX.TELLERS,
NO.OF.REPLICATIONS,
MEAN.INTERARRIVAL.TIME,
MEAN.SERVICE.TIME and
DAY.LENGTH thus
COMPARISON OF SINGLE AND MULTI-QUEUE BANK OPERATIONS
The number of tellers ranges from * to *.
There are * replications for each number of tellers:
Customers arrive according to an exponential distribution
of inter-arrival times with a mean of *.** minutes.
Service time is exponentially distributed
with a mean of **.** minutes.
The bank doors are closed after *.** hours each day
But all customers inside are served.
Skip 2 output lines
End ''READ.DATA
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Routine INITIALIZE.TELLERS
Given
.NO.OF.TELLERS
Define .NO.OF.TELLERS as an integer variable
If N.TELLER is not zero
Destroy every TELLER
Endif ''N.TELLER is not zero
If CASE = "S" ''single queue case
Create every TELLER(1)
Let U.TELLER(1) = .NO.OF.TELLERS
Else ''multi-queue case
Create every TELLER(.NO.OF.TELLERS)
For each TELLER
Do
Let U.TELLER(TELLER) = 1
Loop ''each TELLER do
Endif ''CASE = "S"
End ''INITIALIZE.TELLERS
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-25
1
2
3
4
5
6
7
8
9
10
11
12
13
Process GENERATOR
Define .TIME.TO.CLOSE as a real variable
Let .TIME.TO.CLOSE = time.v + (DAY.LENGTH / hours.v)
Until time.v >= .TIME.TO.CLOSE
Do
Activate a CUSTOMER now
Wait exponential.f(MEAN.INTERARRIVAL.TIME,1) minutes
Loop ''time.v >= .TIME.TO.CLOSE do
End ''GENERATOR
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Process CUSTOMER
Define .ARRIVAL.TIME as a real variable
Define .MY.CHOICE as an integer variable
Let .ARRIVAL.TIME = time.v
If CASE = "S" ''single queue case
Let .MY.CHOICE = 1
Else ''multi-queue case
For each TELLER
with N.X.TELLER(TELLER) = 0
Find the first case
If found
Let .MY.CHOICE = TELLER
Else ''they're all busy
For each TELLER
Do
Compute .MY.CHOICE as the minimum(TELLER)
of N.Q.TELLER(TELLER)
Loop ''each TELLER
Endif ''found
Endif ''CASE = "S"
Request 1 TELLER(.MY.CHOICE)
Let WAITING.TIME = (time.v - .ARRIVAL.TIME) * hours.v * minutes.v
Work exponential.f(MEAN.SERVICE.TIME, 2) minutes
Relinquish 1 TELLER(.MY.CHOICE)
End ''CUSTOMER
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
21
22
23
24
25
26
27
28
30
31
32
Routine DAILY.REPORT
Given
.REPLICATION.NUMBER,
.START.TIME,
.NO.OF.TELLERS
Define .REPLICATION.NUMBER and
.NO.OF.TELLERS
as integer variables
Define .START.TIME as a real variable
If .REPLICATION.NUMBER = 1
Start new page
Print 5 lines with .NO.OF.TELLERS thus
Number of tellers = *
Finish
Teller
Queue Length
Average Customer
Time
Utilization Average Maximum
Waiting time
(Hours)
(Minutes)
Endif ''.REPLICATON.NUMBER = 1
For each TELLER
Do
Print 1 line with (time.v - .START.TIME) * hours.v,
DLY.UTILIZATION(TELLER)/U.TELLER(TELLER),
DLY.AVG.QUEUE.LENGTH(TELLER),
DLY.MAX.QUEUE.LENGTH(TELLER) and
DLY.MEAN.WAITING.TIME thus
*.**
***.*
**.*
**
****
Loop ''each TELLER
End ''DAILY.REPORT
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-28
1
2
3
4
5
Routine FINAL.REPORT
Define .I as an integer variable
Print 2 lines thus
Average over all replications:
8
9
10
11
12
13
14
16
17
18
19
20
For each TELLER
Do
Print 1 line with UTILIZATION(TELLER) / U.TELLER(TELLER),
AVG.QUEUE.LENGTH(TELLER),
MAX.QUEUE.LENGTH(TELLER) and
MEAN.WAITING.TIME thus
***.*
**.*
**
****
Loop ''each TELLER
Skip 3 lines
Print 3 lines with WAIT.HISTOGRAM(1) and
QUEUE.HISTOGRAM(1,1) * 100 /time.v thus
Waiting Time Number Who Waited
Queue Length
Percentage
(minutes)
This Time
of Time
T < 5
***
0
*.*
24
25
For .I = 2 to 20
26
Do
27
Print 1 line with
28
29
30
31
** <= T < **
***
33
Loop ''I = 1 to 20
34
5 * (.I - 1),
5 * .I,
WAIT.HISTOGRAM(.I),
.I - 1 and
QUEUE.HISTOGRAM(1,.I) * 100 / time.v thus
***
*.*
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-29
35
Print 1 line with WAIT.HISTOGRAM(21) and
36
QUEUE.HISTOGRAM(1,21) * 100 /time.v thus
100 <= T
***
20
*.*
38
39
Read as / using unit 5
40
41
End ''FINAL.REPORT
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-30
Enter case to be run (Single-queue (S) or Multi-queue (M): S
Enter minimum number of tellers: 1
Enter maximum number of tellers: 3
Enter number of replications:
5
Enter mean time between customer arrivals (in minutes): 5
Enter mean time for servicing a customer (in minutes): 10
Enter length of time that bank is open for one day:
8
COMPARISON OF SINGLE AND MULTI-QUEUE BANK OPERATIONS
The number of tellers ranges from 1 to 3.
There are 5 replications for each number of tellers:
Customers arrive according to an exponential distribution
of inter-arrival times with a mean of 5.00 minutes.
Service time is exponentially distributed
with a mean of 10.00 minutes.
The bank doors are closed after 8.00 hours each day
But all customers inside are served.
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-31
Number of tellers = 1
Finish
Teller
Time
Utilization
(Hours)
17.82
16.44
19.28
14.56
14.03
1.0
1.0
1.0
1.0
1.0
Queue Length
Average Maximum
25.8
21.7
32.3
22.8
20.0
Average Customer
Waiting time
(Minutes)
53
44
58
44
44
253
227
373
210
185
Average over all replications:
1.0
25.0
58
252
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-32
Waiting Time Number Who Waited
(minutes)
This Time
T < 5
13
5 <= T < 10
2
10 <= T < 15
1
15 <= T < 20
4
20 <= T < 25
2
25 <= T < 30
2
30 <= T < 35
6
35 <= T < 40
5
40 <= T < 45
6
45 <= T < 50
4
50 <= T < 55
5
55 <= T < 60
10
60 <= T < 65
7
65 <= T < 70
6
70 <= T < 75
9
75 <= T < 80
2
80 <= T < 85
12
85 <= T < 90
4
90 <= T < 95
5
95 <= T <100
3
100 <= T
381
Queue Length
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Percentage
of Time
1.7
1.8
1.4
2.1
1.7
1.6
2.2
2.1
2.0
2.5
1.6
2.3
3.4
2.0
1.1
2.5
2.0
1.6
1.2
2.7
60.5
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-33
Number of tellers = 2
Finish
Teller
Time
Utilization
(Hours)
9.26
9.11
9.91
8.05
8.31
1.0
.9
1.0
.9
.8
Queue Length
Average Maximum
3.6
2.3
12.3
1.4
2.2
Average Customer
Waiting time
(Minutes)
13
10
28
8
9
18
13
73
7
12
Average over all replications:
.9
4.6
28
25
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-34
Waiting Time Number Who Waited
(minutes)
This Time
T < 5
177
5 <= T < 10
56
10 <= T < 15
43
15 <= T < 20
36
20 <= T < 25
23
25 <= T < 30
27
30 <= T < 35
22
35 <= T < 40
8
40 <= T < 45
3
45 <= T < 50
11
50 <= T < 55
4
55 <= T < 60
6
60 <= T < 65
9
65 <= T < 70
6
70 <= T < 75
5
75 <= T < 80
1
80 <= T < 85
3
85 <= T < 90
4
90 <= T < 95
2
95 <= T <100
2
100 <= T
41
Queue Length
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Percentage
of Time
28.1
13.9
9.3
7.7
7.4
5.3
4.9
3.5
2.2
2.3
1.3
1.3
1.9
2.0
1.3
1.0
1.0
.2
.1
.5
4.7
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-35
Number of tellers = 3
Finish
Teller
Time
Utilization
(Hours)
8.27
8.34
8.17
8.05
8.08
.7
.7
.8
.6
.6
Queue Length
Average Maximum
.6
.4
1.3
.3
.4
Average Customer
Waiting time
(Minutes)
5
4
6
5
5
3
2
6
2
2
Average over all replications:
.7
.6
6
3
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-36
Waiting Time Number Who Waited
(minutes)
This Time
T < 5
384
5 <= T < 10
36
10 <= T < 15
45
15 <= T < 20
15
20 <= T < 25
7
25 <= T < 30
1
30 <= T < 35
1
35 <= T < 40
0
40 <= T < 45
0
45 <= T < 50
0
50 <= T < 55
0
55 <= T < 60
0
60 <= T < 65
0
65 <= T < 70
0
70 <= T < 75
0
75 <= T < 80
0
80 <= T < 85
0
85 <= T < 90
0
90 <= T < 95
0
95 <= T <100
0
100 <= T
0
Queue Length
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Percentage
of Time
72.6
10.2
7.3
6.2
2.5
1.2
.1
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-37
Enter
Enter
Enter
Enter
Enter
Enter
Enter
case to be run (Single-queue (S) or Multi-queue (M): M
minimum number of tellers: 1
maximum number of tellers: 3
number of replications:
5
mean time between customer arrivals (in minutes): 5
mean time for servicing a customer (in minutes): 10
length of time that bank is open for one day:
8
COMPARISON OF SINGLE AND MULTI-QUEUE BANK OPERATIONS
The number of tellers ranges from 1 to 3.
There are 5 replications for each number of tellers:
Customers arrive according to an exponential distribution
of inter-arrival times with a mean of 5.00 minutes.
Service time is exponentially distributed
with a mean of 10.00 minutes.
The bank doors are closed after 8.00 hours each day
But all customers inside are served.
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-38
Number of tellers = 1
Finish
Teller
Queue Length
Time
Utilization Average Maximum
(Hours)
17.82
16.44
19.28
14.56
14.03
1.0
1.0
1.0
1.0
1.0
25.8
21.7
32.3
22.8
20.0
Average Customer
Waiting time
(Minutes)
53
44
58
44
44
253
227
373
210
185
Average over all replications:
1.0
25.0
58
252
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-39
Waiting Time Number Who Waited
(minutes)
This Time
T < 5
13
5 <= T < 10
2
10 <= T < 15
1
15 <= T < 20
4
20 <= T < 25
2
25 <= T < 30
2
30 <= T < 35
6
35 <= T < 40
5
40 <= T < 45
6
45 <= T < 50
4
50 <= T < 55
5
55 <= T < 60
10
60 <= T < 65
7
65 <= T < 70
6
70 <= T < 75
9
75 <= T < 80
2
80 <= T < 85
12
85 <= T < 90
4
90 <= T < 95
5
95 <= T <100
3
100 <= T
381
Queue Length
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Percentage
of Time
1.7
1.8
1.4
2.1
1.7
1.6
2.2
2.1
2.0
2.5
1.6
2.3
3.4
2.0
1.1
2.5
2.0
1.6
1.2
2.7
60.5
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-40
Number of tellers = 2
Finish
Teller
Time
Utilization
(Hours)
9.49
9.49
9.25
9.25
10.12
10.12
8.16
8.16
8.38
8.38
.9
1.0
.9
.8
.9
1.0
.9
.9
.9
.7
Queue Length
Average Maximum
2.1
1.7
1.7
1.2
6.3
6.0
1.1
1.2
1.3
1.1
Average Customer
Waiting time
(Minutes)
7
6
5
5
15
14
4
4
5
4
20
20
18
18
75
75
12
12
13
13
Average over all replications:
.9
2.6
15
.9
2.4
14
28
28
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-41
Waiting Time Number Who Waited
(minutes)
This Time
T < 5
160
5 <= T < 10
47
10 <= T < 15
48
15 <= T < 20
39
20 <= T < 25
23
25 <= T < 30
24
30 <= T < 35
17
35 <= T < 40
17
40 <= T < 45
20
45 <= T < 50
6
50 <= T < 55
11
55 <= T < 60
7
60 <= T < 65
1
65 <= T < 70
2
70 <= T < 75
5
75 <= T < 80
4
80 <= T < 85
4
85 <= T < 90
3
90 <= T < 95
7
95 <= T <100
7
100 <= T
37
Queue Length
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Percentage
of Time
23.4
23.7
18.3
10.1
6.6
3.2
2.6
4.3
2.3
.2
1.0
.5
.9
1.7
.6
.4
0.
0.
0.
0.
0.
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-42
Number of tellers = 3
Finish
Teller
Time
Utilization
(Hours)
8.48
8.48
8.48
8.46
8.46
8.46
8.17
8.17
8.17
8.05
8.05
8.05
8.14
8.14
8.14
.8
.8
.5
.9
.6
.5
.9
.8
.7
.8
.7
.4
.7
.5
.4
Queue Length
Average Maximum
.4
.3
.1
.5
.1
.1
.6
.5
.3
.2
.2
.1
.3
.1
.1
Average Customer
Waiting time
(Minutes)
2
2
1
2
1
1
2
2
2
2
2
1
2
2
1
4
4
4
4
4
4
7
7
7
3
3
3
3
3
3
Average over all replications:
.8
.4
2
.7
.3
2
.5
.1
2
4
4
4
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-43
Waiting Time
(minutes)
T < 5
5 <= T < 10
10 <= T < 15
15 <= T < 20
20 <= T < 25
25 <= T < 30
30 <= T < 35
35 <= T < 40
40 <= T < 45
45 <= T < 50
50 <= T < 55
55 <= T < 60
60 <= T < 65
65 <= T < 70
70 <= T < 75
75 <= T < 80
80 <= T < 85
85 <= T < 90
90 <= T < 95
95 <= T <100
100 <= T
Number Who Waited
This Time
370
34
30
24
12
6
7
3
1
1
0
1
0
0
0
0
0
0
0
0
0
Queue Length
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Percentage
of Time
65.6
28.0
6.4
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-44
Section 6 - Simulation Output Analysis
Part 3 - Presentation Graphics
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-45
Presentation Graphics
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-46
Displaying a Single Variable
Preamble
Resources include PASSENGER.AGENT
Display variables include N.Q.PASSENGER.AGENT
End ''Preamble
Main
Show N.Q.PASSENGER.AGENT with "QUEUE.GRF"
End ''Main
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-47
Displaying a Histogram
Preamble
Define WAITING.TIME as a real variable
Define LOW, HIGH and DELTA as integer variables
Tally WAITING.TIME.HISTOGRAM (LOW to HIGH by DELTA)
as the dynamic histogram of WAITING.TIME
End ''Preamble
Main
Show WAITING.TIME.HISTOGRAM with "WAIT.GRF"
End ''Main
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-48
Displaying a Clock
Preamble
Define CLOCKTIME as a double variable
Display variables include CLOCKTIME
End ''Preamble
Main
Let timesync.v = 'CLOCK.UPDATE'
Show CLOCKTIME with "CLOCK.GRF"
End ''Main
Routine CLOCK.UPDATE
given .TIME.ATR yielding .NEW.TIME.ATR
Define .TIME.ATR, .NEW.TIME.ATR as double variables
Let CLOCKTIME
= .TIME.ATR
Let .NEW.TIME.ATR = .TIME.ATR
End ''CLOCK.UPDATE
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-49
This page is intentionally blank
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-50
Exercise 6
The Pacific Port Problem (revisited)
C:\Program Files\Simscript3\models\ProblemC
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-51
Pacific Port Problem Revisited
• Now that the prototype simulation model is working, the
Harbor Master has requested a better estimate of the port
performance. In order to satisfy this requirement, the
following statistics have been requested:
1.
Average and maximum waiting line for the docks
2.
Average and maximum waiting line for the tugs
3.
Utilization of the docks and the tug
4.
Average and maximum ship waiting time (excluding unloading time)
5.
Average and maximum in-port time for all ships
6.
The number of ships served
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-52
Pacific Port Problem Revisited
•
In addition, consider a shipper who wishes to ship crude oil from
Valdez, Alaska, to San Pedro. He estimates that shipments will
require five ships of a particular type. The time to unload one of
the new ships follows an exponential distribution with a mean of
21 hours. After unloading, the new ship will travel to Valdez, load
more crude oil, and return to San Pedro. The round trip times
follow a normal distribution with a mean of 10 days and a standard
deviation of 1 day.
•
Before the port authorities agree to accommodate the five new
ships, they want to determine the effect of the additional port
traffic, especially on in-port residency time.
•
The Harbor Master also desires to see a graphical presentation of
a histogram for number of ships versus WAITING.TIME in hours.
SELECT PROBLEMC (Or ANSWERB)
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-53
NOTES
• To identify the new ships and the old ships, give the ships
attributes such as:
EVERY SHIP has
a SHIP.TYPE
Define ..OLD.SHIP to mean 1
Define ..NEW.SHIP to mean 2
Activate a SHIP now
Let SHIP.TYPE(SHIP) = ..OLD.SHIP
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-54
NOTES: Calling a Synchronous Routine from a Process
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Process SHIP
Define .ARRIVAL.TIME,
.UNLOAD.TIME and
.PROBABILITY
as real variables
Let .PROBABILITY = random.f(2)
Select case .PROBABILITY
Case 0.0 to .25
Let .UNLOAD.TIME = uniform.f(16.0, 20.0, 3)
Case .25 to .80
Let .UNLOAD.TIME = uniform.f(21.0, 27.0, 3)
Default
Let .UNLOAD.TIME = uniform.f(32.0, 40.0, 3)
Endselect ''.PROBABILITY
Call HARBOR.OPERATIONS
giving .UNLOAD.TIME
End ‘’SHIP
Routine HARBOR.OPERATIONS
giving .UNLOAD.TIME
Define .ARRIVAL.TIME,
.UNLOAD.TIME
as real variables
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-55
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Let .ARRIVAL.TIME = time.v
Request 1 DOCK(1)
Request 1 TUG(1)
Wait 1.0 hour
Relinquish 1 TUG(1)
Work .UNLOAD.TIME hours
Request 1 TUG(1)
Wait 1.0 hour
Relinquish 1 TUG(1)
Relinquish 1 DOCK(1)
Let
Add
Let
Add
WAITING.TIME = (time.v - .ARRIVAL.TIME) * hours.v - .UNLOAD.TIME
WAITING.TIME to SUM.SHIP.DELAY
MAX.SHIP.DELAY = max.f(WAITING.TIME, MAX.SHIP.DELAY)
1 to NO.OF.SHIPS.SERVED
End ''HARBOR.OPERATIONS
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-56