Simulation Lectures Final
Simulation Lectures Final
CHAPTER ONE
INTRODUCTION TO SIMULATION AND MODELING
inputs
The inputs of a system are variables of the environment that influence the behavior of the system. These inputs may or may not be controllable by us.
outputs
The outputs of a system are variables that are determined by the system and may influence the surrounding environment. In many systems the same variables act as both inputs and outputs.
Definition: experiment
An experiment is the process of extracting information from a system by exercising its inputs.
Mathematical model
Definition: Mathematical model a description of a system where the relationships between variables of the system are expressed in mathematical form. Variables can be measurable quantities such as size, length, weight, temperature, unemployment level, information flow, bit rate, etc.
Modeling
Definition: Modeling is the process of obtaining a set of equations (mathematical model) that describes the behavior of the system. A model describes the mathematical relationship between inputs and outputs.
Physical model
Physical modelthis is a physical object that mimics some properties of a real system, to help us answer questions about that system. For example, during design of artifacts such as buildings, airplanes, etc.,
simulation
A simulation is an experiment performed on a model. formal definition of simulation: ``the process of designing a model of a real system and conducting experiments with this model for the purpose either of understanding the behavior of the system of or evaluating various strategies (within the limits imposed by a criterion or a set of criteria) for the operation of the system.''
Simulation is the imitation of the operation of a real world system over time.
Study Complex Systems Evaluate effect of variables Experiment with different designs Test scientific models
Prior to building a real-world system Provide training environment Validate design Create proof of concept
Advantages of simulation
Test new hardware before buying it Insight about system can be gained Speed up design-build-test-redesign cycle Can be used to verify models or theories Can be used AS COMMUNICATION TOOL
Disadvantages of Simulation
Model building often difficult and not unique Results may be hard to interpret Model and simulator may be too expensive May lead to false conclusions Results are as good as the model Bugs in software are unavoidable Requires human experts
Disadvantages of Simulation
Training required. Interpretation of results required. Time consuming/expensive. Inappropriately used.
10
Application Areas
Manufacturing/ Materials Handling Public and Health Systems Military Natural Resource Management Transportation Computer Systems Performance Communications
11
Applications of Simulations
Designing and analyzing manufacturing systems Evaluating H/W and S/W requirements for a computer system Evaluating a new military weapons system or tactics Determining ordering policies for an inventory system
Applications of Simulation
Designing communications systems and message protocols for them Designing and operating transportation facilities such as freeways, airports, subways, or ports Evaluating designs for service organizations such as hospitals, post offices, or fast-food restaurants Analyzing financial or economic systems
Applications of Simulation
COMPUTER SYSTEMS: hardware components, software systems, networks, data base management, information processing, etc.. MANUFACTURING: material handling systems, assembly lines, automated production facilities, inventory control systems, plant layout, etc.. BUSINESS: stock and commodity analysis, pricing policies, marketing strategies, cash flow analysis, forecasting, etc.. GOVERNMENT: military weapons and their use, military tactics, population forecasting, land use, health care delivery, fire protection, criminal justice, traffic control, etc..
13
Simulation Procedure
Step 1: Define objective, scope, requirements Step 2: Collect and analyze system data Step 3: Build model Step 4: Validate Model Step 5: Conduct experiments Step 6: Present results Note: Iterations required among steps
If there is an existing system, then compare model performance measures with the comparable performance measures collected from the actual system (see Step 2). This is called results validation.
For each system configuration of interest, decide on tactical issues such as run length, warm up period, and the number of independent model replications. Analyze the results and decide if additional experiments are required.
The final presentation for the simulation study should include animations and a discussion of the model building/validation process to promote model credibility.
CHAPTER THREE
SYSTEM DYNAMICS
quantity--any variable, parameter, constant, or output edge--a causal link between quantities
Vensim
Ventana Systems, Inc. Free from downloading off their web site: www.vensim.com Robust--including parametric data fitting and optimization best fit for higher education
PowerSim
What Arthur Andersen is using
A Simple Methodology
Collect info on the problem List variables on post-it notes Describe causality using a CLD Translate CLD into SFD Enter into VENSIM Perform sensitivity and validation studies Perform policy and WHAT IF experiments Write recommendations
Causal Modeling
A way to characterize the physics of the system Lacking: a Newton to describe the causality in these socioeconomic systems
A clear structural representation of the problem or process A way to extract the behavioral implications from the structure and data A hands on tool on which to conduct WHAT IF
Definition
Causal Loop Diagrams (CLDs) are structural pictures used to convey understanding about the interactions, or influences, within a structure. A CLD is used to explicitly show the nature of the influence relations between the elements of a structure.
There are two main conventions for representing CLDs, one using "+" and "-" and another using "S" and "O" as indicators on the influence from one element to another.
Meaning of +
A --> B with a "+" on the arrow indicates that "A" adds to "B". If "A" increases it adds even more to "B". If "A" decreases is adds less readily to "B" though it still adds.
Meaning of A --> B with a "-" on the arrow indicates that "A" subtracts from "B". If "A" decreases is subtracts even more readily to "B". If "A" increases is still subtracts from "B" though not as readily.
Influence Structures
If I have two things, thing 1 and thing 2, there are only two ways thing 1 can influence thing 2.
As indicated in Fig 1, thing 1 can add to thing 2, as indicated by a "+" sign, thus increasing thing 2.
examples
Example
+ Costs Losses
-Costs Profits
EXAMPLE: POPULATION
Consider a simple population with infinite resources-food, water, air, etc. Given, mortality information in terms of birth and death rates, what is this population likely to grow to by a certain time? Over a period of 200 years, the population is impacted by both births and deaths. These are, in turn functions of birth rate norm and death rate norm as well as population. A population of 1.6 billion with a birth rate norm of .04 and a death rate norm of .028
CLD
Birth rate normal + + Births
R +
population
-B +
Deaths +
Example:
Build a model of work flow from work undone to work completed. This flow is controlled by a work rate. Assume there are 1000 days of undone work Assume the work rate is 20 completed days a month Assume the units on time are months Assume no work is completed initially.
Murder rate
Average Temperature
Murder rate 0
Validation of CLDs
Clarity Quantity existence Connection edge existence Cause sufficiency Additional cause possibility Cause/effect reversal Predicted effect existence Tautology
CLD Examples
Salary VS Performance
Salary Performance Performance Salary
Tired VS Sleep
Tired sleep Sleep tired
Salary
Performance
Tired
Sleep
Signing Arcs
Salary
+
Performance
Tired
-
Sleep
Reinforcing Loop
Definition 1: A reinforcing loop is one in which the interactions are such that each action adds to the other. Any situation where action produces a result which promotes more of the same action, it is representative of a reinforcing loop. An increase in quantity 1 produces an increase in quantity 2 A decrease in quantity 1 produces a decrease in quantity 2
EXAMPLE
EXAMPLE
Fig 1 indicates what happens in a typical savings account. The principal in the savings account interacts with the interest rate and adds to the interest. Note that interest rate is considered to be a constant in this example. Interest then adds to the principal.
Balancing Loop
Definition 1:
A balancing loop is one in which action attempts to bring two things to agreement. Any situation where one attempts to solve a problem or achieve a goal or objective is representative of a balancing loop.
EXAMPLE
EXPLANATION
Fig 2 provides the basic form of the balancing loop. The desired state interacts with the current state to produce a gap. The gap adds to the action and the action adds to the current state. The current state then subtracts from the gap.
Signs of loops
reinforcing loops have an even number of negative links (zero also is even, see example above) Balancing loops have an uneven number of negative links.
Sign of loops
Balancing LOOP
Note: A Negative sign on an information link can be seen by saying either of:
An increase in quantity 1 produces a decrease in quantity 2
Population model
Have an odd number of signs Tend to produce stable, balance, equilibrium and goal-seeking behavior over time Notation: place symbol in the center of the loop
-
The more salary I get The better I perform The better I perform The more salary I get
Salary
+
Performance
Tired
-
Sleep
Loop Dominance
There are systems which have more than one feedback loop within them A particular loop in a system of more than one loop is most responsible for the overall behavior of that system The dominating loop might shift over time When a feedback loop is within another, one loop must dominate Stable conditions will exist when negative loops dominate positive loops
Birth rate
+
Polulation
-
Death rate
Sunshine
+
+ +
Earths temperature
+
Evaporation
+
+
Clouds
+
Rain
Exogenous Items
Items that affect other items in the system but are not themselves affected by anything in the system Arrows are drawn from these items but there are no arrows drawn to these items
+
Density of plants
Growth rate
Satisfied Customer
Population
10 B
Order rate
B
Actual inventory
500
Inventory : inv1
SYSTEMS DYNAMICS
Definition: System dynamics is an approach to understanding the behavior of complex systems over time. It deals with internal feedback loops and time delays that affect the behavior of the entire system.
stock
In STELLA terminology, a stock is a noun and represents something that accumulates. Some examples of stocks are population, radioactivity, enzyme concentration, selfesteem, and money.
Principle of Accumulation
In system dynamics modeling, dynamic behavior is thought to arise due to the Principle of Accumulation. According to the principle of accumulation, dynamic behavior arises when something flows through the pipe and faucet assembly and collects or accumulates in the stock.
flow
While a stock is a noun in the language of STELLA, a flow is a verb. A flow is an activity that changes the magnitude of a stock. Some examples of such activities are births in a population, decay of radioactivity, formation of an enzyme, improvement of self-esteem, and growth of money.
Figure 2: Example stock and flow structure with an inflow and outflow
Births
Coming to Age
Dearths
Total Population
Characteristics of stock
Have memory, Change the time shape of flows, Decouple flows, Create delays.
HAVE MEMORY,
If the inflow to the stock is shut-off, the number of entities in the stock will not decrease, but rather stay at the level it is at when the inflow stops. An outflow in excess of the inflow is required to decrease the number of entities in the stock.
PRESENTS THE TIME SHAPE OF THE STOCK WHEN THE FLOW IS AT A CONSTANT LEVEL OF 5 UNITS/TIME
Population model
10/10/2012
120
CREATES DELAYS
Systems often respond sluggishly From the example below, once the trees are planted, the harvest rate can be 0 until the trees grow enough to harvest
delay
+ Harvest rate
1. Information proceeds from stocks and parameters/inputs toward rates where it is used to control flows 2. Flow edges proceed from rates to states (stocks) in the causal diagram always
RATE
Rate
Auxiliary
i1 i2 Auxiliary o1 o2
o3 i3
i3
Output
Have no edges directed away from them
o1 o2
o3
Input/Parameter/Lookup
Outputs
Flow
System Dynamics
Modeling with STELLA software
Learning objective
After this class the students should be able to:
Understand basic concepts of system dynamics, Stock Variable; Flow Variable; Information Flow; Material Flow; and Time Delay; Understand how these basics elements interact with policies and decisions to determine the behavior of dynamic systems.
Time Management
The expected time to deliver this module is 50 minutes. 20 minutes are reserved for team practices and exercises and 30 minutes for lecture.
System Dynamics
Methodology to study systems behavior It is used to show how the interaction between structures of the
Warm-up
Each team is invited to describe through any kind of diagram the process to fill a cup of water. Imagine this as an exercise of operation management (5 minutes)
Feedback Loop
Feedback refers to the situation of X affecting Y and Y in turn affecting X perhaps through a chain of causes and effects.
Time Delay
\Its the time between the action and the result (consequence) of this action.
Time Delay
Causal Diagram
Desired Water Level
Faucet Position
Perceived Gap
Water Flow
Population Dynamic
Births
+
Population -
Deaths
Basic Elements
This methodology use five basics elements: Stock Variable; Flow Variable; Information Flow; Material Flow; and Time Delay
Material Flow
Activity
Stock
A Model
Control Material Flaw to Stock Stock Control Material Flaw from Stock
Figure 1
This stock is known as a reservoir. In our model, this stock represents the number of fish we have in this time are in our the pond
Figure 2
We use the flow tool (the right-pointing arrow, second from the left) to represent the control variable, so named because it controls the states (variables).
Converter
Next we need to know how the fish in our population reproduce, that is, how to accurately estimate the number of new fish per annum. Remember? We assumed our fish population reproduce at 5% per year. This can be represented as a transforming variable. A transforming variable is expressed as a converter, the circle that is second from the right in the STELLA toolbox.
Connector
At the right of the STELLA, toolbox is the connector (information arrow). We use the connector to pass on information about the REPRODUCTION RATE to REPRODUCTION and another to pass on information from FISH population to REPRODUCTION.
Figure 3
5/100 200
Figure 5
What-if?
From now on, the professor can practice what-if with the teams For example: What would happen if we decided to extract fish at a constant rate of 3% per year, and the reproduction rate varied with the fish population as it is seen in figure 6?
Figure 6
New model
Results
Figure 7
Reference
The Fifth Discipline. Peter Senge, Currency Doubleday, 1994, Chapter 5. Modeling Dynamic Economic System. Ruth, M. & Hannon, B. Springer, 1997, Chapter 1
MORE EXAMPLES
Increasing Crime
Events
Behaviour
System Structure
Drugs are a big worry for me. Not least because of the crimes that people commit to fund their dependency. We want the policy to bust these rings and destroy the drugs. They say theyre doing it and they keep showing us sacks of cocaine that they seized but the crime problem seems to be getting worse
Increasing Crime
Events
Behaviour
System Structure
Time
Increasing Crime
What is the structure of this system? What is the causal loop diagram which explains the observed behaviour?
Events
Call for Police Action
Behaviour
System Structure
Supply Demand
Building construction
Problem statement
Fixed area of available land for construction New buildings are constructed while old buildings are demolished Primary state variable will be the total number of buildings over time
Causal Graph
+
Construction
+
Industrial buildings
+ +
Demolition
-
Simulation models
Flow Graph
Construction (C) Industrial Buildings (B) Demolition (D)
Equations
dBl/dt = Cr Dr Cr = f1(CF, Bl) Dr = f2(AL,Bl)
Average lifetime for buildings (AL)
Construction
fraction (CF) Land available for industrial buildings (LA) Fraction of land occupied (FLO) Average area per building (AA)
The ultimate goal of model validation is to make the model useful in the sense that the model addresses the right problem, provides accurate information about the system being modeled and to makes the model actually used.
Definition: Validation
Validation is the process of determining whether a simulation model (as opposed to the computer program) is an accurate representation of the system, for the particular objectives of the study.
Definition: Verification
Verification is concerned with determining whether the conceptual simulation model (model assumptions) has been correctly translated into a computer program, i.e., debugging the simulation computer program.
Verification
A simulation model and its results have credibility if the manager and other project personnel accept them as "correct. A credible model is not necessarily valid, and vice versa.
It is critical to formulate the problem of interest in a precise manner. This should include an overall statement of the problem to be solved, a list of the specific questions that the model is to answer, and the performance measures that will be used to evaluate the efficacy of particular system configurations.
There will never be a single person that knows all of the information necessary to build a simulation model. Thus, it will be necessary for the simulation analysts to talk to many different SMEs to gain a complete understanding of the system to be modeled.
QUESTION
A military analyst worked on a simulation project for several months without interacting with the general who requested it. At the final Pentagon briefing for the study, the general walked out after five minutes stating, Thats not the problem Im interested in.
MODEL VERIFICATION
Step 1: Write and debug the computer program on modules or subprograms. Step 2: More than one person review the computer program (structured walk through of the program). Step 3: Run the simulation under a variety of settings of input parameters, and check to see that the output is reasonable.
MODEL VERIFICATION
Step 4: "trace", interactive debugger. Step 5: The model should be run under simplifying assumptions for which its true characteristics are known or can easily be computed. Step 6: Observe an animation of the simulation output.
MODEL VERIFICATION
Step 7: Compute the sample mean and variance for each simulation input probability distribution, and compare them with the desired mean and variance. Step 8: Use a commercial simulation package to reduce the amount of programming required.
VALIDATION SCHEMES
Structure-Verification Test: This test is meant to answer the following question Is the model structure not in contradiction to the knowledge about the structure of the real system, and have the most relevant structures of the real system been modeled?
Dimensional-Consistency Test:
Do the dimensions of the variables in every equation balance on each side of the equation? This test verifies whether all equations are dimensionally constant.
Extreme-Conditions Test:
Does every equation in the model make sense even if subjected to extreme but possible values of variables? Policy equations are scrutinized for their applicability in extreme conditions.
Boundary-Adequacy Test:
This test verifies whether the model structure is appropriate for the model purpose. Is the model aggregation appropriate and includes all relevant structure containing the variables and feedback effects necessary to address the problem and suit the purposes of the study?
CHAPTER SIX
BUILT IN FUNCTIONS
BUILT IN FUNCTIONS
The software's test input Builtins enable you to conduct controlled experiments on your model. Typically, a PULSE, RAMP or STEP is appended to an inflow or outflow equation. When the Built-in is activated (at the time you specify) it will knock the system out of its previous state. You can then observe how your model responds to this idealized test.
PULSE FUNCTION
PULSE(<volume>[,<first pulse>,<interval>]) The PULSE function generates a pulse input of a specified size (volume). In using the PULSE function, you have the option of setting the time at which the PULSE will first fire (first pulse), as well as the interval between subsequent PULSEs (interval).
PULSE FUNCTION
Each time that it fires a pulse, the software pulses the specified volume over a period of one time step (DT). Thus, the instantaneous value taken on by the PULSE function is volume/DT. Volume can be either variable or constant. First pulse and interval should be specified as constants.
EXAMPLE
Draw the stock and flow pattern generated by the following equations: Flow = PULSE(20,10,10) Flow = PULSE(10,15,10) Flow = PULSE(20,30,40)
RAMP
RAMP(<slope>[,<time>]) The RAMP function generates a linearly increasing or decreasing input over time with a specified slope (slope). Optionally, you may set the time at which the ramp begins. Slope and time can be either variable or constant. As the simulation progresses, the RAMP will return a 0 before its time to begin has been reached. If you do not set the RAMP's time, it will begin at the outset of the simulation.
EXAMPLE
Draw the stock and flow pattern generated by the following equations: Pamp_Input =RAMP(25,5) Pamp_Input =RAMP(5,15) Pamp_Input =RAMP(15,15) Pamp_Input =RAMP(5,5)
STEP FUNCTION
STEP(<height>,<time>) The STEP function generates a one-time step change of specified height (height), which occurs at a specified time (time). Height and time can be either variable or constant. Example: Step_Input = 5 + STEP(5,10) generates the behavior pattern.
EXAMPLE
Draw the stock and flow pattern generated by the following equations: Step_Input = STEP(20, 20) Step_Input = 10 + STEP(20, 20) Step_Input = 20 + STEP(20, 20) Step_Input = 5 + STEP(20, 10) + STEP(20, 20) Step_Input = 10 + STEP(10, 20)+ STEP(25, 20)
Graphical Functions
The Become Graph button at the lower left of the dialog enables you to define the converter as a graphical function. Graphical functions also may be defined from within a flow dialog.