📄 tempsimumain.m
字号:
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton3
% --- Executes on button press in radiobutton4.
function radiobutton4_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton4 (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 radiobutton4
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox 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
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes on button press in checkboxFigure.
function checkboxFigure_Callback(hObject, eventdata, handles)
% hObject handle to checkboxFigure (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 checkboxFigure
if get(hObject,'Value')==1
set(handles.UIMenuFigure,'Checked','On');
elseif get(hObject,'Value')==0
set(handles.UIMenuFigure,'Checked','Off');
end
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (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 btnModel.
function btnModel_Callback(hObject, eventdata, handles)
% hObject handle to btnModel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 模型参数设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ModelParam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in btnEquip.
function btnEquip_Callback(hObject, eventdata, handles)
% hObject handle to btnEquip (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 设备参数设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EquipParam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (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 btnMultiSimu.
function btnMultiSimu_Callback(hObject, eventdata, handles)
% hObject handle to btnMultiSimu (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 btnMultiSimu
% 设置辐射温降、水冷温降、轧制温升、传导温降的按钮状态
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set([handles.btnRadiate handles.btnDesCooling handles.btnDeform ...
handles.btnTrans], 'Enable','off');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 单条或多条仿真方式选择
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
switch get(hObject,'value')
case 0
% 单条仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(hObject,'string','单条带钢计算');
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.uipanelStrip,'Title','当前带钢号');
set(handles.editStripNo,'String',handles.stripListStr(handles.stripListVal,:));
set(handles.UIMenuSingleStrip,'Checked','on');
set(handles.UIMenuMultiStrip,'Checked','off');
set(handles.textSingleMulti,'String','单条带钢计算'); % 状态栏
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pause(0.3)
% 头部或全长仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%
str = {'带钢头部仿真','带钢全长仿真'};
[s_Temp,v_Temp] = listdlg('name','切换到...','listsize',[180 50],'uh',18,'fus',4,'ffs',10,...
'SelectionMode','single','ListString',str);
if v_Temp==1
switch s_Temp
case 1
case 2
path_pwd=handles.PathDefault;
path=strcat(handles.PathDefault,'\gui');
cd(path);
temp_gui
waitfor(findobj('Name','带钢全长仿真'));
cd(path_pwd);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 1
% 多条仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(hObject,'string','多条带钢计算');
set([handles.text7,handles.text8,handles.popupmenuBegin,handles.popupmenuEnd,...
handles.btnIndex1,handles.btnIndex2],'visible','on');
set([handles.btnUpStrip,handles.btnDownStrip,handles.btnStripIndex],'visible','off');
set(handles.uipanelStrip,'Title','所选带钢数');
set(handles.editStripNo,'String',['共 ',num2str(abs(handles.stripListVal2-...
handles.stripListVal1+1)),' 条']);
set(handles.UIMenuSingleStrip,'Checked','off');
set(handles.UIMenuMultiStrip,'Checked','on');
set(handles.textSingleMulti,'String','多条带钢计算'); % 状态栏
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in togglebutton3.
function togglebutton3_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton3 (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 togglebutton3
% --- Executes on button press in btnFMTempSimu.
function btnFMTempSimu_Callback(hObject, eventdata, handles)
% hObject handle to btnFMTempSimu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
cd(handles.PathDefault)
%计算精轧区温度变化 开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 设置辐射温降、水冷温降、轧制温升、传导温降的按钮状态
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set([handles.btnRadiate handles.btnDesCooling handles.btnDeform ...
handles.btnTrans], 'Enable','on');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 读入源数据和参数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data=handles.Data;
Eparam=evalin('base','Eparam');
Mparam=evalin('base','Mparam');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 初始化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Temp_simu=0;
Temp_act=0;
Temp_pre=0;
Temp_deform_inc=0;
Temp_heat_trans=0;
Temp_radiat=0;
Temp_cooling=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 单条或多条带钢仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 单条带钢仿真 开始
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if get(handles.btnMultiSimu,'value')==0 % btnMultiSimu 按钮浮起
% 判断是否新图显示
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cla
if get(handles.checkboxFigure,'value')
hNew=figure('Name',['绘制子图 带钢数: ',get(handles.editStripNo,'String')],...
'NumberTitle','off');
axes('parent',hNew);
set(gcf,'color','w');
else
axes(handles.axes1);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 仿真计算
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % waitbar
% h = waitbar(0,'请稍等...');
% for i=1:100, % computation here %
% waitbar(i/100)
% end
% close(h)
% %end
n = 50;
progressbar % Create figure and set starting time
for i = 1:n
pause(0.01) % Do something important
progressbar(i/n) % Update figure
end
sign=handles.stripListVal; % 带钢号
if isequal(get(handles.UIMenuModel1,'checked'),'on')
% 进行现场模型仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[Temp_simu,Temp_act,Temp_pre,Temp_deform_inc,Temp_heat_trans,Temp_radiat,...
Temp_cooling]=TempSimuCalc(sign,Mparam,Eparam,data);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif isequal(get(handles.UIMenuModel2,'checked'),'on')
path_pwd=handles.PathDefault;
path=strcat(handles.PathDefault,'\DiffModel');
cd(path);
% 进行差分模型仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% profile on
[Temp_simu,Temp_act,Temp_pre,Temp_deform_inc,Temp_heat_trans,Temp_radiat,...
Temp_cooling,gTimeRec,gTemp]=TempDiffSimul(sign,data);
FM.gTimeRec=gTimeRec;
FM.gTemp=gTemp;
% profile viewer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cd(path_pwd);
end
% 进行离线自适应
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if isequal(get(handles.UIMenuSelfAdapt,'Checked'),'on')
Temp_adapt=selfadapt(Temp_act,Temp_simu(:,16));
Temp_simu(:,16)=Temp_adapt;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 动态作图
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% p=1:16;
% % plot(p,Temp_simu(1,:),'.-m',p,Temp_pre(1,:));
% % 动态作图
% %%%%%%%%%%%%%%%%%%%%%%%
% for iPlot=1:16
% % plot(p(iPlot:iPlot+1),Temp_simu(1,iPlot:iPlot+1),'.-m');
% if iPlot==1
% plot(1,Temp_simu(1,1),'-b',1,Temp_pre(1,1),'-g',1,Temp_pre(1,1),'o-r'),hold on;
% end
% if iPlot>1 & iPlot<=16
% plot(p(iPlot-1:iPlot),Temp_simu(1,iPlot-1:iPlot),'.-b',p(iPlot-1:iPlot),Temp_pre(1,iPlot-1:iPlot),'.-g');hold on;
% end
% if iPlot==16
% plot(16,Temp_simu(1,16),'.-b',16,Temp_pre(1,16),'.-g',16,Temp_act(1,1),'o-r');hold off;
% end
%
% axis([1,16,min(Temp_simu(1,:))-50,max(Temp_simu(1,:))+50]);
% set(gca,'XTick',[0:17]);
% set(gca,'XTickLabel','R4|RDT|F1入|F1出|F2入|F2出|F3入|F3出|F4入|F4出|F5入|F5出|F6入|F6出|F7入|F7出|FDT|CSC');
% title(gca,'精轧温度计算','fontweight','bold','fontsize',10);
% ylabel(gca,'温度(`C)','FontSize',9);
% if get(handles.checkboxGrid,'value')
% set(gca,'XGrid','on','YGrid','on');
% else
% set(gca,'XGrid','off','YGrid','off');
% end
% pause(0.05)
% hold on
% end
% legend('仿真值','预计算','实际值');
% hold off
% % 动态作图 结束
% %%%%%%%%%%%%%%%%%%%%%%%
% 作图显示
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
plot([1:16],Temp_simu(1,:),'.-b',[1:16],Temp_pre(1,:),'.-g',[1 16],[Temp_pre(1,1) Temp_act],'or');
legend('实际值','仿真值','预计算');
% axis([1,16,min(Temp_simu(1,:))-50,max(Temp_simu(1,:))+50]);
set(gca,'XTick',[1:16]);
set(gca,'XTickLabel','RDT|F1入|F1出|F2入|F2出|F3入|F3出|F4入|F4出|F5入|F5出|F6入|F6出|F7入|F7出|FDT');
title(gca,'精轧温度计算','fontweight','bold','fontsize',10);
ylabel(gca,'温度(`C)','FontSize',9);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -