Object Oriented Discrete-Event Simulation with OOSimL Fall 2015 Dr. José M. Garrido Department of Computer Science College of Computing and Software Engineering.

Slides:



Advertisements
Similar presentations
Network II.5 simulator ..
Advertisements

Database System Concepts and Architecture
Introduction into Simulation Basic Simulation Modeling.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Lecture 3 Concepts of Discrete-Event Simulation. 2 Discrete Event Model  In the discrete approach to system simulation, state changes in the physical.
Introduction To System Analysis and Design
Chapter 3 Simulation Software
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
Fall 2007CS 225 Introduction to Software Design Chapter 1.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Simulation.
Simscript II.5 Building simulation model with SIMSCRIPT II.5.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Simulation Waiting Line. 2 Introduction Definition (informal) A model is a simplified description of an entity (an object, a system of objects) such that.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
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:
Modeling and Simulation
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Introduction To System Analysis and design
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
The Design Discipline.
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 Validation & Verification Chapter VALIDATION & VERIFICATION Very Difficult Very Important Conceptually distinct, but performed simultaneously.
1 Performance Evaluation of Computer Networks: Part II Objectives r Simulation Modeling r Classification of Simulation Modeling r Discrete-Event Simulation.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
An Introduction to Software Architecture
1 OM2, Supplementary Ch. D Simulation ©2010 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible.
Introduction To System Analysis and Design
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.
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.
Chapter 2 – Fundamental Simulation ConceptsSlide 1 of 46 Chapter 2 Fundamental Simulation Concepts.
CSC480 Software Engineering Lecture 11 September 30, 2002.
Modeling and Simulation Discrete-Event 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.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
Chapter 2 Fundamental Simulation Concepts
Reid & Sanders, Operations Management © Wiley 2002 Simulation Analysis D SUPPLEMENT.
Object Oriented Discrete-Event Simulation CS4730 Fall 2010 Jose M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
OBJECT ORIENTED AND FUNCTION ORIENTED DESIGN 1 Chapter 6.
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,
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
Synchronous Process Cooperation Object Oriented Simulation with OOSimL Chapter 26 (C) J. M. Garrido1.
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.
Advantages of simulation 1. New policies, operating procedures, information flows and son on can be explored without disrupting ongoing operation of the.
 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,
Simulation Examples And General Principles Part 2
Introduction to Modeling & Simulation Dr. A. K. Dey Third Lecture
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.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
OPERATING SYSTEMS CS 3502 Fall 2017
OPERATING SYSTEMS CS 3502 Fall 2017
Modeling and Simulation (An Introduction)
OPERATING SYSTEMS CS3502 Fall 2017
ADVANTAGES OF SIMULATION
An Introduction to Software Architecture
From Use Cases to Implementation
Presentation transcript:

Object Oriented Discrete-Event Simulation with OOSimL Fall 2015 Dr. José M. Garrido Department of Computer Science College of Computing and Software Engineering Kennesaw State University

(C) 2012 J. M. Garrido Definitions Review System a collection of entities that act and interact together toward the accomplishment of some logical end Model a descriptive, functional, or physical representation of a system 2

(C) 2012 J. M. Garrido Simulation Simulation is the activity of: Developing a model of a real or imagined system Conducting experiments with the model – running the model 3

(C) 2012 J. M. Garrido Overview of a Simulation Study Understand the system Clearly state the goals of the simulation study Formulate the model representation Design the conceptual model Construct the simulation model with modeling software Verify the simulation model Validate model Design experiments; simulation runs Analyze, get insight, document results 4

Simulation Model Development Process (C) 2012 J. M. Garrido5

Applications of Simulation As an aid to thought As an aid to communication For purposes of training and instruction As a tool for prediction As an aid to experimentation S. E. Elmahraby Journal of Industrial Engineering,

(C) 2012 J. M. Garrido Applications of Simulation (cont.) Allow to ask what-if questions Does not provide a definitive answer provides a probability of outcome result only as good as the model 7

(C) 2012 J. M. Garrido Simulation Application Examples Wargaming Stock market Weather prediction Computational fluid dynamics Traffic management Manufacturing Computer Systems Computer networks Security Astrophysics Molecular dynamics Business enterprise Equipment training 8

(C) 2012 J. M. Garrido Conceptual Models Description of the system, including its goals This results from the analysis phase of the development process UML and other modeling notations are used to describe structure and behavior of a model 9

(C) 2012 J. M. Garrido Conceptual and Simulation Models 10

(C) 2012 J. M. Garrido Simulation Model Built from the conceptual model of a system. Implemented in an appropriate programming or simulation language. Is needed to mimic the behavior of the real system under certain constraints. 11

(C) 2012 J. M. Garrido Development of Simulation Models Two main objectives: To study some relevant aspects in the dynamic behavior of a system To estimate various performance measures of the system 12

(C) 2012 J. M. Garrido Simulation Run A simulation run is an experiment carried out for some observation period using the simulation model to study (predict) the behavior of the system. 13

(C) 2012 J. M. Garrido Behavior of a Simulation Model Depends on: The passage of time Input data Events generated by the environment 14

(C) 2012 J. M. Garrido Types of Models Physical models Graphic models Mathematical models Other kinds of models 15

(C) 2012 J. M. Garrido Stochastic Models A stochastic model includes some uncertainty in its behavior. One or more attributes change value according to probability distribution. Random variable generation is used. For example, in the carwash model: arrival of cars service time for a car 16

(C) 2012 J. M. Garrido Continuous and Discrete Models Continuous models change their state continuously with time. Mathematical notation is used to completely define the behavior. For example, the free-falling object. Discrete models only change their state at discrete instants. For example, the carwash model. 17

(C) 2012 J. M. Garrido Discrete Model Consider the simple carwash model, its dynamic behavior is defined by: When an arrival event occurs, the model changes state. When a service completion occurs, the model also changes state. 18

(C) 2012 J. M. Garrido Queue Size in the Carwash Model Example of a state variable 19

(C) 2012 J. M. Garrido Continuous Model 20

(C) 2012 J. M. Garrido Simula The SIMULA language was developed by Ole- Johan Dahl and Kristen Nygaard at the Norwegian Computing Center (NCC) in Oslo around Simula was the first language to introduce the concepts of classes and objects. The language also introduced the idea of prefixing and subclasses. The key concepts have evolved since then and have been implemented in most modern OO programming languages. 21

(C) 2012 J. M. Garrido DEMOS Demos was developed by Graham Birtwistle and extends Simula It is a library of standard process synchronization facilities for data collection, random number generation, tracing and automatic reporting. 22

(C) 2012 J. M. Garrido SIMULA and DEMOS The Demos package added more powerful simulation facilities to the Simula language. Simula and Demos have not become widely used, despite the significant contribution to object orientation and simulation. 23

(C) 2012 J. M. Garrido SmallTalk In the early 1970’s, Alan Kay and his group at Xerox PARC used Simula as a platform for their development of Smalltalk. Their development extended object-oriented programming importantly by the integration of graphical user interfaces (GUI) and interactive program execution. 24

(C) 2012 J. M. Garrido C++ and Other OO Languages In the mid 1980’s, Bjarne Stroustrup started his development of C++ by bringing the key concepts of Simula into the C programming language. Other object-oriented programming languages such as Eiffel, CLOS, Java, and others, were also influenced by Simula. 25

(C) 2012 J. M. Garrido Important Quotes “Simulation is one of the most powerful techniques available for the study, design, and operation of complex systems” (R. Shannon). “Mathematical modeling is essentially a conceptual way of thinking” (L. Schruben) “... the task of modeling a system is in itself worthwhile …” (L. Schruben) 26

(C) 2012 J. M. Garrido Simulation in Education Modeling and Simulation is an important part of the Computing curriculum. In object-oriented simulation, students Apply understanding of OO concept when modeling, i.e. building the conceptual model Implementing a simulation model in an OOP language. 27

(C) 2012 J. M. Garrido Simulation in Education (2) Use of OO packages in teaching object- oriented simulation reinforces object-oriented design and programming in Java. Students have learned OO programming principles using Java in introductory courses OO simulation exposes students in programming in the large Students have taken courses in systems analysis and design using UML for modeling 28

(C) 2012 J. M. Garrido Simulation Software Tools At KSU, the following general tools are available to all students and faculty: Arena simulation software (academic version) Psim3, a C++ simulation package PsimJ2, a Java simulation package jGRASP & Eclipse integrated development environments (IDE) The new OOSimL Object Oriented Simulation Language, part of the OOPsim project 29

(C) 2012 J. M. Garrido OOPsim Project The main purpose of OOPsim project is to investigate improved methods and tools for the education of object oriented modeling and process approaches to discrete-event simulation. Provide open access to the software and documentation for educational and research purposes 30

(C) 2012 J. M. Garrido OOPsim Simulation Project Started in 1996 with the Psim simulation package in C++ Enhanced in 1999 (Psim2) Re-implemented in Java in 2000 (PsimJ) Enhanced and updated in 2002 and 2003 Psim3, new version C++ redesigned using POSIX Pthreads, in

(C) 2012 J. M. Garrido PsimJ2 Simulation Package A portable library package of Java classes Object-oriented modeling Supports the process interaction approach Java threads are used to implement the active objects in the simulation models 32

(C) 2012 J. M. Garrido MODSIM III & Simscript III (CACI) Commercial OO simulation languages Object-oriented Supports process-based discrete event simulation Modsim III No longer supported 33

(C) 2012 J. M. Garrido Downloading PsimJ2, OOSimL, and Sample Models Free for educational and research purposes Download from the following URL: ksuweb.kennesaw.edu/~jgarrido/psim.html 34

Simulation Language The advantages and disadvantages of an object-oriented simulation programming language compared to an integrated icon- based simulation tool are: Flexibility and Power of the simulation language May be more difficult to use than an integrated simulation tool. (C) 2012 J. M. Garrido 35

Other Advantages The OOSimL language also supports further research in: simulation languages, developing Simulation Modeling Specification Languages for relevant family of systems, higher-level DEVS support, advanced Cellular and Component Simulation modeling, the next generation of Distributed and Parallel Simulation Languages, and other related areas of research. The language supports the application of simulation in industry; it provides a viable and short transition to current commercial simulation (programming) languages such as Simcript III. (C) 2012 J. M. Garrido 36

(C) 2012 J. M. Garrido System Components Active (or live ) components: the processes. These are the major components in a model, and have a life of their own. Passive components: Explicit and implicit queues Resources that can be acquired by the processes. 37

(C) 2012 J. M. Garrido Using A Simulation Model A user must be allowed to: Manipulate the model by supplying it with a set of inputs Observe its behavior or output Predict the behavior of the real system by analyzing the behavior of the model 38

(C) 2012 J. M. Garrido Supporting Software The simulation executive. The program that controls every simulation. The set of utility functions for housekeeping tasks. Reporting simulation trace and output statistics 39

(C) 2012 J. M. Garrido Facilities Provided by Simulation Software Maintain the sequence of event records (pairs of event and event time) Provide mechanisms for the generation and cancellation of event records Maintain the simulation clock Provide functions to generate random numbers from common probability distributions 40

(C) 2012 J. M. Garrido The Time Dimension Simulation time, the time referenced by executing simulation models. This time is advanced by: Fixed time increments Variable time increments (event scan) Run time, the absolute time referenced by the OS while a program executes. 41

(C) 2012 J. M. Garrido World View with Discrete-Event Simulation Event approach Activity approach Process interaction approach 42

(C) 2012 J. M. Garrido The Process Interaction A simulation model consists of a description of how processes (active entities) are going to interact among themselves, as time passes. Also includes a description of passive objects A simulation run consists of creating and starting the processes interacting among themselves, synchronizing and using resources. 43

(C) 2012 J. M. Garrido Advantages of the Process Style of Simulation Compatible with the Object-Oriented approach to modeling and programming, every process is an active object. Suitable for modeling large and complex systems. C++, Java and any higher-level object- oriented simulation language are used to implement the models. 44

(C) 2012 J. M. Garrido Processes Processes are active objects implemented as threads in Java and C++. The main body in a thread consists of a set of instructions and calls to various functions (or methods) The general behavior of a thread is defined in class Process of the OOsimL language. 45

(C) 2012 J. M. Garrido Process View Static Process Description Dynamic Process Management Initiate Process Delay (Time) Process Suspend Process Activate Process Terminate Process 46

(C) 2012 J. M. Garrido Resource View Standard/Tailored Resource Handler Resource Management Create resource Request resource Acquire resource Release resource Status of resource Destroy resource 47

(C) 2012 J. M. Garrido Simulation Executive Schedule processes at particular instants, i.e., place processes in the event list Remove processes from the event list ( to make them idle or to terminate them) Re-schedule processes, i.e., change position of processes in the event list. Execute the “running” process. 48

(C) 2012 J. M. Garrido The Simulation Executive 49

(C) 2012 J. M. Garrido Threads A thread is an independent execution sequence of an application that may interact with other threads A thread is executed and controlled by the simulation executive The threads of a model are executed concurrently 50

(C) 2012 J. M. Garrido Threads Simulation models implemented in OOSimL use oosimlib, an extended version of the PsimJ2 simulation package PsimJ2 and OOSimL use Java threads Basically, class Process inherits class Thread Psim3 and C++ version of OOSimL use Pthreads 51

(C) 2012 J. M. Garrido Using PsimJ2 with Java Every simulation model defines a set of classes that will be instantiated appropriately The classes that represent processes inherit class Process, which inherits class Thread The other classes defined are used to create passive objects. 52

(C) 2012 J. M. Garrido Simulation Packages SimPack and Sim++ GPSS/V & GPSS/H CSIM Gasp SLAM Simple++ Taylor II SimJava Arena Extend AweSim iThink Simul8 53

(C) 2012 J. M. Garrido Simulation Packages in Java JavaSim JSIM DESMO-J Simjava Silk PsimJ2 54

(C) 2012 J. M. Garrido Simulation Languages Simula GPSS Simscript 2.5 Modsim III Simscript III OOSimL 55

(C) 2012 J. M. Garrido Overview - Levels of Abstraction In modeling a system, different levels of abstraction are used to describe the system The most abstract level is at the top (high), and it is the easiest to understand The most difficult level of abstraction is the implementation level, i.e., the programming of the model into a suitable simulation programming language. 56

(C) 2012 J. M. Garrido Overview (cont.) Together with abstraction, the object-oriented approach is applied to deal with complexity, at all levels of abstraction Java and C++ are high level OO programming languages and are convenient and powerful to implement simulation models A simulation language is considered higher- level 57

(C) 2012 J. M. Garrido Process Interaction Simulation The major components in a model are active and passive entities The active entities are called processes and have a life of their own The passive entities are resources and queues The processes interact among themselves and use resources 58

(C) 2012 J. M. Garrido59

(C) 2012 J. M. Garrido The OOSimL Simulation Language A general-purpose simulation language that supports: The object-oriented approach to modeling and the process interaction approach to discrete- event simulation Higher-level simulation modeling 60

(C) 2012 J. M. Garrido OOSimL The purpose of this language and software tool is to support early introduction to Abstraction Object-oriented modeling Logic Discrete-event simulation Other software concepts. 61

(C) 2012 J. M. Garrido An OO Simulation Language The simulation modeling in OOSimL follows the philosophy of Simula and Demos. The OOSimL compiler carries out syntax checking and automatically generates an equivalent Java program. 62

(C) 2012 J. M. Garrido Using the OOSimL The OOSimL (Java) software consists of: The OOSimL compiler, oosiml.exe The run-time library, oosimlib.jar There are two general procedures for developing programs and models using the OOSimL compiler: In an integrated development environment (IDE), such as jGRASP and Eclipse. The OOSimL Web page includes instructions on how to configure and use the IDEs to compile and run OOSimL programs In a Command window on Windows or in a Terminal window on Linux 63

(C) 2012 J. M. Garrido Modeling with OOSimL Models implemented with OOSimL can be easily be integrated with Java libraries. The language supports the reuse of Java components. A dynamic system is modeled as a set of interacting processes. A process is implemented as a thread object. The other components of a system are modeled as conventional (passive) objects. 64

(C) 2012 J. M. Garrido Simulation Facilities in OOSimL Includes language statements for manipulating processes: Timing, Sequencing, Synchronization 65

(C) 2012 J. M. Garrido Language Simulation Features Definition of processes. Starting of a simulation run that will execute for a predetermined period, called the simulation period. Definition of various queues that are used in the simulation models. Definition of resource pools as passive objects. Generation of random numbers, each with its own probability distribution. 66

(C) 2012 J. M. Garrido More Information on OOSimL For download information on OOSimL, refer to the following URL: ksuweb.kennesaw.edu/~jgarrido/psim.html 67

(C) 2012 J. M. Garrido The Structure of a Model Definition of all classes for the various active objects (processes) These classes inherit the library class Process. Definition of the class (model class) for the process that represents the model Method main with instructions that starts the simulation 68

(C) 2012 J. M. Garrido The Main Class in a Model Every model includes a main class (the model main class). In method main: Assigns the values for the relevant simulation parameters Set up Simulation with the title of the model. Create all the passive objects used in the model. Create and start the main active object 69

(C) 2012 J. M. Garrido Main Body In method Main_body of the main class Create and start the other active objects (processes) of the model Start the simulation, then calculate and output the summary statistics. 70

General Class Structure class as process is private, protected, public data definitions private, protected, public methods endclass (C) 2012 J. M. Garrido 71

(C) 2012 J. M. Garrido class Server as process is private // private data definitions protected // protected data definitions public // public data definitions // private, protected, and public methods endclass Server General Structure of a Class 72

(C) 2012 J. M. Garrido Data Definitions Data must be defined in the following order: Constants Variables Object references 73

(C) 2012 J. M. Garrido OOSimL Data Definition Examples // data definitions constants define NUM = 45 of type integer variables define machine_name of type string define acc_time of type double... object references define machine of class Server define custobj of class Customer 74

(C) 2012 J. M. Garrido Methods or Functions function initializer parameters serv_name of type string is begin call super using serv_name... endfun initializer // function Main_body is... begin... call get_name of machine return value to machine_name... endfun Main_body // other public members 75

(C) 2012 J. M. Garrido Setting Up and Starting a Simulation define simperiod = of type double... define run of class Simulation... simulation title “Carwash Model"... start simulation with simperiod 76

(C) 2012 J. M. Garrido Hold (delay) a Process The following lines of code hold the execution of the current process for a time interval, task_dur. define task_dur of type double... hold self for task_dur hold self for

(C) 2012 J. M. Garrido Queuing Models Models that include at least one queue The queue is a data structure that stores waiting customers The server removes from the queue the next customer to service 78

Carwash Model – Single-server (C) 2012 J. M. Garrido 79

(C) 2012 J. M. Garrido Basic Categories of Queuing Models Single-server models Multi-server models Queuing networks Multi-server, multi-queue with priorities Multi-server, multi-queue with priorities and preemption. 80

(C) 2012 J. M. Garrido Examples of Queuing Models Computer systems Communication systems, networks Teller facilities in a bank Production systems Transport and materials handling Repair and maintenance systems 81

(C) 2012 J. M. Garrido Service Stations A queuing model consists of a number of facilities and interconnecting queues. Each facility, or service station, consists of one or more servers. For these types of systems, it is very common in practice to use exponentially distribution for inter-arrival periods and for service periods. 82

(C) 2012 J. M. Garrido Multiple Servers Single Queue Any of the servers available can provide service demanded by a customer A server removes the next customer from the head of the customer queue One or more servers can be idle, waiting for customers to arrive 83

(C) 2012 J. M. Garrido Carwash Model With Multiple Machines 84

(C) 2012 J. M. Garrido General Description of the Model This model has K machines (servers) A customer can receive service from any machine (any server) A customer waits in the customer queue until it is at the head of the queue and a machine becomes available The machine removes the customer from the head of the queue and starts to service it 85

(C) 2012 J. M. Garrido Idle Servers Idle servers are organized in a server queue A server joins a queue of idle servers if there are no customers An arriving customer enters the input queue and reactivates the server at the head of the server queue. If there are no servers available, the customer just waits 86

(C) 2012 J. M. Garrido Models With Multiple Servers and Multiple Queues 87

(C) 2012 J. M. Garrido Multi-Server Multi-Queue Model Every server has its own queue of customers An arriving customer selects the server with the smallest queue Alternatively, an arriving customer randomly selects a server. 88

(C) 2012 J. M. Garrido Multi-Server Multi-Queue Model with Preemption Every customer has a priority An arriving customer can interrupt the service of another customer with a lower priority the interrupted customer is returned to its queue, this customer is the one with the lowest priority and that started most recently. 89

(C) 2012 J. M. Garrido Performance Measures The average number of customers in the system The average number of customers in the queue(s) (i.e., that are waiting) The average time that a customer spends in the system The average time that a customer spends in the customer queue waiting The server(s) utilization 90

(C) 2012 J. M. Garrido Queuing Networks Consists of two or more interconnected stations Each station provides a different service The output from a station are connected to input of another station Each station has one or more servers and its queues 91

(C) 2012 J. M. Garrido Service in a Queuing Network Customers enter the network at any of several entry stations Customers are routed through the network demanding service from different stations Customers can exit from any of several exit stations 92

(C) 2012 J. M. Garrido A Queuing Network 93

(C) 2012 J. M. Garrido Models With Priorities Customers are grouped into classes or types Each customer class has its own priority, and workload parameters (e.g., arrival rate and a service demand) The customers wait in a priority queue, with highest priority closest to the head A server removes the customer with the highest priority from the queue 94

(C) 2012 J. M. Garrido Examples Medical service systems Computer communication networks Operating systems Car-wash systems for different types of vehicles 95

(C) 2012 J. M. Garrido Priority Queue A queue that stores customers by priority The queue discipline is ordering of the customers by priority Customers with the highest priority are always at the head of the queue 96

(C) 2012 J. M. Garrido Model With Priorities 97

(C) 2012 J. M. Garrido Priority Queues in OOSimL To declare a priority queue, use class Pqueue: define car_queue of class Pqueue // for car objects To create object car_queue (passive object) with K different priorities: create car_queue of class Pqueue using “Car Queue”, K In OOSimL, the highest priority is 0 98

(C) 2012 J. M. Garrido Priorities For the Car Objects There is an arrivals object for every customer class Each arrivals object creates car objects for the corresponding priority A car object gets its priority when created (in the constructor) A car object joins the corresponding priority queue to wait for service 99

(C) 2012 J. M. Garrido Defining and Using Car Priority The constructor in class Car: function initializer parameters cname of type string, ctype of type integer, servdur of type double is … set my_priority = ctype; // assign priority to car process fix priority my_priority In the Main_body of class Car: // this object joins the priority queue insert self into car_queue 100

(C) 2012 J. M. Garrido Results of a Simulation Run Two text files are normally generated by a simulation run: The trace file, which is the sequence of events that occur during the simulation run The statistics file that include performance measures for every priority: Throughput Average wait period other measures 101

(C) 2012 J. M. Garrido Multi-Server Model with Priorities Every customer has a priority and joins the priority queue An server gets the customer from the queue with highest priority If there are no customers, and server joins a server queue and becomes idle 102

(C) 2012 J. M. Garrido Multiple Servers With Priority 103

(C) 2012 J. M. Garrido Verification & Validation 104

(C) 2012 J. M. Garrido Questions? 105