Title: Day 3
1Day 3
- 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
F
2Section 6 - Simulation Output Analysis
- Part 1 - Random Numbers and Statistics
3Generating 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 gt 2 billion numbers on a 32 bit machine
4Multiple 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
5Reproducibility of Random Numbers
- Let .SAVE.SEED.1 seed.v(1)
- ltstatementsgt
- Let seed.v(1) .SAVE.SEED.1
6Replications
- No stop statements
- Let event set empty
- All resources relinquished
- Reset output variables
7- 1 Main
- 2
- 3 Define I as an integer variable
- 4
- 5 Call INITIALIZE
- 6
- 7 Print 6 lines thus
- Pacific Port Problem with
Replications - Number of Average
Maximum - Ships Unloaded Delay Time
Delay Time - ------------ ----------
---------- - 14 For I 1 to 20 do
- 15
- 16 Use unit 6 for output
- 17 Activate a GENERATOR now
- 18 Start simulation
- 19
8- Pacific Port Problem with
Replications - Number of Average
Maximum - Ships Unloaded Delay Time
Delay Time - ------------ ----------
---------- - 795 4.10
26.15 - 805 4.53
34.71 - 813 5.28
41.34 - 819 5.25
40.86 - 793 4.67
51.97 - 792 4.08
24.56 - 801 4.32
23.63 - 807 5.72
33.99 - 786 4.31
34.84 - 800 4.91
39.13 - 821 4.74
26.23 - 795 4.13
24.88 - 781 3.73
22.56
9Collecting Statistics
- Number of occurrences
- Sum
- Mean
- Sum of squares
- Mean square
- Variance
- Standard deviation
- Maximum
- Minimum
- Histogram
10Collecting 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 the
minimum, - LONGEST.LINE.LENGTH as the
maximum, - AVERAGE.LINE.LENGTH as the
mean, - SPREAD as the
std.dev and - LINE.HISTOGRAM (0 to 20 by 1) as the
histogram - of N.Q.RUNWAY
- In another routine
- List SHORTEST.LINE.LENGTH,
- LONGEST.LINE.LENGTH,
- AVERAGE.LINE.LENGTH and
- SPREAD
11Collecting 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.
12Collecting 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
13Using 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)
14Accumulate 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.
- Accumulate gives a value of almost 2.0
- Tally gives a value of 1.5
15This page is intentionally blank
16Section 6 - Simulation Output Analysis
- Part 2 - Modernizing a Bank - with Replications
17Bank 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
18Bank 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. Average utilization of tellers
- 2. Average and maximum waiting line length
- 3. A histogram of waiting line length
- 4. Average waiting time of customers
- 5. A histogram of the waiting time in five minute
increments
19- 1 Preamble
- 2
- 3 '' Modernizing a Bank - CACI Products
Company - 4 '' files SIMBANK.SRC
- 5
- 6 Normally mode is undefined
- 7
- 8 Processes include
- 9 GENERATOR and
- 10 CUSTOMER
- 11
- 12 Resources include
- 13 TELLER
- 14
- 15 Define CASE as a text variable
- 16
- 17 Define MIN.TELLERS,
- 18 MAX.TELLERS and
- 19 NO.OF.REPLICATIONS
20- 37
- 38 Accumulate AVG.QUEUE.LENGTH as the
average, - 39 MAX.QUEUE.LENGTH as the
maximum and - 40 QUEUE.HISTOGRAM (0 to 20 by
1) as the histogram - 41 of N.Q.TELLER
- 42
- 43 Tally MEAN.WAITING.TIME as the mean and
- 44 WAIT.HISTOGRAM (0 to 100 by 5) as
the histogram - 45 of WAITING.TIME
- 46
- 47 End
21- 1 Main
- 2 Define .NO.OF.TELLERS,
- 3 .REPLICATION,
- 4 .SAVESEED1 and
- 5 .SAVESEED2
- 6 as integer variables
- 7
- 8 Define .START.TIME as a real variable
- 9
- 10 Let .SAVESEED1 seed.v(1)
- 11 Let .SAVESEED2 seed.v(2)
- 12
- 13 Call READ.DATA
- 14
- 15 For .NO.OF.TELLERS MIN.TELLERS to
MAX.TELLERS - 16 Do
- 17 Call INITIALIZE.TELLERS
- 18 Given
- 19 .NO.OF.TELLERS
22- 27 Call DAILY.REPORT
- 28 Given
- 29 .REPLICATION,
- 30 .START.TIME and
- 31 .NO.OF.TELLERS
- 32
- 33 For each TELLER
- 34 Do
- 35 Reset DAILY totals of
N.X.TELLER(TELLER), - 36
N.Q.TELLER(TELLER) and - 37
WAITING.TIME - 38 Loop ''each TELLER
- 39 Loop ''.REPLICATION 1 to
NO.OF.REPLICATIONS - 40
- 41 Call FINAL.REPORT
- 42 Let time.v 0.0
- 43 Let seed.v(1) .SAVESEED1
- 44 Let seed.v(2) .SAVESEED2
- 45
23- 1 Routine READ.DATA
- 2
- 3 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
24- 32 Skip 2 output lines
- 33
- 34 Print 10 lines with MIN.TELLERS,
- 35 MAX.TELLERS,
- 36 NO.OF.REPLICATIONS,
- 37 MEAN.INTERARRIVAL.T
IME, - 38 MEAN.SERVICE.TIME
and - 39 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.
- 50 Skip 2 output lines
25- 1 Routine INITIALIZE.TELLERS
- 2 Given
- 3 .NO.OF.TELLERS
- 4
- 5 Define .NO.OF.TELLERS as an integer
variable - 6
- 7 If N.TELLER is not zero
- 8 Destroy every TELLER
- 9 Endif ''N.TELLER is not zero
- 10
- 11 If CASE "S" ''single queue case
- 12 Create every TELLER(1)
- 13 Let U.TELLER(1) .NO.OF.TELLERS
- 14 Else ''multi-queue case
- 15 Create every TELLER(.NO.OF.TELLERS)
- 16 For each TELLER
- 17 Do
- 18 Let U.TELLER(TELLER) 1
- 19 Loop ''each TELLER do
26- 1 Process GENERATOR
- 2
- 3 Define .TIME.TO.CLOSE as a real
variable - 4
- 5 Let .TIME.TO.CLOSE time.v
(DAY.LENGTH / hours.v) - 6
- 7 Until time.v gt .TIME.TO.CLOSE
- 8 Do
- 9 Activate a CUSTOMER now
- 10 Wait exponential.f(MEAN.INTERARRIVAL.
TIME,1) minutes - 11 Loop ''time.v gt .TIME.TO.CLOSE do
- 12
- 13 End ''GENERATOR
27- 1 Process CUSTOMER
- 2
- 3 Define .ARRIVAL.TIME as a real variable
- 4
- 5 Define .MY.CHOICE as an integer
variable - 6
- 7 Let .ARRIVAL.TIME time.v
- 8 If CASE "S" ''single queue case
- 9 Let .MY.CHOICE 1
- 10 Else ''multi-queue case
- 11 For each TELLER
- 12 with N.X.TELLER(TELLER) 0
- 13 Find the first case
- 14 If found
- 15 Let .MY.CHOICE TELLER
- 16 Else ''they're all busy
- 17 For each TELLER
- 18 Do
- 19 Compute .MY.CHOICE as the
minimum(TELLER)
28- 1 Routine DAILY.REPORT
- 2 Given
- 3 .REPLICATION.NUMBER,
- 4 .START.TIME,
- 5 .NO.OF.TELLERS
- 6
- 7 Define .REPLICATION.NUMBER and
- 8 .NO.OF.TELLERS
- 9 as integer variables
- 10
- 11 Define .START.TIME as a real variable
- 12
- 13 If .REPLICATION.NUMBER 1
- 14 Start new page
- 15 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)
29- 1 Routine FINAL.REPORT
- 2
- 3 Define .I as an integer variable
- 4
- 5 Print 2 lines thus
- Average over all replications
- 8
- 9 For each TELLER
- 10 Do
- 11 Print 1 line with UTILIZATION(TELLER)
/ U.TELLER(TELLER), - 12 AVG.QUEUE.LENGTH(TE
LLER), - 13 MAX.QUEUE.LENGTH(TE
LLER) and - 14 MEAN.WAITING.TIME
thus - . .
- 16 Loop ''each TELLER
- 17 Skip 3 lines
- 18
- 19 Print 3 lines with WAIT.HISTOGRAM(1)
and
30 35 Print 1 line with WAIT.HISTOGRAM(21)
and 36
QUEUE.HISTOGRAM(1,21) 100 /time.v thus 100 lt
T 20
. 38 39 Read as / using unit 5
40 41 End ''FINAL.REPORT
31- 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.
32- Number of tellers 1
- Finish Teller Queue Length
Average Customer - Time Utilization Average Maximum
Waiting time - (Hours)
(Minutes) - 17.82 1.0 25.8 53
253 - 16.44 1.0 21.7 44
227 - 19.28 1.0 32.3 58
373 - 14.56 1.0 22.8 44
210 - 14.03 1.0 20.0 44
185 - Average over all replications
- 1.0 25.0 58
252
33- Waiting Time Number Who Waited Queue Length
Percentage - (minutes) This Time
of Time - T lt 5 13 0
1.7 - 5 lt T lt 10 2 1
1.8 - 10 lt T lt 15 1 2
1.4 - 15 lt T lt 20 4 3
2.1 - 20 lt T lt 25 2 4
1.7 - 25 lt T lt 30 2 5
1.6 - 30 lt T lt 35 6 6
2.2 - 35 lt T lt 40 5 7
2.1 - 40 lt T lt 45 6 8
2.0 - 45 lt T lt 50 4 9
2.5 - 50 lt T lt 55 5 10
1.6 - 55 lt T lt 60 10 11
2.3 - 60 lt T lt 65 7 12
3.4 - 65 lt T lt 70 6 13
2.0 - 70 lt T lt 75 9 14
1.1 - 75 lt T lt 80 2 15
2.5 - 80 lt T lt 85 12 16
2.0
34- Number of tellers 2
- Finish Teller Queue Length
Average Customer - Time Utilization Average Maximum
Waiting time - (Hours)
(Minutes) - 9.26 1.0 3.6 13
18 - 9.11 .9 2.3 10
13 - 9.91 1.0 12.3 28
73 - 8.05 .9 1.4 8
7 - 8.31 .8 2.2 9
12 - Average over all replications
- .9 4.6 28
25
35- Waiting Time Number Who Waited Queue Length
Percentage - (minutes) This Time
of Time - T lt 5 177 0
28.1 - 5 lt T lt 10 56 1
13.9 - 10 lt T lt 15 43 2
9.3 - 15 lt T lt 20 36 3
7.7 - 20 lt T lt 25 23 4
7.4 - 25 lt T lt 30 27 5
5.3 - 30 lt T lt 35 22 6
4.9 - 35 lt T lt 40 8 7
3.5 - 40 lt T lt 45 3 8
2.2 - 45 lt T lt 50 11 9
2.3 - 50 lt T lt 55 4 10
1.3 - 55 lt T lt 60 6 11
1.3 - 60 lt T lt 65 9 12
1.9 - 65 lt T lt 70 6 13
2.0 - 70 lt T lt 75 5 14
1.3 - 75 lt T lt 80 1 15
1.0 - 80 lt T lt 85 3 16
1.0
36- Number of tellers 3
- Finish Teller Queue Length
Average Customer - Time Utilization Average Maximum
Waiting time - (Hours)
(Minutes) - 8.27 .7 .6 5
3 - 8.34 .7 .4 4
2 - 8.17 .8 1.3 6
6 - 8.05 .6 .3 5
2 - 8.08 .6 .4 5
2 - Average over all replications
- .7 .6 6
3
37- Waiting Time Number Who Waited Queue Length
Percentage - (minutes) This Time
of Time - T lt 5 384 0
72.6 - 5 lt T lt 10 36 1
10.2 - 10 lt T lt 15 45 2
7.3 - 15 lt T lt 20 15 3
6.2 - 20 lt T lt 25 7 4
2.5 - 25 lt T lt 30 1 5
1.2 - 30 lt T lt 35 1 6
.1 - 35 lt T lt 40 0 7
0. - 40 lt T lt 45 0 8
0. - 45 lt T lt 50 0 9
0. - 50 lt T lt 55 0 10
0. - 55 lt T lt 60 0 11
0. - 60 lt T lt 65 0 12
0. - 65 lt T lt 70 0 13
0. - 70 lt T lt 75 0 14
0. - 75 lt T lt 80 0 15
0. - 80 lt T lt 85 0 16
0.
38- Enter case to be run (Single-queue (S) or
Multi-queue (M) M - 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.
39- Number of tellers 1
- Finish Teller Queue Length
Average Customer - Time Utilization Average Maximum
Waiting time - (Hours)
(Minutes) - 17.82 1.0 25.8 53
253 - 16.44 1.0 21.7 44
227 - 19.28 1.0 32.3 58
373 - 14.56 1.0 22.8 44
210 - 14.03 1.0 20.0 44
185 - Average over all replications
- 1.0 25.0 58
252
40- Waiting Time Number Who Waited Queue Length
Percentage - (minutes) This Time
of Time - T lt 5 13 0
1.7 - 5 lt T lt 10 2 1
1.8 - 10 lt T lt 15 1 2
1.4 - 15 lt T lt 20 4 3
2.1 - 20 lt T lt 25 2 4
1.7 - 25 lt T lt 30 2 5
1.6 - 30 lt T lt 35 6 6
2.2 - 35 lt T lt 40 5 7
2.1 - 40 lt T lt 45 6 8
2.0 - 45 lt T lt 50 4 9
2.5 - 50 lt T lt 55 5 10
1.6 - 55 lt T lt 60 10 11
2.3 - 60 lt T lt 65 7 12
3.4 - 65 lt T lt 70 6 13
2.0 - 70 lt T lt 75 9 14
1.1 - 75 lt T lt 80 2 15
2.5 - 80 lt T lt 85 12 16
2.0
41- Number of tellers 2
- Finish Teller Queue Length
Average Customer - Time Utilization Average Maximum
Waiting time - (Hours)
(Minutes) - 9.49 .9 2.1 7
20 - 9.49 1.0 1.7 6
20 - 9.25 .9 1.7 5
18 - 9.25 .8 1.2 5
18 - 10.12 .9 6.3 15
75 - 10.12 1.0 6.0 14
75 - 8.16 .9 1.1 4
12 - 8.16 .9 1.2 4
12 - 8.38 .9 1.3 5
13 - 8.38 .7 1.1 4
13 - Average over all replications
- .9 2.6 15
28 - .9 2.4 14
28
42- Waiting Time Number Who Waited Queue Length
Percentage - (minutes) This Time
of Time - T lt 5 160 0
23.4 - 5 lt T lt 10 47 1
23.7 - 10 lt T lt 15 48 2
18.3 - 15 lt T lt 20 39 3
10.1 - 20 lt T lt 25 23 4
6.6 - 25 lt T lt 30 24 5
3.2 - 30 lt T lt 35 17 6
2.6 - 35 lt T lt 40 17 7
4.3 - 40 lt T lt 45 20 8
2.3 - 45 lt T lt 50 6 9
.2 - 50 lt T lt 55 11 10
1.0 - 55 lt T lt 60 7 11
.5 - 60 lt T lt 65 1 12
.9 - 65 lt T lt 70 2 13
1.7 - 70 lt T lt 75 5 14
.6 - 75 lt T lt 80 4 15
.4 - 80 lt T lt 85 4 16
0.
43 - Number of tellers 3
- Finish Teller Queue Length
Average Customer - Time Utilization Average Maximum
Waiting time - (Hours)
(Minutes) - 8.48 .8 .4 2
4 - 8.48 .8 .3 2
4 - 8.48 .5 .1 1
4 - 8.46 .9 .5 2
4 - 8.46 .6 .1 1
4 - 8.46 .5 .1 1
4 - 8.17 .9 .6 2
7 - 8.17 .8 .5 2
7 - 8.17 .7 .3 2
7 - 8.05 .8 .2 2
3 - 8.05 .7 .2 2
3 - 8.05 .4 .1 1
3 - 8.14 .7 .3 2
3 - 8.14 .5 .1 2
3
44- Waiting Time Number Who Waited Queue
Length Percentage - (minutes) This Time
of Time - T lt 5 370 0
65.6 - 5 lt T lt 10 34 1
28.0 - 10 lt T lt 15 30 2
6.4 - 15 lt T lt 20 24 3
0. - 20 lt T lt 25 12 4
0. - 25 lt T lt 30 6 5
0. - 30 lt T lt 35 7 6
0. - 35 lt T lt 40 3 7
0. - 40 lt T lt 45 1 8
0. - 45 lt T lt 50 1 9
0. - 50 lt T lt 55 0 10
0. - 55 lt T lt 60 1 11
0. - 60 lt T lt 65 0 12
0. - 65 lt T lt 70 0 13
0. - 70 lt T lt 75 0 14
0. - 75 lt T lt 80 0 15
0. - 80 lt T lt 85 0 16
0.
45Section 6 - Simulation Output Analysis
- Part 3 - Presentation Graphics
46Presentation Graphics
47Displaying 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
48Displaying 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
49Displaying 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
50This page is intentionally blank
51Exercise 6
- The Pacific Port Problem (revisited)
- C\Program Files\Simscript3\models\ProblemC
52Pacific 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
53Pacific 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)
54NOTES
- 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
55NOTES Calling a Synchronous Routine from a
Process
- 1 Process SHIP
- 2
- 3 Define .ARRIVAL.TIME,
- 4 .UNLOAD.TIME and
- 5 .PROBABILITY
- 6 as real variables
- 7
- 8 Let .PROBABILITY random.f(2)
- 9 Select case .PROBABILITY
- 10 Case 0.0 to .25
- 11 Let .UNLOAD.TIME
uniform.f(16.0, 20.0, 3) - 12 Case .25 to .80
- 13 Let .UNLOAD.TIME
uniform.f(21.0, 27.0, 3) - 14 Default
- 15 Let .UNLOAD.TIME
uniform.f(32.0, 40.0, 3) - 16 Endselect ''.PROBABILITY
- 17
- Call HARBOR.OPERATIONS
- giving .UNLOAD.TIME
56- 18 Let .ARRIVAL.TIME time.v
- 19
- 20 Request 1 DOCK(1)
- 21 Request 1 TUG(1)
- 22 Wait 1.0 hour
- 23 Relinquish 1 TUG(1)
- 24
- 25 Work .UNLOAD.TIME hours
- 26
- 27 Request 1 TUG(1)
- 28 Wait 1.0 hour
- 29 Relinquish 1 TUG(1)
- 30 Relinquish 1 DOCK(1)
- 31
- 32 Let WAITING.TIME (time.v -
.ARRIVAL.TIME) hours.v - .UNLOAD.TIME - 33 Add WAITING.TIME to SUM.SHIP.DELAY
- 34 Let MAX.SHIP.DELAY max.f(WAITING.TIME,
MAX.SHIP.DELAY) - 35 Add 1 to NO.OF.SHIPS.SERVED
- 36