📄 nnpredict.m
字号:
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','right', ...
'ListboxTop',0, ...
'Position',[10 130.5 100 15], ...
'String','Cost Horizon (N2)', ...
'Style','text', ...
'ToolTipStr','Horizon over which the set-point error is minimized.',...
'Tag','StaticText2');
H.Nu_text = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','right', ...
'ListboxTop',0, ...
'Position',[10 99 100 15], ...
'String','Control Horizon (Nu)', ...
'Style','text', ...
'ToolTipStr','Horizon over which the deviation in control action is minimized.',...
'Tag','StaticText2');
H.Nu_edit = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Enable',window_en, ...
'ListboxTop',0, ...
'Position',[120 99 45 15], ...
'String','2', ...
'Style','edit', ...
'ToolTipStr','Horizon over which the deviation in control action is minimized.',...
'Tag','Nu_edit');
H.rho_text2 = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','right', ...
'ListboxTop',0, ...
'Position',[189 130.5 95 15], ...
'String','Control Weighting Factor (', ...
'Style','text', ...
'ToolTipStr','Control weighting factor that multiplies the deviation in control action.',...
'Tag','StaticText2');
H.rho_text = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'FontName','Symbol', ...
'FontSize',10, ...
'ListboxTop',0, ...
'Position',[284 130.5 7 15], ...
'String','r', ...
'Style','text', ...
'ToolTipStr','Control weighting factor that multiplies the deviation in control action.',...
'Tag','StaticText2');
H.rho_text3 = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[291 130.5 4 15], ...
'String',')', ...
'Style','text', ...
'ToolTipStr','Control weighting factor that multiplies the deviation in control action.',...
'Tag','StaticText2');
H.rho_edit = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Enable',window_en, ...
'ListboxTop',0, ...
'Position',[305 130.5 45 15], ...
'String','0.03', ...
'Style','edit', ...
'ToolTipStr','Control weighting factor that multiplies the deviation in control action.',...
'Tag','rho_edit');
H.alpha_text2 = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','right', ...
'ListboxTop',0, ...
'Position',[189 99 95 15], ...
'String','Search Parameter (', ...
'Style','text', ...
'ToolTipStr','Search parameter to be used in the minimization routine.',...
'Tag','StaticText2');
H.alpha_text = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'FontName','Symbol', ...
'FontSize',10, ...
'ListboxTop',0, ...
'Position',[284 99 7 15], ...
'String','a', ...
'Style','text', ...
'ToolTipStr','Search parameter to be used in the minimization routine.',...
'Tag','StaticText2');
H.alpha_text3 = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[291 99 4 15], ...
'String',')', ...
'Style','text', ...
'ToolTipStr','Search parameter to be used in the minimization routine.',...
'Tag','StaticText2');
H.alpha_edit = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Enable',window_en, ...
'ListboxTop',0, ...
'Position',[305 99 45 15], ...
'String','0.001', ...
'Style','edit', ...
'ToolTipStr','Search parameter to be used in the minimization routine.',...
'Tag','EditText1');
H.csrchfun_edit = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Enable',window_en, ...
'ListboxTop',0, ...
'Max',5, ...
'Position',[107 68.25 58 15], ...
'String',['csrchgol';'csrchbac';'csrchhyb';'csrchbre';'csrchcha'], ...
'Style','popupmenu', ...
'Tag','PopupMenu1', ...
'Value',1);
H.csrchfun_text = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','right', ...
'ListboxTop',0, ...
'Position',[10 68.25 85 15], ...
'String','Minimization Routine', ...
'Style','text', ...
'ToolTipStr','Line search routine to be used in the optimization algorithm.',...
'Tag','StaticText3');
H.maxiter_edit = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Enable',window_en, ...
'ListboxTop',0, ...
'Position',[305 68.25 45 15], ...
'String','2', ...
'Style','edit', ...
'ToolTipStr','Maximum number of iterations of the optimization algorithm per sample time.',...
'Tag','maxiter_edit');
H.maxiter_text = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Enable',window_en, ...
'HorizontalAlignment','right', ...
'ListboxTop',0, ...
'Position',[185 68.25 110 15], ...
'String','Iterations Per Sample Time', ...
'Style','text', ...
'ToolTipStr','Maximum number of iterations of the optimization algorithm per sample time.',...
'Tag','StaticText2');
frame4 = uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'ListboxTop',0, ...
'Position',[5 12 350 22], ...
'Style','frame', ...
'Tag','Frame4');
H.error_messages(1,1)= uicontrol('Parent',fig, ...
'Units','points', ...
'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
'FontWeight','bold', ...
'ForegroundColor',[0 0 1], ...
'ListboxTop',0, ...
'Position',[6 13 348 20], ...
'Style','text', ...
'ToolTipStr','Feedback line with important messages for the user.',...
'Tag','StaticText1');
% We create the menus for the block.
H.Handles.Menus.File.Top= uimenu('Parent',fig, ...
'Label','File');
H.Handles.Menus.File.ImportModel = uimenu('Parent',...
H.Handles.Menus.File.Top,...
'Label','Import Network...',...
'Accelerator','I',...
'Callback','nncontrolutil(''nnimport'',''init'',gcbf,''nnpredict'',''nnpredict'');',...
'Enable',window_en, ...
'Tag','ImportModel');
H.Handles.Menus.File.Export = uimenu('Parent',H.Handles.Menus.File.Top, ...
'Label','Export Network...', ...
'Accelerator','E', ...
'Callback','nncontrolutil(''nnexport'',''init'',gcbf,''nnpredict'',''nnpredict'')', ...
'Enable',window_en, ...
'Tag','ExportMenu');
H.Handles.Menus.File.Save_NN = uimenu('Parent',...
H.Handles.Menus.File.Top,...
'Label','Save',...
'Separator','on', ...
'Accelerator','S',...
'Callback','nncontrolutil(''nnpredict'',''apply'');',...
'Enable',window_en, ...
'Tag','ImportModel');
H.Handles.Menus.File.Save_Exit_NN = uimenu('Parent',...
H.Handles.Menus.File.Top,...
'Label','Save and Exit',...
'Accelerator','A',...
'Callback','nncontrolutil(''nnpredict'',''ok'');',...
'Enable',window_en, ...
'Tag','ImportModel');
H.Handles.Menus.File.Close = uimenu('Parent',H.Handles.Menus.File.Top, ...
'Callback','nncontrolutil(''nnpredict'',''close'',gcbf);', ...
'Separator','on', ...
'Label','Exit', ...
'Accelerator','X', ...
'Tag','CloseMenu');
H.Handles.Menus.Window.Top = uimenu(fig, 'Label', 'Window', ...
'Callback', winmenu('callback'), 'Tag', 'winmenu');
winmenu(fig); % Initialize the submenu
H.Handles.Menus.Help.Top = uimenu('Parent',fig, ...
'Label','Help');
H.Handles.Menus.Help.Main = uimenu('Parent',H.Handles.Menus.Help.Top, ...
'Label','Main Help', ...
'Callback','nncontrolutil(''nnpredicthelp'',''main'');',...
'Accelerator','H');
H.Handles.Menus.Help.PlantIdent = uimenu('Parent',H.Handles.Menus.Help.Top, ...
'Label','Plant Identification...', ...
'CallBack','nncontrolutil(''nnpredicthelp'',''plant_ident'');');
H.Handles.Menus.Help.Simulation = uimenu('Parent',H.Handles.Menus.Help.Top, ...
'Label','Simulation...', ...
'Separator','on',...
'CallBack','nncontrolutil(''nnpredicthelp'',''simulation'');');
H.gcbh_ptr = uicontrol('Parent',fig,'visible','off');
set(H.gcbh_ptr,'userdata',arg1);
H.gcb_ptr = uicontrol('Parent',fig,'visible','off');
set(H.gcb_ptr,'userdata',arg2);
N2=get_param(arg1,'N2');
set(H.N2_edit,'string',num2str(N2));
Nu=get_param(arg1,'Nu');
set(H.Nu_edit,'string',num2str(Nu));
rho=get_param(arg1,'rho');
set(H.rho_edit,'string',num2str(rho));
alpha=get_param(arg1,'alpha');
set(H.alpha_edit,'string',num2str(alpha));
func_index=['csrchgol';'csrchbac';'csrchhyb';'csrchbre';'csrchcha'];
csrchfun=get_param(arg1,'csrchfun');
vv=strmatch(csrchfun,func_index);
set(H.csrchfun_edit,'value',vv);
maxiter=get_param(arg1,'maxiter');
set(H.maxiter_edit,'string',maxiter);
set(fig,'userdata',H)
set(H.error_messages(1,1),'string',sprintf('Perform plant identification before controller configuration.'));
end
function present_error(H,text_field,field_value,field_type,message)
if text_field~=0
if field_type % Number
set(text_field,'string',num2str(field_value));
else % ASCII or No change.
set(text_field,'string',field_value);
end
else
text_field=0;
end
set(H.error_messages,'string',message);
errordlg(message,'Plant Identification Warning','modal');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -