Sei sulla pagina 1di 27

ChE 475

PROCESS DYNAMICS AND CONTROL

TERM PROJECT

by

Ege ERKMEN
Ufuk İBİŞ

Course Instructor : Mehmet C. ÇAMURDAN, Prof.


Teaching Assistant : Aybüke LEBA
Date of Submission : 30.12.2015

Department of Chemical Engineering


Boğaziçi University
Bebek, Istanbul
ii
ABSTRACT

The objective of this project is the control of a third order process by finding P-only, PI, and PID
controller parameters with Internal Model Control and Ziegler Nichols methods. For the third order
process, time constants and process gain are respectively set the value of τ p1=4, τp2=6,

τp3=12, and Kc=3. Then, the PID controller tuning variables, which are time constants, τI and

τD, and controller gain, Kc, are obtained as τI=29.01, τD=2.44 and Kc=1.344 with the help of
first order plus dead time system and the graphs from first part. Euler’s method in MATLAB
helps to obtain the servo response to a step change in the set point under PID controller. After
IMC approach, the P-only, PI, and PID controllers’ settings are determined by Ziegler-Nichols
method. In that manner, Routh-Hurwitz stability criterion help to obtain Z-N general parameters
for the P-only, PI, and PID controllers. By using MATLAB, controlled variable (y) versus time
and manipulated variable (u) versus time graphs are plotted for each controller. From the
response graphs for each process, it was observed that P-only controller gives an offset, but PI
and PID controlled systems reach the final value without any offset. When we compare PI and
PID controlled systems, PI controlled system is more aggressive and its response is slower.
Actually derivative action makes system more stable and fastens the response.
iii
TABLE OF CONTENTS

ABSTRACT'.................................................................................................................... ................................. 'ii'


TABLE'OF'CONTENTS'................................................................................................................................... 'iii'
LIST'OF'TABLES'.................................................................................... ........................................................ 'iv'
LIST'OF'FIGURES'............................................................................................................. .............................. 'v'
1.'INTRODUCTION'........................................................................................................................................ '1'
2.'RESULTS'AND'DISCUSSION'................................................................................................... .................... '2'
3.'CONCLUSION'............................................................................................................... ............................. '4'
APPENDIX'A:'THIRD'ORDER'PROCESS:'INTERNAL'MODEL'CONTROL'METHOD'........................................... '5'
A.1.'Source'Code:'Third'Order'Process:'IMC'Approach'........................................................................... '7'
A.2.'Output'of'A.1'.................................................................................................................................... '8'
A.3.'Source'Code:'Third'Order'Process:'IMC'Approach'for'PID'Controller'.............................................. '9'
A.4.'Output'for'A.3'................................................................................................................................. '10'
APPENDIX'B:'THIRD'ORDER'PROCESS:'ZIEGLER'Q'NICHOLS'METHOD'......................................................... '12'
B.1'Source'Code:'Third'Order'Process:'ZQN'Method'for'PID'Controller'................................................. '13'
B.2'Output'of'B.1'.................................................................................................................................... '15'
B.3'Source'Code:'Third'Order'Process:'ZQN'Method'for'PI'Controller'................................................... '16'
B.4'Output'of'B.3'.................................................................................................................................... '17'
B.5'Source'Code:'Third'Order'Process:'ZQN'Method'for'PQonly'Controller'............................................ '18'
B.6'Output'of'B.5'.................................................................................................................................... '19'
B.7'Source'Code:'Third'Order'Process:'ZQN'Method'for'PQonly'Controller'with'Experimental'Kc'Value'21'
B.8'Output'of'B.7'.................................................................................................................................... '22'
iv
LIST OF TABLES

Table 1 The tuning parameters by Z-N method. ............................................................................. 2'


Table 2 The experimental tuning paramaters by Z-N method ........................................................ 3'
Table 3 Z-N method tuning settings .............................................................................................. 13'
Table 4 Z-N tuning parameters with experimental values ............................................................ 22'
v
LIST OF FIGURES
Figure A Internal Model Control(IMC)
Figure A.1. IMC approach - the block diagram of a system with IMC .......................................... 5'
Figure A. 2 Parameters from process reaction curve ..................................................................... 8'
Figure A. 3 IMC approach - Servo response of y(t) with a PID controller to a step change. ...... 11'
Figure A. 4 IMC approach - Servo response of u(t) with a PID controller to a step change. ..... 11'
Figure B Ziegler-Nichols(Z-N) Method
Figure B. 1 Z-N - Servo response of y(t) with PID controller to a step change. .......................... 15'
Figure B. 2 Z-N - Servo response of u(t) with PID controller to a step change. .......................... 15'
Figure B. 3 Z-N - Servo response of y(t) with PI controller to a step change.. ............................ 17'
Figure B. 4 Z-N - Servo response of u(t) with PI controller to a step change. ............................. 17'
Figure B. 5 Z-N - Servo response of y(t) with P-only controller to a step change ....................... 19'
Figure B. 6 Z-N - Servo response of u(t) with P-only controller to a step change ....................... 20'
Figure B. 7 Z-N – The experimental P-only controller ................................................................. 22'

'
'
1.!INTRODUCTION

The control theory is an important branch of engineering with disciplines of applied


mathematics. The fundamental idea of control theory is to change dynamical behavior of
a system by a device called the controller. The controller design is done by building a
mathematical model, which can be created on a computer.

This project aims to show dynamical behavior of a third order process and calculate the
controllers’ tuning settings by using Internal Model Control(IMC) and Ziegler-Nichols(Z-N)
method. In IMC model, first order system dead time is used to get model approximations of
our system. With the response curve from the part one (iv), D, τp, and Kc values are obtained
and then these values are used to calculate PID settings. Then, the response curves of PID
controller with respect manipulated and controlled variables are plotted by MATLAB.

Third order system in s-domain is,


$%

!" = ('%(" + 1)('%," + 1)('%-" + 1)

The first order system plus dead time in s-domain is,


! " = $./01 '%" + 1
After IMC method, the third order system is analyzed by Z-N method for stability and ultimate
values, which are ultimate gain Kc,ultimate and period Pu to get setting values of P-only, PI and,
PID controllers. In Z-N method, Routh-Hurwitz stability criterion, which is an analytical
technique for determining whether any roots of a polynomial have positive real parts, is used to
determine whether our closed loop system is stable. Then, the response curves for each
controller with respect manipulated and controlled variables are plotted by MATLAB.

The report contains results and discussion part that the final values are given and conclusion
part. The graphs and MATLAB sources are given in the appendices.
2
2.!RESULTS AND DISCUSSION

The time constants and process gain of the third order system are set of τp1=4, τp2=6, τp3=12,
and Kc=3, respectively. The chosen transfer function is
3 ! " = (4" +
1)(6" + 1)(12" + 1)
As results of IMC method, the setting values of PID controller shown as below is obtained.
! τI=29.01,
! τD=2.44,
! Kc=1.344.

The servo responses of manipulated and controlled variables for PID controller are plotted by
MATLAB in the appendix A. The graphs show that the system is totally stabilized after a
little oscillation as expected for a PID controller and it can be said that the system’s response
is fast enough.
On the other hand, the Z-N method is used to tune P-only, PI, and PID controllers. As
mentioned before, the ultimate values are found by Routh-Hurwitz criterion. The ultimate values
are calculated as,
! Kc,ultimate=3.33
! wu=0.26 s-1

! Pu=23.8 s

The ultimate parameters are used to find setting variables of P-only, PI, and PID controllers as
shown in the Table 1.

Controller Kc τI τD
P-only 1.66 - -
PI 1.50 19.8 -
PID 2.0 11.9 2.98
Table 1 The tuning parameters by Z-N method.

The servo responses of manipulated and controlled variables for P-only, PI, and PID controllers are
plotted by MATLAB in appendix. For all controller types, the controlled system is converged at a
point around -0.5 in the manipulated variable (u) graphs but the oscillations and response
3
speeds are different. When we compare all controller types, it can be understood that the best
response is obtain from PID controller because of the combination of integral and derivative
actions. For P-only controller, the system is stabilized after a few oscillations, whereas PI
controlled system has more oscillation due to integral effect. However, when the controlled
variable (y) graphs of PI and PID go to the final value at point around 1, P-only causes an
offset and it goes to the point around 1.25.

For Z-N method, an experiment calculation is performed as well. This time Kc value is
determined at which the oscillations are constant as time passes for P-only controller by trial
and error and then Pu is obtained from the Z-N graph as the wavelength of oscillations. The
experimental Z-N settings are shown in Table 2.
! Kc=2.59 by trial and error
! Pu=14.8 by reading from the graph

Controller Kc τI τD
P-only 1.30 - -
PI 1.16 12.3 -
PID 1.55 7.4 1.85
Table 2 The experimental tuning paramaters by Z-N method

If we compare two methods, Z-N and IMC for PID controller, the responses of Z-N are little
bit more oscillatory and aggressive than IMC PID controller.
4
3.!CONCLUSION

In this project, the dynamic behavior of a third order system for a step change was analyzed
through Internal Model Control and Ziegler-Nichols methods. The analysis lets us to compare
which controller type among P-only, PI, and PID gives best tuning results like response speed
and which method gives more accurate results.

The Z-N analysis of a third order process for a step change with P-only, PI, and, PID
controllers shows the best tuning responses are taken from the PID controller. While there was
no offset in PI and PID controlled systems, P-only controlled system has an offset. PI controller
made a lot of oscillations in compare to PID controller due to derivative action that makes the
system more stable.

On the other hand, The IMC analysis of a third order process with a dead time for PID controller
gives us an opportunity to compare IMC and Z-N method. As a result, Z-N method could not
reach the level of stability, oscillation, and response speed of IMC approach. The results show
that Z-N method PID controller gives more oscillations and aggressive diagrams and they proved
that IMC is more up-to-date when compared to Z-N method. New technological improvements
in modern control theory give us new chances to control systems more accurately and helps the
understanding of dynamic systems.
5
APPENDIX A: THIRD ORDER PROCESS: INTERNAL MODEL CONTROL METHOD

In this part, the PID settings are going to be obtained by IMC method. Here is the general form
of third order process transfer function,
$%

!" = ('%(" + 1)('%," + 1)('%-" + 1)

The chosen values are,


τp1=4, τp2=6, τp3=12 and Kp = 3.
3 ! " = (4" +
1)(6" + 1)(12" + 1)
IMC Approach
In this section, before going into the calculations and graphs, the steps that we follow in
IMC approach are shown. The IMC block diagram is presented as follows,

Figure A.1. IMC approach - the block diagram of a system with IMC

In the block diagram, G(s), Gm(s), and Gc*(s) respectively refer to the real model and
mathematical model. The following closed-loop relation for IMC can be derived from Figure
A.1.

!.∗! 1 − !.∗!8

6= 1 + !.∗!8
61% +9
1 + !.∗(! − !8)
;
The IMC controller is designed in two steps:
! Step 1
The process model is factored as
!8 = !8<!80 where Gm+ contains any time delays and right half plane zeros. The rest of Gm refers to Gm-.
! Step 2
6
The IMC controller specified as
∗ 1

!. = !8
0 =

where f is a low-pass filter with steady state gain of one. It typically has the form, 1

= =9 λs + 1 n

Parameter n is a positive integer.


After getting Gc* value, by using this expression below we can find our controller settings,
!∗ !. =9 .∗
1 − !. !8

Thus, any IMC controller Gc* is equivalent to a standard feedback controller Gc.[1]
The third order process transfer function,
$%

!8 " =
('%(" + 1)('%," + 1)('%-" + 1)

A first order plus dead time model approximation for the third order process function $ /0AB1

!8 " =9
'8 " + 1
8

With pade approximation for the time delay,


$8(1 − ;8" 2)

!8 " =9
('8" + 1)(1 + ;8" 2)

After this point, the IMC approach steps are used.


$8

!80 =9
('8" + 1)(1 + ;8" 2)

∗ 1

!. = !80 =

∗ ('8" + 1)(1 + ;8 " 2)


1

!. = $8 9 λs + 1 n

For n=1 and then the equivalent conventional feedback controller is,
!. " =9 ('8" + 1)(1 + ;8" 2) $8 λ + ;C 2 "
For PID controller transfer function,
1

!. " = $.(1 + + 'A")


D9
two equation,

So the settings variable can be derived from these '"

9τG

1 2× DG
+1

KF = KG × λ

2× G +1

D
7
τK = D2G + τG
and,
τG

τL =
G

2× τ G +1

D
A.1. Source Code: Third Order Process: IMC Approach

clc
clear all
k=3;
tau_1=4;
T=0.4;
tau_2=6;
tau_3=12;
t=0:T:150
;
dim=length(t);
x1=zeros(1,dim);
x2=zeros(1,dim);
x3=zeros(1,dim)
; for i=1:dim-1
x1(i+1)=(x2(i)*T)+x1(i);
x2(i+1)=(x3(i)*T)+x2(i); x3(i+1)=(T/(tau_1*tau_2*tau_3))*((k-
((tau_1+tau_2+tau_3)*x2(i)))-
(((tau_1*tau_3)+(tau_1*tau_2)+(tau_2*tau_3))*x3(i))-
x1(i))+x3(i); G=x1;
end
plot (t,G)

title('Step response
graph') xlabel('Time')
ylabel('Step response')
xlim ([0 100])
8
A.2. Output of A.1

Figure A. 2 Parameters from process reaction curve

From the Figure A.2, Inflection point (14.8, 1.073) is determined. In order to find the slope of
the line, the another point is chosen from the top point of the line which is at (31.7, 3).
3 − 1.073 Slope9of9line = 31.7 − 14.8 = 0.114

The general line equation is needed to get the equation of the line in the Figure A.2. Here is the
general line equation,
X = CY + Z
Putting the slope and point information into the equation above,
y = 0.114x + c 1.073 = 0.114×14.8 + c
c = −0.6142
y = 0.114x − 0.6142

After finding the equation of the line, the intersection of the line with the x-axis is calculated,
0 = 0.114DG − 0.6142
DG = 5.388
9
τI can be read from the Figure A.2 as 31.7.
τG = 31.7 − 5.388 = 26.312
KG = K_ = 3

According to lecture notes (Çamurdan, M.C. 2015) λ should be selected for the process model by
satisfying both criteria λ> 0.8Dm and λ> (τm/10).
λ > 0.8DG9
λ > 0.8×5.388 = 4.319
λ > τ10G9
λ > 26.312 = 2.639 10
λ can be taken as 4.5.

9τG 26.312
1 +1 1 +1
F 2× DG 2× 5.388

K = KG
× λ
= 3
× 4.5
= 1.3449
2× +1 2× +1
G

D 5.388

99 DG 5.388

τK = 2 + τG = 2 + 26.312 = 29.01

τG 26.312
τL = = = 2.44
τG 26.312

2× DG + 1 2× 5.388 + 1

For PID controller:


!. " = $.× 'A'D", + 'D" + 1 = 3× 2.44×29.01", + 29.01" + 1 'D" 29.01"
= 3× 70.78", + 29.01" + 1 29.01"

A.3. Source Code: Third Order Process: IMC Approach for PID Controller

clear all;
10
clc
hold on;

Kp=3;
Kc=1.344;
tau_1=4;
tau_2=6;
tau_3=12;
T=tau_1/10;
t=0:T:250;
dim=length(t);
TI=29.01;
TD=2.44;
x1=zeros(1,dim)
;
x2=zeros(1,dim)
;
x3=zeros(1,dim)
;
t=zeros(1,dim);
e=zeros(1,dim);
u=zeros(1,dim);
esum=zeros(1,dim);
de=zeros(1,dim);

for i=1:dim-1;
x1(i+1)=(x2(i)*T)+x1(i)
;
x2(i+1)=(x3(i)*T)+x2(i)
;
x3(i+1)=(T/(tau_1*tau_2*tau_3))*((Kp-((tau_1+tau_2+tau_3)*x2(i)))-
(((tau_1*tau_3)+(tau_ 1*tau_2)+(tau_2*tau_3))*x3(i))-
x1(i)+Kp*u(i))+x3(i); e(i+1)=1-x1(i+1);
esum(i+1)=esum(i)+e(i+1)*T;
de(i+1)=(e(i+1)-e(i))/T;
u(i+1)=Kc*(e(i+1)+esum(i+1)/TI+de(i+1)*TD)
; t(i+1)=t(i)+T;
end

plot(t,x1);
legend('controlled variable
y'); xlabel('Time')
xlim([0 200])
figure;
plot(t,u);
legend('manipulated variable
u'); xlabel('Time')
xlim([0 150])

A.4. Output for A.3


11

Figure A. 3 IMC approach - Servo response of y(t) with a PID controller to a step change.
.

Figure A. 4 IMC approach - Servo response of u(t) with a PID controller to a step change.
12

APPENDIX B: THIRD ORDER PROCESS: ZIEGLER - NICHOLS METHOD


Ziegler-Nichols Method
This sections shows how to use Z-N method to find controller parameters of a third order
process for P-only, PI, and PID controllers.
A third order process,
6(") $%

! " =b(") = ('(" + 1)('," + 1)('-" + 1)

Characteristic equation must be found,


1 + !%!. = 0

$%$.

1+ =0
('(" + 1)('," + 1)('-" + 1)

3$.

(4" + 1)(6" + 1)(12" + 1)


1+ =0
4" + 1 6" + 1 12" + 1 + 3$. = 0
288"- + 144", + 22" + 1 + 3$. =0

By using Routh-Hurwitz stability criterion the stability of the system can be checked and
Kc,ultimate can be calculated.
Routh-Hurwitz Array for the equation

S3 288 22
S2 144 1+3Kc
S1 (2880-864Kc)/144 0

S0 1+3Kc

From the S0 row,


1 + 3$c > 0
$. > −0.3339"deZ/9Zfeegh9i/9e/jfhdk/9$. > 0

From the S1 row,


2880 − 864$. > 0
144
13
$. < 3.33
$.,nopq8rps = 3.33

From the S2 row we can calculate the imaginary roots by using Kc,max value,
144", + 10.0 = 0 "(,, = ±0.26u
v8rw = 0.269"0(
Period of oscillations, 2y 2y
x8rw = v8rw = 0.26 = 23.89"

After this point all tuning settings of the controllers can be obtained by using Z-N
general parameters table below.
Ziegler-Nichols General Parameters

Controller Kc τI τD
P-only 0.5 Kc,max - -

PI 0.45 Kc,max Pmax/1.2 -


PID 0.6 Kc,max Pmax/2 Pmax/8

Ziegler-Nichols General Parameters

Controller Kc τI τD
P-only 1.66 - -
PI 1.50 19.8 -
PID 2.0 11.9 2.98
Table 3 Z-N method tuning settings

B.1 Source Code: Third Order Process: Z-N Method for PID Controller

clear
all; clc
hold on;

Kp=3;
Kc=2.0;

tau_1=4;
tau_2=6;
tau_3=12
;
T=tau_1/10;

t=0:T:250;
dim=length(t);
14
TI=11.9;
TD=2.98;
x1=zeros(1,dim);
x2=zeros(1,dim);
x3=zeros(1,dim);
e=zeros(1,dim);
u=zeros(1,dim);
esum=zeros(1,dim);
de=zeros(1,dim);

for i=1:dim-1;
x1(i+1)=(x2(i)*T)+x1(i)
;
x2(i+1)=(x3(i)*T)+x2(i)
;
x3(i+1)=(T/(tau_1*tau_2*tau_3))*((Kp-((tau_1+tau_2+tau_3)*x2(i)))-
(((tau_1*tau_3)+(tau_ 1*tau_2)+(tau_2*tau_3))*x3(i))-
x1(i)+Kp*u(i))+x3(i); e(i+1)=1-x1(i+1);
esum(i+1)=esum(i)+e(i+1)*T
; de(i+1)=(e(i+1)-e(i))/T;
u(i+1)=Kc*(e(i+1)+esum(i+1)/TI+de(i+1)*TD);

end

plot(t,x1);
legend('controlled variable
y'); xlabel('Time')
xlim([0 200])
figure;
plot(t,u);
legend('manipulated variable
u'); xlabel('Time')
xlim([0 150])
15

B.2 Output of B.1

Figure B. 1 Z-N - Servo response of y(t) with PID controller to a step change.

Figure B. 2 Z-N - Servo response of u(t) with PID controller to a step change.
16

B.3 Source Code: Third Order Process: Z-N Method for PI Controller
clear
all; clc
hold on;

Kp=3;
Kc=1.5;

tau_1=4;
tau_2=6;
tau_3=12
;
T=tau_1/10;

t=0:T:250;
dim=length(t);
TI=19.8;

x1=zeros(1,dim);
x2=zeros(1,dim);
x3=zeros(1,dim);
e=zeros(1,dim);
u=zeros(1,dim);
esum=zeros(1,dim);

for i=1:dim-1;
x1(i+1)=(x2(i)*T)+x1(i)
;
x2(i+1)=(x3(i)*T)+x2(i)
;
x3(i+1)=(T/(tau_1*tau_2*tau_3))*((Kp-((tau_1+tau_2+tau_3)*x2(i)))-
(((tau_1*tau_3)+(tau_ 1*tau_2)+(tau_2*tau_3))*x3(i))-
x1(i)+Kp*u(i))+x3(i); e(i+1)=1-x1(i+1);
esum(i+1)=esum(i)+e(i+1)*T;
u(i+1)=Kc*(e(i+1)+esum(i+1)/TI);

end

plot(t,x1);
legend('controlled variable
y'); xlabel('Time')
xlim([0 200])
figure;
plot(t,u);
legend('manipulated variable
u'); xlabel('Time')
xlim([0 150])
17

B.4 Output of B.3

Figure B. 3 Z-N - Servo response of y(t) with PI controller to a step change..

Figure B. 4 Z-N - Servo response of u(t) with PI controller to a step change.


18

B.5 Source Code: Third Order Process: Z-N Method for P-only Controller

clear
all; clc
hold on;

Kp=3;
Kc=1.66;

tau_1=4;
tau_2=6;
tau_3=12
;
T=tau_1/10;

t=0:T:250;
dim=length(t);

x1=zeros(1,dim);
x2=zeros(1,dim);
x3=zeros(1,dim);
e=zeros(1,dim);
u=zeros(1,dim);
esum=zeros(1,dim);

for i=1:dim-1;
x1(i+1)=(x2(i)*T)+x1(i)
;
x2(i+1)=(x3(i)*T)+x2(i)
;
x3(i+1)=(T/(tau_1*tau_2*tau_3))*((Kp-((tau_1+tau_2+tau_3)*x2(i)))-
(((tau_1*tau_3)+(tau_ 1*tau_2)+(tau_2*tau_3))*x3(i))-
x1(i)+Kp*u(i))+x3(i); e(i+1)=1-x1(i+1);
u(i+1)=Kc*e(i+1);

end

plot(t,x1);
legend('controlled variable
y'); xlabel('Time')
figure;
plot(t,u);
legend('manipulated variable
u'); xlabel('Time')
19

B.6 Output of B.5

Figure B. 5 Z-N - Servo response of y(t) with P-only controller to a step change
20

Figure B. 6 Z-N - Servo response of u(t) with P-only controller to a step change
21
B.7 Source Code: Third Order Process: Z-N Method for P-only Controller with
Experimental Kc Value
clear
all; clc
Kp=3;
Kc=2.59;

tau_1=4;
tau_2=6;
tau_3=12
;
T=tau_1/10;

t=0:T:250;
dim=length(t);

x1=zeros(1,dim);
x2=zeros(1,dim);
x3=zeros(1,dim);
e=zeros(1,dim);
u=zeros(1,dim);
esum=zeros(1,dim);

for i=1:dim-1;
x1(i+1)=(x2(i)*T)+x1(i)
;
x2(i+1)=(x3(i)*T)+x2(i)
;
x3(i+1)=(T/(tau_1*tau_2*tau_3))*((Kp-((tau_1+tau_2+tau_3)*x2(i)))-
(((tau_1*tau_3)+(tau_ 1*tau_2)+(tau_2*tau_3))*x3(i))-
x1(i)+Kp*u(i))+x3(i); e(i+1)=1-x1(i+1);
u(i+1)=Kc*e(i+1);

end

plot(t,x1);
legend('controlled variable
y'); xlabel('Time')
22
B.8 Output of B.7

Figure B. 7 Z-N – The experimental P-only controller


Experimental Kc value is obtained by
MATLAB. Kc= 2.59 trial and error
Pu = 14.8 read from graph
Z-N general parameters table is created with the experimental shown in the Table 4.

Controller Kc τI τD
P-only 1.30 - -
PI 1.16 12.3 -
PID 1.55 7.4 1.85
Table 4 Z-N tuning parameters with experimental values

Potrebbero piacerti anche