Code covered by the BSD License  

Highlights from
MIMOtool

image thumbnail

MIMOtool

by

 

12 Nov 2001 (Updated )

Multi Input Multi Output Systems Toolbox

pid2;
function pid2;
%Massimo Davini 08/11/99

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

global stack;
watchon;

set(findobj('tag','plotol'),'visible','off');
set(findobj('tag','plotcl'),'visible','off');
delgraf;
set(stack.temp.handles,'visible','off');
drawnow;

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

sz=jsz/3+.8;

pid2(1)=uicontrol('style','push','unit','normalized',...
   'fontunits','normalized','fontsize',jsz/2+.35,'fontweight','bold',...
   'Horizontalalignment','center','string','COMPUTE PID',...
   'position',[0.55 0.85 0.4 0.1],'callback','pid3 ;','tag','BREG');

pid2(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'',''pid1'',%u)',length(stack.temp.handles)),...
   'callback',sprintf('if stack.general.K_flag messag(gcf,''kns'',''back'');else back_syn(''pid1'',%u);end;',length(stack.temp.handles)));

campi=['''integratori'',''plant'',''augmplant'',''canali'',''canale'',''stabili'',''stabilicl'',''Num'',''Den'',',...
        '''flag'',''pid_type'',''parametri'',''parametri_dfl'',''dfl'',''controllo'',''time'',''grafico'''];
pid2(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','tag','BottBC',...
    'TooltipString','Back to the main SYNTHESIS window','userdata',sprintf('feval(''back_syn'',''syn0'',0,%s)',campi),...
    'callback',sprintf('if stack.general.K_flag messag(gcf,''kns'',''close'');else back_syn(''syn0'',0,%s);end;',campi));

pid2(4)=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');

pid2(5)=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');

drawnow;

nm=stack.temp.canali;
canale=stack.temp.canale;

if nm>8 
 pid2(6)=uicontrol('style','text','unit','normalized',...
   'fontunits','normalized','fontsize',sz,'fontweight','bold','tag','infopid',...
   'Horizontalalignment','left','string',sprintf('CHANNELS [1..8] on %u :',nm),...
   'position',[0.05 0.865 0.45 0.05],'backgroundcolor',[.6 .7 .9]);

 nm=8;
end;
   
for j=1:nm
fr(j)=uicontrol('style','frame','unit','normalized',...
   'position',[0.03 0.745-(j-1)*0.07 0.2 0.06],...
   'backgroundcolor',[1 1 1],'tag','infopid');

tx(j)=uicontrol('style','text','unit','normalized',...
   'fontunits','normalized','fontsize',sz,'fontweight','bold',...
   'Horizontalalignment','center','string',sprintf('CHANNEL %u-%u',j,j),...
   'position',[0.04 0.75-(j-1)*0.07 0.18 0.05],'tag','infopid',...
   'foregroundcolor','red','backgroundcolor',[1 1 1]);

if stack.temp.stabili(j) str1='STABLE';else str1='UNSTABLE';end;
switch stack.temp.pid_type(j)
case 1, str2='P';
case 2, str2='I' ;
case 3, str2='PI';
case 4, str2='PD';
case 5, str2='PID';
end;
if stack.temp.stabilicl(j) str3='STABLE';else str3='UNSTABLE';end;
info(j)=uicontrol('style','text','unit','normalized',...
   'fontunits','normalized','fontsize',sz,'fontweight','bold',...
   'Horizontalalignment','left',...
   'string',sprintf('Open Loop : %s - Closed Loop with %s : %s',str1,str2,str3),...
   'position',[0.24 0.75-(j-1)*0.07 0.73 0.05],...
   'backgroundcolor',[.6 .7 .9],'tag','infopid');

end;


stack.temp.handles=[stack.temp.handles pid2 fr tx info];

watchoff;

Contact us