450 likes | 566 Views
Simulation Software. Introduction. The features that should be programmed in simulation are: Generating random numbers from the uniform distribution Generating random variates from any distribution Advancing simulation time
E N D
Introduction The features that should be programmed in simulation are: • Generating random numbers from the uniform distribution • Generating random variates from any distribution • Advancing simulation time • Determining the next event and passing control to the appropriate block of code • Adding records to, or deleting records from, a list • Collecting output statistics and reporting them • Detecting error conditions These common features are programmed using general-purpose languages like FORTRAN, C or C++ to develop simulation packages.
How to simulate a system with a computer code? • Planning the study • Description of the system • Definitions of the performance measures • Algorithm • Flowchart: Process in the system, collection of statistics to estimate the performance measures, reporting • Algorithm that corresponds to the flowchart • Computer code (Matlab, Java, …) • Data structures (sequential vs linked allocation: in book) • Random number generation • Coding the algorithm
Simulating aMulti-Teller Bank • The bank opens its doors at 9 A.M. and closes its doors at 5 P.M., but operates until all customers still in the bank are served. Customer interarrival times are IID and exponential with mean 1 minute and services are IID and exponential with mean 4.5 minutes. • Each teller has a separate queue. An arriving customer joins the shortest queue, choosing the leftmost shortest queue if there is a tie. Let ni be the number of customers in front of teller i. If the completion of service at teller i causes nj > ni + 1 for some other teller j, then the customer from the tail of queue j jockeys to the tail of queue i. If there are two or more such customers, the one from the closest leftmost queue joins.
Events and state transitions: departure from a non-empty system, followed by jockeying
Performance measures • Expected number in each queue • Expected waiting time of a customer • Expected utilization of each server
Flowchart • Events? a separate flowchart for each event • Customer arrival • Customer departure • Jockeying • How to combine them? main flowchart
Function arrive Arrival Flowchart Schedule the next arrival event Is a teller idle? Yes No Set a delay of 0 for this customer Find the number of the leftmost shortest queue (shortest_q) Make the teller busy Place the customer at the end of queue number shortest_q i.e., increase the # in the queue by 1 Schedule the departure of this customer Record the arrival time of this customer Return
Function depart Departure Flowchart Is the queue for this teller empty? Yes No Make this teller idle Remove the first customer from this queue Compute this customer’s delay and gather statistics Schedule the departure event for this customer Call function Jockey Return
Function jockey Jockeying Flowchart Is there a customer to jockey? Yes Remove this customer from the tail of his or her current queue No Is the teller who just completed service now busy? Compute this customer’s delay and gather statistics Yes No Place the jockeying customer at the tail of the queue of the teller who just completed service Make this teller busy Schedule the departure event for the jockeying customer Return
Function depart FlowchartCombiningDeparture and Jockeying Is the queue for this teller empty? Yes No Is there a customer to jockey? Remove the first customer from this queue Yes No Compute this customer’s delay and gather statistics Remove this customer from the tail of his or her current queue Make this teller idle Schedule the departure event for this customer Compute this customer’s delay and gather statistics Is there a customer to jockey? Yes Make this teller busy Place the jockeying customer at the tail of this queue Schedule the departure event for the jockeying customer No Return
Start Main flowchart Initialization Is current_time < finish_time Yes No • Find the next event • Update current_time: current_time+time_till_next Report Call the function corresponding to the event Stop
Flowcharts • Schedule next departure only if you make the server busy with the next customer. • Collect the statistics: • How many customers were waiting between the previous event and the departure now? • The waiting time of the customer who just started service? • …
How to think to draw a flowchart: Process • Departure function is called, when the minimum of the event times (in this case, time-to-departure and time-to-arrival) corresponds to a departure. • So we know that a customer is leaving the system, which means that the server serving that customer is now idle and has to look for a customer if there is any in the system. • Is there any customer to serve for this server? Check: • The server’s queue • Other queues • Once the server’s state is determined, check for jockeying
How to think to draw a flowchart: Process • Which event will happen next? • Events: • Arrival • Potentially departure from queue i, i=1,2,…,5 • End of simulation
How to think to draw a flowchart:Information gathering • What do you need to know about the queues? • The number of customers in each queue: • State variable: (n1(t),n2(t),..n5(t)), where ni(t) denotes the total number of customers in queuei(including the customer in service). • Server state? • What do we need to know about customers? • For each customer: • The queue that he/she is waiting for (denote by cust_queue) • His/her position in the cust_queue • His/her arrival time
How to modify the states? • Let (n1(t),n2(t),..n5(t)) be our state variable where ni(t) denotes the total number of customers in queuei(including the customer in service). • Arrival event: • If there is at least one ni(t-) =0. • Let j be the smallest index of the queue that is empty, then • nj(t)=nj(t-)+1 • Else • Findargminj((n1(t),n2(t),..n5(t)) • Let j be the smallest index of the queue has the smallest number of customers, then • nj(t)=nj(t-)+1
How to gather statistics • Define the variables: • Cum_delay • Cum_queue • Cum_busy • At each event epoch, update these variables
How to think to draw a flowchart:Information gathering • For example: Cum_queue • At each event epoch, update these variables Inter-arrival times: A1 = 0.4,A2 = 1.2,A3 = 0.5, A4 = 1.7, A5 = 0.2, A6 = 1.6, A7 = 0.2,A8 = 1.4, A9 = 1.9 Processing times: S1 = 2.0,S2 = 0.7, S3 = 0.4, S4 = 1.1,S5 = 3.7,S6 = 0.6
Comparison of Simulation PackageswithProgrammingLanguages Advantages of simulation packages • They automatically provide most of the features, requiring lessprogramming time and cost. • They provide a natural framework for simulation modeling. • Models are easier to modify and maintain. • They provide better error detection because potential errors are checked forautomatically.
Comparison of Simulation PackageswithProgrammingLanguages Advantages of general purpose languages • Most modelers already know a language, but this is often not the case with a simulation package. • A simulation model efficiently written in a language may require less execution time. • Programming languages may allow greater programming flexibility. • Software cost is generally lower, but total project cost may not be.
Classification of Simulation Software • Earlier times: A combination of general purpose language and simulation concepts such as Simscript, Siman, or SLAM • Recently: Simulation software packages • Easy-to-use • User friendly graphical model building approach involving use of modules and icons selected by the user on screen • Entities represented by icons with a wide range of animation capabilities.
Classification of Simulation Software General-purposeversusapplication-orientedsimulationpackages • A general-purpose simulation package can be used for any application, but might have special features for certain ones (like manufacturing, communications, or business process reengineering). • An application-oriented simulation package is designed to be used for a certain class of application (like manufacturing, health-care, or call centers).
Classification of Simulation Software Modelingapproach • Event-scheduling approach is based on simulating over time by executing the events selected from the event list in increasing order of their time. • Process approach is based on simulating the time-ordered sequence of processes experienced by a single entity as it flows through the system.
Prototypecustomer-processroutinefor a single-server queueingsystem
Common Modeling Elements Simulation packages typically include entities, attributes, resources and queues as part of their modeling framework.
Desirable Software Features • General capabilities • Modeling flexibility, Ease of use, Hierarchical modeling, Debugging aids, Fast model execution speed, etc. • Hardware and software requirement • Computer platforms (PC’s, UNIX workstations, Apple’s), RAM requirement, Operating system requirement (Windows, UNIX, Mac OS) • Animation and dynamic graphics • Concurrent and post-processed animation, Vector based and pixel based graphics, Two and three dimensional animation, Dynamic graphics and statistics
Desirable Software Features • Statistical capabilities • Good random number generation, Theoretical discrete and continuous distributions, Empirical distributions, Independent replications or runs, Performance estimation, Confidence interval determination, Warmup period, Optimization via simulation • Customer support and documentation • Public and customized training • Technical support • Good documentation • Output reports and graphics • Standart and customized reports • Descriptive statistics (histograms, time plots, bar chart, pie chart, etc.)
General-Purpose Simulation Packages • Arena • This is the package we will be using in this course. Modeling is done using modules arranged into a number of templates: • Basic Process template has modules used in many models for modeling arrivals (create), services (process) and departures (dispose). • Advanced Process template contains modules to perform very specific logical functions such as choosing a queue when several are available or coordinating the advancement of multiple entities in different areas • Advanced Transfer templatecontains modules (like conveyors and transporters) that are used to describe the transfer of entities from one part of the system to another.
Arena A model is constructed by dragging and dropping modules into the model window, connecting them to indicate the flow of entities through the simulated system, and then detailing the modules using dialog boxes of Arena’s built-in spreadsheet.
Other General-PurposeSimulationPackages ·Extend·AweSim · GPSS/H· Micro Saint · MODSIM III· SES/workbench · SIMPLE++· SIMUL8 · SLX· Taylor Enterprise Dynamics
Application-Oriented Simulation Packages • Manufacturing: AutoMod, AutoSched AP, Extend + Manufacturing, Arena Packaging Edition, ProModel, QUEST, Taylor Enterprise Dynamics, WITNESS • Communication Networks: COMNET, IT DecisionGuru, OPNET Modeler • Process Reengineering and Services: Arena Business Edition, Extend + BPR, ProcessModel,ServiceModel, SIMPROCESS • HealthCare: MedModel • Call Centers: Arena Call Center Edition • Animation: Proof Animation