Download presentation
Presentation is loading. Please wait.
Published byAshley Stafford Modified over 8 years ago
1
Introduction to Modeling & Simulation Dr. A. K. Dey Third Lecture docdey_delhi@hotmail.com
2
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
3
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
4
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
5
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
6
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
7
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
8
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
9
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
10
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)
11
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
12
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”
13
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
14
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
15
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.
16
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
17
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.
18
AKD 318 SIMULATION “WORLD-VIEWS” l Pure Continuous Simulation l Pure Discrete Simulation Event-oriented Activity-oriented Process-oriented l Combined Discrete / Continuous Simulation
19
AKD 319 Examples Of Both Type Models l Continuous Time and Discrete Time Models: CPU scheduling model vs. number of students attending the class.
20
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.
21
AKD 321 Static and Dynamic Models: CPU scheduling model vs. E = mc 2 Other Type Models Input Output Input Output lDeterministic and Probabilistic Models:
22
AKD 322 Stochastic vs. Deterministic 2 3 4 1 System Model Deterministic Stochastic
23
AKD 323 Management of the Simulated Clock l Fixed-time Increment l Variable-time Increment
24
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
25
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
26
AKD 326 Distribution of time between arrivals Time between Cumulative Random digit Arrivals(min.) Probability Probability Assignment 1234567812345678 0.125 0.250 0.375 0.500 0.625 0.750 0.875 1.000 000-125 126-250 251-375 376-500 501-625 626-750 751-875 876-000
27
AKD 327 Service Time Distribution Service Time Cumulative Random digit (Minutes) Probability Probability Assignment 1 0.10 0.10 01 - 10 2 0.20 0.30 11 - 30 3 0.30 0.60 31 - 60 4 0.25 0.85 61- 85 5 0.10 0.95 86 - 95 6 0.05 1.00 96 - 00
28
AKD 328 Time-between-arrival Determination Random Time btwn Random Time btwn Digit Arrivals Digit Arrivals Customer (Minutes) Customer (Minutes) 1 _ _ 11 109 1 2 913 8 12 093 1 3 727 6 13 607 5 4 015 1 14 738 6 5 948 8 15 359 3 6 309 3 16 888 8 7 922 8 17 106 1 8 753 7 18 212 2 9 235 2 19 493 4 10 302 3 20 535 5
29
AKD 329 Service Times Generated 1 84 4 11 32 3 2 10 1 12 94 5 3 74 4 13 79 4 4 53 3 14 05 1 5 17 2 15 79 5 6 79 4 16 84 4 7 91 5 17 52 3 8 67 4 18 55 3 9 89 5 19 30 2 10 38 3 20 50 3 Customer Random Digit Service Time (Minutes) Customer Random Digit Service Time (Minutes)
30
AKD 330 Event Type Work Sheet Clock Time Customer Number Arrival 1 0..................
31
AKD 331 Findings from the Simulation 1. Average waiting time for a customer Total time customers wait in queue(minute) Total number of customers
32
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
33
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
34
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.
35
AKD 335 The Able-Baker carhop problem (Inter-arrival distribution of cars) Time between Random Arrivals Cumulative Digit (Minutes) Probability Probability Assignment 1 0.25 0.25 01-25 2 0.40 0.65 26-65 3 0.20 0.85 66-85 4 0.15 1.00 86-00
36
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.
37
AKD 337 The Able-Baker carhop problem (Service Distribution of Able) Service Random Time Cumulative Digit (Minutes) Probability Probability Assignment 2 0.30 0.30 01-30 3 0.28 0.58 31-58 4 0.25 0.83 59-83 5 0.17 1.00 84-00
38
AKD 338 The Able-Baker carhop problem (Service Distribution of Baker) Service Random Time Cumulative Digit (Minutes) Probability Probability Assignment 3 0.35 0.35 01-35 4 0.25 0.60 36-60 5 0.20 0.80 61-80 6 0.20 1.00 81-00
39
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.
40
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.
41
AKD 341 Thanks
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.