Code covered by the BSD License  

Highlights from
MIMOtool

image thumbnail

MIMOtool

by

 

12 Nov 2001 (Updated )

Multi Input Multi Output Systems Toolbox

h2.m
function h2(tipo)
%H1 : 3 finestra di sintesi e di ottimizzazione  H2 o H-INFINITY
%
%                     h0(tipo)
%
%  tipo  = stringa indicante il tipo di sintesi o di ottimizzazione
%          scelta : 'H - 2' o 'H - INFINITY'
%
%
% Massimo Davini 27/05/99 --- revised 31/05/99

% put delgraf instead of delete(findobj('tag','grafico'));
% 25/may/02 Giampy

global stack;
delgraf;
set(stack.temp.handles,'visible','off');
drawnow;

% enlarge text if java machine is running
jsz=stack.general.javasize;

h2(1)=uicontrol('style','Frame','units','normalized','position',[0.05 0.66 0.46 0.29],...
     'backgroundcolor',[1 1 1],'tag','h2');
  
h2(2)=uicontrol('style','text','units','normalized','position',[0.062 0.75 0.44 0.18],...
   'fontunits','normalized','fontsize',.22,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'foregroundcolor',[1 0 0],...
   'HorizontalAlignment','left','tag','h2',...
   'string','Do you want to express the weights of T or M using a derivative action on the plant?');

h2(3)=uicontrol('style','radiobutton','units','normalized','position',[0.15 0.68 0.12 0.06],...
   'fontunits','normalized','fontsize',jsz/2+.65,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'value',1,'tag','deriva1',...
   'string','YES','callback','sldopt(1,''deriva1'',''deriva2'');');

h2(4)=uicontrol('style','radiobutton','units','normalized','position',[0.3 0.68 0.12 0.06],...
   'fontunits','normalized','fontsize',jsz/2+.65,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'value',0,'tag','deriva2',...
   'string','NO','callback','sldopt(2,''deriva1'',''deriva2'');');

drawnow;

h2(5)=uicontrol('style','Frame','units','normalized','position',[0.05 0.22 0.46 0.43],...
   'backgroundcolor',[1 1 1],'tag','h2');

h2(6)=uicontrol('style','text','units','normalized','position',[0.062 0.51 0.44 0.12],...
   'fontunits','normalized','fontsize',.33,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'foregroundcolor',[1 0 0],...
   'HorizontalAlignment','left','tag','h2',...
   'string','Choose the function used to compute the controller :');

switch tipo
 case 'H - INFINITY'

   h2(7)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.44 0.42 0.06],...
         'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
         'backgroundcolor',[1 1 1],'value',0,'HorizontalAlignment','left',...
         'string','hinfopt     (robust control t.)','tag','funz1',...
         'callback','sldopt(1,''funz1'',''funz2'',''funz3'',''funz4'');');

   h2(8)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.38 0.42 0.06],...
         'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
         'backgroundcolor',[1 1 1],'value',0,'HorizontalAlignment','left',...
         'string','hinfsyne   (mu tools)','tag','funz2',...
         'callback','sldopt(2,''funz1'',''funz2'',''funz3'',''funz4'');');

   h2(9)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.32 0.42 0.06],...
         'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
         'backgroundcolor',[1 1 1],'value',1,'HorizontalAlignment','left',...
         'string','hinfric      (lmi toolbox)','tag','funz3',...
         'callback','sldopt(3,''funz1'',''funz2'',''funz3'',''funz4'');');

   h2(10)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.26 0.42 0.06],...
         'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
         'backgroundcolor',[1 1 1],'value',0,'HorizontalAlignment','left',...
         'string','hinflmi      (lmi toolbox)','tag','funz4',...
         'callback','sldopt(4,''funz1'',''funz2'',''funz3'',''funz4'');');

 case 'H - 2'
      
   h2(7)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.42 0.42 0.06],...
        'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
        'backgroundcolor',[1 1 1],'value',0,'HorizontalAlignment','left',...
        'string','h2synr    (robust control t.)','tag','funz1',...
        'callback','sldopt(1,''funz1'',''funz2'',''funz3'');');

   h2(8)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.35 0.42 0.06],...
        'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
        'backgroundcolor',[1 1 1],'value',0,'HorizontalAlignment','left',...
        'string','h2syn     (mu tools)','tag','funz2',...
        'callback','sldopt(2,''funz1'',''funz2'',''funz3'');');

   h2(9)=uicontrol('style','radiobutton','units','normalized','position',[0.07 0.28 0.42 0.06],...
        'fontunits','normalized','fontsize',jsz/2+.6,'fontweight','bold',...
        'backgroundcolor',[1 1 1],'value',1,'HorizontalAlignment','left',...
        'string','hinfric     (lmi toolbox)','tag','funz3',...
        'callback','sldopt(3,''funz1'',''funz2'',''funz3'');');
end;

if isempty(ver('robust')) set(h2(7),'enable','off');end;

x=length(h2);

h2(x+1)=uicontrol('style','push','unit','normalized','position',[0.57 0.85 0.38 0.1],...
   'fontunits','normalized','fontsize',jsz/3+.35,'fontweight','bold',...
   'Horizontalalignment','center','tag','BREG');

h2(x+2)=uicontrol('style','push','unit','normalized','position',[0.05 0.05 0.14 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'string','BACK','Horizontalalignment','center','tag','BottBC',...
   'TooltipString','Back to the previous window','userdata',sprintf('feval(''back_syn'',''h1'',%u)',length(stack.temp.handles)),...
   'callback',sprintf('if stack.general.K_flag messag(gcf,''kns'',''back'');else back_syn(''h1'',%u);end;',length(stack.temp.handles)));
  
campi=['''integratori'',''pesi'',''type'',''plant'',''X1X2'',''X1'',''X2'',''Fx'''];
h2(x+3)=uicontrol('style','push','unit','normalized','position',[0.2 0.05 0.14 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'string','CLOSE','Horizontalalignment','center','userdata',sprintf('feval(''back_syn'',''syn0'',0,%s)',campi),...
   'TooltipString','Back to the main SYNTHESIS window','tag','BottBC',...
   'callback',sprintf('if stack.general.K_flag messag(gcf,''kns'',''close'');else back_syn(''syn0'',0,%s);end;',campi));
   
h2(x+4)=uicontrol('style','push','unit','normalized','position',[0.39 0.05 0.275 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'TooltipString','Evaluate the computed Controller',...
   'Horizontalalignment','center','string','EVALUATION',...
   'callback','valuta;','tag','BEVAL','enable','off');

h2(x+5)=uicontrol('style','push','unit','normalized','position',[0.675 0.05 0.275 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'TooltipString','Open the SIMULINK Closed-Loop-System',...
   'Horizontalalignment','center','string','SIMULATION',...
   'callback','simula;','tag','BSIMU','enable','off');

drawnow;

if isempty(stack.temp.pesi)
 set(h2(x+1),'string',sprintf('COMPUTE %s',tipo),'callback',sprintf('h3(''%s'');',tipo));
else
 set(h2(x+1),'string','START OPTIMIZATION','callback',sprintf('h3opt(''%s'');',tipo));
end;

stack.temp.handles=[stack.temp.handles,h2];

Contact us