CME321 Project Group 2 With Equations
CME321 Project Group 2 With Equations
1|Page
College of Engineering
Project
Spring 2022
2|Page
Table of Contents
Problem 1: ......................................................................................................................4
Part a: Determine the Transfer Function that relates the height in the vessel to changes
Part b: Plot the actual solution versus the linearized solutiong using MATLAB ..........7
Problem 2: .. ………………………………………………………………………………8
Part a: Determine and plot the response of a closed-loop proportional (P) control
system and the offset for Kc and plot the relation using MATLAB……………….….11
Part b: Determine and plot the respone using Excel and MATLAB of a closed-loop
Part c: Repeat Part b using constant value of 20 for K and values of 1,2,5, and 10 min
for τI
…………………………………………………………………………………………………………………………………………
………… 18
Problem 3:……………………………………………………………………………….20
Part c: Use Simulink to determine the PI controller settings/ parameters using the step
Part d: Simulate the closed loop respone for the determined PI controller setting…...31
3|Page
*IMPORTANT NOTE
To access the Simulink files, please follow these instructions as Simulink versions differ
(A new version file might not be accessible using the old Simulink Version)
3) Model File Untick do not load models created with a newer version of Simulink
4|Page
5|Page
Part a
𝜌𝑞 − 𝜌𝑞0 = 𝜌 𝑑𝑉
𝑑𝑡
(𝑞 − 𝑑0) = 𝑉𝑑 𝑉
𝑞
𝑑𝑡
The difference between the two angles 𝜃and 𝜃0 is the derivative of volume
with respect to time. Therefore, the relation can be written it as follows:
𝑑𝑡 … … … … … … … . (2)
6|Page
𝑉𝑜𝑙𝑢𝑚𝑒 (𝑉) = 1
3 𝑟2 ℎ
To proceed,
𝑉𝑜𝑙𝑢𝑚𝑒 (𝑉) = 1
3ℎ
(𝑡𝑎𝑛 15)2ℎ
𝑞 − 𝑞0 = 𝜋 tan2 15
3
3ℎ2 𝑑ℎ
𝑑𝑡
𝑞 − 𝑞0 = 𝑡𝑎𝑛
( 215)ℎ2. 𝑑ℎ
𝑑𝑡 … … … … … … (3)
𝑤ℎ𝑒𝑟𝑒 𝑞0 = ℎ
𝑄(𝑠) =
𝑅
7|Page
Part b
clear all;
close all;
clc;
% Actual solution axis
X = 2 : 0.5 : 20;
% Linearized solution axis
Y = 2 : 0.5 : 20;
%Actual solution function
A = exp (-X / 3);
%Linearized solution function
B = exp (-X / 2);
%Plot command
plot (X, A, Y, B, 'k')
title('Actual solution versus the linearized solution')
legend('Actual solution', 'Linearized solution')
8|Page
<image: DeviceRGB, width: 646, height: 303, bpc: 8>
9|Page
For a closed loop proportional system, the transfer function (closed loop) of
the system given to us is as follows:
𝑑𝑡
Similarly, the response of the system in steady state can be written as follows:
𝑑𝑡
𝑇𝑖′ = 𝑇𝑖−𝑇𝑖𝑠𝑡𝑒𝑎𝑑𝑦 = 𝑇𝑖 - 60
𝑇′= 𝑇−𝑇𝑠𝑡𝑒𝑎𝑑𝑦= 𝑇- 80
𝑄 ′ = (𝑞 − 𝑞𝑠𝑡𝑒𝑎𝑑𝑦)
𝑤𝐶 Ti′ − T′ + Q ′ = 𝑉𝐶 𝑑𝑇′
𝑑𝑡
Ti′(s) 𝑄′(𝑠)
𝑊𝑐 = T′(𝑠) (𝜌𝑉
𝑤 𝑠 + 1) 𝑊ℎ𝑒𝑟𝑒 𝜏 = 𝜌𝑉
𝑠+ 1 +
1
𝑤𝐶 𝑄′(𝑠)
𝑠+ 1
10 | P a g e
Time constant:-
=𝑉
𝑉
𝐿= 1000 𝐿
200 𝐿
𝑚𝑖𝑛
Gain:-
𝐴=
1
𝑤𝐶
𝐴=
1
200 𝐿
𝑚𝑖𝑛 ∗ 1 𝑘𝑔
∗ 4.184
𝑘𝐽
𝐾𝑔 ∗ 𝐶0 ∗ 1 𝑚𝑖𝑛
60 𝑠𝑒𝑐
𝐴 = 𝐺𝑎𝑖𝑛 = 1
14
𝐶0
𝑘𝐽/𝑠𝑒𝑐
11 | P a g e
Part a
12 | P a g e
MATLAB Code
clear
clc
close all
for i = 1:4
PI = [5,10,20,100]; %Different Kc values for PI
ranging from 5 to 20
Kc = PI(1,i); %i starts from 1 until 4 representing
the four Kc values
display(Offset);
display(KcPlot);
13 | P a g e
Response in terms of Kc
offset =
-3.6832
-2.9170
-0.6143
kcplot=
10
20
100
<image: DeviceRGB, width: 290, height: 237, bpc: 8>
14 | P a g e
𝑜𝑓𝑓𝑠𝑒𝑡 =
5
1 + 𝑘𝐶𝐴
Kc
offset
5
3.680506685
10
2.912026726
20
2.054202671
100
0.611982214
15 | P a g e
Part b
Excel
Simulink
16 | P a g e
MATLAB Code
clear
clc
close all
for i = 1:4
PI = [5,10,20,100]; %Different Kc values for PI
ranging from 5 to 20
Kc = PI(1,i); %i starts from 1 until 4 representing
the four Kc values
display(Offset);
display(KcPlot);
17 | P a g e
Response of KC
Regardless of the actual value of kc, the process reaches the same steady state
value. A variation in Kc values, however; results in a variant response and a
deviation in temperature. For example, Kc=5 results in the biggest
temperature deviation. In contrast, when Kc=100, the maximum deviation is
smallest. By setting Kc higher, the maximum deviation from the set point and
oscillations will be reduced. Thus, higher Kc is more desired.
Offset in PI
Offset =
-0.0025
0.0001
0.0000
Kcplot =
10
20
100
18 | P a g e
Part c
Excel
19 | P a g e
MATLAB Code
clear
clc
close all
for i = 1:4
PI = [1,2,5,10]; %Different Kc values for PI
ranging from 1 to 10
tao = PI(1,i); %defining tao for each Kc value in
the PI
%calling the simulink model 'q2modelgroup2'
model = 'q2modelgroup2';
[t,x,y]= sim(model,60);
plot(t,y(:,1),'color',rand(1,3));
xlabel('Time')
ylabel('Deviation in Tank Temperature T''')
legend('tao = 1','tao = 2','tao = 5','tao = 10')
title('Temp vs Time for tao = 1,2,5,10');
xlim([0 60]);
hold on
[rowL,colL] = size(y);
end
20 | P a g e
W1
W2
X1
X2
h(m)
X
600
300
0.25
0.4
1.4
0.3
<image: DeviceRGB, width: 582, height: 362, bpc: 8>
21 | P a g e
22 | P a g e
Part a
23 | P a g e
Part b
𝑑𝑚
𝑑𝑡 = 𝑤1 + 𝑤2(𝑡) − 𝑤(𝑡)
0 = 𝑤1 + 𝑤2(𝑡) − 𝑤(𝑡)
𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒, 𝑑𝑚
𝑑𝑡 = 0
𝑉 𝑑𝑥(𝑡)
𝑑𝑡
= 𝑤1𝑥1(𝑡) + 𝑤2(𝑡)𝑥2 − 𝑤(𝑡)𝑥(𝑡)
𝑑𝑡
= 𝑤1𝑥1(𝑡) + 𝑤2(𝑡)𝑥2 − 𝑤1𝑥(𝑡) − 𝑤2(𝑡)𝑥(𝑡)
𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒, 𝑤𝑡 = 𝑤1 + 𝑤2(𝑡)
In order to linearize the system about the steady state, first order Taylor
series expansion should be applied
𝑑𝑥1(𝑡) │𝑋1,𝑊1,𝑋
24 | P a g e
𝑋′1(𝑡) = 𝑥1(𝑡) − 𝑋1
𝑊′2(𝑡) = 𝑤2(𝑡) − 𝑊2
𝑋′(𝑡) = 𝑥(𝑡) − 𝑋
𝑋′1(𝑡) +
𝑓
𝑑𝑤2(𝑡) │𝑋1,𝑊2,𝑋𝑊′2(𝑡) +
𝑓
𝑑𝑥(𝑡) │𝑋1,𝑊2,𝑋𝑋′(𝑡)
𝑑𝑥1(𝑡) │𝑋1,𝑊2,𝑋 = 𝑊1
𝑑𝑤2(𝑡) │𝑋1,𝑊2,𝑋 = 𝑋2 − 𝑋
𝑑𝑡
= 𝑉 𝑑(𝑋′(𝑡) + 𝑋)
𝑑𝑡
=𝑉( 𝑑𝑋′(𝑡)
𝑑𝑡
)
Combine
( 𝑑𝑋′(𝑡)
𝑉
𝑑𝑡
) = 𝑊1𝑋′
( 𝑠𝑋′
𝑉
𝑠 + 𝑋′(0)) = 𝑊1𝑋′
(𝑠)
25 | P a g e
1(𝑠)
𝐺𝑑𝑣 = 𝑋′(𝑠)
𝑋′1(𝑠) =
𝑊1
𝑉𝑠 + 𝑊1 + 𝑊2
=
𝑊1
𝑊1 + 𝑊2
𝑉
𝑊1 + 𝑊2 𝑠 + 1
= 𝑘𝑑𝑣
𝑠+ 1
Where 𝜏 =
𝑊1
𝑊1+𝑊2
𝐺𝑚𝑣 = 𝑋′(𝑠)
𝑊′2(𝑠) =
(𝑋2 − 𝑋)
𝑉𝑠 + 𝑊1 + 𝑊2
𝑋2 − 𝑋
𝑊1 + 𝑊2
𝑉
𝑊1 + 𝑊2 𝑠 + 1
= 𝑘𝑚𝑣
𝑠+ 1
Where 𝜏 =
𝑉
𝑊1+𝑊2 and 𝑘𝑚𝑣 =
(𝑋2−𝑋)
𝑊1+𝑊2
kdv
𝑘𝑑𝑣 =
𝑊1
𝑊1 + 𝑊2
𝑘𝑑𝑣 =
600
600 + 300
𝐾𝑑𝑣 = 0.67
W1
W2
X1
X2
h(m)
X
600
300
0.25
0.4
1.4
0.3
26 | P a g e
kmv
𝑘𝑚𝑣 = (𝑋2 − 𝑋)
𝑊1 + 𝑊2
𝑘𝑔
𝜏=
𝑉
𝑊1 + 𝑊2
𝜏=
(1000 𝑘𝑔
𝑚3)(𝜋
4 (2)2(1.4)
600 + 300
= 4.9 𝑖𝑛
𝑚
Transfer Functions
𝐺𝑑𝑣 =
0.67
4.9𝑠 + 1
𝑤ℎ𝑒𝑟𝑒 𝑘𝑚𝑣 = 1.11 ∗ 10−4, 𝜏 = 4.9
𝐺𝑚 = ∆𝐸𝑙𝑒𝑐𝑡𝑟𝑖𝑐 𝑆𝑖𝑔𝑛𝑎𝑙
𝐺𝑚 = 20 − 4
0.5
𝑒−𝑠
𝐺𝑚 = 32 𝑒−𝑆
27 | P a g e
𝐺𝑣 = ∆𝑃𝑟𝑒𝑠𝑠𝑢𝑟𝑒 𝑆𝑖𝑔𝑛𝑎𝑙
∆𝐸𝑙𝑒𝑐𝑡𝑟𝑖𝑐 𝑆𝑖𝑔𝑛𝑎𝑙
𝑘𝑣
𝑣𝑠 + 1
𝐺𝑣 = 15 − 3
20 − 4
300
1.2
0.08335𝑠 + 1
𝐺𝑣 =
187.5
0.08335𝑠 + 1
𝐺𝑐 = 𝐾𝑐(1 + 1
𝐼𝑠)
𝐺𝑐 = 𝐾𝑐(1 + 1
𝐼𝑠 + 𝐷𝑠)
28 | P a g e
Part c
29 | P a g e
MATLAB Code
clear
clc
close all
for i = 1:5
PI = [10.7,11,11.5,11.8,12]; %Different Kc values for PI ranging
from 10.7 to 12
Kc = PI(1,i); %i starts from 1 until 5 representing the four Kc
values
%calling the simulink model
model = 'q3modelgroup2';
[t,x,y]= sim(model,40);
plot(t,y(:,1),'color',rand(1,4));
xlabel('Time')
ylabel(' X''(t)')
legend('Kc = 10.7','Kc = 11','Kc = 11.5','Kc = 11.8','Kc = 12')
title('Composition vs Time for Kc = 10.7,11,11.5,11.8,12');
xlim([0 40]);
hold on
end
Response of the system
In
order
to observe
the
30 | P a g e
Kc
𝐾𝑐 = 0.45𝐾𝑐𝑢
𝐾𝑐 = 0.45 ∗ 11.8
𝐾𝑐 = 5.3
τI
τI = 𝑃𝑢
1.2
τI = 4
1.2
τI = 3 𝑚𝑖𝑛
31 | P a g e
Part d
MATLAB Code
clear
clc
close all
%Given parameters
Kc = 5.31;
taoi = 3.2691 ;
32 | P a g e
Part e
τD = 𝑃𝑢
τD = 4
τD = 0.5 𝑚𝑖𝑛
𝐾𝑐
Kc = 0.6𝐾𝑐𝑢
Kc = 0.6 ∗ 11.8
Kc = 7.08
𝜏I
τI = 𝑃𝑢
τI = 4
2
τI = 2 𝑚𝑖𝑛
33 | P a g e
MATLAB Code
clear
clc
close all
%Given parameters
Kc = 5.31;
taoi = 3.2691 ;
for i = 1:7
PID = [0,0.4,1,2,3,3.5,4]; %Different taod values
for PID ranging from 0 to 4
taod = PID(1,i);
34 | P a g e
By setting 𝐷
value to 3 min, the offshoot will decrease. Thus, the sluggish
response of the process will decrease.
Kc = 5.13
𝜏I = 3.2 min
𝜏D = 3 min