Introduction to Modeling & Simulation Dr. A. K. Dey Third Lecture
AKD 32 Define An Achievable Goal “To model the…” is NOT a goal! “To model the…in order to select/determine feasibility/…is a goal. Goal selection is not cast in concrete Goals change with increasing insight
AKD 33 Choose The Appropriate Simulation Tools Assuming Simulation is the appropriate means, three alternatives exist: Build Model in a General Purpose Language Build Model in a General Simulation Language Use a Special Purpose Simulation Package
AKD 34 Modeling with general purpose languages Advantages: Little or no additional software cost Universally available (portable) No additional training (Everybody knows…(language X) ! ) Disadvantages: Every model starts from scratch Very little reusable code Long development cycle for each model Difficult verification phase
AKD 35 General purpose languages used for simulation FORTRAN Probably more models than any other language. PASCAL Not as universal as FORTRAN MODULA Many improvements over PASCAL ADA Department of Defense attempt at standardization C, C++ Object-oriented programming language
AKD 36 Modeling with General simulation language Advantages: Standardized features often needed in modeling Shorter development cycle for each model Much assistance in model verification Very readable code Disadvantages: Higher software cost (up-front) Additional training required Limited portability
AKD 37 General purpose simulation languages GPSS Block-structured Language Interpretive Execution FORTRAN-based (Help blocks) World-view: Transactions/Facilities SIMSCRIPT II.5 English-like Problem Description Language Compiled Programs Complete language (no other underlying language) World-view: Processes/ Resources/ Continuous
AKD 38 General purpose simulation languages MODSIM III Modern Object-Oriented Language Modularity Compiled Programs Based on Modula2 (but compiles into C) World-view: Processes SIMULA ALGOL-based Problem Description Language Compiled Programs World-view: Processes
AKD 39 General purpose simulation languages SLAM Block-structured Language Interpretive Execution FORTRAN-based (and extended) World-view: Network / event / continuous CSIM process-oriented language C-based (C++ based) World-view: Processes
AKD 310 Modeling with special purpose simulation language Advantages Very quick development of complex models Short learning cycle No programming--minimal errors in usage Disadvantages High cost of software Limited scope of applicability Limited flexibility (may not fit your specific application)
AKD 311 Special purpose packages for simulation NETWORK II.5 Simulator for computer systems OPNET Simulator for communication networks, including wireless networks COMNET III Simulator for communications networks SIMFACTORY Simulator for manufacturing operations
AKD 312 The real cost of simulation Many people think of the cost of a simulation only in terms of the software package price. There are actually at least three components to the cost of simulation: Purchase price of the software Programmer / Analyst time “Timeliness of Results”
AKD 313 TERMINOLOGY l System A group of objects that are joined together in some regular interaction or interdependence toward the accomplishment of some purpose. Entity An object of interest in the system. E.g., customers at a bank
AKD 314 TERMINOLOGY (continued) l Attribute a property of an entity E.g., checking account balance l Activity Represents a time period of specified length. Collection of operations that transform the state of an entity E.g., making bank deposits
AKD 315 TERMINOLOGY (continued) l Event: change in the system state. E.g., arrival; beginning of a new execution; departure l State Variables Define the state of the system Can restart simulation from state variables E.g., length of the job queue.
AKD 316 TERMINOLOGY (continued) l Process Sequence of events ordered on time W Note: the three concepts(event, process,and activity) give rise to three alternative ways of building discrete simulation models
AKD 317 EXAMPLES OF SYSTEMS AND COMPONENTS Note: State Variables may change continuously (continuous sys.) over time or they may change only at a discrete set of points (discrete sys.) in time.
AKD 318 SIMULATION “WORLD-VIEWS” l Pure Continuous Simulation l Pure Discrete Simulation Event-oriented Activity-oriented Process-oriented l Combined Discrete / Continuous Simulation
AKD 319 Examples Of Both Type Models l Continuous Time and Discrete Time Models: CPU scheduling model vs. number of students attending the class.
AKD 320 Examples (continued) l Continuous State and Discrete State Models: Example: Time spent by students in a weekly class vs. Number of jobs in Q.
AKD 321 Static and Dynamic Models: CPU scheduling model vs. E = mc 2 Other Type Models Input Output Input Output lDeterministic and Probabilistic Models:
AKD 322 Stochastic vs. Deterministic System Model Deterministic Stochastic
AKD 323 Management of the Simulated Clock l Fixed-time Increment l Variable-time Increment
AKD 324 Flowchart for arrival routine, queueing model Arrival event Set delay = 0 for this customer and gather statistics Is the server busy? Schedule the next arrival event Add 1 to the number of customers delayed Make the server busy Schedule a departure event for this customer Add 1to the number in queue Write error message and stop simulation Store time of arrival of this customer Is the queue Full? Return NoYes No
AKD 325 Departure event Subtract 1 from the number in queue Is the queue empty? Compute delay of customer entering service and gather statistics Add 1 to the number of customers delayed Schedule a departure event for this customer Make the server idle Move each customer in queue (if any) up one place Eliminate departure event from consideration Return NoYes Flowchart for departure routine, queueing model
AKD 326 Distribution of time between arrivals Time between Cumulative Random digit Arrivals(min.) Probability Probability Assignment
AKD 327 Service Time Distribution Service Time Cumulative Random digit (Minutes) Probability Probability Assignment
AKD 328 Time-between-arrival Determination Random Time btwn Random Time btwn Digit Arrivals Digit Arrivals Customer (Minutes) Customer (Minutes) 1 _ _
AKD 329 Service Times Generated Customer Random Digit Service Time (Minutes) Customer Random Digit Service Time (Minutes)
AKD 330 Event Type Work Sheet Clock Time Customer Number Arrival
AKD 331 Findings from the Simulation 1. Average waiting time for a customer Total time customers wait in queue(minute) Total number of customers
AKD 332 Findings from the Simulation (cont) 2. Prob. that a customer has to wait in a queue Number of customers who wait Total number of customers
AKD 333 Findings from the Simulation (cont) 3. Proportion of idle time of the server Total idle time of server(minute) Total run time of simulation(minute) Thus, the probability of the server being busy is the complement of 0.21, or 0.79
AKD 334 The Able-Baker carhop problem The purpose of this example is to indicate the simulation procedure when there is more than one channel. Consider a drive-in restaurant where carhops take orders and bring food to the car. Cars arrive in the manner shown in the following table.
AKD 335 The Able-Baker carhop problem (Inter-arrival distribution of cars) Time between Random Arrivals Cumulative Digit (Minutes) Probability Probability Assignment
AKD 336 The Able-Baker carhop problem (continued) There are two car hops -- Able and Baker. Able is better able to do the job, and works somewhat faster than Baker. The distribution of service times of Able and Baker is following.
AKD 337 The Able-Baker carhop problem (Service Distribution of Able) Service Random Time Cumulative Digit (Minutes) Probability Probability Assignment
AKD 338 The Able-Baker carhop problem (Service Distribution of Baker) Service Random Time Cumulative Digit (Minutes) Probability Probability Assignment
AKD 339 The Able-Baker carhop problem (Continued) l Over the 62-minute period Able is busy 90% of the time. 2 Baker was busy only 69% of the time. The seniority rule keeps Baker less busy. 3 Nine of 26 or about 35% of the arrivals had to wait. The average waiting time for all customers was only about 0.42 minute, or 25 seconds, which is very small.
AKD 340 The Able-Baker carhop problem (Continued) 4 Those 9 who did have to wait only waited an average of 1.22 minutes, which is quite low. 5 In summary, this system seems well balanced. One server cannot handle all the dinners, and three servers would probably be too many. Adding an additional server would surely reduce the waiting time to nearly zero. However, the cost of waiting would have to be quite high to justify an additional worker.
AKD 341 Thanks