Professional Documents
Culture Documents
Mathematical Modeling, System Identification, and Controller Design of A Two Tank System
Mathematical Modeling, System Identification, and Controller Design of A Two Tank System
Mathematical Modeling, System Identification, and Controller Design of A Two Tank System
22
46th IEEE Conference on Decision and Control
New Orleans, LA, USA, Dec. 12-14, 2007
Abstract— In this paper we present a case study involving by any subspace algorithm such as CVA [4], N4SID [8],
mathematical modeling, system identification, and controller or MOESP [6]. One then converts the discrete-time model
design of a two tank fluid level system. The case study is to continuous-time using the algorithm of [7]. Then apply
motivated by a realistic application of a two tank problem.
We address some fundamental control oriented issues such as a similarity transformation to obtain a nonlinear system
physical plant design and identification, transformation from of equations which can be converted into an orthogonal
discrete-time to continuous-time, and finally the controller complement problem. The solution leads to the similarity
design. We also introduce a novel physical system identification matrix and the physical parameters of the system. Once the
algorithm consisting of subspace identification, followed by a actual plant parameters are obtained, one can proceed to
similarity transformation computation to extract the physical
parameters of the system. The controller design is done by Pole designing the controller.
Placement.
In this paper we present a detailed case study of a con-
I. I NTRODUCTION trol design problem. The case study emphasizes building a
Control engineering is one of those fields considered to be mathematical model of a two tank fluid system, followed by
rich in applications that affect just about every aspect of system identification and parameter estimation, and finally
modern life. By today’s standards, affordable commodities designing a controller that will control the fluid level in the
such as cruise control in automobiles, compact disc and second tank. The controller design is done by pole placement.
DVD players, toasters, and autofocus SLR cameras, to name The rest of the paper is organized as follows: In section
only a few, abound in control applications. With the growing 2 we present the mathematical model of the two tank
trend of affordable and scalable electronic components, system. In section 3 we introduce the system identification
control engineering will whiteness the evolution of new and and parameter estimation method and calculate these based
more challenging applications that not only will enhance on input and output data. In Section 4 we perform the
our comfort levels, but will also revolutionize industries controller design step. Finally, in Section 5 we present some
such as health care, aerospace, automotive, defense, and conclusions.
even the environment.
II. M ATHEMATICAL M ODELING
Designing a model-based controller usually requires a plant The physical law governing the behavior of the liquid level
model, which is normally obtained from first principles. system as described here is the principle of conservation of
However, the parameters of the model are normally unknown mass, which states that the time rate of change of the fluid
and need to be estimated from experimental data. Parameter mass inside the tank is equal to the mass flow rate in (ρqi (t))
estimation methods are typically nonlinear and iterative, minus the mass flow rate out (ρqo (t)) of the tank at time t.
which could lead to convergence problems. Furthermore, That is, if we take V (t) = Ah(t) to be the volume of the
there is also the fundamental issue of some plant model tank at time t, then the mass is equal to m(t) = ρV (t), and
being continuous state-space models but the data is discrete. the conservation of mass equation becomes
Thus, estimating the parameters of a continuous state-space
model with discrete data could lead to numerical problems. d
(ρAh(t)) = ρqi (t) − ρqo (t), (1)
In this paper we present a parameter estimation method for dt
continuous-time state-space models with discrete data. The where A is the area of the tank, h(t) is the fluid level
idea is to first identify a discrete-time state-space model at time t, and ρ is the fluid density. We assume the
Authorized licensed use limited to: UNIVERSITY OF WISCONSIN - STOUT. Downloaded on July 08,2010 at 13:31:33 UTC from IEEE Xplore. Restrictions apply.
46th IEEE CDC, New Orleans, USA, Dec. 12-14, 2007 ThPI23.22
outflow rate qo (t) to be a linear function of the fluid level in (b) Continuity equation for Tank 2:
the tank, i.e., qo (t) = αh(t), where α is the valve coefficient.
α1 α2
ḣ2 (t) − h1 (t) + h2 (t) = 0, (3)
Consider the two tank liquid level system shown in Figure A2 A2
1, where the given information is as follows: where α1 and α2 are the valve coefficients for tanks 1
qi (t) = Inflow rate entering tank 1 at time t. and 2, respectively.
d
q12 (t) = Inflow rate exiting tank 1 and entering If we let D = dt be the derivative operator, then we can
write (2) and (3), respectively, as
tank 2 at time t. µ ¶
qo (t) = Outflow rate exiting tank 2 at time t. α1 1
D+ h1 (t) = qi (t) (4)
A1 A1
h2 (t) = Height of water in tank 2 at time t.
D1 = Diameter of tank 1 (area A1 ). µ
α2
¶
α1
D+ h2 (t) = h1 (t). (5)
D2 = Diameter of tank 2 (area A1 ). A2 A2
h2 (0) = Initial height of water in tank 2 at time 0. ³
α1
´
Now multiplying (5) by D + A , we obtain
ḣ2 (0) = Initial rate of change of height of water in 1
µ ¶µ ¶
tank 2 at time 0 α1 α2
D+ D+ h2 (t)
hD (t) = Desired water level in tank 2 at time t. A1 A2
µ ¶ µ ¶
α1 α1
= D+ h1 (t) . (6)
A1 A2
³ ´
α1
We can now eliminate the term D + A 1
h1 (t) in (6) by
the term on the right hand side of (4). That is,
u(t) µ ¶ µ ¶
Dα1 Dα2 α1 α2 α1
D2 + + + h2 (t) = qi (t).
qi(t) A1 A2 A1 A2 A1 A2
Finally, we can simplify this last equation to yield
Controller ḧ2 (t) + 2ξωn ḣ2 (t) + ωn2 h2 (t) = βqi (t), (7)
K
h1(t) where we have defined the parameters as
D1
α1 A2 + α2 A1
2ξωn = (8)
A1 A2
hD (t) − h2(t) α1 α2
ωn2 = (9)
A1 A2
q12(t) α1 ω2
β = = n, (10)
A1 A2 α2
from which one can obtain
r
h2(t)
α1 α2
D2 ωn = = undamped natural frequency, rad/s
A1 A2
α1 A2 + α2 A1
ξ = √ = dimensionless damping ratio.
2 α1 α2 A1 A2
Notice that this system is overdamped since
qo(t)
(α1 A2 − α2 A1 )2
ξ2 − 1 = > 0.
Fig. 1. Two tank problem with a simple controller. 4α1 α2 A1 A2
As a result of the fact that ξ > 1, the response will not be
oscillatory [2]. Furthermore, the characteristic equation has
Using the mass balance principle, we now derive the dif-
the form
ferential equations for each tank. Follwing the continuity µ ¶µ ¶
principle, we obtain the continuity equations for each tank α1 α2
∆(s) = s+ s+ = 0,
as A1 A2
(a) Continuity equation for Tank 1: whose two roots are real and negative. Thus the system will
respond slowly to changes in demand (inputs). It has been
α1 1 shown in [3] that the best performance can be achieved
ḣ1 (t) + h1 (t) = qi (t). (2) when ξ = 1, which corresponds to the critical damping
A1 A1
2839
Authorized licensed use limited to: UNIVERSITY OF WISCONSIN - STOUT. Downloaded on July 08,2010 at 13:31:33 UTC from IEEE Xplore. Restrictions apply.
46th IEEE CDC, New Orleans, USA, Dec. 12-14, 2007 ThPI23.22
2840
Authorized licensed use limited to: UNIVERSITY OF WISCONSIN - STOUT. Downloaded on July 08,2010 at 13:31:33 UTC from IEEE Xplore. Restrictions apply.
46th IEEE CDC, New Orleans, USA, Dec. 12-14, 2007 ThPI23.22
in terms of ωn2 , ξ, and β. This means that since we do {Āc , B̄c , C̄c , D̄c } to physical coordinates {Ac , Bc , Cc , Dc }.
not have a state equation for h1 (t), one of the parameters For this we need to solve the following system of equations
cannot be identified uniquely. Notice that there is a term
equal to A1 A2 which cannot be separated. These three Ac = T Āc T −1 (16)
parameters {ωn2 , ξ, β} also show up in the state-space Bc = T B̄c (17)
parameter matrices {Ac , Bc , Cc , Dc }. Cc = C̄c T −1 . (18)
Given a recorded input/output discrete data set Equations (16) – (17) are highly nonlinear and difficult
{u(k), y(k)}N −1
k=0 , we would now like to identify the to solve as such. However, if we re-write (16) and (17),
system order n and state-space parameter matrices respectively as
{Ād , B̄d , C̄d , D̄d } in discrete-time form. That is, we would
like to identify a discrete-time version of (13) – (14), given Ac T = T Āc
discrete-time data of the form
Cc T = C̄c .
u(k) = u(tk )|tk =k∆+t0
Expanding these out we obtain,
y(k) = y(tk )|tk =k∆+t0 , k = 0, 1, 2, . . . , N − 1,
· ¸· ¸
t11 t12 ā11 ā12
where t0 is an initial time, usually taken as the origin. One t21 t22 ā21 ā22
can easily obtain a model {Ād , B̄d , C̄d , D̄d , x̄d (0), n} using · ¸· ¸
a subspace technique such as MOESP, CVA, or N4SID [4], 0 1 t11 t12
=
[6], [8]. This can be easily done in MATLAB [5] and we −ωn2 −2ξωn t21 t22
will present an example later in this Section.
· ¸· ¸ · ¸
t11 t12 b̄11 0
Assuming the discrete-time identification is done =
t21 t22 b̄21 β
successfully, we now need to convert the parameter matrices · ¸
{Ād , B̄d , C̄d , D̄d } to its continuous-time counterpart
£ ¤ £ ¤ t11 t12
c̄11 c̄12 = 1 0 .
{Āc , B̄c , C̄c , D̄c } using a time step ∆. For this we will use t21 t22
an iterative algorithm due to [7], as follows: If we now let
Step 0: Initialization step X = ωn2 , Y = 2ξωn , Z = β
F = Ād , G = B̄d , L = F − I2 M = −Xt11 − Y t21 , N = −Xt12 − Y t22 ,
M = I2 , P = M, i = 1, then we can convert the problem of finding T into an
where I2 is a 2 × 2 identity matrix. orthogonal complement problem such as xT A = 01×8 ,
where
Step 1: Iterate until convergence, k
xT =
£ ¤
t11 t12 t21 t22 M N Z 1
for i = 2 : k ā11 ā12 0 0 b̄11 0 −1 0
−(i − 1) · L · M ā21 ā22 0 0 b̄21 0 0 −1
M =
i −1 0 ā11 ā12 0 b̄11 0 0
P = P +M
0 −1 ā21 ā22 0 b̄21 0 0
A = ,
end 0 0 −1 0 0 0 0 0
0 0 0 −1 0 0 0 0
Step 2: Compute final continuous-time parameter matrices
0 0 0 0 0 −1 0 0
{Āc , B̄c , C̄c , D̄c } from 0 0 0 0 0 0 c̄11 c̄12
P ·L P ·G
Āc = , B̄c = , C̄c = C̄d , D̄c = D̄d , and 0m×n is an m × n matrix with all its elements equal
∆ ∆ to zero. Notice that columns 5, 7, and 8 of A are linearly
where the identified matrices have no structure and can be dependent since c̄11 b̄11 + c̄12 b̄21 = 0. Therefore, rank{A} =
represented as 7. The solution to xT A = 01×8 comes from the SVD of A,
· ¸ · ¸ i.e.,
ā11 ā12 b̄11
Āc = , B̄c =
ā21 ā22 b̄21 VT
· ¸· ¸
S 07×1
U U⊥
£ ¤
A = .
01×7 0 (V ⊥ )T
£ ¤ £ ¤
C̄c = c̄11 c̄12 , D̄c = 0 .
Let (U ⊥ )T =
£ ¤
We would now like to find the transformation ma- u1 u2 u3 u4 u5 u6 u7 u8 .
trix T that converts the identified continuous-time model Then the solution to the physical parameter extraction prob-
2841
Authorized licensed use limited to: UNIVERSITY OF WISCONSIN - STOUT. Downloaded on July 08,2010 at 13:31:33 UTC from IEEE Xplore. Restrictions apply.
46th IEEE CDC, New Orleans, USA, Dec. 12-14, 2007 ThPI23.22
2
· ¸
u1 u2
u3 u4 u5 u6 u7 1
T = , M =
, N = , Z = 0 0.5 1 1.5 2 2.5
u8 u8 · u8 ¸ u8 Time, t (minutes) 5
x 10
Measured vs Fitted Response
£ ¤ u4 −u2 1.21
1.2
0 0.5 1 1.5 2 2.5
Time, t (minutes) 5
x 10
2842
Authorized licensed use limited to: UNIVERSITY OF WISCONSIN - STOUT. Downloaded on July 08,2010 at 13:31:33 UTC from IEEE Xplore. Restrictions apply.
46th IEEE CDC, New Orleans, USA, Dec. 12-14, 2007 ThPI23.22
used for the purpose of controlling the fluid level in tank P.O. = 9.25 %
1.02
1
2, h2 (t), so that it follows a desired but known trajectory, 0.98
y(t)
who then tweaks the inflow valve, thus changing the inflow
0.6
rate to qi (t) = f (u(t)), where f (·) is used here to denote
that the response of the valve will not be instantaneous, and 0.4
the microcontroller will compute its adjustments according Fig. 3. Step response of both the open-loop and closed-loop systems.
to a control law of the form u(t) = −Kc e(t) + hD (t).
2843
Authorized licensed use limited to: UNIVERSITY OF WISCONSIN - STOUT. Downloaded on July 08,2010 at 13:31:33 UTC from IEEE Xplore. Restrictions apply.