You are on page 1of 142

Introduction to Modelling and Simulation

Methods and Algorithms


Classical Approach

Classical Scientific Problem


• Application of Theories
• Execute Experiments

Problem Solution

Experiment

2
Classical Approach

Classical Scientific Problem


• Application of Theories
• Execute Experiments

Theory

Problem Solution

Experiment

3
Simulation

Simulation
• Experiments in virtual laboratory
• Experiments in the computer
• The third pillar of science beside theory and
experiment

Problem Modell Simulator

Scientific Research Abstraction of Experimental


problem Reality Environment

4
Simulation

Simulation
• Experiments in virtual laboratory
• Experiments in the computer
• The third pillar of science beside theory and
experiment

Theory

Problem Simulation Solution

Experiment

5
Solution finding

6
What is Computer Simulation ?

Definition (Shannon, 1975)

Simulation is 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 and its underlying causes or
of evaluating various designs of an artificial system or
strategies for the operation of the system.

7
What is Computer Simulation ?

Definition 2 (VDI-Richtlinie 3633)

Simulation is a (virtual) copy of a real system with its dynamic processes in a


(virtual) model (computer model) and (virtual) experiments with experiments
with this model, which allow interpretations for the real system.

In a practical sense, simulation is i) preparing, ii) performing, and iii)


evaluating experiments with a simulation model.

Simulation allows to study time-dependent behaviour of complex dynamical


systems in a simulation model.

8
Dynamical Systems

A system is a set of interacting or interdependent components


forming an integrated whole

A dynamic system is a set of


dynamically interacting or
interdependent components forming
an integrated whole

9
Dynamical Systems

A dynamic system is a set of dynamically


interacting or interdependent
components forming an integrated whole

• Dynamical systems change their behaviour dependent on acting


input signals, disturbances, and initial values
.
• The behaviour of a dynamical system is not direct proportional
to input and disturbance change, it changes its behaviour on
basis of its own dynamic and on inputs.

10
Dynamical Systems

• Dynamical systems change their behaviour


dependent on acting input signals, disturbances,
and initial values
.
• The behaviour of a dynamical system is not direct
proportional to input and disturbance change, it
changes its behaviour on basis of its own dynamic
and on inputs.

Initial Conditions Elements of a Dynamical System

• States x(t)
Inputs Outputs
Dynamic System • Inputs u(t)
(States) • Disturbances w(t) = Inputs
• Outputs y(t)
• Fixed Parameters, Intial Conditions
Disturbances • Time dependent Parameters (Inputs)

11
Dynamical Systems

• Dynamical systems change their behaviour


dependent on acting input signals, disturbances,
and initial values
.
• The behaviour of a dynamical system is not direct
proportional to input and disturbance change, it
changes its behaviour on basis of its own dynamic
and on inputs.

Initial Conditions Elements of a Dynamical System


Potential
Benefit
Customers • States x(t)
Inputs Outputs
Dynamic System • Inputs u(t)
PC (States) BF • Disturbances w(t) = Inputs
• Outputs y(t)
• Fixed Parameters, Intial Conditions
Disturbances • Time dependent Parameters (Inputs)

12
Dynamical Systems

• Dynamical systems change their behaviour


dependent on acting input signals, disturbances,
and initial values
.
• The behaviour of a dynamical system is not direct
proportional to input and disturbance change, it
changes its behaviour on basis of its own dynamic
and on inputs.

Initial Conditions
Potential
static
Benefit
BF = Faktor  PC
Customers
Inputs Outputs
Dynamic System
PC (States) BF

Disturbances

13
Dynamical Systems

• Dynamical systems change their behaviour


dependent on acting input signals, disturbances,
and initial values
.
• The behaviour of a dynamical system is not direct
proportional to input and disturbance change, it
changes its behaviour on basis of its own dynamic
and on inputs.

Initial Conditions
Potential
static
Benefit
BF = Faktor  PC
Customers
Inputs Outputs
Dynamic System
PC (States) BF
dynamic
Disturbances BF (t ) = Function ( PC (t ), t , Parameters)

14
Dynamical Systems

• Dynamical systems change their behaviour


dependent on acting input signals, disturbances,
and initial values
.
• The behaviour of a dynamical system is not direct
proportional to input and disturbance change, it
changes its behaviour on basis of its own dynamic
and on inputs.

Initial Conditions
Potential
static
Benefit
BF = Faktor  PC
Customers
Inputs Outputs
Dynamic System
PC (States) BF
really dynamic
Disturbances BF (t ) = Function ( PC (t ), BF (t ), t , Par )

15
Dynamical Systems

• Dynamical systems change their behaviour


dependent on acting input signals, disturbances,
and initial values
.
• The behaviour of a dynamical system is not direct
proportional to input and disturbance change, it
changes its behaviour on basis of its own dynamic
and on inputs.

Initial Conditions
Potential
static formula
Benefit
BF = Faktor  PC
Customers
Inputs Outputs
Dynamic System
PC (States) BF
dynamic model
Disturbances BF (t ) = Function ( PC (t ), BF (t ), t , Par )

16
Dynamical Systems

Initial Conditions
Potential static formula
Customers Benefit
Inputs
Dynamic System Outputs
BF = Faktor  PC
PC (States) BF

Calculation
Disturbances

dynamic model

BF (t ) = Function ( PC (t ), BF (t ), t , Par )
Simulation

17
Dynamical Systems

Initial Conditions
Potential
Benefit Dynamic mathematical model
Custome
rsInputs Dynamic Outputs
System BF (t ) = Function ( PC (t ), BF (t ), t , par )
BF
(States) Simulation
PC

Disturbances
Feedbacks
System input
A dynamical system System output
may consist of a set of
components, which
themselves are
dynamical subsystems
and which influence
each other Subsystem Interconnection

18
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

19
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

20
What is a Model?

1. Mapping - A model is a Problem

Modelling

representation of a natural Mod Model


el Structure
Model Analysis Identification: NOT OK
Numeric/Programmin Parameter
g Determination

or an artificial object.
Simulator Model
Structure
OK
Basic Simulation

Simulation Results

2. Reduction - A model is
Validation:
Comparison & Validation: Analysis
Fit of Simulation / Parameter / Model
Reality

usually simplified and does


Bad Fit

Good Fit

Experiments with
Model

not have all attributes of the


(„Simulation“)

Problem Solution

original object.
3. Pragmatism - A model is
always created for a certain
purpose, a certain subject
and a certain time-span.

(Stachoviak 1973)

21
Model Classification

models
Problem

Modelling

Mod Model
el Structure
Model Analysis Identification: NOT OK
Numeric/Programmin Parameter
g Determination
Simulator Model
Structure
OK
Basic Simulation

immaterial
Simulation Results

material Validation:
Comparison &
Fit of Simulation /
Reality
Validation: Analysis
Parameter / Model

Bad Fit

Good Fit

Experiments with
Model
(„Simulation“)

Problem Solution

scaled analogue symbolic formal verbal

math. mathematic grafic math.-grafic


algorithmic

simulation analytic simulation analytic simulation


models models models models models

22
Model Classification

models
Problem

Modelling

Mod Model
el Structure
Model Analysis Identification: NOT OK
Numeric/Programmin Parameter
g Determination
Simulator Model
Structure
OK
Basic Simulation

immaterial
Simulation Results

material Validation:
Comparison &
Fit of Simulation /
Reality
Validation: Analysis
Parameter / Model

Bad Fit

Good Fit

Experiments with
Model
(„Simulation“)

Problem Solution

scaled analogue symbolic formal verbal

math. mathematic grafic math.-grafic


algorithmic

simulation analytic simulation analytic simulation


models models models models models

23
Modelling by Abstraction

Two Steps of Abstraction


• Structural Abstraction – Qualitative Knowledge
Identification of system borders and states

• Phenomenological Abstraction – Quantitative


Knowledge
quantisation of states, identification of physical,
economic, biologic, … interactions in and with
subsystems

24
Modelling vs Model

Modelling Approach Model Type

• System Dynamics (SD)


• Ordinary Differential
• Transfer Functions (TF)
Equations (ODEs)
• Compartment Modelling
• Partial Differential
• Math. Formula
Equations (PDEs)
• Lagrange Formalism
• Differential Algebraic
• Port-based physical
Equations (DAEs)
Modelling
• Difference Equations
• Difference Equation
(DEs)
Modelling
• Cellular Automata (CAs)
• Cellular Automata
• Agent-based
Modelling
Systems/Models (ABMs)
• Agent-based Modelling
• Discrete Event Systems
• Event Graphs
(DES)
• Process Flow
Modelling vs Model

Modelling Approach Model Type

• System Dynamics (SD)


• Ordinary Differential
• Transfer Functions (TF)
Equations (ODEs)
• Compartment Modelling
• Partial Differential
• Math. Formula
Equations (PDEs)
• Lagrange Formalism
• Differential Algebraic
• Port-based physical
Equations (DAEs)
Modelling
• Difference Equations
• Difference Equation
(DEs)
Modelling
• Cellular Automata (CAs)
• Cellular Automata
• Agent-based
Modelling
Systems/Models (ABMs)
• Agent-based Modelling
• Discrete Event Systems
• Event Graphs
(DES)
• Process Flow
Landmap of Modelling Methods

The variety of different


Modelling approaches can be
Definition
seen like (Shannon
a structured 1975)
landmap.
„Simulation is 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 and its underlying causes or of
evaluating various designs of an artificial
system or strategies for the operation of the
system.“

27
Landmap of Modelling Methods –
Dynamic Models

Definition (Shannon 1975)


„Simulation is 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 and its underlying causes or of
evaluating various designs of an artificial
system or strategies for the operation of the
system.“

28
Dynamic Models – Time
Discrete/Continuous

Neglecting quantum-mechanics (space as well as)


time can be seen to be a continuous number.
▪ A model is called time-continuous if the
output value of the model can be calculated
at any time (≈ 𝑡 ∈ ℝ).
▪ In the opposite a model is called time-
discrete if values are only calculated at a
finite number of predefined timesteps (≈ 𝑡 ∈
ℕ).

29
Dynamic Models – Time
Discrete/Continuous

• Usually time-continuous models are preferred


to time-discrete models, but the simulation
process is usually more difficult.
• Yet, there are processes in real world for
which time continous models are not
necessary or even dont make sense.
• Very often, time-continuous models cannot
be simulated continously. So they need to be
reformalised in a time-discrete manner – this
process is called discretisation.

30
Landmap of Modelling Methods – Time
Discrete / Continous

Definition (Shannon 1975)


„Simulation is 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 and its underlying causes or of
evaluating various designs of an artificial
system or strategies for the operation of the
system.“

31
Dynamic Models – Value
Discrete/Continuous

Similar to time-discrete/continuous, also output


values can be determined discrete or
continuously.
▪ Value-discrete:
- Number of passengers on a plane
- Number of cars searching for a parking spot.
▪ Value-continuous:
- Voltage/Current in an Electrical Circuit
- Angular Velocity of a Pendulum

32
Dynamic Models – Value
Discrete/Continuous

▪ Although simulation output is expected to be


continuous/discrete, it is not necessarily
modelled in a continuous/discrete way.

E.g.:
Population of a country is a discrete number…
… yet it can be modelled by a continous
model

It requires a correct result interpretation!

33
Examples –Discrete/Continuous

Electricity Consumption People in check-in hall

value
value

time time

Monthly Budget Number of passengers


each flight
value

value

time time

34
Landmap of Modelling Methods –
Discrete / Continous

35
Model Procedures

System

Theoretical Modelling Experimental Modelling


Deductive Analysis Inductive Analysis
Modelling by Laws and Rules Modelling by using models
with observed behaviour
White Box Modelling Black Box Modelling

Ohms Law
Newton‘s Law
Mathematical Model
Supply/Demand Law

36
Application vs. Modelling Approach

White Box Modeling



Electrotechni • Laws
que

• Mechanics • Laws and Observations

• Environment
• Laws and Observations
• Medicine
• Observations and Characterisation
• Economy

• Sociology • Observations and Characterisation

Black Box Modeling

37
Model Reduction

From Deduction to Induction



Electrotechni • Laws
que

• Mechanics • Laws and Observations

• Environment
• Laws and Observations
• Medicine
• Observations and Characterisation
• Economy

• Sociology • Observations and Characterisation

Deductive models may contain too many parameters –


problems with identification

38
Landmap of Modelling Methods –
Discrete / Continous

39
Stochastic/Deterministic

• If the output of the simulation of a model is


uniquely defined by input parameters, initial
conditions and model parameters the model
is called deterministic.
• Otherwise it is called stochastic.
Results: Results:
14.2 14.3
14.2 deterministic 14.6 stochastic
14.2 13.9
14.2 14.2
... ...

40
Stochastic/Deterministic

Stochastic models are necessary…


▪ … if random effects are included in the system.
→ coin toss, rolling a dice, …

▪ … if emelents of the system are too complex to


be described by deterministic rules.
→ human behaviour, problems at system borders,…

41
Stochastic/Deterministic

Stochastic models are necessary…


▪ … if random effects are included in the system.
→ coin toss, rolling a dice, ...

▪ … if emelents of the system are too complex to


be described by deterministic rules.
→ human behaviour, problems at system borders,…
→ coin toss, rolling a dice, …

42
Landmap of Modelling Methods –
Discrete / Continous

43
Microscopic/Macroscopic Models

• If systems consist of a big set of similar


subsystems...
individual

subsidiary

car

wooden
fibre

... the question arises whether a micro- meso-


or macroscopic model should be used.
44
Microscopic/Macroscopic Models

• Microscopic models treat each subsystem as


an individual model. Finally they are linked in
order to model the whole system.

individual individual
individual individual

individual individual
individual

individual individual
individual

45
Microscopic/Macroscopic Models

• Macroscopic models treat the whole system,


neglecting the fact, that it consists of
subsystems.

Population

46
Landmap of Modelling Methods –
Microscopic/Macroscopic

47
Approaches for Soft Sciences
Simulation

(Troitzsch)

48
Approaches for Soft Sciences
Simulation

Aggregated Distributed (Troitzsch)

49
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

50
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

51
Simulation Circle

Problem
Modelling
• simulation Model Structure
software Model NOT OK
Model Analysis Identification:
• simulation Numeric/Programming Parameter Determination
Model Structure
languages Simulator OK

Basic Simulation
• Simulators
Simulation Results
Validation: Comparison & Validation: Analysis
• Simulation Parameter / Model
Fit of Simulation / Reality
systems

Bad Fit
• Simulation
Environments Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

52
Simulation Circle

Problem
Modelling
• simulation Model Structure
software Model NOT OK
Model Analysis Identification:
• simulation Numeric/Programming Parameter Determination
Model Structure
languages Simulator OK

Basic Simulation
• Simulators
Simulation Results
Validation: Comparison & Validation: Analysis
• Simulation Parameter / Model
Fit of Simulation / Reality
systems

Bad Fit
• Simulation
Environments Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

53
Simulation Circle

Problem
Modelling
• simulation Model Structure
software Model NOT OK
Model Analysis Identification:
• simulation Numeric/Programming Parameter Determination
Model Structure
languages Simulator OK

Basic Simulation
• Simulators
Simulation Results
Validation: Comparison & Validation: Analysis
• Simulation Parameter / Model
Fit of Simulation / Reality
systems

Bad Fit
• Simulation
Environments Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

54
Simulation Circle

Problem
Modelling
• simulation Model Structure
software Model NOT OK
Model Analysis Identification:
• simulation Numeric/Programming Parameter Determination
Model Structure
languages Simulator OK

Basic Simulation
• Simulators
Simulation Results
Validation: Comparison & Validation: Analysis
• Simulation Parameter / Model
Fit of Simulation / Reality
systems

Bad Fit
• Simulation
Environments Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

55
Simulation Circle

Problem
Modelling
• simulation Model Structure
software Model NOT OK
Model Analysis Identification:
• simulation Numeric/Programming Parameter Determination
Model Structure
languages Simulator OK

Basic Simulation
• Simulators
Simulation Results
Validation: Comparison & Validation: Analysis
• Simulation Parameter / Model
Fit of Simulation / Reality
systems

Bad Fit
• Simulation
Environments Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

56
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

57
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Verification Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

58
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

59
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

60
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

61
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

62
Simulation Circle
Problem

Modelling

Model Structure
NOT OK
Model

Model Analysis Identification:


Numeric/Programming Parameter Determination
Model Structure
OK
Simulator

Basic Simulation

Simulation Results

Validation: Comparison & Validation: Analysis


Fit of Simulation / Reality Parameter / Model

State, Bad Fit

Observation Good Fit

Experiments with Model


(„Simulation“)

Problem Solution


⧫ ⧫ ⧫

⧫ ⧫ ⧫ ⧫ ⧫ ⧫
⧫ ⧫ ⧫

⧫ Measurement Simulation

time

63
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

64
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

65
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

66
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

67
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

68
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution Visualisation???

69
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution
Visualisation

70
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“) Visualisation
Problem Solution Data-Driven

71
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“) Visualisation
Problem Solution
Data Driven

72
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“) Visualisation
Problem Solution
Simulation Driven

73
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“) Visualisation
Problem Solution Model-Driven

74
Testcase: Predator-Prey

SIMULATION CIRCLE

75
Simulation Circle

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

76
What is System Dynamics

Forrester, 1961

System Dynamics is a field that resulted from the pioneering


efforts of Jay W. Forrester to apply the engineering principles of
feedback and control to social systems.

System Dynamics generates qualitative models based on


causalities.

By appropriate parameterisation, the qualitative models can be


transformed into “quantitative” computer models to simulate the
investigated system

77
World Models

Systems Dynamics and DYNAMO received widespread


interest mainly because they were used to build large
world models such as
• WORLD2 (World Dynamics, Forrester1971);
• WORLD3 (The Dynamics of Growth in a Finite World,
[Meadows]);
• and WORLD3 revisited (Beyond the Limits).

78
World Models

79
Key to develop SD Models

Causal thinking is the key to organizing


ideas in a system dynamics study
(Roberts et al. 1983)

cause effect
How to build a SD Model?

1. Identify system variables and system


boundaries
2. Capture links of variables in a
Causal Loop Diagram (CLD)
3. Build a Stock and Flow Diagram (SFD)
-----------------------------------------------------------
• Implement the model in a simulator
1. System Variables and Boundaries

a. Analysis of the problem - Determining the


purpose and the use of the model and
defining a target for the simulation.
b. Start collecting information and data. Start
developing hypothesis about the parts of the
system.
c. Determine the elements of the system.
d. Determine causal relationships between the
elements.
1. System Variables and Boundaries

System
Links boundary

System variables
2. Causal Loop Diagram

Capture the behavior and links of and within the


system by interlinking system variables that are related
to each other

Behavior of system due to:


• Feedback Loops
• System memory (stocks)
• Delays in material and information delays
2. Causal Loop Diagram

Main components of CLDs:


• System variables: names of elements
• Link - positive:

Eating Weight
+

Represented by a plus-sign
Increase in variable Eating results in an increase in
variable Weight
2. Causal Loop Diagram

Main components of CLDs:


• Link – negative:
Diet Weight
-

Represented by minus-sign.
Increase in variable Diet results in a
decrease in variable Weight
2. Causal Loop Diagram

Main components of CLDs:


• Feedback Loops: are closed loops of arrows,
represented by a:
“(+)” (or ”(R)” for reinforcing) or
“(-)” (or “(B)” for balancing) sign in the middle.
2. Causal Loop Diagram

Main components of CLDs:


• Feedback Loops: are closed loops of arrows,
represented by a
“(+)” (or ”(R)” for reinforcing) or
“(-)” (or “(B)” for balancing) sign in the middle.
2. Causal Loop Diagram

Feedback Loops
▪ Search to identify closed, causal feedback loops
is one key element of System Dynamics
▪ The most important causal influences will be
exactly those that are enclosed within feedback
loops
2. Causal Loop Diagram

Types of behavior due to loops:


▪ Exponential Growth: arises from positive
(reinforcing) feedback loop.
Example:

Population Births
2. Causal Loop Diagram

Causation vs. Correlation


• Correlation represents past behavior and not
the structure of the system
• Causation represents the causal links of the
structure

Wrong: Right:
Ice Creme Murder Ice Creme Murder
+ Sales + + Rate
Sales Rate

Avgerage
Temperature
2. Causal Loop Diagram

At least one negative feedback loop is


necessary to receive a stable system

Lack of Space Population


3. Stock and Flow Diagram

Problem: Not all system elements are system variables!

Solution: distinguish between


• Sources/Sinks
• Levels/Stocks
• Flows
• Auxiliaries
• Paramters
• Links
SFM – Sources/Sinks

Sources/Sinks:
Source represents systems of levels and
rates outside the boundary of the
model
Sink is where flows terminate outside
the system

E.g.: Raw Material (Source for


„Construction“ Flow), Graveyard (Sink for
„Dying“ Flow)
SFM - Stocks

Levels/Stocks/System variables:
A quantity that accumulates over
time and changes its value
continuously.

E.g.: Size of a population, Number of


people waiting in a queue, Number of
goods waiting to be transported, etc.
SFM – Flow

Flow/Rate/Activity/Movement:
Changes the values of levels. Every level
has at least to be connected to one flow
in order to change its value.

E.g.: Birth (Changes the value of the


stock „population“), Eating (Changes the
value of the stock „amount of food“), etc.
SFM – Auxiliary

Auxiliary:
Everything that can directly/analytically be
calculated out of stocks and constants.
Often useful, to avoid confusing models.

E.g.: Density (can directly be calculated


by the stocks/constants „mass“ and
„volume“), Quelength (calculated by stock
„people in queue“ and constant „average
size of one person“), etc.
SFM – System/Input Parameters

Parameter /Constant
Everything that is predefined for the
whole simulation – usually it is a
constant but can be a function too.

E.g.: Average Temperature, Number of


Cash Desks (In a supermarket), Birth
Rate, Maximum capacity of a Room, etc.
Graphical Representation

Initial value of state

Source Change of State


State

Feedback
Rate of
change
From CLD to SFM (1)

Population Births

Population
Births
From CLD to SFM (2)

Lack of Space Population Births

Space
Lack of Space

Population
Births
Predator – Prey System

Dynamics: Predator eats Prey


Problem Predator / Prey births, deaths
Modelling

Model

Environment: isolated
Measurement: Predator Population
5 Years = 60 months, quarterly

Problem: When is a reasonable time to use


chemical pesticides to reduce number of
predators?

102
Predator – Prey System

Problem
Modelling

Model

103
Predator – Prey System

Problem
Modelling

Model

𝑌 𝑡 … Prey
Separation – 𝑋 𝑡 … Predators
Isolated environment

Choice -
2 variables = 2 states

104
Modelling

Problem
Separation –
Modelling
Isolated environment
Model
Choice -
2 variables = 2 states
Causality –
Predator – Prey – Model

105
Modelling

Problem
Separation –
Modelling
Isolated environment
Model
Choice -
2 variables = 2 states
Causality –
Predator – Prey – Model
Y(t) .. Prey Population
X(t) .. Predator Population

106
Modelling

Problem
Causality –
Modelling
Predator – Prey – Model
Model
Y(t) .. Prey Population
X(t) .. Predator Population

System Dynamics –
Population Interaction

107
Modelling

Causality – Predator – Prey – Model


Y(t) .. Prey,
X(t) .. Predator
Problem System Dynamics - Population interaction
Modelling

Model
Then #Preys If #Prey
decreases increases

If #Predator Then #Predators


increases increases

108
Modelling

Causality – Predator – Prey – Model


Y(t) .. Prey,
X(t) .. Predator
Problem System Dynamics - Population interaction
Modelling

Model

+
Then #Preys If #Prey
decreases
- increases

+
If #Predator Then #Predators
increases increases
+
109
Modelling

Causality – Predator – Prey – Model


Y(t) .. Prey,
X(t) .. Predator
Problem System Dynamics - Population interaction
Modelling

Model

- Causal
Loop
Diagram

+
110
Modelling

System Dynamics - Population interaction

Problem
Modelling

Model + Prey -
Prey Pop Prey
Growth + Loss
-
+
+ Food
Rate
+
Causal
Loop
Pred + Pred
+ Pred
Growth Loss
Diagram Pop
-
111
Modelling

System Dynamics - Population interaction

Problem
Modelling

Model

+
-
Prey
Prey Pop Prey
+
Growt Loss
h

Food
+

Causal
Rate

Loop
+

+ +
Pred Pred
Growt Pred Loss

Diagram
h Pop

112
Modelling

+
-
Prey
Prey Pop Prey
+
Growt Loss
h
+

Problem
Food
Rate
+

+ +
Pred Pred
Growt Pred Loss
h Pop

Modelling

Model Causality –
Predator – Prey – Model
x(t) .. Prey
y(t) .. Predator
Logistic Growth -
𝑥ሶ = 𝑎𝑥 − 𝑏𝑥𝑦
𝑦ሶ = −𝑑𝑦 + 𝑒𝑥𝑦
Population rate = Growth rate + food
rate

113
Simulation Circle: Predator - Prey

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit
+
-
Prey
Prey Pop Prey
+
Growt Loss
h
+

Experiments with Model Food


Rate

(„Simulation“)
+

+ +
Pred Pred
Growt Pred Loss

Problem Solution
h Pop

114
Model Analysis

Model
Model Analysis +
-
Numeric/Programming Prey
Pop
Prey Prey
+
Simulator Growth Loss

Causal +

Loop Food
Rate

Diagram +

+ +
Pred Pred
Growth Pred Loss
Pop

Stock
and
Flow
Diagram

115
Model Analysis

Model
Model Analysis +
-
Numeric/Programming Prey
Pop
Prey Prey
+
Simulator Growth Loss

Causal +

Loop Food
Rate

Diagram +

+ +
Pred Pred
Growth Pred Loss
Pop

Stock
and
Flow
Diagram

116
Implementation

Model
Model Analysis
Numeric/Programming
Simulator

117
Simulation Circle: Predator - Prey

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit
+
-
Prey
Prey Pop Prey
+
Growt Loss
h
+

Experiments with Model Food


Rate

(„Simulation“)
+

+ +
Pred Pred
Growt Pred Loss

Problem Solution
h Pop

118
Implementation

Simulator
Basic Simulation

Simulation Results

119
Implementation

Simulator
Basic Simulation
Population development over time:
Simulation Results

Parameters:

x = (a − b  y )x
y = (−c + d  x) y

120
Simulation Circle: Predator - Prey

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit
+
-
Prey
Prey Pop Prey
+
Growt Loss
h
+

Experiments with Model Food


Rate

(„Simulation“)
+

+ +
Pred Pred
Growt Pred Loss

Problem Solution
h Pop

121
Validation

Simulation Results
Validation: Comparison &
Fit of Simulation / Reality

Data
Bad Fit

Good Fit

122
Data & Simulation Results

Simulation Results
Validation: Comparison &
Fit of Simulation / Reality

Bad Fit

Good Fit

Search for
convenient
parameters

123
Data & Simulation Results

Simulation Results
Validation: Comparison &
Fit of Simulation / Reality

Bad Fit

Good Fit

Search for
convenient
parameters

No
Damping
in Model

124
Simulation Circle: Predator - Prey

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit
+
-
Prey
Prey Pop Prey
+
Growt Loss
h
+

Experiments with Model Food


Rate

(„Simulation“)
+

+ +
Pred Pred
Growt Pred Loss

Problem Solution
h Pop

125
Model Modification

Simulation Results
Validation: Comparison &
+ Prey -
Fit of Simulation / Reality Prey Pop Prey
Growth + Loss
Bad Fit +
Good Fit Food
Rate
Model Extension: +
• Both the predator and the
prey compete for food and Pred + Pred
+ Pred
shelter in the forest. Growth Loss
Pop
• Competition sets in and the
population of each species tends
-
to control itself via a negative
effect, that is the population
decreases with a rate directly
proportional to the present
population of that species.

126
Model Modification

Simulation Results
Prey
Validation: Comparison & Comp
Fit of Simulation / Reality + +
Prey -
Bad Fit Prey + Pop Prey
Growth Loss
Good Fit
+

Model Extension: Food


• Both the predator and the Rate
+
prey compete for food and
shelter in the forest. + +
Pred Pred
Growth Pred Loss
• Competition sets in and the
Pop
population of each species tends - +
to control itself via a negative
effect, that is the population Pred
decreases with a rate directly Comp
proportional to the present
population of that species.

127
Model Modification

Simulation Results Causal Prey


Comp

Validation: Comparison &


+ +

Fit of Simulation / Reality Loop Prey


Growth +
Prey
Pop
-

Prey
Loss

Diagram +

Bad Fit
Food
Rate

+ +

Good Fit Pred


Growth
Pred
Pred
Loss

Pop

-
+

Pred
Comp

Model Extension:
• Competition Feedback

128
Model Modification

Simulation Results Causal Prey


Comp

Validation: Comparison &


+ +

Fit of Simulation / Reality Loop Prey


Growth +
Prey
Pop
-

Prey
Loss

Diagram +

Bad Fit
Food
Rate

+ +

Good Fit Pred


Growth
Pred
Pred
Loss

Pop

-
+

Pred
Comp

Stock
and
Flow
Diagram

129
Model Modification

Simulation Results
Validation: Comparison &
Fit of Simulation / Reality
Stock
Bad Fit and
Good Fit
Flow
Diagram

130
Model Modification

Simulation Results
Validation: Comparison &
Fit of Simulation / Reality Parameters:

Bad Fit

Good Fit

x = (a − b  y)x − e  x 2 = (a − e  x − b  y) x
y = (−c + d  x) y − f  y 2 = (−c − f  y + d  x) y

131
Simulation Circle: Predator - Prey

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

132
Model Modification

Simulation Results
Validation: Comparison &
Fit of Simulation / Reality Parameters:

Bad Fit

Good Fit

x = (a − b  y)x − e  x 2 = (a − e  x − b  y) x
y = (−c + d  x) y − f  y 2 = (−c − f  y + d  x) y

133
Simulation Circle: Predator - Prey

Problem
Modelling
Model Structure
Model NOT OK
Model Analysis Identification:
Numeric/Programming Parameter Determination
Model Structure
Simulator OK

Basic Simulation

Simulation Results
Validation: Comparison & Validation: Analysis
Fit of Simulation / Reality Parameter / Model

Bad Fit

Good Fit

Experiments with Model


(„Simulation“)

Problem Solution

134
Results Interpretation / Analysis

Good Fit
• Determination of long time behavior /
Experiments with Model
(„Simulation“)
stationary solutions (equilibria)
Problem Solution

135
Results Interpretation / Analysis

Good Fit
• Determination of long time behavior /
Experiments with Model
(„Simulation“)
stationary solutions (equilibria)
Problem Solution

136
Use of Pesticide

Good Fit
Modification of Predator-prey model with intraspecific Experiments with Model
competition („Simulation“)

Problem Solution
• Assume, that at a specific time poison is released
into the system, e.g. some of predators are
removed
from the population by hunting.

• The growth rate a of prey is changed to:


where K is growth rate change.

• This change occurs at the specific time point.

• The new growth rate a depends on the difference


between populations at this specific time point and
stays constant after that.

137
Use of Pesticide

Good Fit

Experiments with Model


Adequate („Simulation“)

time instant Problem Solution

tc : d old → d new , f old → f new

𝑥ሶ = 𝑎𝑥 − 𝑏𝑥𝑦 − 𝑒𝑥 2
𝑦ሶ = −𝑐𝑦 + 𝑑𝑥𝑦 − 𝑓𝑦 2

138
Modification of Predator-prey model
with intraspecific competition
Good Fit
Population development over time:
Experiments with Model
(„Simulation“)

Problem Solution

Parameters:

139
Modification of Predator-prey model
with intraspecific competition
Good Fit
Population development over time:
Experiments with Model
(„Simulation“)

Problem Solution

Parameters:

140
Modification of Predator-prey model
with intraspecific competition
Good Fit
Problem
Experiments with Model
Modelling („Simulation“)
Model Problem Solution

Assignment: short time,


Dynamics: Prey – Predators changes the growth of preys,
Environment: isolated damping parameter
Measurement: natural enemies Approach: optimal time point
5 Years = 60 months 𝑡𝑐 is dependent on the
quarterly population difference

Problem: When is a reasonable time Result: The assignment is not


to use chemical pesticides? conducive

141
The DON‘Ts of Mathematical Modelling

(S. W. Golomb, Simulation 14 (1970), 197-198)

• DON‘T believe that the model is the reality

• DON‘T extrapolate beyond the region of fit

• DON‘T distort reality to fit the model

• DON‘T retain a discredited model

• DON‘T fall in love with your model

142

You might also like