2 - Dynamic Modelling
2 - Dynamic Modelling
Control
CH 3043 A
=nRT
2
Mathematical model
• Uses and advantages
• Fast, cheap way to investigate possible designs (including control system)
• Describe the behavior of complex systems
• Calculate the size of equipment
• Optimize existing plants
• Predict the result of an experiment
• Mathematical models consist in:
• Balance equations
• Constitutive equations
• What is adequate?
• Approximate what? Formalize by procedure
• Which part?
4
Procedure for developing (dynamic)
models
1. Define
objectives
• Purpose model? 2. Prepare
• Required
information
accuracy?
• Sketch process 3. Formulate
• Determine
model
system boundary
• Identify • Conservation 4. Determine
variables of laws
interest • Constitutive
solution
• State equations • Analytical 5. Analyze
assumptions • DOF”s? • Numerical
results
• Results correct? 6. Validate
• Interpret the
model
results
• Select key
variables
• Compare with
experiment
5
Balance equations
• Conservation laws can be set up for:
1.Mass (total or component)
2.Energy
3.Momentum
• For a lot of process systems mass and energy balances are sufficient, the
momentum balance is replaced by flow assumptions (e.g. ideal mixing, plug
flow…).
6
Writing balance equations
- the “instantaneous” approach -
dX t
X ,in t X ,out t
dt
d V p q
j V , j V , k
dt j 1 k 1
p q
dV
! For constant density r V , j V , k
dt j 1 k 1
dx t
f x t , u t f : R nm R n
dt
y t g x t g : R nm R p
at t 0 x 0 x0
9
Component mass balance
rate of mass accumulation = mass flow in
of component i of component i ( fi )
- mass flow out
of component i
+ rate of formation
of component i
p q
dM i
f i , j fi ,k Ri i 1 n
dt j 1 k 1
p q
dN i
fi , j fi ,k Ri i 1 n (molar)
dt j 1 k 1
10
Constitutive relationships
Gas law pv RT
a
p 2 v b RT
(van der Waals)
v
Equilibrium relations yi Ki xi
11
Conservation balance using intensive variables
•intensive variables enter constitutive equations
(reaction rate, physical properties)
•example:
Mi kg of i
ci kg
M
if well-mixed: ci ci ,out
if M = constant Fin = Fout = F dci
M ci ,in F ci ,out F Ri
dt
Otherwise (well mixed, but M not constant):
dM
Fin Fout
dt
dci
M ci ,in Fin ci Fin Ri
dt
13
Energy balance
rate of change = flow of energy flow of energy
-
of total energy into the system out of the system
E U K E PE
total internal kinetic potential
energy = energy + energy + energy
M w2 M g h h0 Small
H U P V 2 can be neglected
14
Constitutive relationships
Heat transfer
QC UAT QR A T T
1
4
2
4
d
c p T a b T c T
2
15
Example - CSTR
A B
F0, cA,0, cB,0, T0
F [ kg /s ]
c [ kg / kg ] M
cA, cB
Tc
EA
T U, A
r k0 exp cA
RT
(kg A / kg reactor)
F1, cA,1, c T1
B,1
16
Balance equations
Known :
- inlet conditions
dM A - outlet flow rate F1
FA,0 FA,1 r M (an input variable !!)
dt - constitutive relations,
dM B as needed
FB ,0 FB ,1 r M
dt
dH Solution possible
F0 h0 F1 h1 Q (correct model) if:
dt
knowing the state variables
and inputs
=
At t = 0 M A 0 M A0 Can calculate the RHS of
differential equation
M B 0 M B0
H 0 H 0 17
Calculating RHS
MA MB
c A,1 cB ,1 M MA MB
M M
(ideal !!)
H M A hA M B hB
M A hA Tref cP , A T dT M B hB Tref cP ,B T dT
T T
Tref Tref
M A hA Tref cP , A T Tref M h T c T T
B B ref P ,B ref
Solve for T
EA H
Calculate r k0 exp cA h1 Q UA T Tc
RT M 18
Where is the heat of reaction ?
dH d dM A dM B dhA dhB
M A hA M B hB hA hB MA MB
dt dt dt dt dt dt
dhA d dT
hA Tref cP , A T Tref cP , A
dt dt dt
dT dT
M AcP, A M B cP,B dt McP dt
hA,0 hA hA Tref cP , A T0 Tref hA Tref cP , A T1 Tref cP , A T0 T1
hB ,0 hA hB Tref cP , B T0 Tref hB Tref cP , B T1 Tref cP , B T0 T1
dT
McP F0 c A,0cP , A cB ,0cP , B T T0 r H rM UA T TC
dt
McP
dT
F0cP T T0 r H rM UA T TC
c P, A cP , B !
dt 20
Using moles and m3
d V c pT p
Fj c pj T j T rV H R Q
dt j 1
21
General form of dynamic models
dx t
f x t , z (t ), u t
dt
0 g x(t ), z (t ), u (t )
y t h x t , z t
at t 0 x 0 x0
u t for t 0 22
Degrees of freedom
N DF NU N E
unknowns equations
23
Counting
Physical quantities: variables, parameters, constants
The number of algebraic variables (z) must be equal to the number of algebraic
equations (g)
F1 F2
25
Degrees of freedom
1 state variable : h
6 algebraic variables: P0,P1,P2,P3,F1,F2
3 parameters: A, CV, r
1 constant: g
P0
NDF = 6 – 3 = 3
26
Good specification [ P0, P1, P3 ]
P0
At t=0, h=h0
P1 h P3
calculate: P2
P2 F1 F2
F1
F2
dh 1
dh/dt F1 F2 , h 0 h0
dt A
at t = 0 + Dt F1 CV P1 P2 0
h = h(0)+ Dt*dh/dt
F2 CV P2 P3 0
Index 1 P2 P0 gh 0
27
Bad specification [ P0, P1, P2 ]
Index > 1
P0
?
At t=0, h=h0 P1 h
P2 P3
calculate:
P3, F1, F2 F1 F2
P3 F1 F2
dh 1
F1 F2 , h 0 h0
X dt A
F1 CV P1 P2 0
X X
F2 CV P2 P3 0
P2 P0 gh 0
28
Solving nonlinear, dynamic models
• A set of DAE’s can be solved either by:
• Analytical techniques; normally the chances of success are quit small.
However finding an analytical solution after linearization is standard.
• Numerical techniques; think of Euler, Runga-Kutta methods etc…
• Implicit methods are attractive (the algebraic part already requires
iterations and they are very stable).
dx
f ( x, u ), x(0) x0
dt
xi 1 xi (ti 1 ti ) f ( xi , ui ) (explicit)
xi 1 xi (ti 1 ti ) f ( xi 1 , ui 1 ) (implicit)
29
Solution
• Nowadays there are a number software packages
available to solve DAE’s. There are basically two kind of
packages:
1. General purpose; like Matlab, Mathcad, Mapple and
Mathematica.
2. Process oriented; like gPROMS, Aspen Dynamics,
Hysys
30
Identification (I)
• The basic idea of identification is to fit the input-output
behavior of a parameterized differential equation to an
experiment.
u System y
31
Identification (II) dym
a ym b u
dt
• Assume a model, for example:
ym (0) ym 0
• This model has three parameters (a, b and ym0). The values of these
parameters is determined such that “the difference between ye(t)
and ym(t)” is minimal.
u(t), y (t) ym
ye
time
32
Identification (III)
• The main use of identification is tuning of PID-
controllers and getting models for Model Predictive
Control (MPC).
33
Validation
• To determine whether the model represents the
process with the required accuracy for the specified
range of conditions.
34