580 likes | 897 Views
2. Introduction to simulation. What is simulation?Why do we use it?When do we use it?. 3. Introduction to simulation. In this course,Understand stochastic (probabilistic) systemsPerformance over timeMostly event based (vs continuous)Some systems where time is not a factorComplex quality acc
E N D
1. 1 Simulation Fundamentals and Software
2. 2 Introduction to simulation What is simulation?
Why do we use it?
When do we use it?
Simulation – very broad term – methods and applications to imitate or mimic real systems, usually via computer
System – facility or process, actual or planned
Manufacturing facility
Bank or other personal-service operation
Transportation/logistics/distribution operation
Hospital facilities (emergency room, operating room, admissions)
Computer network
Freeway system
Business process (insurance office)
Criminal justice system
Chemical plant
Fast-food restaurant
Supermarket
Theme park
Emergency-response system
Why? Study the system – measure, improve, design, control
When? Could just play with the actual system; then we know we are looking at the right thing
But it’s often impossible to do so in reality with the actual system
System doesn’t exist
Would be disruptive, expensive, or dangerous
Simulation – very broad term – methods and applications to imitate or mimic real systems, usually via computer
System – facility or process, actual or planned
Manufacturing facility
Bank or other personal-service operation
Transportation/logistics/distribution operation
Hospital facilities (emergency room, operating room, admissions)
Computer network
Freeway system
Business process (insurance office)
Criminal justice system
Chemical plant
Fast-food restaurant
Supermarket
Theme park
Emergency-response system
Why? Study the system – measure, improve, design, control
When? Could just play with the actual system; then we know we are looking at the right thing
But it’s often impossible to do so in reality with the actual system
System doesn’t exist
Would be disruptive, expensive, or dangerous
3. 3 Introduction to simulation In this course,
Understand stochastic (probabilistic) systems
Performance over time
Mostly event based (vs continuous)
Some systems where time is not a factor
Complex quality acceptance plan
Gamblers’ betting strategies (Monte Carlo sim)
4. 4 Simulation languages In this class, we will use Arena (based on SIMAN)
Arena is on the computers in the public lab on the 4th floor
Other discrete event simulation languages
GPSS
SLAM
SIMSCRIPT
5. 5 Random numbers Stochastic systems can have more than one outcome
Random numbers select one possible outcome
Serve as a “seed” to set initial conditions
Computers generate “pseudorandom” numbers
6. 6 Introduction to simulation Simulation deals with systems
Types of systems
Discrete (focus of this course)
State of system changes at specific points in time (events)
7. 7 Introduction to simulation (2) Types of systems (cont)
Continuous
State of system changes continuously over time Maybe at some level everything is discrete – water is made up of moleculesMaybe at some level everything is discrete – water is made up of molecules
8. 8 Models Simulation attempts to model the “real world”
But what is a model?
Model – set of assumptions/approximations about how the system works
Study the model instead of the real system … usually much easier, faster, cheaper, safer
Can try wide-ranging ideas with the model
Make your mistakes on the computer where they don’t count, rather than for real where they do count Model is a representation of the system that we use as a surrogate (substitute) for the actual systemModel is a representation of the system that we use as a surrogate (substitute) for the actual system
9. 9 Models (2) Often, just building the model is instructive – regardless of results
Model validity (any kind of model … not just simulation)
Care in building to mimic reality faithfully
Level of detail
Get same conclusions from the model as you would from system
10. 10 Models(3) Types of models
Iconic (physical)
Model airplane in a wind tunnel
Symbolic (mathematical)
Represents system in terms of logical/quantitative relationships
11. 11 Models (4) Two types of symbolic models:
Analytical
Equations give exact results
Linear programming
Inventory model (optimal order quantity)
Queuing theory (statistical)
*If possible, use analytical model Queuing – expected wait time; expected number in queue and associated varianceQueuing – expected wait time; expected number in queue and associated variance
12. 12 Models (5) Symbolic models (cont)
Simulation
Use only if analytical model is not possible or practical
Imitates operations of real world
Similar to observing operations of real systems
Results are estimates of system - NOT EXACT
13. 13 Characteristics of simulation models Time is dynamic
Outcomes
Stochastic
Based on random variable inputs
State variables are discrete
14. 14 Advantages of simulation Can estimate
Expected value (mean/average outcome)
Most likely (mode outcome)
Dispersion/shape (statistical distribution of all outcomes)
Tool for controlled statistical experiments
Allows statistical evaluation (comparison) of alternate strategies
15. 15 Advantages of simulation (2) Provides insight into complex interactions
Compresses or expands time
Can identify bottlenecks
Can model uncertainty, nonstationarity
16. 16 Disadvantages of simulation Provides estimates only
Analysis of results may be difficult
Decision maker may not believe results
Sometimes used when not appropriate Estimates – most important
Results – more later
Decision – graphics may help
Not appropriate – analytical solution may be betterEstimates – most important
Results – more later
Decision – graphics may help
Not appropriate – analytical solution may be better
17. 17 Definitions Entity
Person, object, or thing whose movement through the system changes the state of the system.
Attribute
Property or characteristic of an entity or other object. A variable associated with an entity.
18. 18 Examples Entity Attribute
Customer arrival time
departure time
Machine status (idle, busy, down)
Airliner type
capacity
airspeed
19. 19 Definitions (cont) Global variables
Characteristic of the system, rather than an entity
Resource
An object which acts upon an entity.
Queues
Places where entities wait for resources.
Examples: drill, lathe in a machine shop
server at a restaurant
In Siman, an entity “seizes” and “releases” an entity.
Examples: drill, lathe in a machine shop
server at a restaurant
In Siman, an entity “seizes” and “releases” an entity.
20. 20 Definitions (cont) State of system
Values of a set of variables describing a system
Event
Instantaneous occurrence that causes a change in state.
Activity
Time consuming element in a system In Siman, queues may be given names, capacities, ordering schemes (FIFO, sort), etc. Most queue operations are handled automatically.
E.g.machine shop – running status; number of jobs in queue; number of jobs in process; next arrival time
Activity – machine process time; aircraft boarding time
Event time – job arrival, job completion
In Siman, queues may be given names, capacities, ordering schemes (FIFO, sort), etc. Most queue operations are handled automatically.
E.g.machine shop – running status; number of jobs in queue; number of jobs in process; next arrival time
Activity – machine process time; aircraft boarding time
Event time – job arrival, job completion
21. 21 The simulation clock Represents real system time (called TNOW in Arena)
Updating the simulation clock
Fixed increment time advance method
Increment clock by fixed amount
If an event is scheduled to occur during increment, follow appropriate actions
Very inefficient (why?)
22. 22 The simulation clock (2) Next event time advance method
Advance clock to time of next event
Requires list of scheduled events sorted by time
Most efficient (why?)
23. 23 Simple service model example System has two major events
One major activity Events – arrival departure
Activity – service; departure comes at end of service “activity”Events – arrival departure
Activity – service; departure comes at end of service “activity”
24. 24 Simple service model example We could enumerate all arrival times and all process times in advance
Usual practice is to determine them when they are needed
25. 25 Event-oriented simulation of a single server system
26. 26 If next event is a departure
27. 27 Single server systemmanual simulation example
28. 28 Single server systemmanual simulation example
29. 29 Arrivals and departures
30. 30 State diagram
31. 31 Recapping the simulation Data collected during simulations
Observational
Time-dependent
Know the difference!
32. 32 Recapping the simulation (2) Observational data
Sequence of equally weighted observations
Observations are mostly times…
Time in queue
Time in system
But the time the observation occurs – or sequence- is generally meaningless or irrelevant
33. 33 Calculating observational data Arena uses TALLY to collect observational data
Example
Customer Time in Queue Time in System
1 0 3
2 1 4
3 2 4
4 1 2
5 0 1
Average = 4/5=0.8 14/5=2.8
34. 34 Calculating time-dependent data Arena uses DSTAT to collect time dependent data
Also known as time-persistent data
Sequence of values weighted by the length of time the value persists
Normally not times (queue length, customers in system)
Duration of value is important
35. 35 Calculating time-dependent data Example of DSTAT
Deposit $300.00 on 1st day of a 30-day month
Draw it out on the second day
What is the average balance in the account for the month?
36. 36 Calculating time-dependent data Values must be time-weighted
Thus,
Average =
The values (300, 0) are weighted by the length of time (1, 29) they exist
What if we left the money in for two days?
37. 37 Calculating time-dependent data What if we put $300 in on the first day
$300 on the second day
And took it all out on the fifth day?
38. 38 Calculating time-dependent data
39. 39 Calculating time-dependent data To determine “average”
Queue length
Number of customers in system
Weight number of customers by the length of time
In general, for time persistent data:
Average = ti = length of ith period
qi = quantity in ith period
40. 40 Back to manual example Recall the state diagram (number of customers in system)
Calculate the average in system
41. 41 Calculating average in system Numerator
1*2 + 2*1 + 1*1 + 2*2 + 1*1 + 2*1 + 1*1 + 0*2 + 1*1 =14
Denominator
2 + 1 + 1 + 2 + 1 + 1 + 1 + 2 + 1 = 12
Average = 14/12 = 1.167
What is the average time in queue?
42. 42 Simulation Modeling Perspectives- continued
43. 43 Discrete and Continuous Simulation Discrete Simulation
Dependent variables (system responses) change only at discrete time points (event times)
Ex: Number of customers in the bank will be changed by:
A customer arrives at bank (+1 arrival event)
A customer departs bank (-1 departure event)
44. 44 Discrete and Continuous Simulation Continuous Simulation
Dependent variables change continuously
Ex: A water faucet filling water tanks at a certain rate (maybe constant)
45. 45 Discrete and Continuous Simulation
Combined Simulation
Some continuous variables - values may cause discrete event
Ex: Filled water tanks should be shipped away if a truck is available and the filling continued after a short stop, otherwise stop water until filled tanks are moved
46. 46 The World Views of Discrete (Event) Simulation Modeling
47. 47 The World Views of Discrete (Event) Simulation Modeling Event
Takes places at an “isolated” point in time to start or finish an activity
No duration
Ex: “take-off” as an event to the entire flight process
Process
A time-ordered sequence of events that may encompass several activities
Activity
Has beginning (an event) and ending (an event)
The entire duration is in between the two
Lead to the three world views in discrete simulation modeling: event, activity scanning, and process orientations
48. 48 The World Views of Discrete (Event) Simulation Modeling Event Orientation
Systems modeled only by changes that occur at discrete event times, e.g., arrival, departure
Events may change system’s state (an attribute or attributes that describe the system’s status),
e.g., busy ? idle
Actions may be taken as a result of events, according a decision logic associated with the specific combination of system’s current state and events that are occurring, e.g., if teller is idle and customer arrives and the transaction is a deposit, initiate a service activity of “deposit” (which may take a prescribed duration with a probability distribution)
49. 49 The World Views of Discrete (Event) Simulation Modeling Activity = f {Current State(s), Event(s)}
From an entity’s perspective, an activity may also have to concern current current state of other entities
Ex: System: A robot-machine mini cell
Entity: Robot
Current state: Idle
Event: Arrival of a part
Activities: If machine idle (available)
Then pick up part and put on machine, otherwise wait
50. 50
51. 51 The World Views of Discrete (Event) Simulation Modeling Relation to Statistics
Ex: Bank-Teller System
Customer: arrival ? (wait if teller busy) ? service ? departure
System state: NIS=NIS+1 NIS=NIS-1
Queue state: NIQ=NIQ+1 NIQ=NIQ-1
Teller state: idle ? busy busy ? idle
Cus’s TIS: Tci=TNOW TISci=TNOW-Tci
Cus’s TIQ: TQi=TNOW TIQci=TNOW-TQi
Note:
(1) Statistics for time-persistent variables
(2) Statistics based on observations
52. 52 The World Views of Discrete (Event) Simulation Modeling Activity Scanning Orientation
Model activities and prescribed conditions that cause an activity to start and end
Events that start or end the activity not scheduled by the model, but are initiated from the prescribed condition
Conditions are scanned as simulated time advances
Necessary to scan the entire set of activities to ensure the activity’s accountability
(compare: entity state checking in event orientation)
Scanning process slow - system inefficient
Not widely used in discrete simulation
53. 53 The World Views of Discrete (Event) Simulation Modeling Process Orientation
Model sequences of elements that occur in defined patterns, e.g., waiting in queue for a busy server
Logic of the sequence of events generalized and defined in a single statement
A high-level simulation language with graph network symbols, e.g., SLAM II, SIMAN, SIMNET
User-friendly interface - but still have to program
Higher-level - discrete use of symbols without programming, e.g., SLAMSYSTEMS
54. 54
55. 55
56. 56
57. 57
58. 58