Presentation is loading. Please wait.

Presentation is loading. Please wait.

Simulation Modeling & Simulation 33.  Simulation: It is a numerical technique for conducting experiments with certain types of mathematical models.

Similar presentations


Presentation on theme: "Simulation Modeling & Simulation 33.  Simulation: It is a numerical technique for conducting experiments with certain types of mathematical models."— Presentation transcript:

1 Simulation Modeling & Simulation 33

2  Simulation: It is a numerical technique for conducting experiments with certain types of mathematical models describing the behavior of complex systems on a digital computer over extended periods of time  In a Simulation, a computer is used to evaluate a model numerically, and then gather data in order to estimate the desired characteristics of the model. Basic Concepts

3  Simulation enables the study of complex system.  Simulation is a good approach when analytic study of a system is not possible or very complex.  Informational, organizational, and environmental changes can be simulated.  The knowledge gained in designing a simulation model may be of great value toward suggesting improvement in the system under investigation. When and Why to use Simulations?

4 Application Areas of Simulation

5 Advantages/Drawbacks of Simulation Advantages  Advantages  Adequate for assessing models too complicated for analytical or numerical study;  New policies, decision rules, etc., can be explored without disrupting ongoing operations of the real system;  “What if” scenarios can be analyzed which are useful in the design of new systems.

6 Advantages/Drawbacks of Simulation  Drawbacks  Sometimes very time consuming/costly;  To analyze a certain problem, better methods than simulation may exist;  Simulations provide “random output” (lots of misinterpretation possible).

7 Discrete-Event Simulation

8 Discrete Event Simulation Discrete Event Simulation: computer model for a system where changes in the state of the system occur at discrete points in simulation time. Fundamental concepts: System state (state variables) State transitions (events) Each event has a timestamp indicating when it occurs. A DES computation can be viewed as a sequence of event computations, with each event computation is assigned a (simulation time) time stamp Each event computation can Modify state variables Schedule new events

9 Discrete Event Simulation Computation  Events that have been scheduled, but have not been simulated (processed) yet are stored in a pending event list  Events are processed in time stamp order; why?  Example: air traffic at an airport  Events: aircraft arrival, landing, departure arrival 8:00 departure 9:15 landed 8:05 arrival 9:30 schedules simulation time processed event current event unprocessed event schedules

10 Example: Air traffic at an Airport  Model aircraft arrivals and departures, arrival queuing  Single runway for incoming aircraft, ignore departure queuing  L = mean time runway used for each landing aircraft (exponential distrib.)  G = mean time on the ground before departing (exponential distribution)  A = mean inter-arrival time of incoming aircraft (exponential distribution)  States  Now: current simulation time  InTheAir : number of aircraft landing or waiting to land  OnTheGround : number of landed aircraft  RunwayFree : Boolean, true if runway available  Events  Arrival : denotes aircraft arriving in air space of airport  Landed : denotes aircraft landing  Departure : denotes aircraft leaving

11 Events  An event must be associated with any change in the state of the system  Airport example:  Event 1: Aircraft Arrival ( InTheAir, RunwayFree )  Event 2: Aircraft Landing ( InTheAir, OnTheGround, RunwayFree )  Event 3: Aircraft Departure ( OnTheGround )

12 Event-Oriented World View state variables Integer: InTheAir; Integer: OnTheGround; Boolean: RunwayFree; Event handler procedures Simulation Application Arrival Event { … } Landed Event { … } Departure Event { … } Pending Event List (PEL) 9:00 9:16 10:10 Now = 8:45 Simulation Engine Event processing loop While (simulation not finished) E = smallest time stamp event in PEL Remove E from PEL Now := time stamp of E call event handler procedure

13 Arrival Events Arrival Event: InTheAir := InTheAir+1; Schedule Arrival event @ Now + RandExp(A); If (RunwayFree) { RunwayFree:=FALSE; Schedule Landed event @ Now + RandExp(L); } A: mean interarrival time of incoming aircraft Now: current simulation time InTheAir: number of aircraft landing or waiting to land OnTheGround: number of landed aircraft RunwayFree: Boolean, true if runway available  Arrival Process: New aircraft arrives at airport.  If the runway is free, it will begin to land.  Otherwise, the aircraft must circle, and wait to land.

14 Landed Event Landed Event: InTheAir:=InTheAir-1; OnTheGround:=OnTheGround+1; Schedule Departure event @ Now + RandExp(G); If (InTheAir>0) Schedule Landed event @ Now + RandExp(L); Else RunwayFree := TRUE; L = mean time runway is used for each landing aircraft G = mean time required on the ground before departing Now: current simulation time InTheAir: number of aircraft landing or waiting to land OnTheGround: number of landed aircraft RunwayFree: Boolean, true if runway available Landing Process: An aircraft has completed its landing.

15 Departure Event Departure Event: OnTheGround := OnTheGround - 1; Departure Process: An aircraft now on the ground departs for a new destination. Now: current simulation time InTheAir: number of aircraft landing or waiting to land OnTheGround: number of landed aircraft RunwayFree: Boolean, true if runway available

16 Execution Example OnTheGround Simulation Time State Variables RunwayFree InTheAir 01234567891011 true 0 0 L=3 G=4 TimeEvent 1 Arrival F1 3 Arrival F2 Now=0 Processing: false 1 TimeEvent 4 Landed F1 3 Arrival F2 Arrival F1 Now=1 2 TimeEvent 4 Landed F1 Arrival F2 Now=3 1 1 Landed F1 Now=4 TimeEvent 8 Depart F1 7 Landed F2 0 2 true TimeEvent 8 Depart F1 11 Depart F2 Landed F2 Now=7 1 TimeEvent 11 Depart F2 Depart F1 Now=8 0 TimeEvent Depart F2 Now=11

17 State Variables State:  InTheAir : number of aircraft either landing or waiting to land  OnTheGround : number of landed aircraft  RunwayFree : Boolean, true if runway available customer queue server

18 Output Statistics Compute  The maximum number of aircraft that will be on the ground at one time  Average time an aircraft must wait before they are allowed to land Solution  Maximum on ground  Variable for airport indicating number currently on ground  Maximum “on the ground” so far  Wait time  Variables for airport indicating total wait time, number of aircraft arrivals  State variable for each aircraft indicating the arrival time

19 Problems With Time Step Approach  State changes may occur between time steps  Use small time steps to minimize error  Multiple state changes within the same time step may be processed in the wrong order  Solvable by ordering state changes within time step (this imposes more work)  Inefficient  Many time steps no state changes occur, especially if small time steps

20 DES Model Development Algorithm 1.1 — How to develop a model: 1) Determine the goals and objectives 2) Build a conceptual model 3) Convert into a specification model 4) Convert into a computational model 5) Verify 6) Validate Typically an iterative process

21 Three Model Levels  Conceptual  Very high level  How comprehensive should the model be?  What are the state variables, which are dynamic, and which are important?  Specification  On paper  May involve equations, pseudocode, etc.  How will the model receive input?  Computational  A computer program  General-purpose PL or simulation language?

22 Verification vs. Validation  Verification  Computational model should be consistent with specification model  Did we build the model right?  Validation  Computational model should be consistent with the system being analyzed  Did we build the right model?  Can an expert distinguish simulation output from system output?  Interactive graphics can prove valuable

23 A Machine Shop Model  150 identical machines:  Operate continuously, 8 hr/day, 250 days/yr  Operate independently  Repaired in the order of failure  Income: 20 Pound/hr of operation  Service technician(s):  2-year contract at Pound 52,000/yr  Each works 230 8-hr days/yr  How many service technicians should be hired?

24 System Diagram

25 Algorithm ==== Applied 1) Goals and Objectives: — Find number of technicians for max profit — Extremes: one techie, one techie per machine

26 Algorithm ==== Applied 1) Conceptual Model: — State of each machine (failed, operational) — State of each techie (busy, idle) — Provides a high-level description of the system at any time

27 Algorithm ==== Applied 1) Specification Model: — What is known about time between failures? — What is the distribution of the repair times? — How will time evolution be simulated?

28 Algorithm == Applied 4) Computational Model: — Simulation clock data structure — Queue of failed machines — Queue of available techies

29 Algorithm == Applied 4) Verify: — Software engineering activity — Usually done via extensive testing 5) Validate: — Is the computational model a good approximation of the actual machine shop? — If operational, compare against the real thing — Otherwise, use consistency checks

30 What is Monte Carlo Simulation ?  Monte Carlo methods are a widely used class of computational algorithms for simulating the behavior of various physical and mathematical systems, and for other computations.  Monte Carlo algorithm is often a numerical Monte Carlo method used to find solutions to mathematical problems (which may have many variables) that cannot easily be solved, (e.g. integral calculus, or other numerical methods)

31 What is Monte Carlo Simulation ?  A Monte Carlo simulation is a simulation technique that provides approximate solutions to problems expressed mathematically. It utilizes a sequence of random numbers to perform the simulation.  This technique can be used in different domains:  complex integral computations,  economics,  making decisions in specific complex problems, …

32 Example. Hassan Cake Shop

33  The cake seller Hassan shop sells a random number of cakes each day. Hassan manager wants to determine a policy for managing his inventory of cakes (e.g. how many cakes should he prepare in 10 days).  We can use Monte Carlo simulation to analyze Hassan inventory… Demand Frequency Probability for cakes 0 10 0.05 1 20 0.1 2 40 0.2 3 60 0.3 4 40 0.2 5 30 0.15 200 1.00 =10/200 Example inspired from: To accompany Quantitative Analysis for Management, 9e by Render/Stair/Hanna © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458

34 Example. Hassan Cake Shop Step 1: Set up the probability distribution for cake sales. Using historical data HERFY Shop determined that 5% of the time 0 cakes were demanded, 10% of the time 1 cake was demanded, etc… P(1) = 10%

35 Example. Hassan Cake Shop Step 2: Build a Cumulative Probability Distribution 15% of the time the demand was 0 or 1 cake P(0) = 5% + P(1) = 10%

36 Example. Hassan Cake Shop Demand Frequency Probability Cumulative Probability Random Number Interval 0100.05 01 - 05 1200.100.1506 - 15 2400.200.3516 - 35 3600.300.6536 - 65 4400.200.8566 - 85 5300.151.0086 - 00 Step 3: Establish an interval of random numbers. Must be in correct proportion Note: 5% of the time 0 cakes are demanded, so the random number interval contains 5% of the numbers between 1 and 100

37 Example. Hassan Cake Shop Step 4: Generate random numbers. 52 37 82 69 98 96 33 50 88 90 50 27 45 81 66 74 30 06 63 57 02 94 52 69 33 32 30 48 88 14 02 83 05 34 50 28 68 36 90 62 27 50 18 36 61 21 46 01 14 82 87 88 02 28 49 36 87 21 95 50 24 18 62 32 78 74 82 01 53 74 05 71 06 49 11 13 62 69 85 69 13 82 27 93 74 30 35 94 99 78 56 60 44 57 82 23 64 49 74 76 09 11 10 24 03 32 23 59 95 34 51 08 48 66 97 03 96 46 47 03 11 10 67 23 89 62 56 74 54 31 62 37 33 82 99 29 27 75 89 78 68 64 62 30 17 12 74 45 11 52 59 37 60 79 21 85 71 48 39 31 35 12 73 41 31 97 78 94 66 74 90 95 29 72 17 55 15 36 80 02 86 94 59 13 25 91 85 87 90 21 90 89 29 40 85 69 68 98 99 81 06 34 35 90 92 94 25 57 34 30 90 01 24 00 92 42 72 28 32 73 41 38 73 01 09 64 34 55 84 16 98 49 00 30 23 00 59 09 97 69 98 93 49 51 92 16 84 27 64 94 17 84 55 25 71 34 57 50 44 95 64 16 46 54 64 61 23 01 57 17 36 72 85 31 44 30 26 09 49 13 33 89 13 37 58 07 60 77 49 76 95 51 16 14 85 59 85 40 42 52 39 73

38 Example. Hassan Cake Shop Step 5: Simulate a series of trials. Using random number table on previous slide, simulated demand for 10 days is: Random number: 52 06 50 88 53 30 10 47 99 37 Simulated demand: 3 1 3 5 3 2 1 3 5 3 Tires Interval of DemandedRandom Numbers 001 - 05 106 - 15 216 - 35 336 - 65 466 - 85 586 - 100 1 2 3

39 Simulation Fidelity  © 2006 by Prentice Hall, Inc.  Upper Saddle River, NJ 07458 the accuracy of the representation when compared to the real world. a measure of the realism of a model or simulation Fidelity of the representations; quality and precision of the input data; how closely the results correspond to the intended view of reality (i.e., the referent)

40  © 2006 by Prentice Hall, Inc.  Upper Saddle River, NJ 07458

41 Fidelity Conceptual Framework  Accuracy – The degree to which a parameter or variable within a model or simulation conform exactly to reality or to some chosen standard or referent.  Capacity – The number of instances of an object or detail that are simultaneously represented by simulation.  Error – The difference between an observed, measured, or calculated value and a correct value.  Fitness – Providing the capabilities needed or being suitable for some purpose, function, situation or application.  © 2006 by Prentice Hall, Inc.  Upper Saddle River, NJ 07458

42 Fidelity Conceptual Framework  Precision – 1. The quality or state of being clearly depicted, definite, measured or calculated. 2. A quality associated with the spread of data obtained in repetitions of an experiment as measured by variance; the lower the variance, the higher the precision. 3. A measure of how meticulously or rigorously computational processes are described or performed by a model or simulation.  simulation to respond to a low level stimulus.  42

43 Fidelity Conceptual Framework  Resolution – 1. The degree of detail used to represent aspects of the real world or a specified standard or referent by a model or simulation. 2. Separation or reduction of something into its constituent parts.  Sensitivity – The ability of a simulation to respond to a low level stimulus.  Tolerance – 1. The maximum permissible error or the difference between the maximum and minimum allowable values in the properties of any component, device, model, simulation or system relative to a standard or referent  43


Download ppt "Simulation Modeling & Simulation 33.  Simulation: It is a numerical technique for conducting experiments with certain types of mathematical models."

Similar presentations


Ads by Google