📄 thermo.m
字号:
set_param([sys,'/',['Temp',13,'Convert 2/Gain']],...
'Gain','9/5',...
'position',[60,7,95,43])
add_block('built-in/Outport',[sys,'/',['Temp',13,'Convert 2/Fahrenheit',13,'out']])
set_param([sys,'/',['Temp',13,'Convert 2/Fahrenheit',13,'out']],...
'position',[180,25,200,45])
add_block('built-in/Inport',[sys,'/',['Temp',13,'Convert 2/Celsius',13,'in']])
set_param([sys,'/',['Temp',13,'Convert 2/Celsius',13,'in']],...
'position',[15,15,35,35])
add_block('built-in/Constant',[sys,'/',['Temp',13,'Convert 2/Constant']])
set_param([sys,'/',['Temp',13,'Convert 2/Constant']],...
'Value','32',...
'position',[65,70,85,90])
add_block('built-in/Sum',[sys,'/',['Temp',13,'Convert 2/Sum']])
set_param([sys,'/',['Temp',13,'Convert 2/Sum']],...
'position',[130,15,150,50])
add_line([sys,'/',['Temp',13,'Convert 2']],[40,25;55,25])
add_line([sys,'/',['Temp',13,'Convert 2']],[100,25;125,25])
add_line([sys,'/',['Temp',13,'Convert 2']],[155,35;175,35])
add_line([sys,'/',['Temp',13,'Convert 2']],[90,80;105,80;105,40;125,40])
set_param([sys,'/',['Temp',13,'Convert 2']],...
'Mask Display','C2F')
% Finished composite block ['Temp',13,'Convert 2'].
set_param([sys,'/',['Temp',13,'Convert 2']],...
'position',[445,68,475,102])
% Subsystem ['Temp',13,'Convert 1'].
new_system([sys,'/',['Temp',13,'Convert 1']])
set_param([sys,'/',['Temp',13,'Convert 1']],'Location',[577,197,810,324])
add_block('built-in/Sum',[sys,'/',['Temp',13,'Convert 1/Sum']])
set_param([sys,'/',['Temp',13,'Convert 1/Sum']],...
'inputs','+-',...
'position',[85,15,105,50])
add_block('built-in/Constant',[sys,'/',['Temp',13,'Convert 1/Constant']])
set_param([sys,'/',['Temp',13,'Convert 1/Constant']],...
'Value','32',...
'position',[35,70,55,90])
add_block('built-in/Inport',[sys,'/',['Temp',13,'Convert 1/Fahrenheit',13,'in']])
set_param([sys,'/',['Temp',13,'Convert 1/Fahrenheit',13,'in']],...
'position',[15,15,35,35])
add_block('built-in/Outport',[sys,'/',['Temp',13,'Convert 1/Celsius',13,'out']])
set_param([sys,'/',['Temp',13,'Convert 1/Celsius',13,'out']],...
'position',[180,25,200,45])
add_block('built-in/Gain',[sys,'/',['Temp',13,'Convert 1/Gain1']])
set_param([sys,'/',['Temp',13,'Convert 1/Gain1']],...
'Gain','5/9',...
'position',[125,17,160,53])
add_line([sys,'/',['Temp',13,'Convert 1']],[60,80;70,80;80,40])
add_line([sys,'/',['Temp',13,'Convert 1']],[40,25;80,25])
add_line([sys,'/',['Temp',13,'Convert 1']],[110,35;120,35])
add_line([sys,'/',['Temp',13,'Convert 1']],[165,35;175,35])
set_param([sys,'/',['Temp',13,'Convert 1']],...
'Mask Display','F2C')
% Finished composite block ['Temp',13,'Convert 1'].
set_param([sys,'/',['Temp',13,'Convert 1']],...
'position',[70,42,100,78])
add_block('built-in/Integrator',[sys,'/','Integrator'])
set_param([sys,'/','Integrator'],...
'position',[360,15,380,35])
add_block('built-in/Note',[sys,'/',['House Thermodynamics',13,'(Double click on the "?" for more info)']])
set_param([sys,'/',['House Thermodynamics',13,'(Double click on the "?" for more info)']],...
'position',[130,240,135,245])
add_block('built-in/Note',[sys,'/','Terr'])
set_param([sys,'/','Terr'],...
'position',[170,30,175,35])
add_block('built-in/Note',[sys,'/',['blower',13,'cmd']])
set_param([sys,'/',['blower',13,'cmd']],...
'position',[255,30,260,35])
add_block('built-in/Note',[sys,'/',['heater',13,'QDot']])
set_param([sys,'/',['heater',13,'QDot']],...
'position',[310,30,315,35])
add_block('built-in/Note',[sys,'/',['To start and stop the simulation, use the "Start//Stop"',13,'selection in the "Simulation" pull-down menu']])
set_param([sys,'/',['To start and stop the simulation, use the "Start//Stop"',13,'selection in the "Simulation" pull-down menu']],...
'position',[144,285,149,290])
add_block('built-in/Note',[sys,'/','Tin'])
set_param([sys,'/','Tin'],...
'position',[395,165,400,170])
% Subsystem 'More Info'.
new_system([sys,'/','More Info'])
set_param([sys,'/','More Info'],'Location',[409,70,773,213])
add_block('built-in/Note',[sys,'/',['More Info/This system models the thermodynamics of a house.',13,'The variables are initialized by a file ',13,'called thermdat.m.']])
set_param([sys,'/',['More Info/This system models the thermodynamics of a house.',13,'The variables are initialized by a file ',13,'called thermdat.m.']],...
'position',[177,25,182,30])
add_block('built-in/Note',[sys,'/',['More Info/Examine the file thermdat.m to see the ',13,'simulation variables you can change at will.',13,'']])
set_param([sys,'/',['More Info/Examine the file thermdat.m to see the ',13,'simulation variables you can change at will.',13,'']],...
'position',[185,95,190,100])
set_param([sys,'/','More Info'],...
'Mask Display','?')
% Finished composite block 'More Info'.
set_param([sys,'/','More Info'],...
'hide name',0,...
'Drop Shadow',4,...
'position',[270,245,297,270])
% Subsystem 'More Info1'.
new_system([sys,'/','More Info1'])
set_param([sys,'/','More Info1'],'Location',[0,0,364,143])
add_block('built-in/Note',[sys,'/',['More Info1/Examine the file "thermo_script.m to',13,'get a feel for the wide range of variables at play here.']])
set_param([sys,'/',['More Info1/Examine the file "thermo_script.m to',13,'get a feel for the wide range of variables at play here.']],...
'position',[185,95,190,100])
add_block('built-in/Note',[sys,'/',['More Info1/This system models the thermodynamics of a house.',13,'The variables are initialized by a file ',13,'called "thermo_script".']])
set_param([sys,'/',['More Info1/This system models the thermodynamics of a house.',13,'The variables are initialized by a file ',13,'called "thermo_script".']],...
'position',[177,25,182,30])
set_param([sys,'/','More Info1'],...
'Mask Display','Show Script\nListing',...
'Mask Dialogue','eval(''type thermdat'')')
% Finished composite block 'More Info1'.
set_param([sys,'/','More Info1'],...
'hide name',0,...
'Drop Shadow',4,...
'position',[457,285,542,324])
% Subsystem 'More Info2'.
new_system([sys,'/','More Info2'])
set_param([sys,'/','More Info2'],'Location',[0,56,364,199])
add_block('built-in/Note',[sys,'/',['More Info2/This system models the thermodynamics of a house.',13,'The variables are initialized by a file ',13,'called "thermo_script".']])
set_param([sys,'/',['More Info2/This system models the thermodynamics of a house.',13,'The variables are initialized by a file ',13,'called "thermo_script".']],...
'position',[177,25,182,30])
add_block('built-in/Note',[sys,'/',['More Info2/Examine the file "thermo_script.m to',13,'get a feel for the wide range of variables at play here.']])
set_param([sys,'/',['More Info2/Examine the file "thermo_script.m to',13,'get a feel for the wide range of variables at play here.']],...
'position',[185,95,190,100])
set_param([sys,'/','More Info2'],...
'Mask Display','Load Data',...
'Mask Dialogue','eval(''thermdat'')')
% Finished composite block 'More Info2'.
set_param([sys,'/','More Info2'],...
'hide name',0,...
'Drop Shadow',4,...
'position',[457,236,541,269])
% Subsystem 'More Info3'.
new_system([sys,'/','More Info3'])
set_param([sys,'/','More Info3'],'Location',[128,280,487,453])
add_block('built-in/Note',[sys,'/',['More Info3/This system models a double pendulum system where',13,'the rest state has both pendulums hanging vertically.']])
set_param([sys,'/',['More Info3/This system models a double pendulum system where',13,'the rest state has both pendulums hanging vertically.']],...
'position',[168,20,173,25])
add_block('built-in/Note',[sys,'/',['More Info3/Associated with the demo is an animation function that',13,'will automatically open a figure window and display to it.']])
set_param([sys,'/',['More Info3/Associated with the demo is an animation function that',13,'will automatically open a figure window and display to it.']],...
'position',[174,65,179,70])
add_block('built-in/Note',[sys,'/',['More Info3/Try experimenting with different initial conditions for',13,'alpha and gamma to see the unusal coupling effects.']])
set_param([sys,'/',['More Info3/Try experimenting with different initial conditions for',13,'alpha and gamma to see the unusal coupling effects.']],...
'position',[175,115,180,120])
set_param([sys,'/','More Info3'],...
'Mask Display','Double click\nhere for\nSIMULINK Help',...
'Mask Dialogue','eval(''[cs,cb]=get_param;str=[''''simcad '''' cs];eval(str);'')')
% Finished composite block 'More Info3'.
set_param([sys,'/','More Info3'],...
'hide name',0,...
'Drop Shadow',4,...
'position',[325,260,427,311])
add_block('built-in/Scope',[sys,'/','Heat Cost ($)'])
set_param([sys,'/','Heat Cost ($)'],...
'Vgain','15.000000',...
'Hgain','43200.000000',...
'Vmax','30.000000',...
'Hmax','86400.000000',...
'Window',[545,435,775,567])
open_system([sys,'/','Heat Cost ($)'])
set_param([sys,'/','Heat Cost ($)'],...
'position',[490,12,510,38])
add_line(sys,[445,25;485,25])
add_line(sys,[385,25;415,25])
add_line(sys,[315,140;325,140;325,95;345,95])
add_line(sys,[255,140;275,140])
add_line(sys,[105,60;130,60])
add_line(sys,[50,60;65,60])
add_line(sys,[405,85;440,85])
add_line(sys,[415,85;415,225;115,225;115,75;130,75])
add_line(sys,[190,180;210,180;210,145;225,145])
add_line(sys,[190,130;225,130])
add_line(sys,[160,70;180,70])
add_line(sys,[235,70;270,70])
add_line(sys,[480,85;505,85])
add_line(sys,[300,70;345,70])
add_line(sys,[330,70;330,25;355,25])
drawnow
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str,ts,xts] = feval(sys);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -