Anda di halaman 1dari 19

Automatic Control Lab 1

PID-control and open-loop control


This version: October 24 2011
I
P
D
R
E
G
LERTEK
N
IK
A
U
T
O
M
A
TIC CO
N
T
R
O
L
LINKPING
Name:
P-number:
Date:
Passed:
1 Introduction
The purpose of this laboratory exercise is two-fold. To begin with, it illus-
trates basic concepts introduced in lectures and exercise sessions. Another
purpose is to introduce the most common control structure used in indus-
try, so called PID-controllers. Besides being common, these controllers have
the benet that they clearly illustrate basic control principles. These simple
principles can be found also in more complicated controllers. To get familiar
with PID-control, you will use it to control the water-level in a water tank.
two cases will be investigated. At rst, you will control the level in a tank
where you control the ow directly via a pump, see gure 1. You will then try
to control the lower level in two coupled tanks, i.e. a more complex system.
h1
q1
qin
1
Pump
Figure 1: Sketch of the tank system.
3
2 Computer environment
To start the program described below, double-click the le PID on the
desktop. You start the interface by clicking on the arrow in the top left
corner and stop the interface by clicking on the button marked STOP.
The process, which in this lab consist of two tanks, is controlled via the
computer in an interface shown in gure 2. The system can be set in three
dierent modes.They are closed-loop control using a PID controller, and
open-loop control with a manual control signal (from joystick) or a control
signal interpolated from Look-up table. The dierent alternatives can be
selected using the two switches on the left. There is also a possibility to
switch the measurement signal between the two tanks by clicking on the
switch to the right in the interface.
Figure 2: Interface for the process.
4
2.1 Explanations
Some of the concepts in the program
Start By clicking on the button with an arrow (top left) the real-time process
is started.
Stop The process is stopped by clicking the red button marked STOP.
Graf The graph on the left presents the control signal u(t) och its PID-
components. The graphs on the right show the reference signal (yellow)
and the measurement signal (blue). The scales can be changed by
double clicking on the min- or max-value to be changed.
Clear plots By clicking this button, the graphs will be cleared and a new
plot will be started.
Show P-, I- and D-part Selects if the components (P,I,D) in the control
u(t) are shown.
K
a
, T
I
, T
D
, Parameters in the PID controllers.
Look-up Interpolation points for open-loop control.
Reference The reference r(t) is either set via the bar or typed into the box.
It can be reduced and increased using the arrows on the box..
High-level The program aborts if the level in a tank is too high. This lamp
will light up in that case.
5
3 Level control of a single tank
The rst control task is to control the upper tank at a constant level. The
lower tank is ignored in this part. The tank has a hole in the bottom, allowing
the water to pour down to the lower tank and then to a drain. In the upper
tank, there is also an additional outlet leading water directly to the drain.
An electrical pump pumps water back to the tank.
The problem is to control the voltage to the pump, in order to keep
the tank at a desired water level. A larger pump ow naturally leads to
an equilibrium at a higher water level. The control should be capable of
handling changes in the desired water level (the reference) and disturbances,
such as extra inow or use of the extra drain outlet. Level control of this
type is common in process industry.
Throughout this chapter, only the upper tank is used. Ignore the lower
tank, and make sure that you are using the measurement from the upper
tank (set this in the interface).
3.1 Experiment: Manual control
We will start by controlling the voltage to the pump directly using a manual
choice via the joystick. Connect the joystick to the input ACH2 on the
measurement card. Make sure to ground the black cable!
When discussing control problems, it is common to illustrate them using
block schemes. Figure 3 shows a block scheme for our problem.
System
Input u(t) Output y(t)
Figure 3: Block scheme for the control problem.
In gure 3 we have denoted the output signal, in our case the water level,
y(t). The input signal, the voltage to the pump, is denoted u(t). The block
marked system represents how the output signal (water level) depends on
the input signal (pump voltage). To emphasize that this is the input signal
we control the system with, we will henceforth call it the control signal. The
benet with a block scheme is that it highlights the cause-and-eects in the
system rather than the actual physical components in the system. In many
6
cases, detailed knowledge on the relationship between the control and output
signal is available, typically a dierential equation.
In our case, the knowledge we have about the system, is that the water
level (the output signal) increases when we increase the pump voltage (the
control signal). However, we will see that this information is sucient for
controlling the system, and understanding the control.
Select the joystick as control signal (Set switch so that the joystick is the
input to the pump. Test some dierent inputs and measure the resulting
tank level. (Select inputs in the range 1 3V )
Tank level [cm] Input [V]
Is the system linear? Motivate!
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Through the previous work, we have created a simple model of the tank sys-
tem. Try to use this information to control the tank level, i.e. using manual
open-loop control of the tank.
One person in the group controls the input signal by choosing control
inputs without looking at the level in the tank. This person may only
look at the graph showing the input signal to the pump. Another person
in the group decides which level to reach, and makes notes on the results,
without tel ling the rst person how things progress.
How wel l does this control work?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Partly open the extra outlet and repeat the previous experiment. How
wel l did the control behave now?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
The control strategy above is an example of open-loop control, which
means that the controller (in this case the rst person) has no access to mea-
surements from the system. We will now repeat the experiment, but with
the modication that the person who controls the pump is allowed to look at
the water level when controlling the pump. This is an example of closed-loop
control (the feedback is performed by the eyes, and the rst person act as
the controller)
One person in the group controls the pump while observing the water
level. Try to control to the same water levels as above. What are the
results?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What happens when the extra outlet is used?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
You have now tried both open-loop and closed-loop control, and hopefully
gained some experience in these concepts.
What are the pros and cons with open- and closed-loop control? When is
a model needed? When are sensors needed?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Experiment: Automatic control
3.2.1 Open-loop control
One way to automatize the open-loop control is to use the table you gener-
ated in experiment 3.1 in the controller. The table tells the computer which
control input gives a particular tank level.
To test the automatic control, feed your values to the interpolation table
(Look-up) in the interface. Verify that the signal to the pump comes
from the table.
The table denes a function f relating u(t) to the desired level r(t) as
u(t) = f(r(t))
8
where f in this case is a linear interpolation.
Test the automatic control. Is the desired level reached?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What happens if the extra outlet is used?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Note that this is the same case as when a person not was allowed to look
at the level. We will now see how we can obtain better results compared to
open-loop control, by using water level measurements. A simple idea is take
the dierence between the desired level r(t), and the tank level y(t), and
let the control input be this dierence amplied by a K
a
, i.e. proportional
control!
3.2.2 Feedback
To obtain good control, the controller must be able to compensate for errors
such as those studied above. In the following section, a commonly used feed-
back principle will be presented.
Turn the interface into feedback control mode (Set the middle switch to
the lower setting). Set K
a
= 1.
The relation between the output signal and the control signal is now
u(t) = K
a

r(t) y(t)

The reference signal is compared in the controller with the actual water level
y(t). This gives the control error e(t) = r(t) y(t). The input voltage to the
pump is then generated as a constant K
a
times the control error e(t).
This principle is called P-control (proportional). The controller the com-
puter implements is called a P-controller. A block scheme of the control
system is given in gure 4.
9
K
a
1
System
r(t) e(t) u(t) y(t)
Figure 4: Block scheme for level control.
We wil l now investigate how the control ler gain K
a
inuences the
behavior of the system. Set a reference value. What water level is
obtained for this reference value?
Reference: . . . . . . cm
Water level: . . . . . . cm
Control error: . . . . . . cm
A remaining error is easy to understand: We found out in experiment 3.1
how many volts were needed to obtain a desired level. From the relation
u(t) = K
a

r(t) y(t)

= K
a
e(t)
we see than an control input u(t) volts forces us to have an error u(t)/K
a
volt. To see this, assume the error is 0. This leads to u(t) = 0. Water will
then ow out, and we will not be able to keep the error at 0!
Try another reference level. What happens?
Reference: . . . . . . cm
Water level: . . . . . . cm
Control error: . . . . . . cm
Now increase K
a
. What happens?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
From the experiments, we have learned that a small control error requires
large control inputs already for small errors. We therefore choose K
a
large.
10
What happens with the control input when K
a
is increased?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion:
When setting the gain in a P-controller, we are trying to achieve to contra-
dicting things. We want to use a large gain to obtain a small stationary error.
however, we have seen that an increasing gain leads to an amplication of
measurement noise, and increased oscillatory behaviour. We will now try to
avoid these problems by modifying the controller.
3.2.3 Experiment: PI-control
If we select a nite value on T
I
, the controller will implement the following
control
u(t) = K
a

e(t) +
1
T
I

t
0
e()d

(1)
Reduce K
a
to approximately 1 and use 0 < T
I
< , suitable value for T
I
is roughly 15.
Compared to the control input used in the closed/loop control experiment
3.2 (P-control), we have added a term proportional to the time/integral of
the error signal.
Use one of the reference values in experiment 3.1. What is the voltage
from the I-part when the level has stabilized?
You can see the contribution from the I-part by setting Show P-, I- and
D-part to On.
Stationary level: . . . . . . . . . . . . cm.
Voltage from the I-part: . . . . . . . . . . . . V .
Compare the voltage you measured on the I-part with the control inputs
you measured in experiment 3.1. Make sure the extra outlet is closed!
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The reason for the new result is that the integral keeps growing (or decreas-
11
ing) until the integral of the control error e(t) is zero, and thus the control
error is zero.
You have now investigated how the control system manages to have the
output y(t) follow the reference r(t). This is often called the servo-problem.
A similar problem is to keep the output at a constant level, despite dis-
turbances acting on the system. This is most often called the disturbance
rejection problem. A block scheme for the disturbance rejection problem is
shown in gure 5.
Disturb the system by increasing the outow (open the extra outlet).
What happens?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
In gure 5, v(t) represents the extra water let out.
F G
1 1
r(t) e(t) u(t)
v(t)
y(t)
Figure 5: Block scheme for the disturbance rejection problem.
By modifying the control structure, we have managed to get rid of the
stationary control error completely, without the adverse eects a large K
a
gave in a simple P-controller.
Once again study the servo-problem. Investigate if you can achieve good
control by varying T
I
. Test what happens if you perform steps in the
reference. How does T
I
inuence the results?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
Conclusion:
The I-part handles the stationary error in a feedback control system. It can
however have negative eects on stability.
3.2.4 Experiment: PID-control
We will now study the last part in a PID-controller. To understand the D-
part, we will rst study a PD-controller, and then conclude everything in a
complete PID-controller.
A PD-controller uses the derivative of the control error as follows
u(t) = K
a

e(t) + T
D
de(t)
dt

In other words, we are trying to predict the future error by looking at the
derivative of the error. We can see this from a simple rst order Taylor
expansion of the error T
D
seconds ahead
e(t + T
D
) e(t) + T
D
de(t)
dt
Investigate how T
D
inuences the step response. Start by smal l
(T
D
< 0.5)! Use K
a
= 1, T
I
=inf and = 0. Make sure to reset the
I-part (Click on Reset integral). What happens when T
D
is increased?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
To explain the answer to the question above, let us study how the measure-
ment signal y(t) = h
1
(t) is inuenced by a dierentiation. Let the measure-
ment consist of two parts, the true value y
s
(t) and measurement noise n(t)
which can be described using a sinusoidal signal
y(t) = y
s
(t) + n(t) = y
s
(t) + a sin t
The contribution to the control input from the D-part is (T
D
och K
a
omitted)
dy(t)
dt
=
dy
s
(t)
dt
+ a cos t
It is easily realized that high-frequency noise will be amplied strongly by an
ideal derivation. To avoid this amplication, the derivative part is extended
with a low-frequency lter, and is thus implemented as
D(s) =
T
D
s
T
D
s + 1
E(s)
13
How can the equation above be interpreted (approximately) for large/smal l
s?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How does inuence the control input in the equations above? What
happens with a smal l and large respectively?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
With P-, I- och D-parts used, the equation for the controller is
U(s) = K
a

1 +
1
T
I
s
+
T
D
s
T
D
s + 1

E(s)
Use values for K
a
and T
I
which gave good control in experiment 3.2.3.
Investigate if you can achieve good control by varying T
D
and . Test in
particular if K
a
and T
I
can be increased and decreased respectively, when
we introduce the derivative part. Suitable values on T
D
and are 2 and
1 respectively.
Howe does the inuence of the measurement noise change when T
D
and
are altered?
Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion:
The D-part damps the oscillatory behavior. It can unfortunately amplify
the measurement noise, an eect which however can be reduced by using a
non-ideal derivative part, i.e. a low-pass ltered derivative.
Conclusions
Conclude the inuence from the dierent parts of a PID controller.
P: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
15
4 Level control of the double-tank.
We will now control a slightly harder system. Connect the lower tank by
changing the right switch to its lower setting. We now have two tanks cou-
pled in series where the water in the upper tank ows to the lower tank, and
we want to control the level in the lower tank.
Try to nd a PID-control ler with a rise-time below 5 s and an over-shoot
below 10 %. The requirements are for a step from the level 10 cm with an
amplitude of 1 cm.
PID-controller rise-time Over-shoot
K
a
= T
I
= T
D
= =
K
a
= T
I
= T
D
= =
K
a
= T
I
= T
D
= =
K
a
= T
I
= T
D
= =
K
a
= T
I
= T
D
= =
As you maybe notice, it is fairly hard to simply guess the values for the PID-
controller, when certain specications are given. In the second laboratory
exercise, we will see how model-based control design can help.
16
A Preparations
A.1 Introduction
The purpose of these exercises are to prepare for this laboratory session,
revolving around the control of a water tank system.
The exercises should be thoroughly worked through, and this whole note
should have been read before the session starts.
A.2 Open-loop control
In the rst part of the lab, open-loop control is studied. A joystick is used
to generate a voltage. The joystick is connected to a water pump, pumping
water to the tank. The level in the tank is measured and converted to a
voltage. The joystick and the tank system is connected via a computer, to
get the measured signals presented in a convenient fashion.
1 A sketch of the process is given in gure 1. The joystick is connected
directly to the pump. Draw this system using a block scheme. What
physical quantities are in- and output signal in the dierent blocks?
2 Assume the pump can be described as a static system, meaning the
ow to the tank is changed directly when the voltage to the pump is
change, i.e.
q(t) = K
pump
u(t)
What is the transfer function from voltage to ow. What is the dimen-
sion?
3 The relationship between inow and level in the tank can approximately
be described with the dierential equation
A

h(t) = q(t) ch(t)


where A denotes the surface area of the tank, and the constant c,
amongst other things, depends on the area of the outlet valve. what is
the transfer function for the tank, i.e. from inow to level?
4 Assume the position of the joystick (control input u(t)) is changed
momentaneously from zero to a positive value. What is the Laplace
transform of the resulting level?
17
5 Use the results from exercises 2-4 to sketch the principle behavior of
the water level, as a function of time, when the joystick is changed in
steps.
A.3 Closed-loop control
The computer is used to achieve PID-control. We measure the tank level
at the upper tank, and the controller generates a control input u(t) to the
pump, via a signal processing card by calculating
6 Draw a block scheme of the closed-loop system. Let the computer,
voltage generator and processing card be represented by one single
block (the reference can be seen as an input to the computer). What
physical quantities are input and output signals in the blocks?
7 Now assume the computer implements a proportional controller, i.e.
the generated voltage is proportional to the dierence between the de-
sired and measured level. Let the reference signal (r(t)) change momen-
taneously from zero to a positive value. What is the Laplace transform
of the resulting level?
Hint: Use the result from exercise 3 above.
8 Use the result in exercise 7 to decide if the output will settle at a
constant value, and if so, at which value?
18
B Connection
Figure 6 shows the setup for the double-tank system. The I/O-card sends
all measurements to the computer, were all computations are performed.
Figure 6: Overview of signal path
Figure 7 shows the connections for the exercise. All cables are unique,
and cannot be connected wrong. The cable from ACH0 and ACH1 to To
D/A is Y-coupled, meaning that it splits to two contacts in one end. Note
that the joystick requires a voltage generator.
ACH0 ACH1
To D/A
To Load From D/A
S1 & S2
DAC0
ACH2
I/O card Doubletank Ampllifier
Joystick
"Small" "Big"
Figure 7: Connection scheme.
19

Anda mungkin juga menyukai