Skip to content

Commit 347884e

Browse files
Merge pull request #1404 from LoneMeertens/issue1389_DetailedHouse
Issue1389 detailed house
2 parents 63ade3c + f7b3ec2 commit 347884e

File tree

73 files changed

+1720
-1046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1720
-1046
lines changed
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
within IDEAS.Examples.Tutorial.DetailedHouse;
2+
model DetailedHouse1 "First example model of a one-zone building"
3+
extends Modelica.Icons.Example;
4+
package MediumAir = IDEAS.Media.Air "Air medium";
5+
6+
parameter Modelica.Units.SI.Length l=8 "Zone length";
7+
parameter Modelica.Units.SI.Length w=4 "Zone width";
8+
parameter Modelica.Units.SI.Length h=zon.hZone "Zone height (Default)";
9+
10+
// SimInfoManager must be 'inner' at the top level
11+
inner IDEAS.BoundaryConditions.SimInfoManager sim
12+
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
13+
IDEAS.Buildings.Components.Zone zon(
14+
redeclare package Medium = MediumAir,
15+
nSurf=7,
16+
V=l*h*w)
17+
"Zone model" annotation (Placement(transformation(extent={{-20,0},{0,20}})));
18+
IDEAS.Buildings.Components.OuterWall outWalWes(
19+
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
20+
constructionType,
21+
inc=IDEAS.Types.Tilt.Wall,
22+
azi=IDEAS.Types.Azimuth.W,
23+
A=l*h) "Western outer wall model"
24+
annotation (Placement(transformation(extent={{-60,10},{-48,30}})));
25+
IDEAS.Buildings.Components.OuterWall outWalEas(
26+
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
27+
constructionType,
28+
inc=IDEAS.Types.Tilt.Wall,
29+
azi=IDEAS.Types.Azimuth.E,
30+
A=l*h) "Eastern outer wall model"
31+
annotation (Placement(transformation(extent={{40,0},{28,20}})));
32+
IDEAS.Buildings.Components.OuterWall outWalNor(
33+
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
34+
constructionType,
35+
inc=IDEAS.Types.Tilt.Wall,
36+
azi=IDEAS.Types.Azimuth.N,
37+
A=w*h) "Northern outer wall model"
38+
annotation (Placement(transformation(
39+
extent={{6,-10},{-6,10}},
40+
rotation=90,
41+
origin={-10,54})));
42+
IDEAS.Buildings.Components.OuterWall outWalSou(
43+
redeclare IDEAS.Buildings.Validation.Data.Constructions.HeavyWall
44+
constructionType,
45+
inc=IDEAS.Types.Tilt.Wall,
46+
azi=IDEAS.Types.Azimuth.S,
47+
A=w*h - win.A) "Southern outer wall model"
48+
annotation (Placement(transformation(
49+
extent={{-6,-10},{6,10}},
50+
rotation=90,
51+
origin={-10,-34})));
52+
IDEAS.Buildings.Components.Window win(
53+
inc=IDEAS.Types.Tilt.Wall,
54+
A=3*1.4,
55+
azi=IDEAS.Types.Azimuth.S,
56+
redeclare IDEAS.Buildings.Data.Glazing.Ins2Ar2020 glazing)
57+
"Window model" annotation (Placement(transformation(extent={{-6,-10},{6,10}},
58+
rotation=0,
59+
origin={-54,-10})));
60+
61+
IDEAS.Buildings.Components.SlabOnGround slaOnGro(
62+
redeclare IDEAS.Buildings.Data.Constructions.FloorOnGround constructionType,
63+
inc=IDEAS.Types.Tilt.Floor,
64+
azi=IDEAS.Types.Azimuth.S,
65+
A=l*w) "Floor model" annotation (Placement(transformation(
66+
extent={{-6,-11},{6,11}},
67+
rotation=90,
68+
origin={30,-35})));
69+
IDEAS.Buildings.Components.OuterWall cei(
70+
redeclare IDEAS.Buildings.Validation.Data.Constructions.LightRoof
71+
constructionType,
72+
inc=IDEAS.Types.Tilt.Ceiling,
73+
A=w*l) "Ceiling model" annotation (Placement(transformation(
74+
extent={{6,-10},{-6,10}},
75+
rotation=90,
76+
origin={30,54})));
77+
equation
78+
connect(outWalWes.propsBus_a, zon.propsBus[1]) annotation (Line(
79+
points={{-49,22},{-30,22},{-30,14},{-20,14},{-20,13.1429}},
80+
color={255,204,51},
81+
thickness=0.5));
82+
connect(zon.propsBus[2], outWalNor.propsBus_a) annotation (Line(
83+
points={{-20,13.4286},{-22,13.4286},{-22,30},{-12,30},{-12,49}},
84+
color={255,204,51},
85+
thickness=0.5));
86+
connect(zon.propsBus[3], outWalEas.propsBus_a) annotation (Line(
87+
points={{-20,13.7143},{-20,14},{-22,14},{-22,30},{20,30},{20,12},{29,12}},
88+
color={255,204,51},
89+
thickness=0.5));
90+
connect(outWalSou.propsBus_a, zon.propsBus[4]) annotation (Line(
91+
points={{-12,-29},{-12,-10},{-20,-10},{-20,14}},
92+
color={255,204,51},
93+
thickness=0.5));
94+
connect(win.propsBus_a, zon.propsBus[5]) annotation (Line(
95+
points={{-49,-8},{-30,-8},{-30,14},{-20,14},{-20,14.2857}},
96+
color={255,204,51},
97+
thickness=0.5));
98+
connect(slaOnGro.propsBus_a, zon.propsBus[6]) annotation (Line(
99+
points={{27.8,-30},{28,-30},{28,-10},{-20,-10},{-20,14.5714}},
100+
color={255,204,51},
101+
thickness=0.5));
102+
connect(cei.propsBus_a, zon.propsBus[7]) annotation (Line(
103+
points={{28,49},{28,30},{-22,30},{-22,14.8571},{-20,14.8571}},
104+
color={255,204,51},
105+
thickness=0.5));
106+
annotation (
107+
Icon(coordinateSystem(preserveAspectRatio=false)),
108+
Diagram(coordinateSystem(preserveAspectRatio=false)),
109+
experiment(
110+
StartTime=10000000,
111+
StopTime=11000000,
112+
__Dymola_NumberOfIntervals=5000,
113+
Tolerance=1e-06,
114+
__Dymola_Algorithm="Dassl"),
115+
__Dymola_Commands(file=
116+
"Resources/Scripts/Dymola/Examples/Tutorial/DetailedHouse/DetailedHouse1.mos"
117+
"Simulate and plot"),
118+
Documentation(info="<html>
119+
<p>
120+
This first example instantiates a simple building model that consists of one zone, four walls,
121+
a window, a floor and a ceiling. The zone dimensions are <i>8 m</i> (with walls oriented
122+
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
123+
zone height of <i>2.8 m</i>. Apply double glazing and a heavy wall, which provide high thermal mass.
124+
</p>
125+
<h4>Required models</h4>
126+
<ul>
127+
<li>
128+
<a href=\"modelica://IDEAS.BoundaryConditions.SimInfoManager\">
129+
IDEAS.BoundaryConditions.SimInfoManager</a>
130+
</li>
131+
<li>
132+
<a href=\"modelica://IDEAS.Buildings.Components.Zone\">
133+
IDEAS.Buildings.Components.Zone</a>
134+
</li>
135+
<li>
136+
<a href=\"modelica://IDEAS.Buildings.Components.OuterWall\">
137+
IDEAS.Buildings.Components.OuterWall</a>
138+
</li>
139+
<li>
140+
<a href=\"modelica://IDEAS.Buildings.Components.Window\">
141+
IDEAS.Buildings.Components.Window</a>
142+
</li>
143+
<li>
144+
<a href=\"modelica://IDEAS.Buildings.Components.SlabOnGround\">
145+
IDEAS.Buildings.Components.SlabOnGround</a>
146+
</li>
147+
</ul>
148+
<h4>Connection instructions</h4>
149+
<p>
150+
Each yellow bus connector of a surface (<code>Window</code>, <code>OuterWall</code>
151+
or <code>SlabOnGround</code>) has to be connected to exactly one zone bus connector.
152+
To support multiple connections, the zone has an array of bus connectors with size
153+
<code>nSurf</code>, where <code>nSurf</code> is a parameter of <code>Zone</code>,
154+
which has to be set by the user. It is the user’s responsibility to ensure that each
155+
element of this array is connected to exactly one surface and that there is a total
156+
of <code>nSurf</code> connections to the zone.
157+
</p>
158+
<p>
159+
In addition to connecting each surface, the parameters of each component have to be set. Components typically
160+
have many default values that are appropriate for many purposes. When a parameter does not have a default
161+
value, it must be set by the user. Notable examples are the dimensions and orientation of the zone, walls
162+
and windows. The surface orientation can be set using the parameters <code>incOpt</code>, which automatically sets the
163+
inclination depending on the type of outer wall (wall, floor, ceiling), and <code>aziOpt</code>, which automatically sets the
164+
azimuth (north, east, south, west). Furthermore, the zone Medium must be set to <a href=\"modelica://IDEAS.Media.Air\">
165+
IDEAS.Media.Air</a>. Glazing and wall types must also be specified. This example uses the <i>BESTEST Heavy Wall</i> for the
166+
walls, the <i>FloorOnGround</i> construction type for the floor, the <i>BESTEST light roof</i> for the roof and the double glazing
167+
type <i>Saint Gobain Planitherm</i> and a south orientation for the window.
168+
</p>
169+
<p>
170+
The <code>SimInfoManager</code> by default has the modifier <code>inner</code> in its declaration. All IDEAS building components
171+
have the modifier <code>outer</code> in their respective declarations of the <code>SimInfoManager</code>. This causes the component
172+
declarations to point towards the higher level <code>SimInfoManager</code> declaration. This way all model equations for
173+
the weather data have to be generated only once, instead of for each surface.
174+
</p>
175+
<h4>Reference result</h4>
176+
<p>
177+
This model is simulated with the following settings:
178+
</p>
179+
<ol>
180+
<li>Dassl as the solver with tolerance = 1e-06 </li>
181+
<li>Start time = 1e7,</li>
182+
<li>Stop time = 1.1e7,</li>
183+
<li>Number of intervals = 5000.</li>
184+
</ol>
185+
<p>
186+
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.
187+
The figure below shows the operative zone temperature, <code>zon.TSensor</code>,
188+
which represents the mean of the air temperature and the mean radiative temperature of all surfaces.
189+
</p>
190+
<p align=\"center\">
191+
<img alt=\"Zone temperature as function of time.\"
192+
src=\"modelica://IDEAS/Resources/Images/Examples/Tutorial/DetailedHouse/DetailedHouse1.png\" width=\"700\"/>
193+
</p>
194+
</html>", revisions="<html>
195+
<ul>
196+
<li>
197+
April 14, 2025, by Anna Dell'Isola and Lone Meertens:<br/>
198+
Update and restructure IDEAS tutorial models.
199+
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1374\">#1374</a>
200+
and <a href=\"https://github.com/open-ideas/IDEAS/issues/1389\">#1389</a>.
201+
</li>
202+
<li>
203+
September 18, 2019 by Filip Jorissen:<br/>
204+
First implementation for the IDEAS crash course.
205+
</li>
206+
</ul>
207+
</html>"));
208+
end DetailedHouse1;
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
within IDEAS.Examples.Tutorial.DetailedHouse;
2+
model DetailedHouse10 "Speeding up the code"
3+
extends DetailedHouse9(
4+
pumSec(
5+
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
6+
allowFlowReversal=false,
7+
use_riseTime=false),
8+
pumPri(
9+
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
10+
allowFlowReversal=false,
11+
use_riseTime=false),
12+
pumEmi(
13+
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
14+
allowFlowReversal=false,
15+
use_riseTime=false),
16+
recZon1(
17+
redeclare IDEAS.Buildings.Components.InterzonalAirFlow.n50FixedPressure interzonalAirFlow,
18+
redeclare HeavyWallNoWood conTypA,
19+
redeclare HeavyWallNoWood conTypB,
20+
redeclare HeavyWallNoWood conTypC,
21+
redeclare HeavyWallNoWood conTypD),
22+
recZon(
23+
redeclare IDEAS.Buildings.Components.InterzonalAirFlow.n50FixedPressure interzonalAirFlow,
24+
redeclare HeavyWallNoWood conTypA,
25+
redeclare HeavyWallNoWood conTypB,
26+
redeclare HeavyWallNoWood conTypC,
27+
redeclare HeavyWallNoWood conTypD),
28+
fanRet(
29+
allowFlowReversal=false,
30+
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
31+
use_riseTime=false),
32+
fanSup(
33+
allowFlowReversal=false,
34+
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
35+
use_riseTime=false),
36+
val(allowFlowReversal=false, from_dp=true),
37+
val1(allowFlowReversal=false, from_dp=true),
38+
rad(allowFlowReversal=false, nEle=2),
39+
rad1(allowFlowReversal=false, nEle=2),
40+
heaPum(
41+
allowFlowReversal1=false,
42+
allowFlowReversal2=false,
43+
from_dp1=true,
44+
from_dp2=true),
45+
senTemSup(tau=0),
46+
tan(allowFlowReversal=false, tau=60),
47+
vavSup(allowFlowReversal=false, use_strokeTime=false),
48+
vavRet(allowFlowReversal=false, use_strokeTime=false),
49+
vavSup1(allowFlowReversal=false, use_strokeTime=false),
50+
vavRet1(allowFlowReversal=false, use_strokeTime=false),
51+
hex(allowFlowReversal1=false, allowFlowReversal2=false));
52+
protected
53+
record HeavyWallNoWood "BESTEST heavy wall with idealized wood layer"
54+
extends IDEAS.Buildings.Data.Interfaces.Construction(
55+
final mats={
56+
IDEAS.Buildings.Validation.Data.Materials.WoodSiding(d=0),
57+
IDEAS.Buildings.Validation.Data.Insulation.FoamInsulation(d=0.0615),
58+
IDEAS.Buildings.Validation.Data.Materials.ConcreteBlock(d=0.10)});
59+
60+
end HeavyWallNoWood;
61+
annotation (
62+
__Dymola_Commands(file=
63+
"Resources/Scripts/Dymola/Examples/Tutorial/DetailedHouse/DetailedHouse10.mos"
64+
"Simulate and plot"),
65+
experiment(
66+
StartTime=10000000,
67+
StopTime=11000000,
68+
__Dymola_NumberOfIntervals=5000,
69+
Tolerance=1e-06,
70+
__Dymola_fixedstepsize=20,
71+
__Dymola_Algorithm="Euler"),
72+
__Dymola_experimentFlags(
73+
Advanced(
74+
EvaluateAlsoTop=true,
75+
GenerateVariableDependencies=false,
76+
OutputModelicaCode=false),
77+
Evaluate=true,
78+
OutputCPUtime=true,
79+
OutputFlatModelica=false),
80+
Documentation(info="<html>
81+
<p>
82+
The previous examples present a rather good computational performance. However, the computation time
83+
can significantly increase for larger simulation time due to frequent on/off switching
84+
of the heat pump. This effect causes a lot of fast transients that force the solver
85+
to take small steps, which takes a lot of time.
86+
</p>
87+
<p>
88+
Fortunately, many tricks can be used to speed up the solver. The fundamental principle is to
89+
remove small time constants from the problem.
90+
The example in <a href=\"modelica://IDEAS.Examples.Tutorial.DetailedHouse.DetailedHouse10\">
91+
IDEAS.Examples.Tutorial.DetailedHouse.DetailedHouse10</a> implements changes
92+
that cause the simulation to become almost 3 times faster. By systematically removing fast time constants, the solver can be
93+
switched to a simpler method, such as Euler integration, with a fixed time step of 20 seconds.
94+
<p>
95+
It is important to note the trade-off between computation time and simulation
96+
accuracy when choosing an integration method. While the Euler method is generally
97+
much faster than implicit solvers such as Dassl, it is also less accurate,
98+
especially for stiff or highly dynamic systems. Using smaller Euler time steps
99+
increases simulation accuracy but also increases computation time, whereas larger
100+
time steps decrease computation time at the expense of accuracy. Therefore, careful
101+
consideration is needed when selecting the solver and time step size, balancing
102+
the need for speed and the desired level of accuracy in the simulation results.
103+
</p>
104+
<p>
105+
These are modest improvements since this small example model behaves rather well.
106+
However, for large models, the difference in computation time when using Euler integration
107+
can become a factor 1000. The modifications however require a bit of knowledge about solvers and the models
108+
that you are using, including some of the more advanced parameters. To learn more about this, we refer to
109+
[1, 2, 3].
110+
</p>
111+
<h4>References</h4>
112+
<ol>
113+
[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
114+
</ol>
115+
<ol>
116+
[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
117+
</ol>
118+
<ol>
119+
[3] F. Jorissen. <i>Toolchain for Optimal Control and Design of Energy Systems in Buildings</i>. PhD Thesis, KU Leuven, 2018.
120+
</ol>
121+
</html>", revisions="<html>
122+
<ul>
123+
<li>
124+
April 14, 2025, by Anna Dell'Isola and Lone Meertens:<br/>
125+
Update and restructure IDEAS tutorial models.
126+
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1374\">#1374</a>
127+
and <a href=\"https://github.com/open-ideas/IDEAS/issues/1389\">#1389</a>.
128+
</li>
129+
<li>
130+
October 30, 2024, by Lucas Verleyen:<br/>
131+
Updates according to <a href=\"https://github.com/ibpsa/modelica-ibpsa/tree/8ed71caee72b911a1d9b5a76e6cb7ed809875e1e\">IBPSA</a>.<br/>
132+
See <a href=\"https://github.com/open-ideas/IDEAS/pull/1383\">#1383</a>
133+
(and <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1926\">IBPSA, #1926</a>).
134+
</li>
135+
<li>
136+
September 18, 2019 by Filip Jorissen:<br/>
137+
First implementation for the IDEAS crash course.
138+
</li>
139+
</ul>
140+
</html>"));
141+
end DetailedHouse10;

0 commit comments

Comments
 (0)