Elements of a Simulation Model How can we construct a simulation model without being concerned about implementation details? which are similar in every problem have nothing to do with the model itself can be dealt with automatically Make compiler responsible Model views static: if time is stopped, of what elements does world consist? dynamic: process which moves the world from state to state Entities (Temporary entities) dynamic objects that enter and leave system represent real things or intangibles get service from one or more resources examples: car, patient, customer, order, … Resources (Permanent entities) stay in system can be engaged with one or more temporary entities at the same time can represent a group of servers examples: doctor, machine, traffic ligth, toll-booth, … Distinction is not along lines of physical movement (or not) doctor visits patient or vice versa Distinction depends on situation car in repair shop versus taxi servicing customers Attributes (Local) entities have attributes with specific values for each individual entity examples: arrival time, due date, priority, type, capacity needed, … Variables (Global) not tied to specific entity built-in variables: number in queue, time, … user-defined variables: current shift, number in system, … statistical accumulators: number …, highest number in …, total time, longest time … Queues when an entity cannot move on e.g. resource unavailable, … capacity: limited buffer space, … policy: FIFO, … Events something that happens at an instant may change attributes, variables, … examples ENTER the system LEAVE the system TERMINATE simulation Event Record event type event time entity involved Event Calendar events that are supposed to happen in the future event records in ascending order of time Clock model of time: variable-length increment close interaction with event calendar clock update phase take event in front of event calendar advance clock to scheduled occurrence time of that event put event in current event group WHILE (scheduled occurrence time of next event in calendar = clock) take event from event calendar put event in current event group END scanning phase take first event from current event group WHILE (not end of current event group) PROCESS EVENT IF (blocking condition removed) restart scanning phase END Process Event remove event from current event group schedule new event; add event to event calendar (or to current event group) move entity involved as far as possible through its life-cycle update states and statistics Process Event IF (event is ARRIVAL) update statistics schedule next ARRIVAL add event to event calendar IF (server is busy) put entity in queue update queue length ELSE make server busy schedule DEPARTURE add event to event calendar ELSE IF (event is DEPARTURE) update statistics IF (queue is empty) make server idle ELSE take first entity from queue update queue length & stats schedule DEPARTURE add event to event calendar Phases of a simulation project 1. Determine purpose 2. Build model 3. Validate model 4. Design and run experiments 5. Analyze results & draw conclusions Sequence depends on circumstances Iteration possible Identifier Avg Var Min Max #Obs _______________________________________________ time : 60.0 Server Q Time .73822 1.3780 0 3.5809 59 # in Server Q .72592 1.7489 0 6.0000 0 Server Busy .53786 .92694 0 1.0000 0 time : 480.0 Server Q Time .38699 1.7742 0 3.5809 472 # in Server Q .38054 2.3000 0 6.0000 0 Server Busy .47220 1.0572 0 1.0000 1 time : 1e+006.0 Server Q Time .49301 1.7393 0 14.418 997217 # in Server Q .49164 2.2422 0 17.000 0 Server Busy .49783 1.0043 0 1.0000 0 Identifier Avg Var Min Max #Obs ____________________________________________ Replication 1 of 5 (ended at time 60.0) Server Q Time # in Server Q Server Busy .73822 .72592 .53786 1.3780 1.7489 .92694 0 0 0 3.5809 6.0000 1.0000 59 0 0 Replication 2 of 5 (ended at time 60.0) Server Q Time # in Server Q Server Busy .30073 .26064 .45774 1.7782 2.2225 1.0884 0 0 0 2.3144 3.0000 1.0000 52 0 0 Replication 3 of 5 (ended at time 60.0) Server Q Time # in Server Q Server Busy .20550 .21423 .39406 2.0470 2.7542 1.2400 0 0 0 1.8512 4.0000 1.0000 61 1 1 Replication 4 of 5 (ended at time 60.0) Server Q Time # in Server Q Server Busy .21317 .19185 .41226 1.6442 2.9451 1.1940 0 0 0 1.2277 3.0000 1.0000 54 0 0 Replication 5 of 5 (ended at time 60.0) Server Q Time # in Server Q .58702 .62616 1.3541 1.8374 0 0 2.7351 6.0000 64 0 Server Busy .56152 .88367 0 1.0000 1 Identifier Ignore Wait Preempt _________________________________________ Machine Q Time Flowtime Machine Busy # in Machine Q Machine Available Production .25444 3.7669 .83559 .28638 .60000 2 .85275 3.7669 .71593 .40604 .60000 2 .85275 5.7669 .58260 .40604 .60000 2 Arrive 0 Arrive 1 Server Server 1 Depart Depart 1 Enhancing the Animation Scrap Rework 0 0 Part A Prep Inspect Depart Rework Salvage Scrap 0 Sealer Arrive Server Part A Arrive Depart Part A Prep Part B Prep Arrive Salvaged Parts Inspect 10 Shipping Sealer 0 Number in Rework Queue Server Part B Arrive Part B Prep Depart Shipping 0 Simulate Electronic Assembly and Test 50000 Statistics 0.000 960.000 Time (in Minutes)Animate Rework_R_Q Number in Queue Animate Rework_R Number Available Small Manufacturing System Server Server Cell 1 Cell 2 Depart Arrive Ord er R e l ea s e E x i t S y s tem Leave Server Enter Process Cell 3 C el l 3 M ac hi n es Cell 4 Expressions Sets C e l l 1 Ti m es Sequences P art 1 R o ute P art 2 R o ute P art 3 R o ute Variables Tran s fer Ti m e Fac to r 1 Simulate S m a l l M a n ufa c turi ng S y s tem 20 00 Resource Resource Cell 3 New C el l 3 Ol d Small Manufacturing Resource System Constrained ______________________________________________ Cell Part Cell Cell Part Cell Part 1_R_Q Queue Time 3 Cycle Time 2_R_Q Queue Time 3 Machines_Q Queu 1 Cycle Time 4_R_Q Queue Time 2 Cycle Time 16.705 81.410 9.1815 10.795 111.64 11.626 143.21 12.362 103.69 5.5290 12.103 139.74 11.171 178.07 # in Cell Cell # in Cell # in # in Cell Cell Cell 3 Machines_Q 2_R Busy 1_R Busy Cell 4_R_Q 3 New Busy Cell 2_R_Q Cell 1_R_Q 4_R Busy 3 Old Busy .75625 .82167 .79801 .58713 .81285 .96406 1.2173 .80659 .83263 .84723 .79957 .78298 .56975 .80512 .57226 .89013 .79621 .84121