Presentation is loading. Please wait.

Presentation is loading. Please wait.

F Day 3 Section 5 - Event Approach to Simulation Events

Similar presentations


Presentation on theme: "F Day 3 Section 5 - Event Approach to Simulation Events"— Presentation transcript:

1 F Day 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 —————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-1

2 Section 6 - Simulation Output Analysis
Part 1 - Random Numbers and Statistics —————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-2

3 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

4 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

5 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

6 Replications No stop statements Reset output variables
Let event set empty All resources relinquished Reset output variables —————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-6

7 3 Define I as an integer variable 4 5 Call INITIALIZE 6
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 For I = 1 to 20 do 15 Use unit 6 for output Activate a GENERATOR now Start simulation 19 Print 1 line with NO.OF.SHIPS.SERVED, SUM.SHIP.DELAY / NO.OF.SHIPS.SERVED and MAX.SHIP.DELAY thus *** **.** **.** 24 Let time.v = 0 Let NO.OF.SHIPS.SERVED = 0 Let SUM.SHIP.DELAY = 0 Let MAX.SHIP.DELAY = 0 29 Loop ''I = 1 to 20 do 31 32 End —————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-7

8 Pacific Port Problem with Replications
Number of Average Maximum Ships Unloaded Delay Time Delay Time —————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 6-8

9 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

10 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 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 —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

11 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 ——————————————

12 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 ——————————————

13 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 Compute BEST.RUNWAY as the minimum(RUNWAY) Request 1 RUNWAY (BEST.RUNWAY) —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

14 Accumulate and Tally Time
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. X Time 1 2 t Accumulate gives a value of almost 2.0 Tally gives a value of 1.5 —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

15 This page is intentionally blank
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

16 Section 6 - Simulation Output Analysis
Part 2 - Modernizing a Bank - with Replications —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

17 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 ——————————————

18 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. 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 —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

19 3 '' Modernizing a Bank - CACI Products Company
1 Preamble 2 3 '' Modernizing a Bank - CACI Products Company 4 '' files: SIMBANK.SRC 5 6 Normally mode is undefined 7 8 Processes include GENERATOR and CUSTOMER 11 Resources include TELLER 14 Define CASE as a text variable 16 Define MIN.TELLERS, MAX.TELLERS and NO.OF.REPLICATIONS as integer variables 21 Define MEAN.INTERARRIVAL.TIME, MEAN.SERVICE.TIME, DAY.LENGTH and WAITING.TIME as real variables 27 Accumulate DLY.UTILIZATION as the DAILY average of N.X.TELLER 29 Accumulate DLY.AVG.QUEUE.LENGTH as the DAILY average and DLY.MAX.QUEUE.LENGTH as the DAILY maximum of N.Q.TELLER 33 Tally DLY.MEAN.WAITING.TIME as the DAILY mean of WAITING.TIME 35 Accumulate UTILIZATION as the average of N.X.TELLER —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

20 38 Accumulate AVG.QUEUE.LENGTH as the average,
37 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 42 Tally MEAN.WAITING.TIME as the mean and WAIT.HISTOGRAM (0 to 100 by 5) as the histogram of WAITING.TIME 46 47 End —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

21 8 Define .START.TIME as a real variable 9
1 Main 2 Define .NO.OF.TELLERS, REPLICATION, SAVESEED1 and SAVESEED2 6 as integer variables 7 8 Define .START.TIME as a real variable 9 Let .SAVESEED1 = seed.v(1) Let .SAVESEED2 = seed.v(2) 12 Call READ.DATA 14 For .NO.OF.TELLERS = MIN.TELLERS to MAX.TELLERS Do Call INITIALIZE.TELLERS Given NO.OF.TELLERS 20 For .REPLICATION = 1 to NO.OF.REPLICATIONS Do Let .START.TIME = time.v 24 Activate a GENERATOR now Start simulation —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

22 35 Reset DAILY totals of N.X.TELLER(TELLER), 36 N.Q.TELLER(TELLER) and
Call DAILY.REPORT Given REPLICATION, START.TIME and NO.OF.TELLERS 32 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 40 Call FINAL.REPORT Let time.v = 0.0 Let seed.v(1) = .SAVESEED1 Let seed.v(2) = .SAVESEED2 45 For each TELLER Do Reset totals of N.X.TELLER(TELLER), N.Q.TELLER(TELLER) and WAITING.TIME 51 Loop ''each TELLER do Loop ''.NO.OF.TELLERS = MIN.TELLERS to MAX.TELLERS 54 55 End —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

23 Enter case to be run (Single-queue (S) or Multi-queue (M): 5 Read CASE
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: Read MIN.TELLERS 11 Print 1 line thus Enter maximum number of tellers: Read MAX.TELLERS 15 Print 1 line thus Enter number of replications: Read NO.OF.REPLICATIONS 19 Print 1 line thus Enter mean time between customer arrivals (in minutes): Read MEAN.INTERARRIVAL.TIME 23 Print 1 line thus Enter mean time for servicing a customer (in minutes): Read MEAN.SERVICE.TIME 27 Print 1 line thus Enter length of time that bank is open for one day (in hours): Read DAY.LENGTH 31 —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

24 34 Print 10 lines with MIN.TELLERS, 35 MAX.TELLERS,
Skip 2 output lines 33 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 51 52 End ''READ.DATA —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

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 Destroy every TELLER 9 Endif ''N.TELLER is not zero 10 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" 21 22 End ''INITIALIZE.TELLERS —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

26 3 Define .TIME.TO.CLOSE as a real variable 4
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 >= .TIME.TO.CLOSE 8 Do Activate a CUSTOMER now Wait exponential.f(MEAN.INTERARRIVAL.TIME,1) minutes Loop ''time.v >= .TIME.TO.CLOSE do 12 13 End ''GENERATOR —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

27 3 Define .ARRIVAL.TIME as a real variable 4
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 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" 24 Request 1 TELLER(.MY.CHOICE) 26 Let WAITING.TIME = (time.v - .ARRIVAL.TIME) * hours.v * minutes.v 28 Work exponential.f(MEAN.SERVICE.TIME, 2) minutes 30 Relinquish 1 TELLER(.MY.CHOICE) 32 33 End ''CUSTOMER —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

28 7 Define .REPLICATION.NUMBER and 8 .NO.OF.TELLERS
1 Routine DAILY.REPORT 2 Given REPLICATION.NUMBER, START.TIME, NO.OF.TELLERS 6 7 Define .REPLICATION.NUMBER and NO.OF.TELLERS 9 as integer variables 10 Define .START.TIME as a real variable 12 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 31 32 End ''DAILY.REPORT —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

29 3 Define .I as an integer variable 4 5 Print 2 lines thus
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 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 18 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 < *** *.* 24 For .I = 2 to 20 Do Print 1 line with 5 * (.I - 1), * .I, WAIT.HISTOGRAM(.I), I - 1 and QUEUE.HISTOGRAM(1,.I) * 100 / time.v thus ** <= T < ** *** *** *.* Loop ''I = 1 to 20 34 —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

30 35 Print 1 line with WAIT.HISTOGRAM(21) and
QUEUE.HISTOGRAM(1,21) * 100 /time.v thus 100 <= T *** *.* 38 39 Read as / using unit 5 40 41 End ''FINAL.REPORT —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

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 minutes. The bank doors are closed after hours each day But all customers inside are served. —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

32 Finish Teller Queue Length Average Customer
Number of tellers = 1 Finish Teller Queue Length Average Customer Time Utilization Average Maximum Waiting time (Hours) (Minutes) Average over all replications: —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

33 Waiting Time Number Who Waited Queue Length Percentage
(minutes) This Time of Time T < 5 <= T < 10 <= T < 15 <= T < 20 <= T < 25 <= T < 30 <= T < 35 <= T < 40 <= T < 45 <= T < 50 <= T < 55 <= T < 60 <= T < 65 <= T < 70 <= T < 75 <= T < 80 <= T < 85 <= T < 90 <= T < 95 <= T < 100 <= T —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

34 Finish Teller Queue Length Average Customer
Number of tellers = 2 Finish Teller Queue Length Average Customer Time Utilization Average Maximum Waiting time (Hours) (Minutes) Average over all replications: —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

35 Waiting Time Number Who Waited Queue Length Percentage
(minutes) This Time of Time T < 5 <= T < 10 <= T < 15 <= T < 20 <= T < 25 <= T < 30 <= T < 35 <= T < 40 <= T < 45 <= T < 50 <= T < 55 <= T < 60 <= T < 65 <= T < 70 <= T < 75 <= T < 80 <= T < 85 <= T < 90 <= T < 95 <= T < 100 <= T —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

36 Finish Teller Queue Length Average Customer
Number of tellers = 3 Finish Teller Queue Length Average Customer Time Utilization Average Maximum Waiting time (Hours) (Minutes) Average over all replications: —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

37 Waiting Time Number Who Waited Queue Length Percentage
(minutes) This Time of Time T < 5 <= T < 10 <= T < 15 <= T < 20 <= T < 25 <= T < 30 <= T < 35 <= T < 40 <= T < 45 <= T < 50 <= T < 55 <= T < 60 <= T < 65 <= T < 70 <= T < 75 <= T < 80 <= T < 85 <= T < 90 <= T < 95 <= T < 100 <= T —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

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 minutes. The bank doors are closed after hours each day But all customers inside are served. —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

39 Finish Teller Queue Length Average Customer
Number of tellers = 1 Finish Teller Queue Length Average Customer Time Utilization Average Maximum Waiting time (Hours) (Minutes) Average over all replications: —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

40 Waiting Time Number Who Waited Queue Length Percentage
(minutes) This Time of Time T < 5 <= T < 10 <= T < 15 <= T < 20 <= T < 25 <= T < 30 <= T < 35 <= T < 40 <= T < 45 <= T < 50 <= T < 55 <= T < 60 <= T < 65 <= T < 70 <= T < 75 <= T < 80 <= T < 85 <= T < 90 <= T < 95 <= T < 100 <= T —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

41 Finish Teller Queue Length Average Customer
Number of tellers = 2 Finish Teller Queue Length Average Customer Time Utilization Average Maximum Waiting time (Hours) (Minutes) Average over all replications: —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

42 Waiting Time Number Who Waited Queue Length Percentage
(minutes) This Time of Time T < 5 <= T < 10 <= T < 15 <= T < 20 <= T < 25 <= T < 30 <= T < 35 <= T < 40 <= T < 45 <= T < 50 <= T < 55 <= T < 60 <= T < 65 <= T < 70 <= T < 75 <= T < 80 <= T < 85 <= T < 90 <= T < 95 <= T < 100 <= T —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

43 Number of tellers = 3 Finish Teller Queue Length Average Customer
Time Utilization Average Maximum Waiting time (Hours) (Minutes) Average over all replications: —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

44 Waiting Time Number Who Waited Queue Length Percentage
(minutes) This Time of Time T < 5 <= T < 10 <= T < 15 <= T < 20 <= T < 25 <= T < 30 <= T < 35 <= T < 40 <= T < 45 <= T < 50 <= T < 55 <= T < 60 <= T < 65 <= T < 70 <= T < 75 <= T < 80 <= T < 85 <= T < 90 <= T < 95 <= T < 100 <= T —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

45 Section 6 - Simulation Output Analysis
Part 3 - Presentation Graphics —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

46 Presentation Graphics
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

47 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 ——————————————

48 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 ——————————————

49 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 ——————————————

50 This page is intentionally blank
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

51 Exercise 6 The Pacific Port Problem (revisited)
C:\Program Files\Simscript3\models\ProblemC —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

52 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 ——————————————

53 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 ——————————————

54 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 ——————————————

55 NOTES: Calling a Synchronous Routine from a Process
1 Process SHIP 2 3 Define .ARRIVAL.TIME, UNLOAD.TIME and PROBABILITY 6 as real variables 7 8 Let .PROBABILITY = random.f(2) 9 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 17 Call HARBOR.OPERATIONS giving .UNLOAD.TIME End ‘’SHIP Routine HARBOR.OPERATIONS Define .ARRIVAL.TIME, .UNLOAD.TIME as real variables —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————

56 18 Let .ARRIVAL.TIME = time.v 19 20 Request 1 DOCK(1)
Request 1 TUG(1) Wait 1.0 hour Relinquish 1 TUG(1) 24 Work .UNLOAD.TIME hours 26 Request 1 TUG(1) Wait 1.0 hour Relinquish 1 TUG(1) Relinquish 1 DOCK(1) 31 Let WAITING.TIME = (time.v - .ARRIVAL.TIME) * hours.v - .UNLOAD.TIME Add WAITING.TIME to SUM.SHIP.DELAY Let MAX.SHIP.DELAY = max.f(WAITING.TIME, MAX.SHIP.DELAY) Add 1 to NO.OF.SHIPS.SERVED 36 37 End ''HARBOR.OPERATIONS —————————— CACI Products Company ——————————————————————————————— SimScript II.5 ——————————————


Download ppt "F Day 3 Section 5 - Event Approach to Simulation Events"

Similar presentations


Ads by Google