Page 161 - Practical Control Engineering a Guide for Engineers, Managers, and Practitioners
P. 161

y3=R/(sqrt(  (tau*w)A2+1  ))A3;  %magnitude  at wand
             kdisp(['at  critical  point  mag=  '  num2str(y1)  '  angle
             (deg)  =  '  num2str(y2*180/pi)])
             disp(['process  ampl  at  critical  freq  =  'num2str(y3)  '  '
             num2str(20*log10(y3))  'dB'])
             disp('        ')
             % now  add  integral-only  to  three  tank  process  with  no
             back  flow
             clear
             close  all
             x0=[1  .001];
             x=fminsearch('ThirdCriti',xO);
             disp('for  Third  Order  process  with  integral-only')
             disp(['I  =  'num2str(x(1))  '  fc  =  'num2str(x(2))  ])
             freq=x(2);
             I=X(1);
             R=10;
             tau=10;
             w=2*pi*freq;
             y1=I*R/(w*(sqrt(  (tau*w)A2+1  ))A3);%  magnitude  at wand  k
             y2=-atan(tau*w)-atan(tau*w)-atan(tau*w)-pi/2;
             y3=R/(w*(sqrt(  (tau*w)A2+1  ))A3);  %magnitude  at wand  k
             disp(['at  critical point  mag=  'num2str(y1)  'angle
             (deg)  =  '  num2str(y2*180/pi)])
             disp(['process  ampl  at  critical  freq  =  'num2str(y3)
             num2str(20*log10(y3))  'dB'])
             %-------------------
             function  y=ThirdCrit(x)
             % called by  critpars.m
             k=X(1);
             W=X(2)*(2*pi);
             R=10;
             tau=10;
             y1=k*R/(sqrt(  (tau*w)A2+1  )A3)  - 1;
             y2=-atan(tau*w)-atan(tau*w)-atan(tau*w)+pi;
             Y=Y1A2+y2A2;
             %--------------------------------
             function  y=ThirdCriti(x)
             % called by  critpars.m
             k=X(1);
             w=x(2)*(2*pi);  %convert  to  radian  freq
             R=10;
             tau=10;
             y1=k*R/(w*(sqrt(  (tau*w)A2+1  ))A3)  - 1;
             y2=-atan(tau*w)-atan(tau*w)-atan(tau*w)-pi*.S+pi;
             Y=Y1A2+y2A2;
                Note that the above script calls two functions, Thirdcrit and
             Thirdcriti. It also uses a built-in Matlab function fminsearch.
                Using the integral gain from these calculations for a simula-
             tion would result in marginal stability, namely sustained but not-
             growing oscillations. Decreasing the integral gain by a factor of
             0.5  to 0.004 provides a little better gain margin and produces a
             new Bode plot shown in Fig.  5-9.  Note  that the circles  in this
   156   157   158   159   160   161   162   163   164   165   166