• No results found

Closed loop tuning methods

In document Advanced Control using MATLAB (Page 177-181)

The PID controller

4.6 PID tuning methods

4.6.2 Closed loop tuning methods

The main disadvantage of the open loop tuning methods is that it is performed with the controller switched to manual, i.e. leaving the output uncontrolled in open loop. This is often unreason-able for systems that are openloop unstunreason-able, and impractical for plants where there is a large invested interest, and the operating engineers are nervous. The Ziegler-Nichols continuous cy-cling method described next is a well-known closed loop tuning strategy used to address this problem, although a more recent single response strategy given later in §4.6.3is faster, safer, and easier to use.

Ziegler-Nichols continuous cycling method

The Ziegler-Nichols continuous cycling method is one of the best known closed loop tuning strategies. The controller is left on automatic, but the reset and derivative components are turned off. The controller gain is then gradually increased (or decreased) until the process output contin-uously cycles after a small step change or disturbance. At this point, the controller gain you have selected is the ultimate gain, Ku, and the observed period of oscillation is the ultimate period, Pu.

Ziegler and Nichols originally suggested in 1942 PID tuning constants as a function of the ulti-mate gain and ultiulti-mate period as shown in the first three rows of Table4.4. While these values give near-optimum responses fort load changes, practical experience and theoretical consider-ations (i.e. [15,29]) have shown that these tuning values tend to give responses that are too oscillatory for step-point changes due to the small phase margin. For this reason, various people have subsequently modified the heuristics slightly as listed in the remaining rows of Table4.4 which is expanded from that given in [178, p318].

Table 4.4: Various alternative ‘Ziegler-Nichols’ type PID tuning rules as a function of the ultimate gain, Ku, and ultimate period, Pu.

Response type PID constants

Kc τi τd

Ziegler-Nichols

P 0.5Ku – –

PI 0.45Ku Pu/1.2 –

PID 0.6Ku Pu/2 Pu/8

Modified ZN

No overshoot 0.2Ku Pu/2 Pu/2 Some overshoot 0.33Ku Pu/2 Pu/3

Tyreus-Luyben

PI 0.31Ku 2.2Pu

PID 0.45Ku 2.2Pu Pu/6.3

Chien-Hrones-Reswick PI 0.47Ku 1 –

Astr ¨om-H¨agglund˚ PI 0.32Ku 0.94 –

Specified phase-margin, φm PID Kucos(φm) f τd Eqn.4.56

Experience has shown that the Chien-Hrones-Reswick values give an improved response on the original Ziegler-Nichols, but the ˚Astr ¨om-H¨agglund tend, like the ZN, to be overly oscillatory.

While the Tyreus-Luyben values deliver very sluggish responses, they exhibit very little over-shoot and are favoured by process engineers for that reason.

Algorithm4.1summarises the ZN ultimate oscillation tuning procedure.

Algorithm 4.1 Ziegler-Nichols closed loop PID tuning

To tune a PID controller using the closed-loop Ziegler-Nichols method, do the following:

1. Connect a proportional controller to the plant to be controlled. I.e. turn the controller on automatic, but turn off the derivative and integral action. (If your controller uses integral time, you will need to set τito the maximum allowable value.)

2. Choose a trial sensible controller gain, Kcto start.

3. Disturb the process slightly and record the output.

4. If the response is unstable, decrease Kc and go back to step3, otherwise increase Kcand repeat step 3until the output response is a steady sinusoidal oscillation. Once a gain Kc

has been found to give a stable oscillation proceed to step5.

5. Record the current gain, and measure the period of oscillation in time units (say seconds).

These are the ultimate gain, Kuand corresponding ultimate period, Pu. 6. Use Table4.4to establish the P, PI, or PID tuning constants.

7. Test the closed loop response with the new PID values. If the response is not satisfactory, further manual ‘fine-tuning’ may be necessary.

This method has proved so popular, that automatic tuning procedures have been developed that are based around this theory as detailed in chapter7. Despite the fact that this closed loop test is difficult to apply experimentally, gives only marginal tuning results in many cases, it is widely used and very well known. Much of the academic control literature uses the Z-N tuning method as a basis on which to compare more sophisticated schemes but often conveniently forgetting in the process that the Z-N scheme was really developed for load disturbances as opposed to set-point changes. Finally many practicing instrument engineers (who are the ones actually tuning the plant) know only one formal tuning method— this one.

Consequently it is interesting to read the following quote from a review of a textbook in Process control:4 “ . . . The inclusion of tuning methods based on the control loop cycling (Ziegler-Nichols method) without a severe health warning to the user reveals a lack of control room experience on behalf of the author. ”

Ziegler-Nichols continuous cycling example

Finding the ultimate gain and frequency in practice requires a tedious ‘trial-and-error’ approach.

If however, we already have the model of the process, say in the form of a transfer function, then establishing the critical frequency analytically is much easier, although we may still need to solve a nonlinear algebraic equation.

Suppose we have identified a model of our plant as

G(s) = 1

6s2+ 7s + 1e−3s (4.26)

4Review of A Real-Time Approach to Process Control by Svrcek, Mahoney & Young, reviewed by Patrick Thorpe in The Chemical Engineer, January 2002, p30.

and we want to control this plant using a PID controller. To use Ziegler-Nichols settings we need to establish the ultimate frequency, ωu, where the angle of G(s = iωu) =−π radians, or solve the nonlinear expression

6 G(iωu)=−π (4.27)

for ωu. In the specific case given in Eqn.4.26, we have

6 e−3iωu6 1−6ωu2+7iωu=−π

−3ωu− tan−1

 7ωu

1− 6ω2u



=−π (4.28)

which is a non-trivial function of ultimate frequency, ωu. However it is easy to graph this relation as a function of ωu and look for zero crossing such as shown in Fig. 4.21, or use a numerical technique such as Newton-Rhapson to establish that ωu ≈ 0.4839 rad/s implying an ultimate period of Pu= 2π/ωu= 12.98 seconds per cycle.

0 0.2 0.4 0.6 0.8 1

−2

−1 0 1 2 3

ω

−3 w−atan2(7 w,1−6 w2)+π

f(ω)

Figure 4.21: Solving F (ω) = 0 for the ultimate frequency. In this case the ul-timate frequency is ωu≈ 0.48 rad/s.

A quick way to numerically solve Eqn.4.28is to first define an anonymous function and then to usefzeroto find the root.

1 >> F = @(w) -3*w - atan2(7*w,1-6*w.ˆ2)+pi; % F (ω) =−3ω − tan−1

1−6ω2

+ π

>> ezplot(F,[0 1]) %See Fig.4.21.

>> wu = fzero(F,0.1) %Solve F (ω) = 0 for ω wu =

0.4839

Once we have found the critical frequency, ωu, we can establish the magnitude at this frequency by substituting s = iωuinto the process transfer function, Eqn.4.26,

|G(iωu)| = |G(0.48i)| ≈ 0.2931

which gives a critical gain, Ku= 1/0.2931 = 3.412. An easy way to do this calculation in MATLAB

is to simply usebodeat a single frequency, as in

>> [M,ph] = bode(G,wu) %Compute G(s = jωu), should obtain φ =−180, and Ku. M =

0.2931 ph =

10 -180.0000

Now that we have both the ultimate gain and frequency we can use the classic Zielger-Nichols rules in Table4.4to obtain our tuning constants and simulate the controlled process as shown in Fig.4.22.

−0.2

Figure 4.22: The step and load responses of a P (left) and PI (middle) and PID (right) controlled process using the closed loop Ziegler-Nichols suggestions from Table4.4.

The tuned response to both a setpoint change and a load disturbance at t = 100 of all three candidates shown in Fig.4.22is reasonable, but as expected the P response exhibits offset, and the PI is sluggish. We would expect a good response from the PID controller because the actual plant model structure (second order plus deadtime), is similar to the assumed model structure by Ziegler and Nichols, which is first order plus deadtime. However while it could be argued that the step response is still too oscillatory, the response to the load disturbance is not too bad.

In the very common case of a first order plus deadtime structure, Eqn.4.25, we can find the ultimate frequency by solving the nonlinear equation

− θωu− tan−1(τ ωu) + π = 0 (4.29)

for ωu, and then calculate the ultimate gain from a direct substitution Ku= 1

|G(iωu)| =

√1 + τ2ω2

K (4.30)

The tedious part of the above procedure is generating the nonlinear equation in ωufor the spe-cific plant structure of interest. We can however automate this equation generation for standard polynomial transfer functions with deadtime as shown in the listing below.

[num,den] = tfdata(G,'v') %Or use: cell2mat(G.num) iodelay = G.iodelay;

%Construct the equation6 G(iω)=−π and solve for ω

15 F = @(w) angle(polyval(num,1i*w))-iodelay*w-angle(polyval(den,1i*w))+pi;

wc = fzero(F,0) % Now solve for ωc

Rather than solve for the critical frequency algebraically, we could alternatively rely on the MAT

-LABmarginroutine which tries to extract the gain and phase margins and associated frequencies for arbitrary transfer functions. Listing4.4shows how we can tune a PID controller for an arbi-trary transfer function, although note that because this strategy attempts to solve a nonlinear

expression for the critival frequency using a numerical iterative scheme, this routine is not infal-lible.

Listing 4.4: Ziegler-Nichols PID tuning rules for an arbitrary transfer function G = tf(1,conv([6 1],[1 1]),'iodelay',5); %Plant of interest G =(6s+1)(s+1)1 e−5s [Gm,Pm,Wcg,Wcp] = margin(G); %Establish critical points

20 Ku = Gm; Pu = 2*pi/Wcg; %Critical gain, Ku& period, Pu

Kc = 0.6*Ku; taui = Pu/2; taud = Pu/8; %PID tuning rules (Ziegler-Nichols) Gc = tf(Kc*[taui*taud taui 1],[taui 0]); %PID controller Kciτds2+ τis + 1)/(τis)

Note that while the use of the ultimate oscillation Ziegler-Nichols tuning strategy is generally dis-couraged by practicitioners, it is the oscillation at near instability which is the chief concern, not the general idea of relating the tuning constants to the ultimate gain and frequency. If for exam-ple, we already have a plant model in the form of a transfer function perhaps derived from first principles, or system identification techniques, then we can by-pass the potentially hazardous oscillation step, and compute directly the tuning constants as a function of ultimate gain and frequency.

In document Advanced Control using MATLAB (Page 177-181)