Sie sind auf Seite 1von 19

AS-74.

230 Automation and Control Engineering laboratory course

EXERCISE 11

P-, PI- and PID- CONTROL


An introduction in English

Lasse Eriksson 2002

This English version is based on the Finnish version of the document. The original
Finnish version was written in 1976 by Markku Nihtilä and put to electrical format in
2001 by Timo Oksanen. The exercise was upgraded in 2002 with PC / Matlab
connection. This version of the document includes those new parts of the exercise.
L.E.

Helsinki University of Technology

Control Engineering laboratory


1 Introduction

Feedback control is used in practice in many control applications. The benefits of this
control method are that it is possible to keep some physical quantity at a strict level or
change the value of the quantity, e.g. pressure, temperature etc, quickly and despite of
the disturbances that might occur.

The basic requirement that a control system should be able to fulfill is stability. This
means that a controlled system should remain stable in all circumstances. The quality
of the control can be measured by analysing the accuracy, speed and robustness of a
control system.

2 Feedback control

The figure 1 shows the principal structure of feedback control. In feedback control we
want the output signal to follow the reference signal as precisely as possible. We
measure the output of the process and create an “error signal” e = r – ym. Error signal
is an input signal for the controller. The controller creates the control signal (based on
the error signal) and controls the process (actually the controller controls an actuator
which controls the process).

Reference Error Control Output


signal r + variable e signal u signal y
Controller Process
_

Measurement
signal ym
Sensor

Figure 1: Principal structure of feedback control.

3 Different controllers

If the output signal of the process grows, the measurement signal grows as well. This
means that the error signal becomes smaller and the control signal becomes smaller
too. This makes the process output signal to go down, which means that error signal
goes towards zero and the output of the process towards reference value.

2
3.1 P-controller

In P-control, the output of the controller (control signal) is directly proportional to the
error signal.

u (t ) = Ke(t ) , (1)

where K is controller’s gain. Often P-control is not enough to make the output go to
reference and there will be steady-state deviation.

3.2 PI-controller

In PI-controller, there is another term in the controller equation.

 1
t

u (t ) = K  e(t ) + ∫ e(t )dt  , (2)
 TI 0 

where TI is integration time constant. If the controller is tuned to be slow and TI is


large, then the controller first acts like P-controller, but later the as the integration
starts to affect, the steady-state deviation goes slowly to zero. In PI-control, the
steady-state deviation will finally go to zero. If the controller is tuned to be fast and TI
is small, then both terms (P and I) affect the control signal all the way from the
beginning. The system becomes faster, but the output signal might oscillate.

3.3 PID-control

The equation of PID-controller has three terms, P, I and D-terms.

 1
t
de(t ) 
u (t ) = K  e(t ) + ∫ e(t )dt + TD , (3)
 TI 0 dt 

where TD is derivation time constant. The derivation term acts like predictor, because
the speed of change of the error signal affects the control signal. The derivation term
has a large effect in systems where disturbances are present, because disturbances are
often fast. This means that fast changes in error signal (=disturbances) might even
push the process to unstable state. On the other hand, the D-term might speed up the
controlled system.

3
4 Control system analysis and controller tuning

Figure 2 presents the simplified block diagram of the feedback control.

Reference Error Control Output


signal r + variable e signal u signal y
Controller Process
_

Figure 2: Simplified block diagram of the feedback control.

The choosing of the controller’s parameters is process sensitive. You must use
different parameters in fast and slow processes. The disturbances also affect the
choise of parameters. The choosing can be done by step response method or by
oscillation boundary method (värähtelyrajamenetelmä in Finnish), which is based on
frequency analysis.

4.1 Control system analysis using Bode diagram

Analysing the stability of a control system can be done with frequency response of
the open loop system. Frequency response of an open loop system shows how the
system behavies without the feedback loop (in frequency plane). The structure of an
open loop system is presented in figure 3.

Reference Control Output


signal r signal u signal y
Controller Process

Figure 3: An open loop system (no feedback loop).

Frequency response is a function of ω (frequency). The frequency function gives the


gain (amplitude) and phase of a sinusoid signal, which is fed into the system, at every
frequency in the output. The frequency response can be calculated from the transfer
function of the system by replacing s with jω.

u(t) = sinω t y(t) = |G(jω )|sin{ω t+arg[G(jω )]}


G(s)

Figure 4: A sinusoid signal going through a system.

4
The figure 4 shows the principle of frequency response. A sinusoid signal is fed into
the system and the gain and phase of the output signal is recorded. This is done on
every frequency. Thus a frequency response of the system is created.

A system should be linear, if we want to apply this kind frequency examination.


Otherwise we can linearize the system around some operating point and apply the
frequency examination methods to that linearized system. The controller tuning can
also be done with that linearized model of the system.

To maintain the stability of some system, there should hold

G ( jω ) < 1, whenever arg ( G(jω ) ) ≤ −180D , (4)

where arg(…) means phase. If G ( jω ) = 1 and arg ( G(jω ) ) = −180D , the system is on

the oscillation boundary. The relative stability of a system is characterized by gain


margin (Kv) ja phase margin (φv). They are defined as follows

1
Kv = , when arg ( G(jω ) ) = −180D and (5)
G ( jω )

φv = arg ( G ( jω ) ) + 180D , when G(jω ) = 1 . (6)

Figure 5 shows how the gain and phase margins can be defined from Bode diagram.

Kv

φv

ω2 ω1

Figure 5: Bode diagram of a certain system.

5
4.2 Tuning the controller

The requirements set for a controller can be partly contradictory. A controlled closed
system should be stable and the perfomance of the controller should be good, meaning
that the control is fast and accurate. For example, the better the performance of the
controller, the less stable the closed system. That is why one must make compromises
to fulfill all the requirements. The goal is to make the system fast, but on the other
hand, the system should not be taken close to the oscillation boundary, where small
changes in the system (e.g. noise) could make the system unstable.

4.2.1 Step response method

The step response method can be used to tune the parameters of a controller, if it is
possible to feed a step into open system (no control nor feedback). If a step of height
K1 is fed into the system and the output of the system behaves as in figure 6, one can
draw a tangent to the turning point of the output signal. The height of the output
signal is then K2. Delay (T1) and rising time (T2) are calculated as in figure 6.

u(t)

K1
y(t)

K2

t0
T1 T2

Figure 6: Step response method measurements.

Using the Ziegler-Nichols criterion the parameters of the controller can be derived
from these measurements. The criterion is explained later in this report. The
parameters of the controller are presented in table 1.

6
Table 1: Controller parameters in step response method.

Controller Gain K Integration time TI Derivation time TD


P K1 T2
K 2 T1
PI K1 T2 3 T1
0.9
K 2 T1
PID K1 T2 2 T1 0.5 T1
1.2
K 2 T1

4.2.2 Oscillation boundary method

In oscillation boundary method, the closed loop system behavior is observed.


A P-controller is used to tune the system towards oscillation boundary. The gain is
increased until the system is on the oscillation boundary. Then the output of the
system oscillates with constant amplitude and frequency. In Bode diagram this means
that the amplitude diagram rises as the gain K is increased until the amplitude
becomes one (0 dB) on the frequency where the phase is -180°. The change of gain
(compared to the open loop Bode diagram) is Kcr (critical gain) and the equivalent
time of one oscillation period (in output signal) is Tcr. The parameters of the controller
are calculated according to table 2.
Table 2: Controller parameters in oscillation boundary method.

Controller Gain K Integration time TI Derivation time TD


P 0.5 Kcr
PI 0.45 Kcr 0.85 Tcr
PID 0.6 Kcr 0.5 Tcr 0.125 Tcr

4.3 Ziegler-Nichols criterion

The Ziegler-Nichols criterion is based on the presented ways to calculate the


parameters of the controllers. A closed loop system step response will be damping
oscillation, where the deviation from reference at first peak is four times as large as at
the second peak. As an example of this, let’s create a system in Simulink. Transfer
1
function block contains a system G ( s ) = . First only P-control is used and the
( s + 1)3

7
P-term is increased while the system is on the oscillation boundary. Figure 7 shows
the block diagram of the closed system.

Figure 7: A P-controlled system.

The P-term is increased until the output of the system looks as in figure 8. The
oscillation is critical.

Figure 8: A system on the oscillation boundary.

The oscillation period is calculated from the figure above and it is Tcr = 3.5 s. The P-
term of the controller is 8 and that is why Kcr = 8. PID-controller parameters are:
P = 4.8, I = 1.75 and D = 0.44 (according to formulas in table 2). It has to be noticed
that in Simulink the parameters for a PID-block are interpreted in a different way than
in oscillation boundary method. The method gives parameters for PID-controller of
type of equation (3), but in Simulink the equation of the controller is
t
I de(t )
U ( s ) = P + + Ds, or u (t ) = Pe(t ) + I ∫ e(t ) + D . (7)
s 0
dt

When compared to equation (3), we find out that

8
 P=K

 K
 I= , (8)
 TI
 D = KTD

where P, I and D are parameters in Simulink and K, TI and TD are the values obtained
by the oscillation boundary method. As the parameter values are fed into the Simulink
model and a step is fed into the system reference, the output behaves as in figure 9.

Figure 9: The output of the PID-controlled system.

As it can be seen in the figure, the overshoot is about 60 %, but the second “top” of
the output signal has overshoot of only 12 %. The ratio between these overshoots is
approximately 4, which it should be according to the Ziegler-Nichols criterion.

Generally the criterion might not work in all processes, but it gives a good initial
values for the parameters when tuning a more complex system. It is also possible that
overshoots are not approvable in some systems and the method can not be used.

5 A flow process

In the laboratory, the first part of the exercise is about analysing a flow process model
and tuning a controller for that. The process model has been transformed to circuit
analog model so the behavior of the model can be analysed and different kind of
controllers can be tuned for the process. The process consists of three containers that
have a similar time constant. The process is presented in figure 10.

9
disturbance valve
flow input flow

actuator

measurement
controller
h

Figure 10: The flow process.

The goal of the exercise is to control the level (h) of the last container. The block
diagram of the controlled system is presented in figure 11.

disturbance

controlled quantity +
process
+
measurement actuating
signal

-
error variable controller actuator

+
reference signal

Figure 11: Block diagram of the linearized analog system.

10
6 Temperature control system

Another part of the laboratory exercise deals with a real miniature process, where the
temperature of air flow is controlled. Figure 12 presents the heating process.

Figure 12: Air flow heating process.

On the left end of a tube there is a motor that blows air towards the right end of the
tube. Next to the motor there is a heating element that warms the air. The temperature
can be measured from three different positions in the tube.

The process is connected to a computer with Matlab/Simulink programs through I/O-


card with A/D- and D/A converters. Thus the process can be controlled and analysed
from Matlab. Figures 13- 15 show the interconnections of the process and Matlab.

Figure 13: Hardware and different tasks in the controlled system.

11
Figure 14: Signal flow chart of the controlled system.

The temperature range of the process is 30...60 °C. There is a transport delay in the
process (transit time delay), because it takes some time for the air to travel through the
tube (from motor to sensor). The air flow can be controlled only manually by
adjusting a choker next to the motor. There are many disturbances present in the
process, so it is not ideal.

Figure 15: Connections to the process.

The controller of the process in PC is actually a PID block in Simulink. This means
that the parameters that are calculated using the step response and oscillation
boundary methods have to be transformed to Simulink form using equation (8). Of

12
course, if the program itself calculates the parameters they are in right form and no
transformation is needed. For comparison, tables 3 and 4 show the parameter
equations for the controllers from the program manual. If equation (8) is used,
parameters in tables 1 and 2 become exactly the same as in tables 3 and 4. So when
the parameters are calculated, you must always know how the controller is
implemented!
Table 3: Controller parameters in step response method (Simulink form).

Controller Gain K Integration time TI Derivation time TD


P K1 T2
K 2 T1
PI K1 T2 P
0.9
K 2 T1 3T1
PID K1 T2 P P ⋅ T1
1.2
K 2 T1 2T1 2

Table 4: Controller parameters in oscillation boundary method (Simulink form).

Controller Gain K Integration time TI Derivation time TD


P 0.5 Kcr

PI 0.45 Kcr 1.2 ⋅ P


TKR
PID 0.6 Kcr 2⋅P P ⋅ TKR
TKR 8

13
7 Preliminary exercises

Do these exercises before coming to the laboratory session.

1. In figure 16 there is a mechanical container level control system. If the input


flow increases and the container level starts to rise, the floating “sensor” rises
and the rocking lever makes the valve to shut itself. As the level goes down,
the lever makes the valve to open. The output flow is a disturbance for the
system.

a) What kind of a controller is that in figure 16. P-, PI or PID?

b) How can you change the reference signal of the controller?

c) How can you change the parameters of the controller?

d) Draw a block diagram of the system.

rocking lever

input flow

disturbance flow

Figure 16: Contrainer level control system.

2. a) Plot a Bode diagram for the flow process of figure 10, when transfer
1
function of each container is G ( s ) = .
s +1

b) Calculate the controller parameters (P-, PI- and PID-controllers) for the
process that satisfy the Ziegler-Nichols criterion by using the oscillation
boundary method.

c) Design a P-controller for the process so that the gain margin is 10 dB.

d) What is the phase margin in c)?

14
e) How many percentages is the steady state error when using this P-
controller?

f) Is it possible to find a P-controller for the process so that there would not be
any oscillation in the step response? State reasons!

g) What kind of a controller is used if closed loop system step response looks
like as in figure 17.

Figure 17: Step response of a closed system.

3. a) How does the position of the choker affect the process gain and transport
delay in the heating process?

b) How does the position of the temperature sensor in the tube affect the
process gain and transport delay?

c) How does the position of the temperature sensor affect the relative stability
of the closed system?

d) What are the main disturbance factors of the process when control is
considered?

15
8 Exercises in laboratory

1. Tune P-, PI- and PID-controllers for the flow process (figure 10) using step
response method. Write down the parameter values into the preliminary
exercise paper.

2. Tune the same parameter values using the oscillation boundary method.

3. Do the step response experiments using all three controllers (from exercise 2).
Draw the diagrams of the responses and attach them to your preliminary
exercise paper. Do the responses fulfill the Ziegler-Nichols criterion?

4. Use a P-controller that has a gain of preliminary exercise 2c). Do step


response experiment with closed system and draw the output. How many
percentages is the steady state error? Compare this with the value calculated in
2e).

5. Draw diagrams of closed system when using P- and PI-control so that the
disturbance flow (voltage) of the system changes from 0 - 4 V. Analyse the
disturbance compensation properties of the controllers.

6. Open Matlab 5.3 on the PC. Change the working directory:

>> cd(‘c:\MatlabR11\Labra11’)

Start the Process Trainer Workshop (PT326):

>> pt326

7. Check that the temperature sensor is in the middle position. Start the heating
process. Set switch SW2 to lower position and set value of the temperature to
zero. Double click the Process balance button. Click Set zero button in the
Process balance window.

8. Turn switch SW2 to upper position and set value to 8. Wait a little while so
that the tube gets warm.

9. Type 45 into the edit window provided on the Matlab screen, and click “Set
Slope”. Close the Process balance window.

10. Open Stethoscope. Choose only Temperature1. Collect measurements for 10


seconds. You may change the set value of the temperature during the

16
measurement. Analyse the results on the screen. Notice, that only a P-
controller (with gain 1) is used during these measurements. Turn the switch
SW2 to lower position and print the step responses of the open loop so that
you change the sensor position between each test.

11. Close the Stethoscope window and open “Open loop control” window. Double
click the “Heating POWER” block on the screen. You may manually change
the set value of the process. Click Play button (in the top of Simulink model)
to turn on the measurement and control mode. Notice that there is no
controller nor feedback used at the moment (this means direct control).

12. Stop the measurements and close “Open loop control” window. Don’t save
any changes. Double click Stop Practical button. Open “Time domain
identification” window. You can estimate the process model parameters in this
window. The transfer function of the process model is:

K
G(s) = ⋅ e − sτ ,
(Ta s + 1)(Tb s + 1)
where K is process gain, Ta and Tb are time constants and τ is process delay
(dead time).

13. Choose step size 0.85 and click Data acquisition button. As the step response
appears on the screen, zoom into the beginning of the step. Define delay of the
process and type that to the appropriate window. Click Least squares button to
estimate the process parameters using least squares method. Compare the real
step response and the model step response. You may repeat the experiment
using some other delay. Clear the screen between the experiments. Do the
estimation with Surface method as well, which is Gaussian identification
based method. See also how the step size affects the estimation and the
parameters. Finally, send the parameters to Matlab (when you are satisfied
with the model).

14. Close the “Time domain identification” window. Open “PID Control”
window. Double click the Real-Time Task block and choose Internal from
Generator Flag menu. Open Reference TEMP. block. Load Settings.mat file
using the load menu. From the opening menu you may choose the reference
signal of the process to be constant, square, triangle, sinusoidal or random

17
signal. Choose Immediately to pass the changes immediately to the process.
Choose some reference signal and type the following parameters into the PID
controller: P = 0.017, I = 0.051 and D = 0.001. Start the measuring and control
and analyse the control, reference and output signals. Examine how the
controller parameters affect the control speed, accuracy and stability of the
process. Use different reference signals. Try to find “good” parameters for the
controller and write them down.

15. Close “PID Settings” and “PID Control” windows. Double click Stop Practical
button. Open “Ziegler-Nichols Transient Response” window. Here you can
tune the controller parameters using step response method. The response
should fulfill the Ziegler-Nichols criterion. Use largest step size and do step
response experiments. Send PID controller parameters to Matlab. Calculate
the values as well by hand and compare parameter sets with each others. Write
down the P- and PI-controller parameters as well. Close the window.

16. Return to “PID Controller” window and do same kind of experiments as in 14.
Use those PID controller parameters that you got before in 15. It is possible
that you have to change the max values of the PID parameters if the parameter
values are larger than those limits. Examine the process behavior with
different reference signals. See also how the P- and PI-controllers work (using
the parameters that you got for them before). Do the step responses fulfill the
Ziegler-Nichols criterion?

17. Double click the Stop Practical button. Move the sensor to the left position in
the tube. Return to “PID Control” window and redo the experiments in 16.
How does the position of the sensor affect the control properties? Move the
sensor to the right position and redo the experiments once again. Analyse!

18. Move the sensor back to the middle position. Choose manual reference signal
from Real-Time Task / Generator flag. Set the reference to maximum value
(1) and let it stay there for a moment. Then suddenly turn the reference to
zero. What phenomenon can detect in the response? Why does it happen?

19. Stop the measurements and open “Ziegler-Nichols Ultimate Sensitivity”


window. Set P-controller gain to 0.05 and collect data for 50 s. If the process
is on the oscillation boundary, click End button. Otherwise increase the

18
controller gain and collect data again. Go on like this until the P-controlled
system is on the oscillation boundary. Then click End button and write down
each controllers’ parameters.

20. Close the “Ziegler-Nichols Ultimate Sensitivity” window and return to “PID
Controller” window. Examine how the controllers of 19. work. Do the
responses fulfill the Ziegler-Nichols criterion?

19

Das könnte Ihnen auch gefallen