d7f22e8728a1a9eb2a192c3e5801ae57.ppt
- Количество слайдов: 31
Outline ö performance measures for a single-server station ö discrete-event simulation ö hand simulation ö process-oriented simulation approach 1
A Single-Server Station incoming Machine (Server) 6 5 1 3 2 3 4 out going Queue (FIFO) single-server stations … ö performance measures ö ö two types of averages: customer and time 2
Performance Measures Related to Waiting Time in Queue N be no. of customers who have ever left the queue and got (at least some) service ö WQi be the time in queue of the ith customer ö average waiting time in queue = maximum waiting time in queue, WQ* = 3
Performance Measures Related to Total Time in System ö P no. of customers who have completed his service ö TSi = time in system of customer i average time in system = maximum time in system, TS* = 4
Performance Measures Related to Number in Queue ö Q(t) be the # of customers in queue at t if we simulate only 20 time units time-average number in queue = maximum number waiting in queue, Q* = 5
Performance Measures Related to Utilization of Server again only for simulating for 20 time units utilization = 6
An GI/GI/1 Queue öthe simplest single-server station öindependent service and arrival processes öinter-arrival times of customers, Tn, i. i. d öservice times of customers, Sn, i. i. d öFCFS discipline öinfinite buffer 7
The State and the Sample Path of an GI/G/1 Queue ö state: N(t), number of customers in system N(t) t 8
Simulating an GI/GI/1 Queue by Hand ö simulate the system for 20 time units to get total # of customers served (in the time horizon) ö average and maximum waiting time in queue ö time-average and maximum number in queue ö average and maximum total time in system ö utilization (proportion of time busy) ö 9
Input Data ö ö ö Initially (time 0) empty and idle Time Part Number Arrival Time Interarrival Time Service 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 11 40. 82. . . Stop when 20 minutes of (simulated) time have passed 10
Performance Measures ö simulate 20 time units ö performance ö average measures waiting time in queue ö time-average ö utilization number in queue of drill press ö results? 11
Discrete-event Simulation Approach 12
To Simulate the Sample Path of an GI/G/1 Queue N(t) t ö state: N(t), number of customers in system ö events ö state changes ö arrivals and departures of customers 13
The Discrete-event Simulation Approach ö after defining the states and events, the key is to generate the “locations of points” “location” : state N(t) t How to do that? 14
The Sample Path of an GI/G/1 Queue ö ö ö Sn = the service time of the nth customer Tn = the inter-arrival time between the (n-1)st and nth customers; T 0 = 0 possible to deduce Sn and Tn from the sample path? T 3 T 2 N(t) S 2 T 1 t S 1 15 S 3
An Equivalent Representation of the Sample Path ö {Sn} and {Tn} sample path? ö not necessary, if both {Sn} & {Tn} are discrete ö yes otherwise ö {Sn} & {Tn}: always gives a sample path ö generate each Sn and Tn when necessary 16
To Simulate the Sample Path of an GI/G/1 Queue location of the first location of the point: trivial second point: depending on T 1 and SS 1 suppose T 1 < 1 location of the second location of the fourth point: and third points: trivial depending on T 2 and S 1 -T 1 N(t) T 1 S 1 t 17
To Simulate an GI/GI/1 Queue by a Computer Program ö variables ö ö events: other than initialization and termination ö ö ö system or simulation variables: TNOW, TTERM state of the machine performance variable an arrival: update performance measures a departure: update performance measures general flow of the program ö ö initialization: initialize variables; set first event, etc. if not stopping yet, ö ö check next event, execute tasks for the event termination: execute all house keeping tasks 18
To Simulate an GI/G/1 Queue ö definition of variables ö definition of events ö flow chart of program ö program: Java 19
Flow Chart for Simulating an GI/G/1 Queue N = L = K = 0; Ta = random interarrival time; Ts = infinity Yes Tnow Tmax No arrival next event ouput L/Tnow and L/K service L = L + (Ta - Tnow)N; Tnow = Ta; N = N + 1; K = K +1; Ta = Tnow + random inter-arrival time L = L + (Ts - Tnow)N; Tnow = Ts; N=N-1 Yes No N=0 N=1 Ts = infinity Yes Ts = Tnow + random service time 20 No Ts = Tnow + random service time
Conceptual Structure of an Event Calendar event: (time, type, tasks to do) ö event calendar: a link list with scheduled future events in ascending order of time ö example ö four events scheduled at epoch 0 ö event 1: (24. 3, type = 4, tasks to do) ö event 2: (35. 6, type = 1, tasks to do) ö event 3: (41. 3, type = 2, tasks to do) ö event 4: (5000, type = END, tasks to do = end program) ö 21
Event Calendar of a Simulation Program TNOW = 0: Event. Cal. 1 24. 3 type 4 2 35. 6 type 1 3 41. 3 type 2 4 5000 END 22 tasks to do End simulation
Event Calendar of a Simulation Program suppose 0: TNOW =that no new event is created by a type 4 event move time to TNOW = 24. 3 execute first event and update event calendar Event. Cal. 1 35. 6 24. 3 type 4 1 tasks to do 2 35. 6 41. 3 1 type 2 tasks to do do 3 41. 3 5000 type 2 END tasks to End simulationdo 4 5000 END End simulation 23
Event Calendar of a Simulation Program suppose 0: TNOW =that a new event is created by an type 4 event at 39. 1 move time to TNOW = 24. 3 execute first event and update event calendar 39. 1 Event. Cal. type 4 1 35. 6 24. 3 type 1 4 tasks to do 2 39. 1 35. 6 type 4 1 type 1 tasks to do 3 41. 3 type 2 4 5000 END 24 tasks to do End simulation tasks to do
Operations of the Event Calendar ö delete an event that has (just) occurred after completing all tasks at TNOW, remove the first event in the event calendar Describe concept only; actual ö insert a new event implementation ö get the event time of the new event depends on the data ö check where to insert the event structure used ö move backward one rank for events occurring after the new event ö insert the new event ö 25
A Crude Pseudo-Code of GI/G/1 Queue with Event Calendar ö 1 initialization ö ö ö 2 3 get next event type while { next event != termination } { ö ö ö ö 4 set TNOW = 0; initialize variables; set termination event; set initial events get next event time and next event details set TNOW to next event time update the Event Calendar execute next event, including updating variables and possibly adding new events to Event Calendar get next event type } execute the termination Event 26
Generic Program Structure for Complex Systems ö Initialization Event while (not stopping (e. g. , TNOW < TTERM)) { switch (Next Event Type) { case 1: tasks of type 1 event; break; . . . . keep track of the timing of events by the Event Calendar case n: tasks of type n event; break; } } Termination Event 27
Process-Oriented Simulation Approach 28
Process-Oriented World View ö non-procedural code defining processes of all types of entities ö possible to have artificial entities for logic flow ö possibly to have multiple copies of entities at any time incoming Machine (Server) 6 5 3 4 1 2 3 out going Queue (FIFO) 30 Simulation with Arena, 5 th ed. Chapter 2 – Fundamental Simulation Concepts Slide 30 of 57
Process-Oriented World View in Arena ö common world view adopted by simulation software ö event-oriented programs underneath ö commonest world view of Arena, with everything executed in SIMAN simulation language underneath 31 Simulation with Arena, 5 th ed. Chapter 2 – Fundamental Simulation Concepts Slide 31 of 57
Pieces of a Simulation Model ö entities ö queues ö attributes ö ö global variables statistical accumulators ö ö events ö ö Arena built-in user-defined ö simulation clock ö starting and stopping resources 32


