Introduction to Simulation What is a simulation? A system that represents or emulates the behavior of another system over time; a computer simulation is.

Slides:



Advertisements
Similar presentations
Parallel and Distributed Simulation
Advertisements

Lookahead. Outline Null message algorithm: The Time Creep Problem Lookahead –What is it and why is it important? –Writing simulations to maximize lookahead.
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
 1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach.
Event-drive SimulationCS-2303, C-Term Project #3 – Event-driven Simulation CS-2303 System Programming Concepts (Slides include materials from The.
Simulation. Example: A Bank Simulator We are given: –The number of tellers –The arrival time of each customer –The amount of time each customer requires.
Classification of Simulation Models
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 2.
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.
Chapter 1 Program Design
CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT Class Location:
Parallel and Distributed Simulation Introduction and Motivation By Syed S. Rizvi.
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Fundamentals of Python: From First Programs Through Data Structures
Software design and development Marcus Hunt. Application and limits of procedural programming Procedural programming is a powerful language, typically.
Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:
Discrete Event Systems Simulation
Execution Control with If/Else and Boolean Functions
1 Performance Evaluation of Computer Networks: Part II Objectives r Simulation Modeling r Classification of Simulation Modeling r Discrete-Event Simulation.
Your Logo 1 TREATMENT OF TIME IN A FLIGHT SIMULATOR In a real-time simulator, the most important resource to manage is time itself. A flight simulator.
Parallel and Distributed Simulation Hardware Platforms Simulation Fundamentals.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Parallel and Distributed Simulation Introduction and Motivation.
1 Extend is a simulation tool to create models quickly, with all the blocks you need and without even having to type an equation. You can use a series.
Parallel and Distributed Simulation Introduction and Motivation.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
Parallel and Distributed Simulation Process Oriented Simulation.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Simulation & Confidence Intervals COMP5416 Advanced Network Technologies.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Introduction to discrete event systems
Dr. Anis Koubâa CS433 Modeling and Simulation
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation ---- Discrete Event Simulation (DES) TexPoint fonts used in EMF.
COMP155 Computer Simulation September 10, Discrete Event Simulation  discrete event simulation: state variable change only at a discrete set of.
CS433 Modeling and Simulation Lecture 09 – Part 02 Discrete Events Simulation Dr. Anis Koubâa 27 Dec 2008 Al-Imam.
Parallel and Distributed Simulation Process Oriented Simulation.
1 CS 214 Modeling and Simulation Modeling. TERMINOLOGY lSystem –A group of objects that are joined together in some regular interaction or interdependence.
Clock Synchronization (Time Management) Deadlock Avoidance Using Null Messages.
Simulation Examples And General Principles Part 2
CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation ---- Discrete Event Simulation (DES) TexPoint fonts used in EMF.
Discrete-Event System Simulation in Java. Discrete Event Systems New dynamic systems New dynamic systems Computer and communication networks Computer.
Simulation Modeling & Simulation 33.  Simulation: It is a numerical technique for conducting experiments with certain types of mathematical models.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
WORKING OF SCHEDULER IN OS
PDES Introduction The Time Warp Mechanism
OPERATING SYSTEMS CS 3502 Fall 2017
Parallel and Distributed Simulation
Modeling and Simulation (An Introduction)
OPERATING SYSTEMS CS3502 Fall 2017
ADVANTAGES OF SIMULATION
Discrete Event Simulation
TexPoint fonts used in EMF.
Introduction to the C Language
Parallel and Distributed Simulation
Operating Systems Chapter 5: Input/Output Management
Modeling and Simulation: Fundamentals and Implementation
Coding Concepts (Basics)
Concepts In Discrete-Event Simulation
Discrete Event “Hand” Simulation of a GI/GI/1 Queue
Performance evaluation of manufacturing systems
Chapter 4: Simulation Designs
Variables and Constants
Presentation transcript:

Introduction to Simulation What is a simulation? A system that represents or emulates the behavior of another system over time; a computer simulation is one where the system doing the emulating is a computer program

System Analysis “Classical” application of simulation; here, focus on “discrete event” simulation Telecommunication networks Transportation systems Electronic systems (e.g., microelectronics, computer systems) Battlefield simulations (blue army vs. red army) Ecological systems Manufacturing systems Logistics Focus typically on planning, system design

Simulation Fundamentals A computer simulation is a computer program that models the behavior of a physical system over time. Program variables (state variables) represent the current state of the physical system Simulation program modifies state variables to model the evolution of the physical system over time.

Time physical time: time in the physical system –Noon, December 31, 1999 to noon January 1, 2000 simulation time: representation of physical time within the simulation –floating point values in interval [0.0, 24.0] wallclock time: time during the execution of the simulation, usually output from a hardware clock –9:00 to 9:15 AM on September 10, 1999 physical system physical system: the actual or imagined system being modeled simulation: a system that emulates the behavior of a physical system simulation main() {... double clock;... }

Simulation Time Simulation time is defined as a totally ordered set of values where each value represents an instant of time in the physical system being modeled. For any two values of simulation time T 1 representing instant P 1, and T 2 representing P 2 : Correct ordering of time instants –If T 1 < T 2, then P 1 occurs before P 2 –9.0 represents 9 PM, 10.5 represents 10:30 PM Correct representation of time durations –T 2 - T 1 = k (P 2 - P 1 ) for some constant k –1.0 in simulation time represents 1 hour of physical time

Simulation Taxonomy Continuous time simulation –State changes occur continuously across time –Typically, behavior described by differential equations Discrete time simulation –State changes only occur at discrete time instants –Time stepped: time advances by fixed time increments –Event stepped: time advances occur with irregular increments computer simulation discrete models continuous models event driven time- stepped

Time Stepped vs. Event Stepped Goal: compute state of system over simulation time state variables simulation time event driven execution

Time Stepped Execution While (simulation not completed) { Wait Until (W2S(wallclock time) ≥ current simulation time) Compute state of simulation at end of this time step Advance simulation time to next time step }

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) 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 Unprocessed events are stored in a pending event list Events are processed in time stamp order 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 Executive 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

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 executive 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 queueing Single runway for incoming aircraft, ignore departure queueing R = time runway is used for each landing aircraft (constant) G = time required on the ground before departing (constant) State: 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; If (RunwayFree) RunwayFree:=FALSE; Schedule Landed Now + R; R = time runway is used for each landing aircraft G = 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 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 + G; If (InTheAir>0) Schedule Landed Now + R; Else RunwayFree := TRUE; R = time runway is used for each landing aircraft G = 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 An aircraft has completed its landing.

Departure Event Departure Event: OnTheGround := OnTheGround - 1; R = time runway is used for each landing aircraft G = 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 An aircraft now on the ground departs for a new destination.

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

Summary DES computation: sequence of event computations –Modify state variables –Schedule new events DES System = model + simulation executive Data structures –Pending event list to hold unprocessed events –State variables –Simulation time clock variable Program (Code) –Main event processing loop –Event procedures –Events processed in time stamp order