CS433 Modeling and Simulation Lecture 09 – Part 02 Discrete Events Simulation Dr. Anis Koubâa 27 Dec 2008 Al-Imam.

Slides:



Advertisements
Similar presentations
Discrete Event (time) Simulation Kenneth.
Advertisements

Introduction into Simulation Basic Simulation Modeling.
Simulating Single server queuing models. Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits.
Parallel and Distributed Simulation
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Modeling and simulation of systems Slovak University of Technology Faculty of Material Science and Technology in Trnava.
Discrete Event Simulation - Ch. 1 Instructor: Giampiero Pecelli Office Phone: Office: Olsen 225 Office Hours: Before.
FIN 685: Risk Management Topic 5: Simulation Larry Schrenk, Instructor.
Nur Aini Masruroh Queuing Theory. Outlines IntroductionBirth-death processSingle server modelMulti server model.
1 Simulation Lecture 6 Simulation Chapter 18S. 2 Simulation Simulation Is …  Simulation – very broad term  methods and applications to imitate or mimic.
Simulation.
Discrete Event Simulation Event-Oriented Simulations By Syed S. Rizvi.
Parallel and Distributed Simulation Object-Oriented Simulation.
Simulation Waiting Line. 2 Introduction Definition (informal) A model is a simplified description of an entity (an object, a system of objects) such that.
SIMULATION. Simulation Definition of Simulation Simulation Methodology Proposing a New Experiment Considerations When Using Computer Models Types of Simulations.
Descriptive Modelling: Simulation “Simulation is the process of designing a model of a real system and conducting experiments with this model for the purpose.
Robert M. Saltzman © DS 851: 4 Main Components 1.Applications The more you see, the better 2.Probability & Statistics Computer does most of the work.
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Feedback Control Systems (FCS)
Modeling and Simulation
Introduction to Discrete Event Simulation Customer population Service system Served customers Waiting line Priority rule Service facilities Figure C.1.
Chapter 1 Introduction to Simulation
1 Performance Evaluation of Computer Networks: Part II Objectives r Simulation Modeling r Classification of Simulation Modeling r Discrete-Event Simulation.
Introduction to simulation. Overview What is simulation ? When simulation is appropriate tool When simulation is not appropriate Advantages of simulation.
Modeling & Simulation: An Introduction Some slides in this presentation have been copyrighted to Dr. Amr Elmougy.
1 OM2, Supplementary Ch. D Simulation ©2010 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible.
Computer Science 101 Modeling and Simulation. Scientific Method Observe behavior of a system and formulate an hypothesis to explain it Design and carry.
1 Definition of System Simulation: The practice of building models to represent existing real-world systems, or hypothetical future systems, and of experimenting.
Modeling and simulation of systems Model building Slovak University of Technology Faculty of Material Science and Technology in Trnava.
SUPERCOMPUTING CHALLENGE KICKOFF 2015 A Model for Computational Science Investigations Oct 2015 © challenge.org Supercomputing Around.
Simulation is the process of studying the behavior of a real system by using a model that replicates the behavior of the system under different scenarios.
Modeling and Simulation Discrete-Event Simulation
Parallel and Distributed Simulation Process Oriented Simulation.
Discrete Event (time) Simulation. What is a simulation? “Simulation is the process of designing a model of a real system and conducting experiments with.
Chapter 10 Verification and Validation of Simulation Models
Fall 2011 CSC 446/546 Part 1: Introduction to Simulation.
1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Dr. Anis Koubâa CS433 Modeling and Simulation
(C) J. M. Garrido1 Objects in a Simulation Model There are several objects in a simulation model The activate objects are instances of the classes that.
CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation ---- Discrete Event Simulation (DES) TexPoint fonts used in EMF.
Parallel and Distributed Simulation Process Oriented Simulation.
Csci 418/618 Simulation Models Dr. Ken Nygard, IACC 262B
ENM 307 Simulation Department of Industrial Engineering Anadolu University SPRING 2016 Chapter 1 Basic Simulation Modeling Onur Kaya END 201, Ext: 6439.
 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,
Modeling & Simulation of Dynamic Systems (MSDS)
1 CS 214 Modeling and Simulation Modeling. TERMINOLOGY lSystem –A group of objects that are joined together in some regular interaction or interdependence.
Introduction The objective of simulation – Analysis the system (Model) Analytically the model – a description of some system intended to predict the behavior.
Clock Synchronization (Time Management) Deadlock Avoidance Using Null Messages.
CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation ---- Discrete Event Simulation (DES) TexPoint fonts used in EMF.
Simulation Modeling & Simulation 33.  Simulation: It is a numerical technique for conducting experiments with certain types of mathematical models.
Chapter 1 What is Simulation?. Fall 2001 IMSE643 Industrial Simulation What’s Simulation? Simulation – A broad collection of methods and applications.
Introduction To Modeling and Simulation 1. A simulation: A simulation is the imitation of the operation of real-world process or system over time. A Representation.
Modelling & Simulation of Semiconductor Devices Lecture 1 & 2 Introduction to Modelling & Simulation.
Introduction to Simulation What is a simulation? A system that represents or emulates the behavior of another system over time; a computer simulation is.
Traffic Simulation L2 – Introduction to simulation Ing. Ondřej Přibyl, Ph.D.
PDES Introduction The Time Warp Mechanism
OPERATING SYSTEMS CS 3502 Fall 2017
Parallel and Distributed Simulation
Modeling and Simulation (An Introduction)
ADVANTAGES OF SIMULATION
Chapter 1.
Simulation Department of Industrial Engineering Anadolu University
Chapter 10 Verification and Validation of Simulation Models
Professor S K Dubey,VSM Amity School of Business
Parallel and Distributed Simulation
Discrete-Event System Simulation
Discrete Event Simulation - Ch. 1
MECH 3550 : Simulation & Visualization
MECH 3550 : Simulation & Visualization
Presentation transcript:

CS433 Modeling and Simulation Lecture 09 – Part 02 Discrete Events Simulation Dr. Anis Koubâa 27 Dec 2008 Al-Imam Mohammad Ibn Saud University

 Basic Concepts of Simulation  Why using simulations?  Advantages and drawback of simulations  Types of simulations  Steps in a simulation study  Discrete Event Simulation (DES) Outline

 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 (Naylor 1971)  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.  Example: A manufacturing firm that is thinking to build a large extension onto one of its plants.  Question: Will the potential gain in productivity justify the construction cost?  Problem: It would not be cost effective to build the extension and then remove it later if it does not work out.  Solution: Simulation! Basic Concepts

 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.  Simulation can be used to experiment with new designs or policies prior to implementation (what if scenarios).  Experiments can be very expensive, dangerous …  The modern system is so complex that the interactions can be treated only through simulation. When and Why to use Simulations?

 when the problem can be solved using common sense  when the problem can be solved analytically  when it is easier to perform direct experiments  when the costs exceed the savings  when the resources or time are not available  when the ability to verify and validate the model is very limited  when the system behavior is too complex or cannot be defined When Simulation Cannot be Used?

Application Areas of Simulation

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.  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).

Types of Simulation  Static vs. Dynamic  Does time have a role in the model?  Continuous-change vs. Discrete-change  Can the “state” change continuously or only at discrete points in time?  Deterministic vs. Stochastic  Is everything for sure or is there uncertainty?  Most operational models  Dynamic, Discrete-change, Stochastic

Types of Simulation

Concepts in Discrete Event Simulation

Steps of a Simulation Study

Steps in Simulation Study 1- Problem formulation: Every study should begin with a statement of the problem 2- Setting of objectives and overall project plan: The objectives indicate the questions to be answered by simulation. 3- Model conceptualization: The construction of a model of a system is probably as much art as science 4- Data collection: There is a constant interplay between the construction of the model and the collection of the needed input data [Shannon, 1975]. As the complexity of the model changes, the required data elements may also change

Steps in Simulation Study 5- Model translation: the model must be entered into a computer-recognizable format. 6- Verification: Is the computer program performing properly? 7- Validation: Does the simulation model replicate this system measure? 8- Experimental design: The alternatives that are to be simulated must be determined 9- Production runs and analysis: Production runs, and their subsequent analysis, are used to estimate measures of performance for the system designs that are being simulated.

10- More runs? determines if additional runs are needed and what design those additional experiments should follow. 11- Documentation and Reporting. 12- Implementation. Steps in Simulation Study

Discrete-Event Simulation

Outline  Time-stepped implementation: critique  Discrete event fundamentals  Simulation engine  Example: Airport Simulation  Discrete event simulation critique

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

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

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

Simulation Application state variables code modeling system behavior I/O and user interface software Simulation Engine event list management managing advances in simulation time calls to schedule events calls to event handlers Discrete Event Simulation System Model of the physical system Independent of the simulation application

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

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 Event: InTheAir := InTheAir+1; Schedule Arrival Now + RandExp(A); If (RunwayFree) { RunwayFree:=FALSE; Schedule Landed 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.

Landed Event Landed Event: InTheAir:=InTheAir-1; OnTheGround:=OnTheGround+1; Schedule Departure Now + RandExp(G); If (InTheAir>0) Schedule Landed 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.

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

Execution Example OnTheGround Simulation Time State Variables RunwayFree InTheAir 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

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

Discrete Event Simulation  Avoids problems of time stepped execution  Error when events lie between time steps  Time steps with no events  But…  Priority queue (pending event list) introduces some new computational overhead  What about events with the same time stamp? More important than one might initially think!

Summary  Methodology  Important to have a reasonably clear conceptual and specification model before moving to implementation (computational model)  Key concepts: state variables and changes in state  Simulation engine: largely independent of application  Simulation model: state variables and code to modify state  Time stepped vs. event driven execution  In principle, either can be used to model system  Discrete-event simulation approach more commonly used to model queuing systems