www.pudn.com > Closid30.rar > Clwyoimp.m, change:1999-02-01,size:9299b


function clwyoimp 
% clwyoimp.m 
% 
% Construct window for importing coprime factorizations of 
% controller and auxiliary model for the first (signal construction) 
% step in the dual-Youla identification method. 
 
% Functions called: clsetcol,clximp 
 
% 10-05-1996 
% (c) Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 19-05-1998 
%              01-02-1999 minor corrections on window lay-out 
global CLIDscrz 
 
% Colors 
[frmcol,txtcol,edicol,pshcol,radcol,axscol,c7,c8,c9,c10,... 
modcol,edtcol,pubcol,putcol,chbcol,chtcol,txbcol,pstcol]=clsetcol; 
 
% Determine size and position of window 
z=CLIDscrz; 
posfgm=[45 z(4)-420 370 390]; 
 
% Open window: 
clfgyui=figure('Menubar','none','Color',frmcol,... 
   'pos',posfgm,'Numbertitle','off',... 
   'Name',['Construct signals'],... 
   'Resize','on','TAG','CLIMPFAC'); 
 
% Construct frame for Import Factorizations 
fryuix=0.01;fryuiy=0.01; 
fryuipos=[fryuix fryuiy .98 .7; 
          fryuix+0.06 fryuiy+0.58 .88 .08];       % "Import coprime factorizations"    
typyuipos =[fryuix+0.01 fryuiy+0.47 .22 .08;...   % "Auxil. model" 
            fryuix+0.25 fryuiy+0.50 .25 .05;...   %  
            fryuix+0.01 fryuiy+0.38 .20 .08;...   % "Format"  
            fryuix+0.25 fryuiy+0.39 .70 .08;... 
            fryuix+0.01 fryuiy+0.24 .20 .08;...   % "Controller" 
            fryuix+0.25 fryuiy+0.27 .25 .05;... 
            fryuix+0.01 fryuiy+0.16 .20 .08;...   % "Format" 
            fryuix+0.25 fryuiy+0.17 .70 .08;... 
            fryuix+0.02 fryuiy+0.07 .30 .06;...   % "IMPORT" 
            fryuix+0.34 fryuiy+0.07 .30 .06;...   % "HELP" 
            fryuix+0.66 fryuiy+0.07 .30 .06;...   % "CLOSE" 
            fryuix+0.53 fryuiy+0.48 .10 .06;...   % "File Auxil." 
            fryuix+0.69 fryuiy+0.50 .25 .05;... 
            fryuix+0.53 fryuiy+0.25 .10 .06;...   % "File Contr." 
            fryuix+0.69 fryuiy+0.27 .25 .05]; 
 
 
% Accompanying text 
uicontrol(clfgyui,'style','text','uni','nor',... 
          'pos',[0.01 0.9 0.97 0.075],'back',txbcol,'fore',txtcol,... 
          'string','SIGNALS TO BE CONSTRUCTED') ; 
uicontrol(clfgyui,'style','text','uni','nor',... 
          'pos',[0.05 0.80 0.80 0.05],'back',frmcol,'Fore',txtcol,... 
          'hori','left','string','ID-output z = inv(Dc + Gx Nc)[y - Gx u]') ; 
uicontrol(clfgyui,'style','text','uni','nor',... 
          'pos',[0.05 0.85 0.80 0.05],'back',frmcol,'Fore',txtcol,... 
          'hori','left','string','ID-input x = inv(Dx + C Nx)[u + C y]') ; 
uicontrol(clfgyui,'style','text','uni','nor',... 
          'pos',[0.05 0.75 0.80 0.05],'back',frmcol,'Fore',txtcol,... 
          'hori','left','string','Aux. variables: Gx = Nx/Dx, C = Nc/Dc') ; 
 
fryui=zeros(17,1); 
fryui(1)=uicontrol(clfgyui,'style','frame','uni','nor',... 
   'pos',fryuipos(1,:),'Back',frmcol,'fore',frmcol); 
 
fryui10=uicontrol(clfgyui,'style','frame','uni','nor',... 
        'pos',[fryuix fryuiy+0.15 0.98 0.2],... 
         'back',frmcol,'fore',frmcol); 
fryui20=uicontrol(clfgyui,'style','frame','uni','nor',... 
        'pos',[fryuix fryuiy+0.37 0.98 0.2],... 
         'back',frmcol,'fore',frmcol); 
 
 
fryui(2)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',fryuipos(2,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','GIVE Gx AND C'); 
 
%%%% Auxilary model import 
fryui(3)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',typyuipos(1,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','Auxil.model','Value',1); 
fryui(4)=uicontrol(clfgyui,'style','edit','uni','nor',... 
   'pos',typyuipos(2,:),'horiz','left',... 
   'Back',edicol,'Fore',edtcol,'tag','VARNAME1',... 
   'String','Gx'); 
fryui(14)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',typyuipos(12,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','File'); 
fryui(15)=uicontrol(clfgyui,'style','edit','uni','nor',... 
   'pos',typyuipos(13,:),'horiz','left',... 
   'Back',edicol,'Fore',edtcol,'tag','FILENAME1',... 
   'String',''); 
 
%Construct Pop-up menu for auxiliary model format choice 
fryui(5)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',typyuipos(3,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','Format'); 
stringyuix='from model board|[numx;denx]|[Ax Bx;Cx Dx]|[numNx;denNx;numDx;denDx]|[Andx Bndx;Cndx Dndx]'; 
fryui(6)=uicontrol(clfgyui,'style','popup','uni','nor',... 
   'String',stringyuix,'Back',pubcol,'Fore',putcol,... 
   'pos',typyuipos(4,:)); 
 
%%%% Controller import 
fryui(7)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',typyuipos(5,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','Controller'); 
fryui(8)=uicontrol(clfgyui,'style','edit','uni','nor',... 
   'pos',typyuipos(6,:),'horiz','left',... 
   'Back',edicol,'Fore',edtcol,'tag','VARNAME2',... 
   'String','C'); 
fryui(16)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',typyuipos(14,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','File'); 
fryui(17)=uicontrol(clfgyui,'style','edit','uni','nor',... 
   'pos',typyuipos(15,:),'horiz','left',... 
   'Back',edicol,'Fore',edtcol,'tag','FILENAME2',... 
   'String',''); 
 
 
%Construct Pop-up menu for controller format choice 
fryui(9)=uicontrol(clfgyui,'style','text','uni','nor',... 
   'pos',typyuipos(7,:),... 
   'Back',txbcol,'Fore',txtcol,... 
   'String','Format'); 
stringyuic='from controller board|[numc;denc]|[Ac Bc;Cc Dc]|[numNc;denNc;numDc;denDc]|[Andc Bndc;Cndc Dndc]'; 
fryui(10)=uicontrol(clfgyui,'style','popup','uni','nor',... 
   'String',stringyuic,'Back',pubcol,'Fore',putcol,... 
   'pos',typyuipos(8,:)); 
 
fryui(11)=uicontrol(clfgyui,'style','push','uni','nor',... 
   'pos',typyuipos(9,:),... 
   'Back',pshcol,'Fore',pstcol,... 
   'String','CONSTRUCT','Value',0); 
fryui(12)=uicontrol(clfgyui,'style','push','uni','nor',... 
   'pos',typyuipos(10,:),... 
   'Back',pshcol,'Fore',pstcol,... 
   'String','HELP','Value',0); 
fryui(13)=uicontrol(clfgyui,'style','push','uni','nor',... 
   'pos',typyuipos(11,:),... 
   'Back',pshcol,'Fore',pstcol,... 
   'String','CLOSE','Value',0); 
 
% Construct message line at the bottom of the figure 
fryui18=uicontrol(clfgyui,'style','text','uni','nor',... 
     'pos',[fryuix+0.01 fryuiy+0.01 .97 .04],... 
      'back',frmcol,'Fore',txtcol,... 
      'string','Choose transfer functions then push construct button.',... 
      'tag','YUIMPMESSAGE'); 
% 
% Make editable text for variable name and file name noneditable 
% in case input from SITB model board. 
if get(fryui(6),'value')==1 
  set(fryui(4),'style','text','back',c8,'string',' '); 
  set(fryui(15),'style','text','back',c8,'string',' '); 
end 
if get(fryui(10),'value')==1 
  set(fryui(8),'style','text','back',c8,'string',' '); 
  set(fryui(17),'style','text','back',c8,'string',' '); 
end 
% Set corresponding callback of the format pop-up menu 
% For auxiliary model: 
set(fryui(6),'callb',... 
 ['form=get(gco,''value'');'... 
 'global CLIDcols; edicol=CLIDcols(3,:); c8=CLIDcols(8,:);'... 
 'if form~=1,'... 
   'set(findobj(''tag'',''VARNAME1''),''style'',''edit'',''back'',edicol,''string'','' '');'... 
   'set(findobj(''tag'',''FILENAME1''),''style'',''edit'',''back'',edicol,''string'','' '');'... 
 'else,'... 
   'set(findobj(''tag'',''VARNAME1''),''style'',''text'',''back'',c8,''string'','' '');'... 
   'set(findobj(''tag'',''FILENAME1''),''style'',''text'',''back'',c8,''string'','' '');'... 
 'end; clear form; clear CLIDcols;']); 
% For controller: 
set(fryui(10),'callb',... 
 ['form=get(gco,''value'');'... 
 'global CLIDcols; edicol=CLIDcols(3,:); c8=CLIDcols(8,:);'... 
 'if form~=1,'... 
   'set(findobj(''tag'',''VARNAME2''),''style'',''edit'',''back'',edicol,''string'','' '');'... 
   'set(findobj(''tag'',''FILENAME2''),''style'',''edit'',''back'',edicol,''string'','' '');'... 
 'else,'... 
   'set(findobj(''tag'',''VARNAME2''),''style'',''text'',''back'',c8,''string'','' '');'... 
   'set(findobj(''tag'',''FILENAME2''),''style'',''text'',''back'',c8,''string'','' '');'... 
 'end; clear form; clear CLIDcols;']); 
% 
% Put handles in userdata of figure 
r=length(fryui); 
us=zeros(r,1); 
us(:,1)=fryui; 
set(clfgyui,'Userdata',us); 
 
% Handling CLOSE-key 
strclose='close(gcf);'; 
set(fryui(13),'callb',strclose); 
 
%Handling HELP-key 
set(fryui(12),'callb','hthelp(''clyouimp.htm'')'); 
 
% Handling IMPORT-key: data is directly transferred to object in main window 
%set(fryui(11),'callb',... 
%  ['eval(''clgximp;'',''clerrdia(''''ERROR IMPORTING AUXIL. MODEL: cannot locate variable'''',1)'');'... 
%   'eval(''clcximp;'',''clerrdia(''''ERROR IMPORTING CONTROLLER: cannot locate variable'''',1)'');'... 
%   'clsigcon(3);',... 
%   'eval(''chlight(1)'');']); 
set(fryui(11),'callb',... 
 ['eval(''clximp(''''start'''',''''Gx'''');'',''clerrdia(''''ERROR IMPORTING AUXIL. MODEL: cannot locate variable'''',1)'');'... 
 'eval(''clximp(''''start'''',''''Cx'''');'',''clerrdia(''''ERROR IMPORTING CONTROLLER: cannot locate variable'''',1)'');'... 
 'clsigcon(3);']); 
clear fryui c7 c8 c9 c10 axscol chbcol chtcol strclose radcol posfgm 
clear edicol edtcol frmcol txtcol pshcol modcol pubcol txbcol pstcol 
clear us r clfgyui z fryui10 fryui18 fryui20 fryuipos fryuix fryuiy 
clear putcol stringyuic stringyuix typyuipos