—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-1 Day 2 Section 3 - Introduction to Process Simulation –Modeling.

Slides:



Advertisements
Similar presentations
Discrete Event (time) Simulation Kenneth.
Advertisements

Parallel and Distributed Simulation
—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 3-1 Day 2 Section 3 - Introduction to Process Simulation –Modeling.
—————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-1 Day 5 Section 9 - Continuous Simulation –Exercise 9 Section.
 Basic Concepts  Scheduling Criteria  Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Waiting Lines Example-1
F Day 3 Section 5 - Event Approach to Simulation Events
—————————— CACI Products Company ——————————————————————————————— SimScript II.5 —————————————— 5-1 Day 3 Section 5 - Event Approach to Simulation –Events.
—————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-1 Day 5 Section 9 - Contiuous Simulation –Exercise 9 Section.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
—————————— CACI Products Company ———————————————————————————— SimScript II.5 —————————————— 8-1 Day 4 Section 7 - Simulation Control –User Interface Forms.
—————————— CACI Products Company ———————————————————————————— SimScript II.5 —————————————— Day 1, Section 1 Problem Solution C:\Program Files\Simscript3\models\READFILE2.
Components and Organization of Discrete-event Simulation Model
—————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 2-1 Day 1 Section 1 - The General Purpose Language –Overview.
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.
—————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 1-1 Day 1 Section 1 - The General Purpose Language –Introduction.
CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT Class Location:
SIMSCRIPT1 Modeling and Simulation in SIMSCRIPT II.5 A complete, modern, general purpose programming language –English like syntax is self documenting.
Lab 01 Fundamentals SE 405 Discrete Event Simulation
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:
Efficient Scheduling of Heterogeneous Continuous Queries Mohamed A. Sharaf Panos K. Chrysanthis Alexandros Labrinidis Kirk Pruhs Advanced Data Management.
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
Simulation Examples ~ By Hand ~ Using Excel
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
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.
1 QUEUES. 2 Definition A queue is a linear list in which data can only be inserted at one end, called the rear, and deleted from the other end, called.
Dept. Computer Science, Tianjin Uni. 系统仿真 System Simulation 2008.
Chapter 2 – Fundamental Simulation ConceptsSlide 1 of 46 Chapter 2 Fundamental Simulation Concepts.
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.
NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly.
1 Simulation Implementation Using high-level languages.
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
Object Oriented Simulation with OOSimL Conditional Waiting.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
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.
COMP155 Computer Simulation September 10, Discrete Event Simulation  discrete event simulation: state variable change only at a discrete set of.
4330/6310 FIRST ASSIGNMENT Spring 2015 Jehan-François Pâris
Simulation Examples And General Principles Part 2
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
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
CPU SCHEDULING.
Dan C. Marinescu Office: HEC 439 B. Office hours: M, Wd 3 – 4:30 PM.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Module 5: CPU Scheduling
Operating System Concepts
Java Programming Arrays
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Repetition Structures
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Discrete Event “Hand” Simulation of a GI/GI/1 Queue
Uniprocessor scheduling
Modeling and Simulation in SIMSCRIPT II.5
Chapter 6: CPU Scheduling
Chapter 4: Simulation Designs
Module 5: CPU Scheduling
CSCS-200 Data Structure and Algorithms
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
SIMSCRIPT SIMSCRIPT is a general-purpose simulation language
Presentation transcript:

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-1 Day 2 Section 3 - Introduction to Process Simulation –Modeling the Passage of Time –Processes –Randomness –Exercise 3 Section 4 - Process Simulation II –Time –Resources –Implementation of the Process Approach –Exercise 4 

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-2 Section 4 - Process Simulation II Part 1 - Time

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-3 Time Activate must have a time phrase (Outside the Preamble) Activate a DEPARTURE at 8 Activate a DEPARTURE in 20 minutes Activate a DEPARTURE now Wait (and its synonym, Work) must have a time phrase Wait 10 minutes Nothing else has a time phrase: you have to carry that in your head Let.UNLOADING.TIME = 21 ''hours

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-4 Time (continued) Time.v is a double precision variable which represents the simulation clock. The simulation clock, time.v, advances in time by units. Units default to days. SIMSCRIPT II.5 recognizes days, hours, minutes. Wait 2 days Wait 48 hours Wait 2880 minutes hours.v = 24 minutes.v = 60 All calculations done in days (i.e. units) Wait 48 hours Let time.a(process notice) = 48/hours.v + time.v

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-5 Time (continued) You can change units In Preamble Define MILLISECONDS to mean days Define MICROSECONDS to mean hours Define NANOSECONDS to mean minutes Outside of Preamble Let hours.v = 1000 Let minutes.v = 1000 Wait 32 nanoseconds You can add units Define PICOSECONDS to mean /1000 NANOSECONDS Wait picoseconds

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-6 Time (continued) Define MILLISECONDS to mean units Define MICROSECONDS to mean /1000 MILLISECONDS Define NANOSECONDS to mean / MILLISECONDS Wait 100 MICROSECONDS Wait 100 /1000 MILLISECONDS Wait 0.1 Units

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-7 Time (continued) Define minutes to mean units Define minute to mean units Be careful about redefining hours or minutes as units hours.v and minutes.v still apply and may have to be adjusted

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-8 This page is intentionally blank

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-9 Section 4 - Process Simulation II Part 2 - Resources

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-10 Resources Resources are variants of permanent entities Preamble Resources include RUNWAY.GROUP End ''Preamble Routine INITIALIZE.RESOURCES Create every RUNWAY.GROUP(2) Let U.RUNWAY.GROUP (1) = 2 Let U.RUNWAY.GROUP (2) = 3 End ''INITIALIZE.RESOURCES

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-11 Using Resources Process AIRPLANE... Request 1 RUNWAY.GROUP(2) Wait 2 minutes Relinquish 1 RUNWAY.GROUP(2)... End ''AIRPLANE

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-12 More Details on Resources Each type of resource has a total number of units (servers) of that type available and two sets U.RUNWAY.GROUP(type) Q.RUNWAY.GROUP(type)N.Q.RUNWAY.GROUP(type) X.RUNWAY.GROUP(type)N.X.RUNWAY.GROUP(type)

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-13 More Details on Resources (continued) Multi-Queue, Multi-ServerSingle-Queue, Multi-Server Let N.RUNWAY.GROUP = 3 Create every RUNWAY.GROUP Let U.RUNWAY.GROUP(1) = 2 Let U.RUNWAY.GROUP(2) = 1 Let U.RUNWAY.GROUP(3) = 2 Let N.RUNWAY.GROUP = 1 Create every RUNWAY.GROUP Let U.RUNWAY.GROUP(1) = 5

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-14 More Details on Resources (continued) 8 Airplanes in processing Single-Queue, Multi-Server U.RUNWAY.GROUP N.X.RUNWAY.GROUP N.Q.RUNWAY.GROUP U.RUNWAY.GROUP N.X.RUNWAY.GROUP N.Q.RUNWAY.GROUP (1) (2) (3)(1) Multi-Queue, Multi-Server

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-15 Resource Modeling Once you request a resource of a certain type, you stay there until you get it You can't take a resource away from someone else, but you can go ahead of others in line Request 1 RUNWAY.GROUP(2) with priority 5

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-16 Section 4 - Process Simulation II Part 3 - Implementation of the Process Approach

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-17 The Airport Model Consider an airport with two groups of runways. An airplane will be assigned to one group of runways or the other depending on which has the shortest line relative to the total number of runways. The user will be asked to enter the number of runways of each type. Calculate the maximum waiting time and maximum number of aircraft waiting at any one time.

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-18 The Airport Model (continued) We will model the departure as a process, called DEPARTURE. Departures will be activated by a DEPARTURE.GENERATOR. RUNWAY.GROUP will be a resource and there will be two types of runways. A FINAL.REPORT will be a process. Not necessary but a useful technique.

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-19 The Airport Model (continued) Time Start Takeoff End Takeoff Wait Taxi Arrive Runway Depart Gate Events Takeoff Method

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— Preamble 2 3 '' The Airport Model using processes - CACI Products Company 4 '' files: AIRPORT2.SRC 5 6 Normally mode is undefined 7 8 Processes include 9 DEPARTURE.GENERATOR, 10 DEPARTURE and 11 FINAL.REPORT Resources 14 Every RUNWAY has 15 a RWY.TOTAL.RUNWAYS and 16 a RWY.MAX.NO.OF.WAITING.AIRPLANES Define RWY.TOTAL.RUNWAYS and 19 RWY.MAX.NO.OF.WAITING.AIRPLANES 20 as integer variables '' Global variables Define MINIMUM.INTER.DEPARTURE.TIME, 25 MAXIMUM.INTER.DEPARTURE.TIME, 26 MINIMUM.TAKE.OFF.TIME, 27 MAXIMUM.TAKE.OFF.TIME, 28 MAX.WAITING.TIME and 29 RUN.LENGTH 30 as real variables End ''Preamble

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— Main 2 3 Call READ.DATA 4 5 Activate a FINAL.REPORT in RUN.LENGTH hours 6 Activate an DEPARTURE.GENERATOR now 7 8 Start simulation 9 10 End ''Main

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— Routine READ.DATA 2 3 Print 3 lines thus Enter the shortest and longest times between airplane departures (in minutes) Shortest time: 7 Read MINIMUM.INTER.DEPARTURE.TIME 8 9 Print 1 line thus Longest time: 11 Read MAXIMUM.INTER.DEPARTURE.TIME Print 2 lines thus Enter the shortest and longest takeoff times (in minutes) Shortest time: 16 Read MINIMUM.TAKE.OFF.TIME Print 1 line thus Longest time: 20 Read MAXIMUM.TAKE.OFF.TIME Create every RUNWAY(2) 23 For each RUNWAY 24 Do 25 Print 1 line with RUNWAY thus Enter the number of runways in group *: 27 Read RWY.TOTAL.RUNWAYS(RUNWAY) 28 Let U.RUNWAY(RUNWAY) = RWY.TOTAL.RUNWAYS(RUNWAY) 29 Loop ''each RUNWAY Print 1 line thus Enter the run length (in hours): 33 Read RUN.LENGTH End ''READ.DATA

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— Process DEPARTURE.GENERATOR 2 3 Define.TIME.TO.QUIT as a real variable 4 5 Let.TIME.TO.QUIT = RUN.LENGTH / hours.v 6 Until time.v >=.TIME.TO.QUIT 7 Do 8 Activate an DEPARTURE now 9 Wait uniform.f(MINIMUM.INTER.DEPARTURE.TIME, 10 MAXIMUM.INTER.DEPARTURE.TIME, 11 1) minutes 12 Loop ''time.v >=.TIME.TO.QUIT End ''DEPARTURE.GENERATOR

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— Process DEPARTURE 2 3 Define.BEGIN.WAIT.TIME and 4.WAITING.TIME 5 as real variables 6 Define.MY.CHOICE as an integer variable 7 8 Let.BEGIN.WAIT.TIME = time.v 9 If (N.X.RUNWAY(1) + N.Q.RUNWAY(1)) / RWY.TOTAL.RUNWAYS(1) <= 10 (N.X.RUNWAY(2) + N.Q.RUNWAY(2)) / RWY.TOTAL.RUNWAYS(2) 11 Let.MY.CHOICE = 1 12 Else 13 Let.MY.CHOICE = 2 14 Endif ''(N.X.RUNWAY(1) + N.Q.RUNWAY(1)) / RWY.TOTAL.RUNWAYS(1) <= Request 1 unit of RUNWAY(.MY.CHOICE) 17 Let.WAITING.TIME = time.v -.BEGIN.WAIT.TIME 18 Let MAX.WAITING.TIME = max.f(.WAITING.TIME, MAX.WAITING.TIME) 19 Work uniform.f(MINIMUM.TAKE.OFF.TIME, 20 MAXIMUM.TAKE.OFF.TIME, 21 2) minutes 22 Let RWY.MAX.NO.OF.WAITING.AIRPLANES(.MY.CHOICE) 23 = max.f(N.Q.RUNWAY(.MY.CHOICE), 24 RWY.MAX.NO.OF.WAITING.AIRPLANES(.MY.CHOICE)) 25 Relinquish 1 unit of RUNWAY(.MY.CHOICE) End ''DEPARTURE

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— Process FINAL.REPORT 2 Print 5 lines with time.v * hours.v, 3 MAX.WAITING.TIME * hours.v * minutes.v, 4 RWY.MAX.NO.OF.WAITING.AIRPLANES(1), 5 RWY.MAX.NO.OF.WAITING.AIRPLANES(2) thus The simulation ended at **.* hours The maximum waiting time for a runway was **.** minutes The maximum number of aircraft waiting at any one time was: Runway 1: ** Runway 2: ** Read as / using unit Stop End ''FINAL.REPORT

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-26 Enter the shortest and longest times between airplane departures (in minutes) Shortest time: 1 Longest time: 3 Enter the shortest and longest takeoff times (in minutes) Shortest time: 3 Longest time: 5 Enter the number of runways in group 1: 1 Enter the number of runways in group 2: 1 Enter the run length (in hours): 10 The simulation ended at 10.0 hours The maximum waiting time for a runway was minutes The maximum number of aircraft waiting at any one time was: Runway 1: 3 Runway 2: 3

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-27 Memory for Processes Memory for the process notices –Each instance has a unique process notice with 9 or more attributes –In addition, memory to store local variables Released when the process routine is finished

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-28 This page is intentionally blank

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-29 Exercise 4 The Pacific Port Problem C:\Program Files\Simscript3\models\ProblemB

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-30 The Pacific Port Problem Tankers unload crude oil in San Pedro, California from overseas. Interarrival times are uniformly distributed with a minimum of 4 hours and a maximum of 18 hours. Three classes of ships are served. They have different unloading times and probabilities of arrival as follows: TypeRelative FrequencyUnloading Time (hours) / / /- 4

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-31 The Pacific Port Problem (cont'd) The port can unload as many as three ships simultaneously but only one tug serves the port. All tankers need the tug to move them into and out of the berths. When the tug is available, the movement times are one hour (each way). Formulate a model and write a SIMSCRIPT II.5 program in order to determine the average and the maximum delays experienced by any ship and the total number of ships unloaded. In a subsequent lab session, we shall be expanding on this model. SELECT PROBLEMB

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-32 A Graphical View (C:\Program Files\Simscript3\models\Port)

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-33 Preamble '' Pacific Port Problem - CACI Products Company '' Preliminary Code for Student Problem B '' files: PROBLEMB.SRC Normally mode is undefined Resources include DOCK, TUG '' Output global variables Define WAITING.TIME as a real variable Define TOTAL.WAITING.TIME and MAX.WAITING.TIME as real variables Define NO.OF.SHIPS.SERVED as an integer variable End ''Preamble

—————————— CACI Products Company ————————————————————————————— SimScript II.5 —————————————— 4-34 This page is intentionally blank