⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imcmenu.m

📁 Software for design and tuninig of SISO and MIMO contol systems
💻 M
📖 第 1 页 / 共 5 页
字号:
       temp=mq_gen(1,1,dec_M(i),1,1,order(i),y);
       [qd{i,i},qdnum{i,i},qdden{i,i}]=qd_mat(pd_prime{i,i},temp,Epsilon{2}(i),order(i),y);
       qd{i,i}=strrep(qd{i,i},'e',['e(' num2str(i) ')']);
    end
    
 case 4110
% Find Epsilon - two degree of freedom tuning
% Inner loop tuning by Partial sensitivity function
%-------------------------------------------------------------
    if maxrow > 1 | maxcol >1
       if any(iscellempty(Xmnummt)) | any(iscellempty(Xmdenmt)) | ...
             any(iscellempty(Xpnummt)) | any(iscellempty(Xpdenmt)) | ...
             any(iscellempty(qnummt)) | any(iscellempty(qdenmt))
          errordlg('Not enough data entered');
          return
       end
       mimo_freq;
       if exist('fun_handle') & ishandle(fun_handle)
           set(fun_handle,'Value',3);
           fun='mimopartial';
       end
       temp=round(64/maxrow/maxcol)-1;
       for i=1:maxcol
          temp(2)=maxcol*(i-1)+i;
          set(M1_handle(temp(2)),'Backgroundcolor',COLOR_MAP(temp(2)*temp(1),:));
       end
      % mimo_tune;
       return
    end


if cascade
   if (~isempty(m{1,1,2}) & isempty(p{1,1,2})) | isempty(vlb) | isempty(vub)
      p(:,:,2)=m(:,:,2);
      if isempty(qf{1,1}) | isempty(qfdenmt{1,1})
         errordlg('Inner loop controller has not been given');
         return
      end
      if n_of_TF>1
         [mq]=mq_gen(Xmnummt(1,1,:,2),Xmdenmt(1,1,:,2),Xmdeadmt(1,1,:,2),...
            qfnummt{1},qfdenmt{1},F_order{1},y);
      else
         [mq]=mq_gen(Xmnummt{1,1,1,2},Xmdenmt{1,1,1,2},Xmdeadmt{1,1,1,2},...
            qfnummt{1},qfdenmt{1},F_order{1},y);
      end
      Epsilon{1,1}(2)=noise_amp_e2(qf{1,1},qfnummt{1,1},qfdenmt{1,1},...
         Tcanc(2,:),m{1,1,2},F_order{1,1},Na,y,mq);
      warndlg('Perfect model! Epsilon has been set to meet noise amplification criterion.');
      return
   end
   if isempty(m{1,1,2}) | isempty(qf{1,1}) | isempty(qfdenmt{1,1})
      errordlg('Not enough data entered!');   return
   end      
else
   if (~isempty(m{1,1,1}) & isempty(p{1,1,1})) | isempty(vlb) | isempty(vub)
      p(:,:,1)=m(:,:,1);
      if isempty(qf{1,1}) | isempty(qfdenmt{1,1})
         errordlg('Inner loop controller has not been given');
         return
      end
      if n_of_TF>1
         [mq]=mq_gen(Xmnummt,Xmdenmt,Xmdeadmt,qfnummt{1},...
            qfdenmt{1},F_order{1},y);
      else
         [mq]=mq_gen(Xmnummt{1,1},Xmdenmt{1,1},Xmdeadmt{1,1},qfnummt{1},...
            qfdenmt{1},F_order{1},y);
      end
		Epsilon{1,1}(2)=noise_amp_e2(qf{1,1},qfnummt{1,1},qfdenmt{1,1},...
         Tcanc(2,:),m{1,1,2},F_order{1,1},Na,y,mq);
      warndlg('Perfect model! Epsilon has been set to meet noise amplification criterion.');
      return
   end
   if isempty(m{1,1,1}) | isempty(qf{1,1}) | isempty(qfdenmt{1,1})
      errordlg('Not enough data entered!');   return
   end      
end
[f]=crfig(250,300,300,160,'Tuning parameters (inner loop tuning)','w','none','off');
uicontrol(f,...
 'Style','text',...
 'Position',[20 110 220 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','Left',...
 'String','Filter time constant:');
uicontrol(f,...
 'Style','text',...
 'Position',[20 90 220 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',... 
 'HorizontalAlignment','Left',...
 'String','Performance specification (Mp):');
uicontrol(f,...
 'Style','text',...
 'Position',[20 70 220 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','Left',...
 'String','Maximum peak height:');
uicontrol(f,...
 'Style','text',...
 'Position',[20 130 200 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','Left',...
 'String','Emin_Dist. for noise amplification:');
if cascade
   if n_of_TF>1
      [mq]=mq_gen(Xmnummt(1,1,:,2),Xmdenmt(1,1,:,2),Xmdeadmt(1,1,:,2),...
         qfnummt{1},qfdenmt{1},F_order{1},y);
   else
      [mq]=mq_gen(Xmnummt{1,1,1,2},Xmdenmt{1,1,1,2},Xmdeadmt{1,1,1,2},...
         qfnummt{1},qfdenmt{1},F_order{1},y);
   end
   Emin2=noise_amp_e2(qf{1,1},qfnummt{1,1},qfdenmt{1,1},...
      Tcanc(2,:),m{1,1,2},F_order{1,1},Na,y,mq);
else
   if n_of_TF>1
      [mq]=mq_gen(Xmnummt,Xmdenmt,Xmdeadmt,qfnummt{1},...
         qfdenmt{1},F_order{1},y);
   else
      [mq]=mq_gen(Xmnummt{1,1},Xmdenmt{1,1},Xmdeadmt{1,1},qfnummt{1},...
         qfdenmt{1},F_order{1},y);
   end
   Emin2=noise_amp_e2(qf{1,1},qfnummt{1,1},qfdenmt{1,1},...
      Tcanc(2,:),m{1,1,1},F_order{1,1},Na,y,mq);
end
uicontrol(f,...
 'Style','text',...
 'Position',[180 130 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','center',...
 'String',num2str(Emin2));

uicontrol(f,...
 'Style','edit',...
 'Position',[180 110 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',Epsilon{1,1}(2),...
 'Callback',['Epsilon{1,1}(2)=str2num(get(gcbo,''String''));']);
if size(Mp)==1
   Mp(2)=Mp(1);
end

uicontrol(f,...
 'Style','edit',...
 'Position',[180 90 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',Mp(2),...
 'Callback',['Mp(2)=str2num(get(gcbo,''String''));']);
if size(Mp2)==1
   Mp2(2)=Mp2(1);
end
uicontrol(f,...
 'Style','edit',...
 'Position',[180 70 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',Mp2(2),...
 'Callback',['Mp2(2)=str2num(get(gcbo,''String''));']);
uicontrol(f,...
  'Style','push',...
  'Position',[20 10 50 20],...
  'String','OK',...
  'Callback',['close;','JMENU=(4110);','cback']);
uicontrol(f,...
  'Style','push',...
  'Position',[120 10 50 20],...
  'String',' Cancel',...
  'Callback','close');
uicontrol(f,...
 'Style','push',...
 'Position',[210 10 50 20],...
 'String','Help',...
 'Callback','sayhelp(4200)'); 

case {4120,4130}
    if maxrow > 1 | maxcol >1
       if any(iscellempty(Xmnummt)) | any(iscellempty(Xmdenmt)) | ...
             any(iscellempty(Xpnummt)) | any(iscellempty(Xpdenmt)) | ...
             any(iscellempty(qnummt)) | any(iscellempty(qdenmt))
          errordlg('Not enough data entered');
          return
       end
       mimo_freq;
       temp=round(64/maxrow/maxcol)-1;
       for i=1:maxcol
          temp(2)=maxcol*(i-1)+i;
          set(M1_handle(temp(2)),'Backgroundcolor',COLOR_MAP(temp(2)*temp(1),:));
       end
      % mimo_tune;
       return
    end
   if isempty(p{1,1}) | isempty(m{1,1}) | isempty(q{1,1})
      errordlg('Not enough data entered!');
   end
   [f]=crfig(250,300,300,120,'Tuning parameters (Set point tuning)','w','none','off');
uicontrol(f,...
 'Style','text',...
 'Position',[20 80 220 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','Left',...
 'String','Filter time constant:');
uicontrol(f,...
 'Style','text',...
 'Position',[20 60 200 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',... 
 'HorizontalAlignment','Left',...
 'String','Performance specification (Mp):');
uicontrol(f,...
 'Style','text',...
 'Position',[20 40 220 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','Left',...
 'String','Maximum peak height:');
uicontrol(f,...
 'Style','text',...
 'Position',[20 100 220 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','Left',...
 'String','Emin_Setp. for noise amplification:');
[Emin]=noise_amp_e(qnummt{1,1},qdenmt{1,1},order{1,1},Na,y);
uicontrol(f,...
 'Style','text',...
 'Position',[180 100 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'HorizontalAlignment','center',...
 'String',num2str(Emin));
temp=num2str(Epsilon{1,1}(2));
uicontrol(f,...
 'Style','text',...
 'Position',[200 80 70 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',temp);
temp=Epsilon{1,1}(1);
uicontrol(f,...
 'Style','edit',...
 'Position',[120 80 60 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',temp,...
 'Callback',['Epsilon{1,1}(1)=str2num(get(gcbo,''String''));']);
uicontrol(f,...
 'Style','edit',...
 'Position',[180 60 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',Mp(1),...
 'Callback',['Mp(1)=str2num(get(gcbo,''String''));']);
uicontrol(f,...
 'Style','edit',...
 'Position',[180 40 100 18],...
 'Backgroundcolor','w',...
 'Foregroundcolor','k',...
 'String',Mp2(1),...
 'Callback',['Mp2(1)=str2num(get(gcbo,''String''));']);
uicontrol(f,...
  'Style','push',...
  'Position',[20 10 50 20],...
  'String','OK',...
  'Callback',['close;','JMENU=IMENU;','cback']);
uicontrol(f,...
  'Style','push',...
  'Position',[120 10 50 20],...
  'String',' Cancel',...
  'Callback','close');
uicontrol(f,...
 'Style','push',...
 'Position',[210 10 50 20],...
 'String','Help',...
 'Callback','sayhelp(4220)'); 

case 4200
   if degree_freedom==1
      if isempty(qnummt{1,1}) | isempty(qdenmt{1,1})
         errordlg('Not enough data entered!');
         return
      end
      if maxcol > 1
         Epsilon{1}=noise_amp_MIMO(cell2str(q),order,Na,y);
      else
         Epsilon{1,1}(1)=noise_amp_e(qnummt{1,1},qdenmt{1,1},order{1,1},Na,y);
      end
      temp='The noise amplification filter time constant ';
      temp=strvcat(temp,'of the controller has been calculated and ');
      temp=strvcat(temp,'assigned to the system.');
      temp=strvcat(temp,['Epsilon =' num2str(Epsilon{1,1})]); 
      msgbox(temp,'Warning');
   else
      if any(iscellempty(qf))
         errordlg('Not enough data entered!');
         return
      end
      if cascade
         if n_of_TF>1
            [mq]=mq_gen(Xmnummt(1,1,:,2),Xmdenmt(1,1,:,2),Xmdeadmt(1,1,:,2),...
               qfnummt{1},qfdenmt{1},F_order{1},y);
         else
            [mq]=mq_gen(Xmnummt{1,1,1,2},Xmdenmt{1,1,1,2},Xmdeadmt{1,1,1,2},...
               qfnummt{1},qfdenmt{1},F_order{1},y);
         end
         temp1=m{1,1,2};
      else
         if n_of_TF>1
            [mq]=mq_gen(Xmnummt,Xmdenmt,Xmdeadmt,qfnummt{1},...
               qfdenmt{1},F_order{1},y);
         else
            [mq]=mq_gen(Xmnummt{1,1},Xmdenmt{1,1},Xmdeadmt{1,1},qfnummt{1},...
               qfdenmt{1},F_order{1},y);
         end
         temp1=m{1,1,1};
      end
      if maxcol > 1
         Epsilon{2}=noise_amp_MIMO(cell2str(q),order,Na,y);
         tmp=num2str(Epsilon{2});
      else
         Epsilon{1,1}(2)=noise_amp_e2(qf{1,1},qfnummt{1,1},qfdenmt{1,1},...
            Tcanc(2,:),temp1,F_order{1,1},Na,y,mq);
      	tmp=num2str(Epsilon{1,1}(2));
   	end
   	temp='The noise amplification filter time constant ';
      temp=strvcat(temp,'of the inner-loop controller has been ');
      temp=strvcat(temp,'calculated and assigned to the system.');
      temp=strvcat(temp,['Epsilon(2) =' tmp]); 
      msgbox(temp,'Warning');
   end
   
% Model State Feedback Gain Calculation
%-------------------------------------------------------------
case 4300
   if maxrow > 1 | maxcol > 1
       if all(iscellempty(qnummt)) | any(iscellempty(qdenmt))
          errordlg('The part of model to be inverted was not properly assigned');
          return
       end
       if degree_freedom==1
          [Ksp,K,Kdelay,Kspstr,Kstr,Ds,Dstr]=msfgainM(q,order,Epsilon{1},qdeadmt,qnummt,qdenmt,y);
          delete(diag_handle(ishandle(diag_handle))); [diag_handle]=showmsf1dfdiag(main_fig,...
             maxrow,maxcol,p,pd,m,Kspstr,d_through_p,input_delay,Kstr,Dstr);      
          view_MIMO_MSF;
       else
          if any(iscellempty(diag(pd_prime)))
             warndlg('You need to config the feedback controller!');
          else
             [Ksp,K,Kdelay,Kspstr,Kstr,Ds,Dstr]=msfgainM(q,order,Epsilon{2},qdeadmt,qnummt,qdenmt,y);
             delete(diag_handle(ishandle(diag_handle))); [diag_handle]=showmsf2dfdiag(main_fig,...
                maxrow,maxcol,p,pd,m,Kspstr,d_through_p,input_delay,Kstr,Dstr,qd,...
                prefilcal(Epsilon,order,order),Epsilon);      
             view_MIMO_MSF;
          end
       end
   else
       
   if n_of_TF > 1
      errordlg('MSF calculation does not support transfer function having 2 terms');
      return
   end
   if degree_freedom==1
      if strcmp(qnums{1,1},'Numerator') | strcmp(qnums{1,1},'') |...
            strcmp(qdens{1,1},'Denominator') |strcmp(qdens{1,1},'')
         errordlg('Not enough data entered!');
         return
      end
      [Ksp,K]=msfgain(qnums{1,1},qdens{1,1},Epsilon{1,1}(1));
   else
      if strcmp(qfnums{1,1},'Numerator') | strcmp(qfnums{1,1},'') |...
            strcmp(qfdens{1,1},'Denominator') |strcmp(qfdens{1,1},'')
         errordlg('Not enough data entered!');
         return
      end
      [Ksp,K]=msfgain(qfnums{1,1},qfdens{1,1},Epsilon{1,1}(2));
   end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -