Part II Advanced PID Design Methods 54
Controller transfer function C(s) = k p (1 + 1 T i s + T d s) (71) Many extensions known to the basic design methods introduced in RT I. Four advanced approaches discussed here: analytical crossover specification Aström/Hägglund rules predictive control for plants with large delays numerical multicriteria optimization Vast topic! For more information see [3]. 55
1. Analytical Crossover Specifications Main idea: select {k p, T i, T d } such that the loop gain L(s) = P(s) C(s) has desired crossover frequency ω c, phase margin ϕ and slope ψ (don t forget to check that these specs are feasible!) Im -1 P(jω) ϕ ω c ψ ψ = Arg Re { dl(jω) dω } -1 L(jω) 56
Definitions: P(jω c ) = r P e j ϕ P, C(jω c ) = r C e j ϕ C, L(jω c ) = r L e j ϕ L (72) For the controller tan(ϕ C ) = 1 T i ω c + T d ω c, r C = k p cos(ϕ C ) (73) Im ω r C ω c k p ( 1 T i ωc + T dω c ) ϕ C k p Re C(jω) ω 0 57
Therefore and r L = r P r C! = 1 k p = 1 r P cos(ϕ C ) (74) ϕ L = ϕ P + ϕ C! = π + ϕ ϕ C = ϕ π ϕ P (75) The second equality is equivalent to tan(ϕ C ) = 1 T i ω c + T d ω c = tan(ϕ π ϕ P ) = tan(ϕ ϕ P ) (76) and, using (75), equation (74) can be written in the explicit form k p = 1 r P cos(ϕ π ϕ P ) = 1 r P cos(ϕ ϕ P ) (77) So far, the three parameters {k p, T i, T d } have been expressed as function of the two specifications ω c and ϕ and of the given plant parameters r P and ϕ P. The last missing equation is obtained by using the requirement on ψ. 58
Some preparations: Slope of loop gain L(jω) ω = P(jω) ω From P(jω) = r P (ω) e j ϕ P (ω) it follows C(jω) + P(jω) C(jω) ω (78) or P(jω) ω P(jω) ω = r P(ω) ω = ( rp (ω) e j ϕ P(ω) + j r P (ω) e j ϕ P (ω) ϕ P(ω) ω ω r 1 P (ω) + j ϕ ) P(ω) ω (79) P(jω) (80) Define for ω = ω c r P = r P(ω) ω ω=ωc and ϕ P = ϕ P(ω) ω (81) ω=ωc Therefore P(jω) ω = ω=ωc ( r P r 1 P + j ϕ P ) r P e j ϕ P (82) 59
( ) Similar for the controller C(jω) = k p 1 + j ( 1 T + T i ω d ω) ( ) C(jω) 1 = j k p ω T i ω + T 2 d (83) Inserting (82) and (83) into (78) yields L(jω) ( ) ω = r P r 1 P + j ϕ P r P e j ϕp k p ω=ωc +r P e j ϕp j k p ( 1 T i ω 2 c + T d ) ( ) 1 1 + j ( + T d ω c ) T i ω c (84) Rearranging and twice using (76) yields after some steps (ξ = tan(ϕ ϕ P )) [( ) ) L(jω) r ω = r P e j ϕp P k p + j ϕ P (1 + j ξ) + j (2 ] T d ξωc ω=ωc r P 60 (85)
Collect real and imaginary parts of (85) [( ) L(jω) r ω = r P e j ϕp P k p ϕ P ξ ω=ωc r P + j ( ϕ P + r P ξ + 2 T d ξ r P ω c (86) )] The argument of this expression is Arg { L(jω) ω ω=ωc } = ϕ P + arctan ϕ P + r P rp ξ + 2 T d ξ ω c r P r P ϕ P ξ! = ψ (87) From this the derivative time constant T d immediately follows [ ( ) ] T d = 1 2 r P tan(ψ ϕ P ) ϕ P ξ + ξ ϕ P r P ξ r P ω c r P (88) 61
Summarizing, for the set of specifications ω c = crossover frequency, ϕ = phase margin, ψ = slope at crossover and the parameters of the plant transfer function at crossover frequency r P = magnitude, ϕ P = phase, r P = derivative of r P, ϕ P = derivative of ϕ P the PID controller parameters {k p, T i, T d } are defined by the three equations T d = 1 2 [ tan(ψ ϕ P ) k p = 1 cos(ϕ ϕ P ) r P ( ) r P ϕ P tan(ϕ ϕ P ) + tan(ϕ ϕ P ) r P ( 1 r ω c P r P ) ϕ P ] T i = [ T d ω 2 c tan(ϕ ϕ P ) ω c ] 1 62
Implementation tips: For many plants, the derivatives r P and ϕ P finite differences. may be approximated using Solutions are not guaranteed to exist for arbitrary specs and plants. Similarly, stability is not guaranteed and has to be checked a posteriori. Always start with a reasonable first design (say Ziegler-Nichols) to obtain a feeling for the realizable crossover frequencies and phase margins. Be careful not to mix up radians and degrees (formulas shown above are valid for radians). Example P(s) = 1 s 3 + 4 s 2 + 4 s + 1 works OK for {ω c, ϕ, ψ} = {1.9, 50, 66 } (see next page), but fails for, say, ω c = 2. 63
64 P(jω), linear! Arg{P(jω)}, linear! Bode plot of plant, linear! 1.2 1 0.8 0.6 0.4 0.2 0-0.2 0 2 4 6 8 10 Frequency ω(rad/s), linear! 0-1 -2-3 -4-5 0 2 4 6 8 10 Frequency ω(rad/s), linear! y(t) Nyquist plot of loop gain L(jω) 0.5 0-0.5-1 -1.5-2 -2.5-2 -1 0 1 Closed-loop system step response 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0 2 4 6 8 10 Time t(s)
2. Aström-Hägglund Rules Extension of classical Ziegler-Nichols and Chien-Rhones-Reswick rules. Here just one set of rules using the Ziegler-Nichols critical-loop gain method. Much more in [3]. Pro memoria: 1. Set gains of PID controller to k p = small, T i = and T d = 0. 2. Increase k p until closed-loop system reaches its stability limits. 3. The parameter k p is this critical gain and the period T ist the oscillation period observed in this critical conditions. 4. Choose the controller parameters following the rules given below. 65
Aström-Hägglund tuning rules (rules adapted from [3] using the symbols of RT I and RT II): x = α 0 e α 1 κ+α 2 κ 2 (89) where κ 1 = P(0) k p and x any of the (normalized) controller parameters x = { k p /k p, T i /T, T d /T, a } (90) The parameter P(0) indicates the plant s DC gain (static gain). The coefficients α i are defined in the two table below (one for PI and one for PID controllers). The parameter µ is the minimum return difference that the loop gain should achieve (no guarantee!), i.e. µ = min ω 1 + L(j ω) 66
Aström-Hägglund parameters for PI controllers: µ min = 0.7 µ min = 0.5 x α 0 α 1 α 2 α 0 α 1 α 2 k p /kp 0.053 2.9000-2.6 0.13 1.9-1.30 T i /T 0.900-4.4000 2.7 0.90-4.4 2.70 a 1.100-0.0061 1.8 0.48 0.4-0.17 Aström-Hägglund parameters for PID controllers: µ min = 0.7 µ min = 0.5 x α 0 α 1 α 2 α 0 α 1 α 2 k p /kp 0.33-0.31-1.00 0.72-1.60 1.20 T i /T 0.76-1.60-0.36 0.59-1.30 0.38 T d /T 0.17-0.46-2.10 0.15-1.40 0.56 a 0.58-1.30 3.50 0.25 0.56-1.20 67
The Aström-Hägglund method is a generalization of the older Ziegler-Nichols ideas and often yields better overall performance. Example P(s) = 1 (s 2 + s + 1) (s 4 + 4s 3 + 6s 2 + 4s + 1) Plant of high-order but benign. Critical gain k = 1.75 and period T = 9.7. Compare performance of Ziegler-Nichols and Aström-Hägglund method. Comparison of Ziegler-Nichols and Aström-Hägglund rules. Results ZN : k p = 0.7, T i = 7.76 AH : k p = 0.208, T i = 1.706 (91) Plots see next slide (dashed Ziegler-Nichols and solid Aström-Hägglund results). 68
69 Closed-loop step response Nyquist diagram loop gain L(jω) 0.5 1 0.8 0 y(t) 0.6 0.4 imaginary part -0.5-1 0.2 0 0 10 20 30 40 50 time t(s) -1.5-1.5-1 -0.5 0 0.5 real part
3. Predictive PI Control Plants with delays are hard to control and the regular PID control structure is not well suited (in particular, the D part is not useful). For such systems use controllers that include some prediction power. Main point: no matter how complex a controller is, it will not be able to remove the delay from the system response. Accordingly, the closed-loop system behavior S(s) must include the same delay. Example: plant (or its approximation) P(s) = k τ s + 1 e T s (92) target sensitivity 1 S(s) = 1 s σ τ + 1 e s T (93) Scalar σ is the tuning parameter. 70
The controller that produces this sensitivity must include an integrator and has the following form C(s) = = 1 S(s) S(s) P(s) τ s + 1 k (σ τ s + 1 e T s ) (94) Plant inversion! Therefore, plant and target sensitivity must both be minimum phase systems. The output U(s) generated by this controller is found to be U(s) = 1 σ k (1 + 1 τ s ) E(s) 1 σ τ s (1 e T s ) U(s) (95) If no delay is present (T = 0), the resulting controller is a simple PI controller with σ the only tuning parameter that determines the dynamics of the disturbance rejection transients (recommended 0.5 < σ < 2). The second part provides the predictive correction action. 71
Block diagram C(s) P(s) r + - e + - 1 σk ( ) 1 + 1 τs u T k 1+τs y k τs+1 + - T Interpretation: The D part of a PID controller does not make sense when the plant includes delays. Therefore, replace it by a term that penalizes differences in the control action (that due to the delay eventually will become differences in plant output). 72
Closed-loop system response to step disturbance, σ = 0.5, dashed curves ±10% delay T error y(t) T = 0.9 1 2 T = 1.1 t 73
As a reference, closed-loop system responses to step disturbance when using a standard PI controller (ZN = Ziegler-Nichols design, LS = loop-shaping design) y(t) LS 1 2 t ZN 74
The generalization of the ideas presented in this section to arbitrary plants P(s) is known as a Smith Predictor. More information on these controller structures can be found in [11]. C(s) d P(s) r u y r y C r (s) P r (s) T - ˆP r (s) ŷ r ˆT - ǫ Key idea: design C r (s) as if P(s) = P r (s) (no delays present). 75
The Smith predictor approach is one example of an even larger family of control system structures known as model predictive control systems. Key idea: C(s) d r - T d (s) ˆP 1 (s) u P(s) y ˆP(s) ŷ - Plant-inversion controller! Not suitable for unstable or non-minimumphase plants, can lead to slow disturbance rejection. 76
4. Numerical Multicriteria Optimization Basic idea: fix controller structure and find optimal parameters using numerical optimization routines. Idea explained using an example. Can be extended to much more complex formulations (including nonlinear effects, etc.). Main difficulties: numerical approaches can never guarantee that a solution is optimal or even good. In the best case, only local optima can be found, but the solvers can altogether fail. Good initial guesses for the parameters to be optimized important. Example plant P(s) = 1 (s 2 + s + 1) (s 4 + 4s 3 + 6s 2 + 4s + 1) Plant of high-order but benign. Critical gain k = 1.75 and period T = 9.7. Start values for PI controller chosen according to ZN rules. 77
t r optipimaster.m defines problem initial guess of π=[k p, T i,...] calls function displays results Provided by Matlab s optimization toolbox fminsearch.m forms new π optipisys.mdl calls function J(π) optipi.m y approximates gradients nump(s) denp(s) plant numc(s) denc(s) controller J 1 s e uses π to define new controller simulated closedloop system (may include some nonlinearities) computes objective function J(π) 78
The.m file optipi.m computes the actual objective function J(k p,t i ) = µ 1 Remarks: 0 e 2 (t) dt + µ 2 max(y(t) 1) + µ 3 (1 min( 1 + L(jω) )) t ω For a step change in the reference signal r(t), the objective function penalizes the squared error integral and the maximum overshoot of the closed-loop system (time-domain behavior). In the frequency domain, the minimum return difference of the open-loop system (robustness) is maximized. The three weights µ 1,2,3 are fixed a priori and permit to decide what impact each of the penalized effect has on the objective function. They represent the design iteration parameters. Of course the integration cannot be made for t stop = ; t stop is chosen finite but must be so large that the error e(t stop ) is negligibly small. Matlab uses variable encapsulation on each subroutine level. Use the global command to exchange parameters across levels. 79
µ 1 = 1, µ 2 = 1, µ 3 = 1 k p = 0.724, T i = 4.34 (ZN : k p = 0.7, T i = 7.76) 1.6 Closed-loop step response Nyquist diagram loop gain L(jω) 0.5 1.4 1.2 0 1-0.5 y(t) 0.8 0.6-1 0.4 0.2-1.5 0 0 10 20 30 40 50-2 -1.5-1 -0.5 0 0.5 1 Time t(s) 80
µ 1 = 1, µ 2 = 1, µ 3 = 20 k p = 0.273, T i = 2.83 (ZN : k p = 0.7, T i = 7.76) 1.6 Closed-loop step response Nyquist diagram loop gain L(jω) 0.5 1.4 1.2 0 1-0.5 y(t) 0.8 0.6-1 0.4 0.2-1.5 0 0 10 20 30 40 50-2 -1.5-1 -0.5 0 0.5 1 Time t(s) 81
1 7 51 52 08 6 496 kp 5 ZN 06 6 55 7 04 3 4 5 6 7 8 Ti