Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue1389 detailed house #1404

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c189a7
Create DetailedHouse package and move example models 1-10 into this p…
LoneMeertens Dec 23, 2024
eafe84d
Rename Example 1-10 to DetailedHouse
LoneMeertens Dec 23, 2024
bb83413
Add documentation to new DetailedHouse package
LoneMeertens Dec 23, 2024
d1f32cb
Add image that is a representation of final model
LoneMeertens Dec 23, 2024
821d676
Fix icon sizes
LoneMeertens Dec 23, 2024
8b1630c
Added required models for each DetailedHouse step
LoneMeertens Dec 23, 2024
a98260a
Add more detailed information to the models
LoneMeertens Dec 23, 2024
235aa1b
update naming in reference results (scripts + results)
lucasverleyen Dec 24, 2024
18247d4
test {} for tutorial unit tests
lucasverleyen Dec 24, 2024
2d0e130
revert commit partially
lucasverleyen Dec 24, 2024
a587fcf
restore commit
lucasverleyen Dec 24, 2024
79109b7
remove old file name
lucasverleyen Dec 24, 2024
d6ad814
Change order of Tutorial packages (alphabetical)
jelgerjansen Jan 2, 2025
faff981
For order of Examples package
jelgerjansen Jan 2, 2025
8cca500
Correct reference to mos file in __Dymola_Commands
jelgerjansen Jan 2, 2025
e8f49c5
Fix typo mos file DetailedHouse3
jelgerjansen Jan 2, 2025
7a73f8a
Change diagram coordinate system for DetailedHouse6 to capture the he…
jelgerjansen Jan 2, 2025
65fab4c
put dimensions in italic
LoneMeertens Jan 2, 2025
1e37f37
fixing documentation and syntax suggestions
LoneMeertens Jan 2, 2025
08a2250
Add result plot for DetailedHous1-5
LoneMeertens Jan 2, 2025
16fde4a
Include connection instructions and reference result section in detai…
LoneMeertens Jan 3, 2025
bee17d3
Adding plots of reference results detailed house 6-10
LoneMeertens Jan 8, 2025
9407eb5
Adding reference results and connecting instruction complete for Deta…
LoneMeertens Jan 9, 2025
9d4c306
default zone height of 2.8m used in DetailedHouse1 instead of equalli…
LoneMeertens Jan 9, 2025
8795021
Resolve open comments related to documentation
LoneMeertens Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions IDEAS/Examples/Tutorial/DetailedHouse/DetailedHouse1.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
within IDEAS.Examples.Tutorial.DetailedHouse;
model DetailedHouse1 "First example model containing one zone"
extends Modelica.Icons.Example;
package Medium = IDEAS.Media.Air "Air medium";

parameter Modelica.Units.SI.Length l=8 "Zone length";
parameter Modelica.Units.SI.Length w=4 "Zone width";
parameter Modelica.Units.SI.Length h=zone.hZone "Zone height (Default)";

//SimInfoManager must be 'inner' at the top level
inner IDEAS.BoundaryConditions.SimInfoManager sim
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
IDEAS.Buildings.Components.Zone zone(
redeclare package Medium = Medium,
nSurf=7,
V=l*h*w)
"Zone model" annotation (Placement(transformation(extent={{-20,0},{0,20}})));
IDEAS.Buildings.Components.OuterWall outerWall(
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
constructionType,
inc=IDEAS.Types.Tilt.Wall,
azi=IDEAS.Types.Azimuth.W,
A=l*h)
"Outer wall model"
annotation (Placement(transformation(extent={{-56,0},{-44,20}})));
IDEAS.Buildings.Components.OuterWall outerWall1(
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
constructionType,
inc=IDEAS.Types.Tilt.Wall,
azi=IDEAS.Types.Azimuth.E,
A=l*h)
"Outer wall model"
annotation (Placement(transformation(extent={{36,0},{24,20}})));
IDEAS.Buildings.Components.OuterWall outerWall2(
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
constructionType,
inc=IDEAS.Types.Tilt.Wall,
azi=IDEAS.Types.Azimuth.N,
A=w*h)
"Outer wall model"
annotation (Placement(transformation(
extent={{6,-10},{-6,10}},
rotation=90,
origin={-10,52})));
IDEAS.Buildings.Components.OuterWall outerWall3(
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
constructionType,
inc=IDEAS.Types.Tilt.Wall,
azi=IDEAS.Types.Azimuth.S,
A=w*h - window.A)
"Outer wall model"
annotation (Placement(transformation(
extent={{-6,-10},{6,10}},
rotation=90,
origin={-10,-30})));
IDEAS.Buildings.Components.Window window(
inc=IDEAS.Types.Tilt.Wall,
A=3*1.4,
azi=IDEAS.Types.Azimuth.S,
redeclare TwinHouses.BaseClasses.Data.Materials.Glazing glazing)
"Window model" annotation (Placement(transformation(extent={{-6,-10},{6,10}},
rotation=90,
origin={-36,-30})));

Buildings.Components.InternalWall floor(
redeclare Buildings.Validation.Data.Constructions.HeavyFloor
constructionType,
inc=IDEAS.Types.Tilt.Floor,
azi=IDEAS.Types.Azimuth.S,
A=l*w)
"Floor modelled using internal wall with both the ceiling and roof side connected to the zone"
annotation (Placement(transformation(
extent={{-6,-10},{6,10}},
rotation=90,
origin={70,10})));
equation
connect(outerWall.propsBus_a, zone.propsBus[1]) annotation (Line(
points={{-45,12},{-38.5,12},{-38.5,13.1429},{-20,13.1429}},
color={255,204,51},
thickness=0.5));
connect(zone.propsBus[2], outerWall2.propsBus_a) annotation (Line(
points={{-20,13.4286},{-22,13.4286},{-22,47},{-12,47}},
color={255,204,51},
thickness=0.5));
connect(zone.propsBus[3], outerWall1.propsBus_a) annotation (Line(
points={{-20,13.7143},{-20,28},{25,28},{25,12}},
color={255,204,51},
thickness=0.5));
connect(outerWall3.propsBus_a, zone.propsBus[4]) annotation (Line(
points={{-12,-25},{-12,-6},{-20,-6},{-20,14}},
color={255,204,51},
thickness=0.5));
connect(window.propsBus_a, zone.propsBus[5]) annotation (Line(
points={{-38,-25},{-38,14},{-20,14},{-20,14.2857}},
color={255,204,51},
thickness=0.5));
connect(floor.propsBus_a, zone.propsBus[6]) annotation (Line(
points={{68,15},{68,28},{-20,28},{-20,14.5714}},
color={255,204,51},
thickness=0.5));
connect(floor.propsBus_b, zone.propsBus[7]) annotation (Line(
points={{68,5},{68,-6},{-20,-6},{-20,14.8571}},
color={255,204,51},
thickness=0.5));
annotation (
Icon(coordinateSystem(preserveAspectRatio=false)),
Diagram(coordinateSystem(preserveAspectRatio=false)),
experiment(
StartTime=10000000,
StopTime=11000000,
__Dymola_NumberOfIntervals=5000,
Tolerance=1e-06,
__Dymola_Algorithm="Lsodar"),
__Dymola_Commands(file=
"Resources/Scripts/Dymola/Examples/Tutorial/DetailedHouse/DetailedHouse1.mos"
"Simulate and plot"),
Documentation(info="<html>
<p>
This first example file instantiates a simple building model that consists of one zone, four walls,
a window, a floor and a ceiling. The zone dimensions are <i>8 m</i> (with walls oriented
north and south) by <i>4 m</i>, and the window measures <i>3 m</i> by <i>1.4 m</i>. Use the default
zone height of <i>2.8 m</i>. Apply double glazing and a heavy wall, which provide high thermal mass.
</p>
<h4>Required models</h4>
<ul>
<li>
<a href=\"modelica://IDEAS.BoundaryConditions.SimInfoManager\">
IDEAS.BoundaryConditions.SimInfoManager</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.Zone\">
IDEAS.Buildings.Components.Zone</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.OuterWall\">
IDEAS.Buildings.Components.OuterWall</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.Window\">
IDEAS.Buildings.Components.Window</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.InternalWall\">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember, we decided last year to remove the internal wall representing the floor and ceiling and use a slab on ground for the floor and another outer wall for the ceiling. This was indeed not the case in this tutorial, but I would change the tutorial according to the changes of last year in the crash course exercise

IDEAS.Buildings.Components.InternalWall</a>
</li>
</ul>
<h4>Connection instructions</h4>
<p>
Each yellow bus connector of a surface (<code>Window</code>, <code>OuterWall</code>
or <code>InternalWall</code>) has to be connected to exactly one zone bus connector.
To support multiple connections, the zone has an array of bus connectors with size
<code>nSurf</code>, where <code>nSurf</code> is a parameter of <code>Zone</code>,
which has to be set by the user. It is the user’s responsibility to ensure that each
element of this array is connected to exactly one surface and that there is a total
of <code>nSurf</code> connections to the zone.
</p>
<p>
In addition to connecting each surface, the parameters of each component have to be set. Components typically
have many default values that are appropriate for many purposes. When parameters do not have a default
value, it must be set by the user. Notable examples are the dimensions and orientation of the zone, walls
and windows. The surface orientation can be set using the parameters <code>incOpt</code>, which automatically sets the
inclination depending on the type of outer wall (wall, floor, ceiling), and <code>aziOpt</code>, which automatically sets the
azimuth (north, east, south, west). Furthermore, the zone Medium must be set to <a href=\"modelica://IDEAS.Media.Air\">
IDEAS.Media.Air</a>. Glazing and wall types must also be specified. This example uses the <i>BESTEST Heavy Wall</i> for the
walls, the <i>BESTEST Heavy Floor</i> for the floor, the <i>BESTEST ligth roof</i> for the roof and the double glazing
type <i>Saint Gobain Planitherm</i> and a south orientation for the window.
</p>
<p>
The <code>SimInfoManager</code> by default has the modifier <code>inner</code> in its declaration. All IDEAS building components
have the modifier <code>outer</code> in their respective declarations of the <code>SimInfoManager</code>. This causes the component
declarations to point towards the higher level <code>SimInfoManager</code> declaration. This way all model equations for
the weather data have to be generated only once, instead of for each surface.
</p>

<h4>Reference result</h4>
<p>
This model is simulated with the following settings:
</p>
<ol>
<li>Start time = 1e7,</li>
<li>Stop time = 1.1e7,</li>
<li>Number of intervals = 5000.</li>
</ol>
<p>
The simulation starts 10<sup>7</sup> seconds after New Year and ends 10<sup>6</sup> seconds later, covering a period of 11.6 days.
The zone temperature, <code>zone.TSensor</code>, is plotted, which represents the mean of the air temperature and the mean radiative temperature of all surfaces. The results are shown in the figure below.
</p>
<p align=\"center\">
<img alt=\"Zone temperature as function of time.\"
src=\"modelica://IDEAS/Resources/Images/Examples/Tutorial/DetailedHouse/DetailedHouse1.png\" width=\"700\"/>
</p>
</html>", revisions="<html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can update the revision history of each model, with a reference to this pull request or the issue

<ul>
<li>
September 18, 2019 by Filip Jorissen:<br/>
First implementation for the IDEAS crash course.
</li>
</ul>
</html>"));
end DetailedHouse1;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IDEAS.Examples.Tutorial;
model Example10 "Speeding up the code"
extends Example9(
within IDEAS.Examples.Tutorial.DetailedHouse;
model DetailedHouse10 "Speeding up the code"
extends DetailedHouse9(
fanRet(
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, use_riseTime=
false),
Expand Down Expand Up @@ -49,7 +49,11 @@ record HeavyWall "BESTEST heavy wall with idealized wood layer"
IDEAS.Buildings.Validation.Data.Materials.ConcreteBlock(d=0.10)});

end HeavyWall;
annotation (experiment(
annotation (
__Dymola_Commands(file=
"Resources/Scripts/Dymola/Examples/Tutorial/DetailedHouse/DetailedHouse10.mos"
"Simulate and plot"),
experiment(
StartTime=10000000,
StopTime=11000000,
__Dymola_NumberOfIntervals=5000,
Expand Down Expand Up @@ -78,10 +82,31 @@ First implementation for the IDEAS crash course.
</ul>
</html>", info="<html>
<p>
Tuning model and solver for computation time
The created models tend to exhibit slow performance, with computation time significantly increasing due to
controller oscillations or frequent on/off switching of the heat pump. These effects cause a lot of fast
transients that force the solver to take small steps, which takes a lot of time.
<p>
Fortunately, there are many tricks that can be used to speed up the solver. The fundamental principle is to
remove small time constants from the problem.
The example in <a href=\"modelica://IDEAS.Examples.Tutorial.DetailedHouse.DetailedHouse10\">
IDEAS.Examples.Tutorial.DetailedHouse.DetailedHouse10</a> implements changes
that cause the simulation to become 2 times faster. By systematically removing fast time constants, the solver can be
switched to a simpler method, such as Euler integration, the simulation time also becomes 2 times smaller
when using a fixed time step of 20 seconds. These are modest improvements since this small example model
behaves rather well. However, for large models, the difference in computation time when using Euler integration
can become a factor 1000. The modifications however require a bit of knowledge about solvers and the models
that you are using, including some of the more advanced parameters. To learn more about this, we refer to
[1, 2, 3].
</p>
<h4>References</h4>
<p>
[1] F. Jorissen, M. Wetter, and L. Helsen. <i>Simulation Speed Analysis and Improvements of Modelica Models for Building Energy Simulation</i>. In 11th International Modelica Conference, Paris, 2015. doi: 10.3384/ecp1511859
</p>
<p>
[2] F. Jorissen, M. Wetter, and L. Helsen. <i>Simplifications for hydronic system models in Modelica</i>. Journal of Building Performance Simulation, 11:6, 639-654, 2018. doi: 10.1080/19401493.2017.1421263
</p>
<p>
[3] F. Jorissen. <i>Toolchain for Optimal Control and Design of Energy Systems in Buildings</i>. PhD Thesis, KU Leuven, 2018.
</p>
</html>"),
__Dymola_Commands(file=
"Resources/Scripts/Dymola/Examples/Tutorial/Example10.mos"
"Simulate and plot"));
end Example10;
</html>"));
end DetailedHouse10;
61 changes: 61 additions & 0 deletions IDEAS/Examples/Tutorial/DetailedHouse/DetailedHouse2.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
within IDEAS.Examples.Tutorial.DetailedHouse;
model DetailedHouse2 "Adding closed screens"
extends DetailedHouse1(window(redeclare Buildings.Components.Shading.Screen shaType));
Modelica.Blocks.Sources.Constant const(k=1)
annotation (Placement(transformation(extent={{-100,-60},{-80,-40}})));
equation
connect(const.y, window.Ctrl)
annotation (Line(points={{-79,-50},{-26,-50},{-26,-34}}, color={0,0,127}));
annotation (
Documentation(info="<html>
<p>
This second example file extends the first example and adds a solar shading screen to the window model.
Compare the simulation outputs to see the impact on the zone temperature.
</p>
<h4>Required models</h4>
<ul>
<li>
<a href=\"modelica://Modelica.Blocks.Sources.Constant\">
Modelica.Blocks.Sources.Constant</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.Shading.Screen\">
IDEAS.Buildings.Components.Shading.Screen</a>
</li>
</ul>
<h4>Connection instructions</h4>
<p>
Solar shading is a property of the window and can be selected using the replaceable model <code>shaType</code>.
A drop-down menu lists all available options. Each option may include custom parameters, which can be configured by pressing the <i>Edit</i> button next to the drop-down menu.
</p>
<p>
The <code>Screen</code> model requires an external control signal to determine whether the screen is extended or retracted.
An input appears on the <code>Window</code> icon for this purpose. Ensure that this input is connected to the appropriate control signal.
See the window input comment for more information on how to choose the control signal.
</p>
<h4>Reference result</h4>
<p>
The figure below illustrates the zone temperature with (red) and without (blue) the shading model.
</p>
<p align=\"center\">
<img alt=\"Zone temperature without (blue) and with (red) screen model.\"
src=\"modelica://IDEAS/Resources/Images/Examples/Tutorial/DetailedHouse/DetailedHouse2.png\" width=\"700\"/>
</p>
</html>", revisions="<html>
<ul>
<li>
September 18, 2019 by Filip Jorissen:<br/>
First implementation for the IDEAS crash course.
</li>
</ul>
</html>"),
__Dymola_Commands(file=
"Resources/Scripts/Dymola/Examples/Tutorial/DetailedHouse/DetailedHouse2.mos"
"Simulate and plot"),
experiment(
StartTime=10000000,
StopTime=11000000,
__Dymola_NumberOfIntervals=5000,
Tolerance=1e-06,
__Dymola_Algorithm="Lsodar"));
end DetailedHouse2;
62 changes: 62 additions & 0 deletions IDEAS/Examples/Tutorial/DetailedHouse/DetailedHouse3.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
within IDEAS.Examples.Tutorial.DetailedHouse;
model DetailedHouse3 "Adding occupant and lighting"
extends DetailedHouse2(
zone(
redeclare replaceable Buildings.Components.Occupants.Fixed occNum(nOccFix=1),
redeclare Buildings.Components.OccupancyType.OfficeWork occTyp,
redeclare Buildings.Components.RoomType.Office rooTyp,
redeclare Buildings.Components.LightingType.LED ligTyp,
redeclare Buildings.Components.LightingControl.OccupancyBased ligCtr));
annotation (
Documentation(revisions="<html>
<ul>
<li>
September 18, 2019 by Filip Jorissen:<br/>
First implementation for the IDEAS crash course.
</li>
</ul>
</html>", info="<html>
<p>
This example extends the second example by adding an occupant and lighting model.
Based on the selected options, the system automatically calculates zone heat gains,
relative humidity, and CO2 concentration. The model implements a continuous occupancy
of one person and LED lighting for the zone. The lighting operates when occupants are present.
</p>
<h4>Required models</h4>
<ul>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.Occupants.Fixed\">
IDEAS.Buildings.Components.Occupants.Fixed</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.LightingType.LED\">
IDEAS.Buildings.Components.LightingType.LED</a>
</li>
<li>
<a href=\"modelica://IDEAS.Buildings.Components.LightingControl.OccupancyBased\">
IDEAS.Buildings.Components.LightingControl.OccupancyBased</a>
</li>
</ul>
<h4>Connection instructions</h4>
<p>
Set the appropriate replaceable models in the zone model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the last crash course, I remember that it was not clear that you could simply set this in the zone model's dialogue window. Maybe you can specify this in this sentence by adding "dialogue window"?

</p>
<h4>Reference result</h4>
<p>
The result with and without the occupant and lighting is plotted in the figure below.
</p>
<p align=\"center\">
<img alt=\"Zone temperature without (blue) and with (red) occupant and lighting (both with screen model).\"
src=\"modelica://IDEAS/Resources/Images/Examples/Tutorial/DetailedHouse/DetailedHouse3.png\" width=\"700\"/>
</p>
</html>"),
__Dymola_Commands(file=
"Resources/Scripts/Dymola/Examples/Tutorial/DetailedHouse/DetailedHouse3.mos"
"Simulate and plot"),
experiment(
StartTime=10000000,
StopTime=11000000,
__Dymola_NumberOfIntervals=5000,
Tolerance=1e-06,
__Dymola_Algorithm="Lsodar"));
end DetailedHouse3;
Loading