You are on page 1of 19

CL 433 Chemical Engineering Lab-4 [2021]

Experiment Number CTRL 402

Title Closed Loop Control

Sub-group Code B1d

Date of Experiment 09/02/21

Date of Report Submission 12/02/21

Roll Number Name Responsibility owned


(data, analysis, plots, report,
none)

170020009 Rajat Daga Plots, Code

170020107 Sourav Mishra Calculations, Discussion

170020105 Prithvee Raj Raw Data, Report

170020077 Viren Haldwania Procedure, PPT

(For use by examiners only)

Criterion TA assigned marks Faculty assigned marks

Calculations [35]

Graphical plots [20]

Hypothesis testing [35]

Report quality [10]

Initials with date

R&P TA initials with date


TABLE OF CONTENTS

OBJECTIVE: 3

APPARATUS: 3

PROCEDURE: 3

PRELIMINARY DATA: 5
5.1. Raw Data 5
5.2. Average Transfer Functions from CTRL 401 5
5.3. Derived Data from CTRL 401 5

CALCULATIONS 5

PLOTS: 7

MATLAB CODE: 11
For Regulatory Response: 11
For Servo response: 14

DISCUSSION 17
8.1. OBSERVATIONS 17
8.2. HYPOTHESIS 18
1. OBJECTIVE:
a. Conducting closed loop experiments on the assigned experimental setup using P and
PI controllers designed as part of CTRL 401.
b. Simulate closed loop behavior using the identiÖed transfer function model and
controllers designed as part of CTRL 401.
c. Compare experimental behavior with the simulated behavior.

2. APPARATUS:

3. PROCEDURE:
Carry out the following tasks using the assigned experimental setup during the lab
session:
1. System startup: Start the system under closed loop control with PI-1 as
controller. Use the initial output steady state obtained as part of the open loop
experiment (CTRL401) as the nominal setpoint. Set the disturbance input
value at nominal disturbance steady state (Ds) used in the open loop
experiment (CTRL 401).
2. Servo Control Experiment using PI-1 controller: After the system has settled
at the nominal setpoint, conduct the following experiment:
a. Introduce a negative step change of magnitude R in the setpoint. Wait
for 10-15 mins till the closed loop system settles at the specified
setpoint
b. Change the setpoint to the nominal setpoint and wait for 10 to 15
minutes till the closed loop system settles at the nominal setpoint.
3. Repeat the Servo Control Experiment using PI-2 controller.
4. Regulatory Control Experiment using PI-2 settings: After the system has
settled at the nominal setpoint, conduct the following experiment:
a. Introduce a negative step change of magnitude D in the disturbance
input. Wait for 10 to 15 minutes till the closed loop system reaches a
steady state.
b. Reverse the disturbance change and set the disturbance input back to
Ds: Wait for 10 to 15 minutes till the closed loop system reaches a
steady state again.
5. Regulatory Control Experiment using Proportional Control: Repeat the
regulatory control experiment using the proportional controller, P-2, designed
as part of CTRL-401.

4. P&ID:
Block Diagram

G​p​(s) is the plant transfer function

5. PRELIMINARY DATA:
5.1. Raw Data
reg-data-1 for pi-2, reg-data-2 for p2, servo-data-1 for pi-1, servo-data-2 for pi-2

5.2. Average Transfer Functions from CTRL 401


Average gain K​p​ = Average of K​p​ obtained from Optimal method
= (K​p,1​ + K​p,2​)/2 = (2.45 + 2.46)/2 = 2.455
Average time constant τ​p =
​ Average of time constant obtained from optimal method

= (τ​p,1 +τ​
​ p,2 )/2
​ = (75.75 + 100.71)/2 = 88.23

5.3. Derived Data from CTRL 401


For the interacting tank setup, the following parameters were predicted -
● P controller -
○ For ​alpha​1​ = 2, K​c,1​ = 0.496
○ For ​alpha​2​ = 2.4, K​c,2​ = 0.570
● PI controller -
○ For ​alpha​ = 2, ​zeta1​ ​ = 0.78, K​c,1​ = 1.052, tau​I,1​ = 63.35
○ For a​ lpha​ = 2, ​zeta2​ ​ = 1.28, K​c,2​ = 1.678, tau​I,2​ = 90.88

6. CALCULATIONS
As a part of the open loop experiment CTRL 401, we developed the process model of
the form:

For simulation, we define two state variables:

Expressing them in two differential equations in time domain: (The transfer function
model is equivalent to the following set of ODEs)

=> The set of two ODEs:

These two equations can be combined into a vector differential equation:


The system model can be expressed as the following set of ODEs:

Where, C = [1 1].

7. PLOTS:
Plot 1:​ Y​k​(t​k​) vs t​k​; Ŷ(t​k​) vs t​k​ and R(t​k​) vs t​k​ for both servo control experiments:
Plot 2:​ U​k​(t​k​) vs t​k​ and Û(t​k​) vs t​k​ for both servo control experiments:

Plot 3:​ Error Plot for both servo control experiments:


Plot 4: ​Error integral as computed for both servo control experiments:

Plot 5: ​Y​k​(t​k​) vs t​k​; Ŷ(t​k​) vs t​k​ and R(t​k​) vs t​k​ for both regulatory control experiments:
Plot 6:​ U​k​(t​k​) vs t​k​ and Û(t​k​) vs t​k​ for both regulatory control experiments:

Plot 7:​ D​k​(t​k​) vs t​k​ for both regulatory control experiments:


Plot 8:​ Error Plot for both regulatory control experiments:

Plot 9:​ Ŷ(t​k​) vs t​k​ for both servo control experiments:


8. MATLAB CODE:
For Regulatory Response:
clc
clear variables
load B3a_reg_data_2
n = length(TIME);
dR = SETPT - SETPT(1);
ddist = DIST - DIST(1);
err = zeros(n,1);
C = [1 1];
taop = 88.23;
Kp = 2.455;
taod = 119.52;
Kd = 2.015;
A = [-1/taop 0; 0 -1/taod];
B = [Kp/taop 0; 0 Kd/taod];
h = 1;
x1 = zeros(2,n);
dyest = zeros(n,1);
dy = zeros(n,1);
dUest = zeros(n,1);
Kc = 0.57;
var = zeros(2,n);
for i=1:n
dyest(i) = C*x1(:,i);
err(i) = dR(i) - dyest(i);
dUest(i) = Kc * err(i);
var(:,i) = [dUest(i) ddist(i)]';
x1(:,i+1) = ([1 0; 0 1]+h*A)*x1(:,i)+h*B*var(:,i);
end
x1(:,end) = [];
Umean = mean(MV(1:50));
Uest = dUest + Umean*ones(length(dUest),1);
TIME = TIME-TIME(1);
yest = dyest + SETPT(1)*ones(n,1);
figure(1)
plot(TIME, OUTPUT);
hold on;
plot(TIME, yest);
hold on;
plot(TIME, SETPT);
hold on;
figure(2)
plot(TIME, MV);
hold on;
plot(TIME, Uest);
figure(3)
plot(TIME, DIST);
hold on;
figure(4)
plot(TIME, yest);
hold on;
figure(5)
plot(TIME, err);
hold on;

load B3a_reg_data_1
n = length(TIME);
dR = SETPT - SETPT(1);
ddist = DIST - DIST(1);
err = zeros(n,1);
C = [1 1];
taop = 88.23;
Kp = 2.455;
taod = 119.52;
Kd = 2.015;
A = [-1/taop 0; 0 -1/taod];
B = [Kp/taop 0; 0 Kd/taod];
h = 1;
x1 = zeros(2,n);
dyest = zeros(n,1);
dy = zeros(n,1);
dUest = zeros(n,1);
Kc = 1.678;
taoI = 90.88;
var = zeros(2,n);
z = zeros(n,1);
for i=1:n
dyest(i) = C*x1(:,i);
err(i) = dR(i) - dyest(i);
dUest(i) = Kc * err(i) + (Kc/taoI)*z(i);
var(:,i) = [dUest(i) ddist(i)]';
x1(:,i+1) = ([1 0; 0 1]+h*A)*x1(:,i)+h*B*var(:,i);
z(i+1) = z(i) + h*err(i);
end
x1(:,end) = [];
Umean = mean(MV(1:50));
Uest = dUest + Umean*ones(length(dUest),1);
TIME = TIME - TIME(1);
yest = dyest + SETPT(1)*ones(n,1);
figure(1)
plot(TIME, OUTPUT);
hold on;
plot(TIME, yest);
hold on;
plot(TIME, SETPT);
hold on;
legend("Output P2", "Comp Output P2", "Setpoint P2", "Output PI2", "Comp Output
PI2", "Setpoint PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");
figure(2)
plot(TIME, MV);
hold on;
plot(TIME, Uest);
legend("Obs MV P2","Comp MV P2", "Obs MV PI2","Comp MV PI2");
xlabel("Time in s");
ylabel("Measurement in mA");
figure(3)
plot(TIME, DIST)
legend("Disturbance P2", "Disturbance PI2");
xlabel("Time in sec");
ylabel("Disturbance in mA");
figure(4)
plot(TIME, yest);
legend("Comp Output PI1","Comp Output PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");
figure(5)
plot(TIME, err);
legend("Comp Error P2","Comp Error PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");
For Servo response:
clc
clear variables
load B3a_servo_data_1
n = length(TIME);
dR = SETPT - SETPT(1);
ddist = DIST - DIST(1);
err = zeros(n,1);
C = [1 1];
taop = 88.23;
Kp = 2.455;
taod = 119.52;
Kd = 2.015;
A = [-1/taop 0; 0 -1/taod];
B = [Kp/taop 0; 0 Kd/taod];
h = 1;
x1 = zeros(2,n);
dyest = zeros(n,1);
dy = zeros(n,1);
dUest = zeros(n,1);
Kc = 1.052;
taoI = 63.35;
var = zeros(2,n);
z = zeros(n,1);
for i=1:n
dyest(i) = C*x1(:,i);
err(i) = dR(i) - dyest(i);
dUest(i) = Kc * err(i) + (Kc/taoI)*z(i);
var(:,i) = [dUest(i) ddist(i)]';
x1(:,i+1) = ([1 0; 0 1]+h*A)*x1(:,i)+h*B*var(:,i);
z(i+1) = z(i) + h*err(i);
end
z(end) = [];
x1(:,end) = [];
Umean = mean(MV(1:50));
Uest = dUest + Umean*ones(length(dUest),1);
TIME = TIME - TIME(1);
yest = dyest + SETPT(1)*ones(n,1);
figure(1)
plot(TIME, OUTPUT);
hold on;
plot(TIME, yest);
hold on;
plot(TIME, SETPT);
hold on;
figure(2)
plot(TIME, MV);
hold on;
plot(TIME, Uest);
figure(3)
plot(TIME, DIST);
hold on;
figure(4)
plot(TIME, yest);
hold on;
figure(5)
plot(TIME, err);
hold on;
figure(6)
plot(TIME, z);
hold on;

load B3a_servo_data_2
n = length(TIME);
dR = SETPT - SETPT(1);
ddist = DIST - DIST(1);
err = zeros(n,1);
C = [1 1];
taop = 88.23;
Kp = 2.455;
taod = 119.52;
Kd = 2.015;
A = [-1/taop 0; 0 -1/taod];
B = [Kp/taop 0; 0 Kd/taod];
h = 1;
x1 = zeros(2,n);
dyest = zeros(n,1);
dy = zeros(n,1);
dUest = zeros(n,1);
Kc = 1.678;
taoI = 90.88;
var = zeros(2,n);
z = zeros(n,1);
for i=1:n
dyest(i) = C*x1(:,i);
err(i) = dR(i) - dyest(i);
dUest(i) = Kc * err(i) + (Kc/taoI)*z(i);
var(:,i) = [dUest(i) ddist(i)]';
x1(:,i+1) = ([1 0; 0 1]+h*A)*x1(:,i)+h*B*var(:,i);
z(i+1) = z(i) + h*err(i);
end
z(end) = [];
x1(:,end) = [];
Umean = mean(MV(1:50));
Uest = dUest + Umean*ones(length(dUest),1);
TIME = TIME - TIME(1);
yest = dyest + SETPT(1)*ones(n,1);
figure(1)
plot(TIME, OUTPUT);
hold on;
plot(TIME, yest);
hold on;
plot(TIME, SETPT);
hold on;
legend("Output PI1", "Comp Output PI1", "Setpoint PI1", "Output PI2", "Comp
Output PI2", "Setpoint PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");
figure(2)
plot(TIME, MV);
hold on;
plot(TIME, Uest);
legend("Obs MV PI1","Comp MV PI1", "Obs MV PI2","Comp MV PI2");
xlabel("Time in s");
ylabel("Measurement in mA");
figure(3)
plot(TIME, DIST)
legend("Disturbance PI1", "Disturbance PI2");
xlabel("Time in sec");
ylabel("Disturbance in mA");
figure(4)
plot(TIME, yest);
legend("Comp Output PI1","Comp Output PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");
figure(5)
plot(TIME, err);
legend("Comp Error PI1","Comp Error PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");
figure(6)
plot(TIME, z);
legend("Integral error PI1", "Integral error PI2");
xlabel("Time (in sec)");
ylabel("Measurement in mA");

9. DISCUSSION
8.1. OBSERVATIONS
● In Plot 1, we observe that predictions match reasonably well for a negative
step change, but for positive step change, simulated behaviour is quite
different from observed behaviour
● Qualitative behaviours of the closed loop behaviour (Overshoots, undershoots)
match reasonably well by the approximated transfer function model
● In Plot 6, we observe a larger mismatch in the observed and simulated
Manipulated variables for PI-2 as compared to that for P-2. The higher
observed values as compared to the simulated values implies that the actual
gain is more than what has been derived by the optimal method.
● In Plot 9, we observe the following:
○ For PI-1 [with zeta_1 = 0.78 (<1)] we observe overshoots =>
Underdamped system​. This is because responses exhibit a higher
degree of oscillation and overshoot as zeta approaches zero.
○ For PI-2 [with zeta_2 = 1.28 (>1)], we observe a sluggish response
because large values of zeta yield a sluggish (slow) response =>
Overdamped system​.

8.2. HYPOTHESIS
Hypothesis-1​: The real system is nonlinear while our approximate transfer function
model is assumed to be linear.
Explanation​- For plot 1, predictions match reasonably well for a negative step change,
but for positive step change, simulated behaviour is quite different from observed
behaviour. This is because we have assumed a transfer function model; which is a
linear model; by considering the average gain and time constants from Optimal
method and therefore can not be a very good approximation for the real model which
is inherently nonlinear in nature.
Hypothesis-2​: Assumption of no unmeasured disturbance or wrong transfer function
structure in system during CTRL-401 experiment
Explanation​- In calculating the process transfer function coefficients (gain and time
constant) in CTRL-401, we did not account for unmeasured disturbances that would
have crept in due to unforced errors like sensor error. This error becomes significant
in the data set for positive step change in the 2nd input. Using the optimization
method, the output converges to a value different from that of the steady state value as
according to the data set. This can happen due to 2 reasons:
1) Unknown disturbance in the system: An unknown disturbance would add on
to the value of output obtained from optimization method as an innovation in
the system. However, such behaviour is not observed for the other 3 cases.
Thus, it would be safe to assume that the system does not have errors. It is
possible that error in noting down the data would have caused the error.
However, since it is being done digitally, there is very small chance of having
data entry issues. Therefore, the hypothesis of presence of unknown
disturbance can be safely rejected.
2) Wrong transfer function model structure: It is possible that the 2nd input and
output are related by a higher order transfer function. Also, a lump can be
noticed from the data plot for positive step change of 2nd input. This suggests
the presence of higher order transfer function. However, no such behaviour is
visible for negative step change of 2nd input. This suggests that there might be
some nonlinearities associated with increasing the flow of water in the second
tank. This is possible because of the following reasons:
a) Nonlinear valve characteristics: It is possible that the control valve
used for regulating flow into the 2nd tank has nonlinear characteristics
which amplifies at higher levels of flow.
b) Change in flow regime of fluid: It is possible that the pipe connecting
the water supply tank to tank-2 has undergone corrosion causing
change in flow regime over lower values of flow rate. This might have
caused fluid to behave in nonlinear fashion only when positive step
change is implemented.

You might also like