Sol A4 ch3050 2010 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

INDIAN INSTITUTE OF TECHNOLOGY MADRAS

Department of Chemical Engineering

CH3050 Process Dynamics and Control


Assignment 4 Solutions

Marks distribution

Question 1 Question 2
(a) 15 10
(b) 10 15
(c) 10 10
(d) 5 7
(e) - 8
(f) - 5
(g) - 5

1
(a)
Given transfer function is
(2s + 1)e−2s
G(s) =
(20s + 1)(10s + 1)(5s + 1)(s + 1)

Step response of the system is

t1 is the value at 35.3% of the steady state magnitude of step response.


t2 is the value at 85.3% of the steady state magnitude of step response.

t1 = 23.95
t2 = 58.02

1
By using Krishnaswamy and Sundaresans method (of two points) fit a FOPTD model, therefore
need to find new delay and time constant.

τ = 0.67(t2 − t1 ) = 22.83
D = 1.3t1 − 0.29t2 = 14.30

Estimated gain value K = 0.9971.


Therefore,

0.9971e−14.3s
GF OP T D =
22.83s + 1
MATLAB codes are given below for fitting an approximate FOPTD and SOPTD model by using
Skogestad’s method.

Gs = tf([2 1],[1000 1350 385 36 1],’InputDelay’,2); % Given transfer function


[y t] = step(Gs); % Step resonse of the Gs
Kp = y(end);
[M2, t1prime] = min(abs(y-(0.353*Kp)));
[M2, t2prime] = min(abs(y-(0.853*Kp)));
t1 = t(t1prime);
t2 = t(t2prime);
D = 1.3*t1 - 0.29*t2;
tau = 0.67*(t2 - t1);
G_FOPTD = tf([Kp],[tau 1],’InputDelay’,D); % Final FOPTD model
step(Gs,Gapx); % Comparision between true model and approximated model.

Step Response
1
Gs
G_FOPTD
0.8
Amplitude

0.6

0.4

0.2

0
0 50 100 150
Time (seconds)

Figure 1: Comparison between true model and approximated model

(b)
Skogestads half-rule method
FOPTD approximated model structure

2
τ2

− +τ3 +τ4 s
Ke 2
GF OP T D = τ2
(τ1 + 2 )s +1

where, τ1 = 20, τ2 = 10, τ3 = 5, τ4 = 1


τ2
τ = τ1 + = 25
2
τ2
D= + τ3 + τ4 = 11
2
e−11s
GF OP T D =
25s + 1
SOPTD approximated model structure

τ3
Ke−( 2 +τ4 )s
GSOP T D =
(τ1 s + 1)((τ2 + τ23 )s + 1)

SOPTD approximated model is

e−3.5s
GSOP T D =
(20s + 1)(12.5s + 1)

(c)
MATLAB code for estimating SOPTD model by using least square method

clear all;close all;clc;


Gs = tf([2 1],[1000 1350 385 36 1],’InputDelay’,2);
[Gmag,Gphase,wvec] = bode(Gs,[0,0.1,100]’);
% For gain, time cnstant estimation fit magnitude plot
param = lsqcurvefit(@(param,wval) modpred(param,wval),[1 1 1]’,wvec,squeeze(Gmag));
Kp = param(1);
taup = param(2);
zeta = param(3);
% For delay estimatin fit phase plot
z = cos(squeeze(Gphase))
G_phase = lsqcurvefit(@(param,wval) phasepred(param,wval,Kp,taup,zeta),1,wvec,z);
D = G_phase;
s = tf(’s’);
G_SOPTD_ls = Kp*exp(-D*s)/(taup^2*s^2 + 2*zeta*taup*s + 1);
G_SOPTD_ls % approximated SOPTD model

1
G_SOPTD_ls = exp(-0.994*s) * -----------------------
130.8 s^2 + 34.65 s + 1

Step response comparison of true and approximated transfer function are as shown in figure.

3
Step Response
1
Gs
G_SOPTD
0.8

Amplitude
0.6

0.4

0.2

0
0 50 100 150 200
Time (seconds)

(d)
Comparison between true model and different approximated model obtained in (a)-(c) has been
plotted in below figure.

Step Response
1
Gs
G_FOPTD1
G_FOPTD
0.8
G_SOPTD
G_SOPTD_ls

0.6
Amplitude

0.4

0.2

0
0 50 100 150 200 250 300
Time (seconds)

Observation table for approximated FOPTD and SOPTD:

Method K D τ Method K D τ ζ
K-S 0.9971 14.30 22.83 Skogestad’s 1 3.5 15.81 1.028
Skogestad’s 1 11 25 LSQ 1 0.9943 11.43 1.52

2
(a)
The SIMULINK block diagram of the process with delay and ZOH is shown below.

4
Figure 2: Simulink Block with measurement noise

(b)
MATLAB code for input design and measurement data.

% Input design
B_max = 1/5;
Ts= 0.2;
usig = idinput(2555,’prbs’,[0 B_max],[-1 1]);
uin = [(0:1:length(usig)-1)’*Ts (usig)];

% Input-output data profile


data=iddata(yk,uk,1);
plot(data)

% Partitioning data into train and test data


data_train=data(1:1300);
data_test=data(1300:end);

% Removing the mean


[ztrain,Tr]=detrend(data_train,0);
ztest=detrend(data_test,Tr);

Snapshot of input-output data is shown below. From it is observed that no visible trends and
non-stationarities in the data.

5
Figure 4: Impulse and step response plots.

Figure 3: Snapshot of input-output profile

(c & d)
MATLAB code for estimation of delay and step response.

% Non-parametric(impulse ansd step responses)model estimation


impulse_est= impulseest(ztrain);
figure
impulse(impulse_est,’sd’,3);
figure
step(impulse_est)

The estimated impulse ands step responses for the given system is shown in respective figures.
From the estimated non-parametric analysis, we can observe that:

• System is stable with input-output delay of 3 samples. Hence n=3.

6
• When the damping is large the frictional force is so great that the system cant oscillate and
the process is sluggish. Hence it is an overdamped system.

• The steady state gain of the system is 1.8 units

With the initial idea obtained from the non-parametric analysis, we use the following conditions
to identify which model best fits the given data. The general conditions are:

• The inputs should uncorrelated with the residuals.

• The residuals should be uncorrelated amongst themselves.

• Error in the estimates should be low, which implies our estimated model is parsimonious.

(e , f & g)
MATLAB Code for parametric estimation.

%OE model
model_oe=oe(ztrain,[1,2,3]);
figure
resid(model_oe,ztrain);
figure
compare(model_oe,ztest);
present(model_oe);

The output error model, assumes that the white noise directly affects the output.The model is
denoted as OE(m,n) with a delay of d samples.
From the analysis of impulse and step responses, m=1,n=2 and d=3. A total of (m+n) parameters
have to be estimated.
Goodness of the model
A good model should not leave behind residuals from training. The given figure below displays the
correlation between any two samples separated in time by lag l. This is auto-correlation function
which explains the random effects in stochastic part of model. ACF is unity at lag zero.
The figure also displays the correlation between the residuals and lagged inputs.It is clear from
the figure that there exists no significant correlation between residuals and inputs.This is known as
cross-correlation.

Figure 5: Correlation analysis

7
Thus the estimated OE model has satisfactorily captured the dynamics of the deterministic pro-
cess.
Final model

%Results
model_oe =
Discrete-time OE model: y(t) = [B(z)/F(z)]u(t) + e(t)
B(z) = 0.01262 (+/- 0.0007002) z^-3

F(z) = 1 - 1.802 (+/- 0.01158) z^-1 + 0.8085 (+/- 0.01133) z^-2

Sample time: 1 seconds

Parameterization:
Polynomial orders: nb=1 (m),nf=2 (n),k=3 (d)
Number of free coefficients: 3

A good model yields good predictions on fresh data set. Snapshot of predictions of OE model on
the fresh data is shown below:

Figure 6: Cross-validation

Based on the results of the model assessment tests, the OE(1,2,3) in the transfer function form
is written as:

0.01262(+/ − 0.0007002)q −3
y[k] = u[k] + e[k]
1 − 1.802(+/ − 0.01158)q −1 + 0.8085(+/ − 0.01133)q −2

You might also like