• No results found

Extensions to the PID algorithm

In document Advanced Control using MATLAB (Page 160-165)

The PID controller

4.4 Extensions to the PID algorithm

Industrial PID controllers are in fact considerably more complicated than the textbook formula of Eqn.4.1would lead you to believe. Industrial PID controllers have typically between 15 and 25 parameters. The following describes some of the extra functionality one needs in an effective commercial PID controller.

4.4.1 Avoiding derivative kick

If we implement the classical PID controller such as Eqn.4.3with significant derivative action, the input will show jump excessively every time either the output or the setpoint changes abruptly.

Under normal operations conditions, the output is unlikely to change rapidly, but during a set-point change, the setset-point will naturally change abruptly, and this causes a large, though brief, spike in the derivative of the error. This spike is fed to the derivative part of the PID controller, and causes unpleasant transients in the manipulated variable. If left unmodified, this may cause excessive wear in the actuator. Industrial controllers and derivative kick is further covered in [179, p191].

It is clear that there is a problem with the controller giving a large kick when the setpoint abruptly changes. This is referred to as derivative kick and is due to the near infinite derivative of the error when the setpoint instantaneously changes as when in a setpoint change. One way to avoid problems of this nature is to use the derivative of the measurement ˙y, rather than the derivative of the error ˙e = ˙y− ˙y. If we do this, the derivative kick is eliminated, and the input is much less excited. Equations of both the classical and the ‘anti-kick’ PID controller equations are compared below. The anti-derivative kick controller is sometimes known as a PI-D controller with the dash indi-cating that the PI part acts on the error, and the D part acts on the output.

In SIMULINKyou can build a PID controller with anti-kick by modifying the standardPID con-troller block as shown in Fig.4.7.

Fig.4.8compares the controlled performance for the third order plant and tuning constants given previously in Fig.4.2where the derivative term uses the error (lefthand simulation), with the modification where the derivative term uses the measured variable (righthand simulation).

Evident from Fig4.8is that the PID controller using the measurement rather than the error be-haves better, with much less controller action. Of course, the performance improvement is only evident when the setpoint is normally stationary, rather than a trajectory following problem. Sta-tionary setpoints are the norm for industrial applications, but if for example, we subjected the closed loop to a sine wave setpoint, then the PID that employed the error in the derivative term would perform better than the anti-kick version.

An electromagnetic balance arm

The electromagnetic balance arm described previously in §1.4.1is extremely oscillatory as shown in Fig. 1.5(b). The overshoot is about 75% which corresponds to a damping ratio of ζ ≈ 0.1

reset 1/taui

input/output

gain Kc

derivative filter s taud/N.s+1 deriv

taud

Sum1 Sum

Pulse Generator

Plant 3 (s+4)(s+1)(s+0.4) Integrator

1 s

Figure 4.7: PID controller with anti-derivative kick. See also Fig.4.8.

0 10 20 30 40

−0.5 0 0.5 1 1.5

Normal PID

output & setpoint

0 10 20 30 40

−40

−20 0 20 40

input

time

0 10 20 30 40

−0.5 0 0.5 1 1.5

No derivative Kick

0 10 20 30 40

−40

−20 0 20 40

time

Figure 4.8: PID control of a plant given in Fig.4.7. The derivative kick is evident in the input (lower trend of the left-hand simulation) of the standard PID controller. We can avoid this ‘kick’

by using the derivative of the output rather than the error as seen in the right-hand trend. Note that the output controlled performance is similar in both cases

assuming a proto-type second order process model.

To stabilise a system with poles so close to the imaginary axis requires substantial derivative action. Without derivative action, the integral component needed to reduce the offset would cause instability. Unfortunately however the derivative action causes problems with noise and abrupt setpoint changes as shown in Fig.4.9(a).

1000 1500 2000 2500

Derivative kick

Flapper angle

0 10 20 30 40 50 60

0 1000 2000 3000

input

time [s]

(a) PID control exhibiting significant derivative kick.

1400 1600 1800 2000 2200

No derivative kick

0 10 20 30 40 50

800 1000 1200 1400 1600

time [s]

(b) PID control with anti-kick.

Figure 4.9: Illustrating the improvement of anti-derivative kick schemes for PID controllers when applied to the experimental electromagnetic balance.

The controller output, u(t) exhibits a kick every time the setpoint is changed. So instead of the normal PID controller used in Fig.4.9(a), an anti-kick version is tried in Fig.4.9(b). Clearly there are no spikes in the input signal when Eqn.4.16is used, and the controlled response is slightly improved.

Abrupt setpoint changes are not the only thing that can trip up a PID controller. Fig.4.10shows another response from the electromagnetic balance, this time with even more derivative action.

At low levels the balance arm is very oscillatory, although this behaviour tends to disappear at the higher levels owing to the nonlinear friction effects.

4.4.2 Input saturation and integral windup

Invariably in practical cases the actual manipulated variable value, u, demanded by the PID controller is impossible to implement owing to physical constraints on the system. A control valve for example cannot shut less than 0% open or open more than 100%. Normally “clamps”

are placed on the manipulated variable to prevent unrealisable input demands occurring such as umin< u < umax, or u = MIN(max u,MAX(min u,u))

or in other words, if the input u is larger than the maximum input allowedmax_u, it will be reset to that maximum input, and similarly the input is saturated if it is less than the minimum allowable limit. In addition to an absolute limit on the position of u, the manipulated variable can not instantaneously change from one value to another. This can be expressed as a limit on the derivative of u, such as|dudt| < cd.

1500 2000 2500 3000 3500 4000

Setpoint & output

0 5 10 15 20 25 30 35

0 1000 2000 3000 4000 5000

time [s]

input

Figure 4.10: Derivative control and noise. Note the difference in re-sponse character once the setpoint is increased over 3000. This is due to nonlinear fric-tion effects.

However the PID control algorithm presented so far assumes that the manipulated variable is unconstrained so when the manipulated variable does saturate, the integral error term continues to grow without bound. When finally the plant ‘catches up’ and the error is reduced, the integral term is still large, and the controller must ‘eat up this error’. The result is an overly oscillatory controlled response.

This is known as integral windup. Historically with the analogue controllers, integral windup was not much of a problem since the pneumatic controllers had only a limited integral capacity.

However, this limit is effectively infinite in a digital implementation.

There are a number of ways to prevent integral windup and these are discussed in [15, pp10–14]

and more recently in [138, p60] and [31]. The easiest way is to check the manipulated variable position, and ignore the integral term if the manipulated variable is saturated.

An alternative modification is to compute the difference between the desired manipulated vari-able and the saturated version and to feed this value back to the integrator within the controller.

This is known as anti-windup tracking and is shown in Fig.4.11(a). When the manipulated input is not saturated, there is no change to normal PID algorithm. Note that in this modified PID config-uration we differentiate the measured value (not the error), we approximate the derivative term as discussed in section4.2.1, and we can turn off the anti-windup component with the manual switch.

As an example (adapted from [19, Fig 8.9]), suppose we are to control an integrator plant, G(s) = 1/s, with tight limits on the manipulated variable,|u| < 0.1. Without anti-windup, the controller output rapidly saturates, and the uncompensated response shown in Fig.4.11(b)is very oscilla-tory. However with anti-windup enabled, the controlled response is much improved.

1 u 1/taui

reset

Kc gain

taud.s+1 taud/N.s+1 approx Deriv

actuator model Sum3

Sum2

Sum1 Manual Switch

Kc*taud

Kc*deriv

1/s Integrator

0 Constant

2 y 1 error

(a) A PID controller with anti-windup.

−3

−2

−1 0 1 2 3

output & setpoint

Anti−windup demonstration

Anti−windup on Anti−windup off

0 100 200 300 400 500 600 700 800 900 1000

−0.1

−0.05 0 0.05 0.1 0.15

input

time

(b) Turning on the anti-windup controller at t = 660 dramatically improves the controlled response.

Figure 4.11: The advantages of using anti-windup are evident after t = 660.

In document Advanced Control using MATLAB (Page 160-165)