Filters, Cost Functions, and Controller Structures! Robert Stengel! Optimal Control and Estimation MAE 546! Princeton University, 217!! Dynamic systems as low-pass filters!! Frequency response of dynamic systems!! Shaping system response!! LQ regulators with output vector cost functions!! Implicit model-following!! Cost functions with augmented state vector min J = min 1!u!u 2 "!x T t)q!xt) +!u T t)r!ut) dt subject to!!xt) = F!xt) + G!ut) Copyright 217 by Robert Stengel. All rights reserved. For educational use only. http://www.princeton.edu/~stengel/mae546.html http://www.princeton.edu/~stengel/optconest.html 1 First-Order Low-Pass Filter! 2
Low-Pass Filter Low-pass filter passes low-frequency signals and attenuates high-frequency signals!!x t) = "a!x t) + a!u t) a =.1, 1, or 1 Laplace transform, x) =!x s) = a s + a)!u s) Frequency response, s = j!!x j" ) = a!u j" j" + a) 3 Response of 1 st -Order Low-Pass Filters to Step Input and Initial Condition!!x t) = "a!x t) + a!u t) a =.1, 1, or 1 Smoothing effect on sharp changes 4
Frequency Response of Dynamic Systems! 5 Response of 1 st -Order Low-Pass Filters to Sine-Wave Inputs Input Output!u t) = " sin t sin 2t sin 4t!x t) =!1x t) + 1u t)!x t) =!x t) + u t)!x t) =!.1x t) +.1u t) 6
Response of 1 st -Order Low- Pass Filters to White Noise!!x t) = "a!x t) + a!u t) a =.1, 1, or 1 7 Relationship of Input Frequencies to Filter Bandwidth!u t) = sin "t sin 2"t sin 4"t BANDWIDTH Input frequency at which magnitude = 3dB How do we calculate frequency response? 8
Bode Plot Asymptotes, Departures, and Phase Angles for 1 st -Order Lags H red j! ) = 1 j! +1! General shape of amplitude ratio governed by asymptotes! Slope of asymptotes changes by multiples of ±2 db/dec at poles or zeros! Actual AR departs from asymptotes! AR asymptotes of a real pole! When! =, slope = db/ dec! When!, slope = 2 db/ dec H blue j! ) = 1 j! +1 H green j! ) = 1 j! +1! Phase angle of a real, negative pole! When! =, " =! When! =, " = 45! When! -> ", " -> 9 9 2 nd -Order Low-Pass Filter!!!x t) = "2 n!!x t) " 2 n!x t) + 2 n!u t) Laplace transform, I.C. =!x s) = " n 2 s 2 + 2" n s + " n 2!u s Frequency response, s = j!!x j" ) = " n 2 j" ) 2 + 2" n j"! H j" )!u j" 2 + " n!u j" ) 1
2 nd -Order Step Response Increased damping decreases oscillatory over/undershoot Further increase eliminates oscillation 11 Amplitude Ratio Asymptotes and Departures of Second-Order Bode Plots No Zeros)! AR asymptotes of a pair of complex poles! When! =, slope = db/dec! When!! n, slope = 4 db/ dec! Height of resonant peak depends on damping ratio 12
Phase Angles of Second-Order Bode Plots No Zeros)! Phase angle of a pair of complex negative poles! When! =, " =! When! =! n, " = 9! When! -> ", " -> 18! Abruptness of phase shift depends on damping ratio 13 Transformation of the System Equations Time-Domain System Equations!!xt) = F!xt) + G!ut)!yt) = H x!xt) + H u!ut) Laplace Transforms of System Equations s!xs) "!x) = F!xs) + G!us) [ ]!xs) = [ si " F] "1!x) + G! us)!ys) = H x!xs) + H u!us) 14
Transfer Function Matrix Laplace Transform of Output Vector!ys) = H x!xs) + H u!us) = H x [ si " F] "1 [!x) + G!us)]+ H u!us) "1 G + H u = H x si " F!us) + H si " F x = Control Effect + Initial Condition Effect Transfer Function Matrix relates control input to system output with H u = and neglecting initial condition H s) = H x [ ] "1!x) [ si! F]!1 G r x m) 15 Scalar Frequency Response from Transfer Function Matrix Transfer function matrix with s = j! H j! ) = H x!y i s!u j s [ j!i " F] "1 G r x m) = H ij j" ) = H xi [ j"i F] 1 G j r x m) H xi = i th row of H x G j = j th column of G 16
Second-Order Transfer Function Second-order dynamic system!!x t) = "!!x 1 t)!!x 2 t) = " f 11 f 12 f 21 f 22!y t) = "!y 1 t!y 2 t "!x 1 t!x 2 t = " h 11 h 12 h 21 h 22 + " g 11 g 12 g 21 f 22 "!x 1 t!x 2 t "!u 1 t!u 2 t Second-order transfer function matrix! adj! h H s) = H x A 11 h 12 s)g = " h 21 h " 22 det r! n) n! n) n! m) n = m = r = 2) = r! m) = 2! 2) s f 11 ) f 12 f 21 s f 22 s f 11 ) f 12 f 21 s f 22 + -, -! " g 11 g 12 g 21 f 22 17 Scalar Transfer Function from!u j to!y i H ij s) = k ijn ij s)!s) = k ij s q + b q"1 s q"1 +...+ b 1 s + b s n + a n"1 s n"1 +...+ a 1 s + a Just one element of the matrix, Hs) Denominator polynomial contains n roots Each numerator term is a polynomial with q zeros, where q varies from term to term and n 1 ij s! z 2 ) ij... s! z q s! " 2 )... s! " n ) = k ij s! z 1 s! " 1 ij zeros = q poles = n 18
Scalar Frequency Response Function H ij j! ) = k ij j! " z 1 j! " 1 Substitute: s = j" ij ij j! " z 2 ) ij... j! " z q j! " 2 )... j! " n ) j! ) = a!)+ jb!) " AR!) e Frequency response is a complex function of input frequency,! Real and imaginary parts, or Amplitude ratio and phase angle 19 MATLAB Bode Plot with asymp.m http://www.mathworks.com/matlabcentral/ http://www.mathworks.com/matlabcentral/fileexchange/1183-bode-plot-with-asymptotes 2 nd -Order Pitch Rate Frequency Response, with zero bode.m asymp.m 2
Desirable Open-Loop Frequency Response Characteristics Bode)! High gain amplitude) at low frequency! Desired response is slowly varying! Low gain at high frequency! Random errors vary rapidly! Crossover region is problem-specific 21 Examples of Proportional LQ Regulator Response! 22
Example: Open-Loop Stable and Unstable 2 nd -Order LTI System Response to Initial Condition " F S = " F U = 1!16!1 1!16 +.5 Stable Eigenvalues = -.5 + 3.9686i -.5-3.9686i Unstable Eigenvalues =.25 + 3.9922i.25-3.9922i 23 Example: Stabilizing Effect of Linear- Quadratic Regulators for Unstable 2 nd -Order System min!u J = min!u 1 2 "!x 2 1 +!x 2 2 + r!u 2 )dt ) For the unstable system!ut) = " c 1 c 2 r = 1 Control Gain C) =.262 1.857 Riccati Matrix S) = 2.21.291.291.126!x 1 t)!x 2 t) = "c!x t) " c!x t) 1 1 2 2 r = 1 Control Gain C) =.28.1726 Riccati Matrix S) = 3.7261.312.312 1.9183 Closed-Loop Eigenvalues = -6.461-2.8656 Closed-Loop Eigenvalues = -.5269 + 3.9683i -.5269-3.9683i 24
Example: Stabilizing/Filtering Effect of LQ Regulators for the Unstable 2 nd - Order System r = 1 Control Gain C) =.262 1.857 Riccati Matrix S) = 2.21.291.291.126 Closed-Loop Eigenvalues = -6.461-2.8656 r = 1 Control Gain C) =.28.1726 Riccati Matrix S) = 3.7261.312.312 1.9183 Closed-Loop Eigenvalues = -.5269 + 3.9683i -.5269-3.9683i 25 Example: Open-Loop Response of the Stable 2 nd -Order System to Random Disturbance Eigenvalues = -1.1459, -7.8541 26
Example: Disturbance Response of Unstable System with Two LQRs 27 LQ Regulators with Output Vector Cost Functions! 28
Quadratic Weighting of the Output!yt) = H x!xt) + H u!ut) J = 1 2 = 1 2 "!y T t)q y!yt) dt {[ H x!xt) + H u!ut)] T Q y [ H x!xt) + H u!ut)]}dt 29 Quadratic Weighting of the Output min J = min 1 / )"!u!u 2 +! min 1!u 2 / )" +!x T t)!u T t)!x T t)!u T t) " " H T x Q y H x H T x Q y H u H T u Q y H x H T u Q y H u + R o Q O M O M O T " "!xt), -dt R O + R o!ut).!xt)!ut), -dt.!ut) = " R O + R o ) "1 M T O + G T O P SS!x t) = "C!x t) 3
min!u State Rate Can Be Expressed as an Output to be Minimized J = 1 "!y T t)q y!yt) 2 dt = 1 2!!xt) = F!xt) + G!ut)!yt) = H x!xt) + H u!ut) " F!xt) + G!ut) "!!x T t)q y!!xt) dt min!u J = min!u! min!u 1 2 1 2 / / )" + )" + " F T Q!x T t)!u T t) y F G T Q y F!x T t)!u T t) "!ut) = " R SR + R o ) "1 M T SR + G T SR P SS!x t) = "C!x t) Q SR T M SR Special case of output weighting F T Q y G "!xt), -dt G T Q y G + R o!ut). M SR "!xt), -dt R SR + R o!ut). 31 Implicit Model-Following LQ Regulator Simulator aircraft dynamics!!xt) = F!xt) + G!ut) Ideal aircraft dynamics!!x M t) = F M!x M t) Feedback control law to provide dynamic similarity!ut) = "C IMF!x t) Princeton Variable- Response Research Aircraft F-16 Another special case of output weighting 32
Implicit Model-Following LQ Regulator Assume state dimensions are the same!!xt) = F!xt) + G!ut)!!x M t) = F M!x M t) If simulation is successful,!x M t) "!xt) and!!x M t) " F M!xt) 33 min!u J = min!u! min!u Implicit Model-Following LQ Regulator Cost function penalizes difference between actual and ideal model dynamics 1 2 1 2 1 1 ) + " +, ) + ",+ J = 1 2!xt)!xt) {[!!xt) "!!x M t)] T Q M [!!xt) "!!x M t)]}dt!ut) T " F F M ) T Q M F F M G T Q M T " Q!ut) IMF M IMF T M IMF R IMF + R o F F M ) T Q M G F F M ) G T Q M G + R o "!xt) - +. dt!ut) /+ Therefore, ideal model is implicit in the optimizing feedback control law "!xt) - +. dt!ut) + /!ut) = " R IMF + R o ) "1 M T IMF + G T IMF P SS!x t) = "C!x t) 34
Cost Functions with Augmented State Vector! 35 Integral Compensation Can Reduce Steady-State Errors!! Sources of Steady-State Error!! Constant disturbance!! Errors in system dynamic model!! Selector matrix, H I, can reduce or mix integrals in feedback!!xt) = F!xt) + G!ut)!"! t) = H I!xt)!!xt)!! " t = F G H I!xt)!" t + G!ut) 36
!ut) = "C B!x t! "C B!x t LQ Proportional- Integral PI) Control t " C I H I!x " C I! t) d where the integral state is!" t t! H I!x dim H I d = m n define!" t)!!x t! t ) ) 37 Integral State is Added to the Cost Function and the Dynamic Model min J = min 1!u!u 2 = min!u 1 2!x T t)q x!xt) +!" T t)q!" t "!) T t) subject to!ut) = "R "1 G T = "C B!x t +!u T t)r!ut) Q x + Q " +!)t) +!ut t)r!ut) + + dt!!)t) = F )!)t) + G )!ut) " C I! t) P SS!t) = "C!t) dt 38
Integral State is Added to the Cost Function and the Dynamic Model!ut) = "C!t) = "C B!x t!us) = "C!s) = "C B!x s = "C B!x s [ ]!us) = " C s + C H B I x s " C I! t) " C I! s) H " C x!x s) I!x s) s Controller Bode Plots: Integrator plus numerator matrix of zeros 39 Actuator Dynamics and Proportional-Filter LQ Regulators! 4
Actuator Dynamics May Impact System Response 41 Actuator Dynamics May Affect System Response!!xt) = F!xt) + G!ut) Augment state dynamics to include actuator dynamics!!ut) = "K!ut) +!vt) "!!xt) " F G =!!ut) K "!xt) " +!ut) Control variable is actuator forcing function I v!vt) 42
LQ Regulator with Actuator Dynamics 1 min J = min!v!v 2 Re-define state and control vectors 1 = min!v 2!"t)! "!x T t)q x!xt) +!u T t)r u!ut) +!v T t)r v!vt) dt " " )! T t)) ) )!xt)!ut) F! F G " )K Q x R u ;!v t) = Control ; G! " I v!t) +!vt t)r v!vt) dt subject to!!"t) = F "!"t) + G "!vt) 43 LQ Regulator with Actuator Dynamics!vt) = "C!t) = "R v "1 = "C B!x t) " C A!ut) I v T PSS!x t)!ut) ) )!vs) = "C B!x s) " C A!us) 44
LQ Regulator with Actuator Dynamics!!ut) = "K!ut) " C A!ut) " C B!x t s!us) = "K!us) " C A!us) " C B!x s Control Displacement!" si + K + C A ) us) = C B x s) 1 us) =!" si + K + C A ) CB x s) 45 LQ Regulator with Artificial Actuator Dynamics LQ control variable is derivative of actual system control "!!xt)!!ut) = " F G "!xt)!ut) + " I!vt)!vt) =!!u Int t) = "C B!x t) " C A!ut) C A introduces artificial actuator dynamics 46
Proportional-Filter PF) LQ Regulator!"t) =!xt)!ut) ; F = F G " ; G = " I Optimal LQ Regulator!vt) =!!u Integrator t) = "C!t) C A provides low-pass filtering effect on the control input!us) = "[ si + C A ] "1 C B!x s) 47 Proportional LQ Regulator: High- Frequency Control in Response to High-Frequency Disturbances 2nd-Order System Response with Perfect Actuator Good disturbance rejection, but high bandwidth may be unrealistic 48
Proportional-Filter LQ Regulator Reduces High-Frequency Control Signals 2nd-Order System Response... at the expense of decreased disturbance rejection 49 Next Time:! Linear-Quadratic Control System Design! 5
Supplemental Material 51 Princeton Variable-Response Research Aircraft VRA) 52
Aircraft That Simulate Other Aircraft!! Closed-loop control Variable-stability research aircraft, e.g., TIFS, AFTI F-16, NT-33A, and Princeton Variable-Response Research Aircraft Navion) USAF/Calspan TIFS USAF AFTI F-16 USAF/Calspan NT-33A Princeton VRA 53