1. s to Z-Domain Transfer Function 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. Get step response of continuous transfer function ys(t). 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. Get step response of continuous transfer function ys(t). 2. Discretize step response: ys(nTs). 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. Get step response of continuous transfer function ys(t). 2. Discretize step response: ys(nTs). 1. Z-transform the step response to obtain Ys(z). 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. Get step response of continuous transfer function ys(t). 2. Discretize step response: ys(nTs). 1. Z-transform the step response to obtain Ys(z). 2. Divide the result from above by Z-transform of a step, namely, z/(z − 1). 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. Z-transform the step response to obtain Ys(z). 2. Divide the result from above by Z-transform of a step, namely, z/(z − 1). 1. Get step response of continuous trans- • Ga(s): Laplace transfer function fer function ys(t). 2. Discretize step response: ys(nTs). 1. s to Z-Domain Transfer Function Discrete ZOH Signals 1. Z-transform the step response to obtain Ys(z). 2. Divide the result from above by Z-transform of a step, namely, z/(z − 1). 1. Get step response of continuous trans- • Ga(s): Laplace transfer function fer function ys(t). 2. Discretize step re- • G(z): Z-transfer function sponse: ys(nTs). 1. s to Z-Domain Transfer Function 1. Z-transform the step response to obtain Ys(z). 2. Divide the result from above by Z-transform of a step, namely, z/(z − 1). Discrete ZOH Signals 1. Get step response of continuous trans- • Ga(s): Laplace transfer function fer function ys(t). 2. Discretize step re- • G(z): Z-transfer function sponse: ys(nTs). G(z) = z−1 z −1 Ga (s) Z L s 1. s to Z-Domain Transfer Function 1. Z-transform the step response to obtain Ys(z). 2. Divide the result from above by Z-transform of a step, namely, z/(z − 1). Discrete ZOH Signals 1. Get step response of continuous trans- • Ga(s): Laplace transfer function fer function ys(t). 2. Discretize step re- • G(z): Z-transfer function sponse: ys(nTs). G(z) = z−1 −1 Ga (s) Z L z Step Response Equivalence s 1. s to Z-Domain Transfer Function 1. Z-transform the step response to obtain Ys(z). 2. Divide the result from above by Z-transform of a step, namely, z/(z − 1). Discrete ZOH Signals 1. Get step response of continuous trans- • Ga(s): Laplace transfer function fer function ys(t). 2. Discretize step re- • G(z): Z-transfer function sponse: ys(nTs). G(z) = z−1 −1 Ga (s) Z L z s Step Response Equivalence = ZOH Equivalence Digital Control 1 Kannan M. Moudgalya, Autumn 2007 2. Important Result from Differentiation 2. Important Result from Differentiation Recall 1(n)an ↔ z z−a Differentiating w.r.t. a, = ∞ X n=0 anz −n, 2. Important Result from Differentiation Recall 1(n)an ↔ z z−a Differentiating w.r.t. a, z = ∞ X anz −n, n=0 ∞ X n−1z −n = na (z − a)2 n=0 2. Important Result from Differentiation Recall 1(n)an ↔ z z−a Differentiating w.r.t. a, z = ∞ X anz −n, n=0 ∞ X n−1z −n = na (z − a)2 n=0 z n−1 na 1(n) ↔ (z − a)2 2. Important Result from Differentiation Recall 1(n)an ↔ z z−a Differentiating w.r.t. a, = ∞ X anz −n, n=0 ∞ X z n−1z −n = na (z − a)2 n=0 z n−1 na 1(n) ↔ (z − a)2 2z n−2 n(n − 1)a 1(n) ↔ (z − a)3 Digital Control 2 Kannan M. Moudgalya, Autumn 2007 3. ZOH Equivalence of 1/s 3. ZOH Equivalence of 1/s The step response of 1/s is 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L s2 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, ys(nTs) = 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, ys(nTs) = nTs 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, ys(nTs) = nTs Taking Z-transforms Ys(z) = 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, ys(nTs) = nTs Taking Z-transforms Ts z Ys(z) = (z − 1)2 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, ys(nTs) = nTs Taking Z-transforms Ts z Ys(z) = (z − 1)2 Divide by z/(z −1), 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, ys(nTs) = nTs Taking Z-transforms Ts z Ys(z) = (z − 1)2 Divide by z/(z −1), to get the ZOH equivalent discrete domain transfer function 3. ZOH Equivalence of 1/s The step response of 1/s is 1/s2. In time domain, it is, 1 −1 ys(t) = L =t 2 s Sampling it with a period of Ts, Taking Z-transforms Ts z Ys(z) = (z − 1)2 Divide by z/(z −1), to get the ZOH equivalent discrete domain transfer function Ts G(z) = z−1 ys(nTs) = nTs Digital Control 3 Kannan M. Moudgalya, Autumn 2007 4. ZOH Equivalence of 1/s2 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 1/s3. 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 1/s3. In time domain, it is, 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 1/s3. In time domain, it is, 1 −1 ys(t) = L = 3 s 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 1/s3. In time domain, it is, 1 1 2 −1 ys(t) = L = t . 3 s 2 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 1/s3. In time domain, it is, 1 1 2 −1 ys(t) = L = t . 3 s 2 Sampling it with a period of Ts, 1 2 2 ys(nTs) = n Ts 2 4. ZOH Equivalence of 1/s2 The step response of Take Z-transform 1/s2 is 1/s3. In time domain, it is, 1 1 2 −1 ys(t) = L = t . 3 s 2 Sampling it with a period of Ts, 1 2 2 ys(nTs) = n Ts 2 4. ZOH Equivalence of 1/s2 The step response of Take Z-transform 1/s2 is 1/s3. In time Ts2z(z + 1) Ys(z) = domain, it is, 2(z − 1)3 1 1 2 −1 ys(t) = L = t . 3 s 2 Sampling it with a period of Ts, 1 2 2 ys(nTs) = n Ts 2 4. ZOH Equivalence of 1/s2 The step response of 1/s2 is 1/s3. In time domain, it is, 1 1 2 −1 ys(t) = L = t . 3 s 2 Sampling it with a period of Ts, 1 2 2 ys(nTs) = n Ts 2 Digital Control 4 Take Z-transform Ts2z(z + 1) Ys(z) = 2(z − 1)3 Dividing by z/(z − 1), we get G(z) = Ts2(z + 1) 2(z − 1)2 Kannan M. Moudgalya, Autumn 2007 5. ZOH Equivalent First Order Transfer Function 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). " # 1 1 1 K =K − Ys(s) = sτs + 1 s s + τ1 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). " # 1 1 1 K =K − Ys(s) = sτs + 1 s s + τ1 h i ys(t) = K 1 − e−t/τ , t ≥ 0 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). " # 1 1 1 K =K − Ys(s) = sτs + 1 s s + τ1 h i ys(t) = K 1 − e−t/τ , t ≥ 0 h i −nTs /τ ys(nTs) = K 1 − e , n≥0 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). " # 1 1 1 K =K − Ys(s) = sτs + 1 s s + τ1 h i ys(t) = K 1 − e−t/τ , t ≥ 0 h i −nTs /τ ys(nTs) = K 1 − e , n≥0 Ys(z) = K z z−1 − z z − e−Ts/τ 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). " # 1 1 1 K =K − Ys(s) = sτs + 1 s s + τ1 h i ys(t) = K 1 − e−t/τ , t ≥ 0 h i −nTs /τ ys(nTs) = K 1 − e , n≥0 Ys(z) = K z z−1 − z z − e−Ts/τ = Kz(1 − e−Ts/τ ) (z − 1)(z − e−Ts/τ ) 5. ZOH Equivalent First Order Transfer Function Find the ZOH equivalent of K/(τ s + 1). " # 1 1 1 K =K − Ys(s) = sτs + 1 s s + τ1 h i ys(t) = K 1 − e−t/τ , t ≥ 0 h i −nTs /τ ys(nTs) = K 1 − e , n≥0 Ys(z) = K z z−1 − z z − e−Ts/τ = Kz(1 − e−Ts/τ ) (z − 1)(z − e−Ts/τ ) Dividing by z/(z − 1), we get G(z) = Digital Control K(1 − e−Ts/τ ) z − e−Ts/τ 5 Kannan M. Moudgalya, Autumn 2007 6. ZOH Equivalent First Order Transfer Function - Example 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 and find ZOH equivalent trans. function of 10 Ga(s) = 5s + 1 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 and find ZOH equivalent trans. function of 10 Ga(s) = 5s + 1 Scilab Code: 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 and find ZOH equivalent trans. function of 10 Ga(s) = 5s + 1 Scilab Code: Ga = tf(10,[5 1]); 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 and find ZOH equivalent trans. function of 10 Ga(s) = 5s + 1 Scilab Code: Ga = tf(10,[5 1]); G = ss2tf(dscr(Ga,0.5)); 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 Scilab output is, and find ZOH equivalent trans. function of 10 Ga(s) = 5s + 1 Scilab Code: Ga = tf(10,[5 1]); G = ss2tf(dscr(Ga,0.5)); 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 Scilab output is, and find ZOH equivalent 0.9546 G(z) = trans. function of z − 0.9048 10 Ga(s) = 5s + 1 Scilab Code: Ga = tf(10,[5 1]); G = ss2tf(dscr(Ga,0.5)); 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 Scilab output is, and find ZOH equivalent 0.9546 G(z) = trans. function of z − 0.9048 10 −0.1) 10(1 − e Ga(s) = = 5s + 1 z − e−0.1 Scilab Code: Ga = tf(10,[5 1]); G = ss2tf(dscr(Ga,0.5)); 6. ZOH Equivalent First Order Transfer Function - Example Sample at Ts = 0.5 and find ZOH equivalent trans. function of 10 Ga(s) = 5s + 1 Scilab Code: Ga = tf(10,[5 1]); G = ss2tf(dscr(Ga,0.5)); Digital Control Scilab output is, 0.9546 G(z) = z − 0.9048 10(1 − e−0.1) = z − e−0.1 In agreement with the formula in the previous slide 6 Kannan M. Moudgalya, Autumn 2007 7. Discrete Integration 7. Discrete Integration u(n) u(k − 1) u(k) n 7. Discrete Integration y(k) = blue shaded area u(n) u(k − 1) u(k) n 7. Discrete Integration y(k) = blue shaded area + red shaded area u(n) u(k − 1) u(k) n 7. Discrete Integration y(k) = blue shaded area + red shaded area y(k) = y(k − 1) u(n) u(k − 1) u(k) n 7. Discrete Integration y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area u(n) u(k − 1) u(k) n 7. Discrete Integration u(n) u(k − 1) u(k) n y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area Ts [u(k) + u(k − 1)] y(k) = y(k − 1) + 2 7. Discrete Integration u(n) u(k − 1) u(k) n y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area Ts [u(k) + u(k − 1)] y(k) = y(k − 1) + 2 Take Z-transform: 7. Discrete Integration u(n) u(k − 1) u(k) n y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area Ts [u(k) + u(k − 1)] y(k) = y(k − 1) + 2 Take Z-transform: Ts −1 −1 Y (z) = z Y (z) + U (z) + z U (z) 2 7. Discrete Integration u(n) u(k − 1) u(k) n y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area Ts [u(k) + u(k − 1)] y(k) = y(k − 1) + 2 Take Z-transform: Ts −1 −1 Y (z) = z Y (z) + U (z) + z U (z) 2 Bring all Y to left side: 7. Discrete Integration u(n) u(k − 1) u(k) n y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area Ts [u(k) + u(k − 1)] y(k) = y(k − 1) + 2 Take Z-transform: Ts −1 −1 Y (z) = z Y (z) + U (z) + z U (z) 2 Bring all Y to left side: Ts −1 −1 Y (z) − z Y (z) = U (z) + z U (z) 2 7. Discrete Integration u(n) u(k − 1) u(k) n Digital Control y(k) = blue shaded area + red shaded area y(k) = y(k − 1) + red shaded area Ts [u(k) + u(k − 1)] y(k) = y(k − 1) + 2 Take Z-transform: Ts −1 −1 Y (z) = z Y (z) + U (z) + z U (z) 2 Bring all Y to left side: Ts −1 −1 Y (z) − z Y (z) = U (z) + z U (z) 2 Ts −1 (1 − z )Y (z) = (1 + z −1)U (z) 2 7 Kannan M. Moudgalya, Autumn 2007 8. Transfer Function for Discrete Integration 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts 2 (1 + z −1)U (z) 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Y (z) = Ts (1 + z −1)U (z) 2 Ts 1 + z −1 2 1 − z −1 U (z) 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts (1 + z −1)U (z) 2 Ts 1 + z −1 U (z) 2 1 − z −1 Ts z + 1 U (z) = 2 z−1 Y (z) = 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts (1 + z −1)U (z) 2 Ts 1 + z −1 U (z) 2 1 − z −1 Ts z + 1 U (z) = 2 z−1 Y (z) = Integrator has a transfer function, 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts (1 + z −1)U (z) 2 Ts 1 + z −1 U (z) 2 1 − z −1 Ts z + 1 U (z) = 2 z−1 Y (z) = Integrator has a transfer function, GI (z) = Ts z + 1 2 z−1 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts (1 + z −1)U (z) 2 Ts 1 + z −1 U (z) 2 1 − z −1 Ts z + 1 U (z) = 2 z−1 Y (z) = Integrator has a transfer function, GI (z) = A low pass filter! Ts z + 1 2 z−1 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts Im(z) (1 + z −1)U (z) 2 Ts 1 + z −1 U (z) 2 1 − z −1 Ts z + 1 U (z) = 2 z−1 Y (z) = Integrator has a transfer function, GI (z) = A low pass filter! Ts z + 1 2 z−1 × Re(z) 8. Transfer Function for Discrete Integration Recall from previous slide (1 − z −1 )Y (z) = Ts Im(z) (1 + z −1)U (z) 2 Ts 1 + z −1 U (z) 2 1 − z −1 Ts z + 1 U (z) = 2 z−1 Y (z) = × Re(z) 1 s ↔ Ts z + 1 2 z−1 Integrator has a transfer function, GI (z) = Ts z + 1 2 z−1 A low pass filter! Digital Control 8 Kannan M. Moudgalya, Autumn 2007 9. Derivative Mode 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 2 z−1 • Derivative Mode: s ↔ Ts z + 1 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 2 z−1 • Derivative Mode: s ↔ Ts z + 1 • High pass filter 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 2 z−1 • Derivative Mode: s ↔ Ts z + 1 • High pass filter • Has a pole at z = −1. 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 2 z−1 • Derivative Mode: s ↔ Ts z + 1 • High pass filter • Has a pole at z = −1. Hence produces in partial fraction expansion, a term of the form 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 2 z−1 • Derivative Mode: s ↔ Ts z + 1 • High pass filter • Has a pole at z = −1. Hence produces in partial fraction expansion, a term of the form z ↔ (−1)n z+1 9. Derivative Mode • Integral Mode: 1 s ↔ Ts z + 1 2 z−1 2 z−1 • Derivative Mode: s ↔ Ts z + 1 • High pass filter • Has a pole at z = −1. Hence produces in partial fraction expansion, a term of the form z ↔ (−1)n z+1 • Results in wildly oscillating control effort. Digital Control 9 Kannan M. Moudgalya, Autumn 2007 10. Derivative Mode - Other Approximations 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 Y (z) = Ts 1 − z −1 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 1 ↔ s 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Y (z) = Ts U (z) −1 1−z 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Ts Y (z) = Ts U (z) = U (z) −1 1−z z−1 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Ts Y (z) = Ts U (z) = U (z) −1 1−z z−1 1 ↔ s 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Ts Y (z) = Ts U (z) = U (z) −1 1−z z−1 1 Ts ↔ s z−1 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Ts Y (z) = Ts U (z) = U (z) −1 1−z z−1 1 Ts ↔ s z−1 Both derivative modes are high pass, 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Ts Y (z) = Ts U (z) = U (z) −1 1−z z−1 1 Ts ↔ s z−1 Both derivative modes are high pass, no oscillations, 10. Derivative Mode - Other Approximations Backward difference: y(k) = y(k − 1) + Tsu(k) (1 − z −1)Y (z) = TsU (z) 1 z U (z) Y (z) = Ts = Ts −1 1−z z−1 z 1 ↔ Ts s z−1 Forward difference: y(k) = y(k − 1) + Tsu(k − 1) (1 − z −1)Y (z) = Tsz −1U (z) z −1 Ts Y (z) = Ts U (z) = U (z) −1 1−z z−1 1 Ts ↔ s z−1 Both derivative modes are high pass, no oscillations, same gains Digital Control 10 Kannan M. Moudgalya, Autumn 2007 11. PID Controller 11. PID Controller Proportional Mode: Most popular control mode. 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset • Increased oscillations 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset • Increased oscillations Derivative Mode: Mainly used for prediction purposes. 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset • Increased oscillations Derivative Mode: Mainly used for prediction purposes. Increase in derivative mode generally results in 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset • Increased oscillations Derivative Mode: Mainly used for prediction purposes. Increase in derivative mode generally results in • Decreased oscillations and improved stability 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset • Increased oscillations Derivative Mode: Mainly used for prediction purposes. Increase in derivative mode generally results in • Decreased oscillations and improved stability • Sensitive to noise 11. PID Controller Proportional Mode: Most popular control mode. Increase in proportional mode generally results in • Decreased steady state offset and increased oscillations Integral Mode: Used to remove steady state offset. Increase in integral mode generally results in • Zero steady state offset • Increased oscillations Derivative Mode: Mainly used for prediction purposes. Increase in derivative mode generally results in • Decreased oscillations and improved stability • Sensitive to noise The most popular controller in industry. Digital Control 11 Kannan M. Moudgalya, Autumn 2007 12. PID Controller - Basic Design 12. PID Controller - Basic Design Let input to controller by E(z) 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 1 U (s) = K(1 + + τds)E(s) τi s 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 1 U (s) = K(1 + + τds)E(s) τi s 4 Sc (s) U (s) = E(s) Rc(s) 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 1 U (s) = K(1 + + τds)E(s) τi s 4 Sc (s) U (s) = E(s) Rc(s) If integral mode is present, Rc(0) = 0. 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 1 U (s) = K(1 + + τds)E(s) τi s 4 Sc (s) U (s) = E(s) Rc(s) If integral mode is present, Rc(0) = 0. Filtered derivative mode: 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 1 U (s) = K(1 + + τds)E(s) τi s 4 Sc (s) U (s) = E(s) Rc(s) If integral mode is present, Rc(0) = 0. Filtered derivative mode: ! 1 τds u(t) = K 1 + + e(t) τd s τis 1+ N 12. PID Controller - Basic Design Let input to controller by E(z) and output from it be U (z). If gain is K, τi is integral time and τd is derivative time, Z de(t) 1 t u(t) = K e(t) + e(t)dt + τd τi 0 dt 1 U (s) = K(1 + + τds)E(s) τi s 4 Sc (s) U (s) = E(s) Rc(s) If integral mode is present, Rc(0) = 0. Filtered derivative mode: ! 1 τds u(t) = K 1 + + e(t) τd s τis 1+ N N is a large number, of the order of 100. Digital Control 12 Kannan M. Moudgalya, Autumn 2007 13. Reaction Curve Method - Ziegler Nichols Tuning 13. Reaction Curve Method - Ziegler Nichols Tuning • Applicable only to stable systems 13. Reaction Curve Method - Ziegler Nichols Tuning • Applicable only to stable systems • Give a unit step input to a stable system and get 13. Reaction Curve Method - Ziegler Nichols Tuning • Applicable only to stable systems • Give a unit step input to a stable system and get 1. the time lag after which the system starts responding (L), 13. Reaction Curve Method - Ziegler Nichols Tuning • Applicable only to stable systems • Give a unit step input to a stable system and get 1. the time lag after which the system starts responding (L), 2. the steady state gain (K) and 13. Reaction Curve Method - Ziegler Nichols Tuning • Applicable only to stable systems • Give a unit step input to a stable system and get 1. the time lag after which the system starts responding (L), 2. the steady state gain (K) and 3. the time the output takes to reach the steady state, after it starts responding (τ ) 13. Reaction Curve Method - Ziegler Nichols Tuning • Applicable only to stable systems • Give a unit step input to a stable system and get 1. the time lag after which the system starts responding (L), 2. the steady state gain (K) and 3. the time the output takes to reach the steady state, after it starts responding (τ ) R = K/τ K L Digital Control τ 13 Kannan M. Moudgalya, Autumn 2007 14. Reaction Curve Method - Ziegler Nichols Tuning 14. Reaction Curve Method - Ziegler Nichols Tuning R = K/τ K L τ 14. Reaction Curve Method - Ziegler Nichols Tuning R = K/τ K L τ • Let the slope of the response be calculated as R = K τ . 14. Reaction Curve Method - Ziegler Nichols Tuning R = K/τ K L τ K . • Let the slope of the response be calculated as R = τ Then the PID settings are given below: 14. Reaction Curve Method - Ziegler Nichols Tuning R = K/τ K L τ K . • Let the slope of the response be calculated as R = τ Then the PID settings are given below: Kp τi τd P 1/RL PI 0.9/RL 3L PID 1.2/RL 2L 0.5L 14. Reaction Curve Method - Ziegler Nichols Tuning R = K/τ K L τ K . • Let the slope of the response be calculated as R = τ Then the PID settings are given below: Kp τi τd P 1/RL PI 0.9/RL 3L PID 1.2/RL 2L 0.5L Consistent units should be used Digital Control 14 Kannan M. Moudgalya, Autumn 2007 15. Stability Method - Ziegler Nichols Tuning 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. • Close the loop with a proportional controller 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. • Close the loop with a proportional controller • Gain of controller is increased until the closed loop system becomes unstable 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. • Close the loop with a proportional controller • Gain of controller is increased until the closed loop system becomes unstable • At the verge of instability, note down the gain of the controller (Ku) and the period of oscillation (Pu) 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. • Close the loop with a proportional controller • Gain of controller is increased until the closed loop system becomes unstable • At the verge of instability, note down the gain of the controller (Ku) and the period of oscillation (Pu) • PID settings are given below: 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. • Close the loop with a proportional controller • Gain of controller is increased until the closed loop system becomes unstable • At the verge of instability, note down the gain of the controller (Ku) and the period of oscillation (Pu) • PID settings are given below: Kp τi τd P 0.5Ku PI 0.45Ku Pu/1.2 PID 0.6Ku Pu/2 Pu/8 15. Stability Method - Ziegler Nichols Tuning Another way of finding the PID tuning parameters is as follows. • Close the loop with a proportional controller • Gain of controller is increased until the closed loop system becomes unstable • At the verge of instability, note down the gain of the controller (Ku) and the period of oscillation (Pu) • PID settings are given below: Kp τi τd P 0.5Ku PI 0.45Ku Pu/1.2 PID 0.6Ku Pu/2 Pu/8 Consistent units should be used Digital Control 15 Kannan M. Moudgalya, Autumn 2007 16. Design Procedure 16. Design Procedure A common procedure to design discrete PID controller: 16. Design Procedure A common procedure to design discrete PID controller: • Tune continuous PID controller by any popular technique 16. Design Procedure A common procedure to design discrete PID controller: • Tune continuous PID controller by any popular technique • Get continuous PID settings 16. Design Procedure A common procedure to design discrete PID controller: • Tune continuous PID controller by any popular technique • Get continuous PID settings • Discretize using the method discussed now or the ZOH equivalent method discussed earlier 16. Design Procedure A common procedure to design discrete PID controller: • Tune continuous PID controller by any popular technique • Get continuous PID settings • Discretize using the method discussed now or the ZOH equivalent method discussed earlier • Direct digital design techniques Digital Control 16 Kannan M. Moudgalya, Autumn 2007 17. 2-DOF Controller 17. 2-DOF Controller r u Tc Rc − G= Sc Rc B A y 17. 2-DOF Controller r u Tc Rc − G= Sc Rc u= Tc Rc r− Sc Rc y B A y 17. 2-DOF Controller r u Tc Rc − G= B y A Sc Rc u= Tc r− Sc y Rc Rc It is easy to arrive at the following relation between r and y. 17. 2-DOF Controller r u Tc Rc − G= B y A Sc Rc u= Tc r− Sc y Rc Rc It is easy to arrive at the following relation between r and y. Tc B/A y= r Rc 1 + BSc/ARc 17. 2-DOF Controller r u Tc Rc − G= B y A Sc Rc u= Tc r− Sc y Rc Rc It is easy to arrive at the following relation between r and y. Tc B/A BTc y= r= r Rc 1 + BSc/ARc ARc + BSc 17. 2-DOF Controller r u Tc Rc − G= B y A Sc Rc u= Tc r− Sc y Rc Rc It is easy to arrive at the following relation between r and y. Tc B/A BTc y= r= r Rc 1 + BSc/ARc ARc + BSc Error e, given by r − y is given by 17. 2-DOF Controller r u Tc Rc − G= B y A Sc Rc u= Tc r− Sc y Rc Rc It is easy to arrive at the following relation between r and y. Tc B/A BTc y= r= r Rc 1 + BSc/ARc ARc + BSc Error e, given by r − y is given by BTc e= 1− r ARc + BSc 17. 2-DOF Controller r u Tc Rc G= − B y A Sc Rc u= Tc r− Sc y Rc Rc It is easy to arrive at the following relation between r and y. Tc B/A BTc y= r= r Rc 1 + BSc/ARc ARc + BSc Error e, given by r − y is given by BTc ARc + BSc − BTc e= 1− r= r ARc + BSc ARc + BSc Digital Control 17 Kannan M. Moudgalya, Autumn 2007 18. Offset-Free Tracking of Steps with Integral 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) R(z) 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) lim e(n) = n→∞ A(z)Rc(z) + B(z)Sc(z) R(z) 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) z z−1 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) Because the controller has an integral action, z z−1 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) Because the controller has an integral action, Rc(1) = 0: z z−1 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) Because the controller has an integral action, Rc(1) = 0: e(∞) = z z−1 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) Because the controller has an integral action, Rc(1) = 0: Sc(z) − Tc(z) e(∞) = Sc(z) z=1 z z−1 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) Because the controller has an integral action, Rc(1) = 0: Sc(z) − Tc(z) Sc(1) − Tc(1) e(∞) = = Sc(z) Sc(1) z=1 z z−1 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) z z−1 Because the controller has an integral action, Rc(1) = 0: Sc(z) − Tc(z) Sc(1) − Tc(1) e(∞) = = Sc(z) Sc(1) z=1 This condition can be satisfied if one of the following is met: 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z→1 z A(z)Rc(z) + B(z)Sc(z) z z−1 Because the controller has an integral action, Rc(1) = 0: Sc(z) − Tc(z) Sc(1) − Tc(1) e(∞) = = Sc(z) Sc(1) z=1 This condition can be satisfied if one of the following is met: T c = Sc 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) z z−1 Because the controller has an integral action, Rc(1) = 0: Sc(z) − Tc(z) Sc(1) − Tc(1) e(∞) = = Sc(z) Sc(1) z=1 This condition can be satisfied if one of the following is met: T c = Sc Tc = Sc(1) 18. Offset-Free Tracking of Steps with Integral E(z) = A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) A(z)Rc(z) + B(z)Sc(z) lim e(n) = lim n→∞ z→1 R(z) z − 1 A(z)Rc(z) + B(z)Sc(z) − B(z)Tc(z) z A(z)Rc(z) + B(z)Sc(z) z z−1 Because the controller has an integral action, Rc(1) = 0: Sc(z) − Tc(z) Sc(1) − Tc(1) e(∞) = = Sc(z) Sc(1) z=1 This condition can be satisfied if one of the following is met: T c = Sc Tc = Sc(1) Tc(1) = Sc(1) Digital Control 18 Kannan M. Moudgalya, Autumn 2007