clear all close all % For the process P=3/(s^2+6*s+9), design a digital controller by emulation % of a continuous design in order to satisfy the following requirments. %%%% REQUIREMENTS %%%%%%%%%%%%%%%%%% % - error at steady state =0 wrt to a step disturbance d => K(s)=k0/s % - error at steady state (e_inf) <=0.1 wrt to a ramp signal r(t)=R0 t*1(t), R0=0.5 % => e_inf=R0/F0<=0.1; F0=k0*P0=k0/3 => k0>=15 % - s% < 30% (zita_c> 0.35, i.e. phase_margin > 35°) % - ta5% <= 3 s (ta5%=3/zita_c/omega_c ==> omega_c >= 2.2 rad/s) % - Ts = 0.05 s (delay at omega_c: in terms of phase, % a decrase of phase margin (Delta_phi) of about omega_c*Ts/2, % for example if omega_c=5, Delta_phi=0.125 rad = 7.2 degrees) % plant to be controlled s=tf('s'); P=3/(s+3)^2; k0=15; C1=k0/s; % controller implementing an integral action with gain =15 % open loop function F1=C1*P; % evaluate the cross. freq and phase margin figure, margin(F1) grid on % introduce a zero in s=-3, then the tf of the controller is given by C2 C2=k0*(s/3+1)/s; F2=C2*P; % evaluate the cross. freq and phase margin figure, margin(F2) grid on figure bode(F1,F2) hold on grid on legend % evaluate the closed loop system for the two different cases (C1 and C2) W1=feedback(F1,1); W2=feedback(F2,1); figure step(W1,W2) grid on hold on legend % design the corresponding digital controller Ts=0.05; % (omega_s=2*pi/Ts approx 125 rad/s, check if omega_s is at least about 5-10 times omega_c % delay at omega_c, in terms of phase, about -omega_c*Ts/2=-3*0.05/2=0.07 rad % => decrase of phase margin of about 0.07 rad = 4-5 degrees % discret equivalent tf by using Tustin D1=c2d(C2,Ts,'tustin'); % anti-aliasing filter - a pole at frequency omega_f such that omega_f>omega_c omega_s=2*pi/Ts; % sampling freq. omega_f=omega_s/2.1; % frequency for the pole of anti-aliasing filter Fa=1/(s/omega_f+1); scheme_exam_IA_23_July_2024