Simulation & Modeling Event-Oriented Simulations

Similar documents
CDA6530: Performance Models of Computers and Networks. Chapter 8: Discrete Event Simulation (DES)

1.225 Transportation Flow Systems Quiz (December 17, 2001; Duration: 3 hours)

Discrete-event simulations

EE 368. Weeks 3 (Notes)

Session-Based Queueing Systems

Design of discrete-event simulations

Introduction to Queueing Theory with Applications to Air Transportation Systems

Course Documents Authorized Duration: 120 minutes. Exercise 1. Monte Carlo Simulation and Confidence Interval (5 points)

Modeling Fundamentals: Concepts of Models and Systems Concepts of Modeling Classifications of Models

Performance Evaluation of Queuing Systems

Slides 9: Queuing Models

ISE/OR 762 Stochastic Simulation Techniques

Chapter 2 SIMULATION BASICS. 1. Chapter Overview. 2. Introduction

Queueing Theory I Summary! Little s Law! Queueing System Notation! Stationary Analysis of Elementary Queueing Systems " M/M/1 " M/M/m " M/M/1/K "

MULTIPLE CHOICE QUESTIONS DECISION SCIENCE

The University of British Columbia Computer Science 405 Practice Midterm Solutions

Queuing Theory. The present section focuses on the standard vocabulary of Waiting Line Models.

Chapter 6 Queueing Models. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation

Ways to study a system System

5/15/18. Operations Research: An Introduction Hamdy A. Taha. Copyright 2011, 2007 by Pearson Education, Inc. All rights reserved.

Stochastic Simulation of Communication i Networks

Verification and Validation. CS1538: Introduction to Simulations

The effect of probabilities of departure with time in a bank

Sandwich shop : a queuing net work with finite disposable resources queue and infinite resources queue

Stochastic Simulation of Communication Networks and their Protocols

Queueing Systems: Lecture 3. Amedeo R. Odoni October 18, Announcements

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Queueing Theory and Simulation. Introduction

Computer Science, Informatik 4 Communication and Distributed Systems. Simulation. Discrete-Event System Simulation. Dr.

Queuing Networks: Burke s Theorem, Kleinrock s Approximation, and Jackson s Theorem. Wade Trappe

Simulation. Where real stuff starts

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

Concurrent Models of Computation

The Queue Inference Engine and the Psychology of Queueing. ESD.86 Spring 2007 Richard C. Larson

Clock-driven scheduling

1.225J J (ESD 205) Transportation Flow Systems

IOE 202: lectures 11 and 12 outline

7. Queueing Systems. 8. Petri nets vs. State Automata

Distributed Systems Fundamentals

On the Partitioning of Servers in Queueing Systems during Rush Hour

CS 798: Homework Assignment 3 (Queueing Theory)

Chapter 10. Queuing Systems. D (Queuing Theory) Queuing theory is the branch of operations research concerned with waiting lines.

Course Outline Introduction to Transportation Highway Users and their Performance Geometric Design Pavement Design

Queuing Analysis. Chapter Copyright 2010 Pearson Education, Inc. Publishing as Prentice Hall

EP2200 Course Project 2017 Project II - Mobile Computation Offloading

Introduction to Queueing Theory

Chapter 2 Queueing Theory and Simulation

Cumulative Count Curve and Queueing Analysis

Simulation. Where real stuff starts

CS 700: Quantitative Methods & Experimental Design in Computer Science

Module 5: CPU Scheduling

On the Partitioning of Servers in Queueing Systems during Rush Hour

QUEUING SYSTEM. Yetunde Folajimi, PhD

Last class: Today: Threads. CPU Scheduling

Since D has an exponential distribution, E[D] = 0.09 years. Since {A(t) : t 0} is a Poisson process with rate λ = 10, 000, A(0.

Systems Simulation Chapter 6: Queuing Models

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

PBW 654 Applied Statistics - I Urban Operations Research

A FAST MATRIX-ANALYTIC APPROXIMATION FOR THE TWO CLASS GI/G/1 NON-PREEMPTIVE PRIORITY QUEUE

Dynamic Call Center Routing Policies Using Call Waiting and Agent Idle Times Online Supplement

Simulation Modeling. Random Numbers

IEOR 4106: Spring Solutions to Homework Assignment 7: Due on Tuesday, March 22.

The STATEMATE Semantics of Statecharts. Presentation by: John Finn October 5, by David Harel

GI/M/1 and GI/M/m queuing systems

Networking = Plumbing. Queueing Analysis: I. Last Lecture. Lecture Outline. Jeremiah Deng. 29 July 2013

Queuing Theory. Using the Math. Management Science

Operations Research II, IEOR161 University of California, Berkeley Spring 2007 Final Exam. Name: Student ID:

NICTA Short Course. Network Analysis. Vijay Sivaraman. Day 1 Queueing Systems and Markov Chains. Network Analysis, 2008s2 1-1

Queueing Theory II. Summary. ! M/M/1 Output process. ! Networks of Queue! Method of Stages. ! General Distributions

EE 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Fall 2016

Online Supplement to Delay-Based Service Differentiation with Many Servers and Time-Varying Arrival Rates

Introduction to Queuing Theory. Mathematical Modelling

SOLUTIONS IEOR 3106: Second Midterm Exam, Chapters 5-6, November 8, 2012

Homework 1 - SOLUTION

Inequality Comparisons and Traffic Smoothing in Multi-Stage ATM Multiplexers

Figure 10.1: Recording when the event E occurs

Environment (E) IBP IBP IBP 2 N 2 N. server. System (S) Adapter (A) ACV

Queues and Queueing Networks

How to deal with uncertainties and dynamicity?

Computer Networks More general queuing systems

Andrew Morton University of Waterloo Canada

Part I Stochastic variables and Markov chains

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

NATCOR: Stochastic Modelling

Lecture 7: Simulation of Markov Processes. Pasi Lassila Department of Communications and Networking

L. Lakatos, S. V. Serebriakova

Introduction to Modelling and Simulation

Chapter 2. Poisson Processes. Prof. Shun-Ren Yang Department of Computer Science, National Tsing Hua University, Taiwan

Chapter 7 (Cont d) PERT

Synchronous Reactive Systems

Probability and Statistics Concepts

CHAPTER 3 STOCHASTIC MODEL OF A GENERAL FEED BACK QUEUE NETWORK

Dynamic Call Center Routing Policies Using Call Waiting and Agent Idle Times Online Supplement

Agreement. Today. l Coordination and agreement in group communication. l Consensus

Introduction to queuing theory

Advanced Computer Networks Lecture 3. Models of Queuing

Simulation of Process Scheduling Algorithms

Queueing Review. Christos Alexopoulos and Dave Goldsman 10/6/16. (mostly from BCNN) Georgia Institute of Technology, Atlanta, GA, USA

Discrete Event Simulation

Queuing Networks. - Outline of queuing networks. - Mean Value Analisys (MVA) for open and closed queuing networks

Transcription:

Simulation & Modeling Event-Oriented Simulations

Outline Simulation modeling characteristics Concept of Time A DES Simulation (Computation) DES System = model + simulation execution Data Structures Program (Code) 2

Basic concepts Simulation modeling characteristics The Concept of Time Static or dynamic models Stochastic, deterministic or chaotic models Discrete or continuous change/models Aggregates or Individuals 3

Stochastic Deterministic Monte Carlo simulations Continuous Time Discrete Time Static Dynamic 4

Monte Carlo Methods Generate Inputs randomly from a probability distribution Perform a deterministic computation on the input (repeat this step). Aggregate result (run multiple times with a different sample on the input) to approximate the real value. http://en.wikipedia.org/wiki/monte_carlo_method 5

Static or dynamic models Dynamic:» State variables change over time» System Dynamics, Discrete Event, Agent-Based Static:» Snapshot(s) at a single point in time» Monte Carlo simulation (large number of input samples, compute & aggregate results, time doesn t change), optimization models 6

Deterministic, Stochastic or Chaotic Deterministic:» Predictive behavior. The system is perfectly understood, then it is possible to predict precisely what will happen.» Repeatable Stochastic:» behavior cannot be entirely predicted. Chaotic:» deterministic model with a behavior that cannot be entirely predicted. Depends so sensitively on the system s initial conditions so that in effect it cannot be predicted. 7

Discrete or Continuous models Discrete model:» state variables change only at a countable number of points in time.» These points in time are the ones at which the event occurs/change in state. Continuous model:» the state variables change in a continuous way, and not abruptly from one state to another.» infinite number of states. 8

State variables State variables Time Continuous: State variables change continuously as a function of time State variables = f( t ) Time Discrete: State variables change at discrete times 9

One or more random parameters Fixed inputs yield different outputs Stochastic Deterministic Monte Carlo simulations Continuous Time Discrete Time Model allows system state to change at any time Fixed inputs yield fixed outputs Static Dynamic System state changes at distinct times System description at one point in time System description as it changes in time 10

Simulation inputs (t) Actual System outputs (t) Parameters =? Simulated System outputs (t) Simulated system imitates operations of actual system over time Artificial history of system can be generated and observed Internal (perhaps unobservable) behavior of system can be studied Time scale can be altered as needed Conclusion about actual system characteristics can be inferred 11

What is a simulation model? inputs (t) outputs (t) Actual System Parameters System Environment inputs (t) outputs (t) Model (simplified) Parameters Model Environment An abstraction of a real system Simplified assumptions are used to capture (only) important behaviors 12

System s Modeling System Interactive objects System Environment Placing the system boundary is the first difficult task in modeling 13

System s Modeling System Environment System Sun Moon Pluto Earth? Asteroids? Placing the system boundary is the first difficult task in modeling 14

Entities, Attributes and Activities... An entity is an object of interest in the system» Example: Customer Manager Cashier An attribute is a (relevant) property of an entity» Example: Account balance Gender Skills Attributes are state variables 15

Activities & Delays An activity is a duration of a known (expected) length» Example: drink coffee, serve customers» Activities form part of the model specification» Inter-arrival time, service time» Deterministic or stochastic (probabilistic) A delay» waiting time in queue is a duration of unknown length Delays form part of the simulation results» Example: waiting time in queue» Delays form part of the simulation results event delay event activity Arrive wait in queue Begin Service receive service Depart 16

State and State Variables The (system) state» complete» minimal» contains sufficient information to describe the system at any point in time. A state variable» Describes a portion of the state.» Length of a queue, activity of a manager (sleeping, drinking coffee) 17

Events Event:» Occurrence» Instantaneous» May change the state Example single server queue:» Arrival -- while the server is busy, so queue length is incremented by 1;» Departure -- the completion of service 18

Conditional and Primary Events Primary Events» Scheduled at a certain time» Arrival of customers Conditional Events» triggered by a certain condition becoming TRUE -- a completion of a delay» Customers moving from queue to service 19

How to create a DES? DES Modeling raises the following questions?» How does each event affect system state and attributes?» How are activities defined? What events mark beginning and the end? What condition (if any) most hold?» How are delays defined?» How is the simulation initialized? 20

A Simulation classic Single-server Queue at a bank One possible problem formulation:» customer have to wait too long in my bank Objective:» Determine the effect of an additional cashier Data needed:» inter-arrival time of customers» Service times 21

Simulation Results Queue Length Time 22

Movie Moving Image Series of still images, sufficient to convey recognizable motion 23

System Snapshots System Simulation Series of system snapshot» system state» activities in progress» end time 24

System Snapshots Moving Image System Simulation 25

Time Physical system: actual or imagined system being modeled Simulation: a system that emulates the behavior of a physical system main() {... double clock;... } physical system simulation 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 26

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 27

Modes of Execution As-fast-as-possible execution (unpaced): no fixed relationship necessarily exists between advances in simulation time and advances in wallclock time Real-time execution (paced): each advance in simulation time is paced to occur in synchrony with an equivalent advance in wallclock time Scaled real-time execution (paced): each advance in simulation time is paced to occur in synchrony with S * an equivalent advance in wallclock time (e.g., 2 x wallclock time) Converting from wallclock to Simulation Time: Simulation Time = W2S(W) = T 0 + S * (W - W 0 ) W = wallclock time; S = scale factor W 0 (T 0 ) = wallclock (simulation) time at start of simulation (assume simulation and wallclock time use same time units) 28

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 29

Discrete Event Simulation Computation example: air traffic at an airport events: aircraft arrival, landing, departure arrival schedules 8:00 departure landed schedules 9:15 8:05 arrival 9:30 processed event current event unprocessed event Unprocessed events are stored in a pending event list Events are processed in time stamp order 30

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

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

Example: Air traffic at an Airport Model aircraft arrivals and departures, arrival queuing Single runway for incoming aircraft, ignore departure queuing 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 33

Arrival Events New aircraft arrives at airport. If the runway is free, it will begin to land. Otherwise, the aircraft must circle, and wait to land. 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 Arrival Event: InTheAir := InTheAir+1; if( RunwayFree ) RunwayFree:=FALSE; Schedule Landed event @ Now + R; 34

Landed Event An aircraft has completed its landing. 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 Landed Event: InTheAir := InTheAir-1; OnTheGround := OnTheGround + 1; Schedule Departure event @ Now + G; if( InTheAir > 0 ) Schedule Landed event @ Now + R; else RunwayFree := True; 35

Departure Event An aircraft on the ground departs for a new destination. 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 Departure Event: OnTheGround := OnTheGround - 1; 36

Execution Example State Variables R=3 G=4 InTheAir 0 1 2 1 0 OnTheGround 0 1 2 1 0 RunwayFree true false true Processing: Time Event 1 Arrival F1 3 Arrival F2 Time 0 1 2 3 4 5 6 7 8 9 10 11 Simulation Time Arrival F1 Event 3 Arrival F2 4 Land F1 Arrival F2 Time Event 4 Land F1 7 Land F2 Time Land F1 Event 7 Land F2 8 Depart F1 Time Land F2 Event 8 Depart F1 11 Depart F2 Depart F1 Time Event 11 Depart F2 Depart F2 Time Event Now=0 Now=1 Now=3 Now=4 Now=7 Now=8 Now=11

Summary Time» Important to distinguish among simulation time, wallclock time, and time in the physical system» Paced execution (e.g., immersive virtual environments) vs. unpaced execution (e.g., simulations to analyze systems) 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 38