📄 cback.m
字号:
switch JMENU
case 1 % Number of output
if ~isempty(Xpnummt{1,1})
switch questdlg('System contains data, proceed ?');
case {'No','Cancel'}
set(MAIN_MENU(14),'Value',maxrow);
return
end
end
maxrow=get(MAIN_MENU(14),'Value');
chn_sys_dim; % change system dimension
JMENU=2; cback;
case 2 % 1-DF | 2-DF | CASCADE
if exist('diag_handle')
delete(diag_handle(ishandle(diag_handle)));
end
if exist('DYN_MENU')
delete(DYN_MENU(ishandle(DYN_MENU))); clear DYN_MENU
end
if ishandle(MAIN_MENU(12)) & MAIN_MENU(12)~=0
delete(MAIN_MENU(12));
end
delete(MAIN_MENU(10));
set(MAIN_MENU(14),'Value',maxrow);
set(MAIN_MENU(16),'Value',maxcol);
switch get(MAIN_MENU(15),'Value')
case 1
if cascade
if ~isempty(Xpnummt{1,1,1,2}) |~isempty(Xpdenmt{1,1,1,2})
switch questdlg('Data of the cascade system will be erased, proceed ?');
case {'No','Cancel'}
set(MAIN_MENU(15),'Value',3);
JMENU=2;cback;
return
end
end
p(:,:,2)=[];Xpnums(:,:,:,2)=[]; Xpdens(:,:,:,2)=[];Xpdeads(:,:,:,2)=[];
m(:,:,2)=[];Xmnums(:,:,:,2)=[]; Xmdens(:,:,:,2)=[];Xmdeads(:,:,:,2)=[];
Xunidn(:,:,:,2)=[]; Xunidd(:,:,:,2)=[];Xuniddt(:,:,:,2)=[];
Xmunidn(:,:,:,2)=[];Xmunidd(:,:,:,2)=[];Xmuniddt(:,:,:,2)=[];
Xpnummt(:,:,:,2)=[];Xpdenmt(:,:,:,2)=[];Xpdeadmt(:,:,:,2)=[];
Xmnummt(:,:,:,2)=[];Xmdenmt(:,:,:,2)=[];Xmdeadmt(:,:,:,2)=[];
Xpnum(:,:,:,2)=[];Xpden(:,:,:,2)=[];Xpdead(:,:,:,2)=[];
Xmnum(:,:,:,2)=[];Xmden(:,:,:,2)=[];Xmdead(:,:,:,2)=[];
uindex(:,:,2)=[];muindex(:,:,2)=[];
end
degree_freedom=1;
cascade=0;
set(MAIN_MENU(19),'Enable','on');
if maxrow<=1 & maxcol<=1
qfnums(:)={'Numerator'};
qfdens(:)={'Denominator'};
qfnum(:)={''};
qfden(:)={''};
qfnummt(:)={[]};
qfdenmt(:)={[]};
qd(:)={'1'};
qfdenc(:)={''};
end
diag_handle=show1dfdiag(main_fig,maxrow,maxcol,p,...
pd,m,qnummt,d_through_p,input_delay);
set(MAIN_MENU(3),'Enable','on');
set(MAIN_MENU(6),'Enable','on');
set(MAIN_MENU(11),'Enable','on');
%DYN_MENU=zeros(1,14);
DYN_MENU(1)=uimenu(MAIN_MENU(4),...
'Label',' &Tuning ','Callback',['IMENU=4100;','imcmenu']);
DYN_MENU(2)=uimenu(MAIN_MENU(4),...
'Label',' &Model state Feedback(MSF) K, Ksp ','Callback',['IMENU=4300;','imcmenu']);
DYN_MENU(3)=uimenu(MAIN_MENU(4),...
'Label',' Find uncertainty & bounds ','Callback',['IMENU=4400;','imcmenu']);
DYN_MENU(4)=uimenu(MAIN_MENU(4),...
'Label',' Tuning for lower bound &saturation ','Callback',['IMENU=4500;','imcmenu']);
DYN_MENU(5)=uimenu(MAIN_MENU(4),...
'Label',' &PID Controller ','Callback',['IMENU=4600;','imcmenu']);
if maxcol > 1 | maxcol > 1
DYN_MENU(12)=uimenu(MAIN_MENU(4),...
'Label',' &Noise amplification filter ','Callback',['IMENU=4200;','imcmenu']);
DYN_MENU(6)=uimenu(MAIN_MENU(4),...
'Label',' Frequency response ','Callback',['IMENU=4700;','imcmenu']);
DYN_MENU(7)=uimenu(MAIN_MENU(4),...
'Label',' &Help ','Callback','sayhelp(4900)');
DYN_MENU(8)=uimenu(MAIN_MENU(8),...
'Label','&IMC diagram','Callback',['IMENU=7400;','imcmenu']);
DYN_MENU(9)=uimenu(MAIN_MENU(8),...
'Label','&Realizable PID diagram','Callback',['IMENU=7410;','imcmenu']);
DYN_MENU(10)=uimenu(MAIN_MENU(8),...
'Label','&1st order lag PID diagram','Callback',['IMENU=7420;','imcmenu']);
DYN_MENU(11)=uimenu(MAIN_MENU(8),...
'Label','&2nd order lag PID diagram','Callback',['IMENU=7430;','imcmenu']);
else
DYN_MENU(14)=uimenu(MAIN_MENU(4),...
'Label',' &Noise amplification filter ','Callback',['IMENU=4200;','imcmenu']);
DYN_MENU(6)=uimenu(MAIN_MENU(4),...
'Label',' Frequency response ');
DYN_MENU(7)=uimenu(DYN_MENU(6),...
'Label',' TF between setpoint and output ');
uimenu(DYN_MENU(7),...
'Label',' &Upper bound ','Callback',['IMENU=4700;','imcmenu']);
uimenu(DYN_MENU(7),...
'Label',' &Lower bound ','Callback',['IMENU=4710;','imcmenu']);
uimenu(DYN_MENU(7),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4720;','imcmenu']);
DYN_MENU(8)=uimenu(DYN_MENU(6),...
'Label',' TF between disturbance and output');
uimenu(DYN_MENU(8),...
'Label',' &Upper bound ','Callback',['IMENU=4800;','imcmenu']);
uimenu(DYN_MENU(8),...
'Label',' &Lower bound ','Callback',['IMENU=4810;','imcmenu']);
uimenu(DYN_MENU(8),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4820;','imcmenu']);
DYN_MENU(9)=uimenu(MAIN_MENU(4),...
'Label',' &Help ','Callback','sayhelp(4900)');
DYN_MENU(10)=uimenu(MAIN_MENU(8),...
'Label','&IMC diagram','Callback',['IMENU=7400;','imcmenu']);
DYN_MENU(11)=uimenu(MAIN_MENU(8),...
'Label','&Realizable PID diagram','Callback',['IMENU=7410;','imcmenu']);
DYN_MENU(12)=uimenu(MAIN_MENU(8),...
'Label','&1st order lag PID diagram','Callback',['IMENU=7420;','imcmenu']);
DYN_MENU(13)=uimenu(MAIN_MENU(8),...
'Label','&2nd order lag PID diagram','Callback',['IMENU=7430;','imcmenu']);
end
set(MAIN_MENU(8),'Label','&PID diagrams ');
MAIN_MENU(10)=uimenu(MAIN_MENU(5),...
'Label',' IMC && PID step responses','Callback',['IMENU=5200;','imcmenu']);
if maxrow > 1
set(DYN_MENU(3),'Enable','off');
set(DYN_MENU(4),'Enable','off');
set(MAIN_MENU(13),'Enable','off');
% set(DYN_MENU(14),'Enable','off');
set(DYN_MENU(5),'Enable','off');
else
set(DYN_MENU(3),'Enable','on');
set(DYN_MENU(4),'Enable','on');
set(MAIN_MENU(13),'Enable','on');
% set(DYN_MENU(14),'Enable','on');
set(DYN_MENU(5),'Enable','on');
end
case 2
if cascade
if ~isempty(Xpnummt{1,1,1,2}) |~isempty(Xpdenmt{1,1,1,2})
switch questdlg('Data of the cascade system will be erased, proceed ?');
case {'No','Cancel'}
set(MAIN_MENU(15),'Value',3);
JMENU=2;cback;
return
end
end
p(:,:,2)=[];Xpnums(:,:,:,2)=[]; Xpdens(:,:,:,2)=[];Xpdeads(:,:,:,2)=[];
m(:,:,2)=[];Xmnums(:,:,:,2)=[]; Xmdens(:,:,:,2)=[];Xmdeads(:,:,:,2)=[];
Xunidn(:,:,:,2)=[]; Xunidd(:,:,:,2)=[];Xuniddt(:,:,:,2)=[];
Xmunidn(:,:,:,2)=[];Xmunidd(:,:,:,2)=[];Xmuniddt(:,:,:,2)=[];
Xpnummt(:,:,:,2)=[];Xpdenmt(:,:,:,2)=[];Xpdeadmt(:,:,:,2)=[];
Xmnummt(:,:,:,2)=[];Xmdenmt(:,:,:,2)=[];Xmdeadmt(:,:,:,2)=[];
Xpnum(:,:,:,2)=[];Xpden(:,:,:,2)=[];Xpdead(:,:,:,2)=[];
Xmnum(:,:,:,2)=[];Xmden(:,:,:,2)=[];Xmdead(:,:,:,2)=[];
uindex(:,:,2)=[];muindex(:,:,2)=[];
end
degree_freedom=2;
cascade=0;
set(MAIN_MENU(19),'Enable','on');
diag_handle=show2dfdiag(main_fig,maxrow,maxcol,p,...
pd,m,qnummt,qfnummt,d_through_p,input_delay);
set(MAIN_MENU(3),'Enable','on');
set(MAIN_MENU(6),'Enable','on');
set(MAIN_MENU(11),'Enable','on');
DYN_MENU=zeros(1,14);
DYN_MENU(1)=uimenu(MAIN_MENU(4),...
'Label',' &2-degree of freedom tuning ');
DYN_MENU(2)=uimenu(DYN_MENU(1),...
'Label',' &Inner loop tuning ');
uimenu(DYN_MENU(2),...
'Label','Partial sensitivity function','Callback',['IMENU=4110;','imcmenu']);
uimenu(DYN_MENU(2),...
'Label','Integrated sensitivity function','Enable',...
'off','Callback',['IMENU=4200;','imcmenu4']);
uimenu(DYN_MENU(1),...
'Label',' &Set point response tuning ','Callback',['IMENU=4120;','imcmenu']);
DYN_MENU(5)=uimenu(MAIN_MENU(4),...
'Label',' &Noise amplification filter (inner loop)','Callback',['IMENU=4200;','imcmenu']);
DYN_MENU(3)=uimenu(MAIN_MENU(4),...
'Label',' &Model state Feedback(MSF) K, Ksp ','Callback',['IMENU=4300;','imcmenu']);
DYN_MENU(4)=uimenu(MAIN_MENU(4),...
'Label',' 2-degree of freedom P&ID Controller ','Callback',['IMENU=4600;','imcmenu']);
if maxcol > 1
DYN_MENU(6)=uimenu(MAIN_MENU(4),...
'Label',' Frequency response ','Callback',['IMENU=4700;','imcmenu']);
DYN_MENU(7)=uimenu(MAIN_MENU(4),...
'Label',' &Help ','Callback','sayhelp(4900)');
DYN_MENU(8)=uimenu(MAIN_MENU(8),...
'Label','&IMC diagram','Callback',['IMENU=7440;','imcmenu']);
DYN_MENU(9)=uimenu(MAIN_MENU(8),...
'Label','&Realizable PID diagram','Callback',['IMENU=7450;','imcmenu']);
DYN_MENU(10)=uimenu(MAIN_MENU(8),...
'Label','&1st order lag PID diagram','Callback',['IMENU=7460;','imcmenu']);
DYN_MENU(11)=uimenu(MAIN_MENU(8),...
'Label','&2nd order lag PID diagram','Callback',['IMENU=7470;','imcmenu']);
DYN_MENU(12)=uimenu(MAIN_MENU(8),...
'Label','&Floating Integral diagram','Callback',['IMENU=7480;','imcmenu']);
DYN_MENU(13)=uimenu(MAIN_MENU(8),...
'Label','PI &lag diagram','Callback',['IMENU=7490;','imcmenu']);
DYN_MENU(14)=uimenu(MAIN_MENU(8),...
'Label','&PI &diagram','Callback',['IMENU=7500;','imcmenu']);
else
DYN_MENU(6)=uimenu(MAIN_MENU(4),...
'Label',' Frequency response ');
DYN_MENU(7)=uimenu(DYN_MENU(6),...
'Label',' TF between setpoint and output ');
uimenu(DYN_MENU(7),...
'Label',' &Upper bound ','Callback',['IMENU=4700;','imcmenu']);
uimenu(DYN_MENU(7),...
'Label',' &Lower bound ','Callback',['IMENU=4710;','imcmenu']);
uimenu(DYN_MENU(7),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4720;','imcmenu']);
DYN_MENU(8)=uimenu(DYN_MENU(6),...
'Label',' TF between disturbance and output');
DYN_MENU(9)=uimenu(DYN_MENU(8),...
'Label',' Sensitivity function ');
uimenu(DYN_MENU(9),...
'Label',' &Upper bound ','Callback',['IMENU=4800;','imcmenu']);
uimenu(DYN_MENU(9),...
'Label',' &Lower bound ','Callback',['IMENU=4810;','imcmenu']);
uimenu(DYN_MENU(9),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4820;','imcmenu']);
DYN_MENU(10)=uimenu(DYN_MENU(8),...
'Label',' Integrated sensitivity function ');
uimenu(DYN_MENU(10),...
'Label',' &Upper bound ','Callback',['IMENU=4900;','imcmenu']);
uimenu(DYN_MENU(10),...
'Label',' &Lower bound ','Callback',['IMENU=4910;','imcmenu']);
uimenu(DYN_MENU(10),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4920;','imcmenu']);
DYN_MENU(11)=uimenu(DYN_MENU(8),...
'Label',' Normallized integrated sensitivity function ');
uimenu(DYN_MENU(11),...
'Label',' &Upper bound ','Callback',['IMENU=4930;','imcmenu']);
uimenu(DYN_MENU(11),...
'Label',' &Lower bound ','Callback',['IMENU=4940;','imcmenu']);
uimenu(DYN_MENU(11),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4950;','imcmenu']);
uimenu(DYN_MENU(8),...
'Label',' &3-D upper bound surface of PSF','Enable',...
'off','Callback',['IMENU=8000;','imcmenu2']);
DYN_MENU(12)=uimenu(DYN_MENU(8),...
'Label',' Partial sensitivity function (PSF) ');
uimenu(DYN_MENU(12),...
'Label',' &Upper bound ','Callback',['IMENU=4830;','imcmenu']);
uimenu(DYN_MENU(12),...
'Label',' &Lower bound ','Callback',['IMENU=4840;','imcmenu']);
uimenu(DYN_MENU(12),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4850;','imcmenu']);
DYN_MENU(13)=uimenu(MAIN_MENU(4),...
'Label',' &Help ','Callback','sayhelp(4900)');
DYN_MENU(14)=uimenu(MAIN_MENU(8),...
'Label','&IMC diagram','Callback',['IMENU=7440;','imcmenu']);
DYN_MENU(15)=uimenu(MAIN_MENU(8),...
'Label','&Realizable PID diagram','Callback',['IMENU=7450;','imcmenu']);
DYN_MENU(16)=uimenu(MAIN_MENU(8),...
'Label','&1st order lag PID diagram','Callback',['IMENU=7460;','imcmenu']);
DYN_MENU(17)=uimenu(MAIN_MENU(8),...
'Label','&2nd order lag PID diagram','Callback',['IMENU=7470;','imcmenu']);
DYN_MENU(18)=uimenu(MAIN_MENU(8),...
'Label','&Floating Integral diagram','Callback',['IMENU=7480;','imcmenu']);
DYN_MENU(19)=uimenu(MAIN_MENU(8),...
'Label','PI &lag diagram','Callback',['IMENU=7490;','imcmenu']);
DYN_MENU(20)=uimenu(MAIN_MENU(8),...
'Label','&PI &diagram','Callback',['IMENU=7500;','imcmenu']);
end
set(MAIN_MENU(8),'Label',' &PID diagrams ');
MAIN_MENU(10)=uimenu(MAIN_MENU(5),...
'Label',' IMC && PID step responses','Callback',['IMENU=5200;','imcmenu']);
case 3
degree_freedom=2;
cascade=1;
if ndims(Xpnums) < 4
p(:,:,2)={''};Xpnums(:,:,:,2)={'Numerator'}; Xpdens(:,:,:,2)={'Denominator'};
Xpdnums(:,:,:,2)={'1'}; Xpddens(:,:,:,2)={'1'};
Xpdeads(:,:,:,2)={'Deadtime'};Xunidn(:,:,:,2)={[0]}; Xunidd(:,:,:,2)={[0]};
Xuniddt(:,:,:,2)={[0]};Xpnummt(:,:,:,2)={[]};Xpdenmt(:,:,:,2)={[]};
Xpdnummt(:,:,:,2)={[1]};Xpddenmt(:,:,:,2)={[1]};
Xpdeadmt(:,:,:,2)={[]};Xpnum(:,:,:,2)={''};Xpden(:,:,:,2)={''};
Xpdead(:,:,:,2)={''};uindex(:,:,2)={[]};
Xpdnum(:,:,:,2)={'1'};Xpdden(:,:,:,2)={'1'};
Xpdunidn(:,:,:,2)={[0]}; Xpdunidd(:,:,:,2)={[0]}; pduindex(:,:,2)={[]};
m(:,:,2)={''};Xmnums(:,:,:,2)={'Numerator'}; Xmdens(:,:,:,2)={'Denominator'};
Xmdeads(:,:,:,2)={'Deadtime'};Xmnummt(:,:,:,2)={[]};Xmdenmt(:,:,:,2)={[]};
Xmdeadmt(:,:,:,2)={[]};Xmunidn(:,:,:,2)={[0]};Xmunidd(:,:,:,2)={[0]};
Xmuniddt(:,:,:,2)={[0]};Xmnum(:,:,:,2)={''};Xmden(:,:,:,2)={''};
Xmdead(:,:,:,2)={''};muindex(:,:,2)={[]};
end
d_through_p=0;
set(MAIN_MENU(19),'Value',d_through_p);
set(MAIN_MENU(19),'Enable','off');
diag_handle=showCascade(main_fig,maxrow,maxcol,Xpnummt,Xpdnummt,...
Xmnummt,qnummt,qfnummt);
set(MAIN_MENU(3),'Enable','off');
set(MAIN_MENU(6),'Enable','off');
set(MAIN_MENU(11),'Enable','off');
DYN_MENU=zeros(1,21);
DYN_MENU(1)=uimenu(MAIN_MENU(4),...
'Label',' &2-degree of freedom tuning ');
DYN_MENU(2)=uimenu(DYN_MENU(1),...
'Label',' &Inner loop tuning ');
uimenu(DYN_MENU(2),...
'Label','Partial sensitivity function','Callback',['IMENU=4110;','imcmenu']);
uimenu(DYN_MENU(2),...
'Label','Integrated sensitivity function','Enable',...
'off','Callback',['IMENU=4200;','imcmenu4']);
uimenu(DYN_MENU(1),...
'Label',' &Set point response tuning ','Callback',['IMENU=4130;','imcmenu']);
DYN_MENU(20)=uimenu(MAIN_MENU(4),...
'Label',' &Noise amplification filter (inner loop)','Callback',['IMENU=4200;','imcmenu']);
DYN_MENU(3)=uimenu(MAIN_MENU(4),...
'Label',' &Model state Feedback(MSF) K, Ksp ','Enable','off',...
'Callback',['IMENU=4300;','imcmenu']);
DYN_MENU(4)=uimenu(MAIN_MENU(4),...
'Label',' IMC with inner loop PID controller ','Callback',['IMENU=4600;','imcmenu']);
DYN_MENU(21)=uimenu(MAIN_MENU(4),...
'Label',' Classical PID cascade controller ','Callback',['IMENU=4650;','imcmenu']);
DYN_MENU(5)=uimenu(MAIN_MENU(4),...
'Label',' Frequency response ');
DYN_MENU(6)=uimenu(DYN_MENU(5),...
'Label',' Outer loop TF from r to y1 ');
uimenu(DYN_MENU(6),...
'Label',' &Upper bound ','Callback',['IMENU=4700;','imcmenu']);
uimenu(DYN_MENU(6),...
'Label',' &Lower bound ','Callback',['IMENU=4710;','imcmenu']);
uimenu(DYN_MENU(6),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4720;','imcmenu']);
DYN_MENU(7)=uimenu(DYN_MENU(5),...
'Label',' Inner loop TF from d2 to y2');
DYN_MENU(8)=uimenu(DYN_MENU(7),...
'Label',' Sensitivity function ');
uimenu(DYN_MENU(8),...
'Label',' &Upper bound ','Callback',['IMENU=4800;','imcmenu']);
uimenu(DYN_MENU(8),...
'Label',' &Lower bound ','Callback',['IMENU=4810;','imcmenu']);
uimenu(DYN_MENU(8),...
'Label',' Upp&er and lower bounds ','Callback',['IMENU=4820;','imcmenu']);
DYN_MENU(9)=uimenu(DYN_MENU(7),...
'Label',' Integrated sensitivity function ');
uimenu(DYN_MENU(9),...
'Label',' &Upper bound ','Callback',['IMENU=4900;','imcmenu']);
uimenu(DYN_MENU(9),...
'Label',' &Lower bound ','Callback',['IMENU=4910;','imcmenu']);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -