Subject Name: System Modeling & Simulation. Prepared By : Ms. Pramela Devi( ASCP) Department : Computer Science & Engineering

Similar documents
Discrete-event simulation

Chapter 3 General Principles. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation

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

General Simulation Principles

Overview of the Simulation Process. CS1538: Introduction to Simulations

Numerical approach estimate

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008

Modeling and Simulation (An Introduction)

Performance Evaluation

Lecture: Simulation. of Manufacturing Systems. Sivakumar AI. Simulation. SMA6304 M2 ---Factory Planning and scheduling. Simulation - A Predictive Tool

CHAPTER 5 NEXT-EVENT SIMULATION

An algorithm for Performance Analysis of Single-Source Acyclic graphs

Object Oriented Discrete-Event Simulation with OOSimL CS 4632

SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM

Discrete-Event Simulation:

UNIT 4: QUEUEING MODELS

Event Scheduling Algorithm. Event Notice and Future Event List. Discrete Event Simulation. Event Scheduling Based on FEL

Queuing Systems. 1 Lecturer: Hawraa Sh. Modeling & Simulation- Lecture -4-21/10/2012

Lecture 5: Performance Analysis I

Simulative Evaluation of Internet Protocol Functions

Section 5.2: Next Event Simulation Examples

Processing, representing and interpreting data

OLE Smarts115, Smarts116

Next-Event Simulation

Chapter 5. File and Memory Management

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Simulation. Outline. Common Mistakes in Simulation (3 of 4) Common Mistakes in Simulation (2 of 4) Performance Modeling Lecture #8

Simulation Models for Manufacturing Systems

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank

Information Science 2

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

[2:3] Linked Lists, Stacks, Queues

Chapter 11 Running the Model

Concept as a Generalization of Class and Principles of the Concept-Oriented Programming

CSCI-1200 Data Structures Spring 2017 Lecture 27 Garbage Collection & Smart Pointers

Chapter 12. CPU Structure and Function. Yonsei University

Unit 3 : Process Management

Fundamentals of Operating Systems (COMP355/L) A Student's Manual for Practice Exercises

8.1 Model building, verification, and validation

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

Discrete-Event Simulation: A First Course. Steve Park and Larry Leemis College of William and Mary

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

Adaptive algorithm for High-Performance FPGA Cores

Introduction. Step 1: Creating a Process Simulator Model. Open Tutorial File in Visio. Goal: 40 units/week of new component.

CSCI-1200 Data Structures Fall 2011 Lecture 24 Garbage Collection & Smart Pointers

Operating Systems Lecture 6: Memory Management II

What We ll Do... Random

Read Chapter 4 of Kurose-Ross

In either case, remember to delete each array that you allocate.

A general purpose digital simulator and examples of its application

Module 7:Application of stochastic processes in queueing theory Lecture 29:Application of stochastic processes in Queueing Theory

Section 5.3: Event List Management

Chapter 3 Structured Program Development in C Part II

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

The RASTA Framework. Joel Becker October 3, 2001

Modern Systems Analysis and Design

CS Operating Systems

CS Operating Systems

CS 270 Algorithms. Oliver Kullmann. Binary search. Lists. Background: Pointers. Trees. Implementing rooted trees. Tutorial

Data Structures Lecture 2 : Part 1: Programming Methodologies Part 2: Memory Management

Arrays and Linked Lists

19 File Structure, Disk Scheduling

Module 1. Introduction:

22 File Structure, Disk Scheduling

Stochastic Petri nets

Tasks. Task Implementation and management

Function Call Stack and Activation Records

Queueing Networks 32-1

Page 1. Goals for Today" TLB organization" CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement"

lecture notes September 2, How to sort?

Object Orientated Analysis and Design. Benjamin Kenwright

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

>>> SOLUTIONS <<< a) What is a system? Give a short formal definition. (Hint: what you draw a box around is not a formal definition)

1. Background. 2. Demand Paging

Subject Teacher: Prof. Sheela Bankar

3/3/2014! Anthony D. Joseph!!CS162! UCB Spring 2014!

Two hours. Question ONE is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 25th January 2013 Time: 14:00-16:00

Virtual Memory Management

Chapter 5. Minimization of Average Completion Time and Waiting Time in Cloud Computing Environment

Earthwork 3D for Dummies Doing a digitized dirt takeoff calculation the swift and easy way

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

16. Linked Structures and Miscellaneous

FOURTH EDITION. Discrete-Event System Simulation

More Counting Sort and Sorting-by-Key

EP2200 Queueing theory and teletraffic systems

Midterm Exam Solutions Amy Murphy 28 February 2001

HELLO WORLD. c Copyright Bluespec, Inc. All Rights Reserved. July 8, 2016

11. a b c d e. 12. a b c d e. 13. a b c d e. 14. a b c d e. 15. a b c d e


CS370 Operating Systems

Stream Control Transmission Protocol

BUFFER STOCKS IN KANBAN CONTROLLED (TRADITIONAL) UNSATURATED MULTI-STAGE PRODUCTION SYSTEM

Lab 3 Process Scheduling Due date: 29-Nov-2018

CS2028 -UNIX INTERNALS

Simulation with Arena

Process- Concept &Process Scheduling OPERATING SYSTEMS

CS370 Operating Systems

Heap, Variables, References, and Garbage. CS152. Chris Pollett. Oct. 13, 2008.

Database Applications (15-415)

COMP 202. More on OO. CONTENTS: static revisited this reference class dependencies method parameters variable scope method overloading

Transcription:

Subject Name: System Modeling & Simulation Subject Code: 10CS82 Prepared By : Ms. Pramela Devi( ASCP) Department : Computer Science & Engineering Date : 12-02-2015 3/4/2015

UNIT 2 General Principles and Simulation Software Engineered for Tomorrow Client So & So Software Pvt. Ltd Date dd.mm.y y Descriptor Lorem Ipsum Dolor Sit Amet, Consectetuer Adipiscing

Topic Details 1) Concepts in Discrete-Event Simulation: 2) The Event-Scheduling / Time-Advance Algorithm, 3) World Views, 4) Manual simulation Using Event Scheduling; 5) List processing. 6) Simulation in Java; 7) Simulation in GPSS. 8) Self check Exercise 9) Summary 3/4/2015

Learning Outcome: Students will understand:- The basic concepts in Discrete-Event Simulation The detailed description on the Event-Scheduling / Time-Advance Algorithm Basics of World Views How to perform manual simulation Using Event Scheduling Definition of list processing. How to perform simulation in Java How to perform Simulation in GPSS 3/4/2015

w 1.Concepts in Discrete Event Simulation System - a collection of entities that act and interact toward the accomplishment of some logical end Model An abstract representation of a system, contains structural, logical and mathematical relationship and describe a system in term of state, entities, attributes, sets, process, events, activities and delays System State- A collection of variable describe a system over a time Entity- Object or component in the system that requires explicit representation Attribute Properties of a given entity List Collection of entities ordered in some logical fashion Event An instantaneous occurrence that change the state of a system Event Notice A record of an event to occur at random time Event List A list of event notices for future events known as FEL

1.Concepts in Discrete Event Simulation Continued Activity A duration of time of specified length, example service time or inter arrival time Delay A duration of time of unspecified indefinite length, which is not known until it ends (e.g. a customer s delay in a last-in-first-out waiting line which, when it begins, depends on future arrivals). Clock- Variable representing simulated time Deterministic Model - a deterministic simulation model is one that contains no random variables. All variables are known with certainty, or in other words, no probability is associated with them.

1.Concepts in Discrete Event Simulation Continued Stochastic Model - a stochastic simulation model contains random variables Static Model - a static simulation model is a representation of a system at a particular point in time. Dynamic Model - a dynamic simulation is a representation of a system as it evolves over time.

Event Scheduling/Time Advance Algorithm Future Event List FEL: contains all the notices for events scheduled to occur at a future time At any given time (t), the FEL contains all previously scheduled future events and their associated event times, e.g.: t1, t2, t3,, etc. See Fig. The FEL is ordered by event time, i.e. events are arranged chronologically so that the event time satisfies t t1 t2 tn At time (t), i.e. CLOCK = t, the event associated with t1 is called the imminent event. That is, the event that will occur

Advancing Simulation Time and Updating System Image Clock t System state Entities and Attribute Set1 Set 2 Future Event List FEL Cumulative statistics and Counters t (x,y,z,.) (3,t 1 ) Type 3 event to occur at time t 1 (1,t 2 ) Type 1 event to occur at time t 2 Prototype System Snapshot at simulation time t

Advancing Simulation Time and Updating System Image Clock t System state Future Event List FEL t (5,1,6) (3,t 1 ) Type 3 event to occur at time t 1 (1,t 2 ) Type 1 event to occur at time t 2 (1,t 3 ) Type 1 event to occur at time t 3. (1,t 3 ) Type 2 event to occur at time t n Old System Snapshot at simulation time t

Event Scheduling / time advance algorithm Step 1. Remove the event notice for the imminent event (event 3, time t1) from the FEL Step 2. Advance CLOCK to imminent event time (i.e. advance CLOCK from t to t1) Step 3. Execute imminent event; update system state; change entity attributes; and set membership as needed Step 4. Generate future events (if necessary) and place their event notices on the FEL, ranked by event time, e.g. event 4 to occur at time t*, where t1 < t*< t1 Step 5. Update cumulative statistics and counters

Advancing Simulation Time and Updating System Image Clock t System state Future Event List FEL t (5,1,5) (1,t 2 ) Type 1 event to occur at time t 2 (4,t * ) Type 4 event to occur at time t * (1,t 3 ) Type 1 event to occur at time t 3. (2,t n ) Type 2 event to occur at time t n New System Snapshot at simulation time t

Arriv al Time 0 Generation of External Arrival Stream by Bootsrapping occur at future time t 1 2 3. n n+ 1 3. 7 4. 1 7. 4 t t *. CLO CK = Between successive arrival events, other types of events may occur, causing system state to change At simulated time t, assumed to be the instant of the nth arrival, generate interarrival time a*, compute t*= t + a* and schedule future arrival on FEL to a * Arriv al Time

Stopping a Simulation At time 0, schedule a stop simulation event at a specified future time TE. The simulation will run over the time interval [0, TE] Example: Simulate a shop for 8 hours Run length TE is determined by the simulation itself. TE is the time of occurrence of some event E. - Example: TE = time of the 100th service completion

3 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 1. the event-scheduling world view 2. the process-interaction world view 3. the activity-scanning world view. Particular simulation packages (e.g. Arena) usually support one of these world views.

Event Scheduling World Views Engineered for Tomorrow 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. 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.

Process Interaction World View Engineered for Tomorrow 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 En for Tomorrow 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. 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

3.1.3. Manual Simulation Using Event Scheduling (1) Entities : The server and customers Events : Arrival (A), Departure (D) Stopping event (E), scheduled to occur at time 60. System state (LQ(t), LS(t)) : LQ(t) is the number of customers in the waiting line LS(t) is the number being served (0 or 1) at time t (A, t ), representing an arrival event to occur at future time t (D, t ), representing a customer departure at future time t (E, 60), representing the simulation-stop event at future time 60. Activities : Interarrival time Service time Delay : Customer time spent in waiting line.

Manual Simulation Using Event Scheduling The interarrival times and service Initial conditions The system snapshot at time zero (CLOCK = 0) LQ(0) = 0, LS(0) = 1 both a departure event and arrival event on the FEL. The simulation is scheduled to stop at time 60. Server utilization : total server busy time (B) / total time (TE). a* : the generated interarrival time s* : the generated service times

3.1.3. Manual Simulation Using Event Scheduling (4)

Manual Simulation Using Event Scheduling Example 3.5 (The Dump Truck Problem) Traveling Loading Loader queue Weighing queue Scale First-Come First-Served First-Come First-Served The distributions of loading time, weighing time, and travel time are given in Tables The purpose of the simulation is to estimate the loader and scale utilizations (percentage of time busy).

3.1.3. Manual Simulation Using Event Scheduling (9) The activity times are taken from the following list as needed:

3.1.3. Manual Simulation Using Event Scheduling (10) System state [LQ(t), L(t), WQ(t), W(t)] LQ(t) = number of trucks in loader queue L(t) = number of trucks (0, 1, or 2) being loaded WQ(t) = number of trucks in weigh queue W(t) = number of trucks (0 or 1) being weighed, all at simulation time t Event notices :(ALQ, t, DTi ), dump truck i arrives at loader queue (ALQ) at time t (EL, t, DTi), dump truck i ends loading (EL) at time t (EW, t, DTi), dump truck i ends weighing (EW) at time t Entities : The six dump trucks (DT 1,, DT 6)

3.1.3. Manual Simulation Using Event Scheduling (11) Loader queue : all trucks waiting to begin loading, ordered on a first come, first served basis Weigh queue : all trucks waiting to be weighed, ordered on a first come, first served basis Activities : Loading time, weighing time, and travel time Delays : Delay at loader queue, and delay at scale It has been assumed that five of the trucks are at the loaders and one is at the scale at time 0.

3.1.3. Manual Simulation Using Event Scheduling (13) The utilizations are estimated as follows: average loader utilization average scale utilization 49 / 2 0.32 76 76 1.00 76 These estimates cannot be regarded as accurate estimates of the long-run steady-state utilizations of the loader and scale.

3.2 List Processing 3.2.1 List : Basic Properties and Operations (1) Head Pointer Event type Event type Event type Event type Event time Event time Event time Event time Any data Any data Any data Any data Next pointer Next pointer Next pointer Next pointer Record Record Record List : a set of ordered or ranked records. Record : one entity or one event notice. Tail Pointer Field : an entity identifier and its attributes : the event type, event time, and any other event related data

3.2.1 List : Basic Properties and Operations (2) How to store record in a physical location in computer memory in arrays : successive records in contiguous locations by pointers to a record : structures in C, classes in C++ The main operations on a list : Removing a record from the top of the list. when time is advanced and the imminent event is due to be executed. by adjusting the head pointer on the FEL by removing the event at the top of the FEL. Removing a record from any location on the list.

3.2.1 List : Basic Properties and Operations (3) The main operations on a list (Cont.) Adding an entity record to the top or bottom of the list. when an entity joins the back of a first-in first-out queue. by adjusting the tail pointer on the FEL by adding an entity to the bottom of the FEL Adding a record to an arbitrary position on the list, determined by the ranking rule. if a queue has a ranking rule of earliest due date first (EDF). by making a partial search through the list. The goal of list-processing techniques : to make second and fourth operations efficient

3.2.2 Using Arrays for List Processing (1) The notation R(i) : the ith record in the array Advantage Any specified record, say the ith, can be retrieved quickly without searching, merely by referencing R(i ). Disadvantage When items are added to the middle of a list or the list must be rearranged. Arrays typically have a fixed size, determined at compile time or upon initial allocation when a program first begins to execute.in simulation, the maximum number of records for any list may be difficult or impossible to determine ahead of time, while the current number in a list may vary widely over the course of the simulation run.

3.2.2 Using Arrays for List Processing (2) Memory address 100 101 102 103 104 105 106 107 108 109 110 1 2 3 4 5 7 8 9 10 adding 6 100 101 102 103 104 105 106 107 108 109 110 1 2 3 4 5 6 7 8 9 10 move move move move Two methods for keeping track of the ranking of records in a list to store the first record in R(1), the second in R(2), and so on, and the last in R(tailptr), where tailptr is used to refer to the last item in the list. a variable called a head pointer, with name headptr, points to the record at the top of the list.

3.2.3 Using Dynamic Allocation and Linked Lists (1) In procedural languages such as C and C++, and in most simulation languages, entity records are dynamically created when an entity is created and event notice records are dynamically created whenever an event is scheduled on the future event list. The languages themselves, or the operating systems on which they are running, maintain a linked list of free chunks of computer memory and allocate a chunk of desired size upon request to running programs. With dynamic allocation, a record is referenced by a pointer instead of an array index. A pointer to a record can be thought of as the physical or logical address in computer memory of the record.

Simulation in Java Single Channel Queue

Simulation in Java continued

Engineered for Tomorrow Self Check Exercise

What is discrete event simulation? Explain event scheduling algorithm by generating system snapshots at clock time T and clock time T1 with diagrams. Explain the concepts of discrete event simulation. Six dump trucks are used to have coal from entrance of a mine to a rail road. Each truck is loaded by one of the two loaders. After loading, a truck immediately moves to the scale, to be weighed as soon as possible. Both loader and scale have first come first served waiting line for trucks. Travel time from loader to scale is considered negligible. After being weighed, a truck begins travel time and then afterwards returns to loader queue. The activities of loading, weighing and travel time are given in below table:

End of simulation is 40 minutes of completion of weighing from scale. Depict simulation table and estimate loader and scale utilizations. Assume that 5 trucks are at loaders and one truck is at scale at time 0. Draw the flowchart of the execution of the arrival event & departure event for a single channel queue using event scheduling. What do you mean by world view? Briefly explain different types of world view. Explain in detail about List Processing. Explain about simulation in GPSS. Explain in detail about the concepts of discrete event simulation Simulate the grocery counter problem using manual simulation using event scheduling with the following data.

Engineered for Tomorrow Summary

The concepts in simulation are System, Model System state, Entity Attribute, List, Event, Event Notice etc. Different types of simulation models are : Stochastic Model - a stochastic simulation model contains random variables Static Model - a static simulation model is a representation of a system at a particular point in time. Dynamic Model - a dynamic simulation is a representation of a system as it evolves over time. Future Event List FEL: contains all the notices for events scheduled to occur at a future time At any given time (t), the FEL contains all previously scheduled future events and their associated event times, e.g.: t1, t2, t3,, etc. See Fig. The FEL is ordered by event time, i.e. events are arranged chronologically so that the event time satisfies