0% found this document useful (0 votes)
66 views12 pages

Feedback Control Systems Project: Modeling and Control of Fluid System

The document describes a fluid system project involving modeling and control of a three tank fluid system. The system consists of a water reservoir connected to three coupled tanks (T1, T2, T3) through flow channels. A pump drives water from the reservoir to T2, which then feeds T1 and T3. Valves control the flow rates between tanks. The goal is to develop a nonlinear state space model and linearize it around an operating point, then use MATLAB to find the transfer function and plot the step response.

Uploaded by

saeed khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views12 pages

Feedback Control Systems Project: Modeling and Control of Fluid System

The document describes a fluid system project involving modeling and control of a three tank fluid system. The system consists of a water reservoir connected to three coupled tanks (T1, T2, T3) through flow channels. A pump drives water from the reservoir to T2, which then feeds T1 and T3. Valves control the flow rates between tanks. The goal is to develop a nonlinear state space model and linearize it around an operating point, then use MATLAB to find the transfer function and plot the step response.

Uploaded by

saeed khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

University of Sharjah

College of Engineering
Department of electrical and electronics Engineering

Spring Semester 2020/2021

Feedback Control Systems

Project
“Modeling and control of Fluid System”

Section: 13

Instructors: Dr. Sofiane Khadraoui

Name: Ruqya Alhammadi Id: U18101605

Name: Hamda Al-Ali Id: U17101259


System description:
Consider the fluid system shown in the following figure. Such a system consists mainly of a
water reservoir and three coupled tanks, which are connected by two flow channels as shown in
the Figure.

A pump driven by a DC motor thrusts water collected in the water reservoir at the base to second
tank T2, which feeds the other tanks T1 and T3 through the two flow channels located between
T1 and T2, and T2 and T3. The system has four valves which allow the flow variation conditions
of the entire system. The valves 1 and 4 are used to vary the cross sectional areas “a1” and “a4”
and then provide a direct discharge into the main reservoir from tanks T1 and T4, respectively.
The valves 2 and 3 allow us to vary the cross sectional area “a2” and “a3” of the flow passage
and thus change the water flow rate between tanks. Water flow from the pump can be changed
by manipulating the input voltage “u” applied to the pump. Adjusting the the input voltage “u”
results in a change of water level h2 of tank T2, and hence, affects water level inside tanks T1
and T3. In such a system, the voltage “u” applied to the pump is selected as an input, while water
level in the third tank h3 is chosen as an output of the system. The mathematical model of the
system can be obtained using Bernoulli’s law and mass balance equation, where dynamic of each
tank is described by a non-linear differential equation that presents the time change of water
level inside the tank:

such that
 𝐴1 , 𝐴2 and 𝐴3 are the cross sectional areas of tanks T1, T2, and T3 respectively.
 𝑎1 (resp. 𝑎4 ) is the cross sectional area of the flow channel at the bottom of tank T1 (resp.
of the flow channel at the bottom of tank T3).
 𝑎2 (resp. 𝑎3 ) is the cross sectional area of the flow channel between tank T1 and tank T2
(resp. between tank T2 and tank T3).
 𝑔 is the gravity constant
 𝛼 is the pump gain
 𝑢 is the input voltage applied to the pump.
 ℎ1 , ℎ2 and ℎ3 are water levels in tanks T1, T2, and T3 respectively. ℎ3 is selected to be
the system output.
Questions:
𝑋̇ = 𝐹 (𝑋, 𝑢)
1. Write the nonlinear state space model in the form: {
𝑦 = 𝑔(𝑋, 𝑢)

𝑑ℎ1 𝑎2 𝑎1
ℎ̇1 = = √2𝑔√(ℎ2 − ℎ1 ) − √2𝑔√ℎ1
𝑑𝑡 𝐴1 𝐴1
𝑑ℎ2 −𝑎2 𝑎3 𝛼
ℎ̇2 = = √2𝑔√(ℎ2 − ℎ1 ) − √2𝑔√ℎ2 − ℎ3 + 𝑢
𝑑𝑡 𝐴2 𝐴2 𝐴2

𝑑ℎ3 𝑎3 𝑎4
ℎ̇3 = = √2𝑔√(ℎ2 − ℎ1 ) − √2𝑔ℎ3
𝑑𝑡 𝐴3 𝐴3
We will assume :
𝑋1 = ℎ1
𝑋2 = ℎ2
𝑋3 = ℎ3

𝑑ℎ1 𝑎2 𝑎1
𝑋̇1 = ℎ̇1 = = √2𝑔√(ℎ2 − ℎ1 ) − √2𝑔√ℎ1
𝑑𝑡 𝐴1 𝐴1

𝑑ℎ2 −𝑎2 𝑎3 𝛼
𝑋̇2 = ℎ̇2 = = √2𝑔√(ℎ2 − ℎ1 ) − √2𝑔√ℎ2 − ℎ3 + 𝑢
𝑑𝑡 𝐴2 𝐴2 𝐴2

𝑑ℎ3 𝑎3 𝑎4
𝑋̇3 = ℎ̇3 = = √2𝑔√(ℎ2 − ℎ1 ) − √2𝑔ℎ3
𝑑𝑡 𝐴3 𝐴3

𝑎2 𝑎1
√2𝑔√(𝑋2 − 𝑋1 ) − √2𝑔√𝑋1
𝑋̇1 −𝑎2
𝐴1
𝑎3
𝐴1
𝛼
𝑓1
[𝑋̇2 ] = √2𝑔√(𝑋2 − 𝑋1 ) − √2𝑔√𝑋2 − 𝑋3 + 𝑢 = [𝑓2 ]
𝐴2 𝐴2 𝐴2
𝑋̇3 𝑎3 𝑎4 𝑓3
√2𝑔√(𝑋2 − 𝑋1 ) − √2𝑔𝑋3
[ 𝐴3 𝐴3 ]

Y=𝑋3
2. Linearize the nonlinear state space model around the operating point
(ℎ1eq, ℎ2eq, ℎ3eq , 𝑢eq ) = (0.25, 0.5, 0.2, 8) in terms of the physical parameters. Write
̇
the linear state space model obtained as {𝑋 = 𝐴𝑋 + 𝐵𝑢
𝑦 = 𝐶𝑋 + 𝐷𝑢

−𝑎2 𝑎1 𝑎2
√2𝑔 − √2𝑔 √2𝑔 0
𝐴1 𝐴1 𝐴1
𝑎2 −𝑎2 𝑎3 𝑔 𝑎3 𝑔
[𝐴 ] = √2𝑔 √2𝑔 −
𝐴2 𝐴2 𝐴2 √0.6𝑔 𝐴2 √0.6𝑔
𝑎3 𝑔 −𝑎3 𝑔 𝑎4 𝑔
0 −
[ 𝐴3 √0.6𝑔 𝐴3 √0.6𝑔 𝐴3 √0.4𝑔 ]

0
𝛼
[𝐵] = [ ]
𝐴2
0

[𝐶 ] = [ 0 0 1 ]

[𝐷 ] = [ 0 ]
For the following questions 3 to 6, use the following parameter values 𝑔 = 9.8; 𝐴1 =
0.001; 𝐴2 = 0.005; 𝐴3 = 0.002; 𝑎1 = 𝑎4 = 0.0002; 𝑎2 = 𝑎3 = 0.003; 𝛼 = 0.009.

3. Use MATLAB Commands to find the transfer function of the system 𝐺(𝑠) from the
linear state space model obtained above.
Code Matlab:

clear all
% Q3
g=9.8;
A1 = 0.001;
A2 = 0.005;
A3 = 0.002;
a1 = 0.0002;
a4 = 0.0002;
a2 = 0.003;
a3 = 0.003;
alpha = 0.009;

A11=(((-a2/A1)*sqrt(2*g))-
((a1/A1)*sqrt(2*g)));
A12=((a2/A1)*sqrt(2*g));
A13=0;

A21=((a2/A2)*sqrt(2*g));
A22=(((-a2/A2)*sqrt(2*g))-
((a3/A2)*(g/sqrt(0.6*g))));
A23=((a3/A2)*(g/sqrt(0.6*g)
));

A31=0;
A32=((a3/A3)*(g/sqrt(0.6*g)
));
A33=(((-
a3/A3)*(g/sqrt(0.6*g)))-
((a4/A3)*(g/sqrt(0.4*g))));

B11=0;
B21=alpha/A2;
B31=0;

C11=0;
C12=0;
C13=1;

D=0;

A=[A11,A12,A13;A21,A22,A23;
A31,A32,A33];
B=[B11;B21;B31];
C=[C11,C12,C13];

[N,D]=ss2tf(A,B,C,D);
system=tf(N,D);
minreal(system)
4. Find the system step response y(t) (show your calculations by hand). Then, plot the
calculated output y(t) by the help of MATLAB (for 0≤ 𝑡 ≤ 20𝑠𝑒𝑐 and assuming a step
size equal to 0.1 sec).

10.91𝑠 + 154.6
𝐺(𝑠) =
𝑠 3 + 25.81𝑠 2 + 148.2𝑠 + 32.43
1
For unit step resonse : 𝑌 (𝑠) = 𝑠 𝐺(𝑠)

10.91𝑠 + 154.6
𝑌(𝑠) =
𝑠(𝑠 + 17.399)(𝑠 + 0.227)(𝑠 + 8.182)

𝐴 𝐵 𝐶 𝐷
𝑌 (𝑠 ) = + + +
𝑠 (𝑠 + 17.399) (𝑠 + 0.227) (𝑠 + 8.182)

10.91(0) + 154.6
𝐴|𝑠=0 = = 4.784
(0 + 17.399)(0 + 0.227)(0 + 8.182)

10.91(−17.399) + 154.6
𝐵|𝑠=−17.399 = = 0.01280
(−17.399)(−17.399 + 0.227)(−17.399 + 8.182)

10.91(−0.227) + 154.6
𝐶|𝑠=−0.227 = = −4.905
(−0.227)(−0.227 + 17.399)(−0.227 + 8.182)

10.91(−8.182) + 154.6
𝐷|𝑠=−8.182 = = 0.1089
(−8.182)(−8.182 + 17.399)(−8.182 + 0.227)

4.784 0.01280 −4.905 0.1089


𝑌 (𝑠 ) = + + +
𝑠 (𝑠 + 17.399) (𝑠 + 0.227) (𝑠 + 8.182)

By laplace (Y(s))

𝑌(𝑡) = 4.784 + 0.01280𝑒 −17.399𝑡 − 4.905𝑒 −0.227𝑡 + 0.1089𝑒 −8.182𝑡

clear all
% Q4
t = [0:0.1:20];
y=4.784+0.01280*exp(-
17.399.*t)-4.905*exp(-
0.227.*t)+0.1089*exp(-
8.182.*t)
plot(t,y)
title('step response')
5. Use MATLAB commands to plot the system step response for 0≤ 𝑡 ≤ 20𝑠𝑒𝑐. Compare
this step response with that obtained in Q4.

clear all
g=9.8;A1 = 0.001;A2 = 0.005;
A3 = 0.002;a1 = 0.0002;a4 = 0.0002;
a2 = 0.003;a3 = 0.003;alpha = 0.009;

A11=(((-a2/A1)*sqrt(2*g))-((a1/A1)*sqrt(2*g)));
A12=((a2/A1)*sqrt(2*g));
A13=0;

A21=((a2/A2)*sqrt(2*g));
A22=(((-a2/A2)*sqrt(2*g))-
((a3/A2)*(g/sqrt(0.6*g))));
A23=((a3/A2)*(g/sqrt(0.6*g)));

A31=0;
A32=((a3/A3)*(g/sqrt(0.6*g)));
A33=(((-a3/A3)*(g/sqrt(0.6*g)))-
((a4/A3)*(g/sqrt(0.4*g))));

B11=0;B21=alpha/A2;B31=0;

C11=0;C12=0;C13=1;

D=0;

A=[A11,A12,A13;A21,A22,A23;A31,A32,A33];
B=[B11;B21;B31];
C=[C11,C12,C13];

[N,D]=ss2tf(A,B,C,D);
system=tf(N,D);
minreal(system)

t = [0:0.1:20];
% y=4.784+0.01280*exp(-17.399.*t)-4.905*exp(-
0.227.*t)+0.1089*exp(-8.182.*t)
step(system,t)
title('step response')

It same as plot from the previous question.


6. The system transfer function 𝐺 (𝑠) of the given system is placed in a unity feedback loop as
𝐾
shown below, with a PID controller 𝐶 (𝑠) = 𝐾𝑝 + 𝑖 + 𝐾𝑑 𝑠, where 𝐾𝑝 , 𝐾𝑖 , and 𝐾𝑑 are the PID
𝑠
controller gains.

a. For 𝐾𝑝 = 10 and 𝐾𝑖 = 𝐾𝑑 = 0, plot the closed loop step response using MATLAB
commands, and then using Simulink for 0≤ 𝑡 ≤ 1𝑠𝑒𝑐. Determine the steady-state
error using the step response obtained.

clear all
g=9.8;A1 = 0.001;A2 = 0.005;
A3 = 0.002;a1 = 0.0002;a4 = 0.0002;
a2 = 0.003;a3 = 0.003;alpha = 0.009;

A11=(((-a2/A1)*sqrt(2*g))-
((a1/A1)*sqrt(2*g)));
A12=((a2/A1)*sqrt(2*g));
A13=0;

A21=((a2/A2)*sqrt(2*g));
A22=(((-a2/A2)*sqrt(2*g))-
((a3/A2)*(g/sqrt(0.6*g))));
A23=((a3/A2)*(g/sqrt(0.6*g)));

A31=0;
A32=((a3/A3)*(g/sqrt(0.6*g)));
A33=(((-a3/A3)*(g/sqrt(0.6*g)))-
((a4/A3)*(g/sqrt(0.4*g))));

B11=0;B21=alpha/A2;B31=0;

C11=0;C12=0;C13=1;

D=0;

A=[A11,A12,A13;A21,A22,A23;A31,A32,A33];
B=[B11;B21;B31];
C=[C11,C12,C13];

[N,D]=ss2tf(A,B,C,D);
system=tf(N,D);
minreal(system)

t2=[0:0.001:1];
C =tf([10]);
G=system
𝑒𝑠𝑠 = 𝑟(∞) − 𝑦(∞)
Y = feedback(C*G,1,-1) 𝑒𝑠𝑠 = 1 − 0.982 = 0.018
step(Y,t2)
Simulink :
b. Use MATLAB commands to plot root locus for the varying parameter 𝑲𝒊 (assuming
𝑲𝒑 = 𝟒 and 𝑲𝒅 = 𝟎) and then find the range of stability of the closed-loop system.

10.91𝑠 + 154.6
𝐺(𝑠) =
𝑠3 + 25.81𝑠2 + 148.2𝑠 + 32.43

𝑘𝑖
𝐶(𝑠) = 4 +
𝑠

1 + 𝐺(𝑠)𝐶(𝑠) = 0

10.91𝑠 + 154.6 𝑘𝑖
1+ ∗4+ =0
𝑠3 2
+ 25.81𝑠 + 148.2𝑠 + 32.43 𝑠

𝑘𝑖
𝑠3 + 25.81𝑠2 + 148.2𝑠 + 32.43 + (10.91𝑠 + 154.6) ∗ (4 + )=0
𝑠
𝑘𝑖
𝑠3 + 25.81𝑠2 + 148.2𝑠 + 32.43 + (10.91𝑠 + 154.6) ∗ (4 + )=0
𝑠

154.6
𝑠3 + 25.81𝑠2 + 191.84𝑠 + 650.83 + 10.91𝑘𝑖 + 𝑘𝑖 = 0
𝑠

154.6
𝑠3 + 25.81𝑠2 + 191.84𝑠 + 650.83 + 𝑘𝑖 (10.91 + )=0
𝑠
154.6
10.91 +
1 + 𝑘𝑖 3 𝑠 =0
𝑠 + 25.81𝑠2 + 191.84𝑠 + 650.83

Applay :1 + 𝑘𝑖 𝑃(𝑠) = 0

10.91𝑠 + 154.6
1 + 𝑘𝑖 =0
𝑠4 + 25.81𝑠3 + 191.84𝑠2 + 650.83𝑠

clear all
Numerator=[10.91 154.6];
Denominator=[1 25.81 191.84
650.83 0];
Y=tf(Numerator,Denominator);
rlocus(Y)

𝑇ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 𝑖𝑠 𝑠𝑡𝑎𝑏𝑙𝑒

The range 𝑘𝑖 < 41.7


c. Now set the PID gains to 𝑲𝒑 = 𝟓, 𝑲𝒊 = 𝟐, and 𝑲𝒅 = 𝟎, then test the PID controller
in Simulink and plot the step response of the simulated closed loop system over 0≤
𝑡 ≤ 1𝑠𝑒𝑐. What is your conclusion?

Simulink :

The closed-loop system is stable

You might also like