Вы находитесь на странице: 1из 34

ABSTRACT

This project aims to control a third order process with P-only, PI and PID by using the
internal model control and Ziegler-Nichols method. It also has an object of tuning a third
order process via Ziegler-Nichols method and integral model control approach. The process
time constants and process gain are set the values of τp1=2, τp2=3, τp3=7 and Kp=5,
respectively; and then the PID settings, which are the control gain, integral time constant and
derivative time constant, are calculated as Kc=2, τI=18.357, τD=0.34 by using the method
which is derived by Rivera et. al. In calculations, Matlab is used to manipulate the response of
controlled variable and the response of manipulated variable with respect to time for different
control settings. Calculations of third process are done for both IMC and Z-N methods, and
then calculation of first order process plus dead time is done by Z-N. As a result, it is
observed that when p-only controller is used to control the system, it leads to offset; whereas
the systems controlled by PI or PID settings reach the final value without any offset.
However, PI controller results in oscillation in the response and the speed of the response gets
slower. Then, if derivative action is added to PI, it increases the stability in order to reach the
sustained oscillation and the response of the system fastens. The responses of the first order
process with dead time are more robust compared to that of third order process.

ii
TABLE OF CONTENT

ABSTRACT............................................................................................................................... ii  
TABLE OF CONTENT ............................................................................................................ iii  
LIST OF FIGURE .................................................................................................................... iv  
LIST OF TABLE ........................................................................................................................v  
1. INTRODUCTION ..................................................................................................................1  
2. RESULTS AND DISCUSSION .............................................................................................2  
3. CONCLUSION .......................................................................................................................4  
APPENDIX. A. INTERNAL MODEL CONTROL METHOD- THIRD ORDER PROCESS .5  
APPENDIX B: THIRD ORDER PROCESS – ZIEGLER-NICHOLS METHOD ................13  
APPENDIX C: FIRST ORDER PROCESS WITH TIME DELAY ........................................23  

iii
LIST OF FIGURE
 
Figure A.1. Finding parameters with process reaction curve method 6  
Figure A.2. IMC approach – Servo response of y(t) with a P-only controller to a step change 8  
Figure A.3. IMC approach – Servo response of u(t) with a P-only controller to a step change 9  
Figure A.4. IMC approach – Servo response of y(t) with a PI controller to a step change 10  
Figure A.5. IMC approach – Servo response of u(t) with a PI controller to a step change 11  
Figure A.6. IMC approach – Servo response of y(t) with a PID controller to a step change 12  
Figure A.7. IMC approach – Servo response of u(t) with a PID controller to a step change 13  
Figure B.1. Z-N – Servo response of y(t) with a P-only controller to a step change 16  
Figure B.2. Z-N – Servo response of u(t) with a P-only controller to a step change 16  
Figure B.3. Z-N – Servo response of y(t) with a PI controller to a step change 18  
Figure B.4. Z-N – Servo response of u(t) with a PI controller to a step change 18  
Figure B.5. Z-N – Servo response of y(t) with a PID controller to a step change 20  
Figure B.6. Z-N – Servo response of u(t) with a PID controller to a step change 20  
Figure B.7. Z-N – Servo response of y(t) with a P-only controller to a step change 22  
Figure B.8. Z-N – Servo response of u(t) with a P-only controller to a step change 22  
Figure C.1. Z-N– y(t) of a first order process with time delay with a P-only controller 25  
Figure C.2. Z-N– u(t) of a first order process with time delay with a P-only controller 26  
Figure C.3. Z-N – y(t) of a first order process with time delay with a PI controller 27  
Figure C.4. Z-N – u(t) of a first order process with time delay with a PI controller 28  
Figure C.5. Z-N – y(t) of a first order process with time delay with a PID controller 29  
Figure C.6. Z-N – u(t) of a first order process with time delay with a PID controller 30  

iv
LIST OF TABLE

Table 2.1. Results of Z-N closed loop oscillation method tuning parameters for third order
system .........................................................................................................................................3
Table 2.2. Results of Z-N closed loop oscillation method tuning parameters for first order
system with time delay…………………………………………………………………………3
Table B.1. Z-N closed loop oscillation method tuning parameters ..........................................14
Table B.2. Results of Z-N closed loop oscillation method tuning parameters.........................15
Table C.1. Results of Z-N closed loop oscillation method tuning parameters ........................24

v
1. INTRODUCTION

Control theory is the common interest of both mathematics and engineering areas. It deals
with the behavior of a dynamic system. Dynamic systems give response to any disturbance
which leads to the system out of steady-state condition. When a set point is determined for the
system, the controller manipulates the inputs to obtain the desired effect on the output of the
system. The controllers can be classified into two categories. The open-loop systems refer to
the systems in which the output of a system is not used as a variable to control the system.
The output is not fed back to modify the control output. However in closed-loop systems, the
system is controlled by a feedback. The feedback is compared with the input and any error is
added or subtracted from the input to get the required output.

In real systems, there is always a mismatch between the real process function and the modeled
process function due to system characteristics and the unknown disturbances. The IMC
method has the potential to achieve perfect control of the systems. It has many advantages: it
provides a transparent framework for control system design and tuning and compensates for
disturbances and model uncertainty.

The Ziegler-Nichols Closed Loop method is one of the common methods used to tune control
loops. The closed loop method determines the gain at which a loop with proportional only
control will oscillate, and then derives the controller gain, reset, and derivative values from
the gain at which the oscillations are sustained and the period of oscillation at that gain. It is
not a necessary method for perfect tuning.

The aim of this project is to see the responses of a third order system and first order system
with time delay to a step change by approaching the system with different methods. In the
project, the Ziegler- Nichols tuning and IMC approach are used for the third order system and
for the first order system with time delay, only Ziegler- Nichols approach is used.

The report contains results and discussion parts in which the final values are given and the
conclusion part. In appendixes, the graphs and MATLAB codes are given.

1
2. RESULTS AND DISCUSSION

This project aims at controlling a third order process and a first order process with dead time
with P-only, PI and PID controllers. The analysis is made for the third order process by using
both Internal Model approach and Ziegler - Nichols Method. For the first order system, only
Ziegler-Nichols method is used to find the controller settings.

In the first part of the project, IMC method is used to calculate the settings of P-only, PI and

PID. The time constant of the third order process are 𝜏" = 2, 𝜏& = 3  and 𝜏) = 7. The gain of
the process is 5. The λ value was chosen. So, the results for 𝜏, , 𝜏-   and 𝐾/ are the followings:

𝜏, = 18.357

𝜏- = 0.34

𝐾5 = 2

The servo responses of manipulated variable u(t) and the controlled variable y(t) are
calculated by using MATLAB code by using these settings. For P-only controller, the many
oscillations are seen in the graph. Their magnitudes increase continuously with time. For PI
controller, the oscillations do not occur immediately but as time passes, the system response
the disturbance. For PID controller, the response of the system is the fastest one among other
controller responses.

In the second part, the Ziegler- Nichols method is used to tune the controllers. The ultimate
values of Ku , wu and Pu are found using Routh- Herwitz criterion. The calculated ultimate
values are the followings:

𝐾6 = 2.14

𝑤6 = 0.534

𝑃6 = 11.77

The parameters calculated for each type of controller are as follows:

2
Table 2.1. Results of ZN closed loop oscillation method tuning parameters for third order system

Controller type kc τı τD

P-only 1.07

PI 0.963 9.81

PID 1.284 5.885 1.47

The graphs for the calculated Ziegler-Nichols Setting are shown in the graphs for P-only, PI
and PID controllers. For P-only controller, after, several oscillations, the system is converged
to a point around 0.2. In PI controller, due to the integral effect, the number of oscillations
increase and converged value is around 0.2 again. For PID controller, derivative effect
eliminates the oscillations and makes the system more stable. The final value is 1.For the first
order system with time delay, the ultimate values are calculated. These are:

𝐾6 = 13/𝐾/

𝑤6 = 2.158

𝑃6 = 2.9

The controller parameters for P-only, PI and PID controllers are:

Table 2.2. Results of ZN closed loop oscillation method tuning parameters for first order system with time delay

Controller type kc τı τD

P-only 5.5/Kp

PI 4.95/Kp 2.42

PID 6.6/Kp 1.45 0.3625

For each controller, Kp values are equal to 5. For P-only controller , the system becomes
stable around point 9.4. For PI controller, the system converges to 1. For PID controller, the
final value is 1.4. In all controllers, no oscillations are observed. So, the ultimate values
cannot be determined.

3
3. CONCLUSION

The aim of this project is to control a third order process with P-only, PI and PID by using the
internal model control and Ziegler-Nichols method. The models are used for tuning a third
order process plus time delay via Ziegler-Nichols method. The process time constants and
process gain are set the values of τp1=2, τp2=3, τp3=7 and Kp=5, respectively; and then the
PID settings, which are the control gain, integral time constant and derivative time constant,
are calculated as Kc=2, τI=18.357, τD=0.34 by using the method which is derived by Rivera
et. al. In calculations, Matlab is used to manipulate the response of controlled variable and the
response of manipulated variable with respect to time for different control settings.
Calculations of third process are done for both IMC and Z-N methods, and then calculation of
first order process plus dead time is done by Z-N.

It is observed that when p-only controller leads to an offset; whereas the systems controlled
by PI or PID settings reach the final value without any offset. However, when we compared
the responses of PI and PID controller, the latter gives quicker response to a step change. Both
controllers lead to oscillations. Derivative controller increases the stability of the system due
to the derivative action. It increases the stability of the system. As a result, for both IMC and
the Ziegler-Nichols method, PID controller gives the most accurate results. If we compare two
methods, the responses of Ziegler – Nichols method are more oscillatory and more sensitive
than the ones of IMC controller.

The responses of the first order process with dead time, no oscillations are observed in the
controller. The robustness of the controllers is high. For PI controller, there is a kick when we
put a step change in the system. After this, without oscillations the system becomes stable.
For PID controller the system becomes stable with the decreasing slope. If the first order
system with time delay and the third order system are compared, the first order system has a
greater degree of robustness compared to the third order system.

4
APPENDIX. A. INTERNAL MODEL CONTROL METHOD- THIRD ORDER
PROCESS

In the problem, there is a third order process which is generally in the form:
Kp
g p (s) =
(τp1s + 1)(τp 2 s + 1)(τp 3s + 1)
The time constants of the process and steady state process gain are set to the points that:
τp1=2, τp2=3, τp3=7 and Kp =5
5
g p (s) =
(2s + 1)(3s + 1)(7s + 1)

A.1. Matlab Code

A=10;
t(1)=0; x(1)=0; y(1)=0; z(1)=0;
tp1=2; tp2=3; tp3=7; Kp=5;
h=tp3/A;
N=100;
for i=1:N
y(i+1)=y(i)+h*x(i);
x(i+1)=x(i)+h*z(i);
B=tp1*tp2+tp1*tp3+tp2*tp3;
C=tp1+tp2+tp3;
D=tp1*tp2*tp3;
z(i+1)=z(i)+h*(-B*z(i)-C*x(i)-y(i)+Kp*A)/D;
t(i+1)=t(i)+h;
end;
plot(t,y)

5
A.1. Results

tp1=2 tp2=3 tp3=7 kp=5


50

40

30 X: 9.8
Y: 24.61

20

10

0
0 10 20 30 40 50 60 70 80

Figure A.1. Finding parameters with process reaction curve method

From the graph, the inflection point is read at (9.8, 24.61) and using these values in the
general line equation y = mx + c where the m is the slope and it equals to 2.70.

24.61 = 2.70 * 9.8 + c => c = -1.85


Finding Dm: 0 = 2.70 * x -1.85 => x = Dm = 0.685

τ1 is found from the graph which is 18.7.


So τm= 18.7-0.685=18.015
Km = Kp = 5

In order to calculate Kc, τI and τD, a last parameter λ is needed. Based on recommendation of
Rivera et al., λ should be selected for the process model so that both λ> 0.8Dm and λ>(τm/10)
are satisfied. Therefore a λ value of 1.5 is chosen. Then the PID controller settings are:
18.015
2 +1
1 0.685
Kc = = 1.99 ≅ 2
5 1.5
2 +1
0.685

6
0.685
τI = + 18.015 = 18.357
2

18.015
τD = = 0.34
18.015
2 +1
0.685

⎛ τ τ s 2 + τ I s + 1 ⎞ ⎛ 6.24 s 2 + 18.357s + 1 ⎞
For PID controller: g c ( s) = K c ⎜⎜ D I ⎟⎟ = 2⎜⎜ ⎟⎟
⎝ τIs ⎠ ⎝ 18.357s ⎠
⎛ τ s + 1 ⎞ ⎛ 18.357s + 1 ⎞
For PI controller: g c ( s) = K c ⎜⎜ I ⎟⎟ = 2⎜ ⎟
⎝ τ I s ⎠ ⎝ 18.357s ⎠

For P-only controller: g c ( s) = K c = 2

A.2. For P-Only Controller


For a P-only controller with the calculated settings, the servo response to a step change in the
set point is calculated with the following MATLAB code:

A.2. Matlab Code


clear;
tp1=2; tp2=3; tp3=7; Kp=5;
Kc=2;
K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
for i=1:1000;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;
b(i+1)=1-x1(i+1);
c(i+1)=Kc*b(i+1);
a(i+1)=a(i)+delt;

7
end
plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

A.2. Results

tp1=2 tp2=3 tp3=7 kp=5 kc=2


50
controlled variable y
40

30

20

10

-10

-20

-30

-40
0 20 40 60 80 100 120 140 160 180 200

Figure A.2. IMC approach – Servo response of y(t) with a P-only controller to a step change

8
tp1=2 tp2=3 tp3=7 kp=5 kc=2
100
manipulated variable u
80

60

40

20

-20

-40

-60

-80

-100
0 20 40 60 80 100 120 140 160 180 200

Figure A.3. IMC approach – Servo response of u(t) with a P-only controller to a step change

A.3. For PI Controller


For a PI controller with the calculated settings, the servo response to a step change in the set
point is calculated with the following MATLAB code:

A.3. Matlab Code


clear all;
tp1=2; tp2=3; tp3=7; tI=18.357;
Kp=5; Kc=2;
K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
es(1)=0;
for i=1:3000;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;

9
b(i+1)=1-x1(i+1);
es(i+1)=es(i)+b(i+1)*delt;
c(i+1)=Kc*(b(i+1)+es(i+1)/tI);
a(i+1)=a(i)+delt;
end
plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

A.3. Results

10 tp1=2 tp2=3 tp3=7 kp=5 kc=2 tI=18.357


x 10
2.5
controlled variable y
2

1.5

0.5

-0.5

-1

-1.5

-2
0 100 200 300 400 500 600

Figure A.4. IMC approach – Servo response of y(t) with a PI controller to a step change

10
10 tp1=2 tp2=3 tp3=7 kp=5 kc=2 tI=18.357
x 10
4
manipulated variable u
3

-1

-2

-3

-4

-5
0 100 200 300 400 500 600

Figure A.5. IMC approach – Servo response of u(t) with a PI controller to a step change

A.4. For PID Controller


For a PID controller with the calculated settings, the servo response to a step change in the set
point is calculated with the following MATLAB code:

A.4. Matlab Code

clear all;
tp1=2; tp2=3; tp3=7;
tI=18.357; tD=0.34;
Kp=5; Kc=2; K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
es(1)=0;
de(1)=0;
for i=1:800;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;

11
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;
b(i+1)=1-x1(i+1);
es(i+1)=es(i)+b(i+1)*delt;
de(i+1)=(b(i+1)-b(i))/delt;
c(i+1)=Kc*(b(i+1)+es(i+1)/tI+de(i+1)*tD);
a(i+1)=a(i)+delt;
end

plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

A.4. Results

tp1=2 tp2=3 tp3=7 kp=5 kc=2 tI=18.357 tD=0.34


3.5
controlled variable y
3

2.5

1.5

0.5

-0.5

-1

-1.5
0 20 40 60 80 100 120 140 160

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

12
tp1=2 tp2=3 tp3=7 kp=5 kc=2 tI=18.357 tD=0.34
6
manipulated variable u

-2

-4

-6
0 20 40 60 80 100 120 140 160

Figure A.7. IMC approach – Servo response of u(t) with a PID controller to a step change

APPENDIX B: THIRD ORDER PROCESS – ZIEGLER-NICHOLS METHOD

The transfer function of a third order process is in general form as:


Y ( s) Kp
G( s) = =
U ( s) (τ 1 s + 1)(τ 2 s + 1)(τ 3 s + 1)

The characteristic equation is evaluated by using the formula:


Kp
1+GpGc= 1 + K c
(τ 1 s + 1)(τ 2 s + 1)(τ 3 s + 1)

Following set are used in the first part:


τp1=2 τp2=3 τp3=7 Kp=5

5
1 + Kc =0
(2s + 1)(3s + 1)(7s + 1)
(2s + 1)(3s + 1)(7s + 1) + 5K c = 0 which is rewritten as;

13
42 s 3 + 41s 2 + 12 s + (1 + 5K c )=0

S3 42 12
2
S 41 1+5Kc
S1 [41*12-42*(1+5Kc)]/41 0
S0 1+5Kc

For the first stability criteria 1+ 5Kc > 0, so Kc should be greater than -0.20
41 * 12 − 42 * (1 + 5 K c )
>0
41

Rearranging and solving for Kc

41 *12 − 42
> K c gives the ultimate gain K value as; Kultimate = 2.14
42 * 5

Solving S2 row by setting K ultimate value in it gives:

41s 2 + 1 + 10.7 = 0
s = jw = ± 0.285 j

So wultimate = 0.285

Ultimate period of sustained cycling is: Pu =
wu

Pultimate = ≈ 11.77
0.21
Z-N method suggests using the following settings for feedback controllers.

Table B.1. ZN Closed loop oscillation method tuning parameters

Controller type kc τı τD
P-only 0.5 ku - -
PI 0.45 ku Pu/1.2 -
PID 0.6 ku Pu/2 Pu/8

14
Then the calculated controller parameters are;
Table B.2. Results of ZN closed loop oscillation method tuning parameters

Controller type kc τı τD
P-only 1.07 - -
PI 0.963 9.81 -
PID 1.284 5.885 1.47

Graphs for P-only, PI and PID controllers are prepared by the MATLAB code used in the
previous appendix. However, this time the values found by Ziegler-Nichols Method are used.

B.1. For P-Only Controller

B.1. Matlab Code


clear;
tp1=2; tp2=3; tp3=7; Kp=5; Kc=1.07;
K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
for i=1:1000;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;
b(i+1)=1-x1(i+1);
c(i+1)=Kc*b(i+1);
a(i+1)=a(i)+delt;
end
plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

15
B.1. Results

tp1=2 tp2=3 tp3=7 kp=5 kc=1.07


1.4
controlled variable y

1.2

0.8

0.6

0.4

0.2

0
0 20 40 60 80 100 120 140 160 180 200

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

tp1=2 tp2=3 tp3=7 kp=5 kc=1.07


1.2
manipulated variable u
1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6
0 20 40 60 80 100 120 140 160 180 200

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

16
B.2. For PI Controller

B.2. Matlab Code

clear all;
tp1=2; tp2=3; tp3=7; tI=9.81; Kp=3; Kc=0.963;
K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
es(1)=0;
for i=1:2000;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;
b(i+1)=1-x1(i+1);
es(i+1)=es(i)+b(i+1)*delt;
c(i+1)=Kc*(b(i+1)+es(i+1)/tI);
a(i+1)=a(i)+delt;
end

plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

17
B.2. Results
tp1=2 tp2=3 tp3=7 kp=5 kc=0.963 tI=9.81
1.8
controlled variable y
1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
0 50 100 150 200 250 300 350 400

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

tp1=2 tp2=3 tp3=7 kp=5 kc=0.963 tI=9.81


1.2
manipulated variable u
1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6
0 50 100 150 200 250 300 350 400

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

18
B.3. For PID Controller

B.3. Matlab Code

clear all;
tp1=2; tp2=3; tp3=7; tI=5.885; tD=1.47;
Kp=5; Kc=1.284; K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
es(1)=0;
de(1)=0;
for i=1:500;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;
b(i+1)=1-x1(i+1);
es(i+1)=es(i)+b(i+1)*delt;
de(i+1)=(b(i+1)-b(i))/delt;
c(i+1)=Kc*(b(i+1)+es(i+1)/tI+de(i+1)*tD);
a(i+1)=a(i)+delt;
end

plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

19
B.3. Results
tp1=2 tp2=3 tp3=7 kp=5 kc=1.284 tI=5.885 tD=1.47
1.6
controlled variable y
1.4

1.2

0.8

0.6

0.4

0.2

0
0 20 40 60 80 100 120

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

tp1=2 tp2=3 tp3=7 kp=5 kc=1.284 tI=5.885 tD=1.47


12
manipulated variable u

10

-2
0 20 40 60 80 100 120

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

20
B.4. Sustained Oscillation By Inspection
The values for the Z-N method are found by manipulating Kc in the P-only calculation. By
inspection, the Kc value at which steady oscillations occur is determined.

B.4. Matlab Code

clear;
tp1=2; tp2=3; tp3=7; Kp=5; Kc=1.68;
K=Kp*Kc;
delt=min([tp1,tp2,tp3])/10;
a(1)=0; b(1)=0; c(1)=0;
x1(1)=0; x2(1)=0; x3(1)=0;
for i=1:1000;
x1(i+1)=x1(i)+x2(i)*delt;
x2(i+1)=x2(i)+x3(i)*delt;
x3(i+1)=x3(i)+(1/(tp1*tp2*tp3)*(-(tp1*tp3+tp2*tp3+tp1*tp2)*x3(i)-(tp1+tp2+tp3)*x2(i)-
x1(i)+Kp*c(i)))*delt;
b(i+1)=1-x1(i+1);
c(i+1)=Kc*b(i+1);
a(i+1)=a(i)+delt;
end

plot(a,x1);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

21
B.4. Results
tp1=2 tp2=3 tp3=7 kp=5 kc=1.68
1.8
controlled variable y
1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
0 20 40 60 80 100 120 140 160 180 200

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

tp1=2 tp2=3 tp3=7 kp=5 kc=1.68


2
manipulated variable u

1.5

0.5

-0.5

-1

-1.5
0 20 40 60 80 100 120 140 160 180 200

Figure B.8. Z-N – Servo response of u(t) with a P-only controller to a step change

22
APPENDIX C: FIRST ORDER PROCESS WITH TIME DELAY

The characteristic equation of a first oreder process with time delay as:

D
K c K p (−
s + 1)
1+GpGc= 1 + 2
D
(τ p s + 1)( s + 1)
2

D −D
(τ p s + 1)( s + 1) + K c K p ( s + 1) = 0
2 2

D 2 D D
τp s + s(τ p + − K c K p ) + K c K p + 1 = 0
2 2 2

Setting D=1 and τp=6gives:

S2 3 1+Kc Kp
S1 6.5- 0.5Kc Kp 0
S0 1+Kc Kp

For the first criteria 1+Kc Kp > 0, so Kc should be greater than -1/Kp
6.5-0.5KcKp>0

Rearranging and setting the equation not greater than but equal to zero;
13
= Kc
Kp
13
gives the ultimate gain K value as; Kultimate =
Kp
Solving S2 row by setting K ultimate value in it gives:
13
3s 2 + 1 + Kp = 0
Kp

s = jw = ± 4.66 j

So wultimate = 4.66

23

Ultimate period of sustained cycling is: Pu =
wu

Pultimate = ≈ 2.9
4.66

Then the calculated controller parameters are;


Table C.1. Results of ZN closed loop oscillation method tuning parameters

Controller type kc τı τD
P-only 5.5/Kp
PI 4.95/Kp 2.42
PID 6.6/Kp 1.45 0.3625

C.1. For P-Only Controller


For a P-only controller with the calculated settings, the servo response to a step change in the
set point is calculated with the following MATLAB code:

C.1. Matlab Code

clear all;
Kp=5; tp=6; Kc=5.5/Kp;
delt=0.005;
D=1;
N=D/delt;
A=zeros(1,N);
c=1;
y(1)=0; a(1)=0; c(1)=1; b(1)=0;
for i=1:10000;
y(i+1)=y(i)+((Kp*c(i)-y(i))/tp)*delt;
a(i+1)=a(i)+delt;
A(1)=y(i);
y(i)=A(N);
for j=1:N-1;
k=N+1-j;
24
A(k)=A(k-1);
end
b(i+1)=1-y(i+1);
c(i+1)=Kc*b(i+1);
end

plot(a,y);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

C.1. Results
tp=6 kp=5 kc=1.1
0.9
controlled variable y
0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 10 20 30 40 50 60

Figure C.1. Z-N– y(t) of a first order process with time delay with a P-only controller

25
tp=6 kp=5 kc=1.1
0.9
controlled variable y
0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 10 20 30 40 50 60

Figure C.2. Z-N– u(t) of a first order process with time delay with a P-only controller

C.2. For PI Controller


For a PI controller with the calculated settings, the servo response to a step change in the set
point is calculated with the following MATLAB code:

C.2. Matlab Code

clear all;
c=1; Kp=5; tp=6;
Kc=4.95/Kp;
tI=2.42; delt=0.005;
D=1;
N=D/delt;
A=zeros(1,N);
y(1)=0; a(1)=0; b(1)=0; c(1)=1; es(1)=0;
for i=1:10000;
y(i+1)=y(i)+((Kp*c(i)-y(i))/tp)*delt;
a(i+1)=a(i)+delt;
A(1)=y(i);

26
y(i)=A(N);
for j=1:N-1;
k=N+1-j;
A(k)=A(k-1);
end
b(i+1)=1-y(i+1);
es(i+1)=es(i)+b(i+1)*delt;
c(i+1)=Kc*(b(i+1)+es(i+1)/tI);
end

plot(a,y);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

C.2. Results
tp=6 kp=5 kc=0.99 tI=2.42
1.4
controlled variable y

1.2

0.8

0.6

0.4

0.2

0
0 10 20 30 40 50 60

Figure C.3. Z-N – y(t) of a first order process with time delay with a PI controller

27
tp=6 kp=5 kc=0.99 tI=2.42
1
manipulated variable u
0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1
0 10 20 30 40 50 60

Figure C.4. Z-N – u(t) of a first order process with time delay with a PI controller

C.3. For PID Controller


For a PID controller with the calculated settings, the servo response to a step change in the set
point is calculated with the following MATLAB code:

C.3. Matlab Code

clear all;
Kp=5; tp=6; Kc=6.6/Kp;
tI=1.45; tD=0.3625; delt=0.005;
D=1; N=D/delt; A=zeros(1,N);
y(1)=0; a(1)=0; c(1)=1;
b(1)=0; es(1)=0; de(1)=0;
for i=1:1000;
y(i+1)=y(i)+((Kp*c(i)-y(i))/tp)*delt;
a(i+1)=a(i)+delt;
A(1)=y(i);
y(i)=A(N);

28
for j=1:N-1;
k=N+1-j;
A(k)=A(k-1);
end
b(i+1)=1-y(i+1);
es(i+1)=es(i)+b(i)*delt;
de(i+1)=(b(i+1)-b(i))/delt;
c(i+1)=Kc*(b(i+1)+es(i+1)/tI+de(i+1)*tD);
end

plot(a,y);
legend('controlled variable y');
figure;
plot(a,c);
legend('manipulated variable u');

C.3. Results
tp=6 kp=5 kc=1.32 tI=1.45 tD=0.3625
1.4
controlled variable y

1.2

0.8

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Figure C.5. Z-N – y(t) of a first order process with time delay with a PID controller

29
tp=6 kp=5 kc=1.32 tI=1.45 tD=0.3625
100
manipulated variable u

80

60

40

20

-20

-40
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Figure C.6. Z-N – u(t) of a first order process with time delay with a PID controller

30

Вам также может понравиться