Discrete Event Simulation

Slides:



Advertisements
Similar presentations
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. A PowerPoint Presentation Package to Accompany Applied Statistics.
Advertisements

Discrete Event (time) Simulation Kenneth.
Introduction into Simulation Basic Simulation Modeling.
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Lab Assignment 1 COP 4600: Operating Systems Principles Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of.
Lecture 3 Concepts of Discrete-Event Simulation. 2 Discrete Event Model  In the discrete approach to system simulation, state changes in the physical.
Simulation Where real stuff starts. ToC 1.What, transience, stationarity 2.How, discrete event, recurrence 3.Accuracy of output 4.Monte Carlo 5.Random.
Classification of Simulation Models
1 Performance Evaluation of Computer Networks Objectives  Introduction to Queuing Theory  Little’s Theorem  Standard Notation of Queuing Systems  Poisson.
Simulation.
Performance Analysis of the IEEE Wireless Metropolitan Area Network nmgmt.cs.nchu.edu.tw 系統暨網路管理實驗室 Systems & Network Management Lab Reporter :黃文帥.
Channel Allocation for GPRS From: IEEE Tran. Veh. Technol., Vol. 50, no. 2, Author: P. Lin and Y.-B. Lin CSIE, NTU & CSIE, NCTU.
7/3/2015© 2007 Raymond P. Jefferis III1 Queuing Systems.
CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT Class Location:
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Lecture 14 – Queuing Systems
Basic Simulation Modeling II
Location Models For Airline Hubs Behaving as M/D/C Queues By: Shuxing Cheng Yi-Chieh Han Emile White.
Computer Simulation A Laboratory to Evaluate “What-if” Questions.
Simulation II IE 2030 Lecture 18. Outline: Simulation II Advanced simulation demo Review of concepts from Simulation I How to perform a simulation –concepts:
Introduction to Discrete Event Simulation Customer population Service system Served customers Waiting line Priority rule Service facilities Figure C.1.
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
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.
 1  Outline  stages and topics in simulation  generation of random variates.
Network Analysis A brief introduction on queues, delays, and tokens Lin Gu, Computer Networking: A Top Down Approach 6 th edition. Jim Kurose.
Modeling & Simulation: An Introduction Some slides in this presentation have been copyrighted to Dr. Amr Elmougy.
ETM 607 – Discrete Event Simulation Fundamentals Define Discrete Event Simulation. Define concepts (entities, attributes, event list, etc…) Define “world-view”,
Structure of a Waiting Line System Queuing theory is the study of waiting lines Four characteristics of a queuing system: –The manner in which customers.
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.
Queueing Theory What is a queue? Examples of queues: Grocery store checkout Fast food (McDonalds – vs- Wendy’s) Hospital Emergency rooms Machines waiting.
Modeling and Analysis of Computer Networks
SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
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
ETM 607 – Random-Variate Generation
WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 25 Simulation.
Chapter 2 Fundamental Simulation Concepts
Computer Simulation. The Essence of Computer Simulation A stochastic system is a system that evolves over time according to one or more probability distributions.
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Discrete Event Simulation
1 An Analytical Model for the Dimensioning of a GPRS/EDGE Network with a Capacity Constraint on a Group of Cells r , r , r Nogueira,
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.
SIMULATION EXAMPLES. Monte-Carlo (Static) Simulation Estimating profit on a sale promotion Estimating profit on a sale promotion Estimating profit on.
User Mobility Modeling and Characterization of Mobility Patterns Mahmood M. Zonoozi and Prem Dassanayake IEEE Journal on Selected Areas in Communications.
Advantages of simulation 1. New policies, operating procedures, information flows and son on can be explored without disrupting ongoing operation of the.
EVOLUTION OF INDUSTRIAL ENGINEERING Prof. Dr. Orhan TORKUL Res. Asst. M. Raşit CESUR Res. Asst. Furkan YENER.
CS433 Modeling and Simulation Lecture 09 – Part 02 Discrete Events Simulation Dr. Anis Koubâa 27 Dec 2008 Al-Imam.
 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,
© 2015 McGraw-Hill Education. All rights reserved. Chapter 17 Queueing Theory.
Simulation Examples And General Principles Part 2
Simulation. Types of simulation Discrete-event simulation – Used for modeling of a system as it evolves over time by a representation in which the state.
Discrete-Event System Simulation in Java. Discrete Event Systems New dynamic systems New dynamic systems Computer and communication networks Computer.
NETW 707: Modeling & Simulation Course Instructor: Tallal Elshabrawy Instructor Office: C3.321 Instructor Teaching.
Modeling and Simulation
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.
OPERATING SYSTEMS CS 3502 Fall 2017
Prepared by Lloyd R. Jaisingh
Modeling and Simulation (An Introduction)
Simulation Statistics
ADVANTAGES OF SIMULATION
Chapter 10 Verification and Validation of Simulation Models
Cellular Digital Packet Data: Channel Availability
Qingwen Liu, Student Member, IEEE Xin Wang, Member, IEEE,
MECH 3550 : Simulation & Visualization
Video Streaming over Cognitive radio networks
Presentation transcript:

Discrete Event Simulation Speaker: Yeh, En-Hau Advisor: Phone Lin MCN Lab., Dept. of CSIE, NTU Email: jet.lee@pcs.csie.ntu.edu.tw TEL: +886-2-33664888#538

Grading Midterm Exam 40% Final Exam 30% Final Project 30% Step 1: Find a paper with the analytical model Step 2: Read the paper in detail Step 3: Write the simulation to validate the analytical model Step 4: Compare the errors of your simulation results with the results in the paper [optional] Step 5: Do some more if you can (e.g., performance analysis via simulation or analytical models). Step 6: Prepare your presentation Report

Grading Find a paper with the analytical model Where to find a paper? IEEE Xplore: http://ieeexplore.ieee.org/Xplore/guesthome.jsp ACM Digital Library: http://portal.acm.org/ Which Journal/Magazine? Journals IEEE Transactions on Vehicular Technology IEEE Journal on Selected Areas in Communications IEEE Transactions on Mobile Computing IEEE Networks IEEE Transactions on Computer IEEE Communications Letter IEEE Transactions on Wireless Communication IEICE Transactions on Communication Security and Communication Networks ACM/Springer Wireless Networks Journal of Wireless Communications and Mobile Computing ACM/Springer Mobile Networks and Applications Magazines IEEE Personal Communications Magazine IEEE Communications Magazine IEEE Wireless Communications Magazine

Outline Introduction to Simulation Simulation Implementation What is Simulation? Why Simulate? System & Simulation Simulation Implementation A Simulation Example M/M/c/c Handoff Model

What is Simulation? Simulation is the imitation of some real thing, state of affairs, or process. Simulation is defined as the process of creating a model of an existing or proposed system to gain some understanding of how the corresponding system behaves.

What is Simulation?

Why Simulate? (Example) stack landing

Why Simulate? (Example Cont.) An Example of Simulation in the Real World The Airport Problem The airport has two runways, one for landing and one for takeoff. If the landing way is busy, the airplane in the air must enter in a stack. However, when the stack is full, the takeoff way must become landing way. Airports have a waiting stack, where airplanes wait before they can land. In this stack, airplanes fly a holding pattern on an assigned altitude. What we want to know? Calculate the stack length. The average time a plane waits for takeoff. The average utilization of the landing way and the takeoff way.

Why Simulate? (Example Cont.) Such measures of performance can get from historical data records. However, we are interested in the impact of certain proposed changes. Landing airplane arrival rate. Takeoff airplane arrival rate. Increasing the runways.

Why Simulate? Save time Reduce cost Test design ideas (performance measurement) The impact of certain changes of parameter. The arrival rate of certain traffic class. The service time of certain traffic class. The number of application server. Predict the future behavior of the system

Simulation Static/Dynamic Simulation Continuous/Discrete Simulation Time simply plays no role Dynamic A system evolves over time Continuous/Discrete Simulation Continuous The state change continuously with respect to time Discrete The state change instantaneously at separated points in time

Discrete-Event Simulation Dynamic Simulation clock Keep track of the current value of simulated time as the simulation proceeds A mechanism to advance simulated time from one value to another Discrete The state change instantaneously at separate points in time The system can change at only a countable number of points in time. These points in time are the ones at which an event occurs. Event An instantaneous occurrence that may change the state of the system

Discrete-Event Simulation All state changes occur only at event times for a discrete-event simulation model Periods of inactivity are skipped over by jumping the clock from event time to event time Stochastic Interarrival times A1, A2,… and service times S1, S2,… Are random variables Have cumulative distribution functions For example, the process of arrival at and departure from a voip server occurs in random fashion. The only way we can represent this randomness is by using probability distributions to describe.

The Phase of Simulation Construction Formularize the problem Collecting necessary input data as parameter (arrival rate, departure rate) Design a simulation model to match the problem Running Run this simulation for enough time to estimate the system’s result. Debugging See if the result make sense. Compare to an analytic model

Simulation Implementation

Simulation Implementation Event An instantaneous occurrence that may change the state of the system Attributes of an event Type (e.g., arrival, departure, etc.) Timestamp Other attributes Location info. Programming Language C C++ Java C# … Priority Queue in C++ Standard Template Library priority_queue<T, Sequence, Compare> Event List Event list is a linked list Events are sorted according to the timestamp value. Automatically adjusts the event order at each event insertion. Efficiency Data structure: link-list v.s. min-Heap data structure Time Complexity Memory allocation management Freelist

Random Number Generator R.N.G.’s for various probability distributions Used when we need a time period with a certain distribution Uniform, exponential, gamma, etc. Implementation The inverse transform method CDF: F(x) = Pr[ X ≤ x]

Inverse Transform Method 1 F(x) yj F-1(yj) yi Probability Uniform(0,1) xi xj X

Inverse Transform Method Validity of this method: Whether r.v. F-1(U) has the CDF F(x)? F’(x) = Pr[F-1(U) ≤ x] = Pr[U ≤ F(x)] = FU( F(x) ) = F(x)

Inverse Transform Method Example: exponential distribution with rate CDF: F(x) = 1 - e -λX Set F(X) = U => 1 - e-λX = U => e-λX = 1-U => -λX = ln(1-U) => X = -ln(1-U)/ λ Note: u!=0

Inverse Transform Method Applicable when the inverse function of F(x), i.e., F-1(x), can be derived Preferably when F-1(x) has an east-to-use form Steps: Generate a uniform (0,1) random number u Compute x = F-1(u), and x is the desired random number

Generating Gamma-distributed

Generating Gamma-distributed

A SIMULATION EXAMPLE M/M/c/C

Queueing System Key elements: customers and servers Customer: arrival process Server: service rate and number of servers Notation: A/B/c/N/K A: inter-arrival time distribution (arrival process) B: service time distribution c : number of servers/channels N: system capacity K: queue discipline (Unless specified, it is assumed to be First-In-First-Out)

Queueing System M/M/c/c The 1st M: Markovian / Memoryless Possision arrivals / exponential inter-arrival time The 2nd M: Markovian Exponential service time c: c servers/channels c: system capacity Blocking

Analysis: M/M/c/c (Erlang B) λ λ λ λ λ … 1 2 c-1 c μ 2μ 3μ (c-1)μ cμ

Simulation Models: M/M/c/c ARRIVAL event represents a customer arrival. arrival1 arrival2 departure1 generate next call: arrival2 if channel > 0 then channel-- and generate service time: departure1

Simulation Models: M/M/c/c arrival1 arrival2 arrival3 departure1 departure2 generate next call: arrival3 if channel > 0 then channel-- and generate service time: departure2

Simulation Models: M/M/c/c DEPARTURE event represents a customer departure . arrival1 arrival2 arrival3 departure1 departure2 channel++

Simulation Models: M/M/c/c Assume that c=2 Arrival5 is Blocking Pb = N_blocking / N_arrival arrival1 arrival2 arrival3 arrival4 arrival5 arrival6 departure1 departure2 departure4 generate next call: arrival6 if channel = 0 then N_blocking++

Simulation Models: Event Class

Simulation Models: Initialize 實驗次數100萬次

Simulation Models: Timing Routine generate next call if channel > 0 then channel generate service time if channel = 0 then N_blocking++ channel++

Simulation Models: Report M/M/c/c Inter-arrival time is Exponential distribution with rate 50.0 Service time is Exponential distribution with rate 10.0 c: number of channels is 8 c: system capacity is 8 http://www.erlang.com/calculator/erlb

Priority Queue

A SIMULATION EXAMPLE Handoff Model

A Simulation Example Handoff Model When the network attempts to deliver a call to a handset or the handset attempts to originate a call, the call is connected if a channel is available. Otherwise, the call is blocked (referred to as the new call blocking). When a handset moves from one cell to another during a call, in order to maintain call continuation the channel in the old cell is released, and a channel is required in the new cell. This process is called hand-off. If no channel is available in the new base station, then the hand-off call is force-terminated.

A Simulation Example Handoff Model

System Model – Assumptions (1/4) Each cell consists of One base station Several channels Several mobile station A mobile user can carry only a call We do not consider batch arrivals of new and handoff calls

System Model – Assumptions (2/4)

System Model – Assumptions (3/4) Each hard handoff call can only connect to one BS.

System Model – Assumptions (4/4) Wrapped mesh cell: N*N => 8*8 The boundary cell effects can be ignored

Simulation Models: Event Design A HANDOFF event An ARRIVAL event A RELEASE event

Simulation Models: Event Design We define three types of events for traditional calls : ARRIVAL event represents a new call arrival. Call_Type is maintained in this event to indicate that the event is for a (Call_type = Traditional) A channel is required HANDOFF event represents a handoff call arrival. The Call_Type variable is used to indicate that the event is for a traditional call (Call_type = Traditional) The channel in the old cell is released, and a channel is required in the new cell. RELEASE event represents the completion of a call. Call_Type indicates that the event is for a traditional call (Call_type = Traditional) The channel is released.

Timing Diagram for one call tc: the call holding time of a portable. tc,i: the period between the time the portable moves into coverage area i and the time when the call is complete. tm,i: the residence time of a portable at a coverage area i. τ0: the time between the arrival of the call and when the portable moves out of coverage area 0.

Residual-life τ0 Generation of an residual-life random number for gamma residence time with the parameters (k, θ) includes the following steps: We first generate a uniform random number μ in (0, 1). Second, we generate a random number t for the gamma random variable T with the parameters (k+1, θ). By multiplying u and t, we obtain a random number for the residual τ0. τ0=U*Gamma(k+1, θ) Yi-Bing Lin, “Random Number Generation for Residual Life of Mobile Phone Movement”, IEEE International Conference on  Networking, Sensing and Control, Vol 1, pp. 30-33, March 2004.

Timing Diagram for multiple call first call Event List Call 1 Arrival (t=0) Call 1 Handoff (t=4) Call 2 Arrival (6) Call 2 Arrival (t=6) generate next call arrival2 generate service time generate cell residence time insert ARRIVAL event if channel>0 { channel-- if (service time > residence time) insert HANDOFF event else insert RELEASE event }

Timing Diagram for multiple call Event List Call 1 Arrival (t=0) Call 1 Handoff (t=4) Call 2 Arrival (6) Call 2 Arrival (t=6) Call 1 RELEASE (t=14) Call 3 Arrival (t=20) channel++ generate next call arrival3 generate cell residence time if channel==0 N_Blocking++ compare the service time and the residence time if (service time > residence time) insert HANDOFF event else insert RELEASE event

Example: Event List and Event Struct …

Simulation Models: Timing Routine /* initialization */ /* generate the first event and insert it into the event list */ While(Number_of_Case <= Bound){ /* retrieve the first event from event list */ /* adjust the system clock according to the timestamp of current event */ switch(event_type){ case ARRIVAL : /*Process flowchart for ARRIVAL event */ break; case HANDOFF: /*Process flowchart for HANDOFF event */ case RELEASE: /*Process flowchart for RELEASE event */ } /*Calculate the desired performance measures and output the result */

Flow Chart

The notations The new traditional call arrival rate to a cell is exponentially distributed with the rate . The call holding time for a traditional call is exponentially distributed with the mean . The UE residence time in a cell has an exponential distribution with the mean . The total channels in a cell are C. The call incompletion probability for a traditional call is Pnc,t.

Analysis and Simulation Validation The input parameters and are normalized by . We assume there are C=10 channels per cell.

Reference http://www.erlang.com/calculator/erlb Gamma distribution http://en.wikipedia.org/wiki/Gamma_distribution Erlang B Calculator http://www.erlang.com/calculator/erlb Latex http://www.latex-project.org/ http://miktex.org/ GNUPlot http://www.gnuplot.info/ M/M/c/c Sample Source Code http://pcs.csie.ntu.edu.tw/course/performance/2012/Simulation_MMCC.rar