📄 tempsimumain.m
字号:
function varargout = TempSimuMain(varargin)
% TEMPSIMUMAIN M-file for TempSimuMain.fig
% TEMPSIMUMAIN, by itself, creates a new TEMPSIMUMAIN or raises the existing
% singleton*.
%
% H = TEMPSIMUMAIN returns the handle to a new TEMPSIMUMAIN or the handle to
% the existing singleton*.
%
% TEMPSIMUMAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TEMPSIMUMAIN.M with the given input arguments.
%
% TEMPSIMUMAIN('Property','Value',...) creates a new TEMPSIMUMAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before TempSimuMain_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to TempSimuMain_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above textCurrentSet to modify the response to help TempSimuMain
% Last Modified by GUIDE v2.5 04-Jul-2005 15:07:11
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TempSimuMain_OpeningFcn, ...
'gui_OutputFcn', @TempSimuMain_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before TempSimuMain is made visible.
function TempSimuMain_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to TempSimuMain (see VARARGIN)
% Choose default command line output for TempSimuMain
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
clc
disp('启动 热轧温度仿真系统 ... ')
% 导入数据
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% file=strcat(pwd,'\data\2050\正常数据.xls');
% [handles.Data handles.VarName]=xlsread(file);
load initialization;
handles.Data=Data;
handles.VarName=VarName;
handles.PathDefault=pwd;
FM.Temp_simu=Temp_simu;
FM.Temp_act=Temp_act;
FM.Temp_pre=Temp_pre;
set(handles.btnMultiSimu,'Userdata',[]);
set(handles.btnMultiSimu,'Userdata',FM); % 仿真结果存入btnMultiSimu控件
data=handles.Data;
handles.FileName='正常数据.xls';
handles.PathName=strcat(handles.PathDefault,'\data\2050\');
guidata(hObject,handles);
set(findobj('name','热轧温度仿真工具'),'Userdata',[]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 加入搜索路径
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
addpath(handles.PathDefault)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 进度条
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
handle=waitbar(0,'热轧温度仿真系统 ...');
pause(0.5);
for i=1:100
waitbar(i/100,handle,['完成 ',num2str(i),'% '],handle);
end
close(handle);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 当前时间
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(handles.textTime,'String',date);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 主界面窗口设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 动态显示图形坐标值
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dynpoint(handles.axes1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 窗口位置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set(hObject,'outerposition', get(0,'screensize'));
set(hObject,'outerposition', [-3 27 1032 746]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 工具栏
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(hObject,'Toolbar','figure');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 菜单
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(handles.figure1,'Menubar','none')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 按钮控件的背景设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load BtnCData;
% X_help=imread('G:\Documents and Settings\ershuizi\桌面\help.tif');
% X_close=imread('G:\Documents and Settings\ershuizi\桌面\close.tif');
% X_graph=imread('G:\Documents and Settings\ershuizi\桌面\graph.jpg');
% X_table=imread('G:\Documents and Settings\ershuizi\桌面\table.jpg');
% X_plotbrowser=imread('G:\Documents and Settings\ershuizi\桌面\plotbrowser.jpg');
% save BtnCData;
set(handles.btnHelp,'CData',X_help);
set(handles.btnClose,'CData',X_close);
set(handles.btnUpStrip,'CData',X_larrow);
set(handles.btnDownStrip,'CData',X_rarrow);
set(handles.btnGraph,'CData',X_graph);
set(handles.btnTable,'CData',X_table);
set(handles.btnPlotBrowser,'CData',X_plotbrowser);
% [X_up map_up]=imread('G:\Documents and Settings\ershuizi\桌面\up.ico');
% RGB_up = ind2rgb(X_up,map_up);
% set(handles.btnUpStrip,'CData',RGB_up);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 清除工作间的参数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear Eparam Mparam Sresult;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 设备参数初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Eparam.DIS_BETWEEN_STAND =[6.0E3 6.0E3 6.0E3 6.0E3 6.0E3 6.0E3];
Eparam.DIS_F7_MH = 7.68E3;
% Eparam.x_radius=0.5*[765.0,765.0,765.0,685.0,685.0,685.0,685.0];
Eparam.x_radius=0.5*[774.4,765.0,796.0,758.0,712.0,685.0,760.0];
Eparam.x_roll_temp=[65,45,45,65,45,55,20];
Eparam.ROOM_TEMP = 20.0;
Eparam.quantity=[0.0,440,440,440,440,440,0];
Eparam.MAX_WATER_QUANTITY=450;
assignin('base','Eparam',Eparam);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 模型参数初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Mparam.FAC_RADIT_COVER=0.925;
Mparam.RADIAT_TRANS_ROLL=4.69E-11;
Mparam.RADIAT_COEFF_THICK=1.0;
Mparam.RADIT_COEFF_FM_THICK=repmat(4.85000E-11,[1,7]);
assignin('base','Mparam',Mparam);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 仿真结果初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sresult=0;
assignin('base','Sresult',Sresult);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 作图区初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axes(handles.axes1);
plot(Temp_simu,'.-b'),hold on;
plot(Temp_pre,'.-g'),hold on;
plot(Temp_act,'.-r'),hold off;
legend('仿真值', '预计算','实际值');
title('精轧温度仿真比较','fontweight','bold','fontsize',10);
xlabel('带钢数','FontSize',9);
ylabel('温度(`C)','FontSize',9);
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 参数初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
handles.stripListStr=num2str(data(:,1)); % 带钢号列表
handles.stripListVal=1; % 所选带钢索引
handles.stripListVal1=1; % 起始带钢索引
handles.stripListVal2=length(handles.stripListStr); % 终止带钢索引
guidata(hObject,handles)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 控件状态初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(handles.btnMultiSimu,'value',0);
set(handles.btnMultiSimu,'string','单/多条带钢计算');
set(handles.editStripNo,'String',...
handles.stripListStr(handles.stripListVal,:));
set(handles.uipanelStrip,'title','当前带钢号');
set([handles.text7,handles.text8,handles.popupmenuBegin,...
handles.popupmenuEnd,handles.btnIndex1,handles.btnIndex2],'visible','off');
set([handles.btnUpStrip,handles.btnDownStrip,...
handles.btnStripIndex],'visible','on');
set(handles.UIMenuSingleStrip,'Checked','on');
set(handles.UIMenuMultiStrip,'Checked','off');
set(handles.textSingleMulti,'String','单条带钢计算');
set([handles.listboxStripNo,handles.popupmenuBegin,handles.popupmenuEnd],...
'string',handles.stripListStr);
set(handles.popupmenuBegin,'value',handles.stripListVal1);
set(handles.popupmenuEnd,'value',handles.stripListVal2);
set(handles.uipanelStripList,'Title',['带钢列表: ',...
num2str(handles.stripListVal2-handles.stripListVal1+1),' 条']);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% UIWAIT makes TempSimuMain wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = TempSimuMain_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as textCurrentSet
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as textCurrentSet
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in togglebutton1.
function togglebutton1_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton1
% --- Executes on button press in radiobutton3.
function radiobutton3_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -