Professional Documents
Culture Documents
Modelado 1 UK
Modelado 1 UK
Modelado 1 UK
Proceso
u time
ym
time Model
time
Prof. Cesar de Prada, ISA, UVA 6
Continuous and discrete event
processes
q
q
time
u(kT)
y(t)
Computer D/A Process
y(kT)
A/D
Model
dm Fi F0
= Fi − F0 + G − C
dt G m C
v Disturbances
u y Observed
x
Manipulated responses
variables
x states
Prof. Cesar de Prada, ISA, UVA 21
Model simulation
Integrating (numerically)
q
the model, one can obtain
the time evolution of the
liquid volume as a function
h of q
dh 1 uk
F = q− h V = Ah
dt A A
Euler integration 1 u ( t )k
formula h ( t + ∆t ) = h ( t ) + q ( t ) − h ( t ) ∆t
A A
F
Physical causality: The intended use of the
causes and effects model (what happens if…,
q h F control,.., may impose the
computational causality
Prof. Cesar de Prada, ISA, UVA 23
Hypothesis
ci
q q
c h h
F F
Perfect mix No mix
d Vc h Ah V
= qc i − Fc c( t ) = c i ( t − ) = c i ( t − ) = ci (t − )
dt v Av F
h1 h2
F1
F2
dh dh Laws +
A1 1 = q 1 − F1 A 2 2 = q 2 + F1 − F2
dt dt constraints
F1 = k 1 h 1 − h 2 h 1 < h 2 ? F2 = k 2 h 2
F1 = k 1 sgn( h 1 − h 2 ) h 1 − h 2 0 ≤ h i ≤ h max qi ≥ 0
Reaction: A B
FT
AT Row material
A
Reactor
Products
A, B
F Reference
m system
x
d2x
m 2 = ∑ Fi
dt
d2x
m 2 = −kx + mg + F
-kx dt
0 m dx
=v
dt
x mg dv k 1
= − x+g+ F
F dt m m
θ L
d2x d 2 ( x + Lsenθ) dx
M 2 +m = F−f
dt dt 2 dt
m
d 2θ d θ
2
d2x dx
(M + m) 2 + mL cos θ 2 − mLsenθ = F − f
mg dt dt dt dt
dt dt
d 2θ dθ
2
d2x dx
(M + m) 2 + mL cos θ 2 − mLsenθ = F − f
dt dt dt dt
Prof. Cesar de Prada, ISA, UVA 36
Liquid flow in a pipe
d mv
Momentum = A∆p 0 − A∆p v − AfLρv 2 − Ahρg
conservation dt
law 1
∆p v = 2 2 ρq 2 m = ALρ q = Av
a Cv
Non-linear L d q ∆p 0 1 fL
differential = − ( 2 2 + 2 )q 2 − gh
A dt ρ a Cv A
equation
a q h
∆pv
∆p0
Prof. Cesar de Prada, ISA, UVA 37
Control valve (linear)
Spring d2x dx
m 2= (p − p 0 )A + ∆p vS − kx − k v
x dt dt
Diafragm
x ∆p v
Aire q = Cv
L ρ
Aire
p x position of stem from
abre
Friction
equilibrium position
L range of stem
Líquid displacement
p air pressure
Prof. Cesar de Prada, ISA, UVA 38
RC circuit
R I2
Infinite
I1 impedance
V E
C I2 =0
I1-I2
1 1 d V d I1 1
V = I1 R + ∫ (I1 − I 2 )dt V = I1 R + ∫ I1dt = R + I1
C C dt dt C
1 1 dE 1
E = ∫ (I1 − I 2 )dt E = ∫ I1dt = I1
C C dt C
d I1 1 1 dV
=− I1 +
dt RC R dt
dE 1
= I1
dt C
Prof. Cesar de Prada, ISA, UVA 39
Circuits
R1 L I2
I1
V C E
R2
I1-I2
d I1 1
dt C ∫
V = I1 R 1 + L + (I1 − I 2 )dt + (I1 − I 2 )R 2
1
E=
C ∫ (I1 − I 2 )dt + (I1 − I 2 )R 2
ω dω
J = k 1I − fω − T
dt
Independent T dθ
=ω
excitation dt
dI
V = RI + L + k 2 ω
dt
Ti F
∆x
Prof. Cesar de Prada, ISA, UVA 42
Distributed parameters process
Ts
x ∆x
∆x
Energy balance d πr 2 ∆xρc e Ti
= Fρc e Ti −1 − Fρc e Ti + 2πr∆xU(Ts − Ti )
dt
Partial d Ti F (Ti −1 − Ti ) 2 U(Ts − Ti )
= 2 +
differential dt πr ∆x rρc e
equations d Ti F (T − Ti ) 2 U(Ts − Ti )
lim = 2 lim i −1 + lim
∆x → 0 d t πr ∆x →0 ∆x ∆x → 0 rρc e
∂ T( x, t ) F ∂T ( x , t ) 2 U(Ts − T ( x , t ))
=− 2 +
∂t πr ∂x rρc e
Prof. Cesar de Prada, ISA, UVA 44
First principles models
• Described by sets of algebraic and differential
equations, often non-linear.
• They can be used for a wide range of aims
• They have a wide range of validity within the one
fix by the associated hypothesis
• They require a certain modelling background
• They may be difficult to operate with
• Quite often they are solved by simulation
Prof. Cesar de Prada, ISA, UVA 45
Simulation: EcosimPro
• Facilitate the description of the model, and provides the
methods to solve it
• Modelling / Simulation languages
• What happens if…?
• Based on object oriented software technologies
• Advanced numerical methods and functionalities
• ESA: European Space Agency
• C++ code generator with a development and execution
environment
• Library / Component / Partition / Experiment
• Open system
dh d∆h
A =q−k h A = β∆q − α∆h
dt dt
∂f ∂f ∂f
∆u + ∆y + ∆z = 0 ∆u = u − u 0 ∆y = y − y 0 ∆z = z − z 0
∂u 0 ∂y 0 ∂z 0
4.0 4
0 10 20 30 40 0 10 20 30 40
TIME TIME
5.0 5.0
0 10 20 30 40 0 10 20 30 40
TIME TIME
U
U0 Y
U Y Y0
t Process
t
The range of validity is constrained to a certain extent around
the linearization point
Prof. Cesar de Prada, ISA, UVA 55
Liquid flow in a pipe
Non-linear L d q ∆p 0 1 fL
= − ( 2 2 + 2 )q 2 − gh
differential A dt ρ a Cv A
equation
, q, ∆p 0 , a ) = 0
f (q
∂f ∂f
−q
(q 0) + (q − q 0 ) +
∂q
0 ∂q 0
∂f ∂f
+ ( ∆p 0 − ( ∆p 0 ) 0 ) + (a − a 0 ) = 0
∂∆p 0 0 ∂a 0
a h
q
∆pv
∆p0
Prof. Cesar de Prada, ISA, UVA 56
Linearized model of the flow
d q A ∆p 0 1 fL
= [ − ( 2 2 + 2 )q 2 − gh ]
dt L ρ a Cv A
d ∆q A ∆ (∆p 0 ) 1 fL 2
= [ − ( 2 2 + 2 )2q ∆q + 3 2 q 2 ∆a ]
dt L ρ a Cv A 0 a C v 0
1 d ∆q
+ ∆q =
A 1 fL dt
( 2 2
+ 2
) 2 q
L a C v A 0
1 2
= [∆ (∆p 0 ) + 3 2 ρq 2 ∆a ]
1 fL a Cv 0
ρ
2 2
( + 2
) 2 q
a Cv A 0
d ∆q
τ + ∆q = K1∆ (∆p 0 ) + K 2 ∆a
dt
q
τ increases in operating points
corresponding to large openings
K2 decreases in operating points
corresponding to large openings
t
Prof. Cesar de Prada, ISA, UVA 58
Linearized model of the tank
dT V2
Ah = q (Ti − T ) + si Ti y h = cte.
dt ρc e R
f (T , T, q, V) = 0
∂f ∂f ∂f ∂f
(T − T0 ) + (T − T0 ) + (q − q 0 ) + (V − V0 ) = 0
∂T 0
∂T 0 ∂q 0 ∂V 0
Ti d∆T 2V0
q Ah = −q 0 ∆T + (Ti0 − T0 )∆q + ∆V
dt ρc e R
Ah d∆T (T − T ) 2V0
+ ∆T = i 0 0 ∆q + ∆V
q 0 dt q0 ρc e Rq 0
V R T d∆T
τ + ∆T = K1∆q + K 2 ∆V
dt
Prof. Cesar de Prada, ISA, UVA 59
Similarities
a q h
∆pv
∆p0
Ti d ∆q
q τ + ∆q = K1∆ ( ∆p 0 ) + K 2 ∆a
dt
d∆T
τ + ∆T = K1∆q + K 2 ∆V
dt
V R T
Two equations
A⇒B
f1 (c A , c A , F, c Ai ) = 0 CA CB T
f 2 (c B , c B , c A , F) = 0
F
d∆c A F0 −E (c − c ) F
= −( + ke RT0 )∆c A + Ai 0 A 0 ∆F + 0 ∆c Ai
dt V V V
d∆c A
= a11∆c A + b11∆F + d11∆c Ai
dt
Value computed at the operating point
Prof. Cesar de Prada, ISA, UVA 62
Linearization point
dc A −E
If the linearization point V = Fc Ai − Fc A − Vke RT c A = 0
dt
corresponds to an
dc −E
equilibrium point: V B = −Fc B + Vke RT c A = 0
dt
If cAi0 = 8 y cA0 = 0.8 ⇒ cB0 = 7.2
If F0 = 26.66 and V = 80 ⇒ ke-E/RT = 2.999
d∆c A −E
V = −(F0 + Vke RT0 )∆c A + (c Ai 0 − c A 0 )∆F + F0 ∆c Ai
dt
d∆c A F0 −E (c − c ) F
= −( + ke RT0 )∆c A + Ai 0 A 0 ∆F + 0 ∆c Ai = −3.332∆c A + 0.09∆F + 0.333∆c Ai
dt V V V
Prof. Cesar de Prada, ISA, UVA 63
Linearized model (2)
d cB − E RT
V = − Fc B + Vke cA
dt
Using the Taylor series expansion…
d∆c B −E F0 c B0
= ke RT0
∆c A − ∆c B − ∆F = 2.999∆c A − 0.333∆c B − 0.09∆F
dt V V
d∆c B
= a 21∆c A + a 22 ∆c B + b 21∆F
dt
d∆c A
= a11∆c A + b11∆F + d11∆c Ai
dt
d ∆c A
d t a 11 0 ∆c A b11 b12 ∆F
= +
d ∆c B a 21 a 22 ∆c B b 21 0 ∆c Ai
d t
∆c A
∆c B = (0 1)
dx
= Ax + Bu
∆c B
dt
y = Cx
F
Prof. Cesar de Prada, ISA, UVA 66
State space models
d∆h k 1
q =− ∆h + ∆q
dt 2A h 0 A
d∆h
= α∆h + β ∆q
h dt
∆h = 1.∆h
d ∆q
a q τ + ∆q = K 1 ∆(∆p 0 ) + K 2 ∆a
h dt
∆p0 d ∆q − 1 K K 2 ∆(∆p 0 )
= ∆q + 1
dx dt τ τ τ ∆a
= Ax + Bu
dt ∆q = 1∆q
y = Cx
Prof. Cesar de Prada, ISA, UVA 67
Linear states space models
x state variables: If its value is
dx
= Ax + Bu known at an initial time instant,
dt as well as the values of the
y = Cx + Du input u(t) along time, then the
value of the outputs y(t) is
determined along time
t
Analytical
solution: x(t ) = e A( t −t0 ) x(t 0 ) + ∫ e A(t − τ ) Bu (τ)dτ
t0
dt dt
y = Cx y = [CP -1
]z
A − λI = 0 PAP −1 − λI = 0
PAP −1 − λPP −1 = 0
Equivalent
representations P(A − λI)P −1 = 0
have the same P A − λI P −1 = 0
eigenvalues A − λI = 0
y(t) = ∫ Ce A ( t −τ )
Bδ( τ)dτ = Ce B = g( t )
At Impulse response
0 t
δ(t) g(t)
y( t ) = ∫ g ( t − τ)u (τ)dτ
0
∞
y( t ) = ∫ g( t − τ) u( τ)dτ
0
Prof. Cesar de Prada, ISA, UVA 71
Impulse response model
t
y( t ) = ∫ g ( t − τ)u (τ)dτ t−τ=σ dτ = − dσ
τ = 0 ⇒ σ = t
0
∞
y ( t ) = ∫ g ( t − τ ) u ( τ ) dτ τ = t ⇒ σ = 0
0 t
y ( t ) = ∫ g ( σ ) u ( t − σ ) dσ
0
δ(t) g(t)
∞
y ( t ) = ∫ g ( σ ) u ( t − σ ) dσ
0