home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS2.DI$ / HIMAT_X5.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  7.6 KB  |  240 lines

  1.  echo on
  2. %
  3. %    HIMAT_X5
  4. %
  5. %  It is assumed that you have just run 'himat_x4' 
  6.  
  7.  
  8.  pause     % strike any key to continue
  9.  
  10. %  We will compare the  'best' mu-synthesis control design for
  11. %   HIMAT with the a loop-shaping control law using singular values 
  12. %   and mu-analysis tools. Several comparisons will be preformed
  13. %   between the two: weighted output sensitivity transfer functions,
  14. %   weighted input complementary sensitivity transfer functions, 
  15. %   mu values and the condition numbers of the control designs as a
  16. %   function of frequency.
  17.  
  18.  
  19. %  The loop-shaping control law will be loaded from the file 
  20. %   KLP, an aschii file, and the 'best' mu control law is 
  21. %   from the last mu-synthesis iteration  K4.
  22.  
  23. echo off
  24.  mkklp;
  25. echo on
  26.  minfo(klp)
  27.  minfo(k4)
  28.  
  29. % Notice that the mu-controller has a fairly high order
  30.  
  31.  pause      % strike any key to continue
  32.  
  33. % We need to form the closed-loop system with the loop-shaping
  34. %  control law. We'll check it's eigenvalues to make sure it
  35. %  stablizes the system.
  36.  
  37.  g4 = starp(himat_ic,k4,2,2);
  38.  g_lp = starp(himat_ic,klp,2,2);
  39.  g_mu = starp(himat_ic,k4,2,2);
  40.  format short e
  41.  
  42.  rifd(spoles(g_lp))
  43.  
  44.  pause         % strike any key to continue
  45.  om2 = logspace(-2,2,20);
  46.  g_lpg = frsp(g_lp,om2);
  47.  g_mug = frsp(g4,om2);
  48.  
  49. % Compare the singular value plots of the closed loop systems 
  50. %   which is a 4 by 4 transfer function with the loopshaping 
  51. %   and mu design.
  52.  
  53.   g_mugs = vsvd(g_mug);
  54.   g_lpgs = vsvd(g_lpg);
  55.   both = sbs(sel(g_mugs,1,1),sel(g_lpgs,1,1));
  56.   clg
  57.   vplot('liv,lm',both)
  58.   echo off
  59.   title('Closed loop mu and loop shaping controllers max singular values')
  60.   xlabel('Frequency (rad/s)');
  61.   ylabel('Magnitude');
  62.   text(.15,.20,'solid = mu controller','sc')
  63.   text(.15,.85,'dashed = loop shape controller','sc')
  64.   pause
  65.   clear both g_lpgs g_mugs
  66.   echo on
  67.  
  68.   pause     % strike any key to continue
  69.  
  70. % The maximum singular value of the closed loop system with the 
  71. %  mu controller is greater than 1 and the loop shaping control 
  72. %  law is on the order of 1000. The mu controller doesn't 
  73. %  try to make sigma_max small, it tries to make mu small. This can 
  74. %  be done by allowing one of the off diagonal blocks to become very
  75. %  large, as long as the other off diagonal block is very small 
  76. %  (think about how the affect the off-diagonal terms).
  77.  
  78. % Comparing mu values of the mu-synthesis and the loop-shaping 
  79. %  control law (mu is the lower curve). 
  80.  
  81.  pause      % strike any key to continue
  82.  
  83.  [bnd_mu,dv_mu,sens_mu,rp_mu]=mu(g_mug,blk);
  84.  [bnd_lp,dv_lp,sens_lp,rp_lp]=mu(g_lpg,blk);
  85.  both=sbs(sel(bnd_mu,1,1),sel(bnd_lp,1,1));
  86.  vplot('liv,lm',both)
  87.  echo off
  88.  title('mu of the mu-synthesis controller and loop-shaping control design ');
  89.  xlabel('Frequency (rad/s)');
  90.  ylabel('Magnitude');
  91.  text(.15,.20,'solid = mu controller','sc')
  92.  text(.15,.85,'dashed = loop shape controller','sc')
  93.  pause
  94.  clear dv_mu dv_lp rp_mu rp_lp sens_mu sens_lp both
  95.  echo on
  96.  pause      % strike any key to continue
  97.  
  98. %   Let's look at their output sensitivity (So) and the 
  99. %   input complementary (Ti) transfer functions for the nominal case. 
  100.   
  101. %   We will compare the two designs, for the nominal case and 
  102. %   with an uncertainty block [0.1 0;0 -0.1] fed back around 
  103. %   the input multiplicative uncertainty. 
  104.  
  105. % For the mu control law:
  106.  
  107.  g_munS = sel(g4,[3 4],[3 4]);
  108.  g_munT = sel(g4,[1 2],[1 2]);
  109.  
  110. % For the loop shape control law:
  111.  
  112.  g_lpnS = sel(g_lp,[3 4],[3 4]);
  113.  g_lpnT = sel(g_lp,[1 2],[1 2]);
  114.  
  115.  pause      % strike any key to continue
  116.  
  117. % Calculate their frequency responses between .01 and 100 rad/s 
  118. %  and  compare them.
  119.  
  120.  om3 = logspace(-2,2,40);
  121.  g_munSg = vsvd(frsp(g_munS,om3));
  122.  g_munTg = vsvd(frsp(g_munT,om3));
  123.  g_lpnSg = vsvd(frsp(g_lpnS,om3));
  124.  g_lpnTg = vsvd(frsp(g_lpnT,om3));
  125.  clg;
  126.  
  127. % Let's plot them and compare
  128.  
  129. % First the Nominal Output Sensitivity (SO) function for the 
  130. % loop-shape control law and the mu control law.
  131.  
  132.  echo off  
  133.  subplot(211), axis([-2 2 0 1]);
  134.  subplot(212), axis([-2 2 0 1]);
  135.  subplot(211), vplot('liv,m',g_lpnSg)
  136.  subplot(211), title('SO (sensitivity function) for loop-shape control law');
  137.  subplot(212), vplot('liv,m',g_munSg)
  138.  subplot(212), title('SO (sensitivity function) for mu control law');
  139.  subplot(212), xlabel('Frequency (rad/s)') ;ylabel('Magnitude');
  140.  pause
  141.  clear g_munSg g_lpnSg
  142.  echo on
  143.  
  144.  pause      % strike any key to continue
  145.  clg;
  146.  
  147. % Now, let's look at the Nominal Complementary Sensitivity (Ti)
  148. %  function for the loop-shape control law and the mu control law.
  149.    
  150.  echo off
  151.  subplot(211), axis([-2 2 0 1]);
  152.  subplot(212), axis([-2 2 0 1]);
  153.  subplot(211), vplot('liv,m',g_lpnTg)
  154.  subplot(211), title('Ti (comp sens function) for loop-shape control law');
  155.  subplot(212), vplot('liv,m',g_munTg)
  156.  subplot(212), title('Ti (comp sens function) for mu control law');
  157.  subplot(212), xlabel('Frequency (rad/s)') ;ylabel('Magnitude');
  158.  pause
  159.  clear g_munT g_munTg g_lpnT g_lpnTg
  160.  echo on
  161.  
  162.  pause      % strike any key to continue
  163.  clg;
  164.  
  165. %   Let's look at their output sensitivity (So) transfer functions for the 
  166. %   perturbed system with delta = [0.1 0; 0 -.1].
  167.  
  168. delta = [0.1 0;0 -0.1];
  169. himat_idn = himat_ic;
  170. g_muidn = starp(himat_idn,k4,2,2);
  171. g_lpidn = starp(himat_idn,klp,2,2);
  172. g_muinS = sel(g_muidn,[3:4],[3:4]);
  173. g_lpinS = sel(g_lpidn,[3:4],[3:4]);
  174.  
  175. g_lpids = starp(delta,g_lpidn,2,2);
  176. g_lpidsg = frsp(g_lpids,om2);
  177. g_muids = starp(delta,g_muidn,2,2);
  178. g_muidsg = frsp(g_muids,om2);
  179.  
  180.  echo off  
  181.  subplot(211), axis([-2 2 0 12]);
  182.  subplot(212), axis([-2 2 0 12]);
  183.  subplot(211), vplot('liv,m',vnorm(g_lpidsg))
  184.  subplot(211), title('Sens function perturbed system, loop-shape controller');
  185.  subplot(212), vplot('liv,m',vnorm(g_muidsg))
  186.  subplot(212), title('Sensitivity function perturbed system, mu control law');
  187.  pause
  188.  echo on
  189.  pause           %strike any key to continue
  190.  
  191. % One notices how much the loop shape controller degrades with the
  192. %  inclusion of the perturbation, whereas the mu controller hardly
  193. %  degrades at all. Hence, this degradation is related to the mu value
  194. %  of the closed loop system. The mu control law had a very low mu
  195. %  value whereas the loop shape control law had a large mu value.
  196.  
  197. % Let's look at the condition number of the control laws as
  198. %  a function of frequency.
  199.  
  200.  kmug = frsp(k4,om2);
  201.  klpg = frsp(klp,om2);
  202.  outkmu = vsvd(kmug);
  203.  outkl = vsvd(klpg);
  204.  clear kmug klpg
  205.  maxmu = sel(outkmu,1,1);
  206.  minmu = sel(outkmu,2,1);
  207.  maxl = sel(outkl,1,1);
  208.  minl = sel(outkl,2,1);
  209.  condmu = mmult(maxmu,minv(minmu));
  210.  condl = mmult(maxl,minv(minl));
  211.  clear max4 min4 maxl minl outk4 outkl
  212.  clg
  213.  axis([-2 2 0 4]);
  214.  vplot('liv,lm',condmu,condl)
  215.  echo off
  216.  title('Condition number of loopshaping and mu control laws');
  217.  xlabel('Frequency (rad/sec)');
  218.  ylabel('Magnitude');
  219.   text(.15,.30,'solid = mu controller','sc')
  220.   text(.15,.85,'dashed = loop shape controller','sc')
  221.  pause
  222.  echo on
  223.  
  224. % High condition number controllers and plant are usually very 
  225. %  sensitive to the introduction of perturbations into the system.
  226.  
  227.  pause      % strike any key to continue
  228.  
  229. % Comparing the output sensitivity and the input complementary 
  230. %  sensitivity one can see that the mu control law is more robust
  231. %  to input uncertainty.
  232.  
  233. % To wrap up the analysis, we will look at time domain performance.
  234. %  Simulations with the nominal plants, G_MUNS and G_LPNS will be 
  235. %  compared with the plants with uncertainty, G_MUDS and G_LPDS. 
  236.  
  237. % Type in 'himat_x6' for the time response analysis.
  238. %
  239. % Copyright MUSYN INC 1991,  All Rights Reserved
  240.