Coursera Specialization on Embedding Sensors and Motors ESM_C4M1V3 Automotive Cruise Control Systems Use PID Control [1] 2012 Honda Accord on cruise control • • • Cruise control buttons on steering wheel of 2012 Honda Accord Proportional control – based on difference between setpoint and actual speed Integral control – opens the throttle more to help a car get up a hill, and helps settle the car into correct speed Derivative control – senses deceleration uphill to open throttle early, senses acceleration on steep downhills and may downshift the cars (on later models) Loop Control Definitions: Proportional Error (e) up(t) Time Domain up(t) = Kp e(t) KI [2] from sensor KD Sensor • • • • Proportional (P) control: output = gain x error Large P gain lets the output catch up quickly to setpoint Setting the P gain too high causes overshoot Loop output is negligible when P gain error is small Laplace Domain Up(s) = Kp E(s) Proportional Control for Series RLC Circuit output Laplace transform for natural solution: s2 + (R/L) s + 1/LC = 0 [3] input Plant model P(s) for 2nd order plant: Gp(s) = output / input = Vc(s) / Vs(s) Gp(s) = (1/LC) / (s2 + (R/L) s + 1/LC) substituting: ωn = 1 / √LC and α = R/L ωn2 = 1 / LC s2 + (R/L) s + 1/LC) = s2 + αωns + wn2= 0 Gp(s) = ωn2 / (s2 + αωns + wn2 ) Proportional Control for Series RLC Circuit Plant model for 2nd order plant: Gp(s) = ωn2 / (s2 + αωns + wn2 ) [3] (RLC Circuit) [4] Sensor Controller model: U(s) = Up(s) E(s) U(s) = Kp E(s) Transfer Functions for Proportional Control of Series RLC Circuit (RLC Circuit) [4] Sensor Plant model: Gp(s) = ωn2 / (s2 + αωns + wn2 ) Controller model: Gc(s) = U(s)/ E(s) = Kp Open Loop Transfer Function: Gp(s)Gc(s) = wn2 Kp / (s2 + αωns + wn2 ) Closed Loop Transfer Function = G(s) = Gp(s)Gc(s)/(1 + Gp(s)Gc(s)) Closed Loop Transfer Function for Proportional Control of Series RLC Circuit (RLC Circuit) [4] Sensor Closed Loop G(s) = [wn2 Kp / (s2 + αωns + wn2 )] / [1 + (wn2 Kp / (s2 + αωns + wn2 )] = wn2 Kp / (s2 + αωns + (1 + Kp) wn2 ) [5] • • α α As Kp is increased, the closed loop natural frequency increases and the closed loop damping ratio decreases Setting Kp too high causes overshoot Steady State Error for Proportional Control of Series RLC Circuit G(s) = closed loop transfer α [6] R = step input Ess = steady state error Ess(s) = lim(s→0) R – R G(s) = R ( 1 – Kp / (1 + Kp) = R / (1 + Kp) • • • No way to reduce error to zero using solely proportional gain This would result in a steady-state offset error = R / (1 + Kp) You can reduce the error by making Kp large, but then you get overshoot Loop Control Definitions: Integral Error (e) KI [2] from sensor ui(t) KD Sensor • • • • • • Integral (I) control: output = gain x integral of the error The loop stores all measured error (∫ε), positive or negative Functions best when absolute error is kept very small Acts to reduce error to zero or very close Control loop action at steady state is due to integral control Contributes strongly to overshoot of the setpoint, needs differential control to offset this effect Time Domain ui (t) = Ki ∫ 0 t e (t) dt Laplace Domain Ui(s) = (Ki / s) E(s) Loop Control Definitions: Differential Error (e) KI [2] from sensor KD ud(t) Sensor • • • • • • Differential (D) control: output = gain x derivative of the error Time Domain Looks at the rate of change of the error ud (t) = Kd d/dt e (t) The more error changes or the longer the derivative time, the larger the derivative factor becomes. When error is large, the P and the I terms increase the output u(t) Laplace Domain Ud(s) = (Kd s) E(s) and this aggressive response can cause overshoot The derivative then acts more aggressively to reduce the overshoot Relative Effects of P, I, and D Control [7] High gain in proportional control reduces the error quickly, but causes overshoot High gain in integral control corrects errors faster, but you need derivative control to prevent overshoot Modest derivative control resolves overshoot, but excessive derivative control can lead to system instability PID Control for Series RLC Circuit [6] Plant model : Gp(s) = ωn2 / (s2 + 2αωns + wn2 ) (RLC Circuit) [4] Laplace transform for natural solution: s2 + (R/L) s + 1/LC = 0 substituting in: ωN = 1 / √LC α = R/L gives: s2 + 2αωns + wn2= 0 Controller model: U(s) = (Up(s) + Ui(s) + Ud(s)) x E(s) U(s) = (Kp + Ki / s + Kd s ) x E(s) Open Loop Transfer Function for PID Control of Series RLC Circuit (RLC Circuit) [4] Plant model: Gp(s) = ωn2 / (s2 + αωns + wn2 ) Controller model: Gc(s) = U(s)/ E(s) = (Kp + Ki / s + Kd s) Open Loop Transfer Function: Gp(s)Gc(s) = ωn2 (Kp + Ki / s + Kd s) / (s2 + αωns + wn2 ) multiply by s / s Gp(s)Gc(s) = ωn2 (Kp s + Ki + Kds2 ) / s (s2 + αωns + wn2 ) Closed Loop Transfer Function for PID Control of Series RLC Circuit Open Loop Transfer Function: Gp(s)Gc(s) = (Kp s + Ki + Kds2)/ s (s2 + αω + wn2 ) Closed Loop Transfer Function = G(s) = Gp(s)Gc(s)/(1 + Gp(s)Gc(s)) G α α α • • • • • • The closed loop transfer function is a third order system with two zeros Kp, Ki, and Kd give complete control over the three poles of the system This equation can be solved analytically using an iterative approach First, let Ki = 0 and reduce the third order equation to second order Then, solve for Kp and Kd to give satisfactory rise time and overshoot specs Then, adjust Ki until a satisfactory setting time is met [8] Tuning the PID Controller for a Plant Model [9] • First, let Ki = 0 and reduce the third order equation to second order • Then, solve for Kp and Kd to give satisfactory rise time and overshoot specs • Then, adjust Ki until a satisfactory setting time is met Ziegler Nichols Method for Tuning the PID Controller for a Plant Model [10] • Created in 1942 by John G. Ziegler and Nathaniel B. Nichols of Taylor Instruments • For PID control set Ki and Kd to zero, and increase Kp until the loop output oscillates • Second, document critical gain Kc and the period of output Pc • Third, adjust Kp to 0.6Kc, Ki to 2Kp/Pc, and Kd to KpPc/8 • Adequate for loops where stability is achieved after ¼ wavelength of time • Most common manual tuning method for all types of controllers Citations [1] www.motortrend.com [2][7][10] www.machinedesign.com [3] www.slideplayer.net [4] www.elprocus.com [5][6][8] www.maplesoft.com [9] www.slideshare.net ESM_C4M1V3 ESM_C4M1V3 ESM_C4M1V3