📄 da_olset.m
字号:
%
% da_olset
%
% Sets up the programme to run in on-line
% mode.
%
% In order for the communications to function
% the Serial Port communcations interface MUST
% be running otherwise errors will be generated
%
da_front;
drawnow;
set(w1,'NumberTitle','off','Name','Configuring for OnLine operation');
drawnow;
%
% Flash up a warning dialog
%
dialog('style','error','replace','on','resize','off','name','WARNING...','Textstring','Data transfer software MUST be running');
drawnow;
%
% Options for on line predictions
%
check1=uicontrol(w1,...
'style','check',...
'position',[10 350 130 20],...
'string','On-Line prediction',...
'foregroundcolor',[1 1 1],...
'backgroundcolor',[0 0 0],...
'callback','ol_pred_active=get(check1,''value'');');
%
% Set this checkbox if the programme knows about a file
%
set(check1,'value',ol_pred_active);
but1=uicontrol(w1,...
'style','push',...
'position',[150 350 130 20],...
'string','Select a model file',...
'callback',[
'[df_name df_path]=uigetfile(''*.mat'',''Select a model file'');',...
'if df_name ~= 0;',...
'ol_mod_path=df_path;',...
'ol_mod_name=df_name;',...
'set(text1,''string'',[''File: '' df_path df_name]);',...
'drawnow;',...
'set(check1,''value'',1);',...
'ol_pred_active=1;',...
'end;']);
text1=da_text(w1,290,352,300,15,['File: ' ol_mod_path ol_mod_name],[1 1 1],[0 0 1]);
%
% Options for on-line PCA
%
check2=uicontrol(w1,...
'style','check',...
'position',[10 300 130 20],...
'string','On-Line PCA',...
'foregroundcolor',[1 1 1],...
'backgroundcolor',[0 0 0],...
'callback','ol_pca_active=get(check2,''value'');');
set(check2,'value',ol_pca_active);
but2=uicontrol(w1,...
'style','push',...
'position',[150 300 130 20],...
'string','Select a config file',...
'callback',[
'[df_name df_path]=uigetfile(''*.mat'',''Select a configuration file'');',...
'if df_name ~= 0;',...
'ol_pca_path=df_path;',...
'ol_pca_name=df_name;',...
'set(text2,''string'',[''File: '' df_path df_name]);',...
'drawnow;',...
'set(check2,''value'',1);',...
'ol_pca_active=1;',...
'end;']);
text2=da_text(w1,290,302,300,15,['File: ' ol_pca_path ol_pca_name],[1 1 1],[0 0 1]);
%
% Select a data transfer file
%
but3=uicontrol(w1,...
'style','push',...
'position',[150 250 130 20],...
'string','Select a transfer file',...
'callback',[
'[df_name df_path]=uigetfile(''*.dat'',''Select a model file'');',...
'if df_name ~= 0;',...
'ol_pca_path=df_path;',...
'ol_pca_name=df_name;',...
'set(text2,''string'',[''File: '' df_path df_name]);',...
'drawnow;',...
'end;']);
text3=da_text(w1,290,252,300,15,['File: ' ol_trans_path ol_trans_name],[1 1 1],[0 0 1]);
%
% Text objects for analyse model option
%
text4=da_text(w1,300,200,250,15,'Model type: UNKNOWN',[1 1 1],[1 0 0]);
text5=da_text(w1,300,180,250,15,'Number of inputs: UNKNOWN',[1 1 1],[1 0 0]);
text6=da_text(w1,300,160,250,15,'Scaling option: UNKNOWN',[1 1 1],[1 0 0]);
%
% Analyse model files button
%
but4=uicontrol(w1,...
'style','push',...
'position',[150 200 130 20],...
'string','Display Model Info',...
'callback',[
'if ol_pred_active == 1;',...
'[D L]=size(ol_mod_path);',...
'eval([''cd '' df_path]);',...
'eval([''load '' ol_mod_name]);',...
'if ol_mod_type == 1;',...
'set(text4,''string'',''Model type: STATIC LINEAR'');',...
'elseif ol_mod_type == 2;',...
'set(text4,''string'',''Model type: LINEAR DYNAMIC'');',...
'elseif ol_mod_type == 3;',...
'set(text4,''string'',''Model type: NON-LINEAR DYNAMIC'');',...
'elseif ol_mod_type == 4;',...
'set(text4,''string'',''Model type: NON-LINEAR STATIC'');',...
'end;',...
'[D L]=size(ol_coefs);',...
'set(text5,''string'',[''Number of inputs: '' num2str(D)]);',...
'if ol_scl_opt == 1;',...
'set(text6,''String'',''Scaling option: UNIT VARIANCE'');',...
'elseif ol_scl_opt == 2;',...
'set(text6,''String'',''Scaling option: 0---->1 SCALING'');',...
'end;',...
'end;']);
%
% Draw a big bastard box
%
box1=uicontrol(w1,...
'style','frame',...
'position',[20 20 580 110],...
'foregroundcolor',[1 1 1],...
'backgroundcolor',[0 0 1]);
%
% + a title
%
text7=da_text(w1,40,110,100,15,'Runtime options:',[1 1 1],[0 0 1]);
%
% Number of plot points
%
text8=da_text(w1,50,90,160,15,'Number of storage points:',[1 1 1],[0 0 1]);
text9=uicontrol(w1,...
'style','edit',...
'position',[220 90 75 15],...
'string',num2str(ol_plot_store),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text9,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text9,''string'',num2str(a));',...
'ol_plot_store=a;',...
'else;',...
'set(text9,''string'',num2str(ol_plot_store));',...
'end']);
%
% Minimum y scale
%
text10=da_text(w1,50,70,160,15,'Prediction plot Y-scale min:',[1 1 1],[0 0 1]);
text11=uicontrol(w1,...
'style','edit',...
'position',[220 70 75 15],...
'string',num2str(ol_plot_ymin),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text11,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text11,''string'',num2str(a));',...
'ol_plot_ymin=a;',...
'else;',...
'set(text11,''string'',num2str(ol_plot_ymin));',...
'end']);
%
% Yscale maximum
%
text12=da_text(w1,50,50,160,15,'Prediction plot Y-scale max:',[1 1 1],[0 0 1]);
text13=uicontrol(w1,...
'style','edit',...
'position',[220 50 75 15],...
'string',num2str(ol_plot_ymax),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text13,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text13,''string'',num2str(a));',...
'ol_plot_ymax=a;',...
'else;',...
'set(text13,''string'',num2str(ol_plot_ymax));',...
'end']);
%
% Maximum time to wait for data
%
text14=da_text(w1,50,30,160,15,'Maximum data wait (sec):',[1 1 1],[0 0 1]);
text15=uicontrol(w1,...
'style','edit',...
'position',[220 30 75 15],...
'string',num2str(ol_read_wait),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text15,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text15,''string'',num2str(a));',...
'ol_read_wait=a;',...
'else;',...
'set(text15,''string'',num2str(ol_read_wait));',...
'end']);
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% ON - LINE PCA CONFIGURATION
% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%
% x-axis PC
%
text16=da_text(w1,320,90,160,15,'X -axis principal comp:',[1 1 1],[0 0 1]);
text17=uicontrol(w1,...
'style','edit',...
'position',[490 90 75 15],...
'string',num2str(ol_xaxis_pc),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text17,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text17,''string'',num2str(a));',...
'ol_xaxis_pc=a;',...
'else;',...
'set(text17,''string'',num2str(ol_xaxis_pc));',...
'end']);
%
% y-axis pc
%
text18=da_text(w1,320,70,160,15,'Y -axis principal comp:',[1 1 1],[0 0 1]);
text19=uicontrol(w1,...
'style','edit',...
'position',[490 70 75 15],...
'string',num2str(ol_yaxis_pc),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text19,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text19,''string'',num2str(a));',...
'ol_yaxis_pc=a;',...
'else;',...
'set(text19,''string'',num2str(ol_yaxis_pc));',...
'end']);
%
% Component buffer size
%
text20=da_text(w1,320,50,160,15,'PC plot buffer size:',[1 1 1],[0 0 1]);
text21=uicontrol(w1,...
'style','edit',...
'position',[490 50 75 15],...
'string',num2str(ol_pc_buffer),...
'foregroundcolor',[0 0 0],...
'backgroundcolor',[1 1 1],...
'callback',[
'a=get(text21,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text21,''string'',num2str(a));',...
'ol_pc_buffer=a;',...
'else;',...
'set(text21,''string'',num2str(ol_pc_buffer));',...
'end']);
%
% Run button
%
but5=uicontrol(w1,...
'style','push',...
'position',[150 155 130 40],...
'string','RUN OnLine!',...
'callback',[
'if ol_pred_active == 1;',...
'[D L]=size(ol_mod_path);',...
'df_path=num2str(ol_mod_path(:,1:L-1));',...
'eval([''cd '' df_path]);',...
'eval([''load '' ol_mod_name]);',...
'end;',...
'if ol_pca_active == 1;',...
'[D L]=size(ol_pca_path);',...
'df_path=num2str(ol_pca_path(:,1:L-1));',...
'eval([''cd '' df_path]);',...
'eval([''load '' ol_pca_name]);',...
'end;',...
'da_olr;']);
text22=da_text(w1,150,400,300,15,'Welcome to the OnLine Predictor...',[1 1 1],[0 0 1]);
text23=da_text(w1,460,30,120,15,'(c)1995 H.G.Hiden',[1 1 1],[0 0 1]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -