Skip to content

Commit

Permalink
Merge branch 'master' into issue1791_SimpleHouse
Browse files Browse the repository at this point in the history
  • Loading branch information
mwetter committed Sep 26, 2023
2 parents 8b7c0fd + c5f8684 commit 09b302b
Show file tree
Hide file tree
Showing 23 changed files with 664 additions and 534 deletions.
202 changes: 102 additions & 100 deletions IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo
Original file line number Diff line number Diff line change
@@ -1,100 +1,102 @@
within IBPSA.Examples.Tutorial.SimpleHouse;
model SimpleHouse0
"Start file for simple house example"
extends Modelica.Icons.Example;
package MediumAir = IBPSA.Media.Air "Medium model for air";
package MediumWater = IBPSA.Media.Water "Medium model for water";
parameter Modelica.Units.SI.Area AWall = 100 "Wall area";
parameter Modelica.Units.SI.Length dWall = 0.25 "Wall thickness";
parameter Modelica.Units.SI.ThermalConductivity kWall = 0.04 "Wall thermal conductivity";
parameter Modelica.Units.SI.Density rhoWall = 2000 "Wall density";
parameter Modelica.Units.SI.SpecificHeatCapacity cpWall = 1000 "Wall specific heat capacity";
IBPSA.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
ModelicaServices.ExternalReferences.loadResource(
"modelica://IBPSA/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"))
"Weather data reader"
annotation (Placement(transformation(extent={{-180,-10},{-160,10}})));
IBPSA.BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"
annotation (Placement(transformation(extent={{-140,-10},{-120,10}}),
iconTransformation(extent={{-152,-10},{-132,10}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut
"Exterior temperature boundary condition"
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
equation
connect(weaDat.weaBus, weaBus) annotation (Line(
points={{-160,0},{-130,0}},
color={255,204,51},
thickness=0.5));
connect(TOut.T, weaBus.TDryBul)
annotation (Line(points={{-82,0},{-130,0}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}}), graphics={
Rectangle(
extent={{-200,60},{-20,-60}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-200,-80},{200,-200}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-200,200},{200,80}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{0,60},{200,-60}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Text(
extent={{57.25,40.25},{2.75,59.75}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Building"),
Text(
extent={{-137,-99},{-203,-81}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Heating"),
Text(
extent={{-102,39},{-198,61}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Weather inputs"),
Text(
extent={{-61,179},{-199,201}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Cooling and ventilation")}),
experiment(Tolerance=1E-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
Replace IDEAS by IBPSA models and general revision/update of the model.
</li>
<li>
October 11, 2016, by Filip Jorissen:<br/>
First implementation.
</li>
</ul>
</html>", info="<html>
<p>
This model is used as the starting point for the <code>SimpleHouse</code> tutorial.
It contains a weather data reader and a <code>PrescribedTemperature</code> component
that allows the user to connect thermal components to the dry bulb temperature.
It was based on from the Modelica crash course organised by KU Leuven
(<a href=\"https://github.com/open-ideas/__CrashCourse__\">https://github.com/open-ideas/__CrashCourse__</a>).
</p>
</html>"),
__Dymola_Commands(file=
"modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse0.mos"
"Simulate and plot"));
end SimpleHouse0;
within IBPSA.Examples.Tutorial.SimpleHouse;
model SimpleHouse0
"Start file for simple house example"
extends Modelica.Icons.Example;
package MediumAir = IBPSA.Media.Air "Medium model for air";
package MediumWater = IBPSA.Media.Water "Medium model for water";
parameter Modelica.Units.SI.Area AWall = 100 "Wall area";
parameter Modelica.Units.SI.Length dWall = 0.25 "Wall thickness";
parameter Modelica.Units.SI.ThermalConductivity kWall = 0.04 "Wall thermal conductivity";
parameter Modelica.Units.SI.Density rhoWall = 2000 "Wall density";
parameter Modelica.Units.SI.SpecificHeatCapacity cpWall = 1000 "Wall specific heat capacity";
IBPSA.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
ModelicaServices.ExternalReferences.loadResource(
"modelica://IBPSA/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"))
"Weather data reader"
annotation (Placement(transformation(extent={{-180,-10},{-160,10}})));
IBPSA.BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"
annotation (Placement(transformation(extent={{-140,-10},{-120,10}}),
iconTransformation(extent={{-152,-10},{-132,10}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut
"Exterior temperature boundary condition"
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
equation
connect(weaDat.weaBus, weaBus) annotation (Line(
points={{-160,0},{-130,0}},
color={255,204,51},
thickness=0.5));
connect(TOut.T, weaBus.TDryBul)
annotation (Line(points={{-82,0},{-130,0}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}}), graphics={
Rectangle(
extent={{-200,60},{-20,-60}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-200,-80},{200,-200}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-200,200},{200,80}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{0,60},{200,-60}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Text(
extent={{57.25,40.25},{2.75,59.75}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Building"),
Text(
extent={{-137,-99},{-203,-81}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Heating"),
Text(
extent={{-102,39},{-198,61}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Weather inputs"),
Text(
extent={{-61,179},{-199,201}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Cooling and ventilation")}),
experiment(Tolerance=1E-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
Replace IDEAS by IBPSA models and general revision/update of the model.
</li>
<li>
October 11, 2016, by Filip Jorissen:<br/>
First implementation.
</li>
</ul>
</html>", info="<html>
<p>
This model is used as the starting point for the
<a href=\"modelica://IBPSA.Examples.Tutorial.SimpleHouse\">IBPSA.Examples.Tutorial.SimpleHouse</a>
tutorial.
It contains a weather data reader and a <code>PrescribedTemperature</code> component
that allows the user to connect thermal components to the dry bulb temperature.
It was based on from the Modelica crash course organised by KU Leuven
(<a href=\"https://github.com/open-ideas/__CrashCourse__\">https://github.com/open-ideas/__CrashCourse__</a>).
</p>
</html>"),
__Dymola_Commands(file=
"modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse0.mos"
"Simulate and plot"));
end SimpleHouse0;
179 changes: 90 additions & 89 deletions IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse1.mo
Original file line number Diff line number Diff line change
@@ -1,89 +1,90 @@
within IBPSA.Examples.Tutorial.SimpleHouse;
model SimpleHouse1 "Building wall model"
extends SimpleHouse0;

Modelica.Thermal.HeatTransfer.Components.HeatCapacitor walCap(
C=AWall*dWall*cpWall*rhoWall, T(fixed=true))
"Thermal mass of wall"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={170,0})));
Modelica.Thermal.HeatTransfer.Components.ThermalResistor walRes(R=dWall/AWall
/kWall) "Thermal resistor for wall: 25 cm of rockwool"
annotation (Placement(transformation(extent={{60,-10},{80,10}})));
equation
connect(walRes.port_b, walCap.port) annotation (Line(points={{80,0},{100,0},{100,
1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
connect(TOut.port, walRes.port_a)
annotation (Line(points={{-60,0},{60,0}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>", info="<html>
<p>
A very simple building envelope model will be constructed manually using thermal resistors and heat capacitors.
The house consists of a wall represented by a single heat capacitor and a thermal resistor.
The boundary temperature are already included in
<a href=\"modelica://IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0\">
IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0</a>.
The wall has a surface area of <i>A<sub>wall</sub>=100 m<sup>2</sup></i>,
a thickness of <i>d<sub>wall</sub>=25 cm</i>,
a thermal conductivity of <i>k<sub>wall</sub>=0.04 W/(m K)</i>,
a density of <i>&rho;<sub>wall</sub>=2000 kg/m<sup>3</sup></i>,
and a specific heat capacity of <i>c<sub>p,wall</sub>= 1000 J/(kg K)</i>
</p>
<p>
These parameters are already declared in the equation section of
<a href=\"modelica://IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0\">
IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0</a>.
You can use this way of declaring parameters in the remainder of this exercise, but this is not required.
</p>
<p>
The conductive thermal resistance value of a wall may be computed as <i>R=d/(A*k)</i>.
The heat capacity value of a wall may be computed as <i>C=A*d*c<sub>p</sub>*&rho;</i>
</p>
<h4>Required models</h4>
<ul>
<li>
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.ThermalResistor\">
Modelica.Thermal.HeatTransfer.Components.ThermalResistor</a>
</li>
<li>
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.HeatCapacitor\">
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor</a>
</li>
</ul>
<h4>Connection instructions</h4>
<p>
Connect one side of the thermal resistor to the output of <code>PrescribedTemperature</code>
and the other side of the thermal resistor to the heat capacitor.
</p>
<h4>Reference result</h4>
<p>
If you correctly added the model of the heat capacitor,
connected it to the resistor and added the parameter values for <i>C</i>,
then you should be able to simulate the model.
To do this, press the <i>Simulation Setup</i> and set the model <i>Stop time</i> to 1e6 seconds.
You can now simulate the model by pressing the <i>Simulate</i> button.
</p>
<p>
You can plot individual variables values by clicking on their name in the variable browser on the left.
Now plot the wall capacitor temperature value <i>T</i>.
It should look like the figure below (1 Ms is around 12 days).
</p>
<p align=\"center\">
<img alt=\"Wall temperature as function of time.\"
src=\"modelica://IBPSA/Resources/Images/Examples/Tutorial/SimpleHouse/result1.png\" width=\"1000\"/>
</p>
</html>"),
__Dymola_Commands(file=
"modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse1.mos"
"Simulate and plot"));
end SimpleHouse1;
within IBPSA.Examples.Tutorial.SimpleHouse;
model SimpleHouse1 "Building wall model"
extends SimpleHouse0;

Modelica.Thermal.HeatTransfer.Components.HeatCapacitor walCap(
C=AWall*dWall*cpWall*rhoWall,
T(fixed=true))
"Thermal mass of wall"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={170,0})));
Modelica.Thermal.HeatTransfer.Components.ThermalResistor walRes(
R=dWall/AWall/kWall) "Thermal resistor for wall: 25 cm of rockwool"
annotation (Placement(transformation(extent={{60,-10},{80,10}})));
equation
connect(walRes.port_b, walCap.port) annotation (Line(points={{80,0},{100,0},{100,
1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
connect(TOut.port, walRes.port_a)
annotation (Line(points={{-60,0},{60,0}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>", info="<html>
<p>
A very simple building envelope model will be constructed manually using thermal resistors and heat capacitors.
The house consists of a wall represented by a single heat capacitor and a thermal resistor.
The boundary temperature are already included in
<a href=\"modelica://IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0\">
IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0</a>.
The wall has a surface area of <i>A<sub>wall</sub>=100 m<sup>2</sup></i>,
a thickness of <i>d<sub>wall</sub>=25 cm</i>,
a thermal conductivity of <i>k<sub>wall</sub>=0.04 W/(m K)</i>,
a density of <i>&rho;<sub>wall</sub>=2000 kg/m<sup>3</sup></i>,
and a specific heat capacity of <i>c<sub>p,wall</sub>= 1000 J/(kg K)</i>
</p>
<p>
These parameters are already declared in the equation section of
<a href=\"modelica://IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0\">
IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0</a>.
You can use this way of declaring parameters in the remainder of this exercise, but this is not required.
</p>
<p>
The conductive thermal resistance value of a wall may be computed as <i>R=d/(A*k)</i>.
The heat capacity value of a wall may be computed as <i>C=A*d*c<sub>p</sub>*&rho;</i>
</p>
<h4>Required models</h4>
<ul>
<li>
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.HeatCapacitor\">
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor</a>
</li>
<li>
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.ThermalResistor\">
Modelica.Thermal.HeatTransfer.Components.ThermalResistor</a>
</li>
</ul>
<h4>Connection instructions</h4>
<p>
Connect one side of the thermal resistor to the output of <code>PrescribedTemperature</code>
and the other side of the thermal resistor to the heat capacitor.
</p>
<h4>Reference result</h4>
<p>
If you correctly added the model of the heat capacitor,
connected it to the resistor and added the parameter values for <i>C</i>,
then you should be able to simulate the model.
To do this, press the <i>Simulation Setup</i> and set the model <i>Stop time</i> to 1e6 seconds.
You can now simulate the model by pressing the <i>Simulate</i> button.
</p>
<p>
You can plot individual variables values by clicking on their name in the variable browser on the left.
Now plot the wall capacitor temperature value <i>T</i>.
It should look like the figure below (1 Ms is around 12 days).
</p>
<p align=\"center\">
<img alt=\"Wall temperature as function of time.\"
src=\"modelica://IBPSA/Resources/Images/Examples/Tutorial/SimpleHouse/result1.png\" width=\"1000\"/>
</p>
</html>"),
__Dymola_Commands(file=
"modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse1.mos"
"Simulate and plot"));
end SimpleHouse1;
Loading

0 comments on commit 09b302b

Please sign in to comment.