DISCRETE-EVENT SIMULATION CONCEPTS and EVENT SCHEDULING ALGORITHM

Slides:



Advertisements
Similar presentations
Introduction into Simulation Basic Simulation Modeling.
Advertisements

Chapter 3 General Principles
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Queueing Models and Ergodicity. 2 Purpose Simulation is often used in the analysis of queueing models. A simple but typical queueing model: Queueing models.
 1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach.
Agenda Main concepts in discrete-event simulation
Lecture 3 Concepts of Discrete-Event Simulation. 2 Discrete Event Model  In the discrete approach to system simulation, state changes in the physical.
Chapter 3 Simulation Software
Classification of Simulation Models
#11 QUEUEING THEORY Systems Fall 2000 Instructor: Peter M. Hahn
Discrete-Event Simulation: A First Course Steve Park and Larry Leemis College of William and Mary.
Components and Organization of Discrete-event Simulation Model
Simscript II.5 Building simulation model with SIMSCRIPT II.5.
Simulation with ArenaChapter 2 – Fundamental Simulation Concepts Discrete Event “Hand” Simulation of a GI/GI/1 Queue.
SIMULATION EXAMPLES. SELECTED SIMULATION EXAMPLES 4 Queuing systems (Dynamic System) 4 Inventory systems (Dynamic and Static) 4 Monte-Carlo 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.
Queueing Models: Data Collection and Hand Simulation from Prof. Goldsman’s lecture notes.
CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT Class Location:
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Basic Simulation Modeling II
 1  Outline  simulating GI/G/1 queues  M/M/1 queues  theoretical results of queueing systems  an inventory system  simulation program with an event.
Graduate Program in Engineering and Technology Management
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:
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
Simulation Examples ~ By Hand ~ Using Excel
1 Performance Evaluation of Computer Networks: Part II Objectives r Simulation Modeling r Classification of Simulation Modeling r Discrete-Event Simulation.
 1  Outline  world view of simulation  overview of ARENA  simple ARENA model: Model  basic operations: Model
General Simulation Principles
ETM 607 – Discrete Event Simulation Fundamentals Define Discrete Event Simulation. Define concepts (entities, attributes, event list, etc…) Define “world-view”,
Chapter 3 System Performance and Models. 2 Systems and Models The concept of modeling in the study of the dynamic behavior of simple system is be able.
Chapter 3 General Principles Banks, Carson, Nelson & Nicol Discrete-Event System Simulation.
Entities and Objects The major components in a model are entities, entity types are implemented as Java classes The active entities have a life of their.
Data Structures Using C++ 2E Chapter 8 Queues. Data Structures Using C++ 2E2 Objectives Learn about queues Examine various queue operations Learn how.
+ Simulation Design. + Types event-advance and unit-time advance. Both these designs are event-based but utilize different ways of advancing the time.
Dept. Computer Science, Tianjin Uni. 系统仿真 System Simulation 2008.
Chapter 2 – Fundamental Simulation ConceptsSlide 1 of 46 Chapter 2 Fundamental Simulation Concepts.
Slide 1 of 46 Fundamental Simulation Concepts Chapter 2.
SIMULATION EXAMPLES QUEUEING SYSTEMS.
SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM
Simulation Examples and General Principles
NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly.
1 Simulation Implementation Using high-level languages.
Chapter 2 Fundamental Simulation Concepts
Chapter 3 System Performance and Models Introduction A system is the part of the real world under study. Composed of a set of entities interacting.
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
Simulation of Operations The Discrete Event Approach to Computer Modelling.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Network Protocol Simulation: A look at Discrete Event Simulation Grant D. Lanterman 5/21/2004.
Simulation Chapter 16 of Quantitative Methods for Business, by Anderson, Sweeney and Williams Read sections 16.1, 16.2, 16.3, 16.4, and Appendix 16.1.
Network Performance modelling 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.
SIMULATION EXAMPLES. Monte-Carlo (Static) Simulation Estimating profit on a sale promotion Estimating profit on a sale promotion Estimating profit on.
Chapter 2 Basic Simulation Modeling
 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,
Chapter 3 General Principles Banks, Carson, Nelson & Nicol Discrete-Event System Simulation.
Unit 4 Simulation software. Introduction Software used to develop simulation models can be divided into 3 categories: – General-purpose programming languages:
MODELING AND SIMULATION CS 313 Simulation Examples 1.
Simulation Examples And General Principles Part 2
Discrete-Event System Simulation in Java. Discrete Event Systems New dynamic systems New dynamic systems Computer and communication networks Computer.
Modeling and Simulation
Chapter 1 What is Simulation?. Fall 2001 IMSE643 Industrial Simulation What’s Simulation? Simulation – A broad collection of methods and applications.
OPERATING SYSTEMS CS 3502 Fall 2017
Prepared by Lloyd R. Jaisingh
Modeling and Simulation (An Introduction)
Discrete Event Simulation
Modeling and Simulation CS 313
More Explanation of an example in chapter4
Concepts In Discrete-Event Simulation
Discrete Event “Hand” Simulation of a GI/GI/1 Queue
MECH 3550 : Simulation & Visualization
Presentation transcript:

DISCRETE-EVENT SIMULATION CONCEPTS and EVENT SCHEDULING ALGORITHM

Discrete Event Simulation Is concerned with modelling of a system as it evolves over time by a representation in which the system variables change at discrete points on time Characteristics: the passage of time is a part of simulation (Dynamic) usually contains random elements (Stochastic)

Discrete-Event Simulation Concepts System: A collection of entities (e.g. people and machines) that interact together over time to accomplish one or more goals Model: An abstract representation of a system, usually containing structural, logical, or mathematical relationships that describe a system in terms of its state, entities and their attributes, sets, processes, events, activities and delays. System State: A collection of variables that contain all the information necessary to describe a system at any point in time

Discrete-Event Simulation Concepts Entity: Any object or component in a system which requires explicit representation in the model (e.g. a server, a customer, a machine) Attributes: Properties of a given entity (e.g. priority of a waiting customer, the routing number of a job through a job shop) List: A collection of (permanently or temporarily) associated entities, ordered in some logical fashion (e.g. customers currently waiting in a queue ordered according to a queueing discipline) [sets, queues, chains]

Discrete-Event Simulation Concepts Event: An instantaneous occurrence that changes the state of a system (e.g. arrival of a new customer) Event Notice: A record of an event to occur at the current or some future time, along with any associated data to execute the event (at a minimum: event type, event time) Event List: A list of event notices for future events, ordered by time of occurrence, also know as future event list (FEL)

Discrete-Event Simulation Concepts Activity: A duration of time of specified length (e.g. service time), which is known when it begins. deterministic random function of state variables or entity attributes (deterministic/random) Delay: A duration of time of unspecified length, which is not directly known until it ends (an event triggers the end) [conditional wait] (e.g. time a customer spends in a waiting line) Clock: A variable representing simulated time (CLOCK)

Events and System State Time S1 C1 C2 L(t) 2 1 t1 t2 t3 t4 Time B(t) 1 t1 t2 t3 t4 Time

Example: A Doctor’s Office

Example: A Doctor’s Office System State Q(t), the number of patients waiting to be examined at time t B(t), 0 or 1 indicate the doctor being busy or not at time t Entities Neither the patients nor the doctor need to be explicitly represented, except in terms of state variables unless certain patient averages are desired Events Patient arrival event Examination completion event

Example: A Doctor’s Office Activities: Interarrival time Examination time Delay A patient’s wait until the doctor is free What more to specify? Consequences of events ( a logical description) Activity lengths (deterministic, probabilistic, a function) Triggers for the beginning and the end of delays Initial conditions (System state at time 0)

Advancing simulated time Variable time increments Time Advance Advancing simulated time Fixed time increments Variable time increments Advances the clock by one time unit & examines the events and system state (ACTIVITY SCANNING) Approach Not an efficient approach for most systems Advances the clock to the most imminent event time & examine the system state EVENT ORIENTATION EVENT SCHEDULING NEXT EVENT METHOD

Variable Time Increment Moves the system from one event time to the next event time Produces a sequence of system snapshots (or system images) which represent the system evolution through time System evolution can be represented by these snapshots since between events the system does not change

Variable Time Increment Snapshots at each event time include: The current state of the system FEL for all activities currently in progress (their completion times) The current membership to all lists The status of all entities Current values of all cumulative statistics and counters Thus only the last snapshot is needed to construct the next snapshot (Markovian property)

Future Events List (FEL) In real world, the future events are not scheduled but merely happen at a certain time (random arrivals, failures) Yet these event times can be modeled by a statistical characterization (distribution) of the time to next occurrence (arrival, failure) In simulation activity lengths are determined by obtaining a random sample from the distribution associated with it. Completion Time = Starting Time + Activity Length The activity completion time is determined as the activity begins and the activity completion event is added to FEL.

Event-Scheduling At any given time t, the FEL contains all previously scheduled future events and their associated event times. The FEL is ordered by event time, which means that the events are in chronological order. t < t1 <= t2 <= t3 <= . . . <= tn The time t is the value of CLOCK, current value of simulated time The event associated with time t1 is called the imminent event, which means the next event to occur. The snapshot at CLOCK= t is updated

Event-Scheduling Simulation time advances to CLOCK= t1 Imminent event notice about t1 is removed from the FEL The event is executed The execution creates a new snapshot of the system at t1 based on the previous snapshot and the nature of the event This snapshot may include new future event notices added to FEL or not(depends on the nature of the executed event) And the cycle continues by repeating the same steps after advancing CLOCK to the time of the new imminent event until the end of the simulation

System Snapshot CLOCK System State . . . Future Event List t (5,1,6) (4, t1) – Type 4 event to occur at t1 (1, t2) – Type 1 event to occur at t2 (1, t3) – Type 1 event to occur at t3 . (3, tn) – Type 3 event to occur at tn

System Snapshot CLOCK System State . . . Future Event List (5,1,7) t1 (1, t2) – Type 1 event to occur at t2 (2, t*) – Type 2 event to occur at t* (1, t3) – Type 1 event to occur at t3 . (3, tn) – Type 3 event to occur at tn

Future Event Generation Exogenous Events (Events that are not caused by the internal dynamics of the system. They happen outside the system, yet effect the evolution of the system): The events that are in the initial system snapshot at time 0 (specified by initial conditions). These are placed to the FEL before the simulation starts. Other external events such as arrivals to a queueing system. These events are generated using a technique called Bootstrapping This technique is based on each event causing another event of the same type The time between the events is an activity (a) (It may be a r.v.) When an event occurs, schedule the next event in the same stream of events and place the associated notice in the FEL This next event in the stream is scheduled at t* = t + a

Bootstrapping

Future Event Generation Endogenous Events Service-completion event Each time a customer starts service a service-completion event is scheduled (End of an activity) Note that service-start event is never scheduled, it is called a conditional event. A service-start occurs within an arrival or a service-completion event. The events that are placed on FEL are called primary events. Uptimes and downtimes for a system subject to breakdown End-of-uptime and end-of-downtime events (primary events) Similar to bootstrapping

Stopping Simulation Runs At time 0, schedule a stop-simulation event at a specified future time TE ( Simulation runs in the interval [0, TE] ) Stop the run at the time of occurrence of some specified event E. (The completion of the 1000th service at the server)

World Views When using a simulation package or even when doing hand simulation, a modeler adopts a world view or orientation for developing a model. The most prevalent world views are the event-scheduling world view the process-interaction world view the activity-scanning world view. Particular simulation packages (e.g. Arena) usually support one of these world views.

Event-Scheduling World View Concentrates on events and their effects on system state It makes use of the Future Event List and variable time increments This is the approach we have just discussed It is a very flexible approach using which any system can be simulated It requires lots of mechanisms (e.g. FEL handling) to be coded, which may slow down the development of the simulation model for very simple systems.

Event-Scheduling World View We have not used this method on any example last week. We are going to do it now on the doctor’s office system This is the world view that is usually used when the simulation program is directly coded on a general-purpose programming language such as Java. We are going to show its implementation in Java next week It would be hard to use this world view with EXCEL since the implementation of the standard mechanisms of Event-Scheduling is not easy in such environments (it could be done with extensive use of EXCEL macros)

Process-Interaction World View Models the system in terms of processes Concentrates on entities, and their life cycles as they flow through the system, demanding resources and queueing to wait for resources. A process is a time-sequenced list of events, activities and delays that define the life cycle of one entity as it moves through a system. Some activities might require resources that are limited, which may cause delays in the process

Process-Interaction World View This is the world view we adopted for the hand simulation of the doctor’s office system last week

Process-Interaction World View This approach is easier for the modeler since people usually perceive the systems in terms of the processes the entities experience But this approach is usually harder to implement directly, especially when the systems to be simulated are complex Thus, many simulation packages (including ARENA) use this view for the modeler to describe the system (user-interface), but an event-scheduling approach is used operationally to perform the simulation run, hidden from the user.

Activity-Scanning World View Concentrates on activities and conditions that allow them to begin It uses fixed time increments At each clock advance, the conditions for each activity are checked, and if the conditions hold, then the corresponding activity starts. The (M,N) inventory system simulation we used last week used activity-scanning approach. The time increment used was a day.

Activity-Scanning World View Simple in concept and leads to modular models that are easier to maintain, understand and modify. The repeated scanning (at each time increment) results in slow runtime on computers The pure activity-scanning approach has been modified by what is called the three-phase approach, which combines the features of event-scheduling with activity scanning to allow for variable time advance. (ARENA uses this as well)

Example: A Doctor’s Office

Example: A Doctor’s Office System State (Q(t),B(t)) Q(t), the number of patients waiting to be examined at time t B(t), 0 or 1 indicate the doctor being busy or not at time t Entities (Pi,t), representing patient Pi who arrived at time t Events Patient arrival event (A) Patient departure event (D) Stopping event (E)

Example: A Doctor’s Office Event Notices (A,t,Pi) represents the arrival of patient Pi at future time t (D,t,Pi) represents the departure of patient Pi at future time t (E,19) represents the simulation-stop event at future time 19 Activities Interarrival time, described in a following table Service time, described in a following table Delay Patient time spent in the waiting room Set “Waiting Room”, the set of all patients in the waiting room “Doctor’s Room”, the set of all patients in the doctor’s room

Arrival Event Arrival event occurs at CLOCK = t B(t)=1 Q(t)=Q(t)+1 NO YES B(t)=1 ? B(t)=1 Q(t)=Q(t)+1 Generate service time s & schedule new departure event at t+s Generate interarrival time a; schedule next arrival event at t+a Collect statistics Return control to time-advance routine to continue simulation

Service Completion Event Departure event occurs at CLOCK = t NO Q(t) 1 ? YES B(t)=0 Q(t)=Q(t)-1 Generate service time s; schedule new departure at t+s Collect statistics Return control to time-advance routine to continue simulation

Interarrival time Probability Cumulative probability Input Data (Arrival) Interarrival time Probability Cumulative probability 1 0.30 0.30 2 0.25 0.55 3 0.20 0.75 4 0.15 0.90 5 0.07 0.97 6 0.03 1.00

Service time Probability Cumulative probability Input Data (Service) Service time Probability Cumulative probability 1 0.25 0.25 2 0.25 0.50 3 0.25 0.75 4 0.25 1.00

Generation of interarrival times Interarrival time Cumulative probability Random digit assignment 1 0.30 01-30 2 0.25 31-55 3 0.20 56-75 4 0.15 76-90 5 0.07 91-97 6 0.03 97-00 Customer No. Random digit Interarrival time 1 - - 2 38 2 3 84 4 4 15 1 5 50 2 6 99 6 … … …

Generation of service times Interarrival time Cumulative probability Random digit assignment 1 0.25 01-25 2 0.25 26-50 3 0.25 51-75 4 0.25 76-90 Customer No. Random digit Service time 1 28 2 2 24 1 3 73 3 4 46 2 5 04 1 6 85 4 … … …

Statistics Continuous time statistics Discrete time statistics (Observational data) Time dependent data Continuous statistics Time weighted statistics Defined on the random variables {Q(t)},{B(t)}, each of which is indexed on the continuous time parameter Defined relative to the collection of random variables with a discrete time index (Observational data) ^

Notation TQ: time integral of Q(t) (from 0 to T) TB: time integral of B(t) (from 0 to T) TL: time integral of (B+Q)(t) (from 0 to T) R: total response time for patients (time-in-the-system) who departed by T W: total waiting time of patients (time-in-the-queue) who departed by T N: total number of departures by T Example: calculation of TL : TLnew=TLold+(T-Told)(Bold +Qold) T B+Q TL 1 2 1 0+(2-0)*1=2 3 2+(3-2)*1=3 6 1 3+(6-3)*0=3 19 13+(19-15)*1=17

Simulation table 2 3 6 7 9 11 12 15 19 1 (P1,0) (P2,2) (P3,6) (P4,7) Clock B(t) Q(t) DR WR FEL R W N TQ TB 2 3 6 7 9 11 12 15 19 1 (P1,0) (P2,2) (P3,6) (P4,7) (P5,9) (P6,15) (A,2,P2),(D,2,P1),(E,19) (D,3,P2),(A,6,P3),(E,19) (A,6,P3),(E,19) (A,7,P4),(D,9,P3),(E,19) (A,9,P5),(D,9,P3),(E,19) (D,11,P4),(A,15,P6),(E,19) (D,12,P5),(A,15,P6),(E,19) (A,15,P6),(E,19) (D,19,P6),(E,19),(A,24,P7) (A,24,P7) 10 13 17 4 5 8 17 4 6 4 13

Another Example of Hand Simulation using Event-Scheduling From Chapter 2 of the Arena Book Arriving Blank Parts Departing Finished Parts Machine (Server) Queue (FIFO) Part in Service 4 5 6 7

Model Specifics Initially (time 0) empty and idle Base time units: minutes Input data (assume given for now …), in minutes: Part Number Arrival Time Interarrival Time Service Time 1 0.00 1.73 2.90 2 1.73 1.35 1.76 3 3.08 0.71 3.39 4 3.79 0.62 4.52 5 4.41 14.28 4.46 6 18.69 0.70 4.36 7 19.39 15.52 2.07 8 34.91 3.15 3.36 9 38.06 1.76 2.37 10 39.82 1.00 5.38 11 40.82 . . . . . . Stop when 20 minutes of (simulated) time have passed

Simulation by Hand: Setup

Simulation by Hand: t = 0.00, Initialize

Simulation by Hand: t = 0.00, Arrival of Part 1

Simulation by Hand: t = 1.73, Arrival of Part 2

Simulation by Hand: t = 2.90, Departure of Part 1

Simulation by Hand: t = 3.08, Arrival of Part 3 2

Simulation by Hand: t = 3.79, Arrival of Part 4 2

Simulation by Hand: t = 4.41, Arrival of Part 5 3 2

Simulation by Hand: t = 4.66, Departure of Part 2 5 4 3

Simulation by Hand: t = 8.05, Departure of Part 3 4

Simulation by Hand: t = 12.57, Departure of Part 4

Simulation by Hand: t = 17.03, Departure of Part 5

Simulation by Hand: t = 18.69, Arrival of Part 6

Simulation by Hand: t = 19.39, Arrival of Part 7 6

Simulation by Hand: t = 20.00, The End 7 6

Simulation by Hand: Finishing Up Average waiting time in queue: Time-average number in queue: Utilization of drill press:

Complete Record of the Hand Simulation