Você está na página 1de 11

Objective is to control the following MIMO mixing tank:

Temperature
Level
Controller
Setpoints
Hot water pump Cold water
pump
Output
(demand) pump
Control
Valve COh
Control
Valve COc
Figure 1. Proceess scheme
First of all, appropriate model is need to be obtained.
There is one mixing tank and two inlet valves. Control valves can control input flow of
hot and cold water. Temperature of hot water is assumed to be constant and is labeled as
1
T
, temperature of cold water is
2
T
. Input hot water flow is defined as
1
F Pumph COh
,
where
Pumph
represents hot water pump capacity and CO shows how open control
valve is (0-1). Both pump's capacity is assumed same and constant. Mixed water with
temperature T and flow
3
F
is flowing out of the tank. Objective is to control both
temperature and level, therefore we need to write differential equations which describe
dynamics of the system.
From the heat point of view, there are heat that going into tank (due to both input flows)
and there is heat going out of the tank (demand). Heat losses are assumed negligable.
Writing differential equation for level is easy, it is just simple matter of mass balance:
input output = accumulation.
Level equation is:
( )
1 2 3
1 2
( )
1
in out
h h c c
dV
F F
dt
dL
A F F F
dt
dL
A Pump CO Pump CO Demand t
dt
dL
F F F
dt A

+
+
+
Where A is cross-sectional area.
Temperature equation can be obtained from heat balance equation:
1 1 2 2 3
1 1 2 2 3
( ) d V T
F T F T FT
dt
dL dT
A T AL F T F T FT
dt dt

+
+ +
Since there is only one substance (water), density and specific heat are same in all terms.
Now if we combine last equation with the level equation, we get this:
( )
1 2 3 1 1 2 2 3
dT
F F F T AL F T F T FT
dt
+ + +
Which yields to the following temperature equation:
1 1 2 2
( ) ( )
dT
AL F T T F T T
dt
+
Finally we have two equations:
( )
1 2
1 dL
F F F
dt A
+ ........(1)
1 1 2 2
1 1
( ) ( )
dT
F T T F T T
dt AL AL
+ .......(2)
This leads to the following Matlab/Simulink model:
Figure 2. Matlab/Simulink model
Now the following nominal operational paremeters are assumed:
3
10
3
20
0
0
3
2
0.0042 0.4 0.00168 /
0.0042 0.5 0.0021 /
1
40
0.00378 /
1
h h
c c
F Pump CO m s
F Pump CO m s
L m
T C
Demand m s
A m

o

If inital values are
0
L
= 1m and T = 35C response is given in the following figures:
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
35
36
37
38
39
40
41
Time [s]
T
e
m
p
e
r
a
t
u
r
e

[

C
]
Figure 3. Temperature response of the model
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
35
36
37
38
39
40
41
Time [s]
T
e
m
p
e
r
a
t
u
r
e

[

C
]
Figure 4. Level response of the model
We see that temperature exponentiallyreach steady state value at 40C and level is
constant at 1m, becase there was no changes in supply or demand.
Now, by observing equations (1) and (2), one can see that model is nonlinear. If we want
to use standard LQR procedure to determine gains in order to control the process, we
need to have linear model.
Since we have nonlinear model, we need to linearize it first. The most used way is to
apply Taylor approximation.
Taylor approximation of function of one variable is given with the following formulas:
0
0 0
0
0
( )
( ) ( ) ( )
( )
( )
df x
f x f x x x
dx
df x
f x x
dx
+

For multivariable functions it is:
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0
( , , ) ( , , ) ( , , )
( , , ) ( , , ) ( ) ( ) ( )
F x y z F x y z F x y z
F x y z F x y z x x y y z z
x y z

+ + +

1 1
1
( ) F T T
AL
is obviously multivariable function (three variables).
Now if assume small changes around operational points:
10 1 0 1 0 10 1 0 10 0
1 1 1 2
0 0 0 0
( ) ( ) ( ) 1
( )
F T T T T F T T F T
F T T F L T
AL AL AL AL AL

+
20 2 0 2 0 20 2 0 20 0
2 2 2 2
0 0 0 0
( ) ( ) ( ) 1
( )
F T T T T F T T F T
F T T F L T
AL AL AL AL AL

+
0 10 1 0 1 0 10 1 0 10 0
1 2
0 0 0 0
20 2 0 2 0 20 2 0 20 0
2 2
0 0 0 0
( ) ( ) ( ) ( )
( ) ( ) ( )
d T T F T T T T F T T F T
F L T
dt AL AL AL AL
F T T T T F T T F T
F L T
AL AL AL AL
+
+ +

+ +
In steady state:
10 1 20 2
10 1 0 20 2 0 0
10 20
( ) ( ) 0
F T F T
F T T F T T T
F F
+
+
+
Since
0
T const
its derivation is zero.
1 0 10 1 0 10 0 2 0 20 2 0 20 0
1 2 2 2
0 0 0 0 0 0
( ) ( ) ( ) ( ) ( ) T T F T T F T T T F T T F T d T
F L T F L T
dt AL AL AL AL AL AL

+
Further, we have,
1 0 10 1 0 10 0 2 0 20 2 0 20 0
1 2 2 2
0 0 0 0 0 0
( ) ( ) ( ) ( ) ( ) T T F T T F T T T F T T F T d T
F L T F L T
dt AL AL AL AL AL AL

+
This can be written in the following matrix form:
1
10 20 10 1 0 20 2 0 1 0 2 0
2
2 0 0 0 0
( ) ( ) ( ) ( )
F T
F F F T T F T T T T T T
T
F L AL AL AL AL
1 1 1 1 + +
+
1 1 1 1

] ] ] ]
&
Or even more simple:
1
10 20 1 0 2 0
2 0 0 0
( ) ( )
0
F T
F F T T T T
T
F L AL AL AL
1 1 1 1 +
+
1 1 1 1

] ] ] ]
&
Applying same procedure on level equation, we have:
1 2
F F
L
A A

+
&
Now the sistem can be written in the following state-space form:
1 0 2 0
10 20 10 0 1 20 0 2
1 2 2
0 0
0 0
2
( ) ( )
1 1
0 0
T T T T
F F F T T F T T
F T T
AL AL
AL AL
L F
L
A A
1
+ + 1
1
1 1 1
1
1 +
1
1 1
1

1
] ]
]
1
]
1
]
&
&
Since state space representation of a system is given with following equations, we have:
c c
c c
x A x B u
y C x D u
+
+
&
where matrices are:
10 20
2
0
0
0 0
c
F F
AL A
+ 1

1
1
]
1 0 2 0
0 0
1 1
c
T T T T
AL AL
B
A A
1
1
1
1
1
]
1 0
0 1
c
C
1

1
]
0 0
0 0
c
D
1

1
]
LQR means linear quadratic regulator which assumes state variables to go to zero. We'll
use same procedure, but because in this case output variables are chosen as state variable,
they musn't go to zero, but to setpoints. Because of that I'll refer to optimal gains with
term LQ.
For steady, operational parameters, these matrics have following values:
Ac =
-0.0038 -0.0000
0 0
Bc =
25 -20
1 1
Cc =
1 0
0 1
Dc =
0 0
0 0

Now, we can compare these models with the following structures:

Figure 5. Comparing models
Where Step change is defined in the following way:
0, 4000
( )
0.0002, 4000
t s
Step t
t s
<

'

Which basically means, that there is a step change in hot water flow by 0.0002, which
represents about 5 % of total pump capacity.
Figure 6. Comparing responses of original and approximated model
This means that linearized model is good approximation of original nonlinear model.
If we execute following Matlab script:
%Mixing tank
clear
clc

T1 = 65;
T2= 20;
T0 = 40;

F10 = 0.0042*0.4;
F20 = 0.0042*0.5;
L0 = 1;
Area = 1;
%State space model
Ac = [-(F10+F20)/(Area*L0), (F10*(T0-T1)+F20*(T0-T2))/(Area*L0^2);
0 0];

Bc = [(T1-T0)/(Area*L0), (T2-T0)/(Area*L0);
1/Area, 1/Area];
Cc = [1 0; 0 1];
Dc = [0, 0; 0, 0];

%Cost matrices
Q = [1, 0; 0, 10];
R = [0.1 0; 0 0.001];
%Find discrete version of the system with sample time 0.01s
[Ad, Bd, Cd, Dd]= c2dm(Ac,Bc,Cc, Dc, 0.01);
%Calculate optimal gains
[K1,S,E] = dlqr(Ad,Bd,Q,R,0);
Result is:
K1 =
0.4841 8.7630
-4.1898 12.8069
This results in the following structure:
Figure 7. Simulation
Notice that setpoints are 42 C and 1.8 m.
Original nonlinear system presented in figure 2 is placed under subsytem mask. If
demand is changing in the following way :
0 1000 2000 3000 4000 5000 6000 7000
3
4
5
6
7
8
9
10
x 10
-3
D
e
m
a
n
d

i
n

m
3
/
s
Figure 8. Change in demand
Now temperature and level responses are:
3000 3500 4000 4500 5000
41.5
42
42.5
43
T
e
m
p
e
r
a
t
u
r
e

[

C
]
3000 3500 4000 4500 5000
1
1.2
1.4
1.6
1.8
L
e
v
e
l

[
m
]
Figure 9. Temperature and Level responses to change in demand
Now, if setpoints are SPtemp = 40C and Splevel = 1.2, with same change in demand, we
have following responses:
2000 2500 3000 3500 4000 4500 5000 5500
36
38
40
42
T
e
m
p
e
r
a
t
u
r
e

[

C
]
2000 2500 3000 3500 4000 4500 5000 5500
0.2
0.4
0.6
0.8
1
1.2
L
e
v
e
l

[
m
]
Figure 10. Temperature and Level responses to change in demand

Você também pode gostar