180 likes | 334 Views
ADVANTAGES OF SIMULATION. Most complex, real-world systems with stochastic elements cannot be accurately described by a mathematical model that can be evaluated analytically. Thus, a simulation is often the only type of investigation possible.
E N D
ADVANTAGES OF SIMULATION • Most complex, real-world systems with stochastic elements cannot be accurately described by a mathematical model that can be evaluated analytically. Thus, a simulation is often the only type of investigation possible. • Simulation allows one to estimate the performance of an existing system under some projected set of operating conditions. • Alternative proposed system designs (or alternative operating policies for a single system) can be compared via simulation to see which best meets a specified requirement. • In a simulation we can maintain much better control over experimental conditions than would generally be possible when experimenting with the system itself. • Simulation allows us to study a system with a long time frame---e.g., an economic system---in compressed time, or alternatively to study the detailed workings of a system in expanded time.
DISADVANTAGES OF SIMULATION • Each run of a stochastic simulation model produces only estimates of a model’s true characteristics for a particular set of input parameters. If a “valid” analytic model is available or can be easily de developed, it will generally be preferable to a simulation model. • Simulation models are often expensive and time-consuming to develop. • If a model is not a “valid” representation of a system under study, the simulation results, no matter how impressive they appear, will provide little useful information about the actual system.
DISADVANTAGES OF SIMULATION • Each simulation model is unique • In some studies both simulation and analytic models might be useful. In particular, simulation can be used to check the validity of assumptions needed in an analytic model. On the other hand, an analytic model can suggest reasonable alternatives to investigate in a simulation study.
Pitfalls to the successful completion of a simulation study • Failure to have a well-defined set of objectives at the beginning of the simulation study • Inappropriatelevelofmodeldetail • Failure to communicate with management throughout the course of the simulation study • Misunderstandingofsimulation by management • Treating a simulation study as if it were primarily an exercise in computer programming • Failure to have people with a knowledge of simulation methodology and statistics on the modeling team • Failure to collect good system data • Inappropriatesimulation software • Obliviously using simulation software products whose complex marco statement may not be well documented and may not implement the desired modeling logic
Pitfalls to the successful completion of a simulation study • Belief that easy-to-use simulation packages, which require little or no programming, require a significantly lower level of technical competence • Misuseofanimation • Failure to account correctly for sources of randomness in the actual system • Using arbitrary distributions (e.g., normal, uniform, or triangular) as input to the simulation • Analyzing the output data from one simulation run (replication) using formulas that assume independence • Making a single replication of a particular system design and treating the output statistics as the “true answers” • Comparing alternative system design on the basis of one replication for each design • Usingthewrongperformancemeasures
State Variables queue customer server State: • InTheAir: number of aircraft either landing or waiting to land • OnTheGround: number of landed aircraft • RunwayFree: Boolean, true if runway available
Time Step Implementation /* ignore aircraft departures */ Float InTheAir: # aircraft landing or waiting to land Float OnTheGround: # landed aircraft Boolean RunwayFree: True if runway available Float NextArrivalTime: Time the next aircraft arrives Float NextLanding: Time next aircraft lands (if one is landing) For (Now = 1 to EndTime) { /* time step size is 1.0 */ if (Now >= NextArrivalTime) { /* if aircraft just arrived */ InTheAir := InTheAir + 1; NextArrivalTime := NextArrivalTime + RandExp(A); if (RunwayFree) { RunwayFree := False; NextLanding := Now + RandExp(L); } } if (Now >= NextLanding) { /* if aircraft just landed */ InTheAir := InTheAir - 1; OnTheGround := OnTheGround + 1; if (InTheAir > 0) NextLanding := Now + RandExp(L) else {RunWayFree := True; NextLanding := EndTime+1;} } }
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
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
processed event current event unprocessed event Discrete Event Simulation Computation • Example: air traffic at an airport • Events: aircraft arrival, landing, departure arrival 8:00 schedules departure 9:15 arrival 9:30 landed 8:05 schedules simulation time 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?
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)
Event handler procedures state variables Arrival Event { … } Landed Event { … } Departure Event { … } Integer: InTheAir; Integer: OnTheGround; Boolean: RunwayFree; Simulation Application 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 Now = 8:45 Pending Event List (PEL) 9:00 10:10 9:16 Event-Oriented World View
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
Arrival Events • 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. 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 Event: InTheAir := InTheAir+1; Schedule Arrival event @ Now + RandExp(A); If (RunwayFree) { RunwayFree:=FALSE; Schedule Landed event @ Now + RandExp(L); }
Landed Event Landing Process: An aircraft has completed its landing. 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 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;
Departure Event 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 Departure Event: OnTheGround := OnTheGround - 1;
State Variables L=3 G=4 InTheAir 0 1 1 0 2 1 0 OnTheGround 0 1 2 RunwayFree true false true 0 1 2 3 4 5 6 7 8 9 10 11 Simulation Time Processing: Arrival F1 Arrival F2 Landed F1 Landed F2 Depart F1 Depart F2 Time Event Time Event Time Event Time Event Time Event Time Event Time Event 1 Arrival F1 3 Arrival F2 3 Arrival F2 4 Landed F1 4 Landed F1 7 Landed F2 8 Depart F1 8 Depart F1 11 Depart F2 11 Depart F2 Now=0 Now=1 Now=3 Now=4 Now=7 Now=8 Now=11 Execution Example