L1 Modeling State Space
L1 Modeling State Space
2
Part 1.1:
Modeling & Simulation –
Basic Concepts
3
Intended Learning Outcomes
4
Model?
Definition: Model
To a person P, an object M is a model of an object O
to the extent that P can use M to answer questions that interest them about O. à Depends on goal!
M. Minksy (1965), Matter, mind and models.
Our focus
Mathematical models:
( 𝑡 ) , 𝑢 (𝑡 ))
𝑓 (𝑥
̇𝑥 (𝑡) = 𝑥 , (𝑡) 𝑢(𝑡))
ℎ(
𝑦 (𝑡 ) =
𝜕𝑇 𝜕 !𝑇
𝜕𝑡 = 𝑘 𝜕𝑥 !
𝑦 = 𝐴𝑥
5
Simulation?
Definition: Simulation
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.
R.E. Shannon (1975), Systems simulation: The art and science.
6
Types of Mathematical Models
Our focus
Dynamic Steady-state
models models
𝑥"
𝑥!
𝑥!
7
Types of Mathematical Models
Our focus
Distributed-parameter Lumped-parameter
models models
𝑥"
𝑥!
𝑡 = 0𝑠 𝑡 = 1𝑠
8
Types of Mathematical Models
Our focus
Continuous Discrete
models models
𝑥!
9
Intended Learning Outcomes
10
Part 1.2:
The State-Space Representation
11
Intended Learning Outcomes
12
Quantities in State-Space Models
System
“Degrees of freedom”, Inputs Outputs “Dependent variables”,
values need to be known values can be computed
to conduct a simulation from the model equations
experiment
𝑢" (𝑡) 𝑦" (𝑡)
𝑢 𝑡 = ⋮ ∈ ℝ#" 𝑦 𝑡 = ⋮ ∈ ℝ##
𝑢#" (𝑡) Parameters States / state variables 𝑦## (𝑡)
𝑝" 𝑥" (𝑡)
• Control inputs (adjusted by 𝑝= ⋮ ∈ ℝ#! ⋮
𝑥 𝑡 = ∈ ℝ#$ • Measured variables
process operator) 𝑝#! 𝑥#$ (𝑡) • Controlled variables (things we
• Disturbances (determined want to keep at certain values)
by environment)
• Constant over time, • Describe state of the system
e.g. reactor volume, (“what does the system
molar masses, … currently look like”?), e.g.,
temperature, mole fractions, …
13
Continuous Models in State-Space Representation
𝑑𝑥"
(𝑡)
𝑑𝑥 𝑑𝑡
𝑥̇ 𝑡 ≔ (𝑡) = ⋮
𝑑𝑡 𝑑𝑥#$
(𝑡)
𝑑𝑡
𝑥̇ 𝑡 = 𝑓 𝑥 𝑡 , 𝑢 𝑡 , 𝑡, 𝑝 state equations, dynamics
𝑦 𝑡 = ℎ 𝑥 𝑡 , 𝑢 𝑡 , 𝑡, 𝑝 output equations
𝑥 0 = 𝑥& initial conditions
Once 𝑢(𝑡), 𝑝, and 𝑥& are fixed, these initial values Once 𝑥 𝑡 has been computed, easy
are differential equations with initial to obtain 𝑦(𝑡): just evaluate the right-
conditions (= initial value problem) hand side, no equation to solve
à Can be solved for 𝑥(𝑡)
14
Visualizing Solutions of State-Space Models
Option 1: Plot states (or outputs) over time Option 2: Plot trajectory in state space
15
More Examples for Visualization in the State Space
16
Classification of State-Space Models: Time Invariance
Time-variant Time-invariant
model model
𝑥̇ 𝑡 = 𝑓 𝑥 𝑡 , 𝑢 𝑡 , 𝒕, 𝑝 𝑥̇ 𝑡 = 𝑓 𝑥 𝑡 , 𝑢 𝑡 , 𝑝
𝑦 𝑡 = ℎ 𝑥 𝑡 , 𝑢 𝑡 , 𝒕, 𝑝 𝑦 𝑡 = ℎ 𝑥 𝑡 ,𝑢 𝑡 ,𝑝
𝑥 0 = 𝑥& 𝑥 0 = 𝑥&
à Time occurs explicitly on right-hand sides à Time does not occur explicitly on right-hand sides
Examples:
17
Classification of State-Space Models: Time Invariance – Effect
Time invariant model à for given initial values and inputs, we always get the same response (i.e., 𝑥(𝑡), 𝑦(𝑡))
Example: input shifted in time leads to same output, but also shifted in time
18
19 Faculty, department, unit ...
Classification of State-Space Models: Linearity
Nonlinear Linear
model model
𝑥̇ 𝑡 = 𝑓 𝑥 𝑡 , 𝑢 𝑡 , 𝑡, 𝑝 𝑥̇ 𝑡 = 𝐴 𝑝, 𝑡 𝑥 𝑡 + 𝐵 𝑝, 𝑡 𝑢(𝑡)
𝑦 𝑡 = ℎ 𝑥 𝑡 , 𝑢 𝑡 , 𝑡, 𝑝 𝑦 𝑡 = 𝐶 𝑝, 𝑡 𝑥 𝑡 + 𝐷 𝑝, 𝑡 𝑢(𝑡)
𝑥 0 = 𝑥& 𝑥 0 = 𝑥&
Examples:
20
Classification of State-Space Models: Linear Time-Invariant Models (“LTI models”)
𝑥̇ 𝑡 = 𝐴 𝑝 𝑥 𝑡 + 𝐵 𝑝 𝑢(𝑡)
𝑦 𝑡 = 𝐶 𝑝 𝑥 𝑡 + 𝐷 𝑝 𝑢(𝑡)
𝑥 0 = 𝑥&
21
Classification of State-Space Models: Overview
nonlinear linear
𝑥̇ 𝑡 = 𝑓 𝑥 𝑡 , 𝑢 𝑡 , 𝒕, 𝑝 𝑥̇ 𝑡 = 𝐴 𝑝, 𝒕 𝑥 𝑡 + 𝐵 𝑝, 𝒕 𝑢(𝑡)
time-variant 𝑦 𝑡 = ℎ 𝑥 𝑡 , 𝑢 𝑡 , 𝒕, 𝑝 𝑦 𝑡 = 𝐶 𝑝, 𝒕 𝑥 𝑡 + 𝐷 𝑝, 𝒕 𝑢(𝑡)
𝑥 0 = 𝑥& 𝑥 0 = 𝑥&
22
23 Faculty, department, unit ...
24 Faculty, department, unit ...
Intended Learning Outcomes
25
Part 1.3:
Constructing State-Space Models
26
Intended Learning Outcomes
27
Modeling Strategy: Constructing Continuous Dynamic Models
28
Modeling Strategy, Step 1: Identify Subsystems & Interfaces
System
Connections
System
components
29
Modeling Strategy, Step 1: Identify Subsystems & Interfaces
System
(Sub)system Interfaces
30
Modeling Strategy, Step 1: Identify Subsystems & Interfaces
System
Decomposition
(Sub)system
Elementary system
𝑥̇ 𝑡 = …
31
Modeling Strategy, Step 1: Identify Subsystems & Interfaces
System
Aggregation
(Sub)system • When to stop with decomposition? What makes a
good elementary system?
• Storage of material or energy
• Sufficiently homogeneous, i.e., can describe
with one / few temperatures, mole fractions, …
𝑥̇ 𝑡 = …
32
Modeling Strategy, Step 1: Identify Subsystems & Interfaces – Example: Methanol Producion
Picture: www.clariant.com
33
Modeling Strategy, Step 1: Identify Subsystems & Interfaces – Example: Methanol Producion
Synthesis loop
Purge
Feed preparation
Synthesis gas
(H2, CO, CO2)
Product purification
Methanol
Material flow
Power input
Water
Heat flow
34
Modeling Strategy, Step 1: Identify Subsystems & Interfaces – Example: Methanol Producion
Synthesis loop
Feed preparation
Synthesis gas
(H2, CO, CO2)
Product purification
Methanol
Material flow
Power input
Water
Heat flow
35
Modeling Strategy, Step 2: Balances & Other Equations
36
Modeling Strategy, Step 2: Balances & Other Equations
37
Modeling Strategy, Step 2: Balances & Other Equations – Example: Blending Process
Outflow
38
Modeling Strategy, Step 2: Balances & Other Equations – Example: Blending Process
39
Modeling Strategy, Step 3: Equations Connecting Subsystems
System
(Sub)system 1 (Sub)system 2
40
Modeling Strategy, Step 3: Equations Connecting Subsystems
System
(Sub)system 1 (Sub)system 2
Typical:
• Outflow of subsystem 1 = inflow of subsystem 2
• Pressure at interface is equal in subsystems 1 and 2
• …
41
Modeling Strategy: What Have We Achieved?
2. For each subsystem, set up balances and further equations à We have a model! J
But is it a state-space model?
Model consisting of
• Balances in subsystems à ordinary differential equations
• Other equations in subsystems à algebraic equations
• Equations connecting subsystems à algebraic equations
42
From Differential-Algebraic Equations to State-Space Models
43
From Differential-Algebraic Equations to State-Space Models – Example
𝐽./0 𝑡 = R h t ℎ(𝑡)
ℎ 𝑡 = 𝑚(𝑡)/(𝜌 𝐴2345 ) 𝐽'+,- , 𝐽+,-
𝐽+./0 𝑡 = 𝑦+./0 t 𝐽./0 (𝑡)
𝑦+./0 t = y6 t 𝐴./01
𝑦+ 𝑡 = 𝑚+ (𝑡)/𝑚(𝑡)
Parameters 𝑝
44
From Differential-Algebraic Equations to State-Space Models – Example
𝐽./0 𝑡 = 𝐑 h t ℎ(𝑡)
ℎ 𝑡 = 𝑚(𝑡)/(𝝆 𝑨𝐛𝐚𝐬𝐞 ) 𝐽'+,- , 𝐽+,-
𝐽+./0 𝑡 = 𝑦+./0 t 𝐽./0 (𝑡)
𝑦+./0 t = y6 t 𝐴./01
𝑦+ 𝑡 = 𝑚+ (𝑡)/𝑚(𝑡)
;
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345
<
Inputs 𝑢(𝑡) = 𝐽+,- 𝑡 , 𝐽+./0 𝑡
45
From Differential-Algebraic Equations to State-Space Models – Example
𝐽./0 𝑡 = R h t ℎ(𝑡)
ℎ 𝑡 = 𝑚(𝑡)/(𝜌 𝐴2345 ) 𝐽'+,- , 𝐽+,-
𝐽+./0 𝑡 = 𝑦+./0 t 𝐽./0 (𝑡)
𝑦+./0 t = y6 t 𝐴./01
𝑦+ 𝑡 = 𝑚+ (𝑡)/𝑚(𝑡)
;
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345
<
Inputs 𝑢 𝑡 = 𝐽+,- 𝑡 , 𝐽+./0 𝑡
Outputs 𝑦 𝑡
46
From Differential-Algebraic Equations to State-Space Models – Example
𝐽./0 𝑡 = R h t ℎ(𝑡)
ℎ 𝑡 = 𝑚(𝑡)/(𝜌 𝐴2345 ) 𝐽'+,- , 𝐽+,-
𝐽+./0 𝑡 = 𝒚𝐨𝐮𝐭
𝑨 𝒕 𝐽./0 (𝑡)
𝒚𝐨𝐮𝐭
𝑨 𝒕 = y6 t 𝐴./01
𝑦+ 𝑡 = 𝑚+ (𝑡)/𝑚(𝑡)
;
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345
<
Inputs 𝑢 𝑡 = 𝐽+,-𝑡 , 𝐽+./0 𝑡
Outputs 𝑦 𝑡 = (𝑦+./0 𝑡 )
States 𝑥 𝑡
47
From Differential-Algebraic Equations to State-Space Models – Example
𝐽./0 𝑡 = R h t ℎ(𝑡)
ℎ 𝑡 = 𝒎(𝒕)/(𝜌 𝐴2345 ) 𝐽'+,- , 𝐽+,-
𝐽+./0 𝑡 = 𝑦+./0 𝑡 𝐽./0 (𝑡)
𝑦+D$E 𝑡 = y6 t 𝐴./01
𝑦+ 𝑡 = 𝒎𝑨 (𝒕)/𝒎(𝒕)
;
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345
<
Inputs 𝑢 𝑡 = 𝑡 , 𝐽+./0 𝑡
𝐽+,-
Outputs 𝑦 𝑡 = (𝑦+./0 𝑡 )
States 𝑥 𝑡 = 𝑚+ 𝑡 , 𝑚 ;
48
From Differential-Algebraic Equations to State-Space Models – Example
𝑱𝐨𝐮𝐭 𝒕 = R 𝐡 𝐭 ℎ(𝑡)
𝒉 𝒕 = 𝑚(𝑡)/(𝜌 𝐴2345 ) 𝐽'+,- , 𝐽+,-
𝑱𝐨𝐮𝐭
𝑨 𝒕 = 𝑦+./0 𝑡 𝑱𝐨𝐮𝐭 (𝒕)
𝑦+D$E 𝑡 = 𝐲𝐀 𝐭 𝐴./01
𝒚𝑨 𝒕 = 𝑚+ (𝑡)/𝑚(𝑡)
;
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345
<
Inputs 𝑢 𝑡 = 𝐽+,-𝑡 , 𝐽+./0
𝑡
Rest: 𝐽+./0 𝑡 , 𝐽./0 𝑡 , h t , y6 t à eliminate!
Outputs 𝑦 𝑡 = (𝑦+./0 𝑡 )
States 𝑥 𝑡 = 𝑚+ 𝑡 , 𝑚(𝑡) ;
49
From Differential-Algebraic Equations to State-Space Models – Example
Eliminate
Blending process model (DAE): Blending process model (state-space model):
other
𝑚̇ + 𝑡 = 𝐽+,- 𝑡 − 𝑱𝐨𝐮𝐭
𝑨 𝒕 𝑚̇ + 𝑡 = 𝐽+,- 𝑡 − 𝑚+ (𝑡)R/(𝜌 𝐴2345 )
variables
𝑚̇ 𝑡 = 𝐽+,- 𝑡 + 𝐽1,- 𝑡 − 𝑱𝐨𝐮𝐭 (𝒕) 𝑚̇ 𝑡 = 𝐽+,- 𝑡 + 𝐽1,- 𝑡 − 𝑚(𝑡)R/(𝜌 𝐴2345 )
𝑦+D$E 𝑡 = 𝑚+ (𝑡)/𝑚(𝑡)
𝑱𝐨𝐮𝐭 𝒕 = R 𝐡 𝐭
𝒉 𝒕 = 𝑚(𝑡)/(𝜌 𝐴2345 )
𝑱𝐨𝐮𝐭
𝑨 𝒕 = 𝑦+./0 𝑡 𝑱𝐨𝐮𝐭 (𝒕)
𝑦+D$E 𝑡 = 𝐲𝐀 𝐭
𝒚𝑨 𝒕 = 𝑚+ (𝑡)/𝑚(𝑡)
;
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345
<
Inputs 𝑢 𝑡 = 𝐽+,-𝑡 , 𝐽+./0
𝑡
Outputs 𝑦 𝑡 = (𝑦+./0 𝑡 )
States 𝑥 𝑡 = 𝑚+ 𝑡 , 𝑚(𝑡) ;
50
From Differential-Algebraic Equations to State-Space Models – Example
Eliminate
Blending process model (DAE): Blending process model (state-space model):
other
𝑚̇ + 𝑡 = 𝐽+,- 𝑡 − 𝑱𝐨𝐮𝐭
𝑨 𝒕 𝑚̇ + 𝑡 = 𝐽+,- 𝑡 − 𝑚+ (𝑡)R/(𝜌 𝐴2345 )
variables
𝑚̇ 𝑡 = 𝐽+,- 𝑡 + 𝐽1,- 𝑡 − 𝑱𝐨𝐮𝐭 (𝒕) 𝑚̇ 𝑡 = 𝐽+,- 𝑡 + 𝐽1,- 𝑡 − 𝑚(𝑡)R/(𝜌 𝐴2345 )
𝑦+D$E 𝑡 = 𝑚+ (𝑡)/𝑚(𝑡)
𝑱𝐨𝐮𝐭 𝒕 = R 𝐡 𝐭
Rename to identify
𝒉 𝒕 = 𝑚(𝑡)/(𝜌 𝐴2345 ) states, …
𝑱𝐨𝐮𝐭
𝑨 𝒕 = 𝑦+./0 𝑡 𝑱𝐨𝐮𝐭 (𝒕)
𝑦+D$E 𝑡 = 𝐲𝐀 𝐭 p"
𝑥̇ " 𝑡 =− 𝑥 𝑡 + 𝑢" 𝑡
𝒚𝑨 𝒕 = 𝑚+ (𝑡)/𝑚(𝑡) 𝑝! 𝑝G "
p"
𝑥̇ ! 𝑡 =− 𝑥 𝑡 + 𝑢" 𝑡 + 𝑢! 𝑡
𝑝! 𝑝G !
Parameters 𝑝 = 𝑅, 𝜌, 𝐴2345 ; 𝑥" 𝑡
<
𝑦 𝑡 =
𝑥! 𝑡
Inputs 𝑢 𝑡 = 𝐽+,- 𝑡 , 𝐽+./0 𝑡
𝑥 0 = 𝑥&
Outputs 𝑦 𝑡 = (𝑦+./0 𝑡 )
States 𝑥 𝑡 = 𝑚+ 𝑡 , 𝑚(𝑡) ;
51
From Differential-Algebraic Equations to State-Space Models – Example
p"
𝑥̇ " 𝑡 = − 𝑥 𝑡 + 𝑢" 𝑡
𝑝! 𝑝G " Is the model time-variant?
p"
𝑥̇ ! 𝑡 = − 𝑥 𝑡 + 𝑢" 𝑡 + 𝑢! 𝑡
𝑝! 𝑝G !
𝑥" 𝑡
𝑦 𝑡 =
𝑥! 𝑡
52
From Differential-Algebraic Equations to State-Space Models – Example
p"
𝑥̇ " 𝑡 = − 𝑥 𝑡 + 𝑢" 𝑡
𝑝! 𝑝G " Is the model linear?
p"
𝑥̇ ! 𝑡 = − 𝑥 𝑡 + 𝑢" 𝑡 + 𝑢! 𝑡
𝑝! 𝑝G !
𝑥" 𝑡
𝑦 𝑡 =
𝑥! 𝑡
Try to write as
linear system
H%
−I 0
& I' 1 0
𝑥̇ 𝑡 = 𝐴 𝑥 𝑡 + 𝐵 𝑢 𝑡 , with 𝐴 = H% , B= à state equations linear
0 − 1 1
I& I'
' E
𝑦 𝑡 = '% à output equations nonlinear
& E
53
What About Higher-Order Differential Equations?
54
Intended Learning Outcomes
55
Lecture Outline: Systems Analysis of Chemical Processes
56
See you next week!