pid pm english

19

Click here to load reader

Upload: jamal-alshawesh

Post on 30-Apr-2017

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pid Pm English

Automatic Control — Lab 1

PID-control and open-loop control

This version: October 24 2011

I

P

D

REGLERTEKNIK

AUTOMATIC CONTROL

LINKÖPING

Name:

P-number:

Date:

Passed:

Page 2: Pid Pm English
Page 3: Pid Pm English

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. Anotherpurpose is to introduce the most common control structure used in indus-try, so called PID-controllers. Besides being common, these controllers havethe benefit that they clearly illustrate basic control principles. These simpleprinciples can be found also in more complicated controllers. To get familiarwith PID-control, you will use it to control the water-level in a water tank.two cases will be investigated. At first, you will control the level in a tankwhere you control the flow directly via a pump, see figure 1. You will then tryto 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

Page 4: Pid Pm English

2 Computer environment

To start the program described below, double-click the file ”PID” on thedesktop. You start the interface by clicking on the arrow in the top leftcorner and stop the interface by clicking on the button marked ’STOP’.

The process, which in this lab consist of two tanks, is controlled via thecomputer in an interface shown in figure 2. The system can be set in threedifferent modes.They are closed-loop control using a PID controller, andopen-loop control with a manual control signal (from joystick) or a controlsignal interpolated from ’Look-up table’. The different alternatives can beselected using the two switches on the left. There is also a possibility toswitch the measurement signal between the two tanks by clicking on theswitch to the right in the interface.

Figure 2: Interface for the process.

4

Page 5: Pid Pm English

2.1 Explanations

Some of the concepts in the program

Start By clicking on the button with an arrow (top left) the real-time processis 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 bydouble clicking on the min- or max-value to be changed.

Clear plots By clicking this button, the graphs will be cleared and a newplot will be started.

Show P-, I- and D-part Selects if the components (P,I,D) in the controlu(t) are shown.

Ka, TI , TD, α 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 lampwill light up in that case.

5

Page 6: Pid Pm English

3 Level control of a single tank

The first control task is to control the upper tank at a constant level. Thelower tank is ignored in this part. The tank has a hole in the bottom, allowingthe water to pour down to the lower tank and then to a drain. In the uppertank, 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 keepthe tank at a desired water level. A larger pump flow naturally leads toan equilibrium at a higher water level. The control should be capable ofhandling changes in the desired water level (the reference) and disturbances,such as extra inflow or use of the extra drain outlet. Level control of thistype is common in process industry.

Throughout this chapter, only the upper tank is used. Ignore the lowertank, and make sure that you are using the measurement from the uppertank (set this in the interface).

3.1 Experiment: Manual control

We will start by controlling the voltage to the pump directly using a manualchoice via the joystick. Connect the joystick to the input ”ACH2” on themeasurement card. Make sure to ground the black cable!

When discussing control problems, it is common to illustrate them usingblock schemes. Figure 3 shows a block scheme for our problem.

SystemInput u(t) Output y(t)

Figure 3: Block scheme for the control problem.

In figure 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 blockmarked system represents how the output signal (water level) depends onthe input signal (pump voltage). To emphasize that this is the input signalwe control the system with, we will henceforth call it the control signal. Thebenefit with a block scheme is that it highlights the cause-and-effects in thesystem rather than the actual physical components in the system. In many

6

Page 7: Pid Pm English

cases, detailed knowledge on the relationship between the control and outputsignal is available, typically a differential equation.

In our case, the knowledge we have about the system, is that the waterlevel (the output signal) increases when we increase the pump voltage (thecontrol signal). However, we will see that this information is sufficient forcontrolling the system, and understanding the control.

Select the joystick as control signal (Set switch so that the ’joystick’ is theinput to the pump. Test some different inputs and measure the resultingtank 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 manualopen-loop control of the tank.

One person in the group controls the input signal by choosing controlinputs without looking at the level in the tank. This person may onlylook at the graph showing the input signal to the pump. Another personin the group decides which level to reach, and makes notes on the results,without telling the first person how things progress.

How well does this control work?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Partly open the extra outlet and repeat the previous experiment. Howwell did the control behave now?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

Page 8: Pid Pm English

The control strategy above is an example of open-loop control, whichmeans that the controller (in this case the first person) has no access to mea-surements from the system. We will now repeat the experiment, but withthe modification that the person who controls the pump is allowed to look atthe water level when controlling the pump. This is an example of closed-loopcontrol (the feedback is performed by the eyes, and the first person act asthe controller)

One person in the group controls the pump while observing the waterlevel. Try to control to the same water levels as above. What are theresults?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

What happens when the extra outlet is used?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

You have now tried both open-loop and closed-loop control, and hopefullygained some experience in these concepts.

What are the pros and cons with open- and closed-loop control? When isa 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 whichcontrol 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 comesfrom the table.

The table defines a function f relating u(t) to the desired level r(t) as

u(t) = f(r(t))

8

Page 9: Pid Pm English

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 lookat the level. We will now see how we can obtain better results compared toopen-loop control, by using water level measurements. A simple idea is takethe difference between the desired level r(t), and the tank level y(t), andlet the control input be this difference amplified by a Ka, i.e. proportionalcontrol!

3.2.2 Feedback

To obtain good control, the controller must be able to compensate for errorssuch 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 tothe lower setting). Set Ka = 1.

The relation between the output signal and the control signal is now

u(t) = Ka

(

r(t) − y(t))

The reference signal is compared in the controller with the actual water levely(t). This gives the control error e(t) = r(t) − y(t). The input voltage to thepump is then generated as a constant Ka 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 controlsystem is given in figure 4.

9

Page 10: Pid Pm English

KaΣ

−1

Systemr(t) e(t) u(t) y(t)

Figure 4: Block scheme for level control.

We will now investigate how the controller gain Ka influences thebehavior of the system. Set a reference value. What water level isobtained for this reference value?

Reference: . . . . . . cmWater level: . . . . . . cmControl error: . . . . . . cm

A remaining error is easy to understand: We found out in experiment 3.1how many volts were needed to obtain a desired level. From the relation

u(t) = Ka

(

r(t) − y(t))

= Kae(t)

we see than an control input u(t) volts forces us to have an error u(t)/Ka

volt. To see this, assume the error is 0. This leads to u(t) = 0. Water willthen flow out, and we will not be able to keep the error at 0!

Try another reference level. What happens?

Reference: . . . . . . cmWater level: . . . . . . cmControl error: . . . . . . cm

Now increase Ka. What happens?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

From the experiments, we have learned that a small control error requireslarge control inputs already for small errors. We therefore choose Ka large.

10

Page 11: Pid Pm English

What happens with the control input when Ka 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 amplification ofmeasurement noise, and increased oscillatory behaviour. We will now try toavoid these problems by modifying the controller.

3.2.3 Experiment: PI-control

If we select a finite value on TI , the controller will implement the followingcontrol

u(t) = Ka

(

e(t) +1

TI

∫ t

0

e(τ)dτ)

(1)

Reduce Ka to approximately 1 and use 0 < TI < ∞, suitable value for TI

is roughly 15.

Compared to the control input used in the closed/loop control experiment3.2 (P-control), we have added a term proportional to the time/integral ofthe error signal.

Use one of the reference values in experiment 3.1. What is the voltagefrom the I-part when the level has stabilized?You can see the contribution from the I-part by setting ”Show P-, I- andD-part” to ”On”.

Stationary level: . . . . . . . . . . . . cm.

Voltage from the I-part: . . . . . . . . . . . . V .

Compare the voltage you measured on the I-part with the control inputsyou 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

Page 12: Pid Pm English

ing) until the integral of the control error e(t) is zero, and thus the controlerror is zero.

You have now investigated how the control system manages to have theoutput 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 disturbancerejection problem. A block scheme for the disturbance rejection problem isshown in figure 5.

Disturb the system by increasing the outflow (open the extra outlet).What happens?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

In figure 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 thestationary control error completely, without the adverse effects a large Ka

gave in a simple P-controller.

Once again study the servo-problem. Investigate if you can achieve goodcontrol by varying TI . Test what happens if you perform steps in thereference. How does TI influence the results?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

Page 13: Pid Pm English

Conclusion:

The I-part handles the stationary error in a feedback control system. It canhowever have negative effects 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 first study a PD-controller, and then conclude everything in acomplete PID-controller.

A PD-controller uses the derivative of the control error as follows

u(t) = Ka

(

e(t) + TD

de(t)

dt

)

In other words, we are trying to predict the future error by looking at thederivative of the error. We can see this from a simple first order Taylorexpansion of the error TD seconds ahead

e(t + TD) ≈ e(t) + TD

de(t)

dt

Investigate how TD influences the step response. Start by small(TD < 0.5)! Use Ka = 1, TI =’inf ’ and α = 0. Make sure to reset theI-part (Click on ’Reset integral’). What happens when TD is increased?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

To explain the answer to the question above, let us study how the measure-ment signal y(t) = h1(t) is influenced by a differentiation. Let the measure-ment consist of two parts, the true value ys(t) and measurement noise n(t)which can be described using a sinusoidal signal

y(t) = ys(t) + n(t) = ys(t) + a sin ωt

The contribution to the control input from the D-part is (TD och Ka omitted)

dy(t)

dt=

dys(t)

dt+ aω cos ωt

It is easily realized that high-frequency noise will be amplified strongly by anideal derivation. To avoid this amplification, the derivative part is extendedwith a low-frequency filter, and is thus implemented as

D(s) =TDs

αTDs + 1E(s)

13

Page 14: Pid Pm English

How can the equation above be interpreted (approximately) for large/smalls?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

How does α influence the control input in the equations above? Whathappens with a small and large α respectively?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

With P-, I- och D-parts used, the equation for the controller is

U(s) = Ka

(

1 +1

TIs+

TDs

αTDs + 1

)

E(s)

Use values for Ka and TI which gave good control in experiment 3.2.3.Investigate if you can achieve good control by varying TD and α. Test inparticular if Ka and TI can be increased and decreased respectively, whenwe introduce the derivative part. Suitable values on TD and α are 2 and1 respectively.Howe does the influence of the measurement noise change when TD andα are altered?

Result: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Conclusion:

The D-part damps the oscillatory behavior. It can unfortunately amplifythe measurement noise, an effect which however can be reduced by using anon-ideal derivative part, i.e. a low-pass filtered derivative.

Conclusions

Conclude the influence from the different parts of a PID controller.

P: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

I: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

D:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14

Page 15: Pid Pm English

15

Page 16: Pid Pm English

4 Level control of the double-tank.

We will now control a slightly harder system. Connect the lower tank bychanging the right switch to its lower setting. We now have two tanks cou-pled in series where the water in the upper tank flows to the lower tank, andwe want to control the level in the lower tank.

Try to find a PID-controller with a rise-time below 5 s and an over-shootbelow 10 %. The requirements are for a step from the level 10 cm with anamplitude of 1 cm.

PID-controller rise-time Over-shootKa = TI = TD = α =Ka = TI = TD = α =Ka = TI = TD = α =Ka = TI = TD = α =Ka = TI = TD = α =

As you maybe notice, it is fairly hard to simply guess the values for the PID-controller, when certain specifications are given. In the second laboratoryexercise, we will see how model-based control design can help.

16

Page 17: Pid Pm English

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 noteshould have been read before the session starts.

A.2 Open-loop control

In the first part of the lab, open-loop control is studied. A joystick is usedto generate a voltage. The joystick is connected to a water pump, pumpingwater to the tank. The level in the tank is measured and converted to avoltage. The joystick and the tank system is connected via a computer, toget the measured signals presented in a convenient fashion.

1 A sketch of the process is given in figure 1. The joystick is connecteddirectly to the pump. Draw this system using a block scheme. Whatphysical quantities are in- and output signal in the different blocks?

2 Assume the pump can be described as a static system, meaning theflow to the tank is changed directly when the voltage to the pump ischange, i.e.

q(t) = Kpump · u(t)

What is the transfer function from voltage to flow. What is the dimen-sion?

3 The relationship between inflow and level in the tank can approximatelybe described with the differential equation

Ah(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 isthe transfer function for the tank, i.e. from inflow to level?

4 Assume the position of the joystick (control input u(t)) is changedmomentaneously from zero to a positive value. What is the Laplacetransform of the resulting level?

17

Page 18: Pid Pm English

5 Use the results from exercises 2-4 to sketch the principle behavior ofthe water level, as a function of time, when the joystick is changed insteps.

A.3 Closed-loop control

The computer is used to achieve PID-control. We measure the tank levelat the upper tank, and the controller generates a control input u(t) to thepump, 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 singleblock (the reference can be seen as an input to the computer). Whatphysical 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 difference 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 transformof 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 aconstant value, and if so, at which value?

18

Page 19: Pid Pm English

B Connection

Figure 6 shows the setup for the double-tank system. The I/O-card sendsall 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 ToD/A is Y-coupled, meaning that it splits to two contacts in one end. Notethat the joystick requires a voltage generator.

ACH0 ACH1

To D/A

To LoadFrom D/A

S1 & S2

DAC0

ACH2

I/O card Double−tankAmpllifier

Joystick

"Small""Big"

Figure 7: Connection scheme.

19