Code covered by the BSD License  

Highlights from
MIMOtool

image thumbnail

MIMOtool

by

 

12 Nov 2001 (Updated )

Multi Input Multi Output Systems Toolbox

ltr2;
function ltr2;

%LTR2 : ultima finestra nel controllo LQG\LTR
%
% Questa finestra permette di valutare le condizioni
% di performance,crossover e robustness del sistema
% globale,richiamando la funzione ltr3.
% E' possibile inoltre passare alla fase di evaluation
% e di simulation
%
% Massimo Davini 20/10/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;

szt=jsz+.65;

ltr_2(1)=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'',''ltr_12'',%u)',length(stack.temp.handles)),...
   'callback',sprintf('if stack.general.K_flag messag(gcf,''kns'',''back'');else back_syn(''ltr_12'',%u);end;',length(stack.temp.handles)));
   
campi=['''integratori'',''plant'',''sys'',''edit'',''incer'',',...
      '''param'',''gates'',''H'',''W'',''w'',''sv_Trol'',''sv_Tfol'',',...
      '''Kc'',''Kf'',''sv_Tlq'',''sv_Tkf'',''GK_KG'',''sv_GKKG'',''K'''];
ltr_2(2)=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));
  
ltr_2(3)=uicontrol('style','push','unit','normalized',...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'TooltipString','Evaluate the computed Controller',...
   'Horizontalalignment','center','string','EVALUATION',...
   'position',[0.39 0.05 0.275 0.12],...
   'callback','valuta;','tag','BEVAL','enable','off');

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

ltr_2(5)=uicontrol('style','Frame','units','normalized',...
   'position',[0.05 0.57 0.29 0.38],...
   'backgroundcolor',[1 1 1],'tag','ltr_2');

ltr_2(6)=uicontrol('style','push','unit','normalized',...
   'fontunits','normalized','fontsize',jsz*0.3+.35,'fontweight','bold',...
   'Horizontalalignment','center','string','PERFORMANCE',...
   'position',[0.06 0.83 0.27 0.1],...
   'callback','ltr3(1);','tag','ltr_2');

ltr_2(7)=uicontrol('style','push','unit','normalized',...
   'fontunits','normalized','fontsize',jsz*0.3+.35,'fontweight','bold',...
   'Horizontalalignment','center','string','CROSSOVER',...
   'position',[0.06 0.71 0.27 0.1],...
   'callback','ltr3(2);','tag','ltr_2');

ltr_2(8)=uicontrol('style','push','unit','normalized',...
   'fontunits','normalized','fontsize',jsz*0.3+.35,'fontweight','bold',...
   'Horizontalalignment','center','string','ROBUSTNESS',...
   'position',[0.06 0.59 0.27 0.1],...
   'callback','ltr3(3);','tag','ltr_2');

ltr_3(1)=uicontrol('style','Frame','units','normalized',...
   'position',[0.05 0.22 0.29 0.33],'visible','off',...
   'backgroundcolor',[1 1 1],'tag','cframe');

ltr_3(2)=uicontrol('style','text','unit','normalized',...
   'position',[0.06 0.48 0.27 0.05],'backgroundcolor',[1 1 1],...
   'foregroundcolor','red','tag','ctitle','visible','off',...
   'fontunits','normalized','fontsize',szt,'fontweight','bold',...
   'Horizontalalignment','left');

ltr_3(3)=uicontrol('style','text','unit','normalized',...
   'position',[0.06 0.42 0.27 0.05],'backgroundcolor',[1 1 1],...
   'foregroundcolor',[0 0 0],'tag','ctitle1','visible','off',...
   'fontunits','normalized','fontsize',szt,'fontweight','bold',...
   'Horizontalalignment','left');

ltr_3(4)=uicontrol('style','text','unit','normalized',...
   'position',[0.06 0.32 0.27 0.05],'backgroundcolor',[1 1 1],...
   'foregroundcolor',[0 0 1],'tag','co1','visible','off',...
   'fontunits','normalized','fontsize',szt,'fontweight','bold',...
   'Horizontalalignment','left');

ltr_3(5)=uicontrol('style','text','unit','normalized',...
   'position',[0.06 0.25 0.27 0.05],'backgroundcolor',[1 1 1],...
   'foregroundcolor',[0 0 1],'tag','co2','visible','off',...
   'fontunits','normalized','fontsize',szt,'fontweight','bold',...
   'Horizontalalignment','left');

set(findobj('tag','simu_2'),'enable','on');
set(findobj('tag','eval_31'),'enable','on');
drawnow;

stack.general.K_flag=1;

%aggiornamento handles temporanei
stack.temp.handles=[stack.temp.handles,ltr_2,ltr_3];

%inizializzazione stack per la valutazione  
K=stack.temp.K; 
[Ak,Bk,Ck,Dk]=unpck(K);
stack.evaluation.model=stack.general.model;   %nome modello 
stack.evaluation.kind='lqg \ ltr';            %tipo del regolatore 
stack.evaluation.K=K;                         %regolatore
stack.evaluation.plant=stack.temp.sys;        %plant

%inizializzazione stack per la simulazione
stack.simulation.kind='lqg \ ltr';  %tipo del regolatore 
stack.simulation.Ak=Ak;             %regolatore
stack.simulation.Bk=Bk;             %regolatore
stack.simulation.Ck=Ck;             %regolatore
stack.simulation.Dk=Dk;             %regolatore
if rank(stack.general.A)==size(stack.general.A,1)
   G0=stack.general.C*inv(-stack.general.A)*stack.general.B+stack.general.D;
   stack.simulation.pinvG0=pinv(G0);
else 
   stack.simulation.pinvG0=zeros(size(stack.general.D'));
end;

set(findobj('tag','file_6'),'enable','on');
set(findobj('tag','BEVAL'),'enable','on');
set(findobj('tag','BSIMU'),'enable','on');
drawnow;

ltr3(1);

Contact us