Object Oriented Simulation with OOSimL Conditional Waiting.

Slides:



Advertisements
Similar presentations
Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
Advertisements

Many useful applications, especially in queueing systems, inventory management, and reliability analysis. A connection between discrete time Markov chains.
Parallel and Distributed Simulation
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
Chapter 22 Simulation with Process Model to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004.
Simscript II.5 Building simulation model with SIMSCRIPT II.5.
© 2004 by Prentice Hall, Inc., Upper Saddle River, N.J F-1 Operations Management Simulation Module F.
Parallel and Distributed Simulation Object-Oriented Simulation.
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-1 Day 2 Section 3 - Introduction to Process Simulation –Modeling.
1 Ardavan Asef-Vaziri Sep-09Operations Management: Waiting Lines3  Terminology: The characteristics of a queuing system is captured by five parameters:
Chapter 9: Queuing Models
Fundamentals of Python: From First Programs Through Data Structures
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
The Poisson Process. A stochastic process { N ( t ), t ≥ 0} is said to be a counting process if N ( t ) represents the total number of “events” that occur.
Modeling Detailed Operations, Part II
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 Queueing Systems.
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.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.
6.3 Peterson’s Solution The two processes share two variables: Int turn; Boolean flag[2] The variable turn indicates whose turn it is to enter the critical.
Chapter 2 – Fundamental Simulation ConceptsSlide 1 of 46 Chapter 2 Fundamental Simulation Concepts.
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
2-Jun-16EE5141 Chapter 3 ä The concept of the signal ä Process concurrency ä Delta time ä Concurrent and sequential statements ä Process activation by.
Parallel and Distributed Simulation Process Oriented Simulation.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
Threaded Programming in Python Adapted from Fundamentals of Python: From First Programs Through Data Structures CPE 401 / 601 Computer Network Systems.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 5A Repetition (Concepts)
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 24 Critical Regions.
Synchronous Process Cooperation Object Oriented Simulation with OOSimL Chapter 26 (C) J. M. Garrido1.
1 Ardavan Asef-Vaziri Sep-09Operations Management: Waiting Lines3 Example: The arrival rate to a GAP store is 6 customers per hour and has Poisson distribution.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
(C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.
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.
1 1 Slide Chapter 12 Waiting Line Models n The Structure of a Waiting Line System n Queuing Systems n Queuing System Input Characteristics n Queuing System.
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
Object Oriented Simulation with OOSimL Models with Resources Fall 2015.
Parallel and Distributed Simulation Process Oriented Simulation.
Queuing Models.
Mohammad Khalily Islamic Azad University.  Usually buffer size is finite  Interarrival time and service times are independent  State of the system.
Second Model: “Model2”. What You Will Learn  How to build a simple layout  How to connect ports for routing flowitems  How to detail and enter data.
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
Multithreading / Concurrency
Threaded Programming in Python
IAY 0600 Digitaalsüsteemide disain
ADVANTAGES OF SIMULATION
Chapter 9: Queuing Models
Chapter 10 Verification and Validation of Simulation Models
UML Sequence Diagrams.
Chapter 3 Introduction to Classes, Objects Methods and Strings
Monitors Chapter 7.
Parallel and Distributed Simulation
Simulation An Application of Queue ADT
6 Chapter Functions.
Multithreading.
An introduction to UML 2 for modelling communications
Defining Classes and Methods
Monitors Chapter 7.
Threaded Programming in Python
Mitchell Jareo MAT4340 – Operations Research Dr. Bauldry
Discrete Event “Hand” Simulation of a GI/GI/1 Queue
Monitors Chapter 7.
Defining Classes and Methods
Multithreading in java.
Presentation transcript:

Object Oriented Simulation with OOSimL Conditional Waiting

Feb Conditional Waiting One or more processes wait for a condition to become true. Waiting processes are suspended and automatically placed in a queue. A suspended process will be reactivated when another process changes the condition.

Conditional Waiting The processes involved use the synchronization mechanism implemented in a synchronization conditional object This synchronization object suspends and later reactivates the interacting processes. The synchronization object evaluates the specified condition on behalf of a process Feb. 2015

Evaluating the Condition If the condition is not true, the process is suspended by the synchronization object and placed in the condition queue. Suspended processes are held in the condition queue that belongs to the synchronization object. Another process, which changes the parameters of the condition, will signal the synchronization object and it reactivates any waiting processes. Feb. 2015

Synchronization Object The mechanism that controls conditional waiting synchronization is implemented in class Condq An object of class Condq is a passive object and includes an internal queue to hold waiting processes An object of class Condq is needed for each condition.

Feb UML Diagram With Conditional Wait

Feb Two Processes and Conditional Waiting

Feb Declaring and Creating an Object of Class Condq To use a conditional object of class Condq, the object reference must be declared and the object created with title and the optional number of priorities to use. The default number of priorities is 250. define cond_cust of class Condq... create cond_cust of class Condq using "Customer Cond”, priorities

Feb Waituntil Statement A Process tests a condition by executing the waituntil statement, and if the condition is not true, is suspended and placed in the condition queue waituntil in

Example of ‘waituntil’ define mcond of type boolean... set mcond = false while mcond not equal true do // evaluate boolean expression set mcond = (att1 > 3 ) and (att2 <= att1) waituntil mcond in cond_cust endwhile // now acquire resources // hold for a specified time interval // release resources Feb. 2015

Signal Statement A process that changes the condition, execute the signal statement to reactivate waiting process at the head of the queue A reactivated process will re-evaluate the condition signal to

Feb Length of Conditional Queue The assign length statement, gets the number of processes waiting in the conditional queue of the specified Condq object, and assigns it to the specified integer variable. define cond_num of type integer... assign length of cond_cust to cond_num

Feb Conditional Port System Ships arrive periodically at a port to unload their cargo To dock, ships require the following resources: a pier and two tugboats To leave, ships require one tugboat Ships can only dock if the tide is high The tide changes every 13 hours, and lasts for 4 hours.

Feb Processes and Resources in the Port System There are four types of processes Ships, with several instances Arrivals, one instance Tide, with only one instance Cport, the top class The resource types are: Tugboats Piers

Feb Conditions in the Port System The condition for ships to dock is: a pier and two tugboats available the tide is not low. The tide remains low for 4 time units. The cycle continuously repeats.

Feb Ships Behavior 1. First acquire a pier, if there any available 2. Evaluate the condition for tide not low and enough tugs available 3. Wait suspended if condition is not true 4. Continue 5. Acquire the necessary tugs for docking 6. Unload, which takes a finite time interval 7. Acquire 1 tugboat for undocking and departure.

Feb Timings for the Simulation Inter-arrival time of ships follows an exponential distribution with mean of 26.0 minutes. Docking time is constant: 32.5 minutes. Unloading follows a normal distribution: mean time is 74.0 minutes with a standard deviation of 8.0 minutes. Undocking time interval is constant: 25.0 time units.

Feb Tide Behavior and Condition Changes The tide is modeled as a process When the tide changes state, the evaluation of the condition also changes When the tide changes to high, this process invokes the signal method of the conditional object, so ships can re-evaluate the condition

Main Body of Tide while clktime < simperiod do set lowtide = true hold self for 4.0 set lowtide = false signal to cond_obj hold self for 9.0 endwhile Feb. 2015

Condition Changes When a ship process releases resources, this event may also cause a change of the condition. The ship process executes the signal statement.

Feb Implementation The Conditional Port model is archived in file cport.jar The classes of this model are stored in files: Cport.osl, Arrivals.osl, Ship.osl, and Tide.osl.

Feb Partial Output of a Simulation Run End Simulation of Port System with Conditions date: 10/13/2014 time: 7:16 Total number of ships that arrived: 27 Average wait period: 123.5