.. 6.3 1 Sintesi di reti correttrici Block scheme for the continuous time case: r(t) e(t) m(t) y(t) C(s) G(s) C(s) is the compensator to be designed: Let γ and γ denote: C(s) = 1 + τ 1 s 1 + τ 2 s (1) γ = lim s C(s) = 1, γ = lim s C(s) = τ 1 τ 2 The Bode magnitude and phase plots of compensator C(s): Magnitude C(jω) [db] 2 15 1 5 5 1 15 γ > 1 γ = 1 γ < 1 2 1 2 1 1 1 1 1 1 2 6 Phase of C(jω) [deg] 4 2 2 4 6 γ>1 γ<1 1 2 1 1 1 1 1 1 2 Frequency ω [Log 1 ]
6.3. SINTESI DI RETI CORRETTRICI 6.3 2 Design Problem (continuous time): find the parameters τ 1 and τ 2 of compensator (1) such that C(jω) = 1 + j ωτ 1 1 + j ωτ 2 = M e jϕ (2) where M and ϕ are the magnitude and the phase desired at frequency ω. Inversion formulas (continuous time): the continuous time design problem is solved by using the following inversion formulas: Graphical design procedure: τ 1 = M cos ϕ ω sin ϕ, τ 2 = cos ϕ 1 M ω sin ϕ (3) Ā 2 O A 2 B 2 = B γ 2 G(jω) B A 1 B 1 = B γ 1 Ā 1 The parameters τ 1 and τ 2 of compensator C(s) that moves point A = M A e jϕ A in B = M B e jϕ B can be obtained using the following parameters: M = M B M A, ϕ = ϕ B ϕ A, ω = ω A (4)
6.3. SINTESI DI RETI CORRETTRICI 6.3 3 Numerical example. Given the system: G(s) = 25 s(s + 1)(s + 1), let us design a lead compensator C 1 (s) which imposes a phase margin M ϕ = 6 o and with the gain γ as small as possible. Nyquist diagram: 1 ω 1 A ω 2 G O ω G(jω) B G c (jω) Point B is: Choose point A: M B = 1, ϕ B = π + M ϕ = 24 o, M A =.538, ϕ A = 194.9 o, ω A = 2.2. The parameters M and ϕ are the following: Substituting one obtains:: M = M B M A = 1.859, ϕ = ϕ B ϕ A = 45.1 o. C 1 (s) = (1 +.86s) (1 +.117s).
6.3. SINTESI DI RETI CORRETTRICI 6.3 4 The step responses of the two systems G(s) and G c (s) = C 1 (s)g(s) controlled in closed loop:. 1.5 1.5 5 1 15 secondi
6.3. SINTESI DI RETI CORRETTRICI 6.3 5 The Discrete Time Case The considered block scheme for the discrete time case: r n e n m n y n C d (z) HG(z) HG(z) is the discrete system to be controlled, H (s) is the zero-order hold: HG(z) = Z[H (s) G(s)], C d (z) is the compensator to be designed: C d (z) = The frequency response of function C d (z): 1 + α(z 1) 1 + β(z 1) H (s) = 1 e T s s (5) Magnitude Cd(z) [db] 15 1 5 5 1 γ d > 1 γ = 1 γ d = 1 γ d < 1 15 1 2 1 1 1 1 1 1 2 6 Phase of Cd(z) [deg] 4 2 2 4 γ d >1 γ d <1 6 1 2 1 1 1 1 1 1 2 Frequency ω [, π/t] Design Problem (discrete time): find the parameters α and β of compensator (5) such that: C d (e jωt ) = 1 + α(ejωt 1) 1 + β(e jωt 1) = Mejϕ, (6) where M and ϕ are the magnitude and the phase desired at frequency ω.
6.3. SINTESI DI RETI CORRETTRICI 6.3 6 Inversion formulas (discrete time): the discrete time design problem is solved by the following inversion formulas: α = 1 2 + β = 1 2 + M cos ϕ 2 sinϕ tan ωt 2 cos ϕ 1 M 2 sinϕ tan ωt 2 (7) Remark: these formulas can also be rewritten in the following form: α = 1 2 + ω τ 1 2 tan ωt 2 β = 1 2 + ω τ 2 2 tan ωt 2 (8) where τ 1 and τ 2 are obtained from the continuous time inversion formulas. Remark: the same result is obtained applying the bilinear transformation with prewarping to compensator C(s): s = ω tan ωt 2 [ z 1 z + 1 ] z = 1 + s ω tan ωt 2 1 s ω tan ωt 2 Numerical example. Let us refer to the same system G(s) = 25 s(s + 1)(s + 1) considered in the previous numerical example. Design a discrete lead compensator C d (z) which imposes a phase margin M ϕ = 6 o when T =.15 s. The discrete system HG(z) is the following: HG(z) = Z [H (s)g(s)] = (9.657z2 + 26.66z + 4.259)1 3 z 3 2.84z 2 + 1.276z.192.
6.3. SINTESI DI RETI CORRETTRICI 6.3 7 Nyquist plane when T =.15 s: Nyquist plane: T =.15 s.2.2 1 A Im.4 HG(z).6 G(s).8 1 B C d (z)hg(z) 1.5 1.5.5 Re The design specification M ϕ = 6 o completely defines point B = M B e jϕ B: M B = 1, ϕ B = π + M ϕ = 24 o Point A = HG(e jω AT ) = M A e jϕ A is chosen on the Nyquist diagram of function HG(z) for ω = ω A : M A =.5361, ϕ A = 186.2 o, ω = 2.2. Point A belongs to the admissible domain: the dotted half circle. Parameters M and ϕ are now the following: M = M B M A = 1.865, ϕ = ϕ B ϕ A = 53.76 o. Substituting M, ϕ, ω and T in the discrete inversion formulas (7) one obtains α = 5.673 and β =.723. The discrete compensator is the following: C d (z) = 1 + α(z 1) 1 + β(z 1) = 1 + 5.673(z 1) 1 +.723(z 1) The same C d (z) can be obtained applying the bilinear transformation with prewarping to compensator C(s) = 1+τ 1s 1+τ 2 s.
6.3. SINTESI DI RETI CORRETTRICI 6.3 8 In the figure it is also reported (blue dash-dotted thick line) the step response of the system C b (z)hg(z) controlled in closed loop, when the discrete compensator C b (z) is obtained from C 1 (s) by using the bilinear correspondence between the s and z complex variables: C b (z) = (1 +.86s) (1 +.117s) s= 2 T z 1 z+1 = 1.762z 1.462.384z.84. Step responses of the considered systems controlled in closed loop. Sampling period: T =.15 s. Step response: T =.15 s 1.2 1.8 y(t).6.4.2.5 1 1.5 2 2.5 3 3.5 4 Time (s) Matlab file Formule di Inversione discrete.m : Esempio di applicazione delle formule di inversione discrete clear all close all Mf=6; Mb=1; Fb=pi+Mf*pi/18; B=Mb*exp(j*Fb); thick=1.8; thin=.5; Tfin=4; s=tf( s ); gs=25/(s*(s+1)*(s+1)); Specifica di progetto Scelta del punto B Linea spessa Linea sottile Durata della simulazione Funzione di trasferimento gs
6.3. SINTESI DI RETI CORRETTRICI 6.3 9 gs=feedback(gs,1); T=.15; z=tf( z,t); gz=c2d(gs,t, zoh ) wa=2.2; A=evalfr(gz,exp(T*wa*j)); Ma=abs(A); Fa=angle(A); Sistema retroazionato gs=gs/(1+gs) Periodo di campionamento Si discretizza (gz) il sistema gs Scelta della pulsazione Scelta del punto A M=Mb/Ma Calcolo dei parametri per le formule di inversione phi=fb-fa-2*pi; phi*18/pi [alfa,beta]=alfa_beta(m,phi*18/pi,wa,t) grz=(1+alfa*(z-1))/(1+beta*(z-1)); Rete correttrice tempo discreto Ac=evalfr(gs,wa*j); Scelta del punto Ac Mac=abs(Ac); Fac=angle(Ac); Mc=Mb/Mac; Calcolo dei parametri per le formule di inversione phic=fb-fac; [tau1,tau2]=tau1tau2(mc,phic*18/pi,wa); grs=(1+.86*s)/(1+.117*s); Rete correttrice tempo continuo [tau1,tau2]=tau1tau2(m,phi*18/pi,wa) grs1=(1+tau1*s)/(1+tau2*s) Rete correttrice tempo continuo grsz=c2d(grs1,t, prewarp,wa) minreal(grz) gsr=grs*gs; gsr=feedback(gsr,1); Sistema tempo continuo retroazionato gsr=gsr/(1+gsr) gzr=grz*gz; gzr=feedback(gzr,1); Sistema tempo discreto retroazionato gzr=gzr/(1+gzr) k=1; tau1=.86; tau2=.117; 3) Metodo della trasformazione bilineare a=k*(t+ 2*tau1); b=k*(t-2*tau1); c=t+2*tau2; d=t-2*tau2; grz3=(a*z+b)/(c*z+d) grgz3=grz3*gz; gz3=feedback(grgz3,1); Sistema con rete discretizzata: gz3=grgz3/(1+grgz3) figure(1); hold off; clf [y,t]=step(gsr,tfin); Risposta del sistema continuo con rete correttrice h=plot(t,y, k ); hold on set(h, Linewidth,thin) [y,t]=step(gz3,tfin); Risposta del sistema discreto con rete discretizzata h=stairs(t,y, b-. ); hold on set(h, Linewidth,thick) [y,t]=step(gzr,tfin); Risposta del sistema discreto con rete correttrice h=stairs(t,y, r ); hold on set(h, Linewidth,thick) plot([ 1],[1 1], : ) axis([ Tfin 1.3]) xlabel( Time (s) ) ylabel( y(t) ) title([ Step response, T= num2str(t)]) figure(2); hold off; clf
6.3. SINTESI DI RETI CORRETTRICI 6.3 1 [re,im]=nyquist(gs,{.1,1}); Nyquist del sistema continuo senza rete correttrice h=plot(re(:,:),im(:,:), k-- ); hold on set(h, Linewidth,thin) [re,im]=nyquist(gsr,{.1,1}); Nyquist del sistema continuo con rete correttrice h=plot(re(:,:),im(:,:), k ); hold on set(h, Linewidth,thin) [re,im]=nyquist(gz,{.1,1}); Nyquist del sistema discreto senza rete correttrice h=plot(re(:,:),im(:,:), r-- ); hold on set(h, Linewidth,thick) [re,im]=nyquist(gzr,{.1,1}); Nyquist del sistema discreto con rete correttrice h=plot(re(:,:),im(:,:), r ); hold on set(h, Linewidth,thick) [re,im]=nyquist(grgz3,{.1,1}); Nyquist del sistema discreto con rete discretizzata h=plot(re(:,:),im(:,:), b-. ); hold on set(h, Linewidth,thick) Dominio_Rete_Ant_Nyq(Mf,Mb) Graficazione del dominio di ammissibilit plot(a, * ); Graficazione del punto A plot(b, * ); Graficazione del punto B V=[-1.5.5-1.1.4]; dx=(v(2)-v(1))/4; dy=(v(4)-v(3))/3; freccia(real(a),imag(a),real(b),imag(b),dx,dy) axis(v) plot(-1,, * ) plotaxis(v) xlabel( Real ) ylabel( Imag ) title([ Nyquist. T= num2str(t)]) text(real(a)+.2,imag(a)-.2, A ) text(real(b)-.8,imag(b), B ) text(-1-.6,.2, m1 ) C=evalfr(gz,exp(T*.7*wa*j)); text(real(c)-.8,imag(c), C ) D=evalfr(gzr,exp(T*.9*wa*j)); text(real(d)-.8,imag(d), D ) text(-1,-.65, G ) File Matlab alfa beta.m function [alfa,beta]=alfa_beta(m,phi,omega,t) [alfa,beta]=alfa_beta(m,phi,omega,t) calcola alfa, beta di una rete correttrice discreta M : guadagno phi : fase omega : pulsazione T : periodo di campionamento phirad=phi*pi/18; tw1=(m-cos(phirad))/(sin(phirad)); tw2=(cos(phirad)-1/m)/(sin(phirad)); tau1_tau2=[tw1/omega tw2/omega ] alfa=.5+tw1/(2*tan(omega*t/2)); beta=.5+tw2/(2*tan(omega*t/2)); return