Simulation Software and Simulation in Java. Simulation languages & software Simulation Model Development General Purpose Languages Simulation Programming.

Slides:



Advertisements
Similar presentations
Simulating Single server queuing models. Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits.
Advertisements

Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
INTRODUCTION TO SIMULATION
 1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach.
Agenda Main concepts in discrete-event simulation
Lecture 3 Concepts of Discrete-Event Simulation. 2 Discrete Event Model  In the discrete approach to system simulation, state changes in the physical.
Event-drive SimulationCS-2303, C-Term Project #3 – Event-driven Simulation CS-2303 System Programming Concepts (Slides include materials from The.
Simulation Where real stuff starts. ToC 1.What, transience, stationarity 2.How, discrete event, recurrence 3.Accuracy of output 4.Monte Carlo 5.Random.
Chapter 3 Simulation Software
INTRODUCTION TO SIMULATION
DISCRETE-EVENT SIMULATION CONCEPTS and EVENT SCHEDULING ALGORITHM
Components and Organization of Discrete-event Simulation Model
Simulation with ArenaChapter 2 – Fundamental Simulation Concepts Discrete Event “Hand” Simulation of a GI/GI/1 Queue.
Simulating Single server queuing models. Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits.
CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT Class Location:
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Simulation Software Discrete-Event System Simulation 5 th Edition Chapter 4 1.
Ch. 3 Simulation Software. Programming of discrete-event simulation models Generating random numbers, that is, observations from a U(0,1) probability.
Graduate Program in Engineering and Technology Management
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
Simulation Examples ~ By Hand ~ Using Excel
 1  Outline  world view of simulation  overview of ARENA  simple ARENA model: Model  basic operations: Model
Designing a Discrete Event Simulation Tool Peter L. Jackson School of Operations Research and Industrial Engineering March 15, 2003 Cornell University.
1 Chapter 2 Fundamental Simulation Concepts. Simulation with Arena Fundamental Simulation Concepts C2/2 What We’ll Do... Underlying ideas, methods, and.
Steps in simulation study 1. - Clearly understand problem - Reformulation of the problem 2. - Which questions should be answered? - Is simulation appropriate?
ETM 607 – Discrete Event Simulation Fundamentals Define Discrete Event Simulation. Define concepts (entities, attributes, event list, etc…) Define “world-view”,
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.
Dept. Computer Science, Tianjin Uni. 系统仿真 System Simulation 2008.
Chapter 2 – Fundamental Simulation ConceptsSlide 1 of 46 Chapter 2 Fundamental Simulation Concepts.
Slide 1 of 46 Fundamental Simulation Concepts Last revision June 7, 2003.
SIMULATION EXAMPLES QUEUEING SYSTEMS.
SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM
NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly.
1 Simulation Implementation Using high-level languages.
Modeling and simulation of systems Methodology for simulation software selection Slovak University of Technology Faculty of Material Science and Technology.
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
1 1 Slide © 2011 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole.
1 1 Slide © 2009 South-Western, a part of Cengage Learning Slides by John Loucks St. Edward’s University.
Intermediate 2 Computing Unit 2 - Software Development.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
(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.
CHAPTER 3 Simulation Software 1. World Views of Simulation Model Event-Scheduling View  Focus on processing each event Process-interaction View  View.
 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,
Unit 4 Simulation software. Introduction Software used to develop simulation models can be divided into 3 categories: – General-purpose programming languages:
MODELING AND SIMULATION CS 313 Simulation Examples 1.
Simulation Examples And General Principles Part 2
Discrete-Event System Simulation in Java. Discrete Event Systems New dynamic systems New dynamic systems Computer and communication networks Computer.
Introduction to Modeling & Simulation Dr. A. K. Dey Third Lecture
1 Simulation Software. 2 Introduction The features that should be programmed in simulation are: Generating random numbers from the uniform distribution.
Simulation of single server queuing systems
12-Jun-16 Event loops. 2 Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output.
Modeling and Simulation
Chapter 1 What is Simulation?. Fall 2001 IMSE643 Industrial Simulation What’s Simulation? Simulation – A broad collection of methods and applications.
Chapter 4 Simulation Software
OPERATING SYSTEMS CS 3502 Fall 2017
Discrete Event Simulation
Modeling and Simulation CS 313
The Object-Oriented Thought Process Chapter 06
Chapter 10 Verification and Validation of Simulation Models
SIMULATION EXAMPLES QUEUEING SYSTEMS.
ميرعماد سليمانيان محمدرضا صمدي ميلاد ظفرنژاد.
World-Views of Simulation
SIMULATION EXAMPLES QUEUEING SYSTEMS.
Simulation Software.
Event loops 17-Jan-19.
Concepts In Discrete-Event Simulation
Discrete Event “Hand” Simulation of a GI/GI/1 Queue
MECH 3550 : Simulation & Visualization
SIMULATION EXAMPLES QUEUEING SYSTEMS.
Presentation transcript:

Simulation Software and Simulation in Java

Simulation languages & software Simulation Model Development General Purpose Languages Simulation Programming Languages C,C++, Fortran, Java Examples: SIMAN, GPSS, SLAM Examples: Simulation Environments Examples: ARENA,AUTOMOD

Simulation languages & software General Features –Orientation (general vs. manufacturing) –Modeling approaches (event-scheduling based, activity- scanning based, process-interaction based) –Input mode (batch mode, interactive mode, etc) –On-line help –Debugger –Type of simulation (discrete vs. continuous) –Integrated data-base

Simulation languages & software Statistical capability –Number of random number generators –Standard distribution functions –Empirical distribution functions –User defined random number streams –Warm-up period, steady state analysis –Multiple replications, batching

Simulation languages & software Output –Standard reports –Intermediate reports –Quality of graphics Material handling –Conveyors –Forklifts –AGVs, robots –AS/RS

Simulation languages & software Animation –2 or 3 dimensional –Multiple screen layout –Zoom –Speed up/down –Playback –Elements (programming, graphics, menu, etc)

Simulation languages & software Customer support –Training –Free technical support –Documentation (manuals, etc)

Selection of Simulation Software 1.Do not focus on a single issue, such as ease of use. Consider the accuracy and level of detail obtainable, ease of learning, vendor support, and suitability to your applications 2.Execution speed is important. Speed affects development time. 3.Beware of the advertising claims and demonstrations. 4.Ask the vendor to solve a small version of your problem

Selection of Simulation Software 5.Beware of “checklists” with “yes” and “no” as entries. Implementation and capability are what is important 6.Capability to link it with code written in general- purpose languages is good, but you should not be required to do it for basic modeling. 7.Although it is nice to be able to build the models with a GUI without actually writing to code, the software should give you the capability to write code when you need something that is not built- in.

Overall Structure of an Event-Scheduling Simulation Program

Overall Structure of Java Simulation of a Single-Server Queue

Java Main Program class Sim { // Class Sim variables public static double Clock, MeanInterArrivalTime, MeanServiceTime, SIGMA, LastEventTime, TotalBusy, MaxQueueLength, SumResponseTime; public static long NumberOfCustomers, QueueLength, NumberInService, TotalCustomers, NumberOfDepartures, LongService; public final static int arrival = 1; public final static int departure = 2; public static EventList FutureEventList; public static Queue Customers; public static Random stream;

Java Main Program public static void main(String argv[]) { MeanInterArrivalTime = 4.5; MeanServiceTime = 3.2; SIGMA = 0.6; TotalCustomers = 1000; long seed = ; stream = new Random(seed); // initialize rng stream FutureEventList = new EventList(); Customers = new Queue(); Initialization();

Java Main Program // Loop until first "TotalCustomers" have departed while(NumberOfDepartures < TotalCustomers ) { Event evt = (Event)FutureEventList.getMin(); // get imminent event FutureEventList.dequeue(); // be rid of it Clock = evt.get_time(); // advance simulation time if( evt.get_type() == arrival ) ProcessArrival(evt); else ProcessDeparture(evt); } ReportGeneration(); }

Initialization Method // seed the event list with TotalCustomers arrivals public static void Initialization() { Clock = 0.0; QueueLength = 0; NumberInService = 0; LastEventTime = 0.0; TotalBusy = 0 ; MaxQueueLength = 0; SumResponseTime = 0; NumberOfDepartures = 0; LongService = 0; // create first arrival event Event evt = new Event(arrival, exponential( stream, MeanInterArrivalTime)); FutureEventList.enqueue( evt ); }

Arrival Event Method public static void ProcessArrival(Event evt) { Customers.enqueue(evt); QueueLength++; // if the server is idle, fetch the event, do statistics // and put into service if( NumberInService == 0) ScheduleDeparture(); else TotalBusy += (Clock - LastEventTime); // server is busy // adjust max queue length statistics if (MaxQueueLength < QueueLength) MaxQueueLength = QueueLength; // schedule the next arrival Event next_arrival = new Event(arrival, Clock+exponential(stream, MeanInterArrivalTime)); FutureEventList.enqueue( next_arrival ); LastEventTime = Clock; }

Schedule Departure Method public static void ScheduleDeparture() { double ServiceTime; // get the job at the head of the queue while (( ServiceTime = normal(stream, MeanServiceTime, SIGMA)) < 0 ); Event depart = new Event(departure,Clock+ServiceTime); FutureEventList.enqueue( depart ); NumberInService = 1; QueueLength--; }

Departure Event Method public static void ProcessDeparture(Event e) { // get the customer description Event finished = (Event) Customers.dequeue(); // if there are customers in the queue then schedule // the departure of the next one if( QueueLength > 0 ) ScheduleDeparture(); else NumberInService = 0; // measure the response time and add to the sum double response = (Clock - finished.get_time()); SumResponseTime += response; if( response > 4.0 ) LongService++; // record long service TotalBusy += (Clock - LastEventTime ); NumberOfDepartures++; LastEventTime = Clock; }

Report Generation Method public static void ReportGeneration() { double RHO = TotalBusy/Clock; double AVGR = SumResponseTime/TotalCustomers; double PC4 = ((double)LongService)/TotalCustomers; System.out.println( "SINGLE SERVER QUEUE SIMULATION - GROCERY STORE CHECKOUT COUNTER "); System.out.println( "\tMEAN INTERARRIVAL TIME " + MeanInterArrivalTime ); System.out.println( "\tMEAN SERVICE TIME " + MeanServiceTime ); System.out.println( "\tSTANDARD DEVIATION OF SERVICE TIMES " + SIGMA ); System.out.println( "\tNUMBER OF CUSTOMERS SERVED " + TotalCustomers );

Report Generation Method System.out.println(); System.out.println( "\tSERVER UTILIZATION " + RHO ); System.out.println( "\tMAXIMUM LINE LENGTH " + MaxQueueLength ); System.out.println( "\tAVERAGE RESPONSE TIME " + AVGR + " MINUTES" ); System.out.println( "\tPROPORTION WHO SPEND FOUR "); System.out.println( "\t MINUTES OR MORE IN SYSTEM " + PC4 ); System.out.println( "\tSIMULATION RUNLENGTH " + Clock + " MINUTES" ); System.out.println( "\tNUMBER OF DEPARTURES " + TotalCustomers ); }

Random Variate Generators public static double exponential(Random rng, double mean) { return -mean*Math.log( rng.nextDouble() ); } public static double SaveNormal; public static int NumNormals = 0; public static final double PI = ; public static double normal(Random rng, double mean, double sigma) { double ReturnNormal; // should we generate two normals? if(NumNormals == 0 ) { double r1 = rng.nextDouble(); double r2 = rng.nextDouble(); ReturnNormal = Math.sqrt( 2*Math.log(r1))*Math.cos(2*PI*r2); SaveNormal = Math.sqrt(-2*Math.log(r1))*Math.sin(2*PI*r2); NumNormals = 1; } else { NumNormals = 0; ReturnNormal = SaveNormal; } return ReturnNormal*sigma + mean ; }