Skip to content

Commit

Permalink
Merge pull request #1391 from open-ideas/issue1337_TemperatureSetpoin…
Browse files Browse the repository at this point in the history
…t_PartialZone

Issue1337 temperature setpoint partial zone
  • Loading branch information
jelgerjansen authored Dec 4, 2024
2 parents 7b40f27 + 6908181 commit e953b5c
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 48 deletions.
34 changes: 24 additions & 10 deletions IDEAS/Buildings/Components/BoundaryWall.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,36 @@ model BoundaryWall "Opaque wall with optional prescribed heat flow rate or tempe
final custom_q50=0,
final use_custom_q50=true,
final nWin=1,
QTra_design=U_value*A*(273.15 + 21 - TRef_a),
dT_nominal_a=-1,
add_cracks=false,
final QTra_design(fixed=false),
layMul(disableInitPortB=use_T_in or use_T_fixed, monLay(monLayDyn(each
addRes_b=(sim.lineariseDymola and (use_T_in or use_T_fixed))))));

parameter Boolean use_T_in = false
"Use a temperature boundary condition which is read from the input connector T_in"
annotation(Dialog(group="Boundary conditions"));
parameter Boolean use_T_fixed = false
"Get the boundary temperature from the input connector"
"Use a fixed temperature boundary condition which is read from the parameter T_fixed"
annotation(Dialog(group="Boundary conditions"));
parameter Modelica.Units.SI.Temperature T_fixed=294.15
"Fixed boundary temperature"
annotation (Dialog(group="Boundary conditions", enable=use_T_fixed));
parameter Boolean use_T_in = false
"Get the boundary temperature from the input connector"
annotation(Dialog(group="Boundary conditions"));
annotation (Dialog(group="Boundary conditions",enable=use_T_fixed));
parameter Modelica.Units.SI.Temperature T_in_nom=T_fixed
"Nominal boundary temperature, for calculation of design heat loss"
annotation (Dialog(group="Design power", tab="Advanced",enable=use_T_fixed or use_T_in));
parameter Boolean use_Q_in = false
"Get the boundary heat flux from the input connector"
"Use a heat flow boundary condition which is read from the input connection Q_in"
annotation(Dialog(group="Boundary conditions"));

parameter Modelica.Units.SI.HeatFlowRate Q_in_nom=0
"Nominal boundary heat flux, for calculation of design heat loss (positive if entering the wall)"
annotation (Dialog(group="Design power", tab="Advanced", enable=use_Q_in));
Modelica.Blocks.Interfaces.RealInput T if use_T_in
"Input for boundary temperature" annotation (Placement(
transformation(extent={{-120,10},{-100,30}}),iconTransformation(extent={{-120,10},
{-100,30}})));
Modelica.Blocks.Interfaces.RealInput Q_flow if use_Q_in
"Input for boundary heat flow rate entering the wall" annotation (Placement(
"Input for boundary heat flow rate entering the wall (positive)" annotation (Placement(
transformation(extent={{-120,-30},{-100,-10}}),
iconTransformation(extent={{-120,
-30},{-100,-10}})));
Expand Down Expand Up @@ -64,6 +69,8 @@ protected
IDEAS.Buildings.Components.Interfaces.WeaBus weaBus(final numSolBus=sim.numIncAndAziInBus,
outputAngles=sim.outputAngles) "Weather bus"
annotation (Placement(transformation(extent={{40,-80},{60,-60}})));
initial equation
QTra_design=if use_T_in or use_T_fixed then U_value*A*(TRefZon - T_in_nom) else -Q_in_nom;
equation
assert(not (use_T_in and use_Q_in or use_T_in and use_T_fixed or use_Q_in and use_T_fixed),
"In "+getInstanceName()+": Only one of the following options can be used simultaneously: use_T_in, use_Q_in, use_T_fixed");
Expand Down Expand Up @@ -169,11 +176,18 @@ to enable an input for a prescribed boundary condition temperature or heat flow
Alternatively, parameters <code>use_T_fixed</code> and <code>T_fixed</code> can be used
to specify a fixed boundary condition temperature.
It is not allowed to enabled multiple of these three options.
If all are disabled then an adiabatic boundary (<code>Q_flow=0</code>) is used.
If all are disabled, an adiabatic boundary (<code>Q_flow=0</code>) is used.</p>
Parameters <code>T_in_nom</code> and <code>Q_in_nom</code> are used for the calculation
of heat losses, when the temperature boundary condition and heat flow boundary condition are applied, respectively.
</p>
</html>", revisions="<html>
<ul>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Update calculation of transmission design losses.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
April 26, 2020, by Filip Jorissen:<br/>
Refactored <code>SolBus</code> to avoid many instances in <code>PropsBus</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1131\">
Expand Down
9 changes: 9 additions & 0 deletions IDEAS/Buildings/Components/Interfaces/DummyConnection.mo
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ model DummyConnection "Source generator/sink for propsbus"
annotation (Placement(transformation(extent={{-80,-100},{-60,-80}})));
Modelica.Blocks.Sources.BooleanConstant custom_q50(k=false) if not isZone
annotation (Placement(transformation(extent={{-80,-130},{-60,-110}})));
Modelica.Blocks.Sources.Constant TRefZon(k=T) if isZone
annotation (Placement(transformation(extent={{-40,60},{-20,80}})));
equation
connect(prescribedHeatFlow[1].port, zoneBus.surfCon) annotation (Line(
points={{-50,20},{62,20},{62,-1.9},{100.1,-1.9}},
Expand Down Expand Up @@ -132,6 +134,8 @@ equation
connect(custom_q50.y, zoneBus.use_custom_q50) annotation (Line(points={{-59,
-120},{100.1,-120},{100.1,-1.9}},
color={255,0,255}));
connect(TRefZon.y, zoneBus.TRefZon) annotation (Line(points={{-19,70},{100.1,70},
{100.1,-1.9}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{100,100}})), Icon(coordinateSystem(
preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
Expand All @@ -145,6 +149,11 @@ equation
Documentation(revisions="<html>
<ul>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Assign value for <code>TRefZon</code> in the bus connector.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
May 23, 2022, by Filip Jorissen:<br/>
Added missing medium declaration.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
Expand Down
16 changes: 9 additions & 7 deletions IDEAS/Buildings/Components/Interfaces/PartialSurface.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ partial model PartialSurface "Partial model for building envelope component"
parameter Modelica.Units.SI.Temperature T_start=293.15
"Start temperature for each of the layers"
annotation (Dialog(tab="Dynamics", group="Initial condition"));

parameter Modelica.Units.SI.Temperature TRef_a=291.15
"Reference temperature of zone on side of propsBus_a, for calculation of design heat loss"
annotation (Dialog(group="Design power", tab="Advanced"));
parameter Boolean linIntCon_a=sim.linIntCon
"= true, if convective heat transfer should be linearised"
annotation (Dialog(tab="Convection"));
Expand Down Expand Up @@ -138,6 +134,9 @@ protected
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlowQgai
"Component for computing conservation of energy";

Modelica.Units.SI.Temperature TRefZon=propsBusInt.TRefZon
"Reference zone temperature for calculation of design heat load";

IDEAS.Buildings.Components.Interfaces.ZoneBusVarMultiplicator gain(redeclare
package Medium = Medium, k=nWin)
"Gain for all propsBus variable to represent nWin surfaces instead of 1"
Expand Down Expand Up @@ -279,7 +278,6 @@ equation
points={{56.09,19.91},{46,19.91},{46,0},{40,0}},
color={191,0,0},
smooth=Smooth.None));

connect(layMul.port_a, propsBusInt.surfRad) annotation (Line(
points={{10,0},{16,0},{16,19.91},{56.09,19.91}},
color={191,0,0},
Expand Down Expand Up @@ -335,14 +333,18 @@ equation
connect(setArea.v50, propsBus_a.v50) annotation (Line(points={{79.4,-83.2},{
79.4,-82},{56,-82},{56,0},{100.1,0},{100.1,19.9}}, color={0,0,127}));
annotation (
Diagram(graphics,
coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{
100,100}})),
Icon(graphics,
coordinateSystem(preserveAspectRatio=false, extent={{-50,-100},{50,100}})),
Documentation(revisions="<html>
<ul>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Add variable <code>TRefZon</code> to be used when calculating <code>QTra_design</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
August 10, 2020, by Filip Jorissen:<br/>
Modifications for supporting interzonal airflow.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1066\">
Expand Down
25 changes: 18 additions & 7 deletions IDEAS/Buildings/Components/Interfaces/PartialZone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ model PartialZone "Building zone model"
parameter Boolean calculateViewFactor = false
"Explicit calculation of view factors: works well only for rectangular zones!"
annotation(Dialog(tab="Advanced", group="Radiative heat exchange"));
parameter Modelica.Units.SI.Temperature TZon_design=294.15
"Reference zone temperature for calculation of design heat load"
annotation (Dialog(group="Design heat load", tab="Advanced"));
final parameter Modelica.Units.SI.Power QInf_design=1012*1.204*V/3600*n50_int
/n50toAch*(273.15 + 21 - sim.Tdes)
/n50toAch*(TZon_design - sim.Tdes)
"Design heat losses from infiltration at reference outdoor temperature";
final parameter Modelica.Units.SI.Power QRH_design=A*fRH
"Additional power required to compensate for the effects of intermittent heating";
final parameter Modelica.Units.SI.Power Q_design(fixed=false)
"Total design heat losses for the zone";
"Total design heat losses for the zone (including transmission, infiltration, and reheating; excluding ventilation)";
parameter Medium.Temperature T_start=Medium.T_default
"Start value of temperature"
annotation(Dialog(tab = "Initialization"));
Expand Down Expand Up @@ -192,6 +195,9 @@ model PartialZone "Building zone model"


protected
Modelica.Blocks.Sources.RealExpression TRefZon[nSurf](each y=TZon_design)
"Reference zone temperature for the surfaces connected to this zone, for calculation of design heat load";

parameter Real n50_int(unit="1/h",min=0.01,fixed= false)
"n50 value cfr airtightness, i.e. the ACH at a pressure diffence of 50 Pa"
annotation(Dialog(enable=use_custom_n50,tab="Airflow", group="Airtightness"));
Expand Down Expand Up @@ -298,11 +304,11 @@ end Setq50;


initial equation


n50_int = if use_custom_n50 and not setq50.allSurfacesCustom then n50 else sum(propsBusInt.v50)/V;

Q_design=QInf_design+QRH_design+QTra_design; //Total design load for zone (additional ventilation losses are calculated in the ventilation system)
Q_design=QInf_design+QRH_design+QTra_design;
//Total design load for zone (excluding ventilation losses, these are assumed to be calculated in the ventilation system
//and should be added afterwards to obtain the total design heat load). See for example IDEAS.Templates.Interfaces.Building.

equation
if interzonalAirFlow.verifyBothPortsConnected then
Expand Down Expand Up @@ -504,8 +510,8 @@ end for;
connect(setq50.use_custom_n50s, propsBusInt.use_custom_n50) annotation (Line(points={{-60.8,
-92.8},{-60,-92.8},{-60,-92},{-80.1,-92},{-80.1,39.9}}, color={
255,0,255}));
annotation (Placement(transformation(extent={{
140,48},{100,88}})),
connect(TRefZon.y, propsBusInt.TRefZon);
annotation (Placement(transformation(extent={{140,48},{100,88}})),
Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
graphics),
Documentation(info="<html>
Expand All @@ -518,6 +524,11 @@ Change Medium to IDEAS.Media.Air and use 'constrainedby' for Modelica.Media.Inte
This is for <a href=https://github.com/open-ideas/IDEAS/issues/1375>#1375</a>.
</li>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Add parameter <code>TZon_design</code> to be used when calculating <code>Q_design</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
April 26, 2024 by Jelger Jansen:<br/>
Added parameter <code>ignAss</code> to ignore view factor asserts for non-physical unit test models.
This is for <a href=https://github.com/open-ideas/IDEAS/issues/1272>#1272</a>.
Expand Down
8 changes: 8 additions & 0 deletions IDEAS/Buildings/Components/Interfaces/ZoneBus.mo
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ expandable connector ZoneBus
IDEAS.Buildings.Components.Interfaces.RealConnector q50_zone(final unit="m3/(h.m2)") "v50 of the surface" annotation ();
IDEAS.Buildings.Components.Interfaces.BooleanConnector use_custom_q50 "true if custome q50 value is assigned to surface" annotation ();
IDEAS.Buildings.Components.Interfaces.BooleanConnector use_custom_n50 "true if the zone n50 is a custom value";
IDEAS.Buildings.Components.Interfaces.RealConnector TRefZon(
final quantity="Temperature",
final unit="K") annotation ();
annotation (Documentation(info="<html>
<p>
Connector that contains a weather bus and further
Expand All @@ -57,6 +60,11 @@ heat and information between a zone and a surface.
</html>", revisions="<html>
<ul>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Add connector <code>TRefZon</code> to be used when calculating <code>QTra_design</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
April 20, 2023 by Jelger Jansen:<br/>
Make the connector expandable to avoid (pedantic check) warnings in Dymola 2022x.
See issue <a href=https://github.com/open-ideas/IDEAS/issues/1317>#1317</a>
Expand Down
18 changes: 15 additions & 3 deletions IDEAS/Buildings/Components/Interfaces/ZoneBusVarMultiplicator.mo
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected
if sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None
"Mass flow rate multiplier for port 1"
annotation (Placement(transformation(extent={{-10,-170},{10,-150}})));
Modelica.Blocks.Math.Gain QTra_desgin(k=k) "Design heat flow rate"
Modelica.Blocks.Math.Gain QTra_design(k=k) "Design heat flow rate"
annotation (Placement(transformation(extent={{-10,178},{10,198}})));
Modelica.Blocks.Math.Gain area(k=k) "Heat exchange surface area"
annotation (Placement(transformation(extent={{-10,150},{10,170}})));
Expand Down Expand Up @@ -80,10 +80,13 @@ protected
Modelica.Blocks.Routing.BooleanPassThrough use_custom_q50
"0 if the surface has a custom q50"
annotation (Placement(transformation(extent={{-12,-296},{8,-276}})));
Modelica.Blocks.Routing.RealPassThrough TRefZon
"Reference zone temperature for calculation of design heat load"
annotation (Placement(transformation(extent={{8,-356},{-12,-336}})));
equation
connect(QTra_desgin.u, propsBus_a.QTra_design) annotation (Line(points={{-12,188},
connect(QTra_design.u, propsBus_a.QTra_design) annotation (Line(points={{-12,188},
{-100.1,188},{-100.1,0.1}}, color={0,0,127}));
connect(QTra_desgin.y, propsBus_b.QTra_design) annotation (Line(points={{11,188},
connect(QTra_design.y, propsBus_b.QTra_design) annotation (Line(points={{11,188},
{100.1,188},{100.1,-0.1}},color={0,0,127}));
connect(area.u, propsBus_a.area) annotation (Line(points={{-12,160},{-100.1,
160},{-100.1,0.1}},color={0,0,127}));
Expand Down Expand Up @@ -162,6 +165,10 @@ equation
connect(use_custom_n50.y, propsBus_a.use_custom_n50) annotation (Line(points={{-13,
-314},{-100,-314},{-100,0.1},{-100.1,0.1}},
color={255,0,255}));
connect(TRefZon.u, propsBus_b.TRefZon) annotation (Line(points={{10,-346},{
100.1,-346},{100.1,-0.1}}, color={0,0,127}));
connect(TRefZon.y, propsBus_a.TRefZon) annotation (Line(points={{-13,-346},{
-100.1,-346},{-100.1,0.1}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-180},
{100,200}}), graphics={
Polygon(
Expand All @@ -186,6 +193,11 @@ equation
Documentation(revisions="<html>
<ul>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Add connector <code>TRefZon</code> to be used when calculating <code>QTra_design</code>.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
August 10, 2020, by Filip Jorissen:<br/>
Modifications for supporting interzonal airflow.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1066\">
Expand Down
22 changes: 14 additions & 8 deletions IDEAS/Buildings/Components/InternalWall.mo
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ model InternalWall "interior opaque wall between two zones"
E(y=if sim.computeConservationOfEnergy then layMul.E else 0),
Qgai(y=(if sim.openSystemConservationOfEnergy or not sim.computeConservationOfEnergy
then 0 else sum(port_emb.Q_flow))),
final QTra_design=U_value*A*(TRef_a - TRef_b),
q50_zone(v50_surf=0));
q50_zone(v50_surf=0),
final QTra_design(fixed=false));
//using custom q50 since this model is not an external component

parameter Boolean linIntCon_b=sim.linIntCon
Expand All @@ -18,10 +18,8 @@ model InternalWall "interior opaque wall between two zones"
parameter Modelica.Units.SI.TemperatureDifference dT_nominal_b=1
"Nominal temperature difference used for linearisation, negative temperatures indicate the solid is colder"
annotation (Dialog(tab="Convection"));
parameter Modelica.Units.SI.Temperature TRef_b=291.15
"Reference temperature of zone on side of propsBus_b, for calculation of design heat loss"
annotation (Dialog(group="Design power", tab="Advanced"));

Modelica.Units.SI.Temperature TRef_b = propsBus_b.TRefZon
"Reference temperature of zone on side of propsBus_b, for calculation of design heat loss";
// open door modelling
parameter Boolean hasCavity = false
"=true, to model open door or cavity in wall"
Expand Down Expand Up @@ -98,7 +96,7 @@ protected
"convective surface heat transimission on the interior side of the wall"
annotation (Placement(transformation(extent={{-22,-10},{-42,10}})));
Modelica.Blocks.Sources.RealExpression QDesign_b(y=-QTra_design);
//Negative, because of its losses from zone side b to zone side a, oposite of calculation of QTra_design
//Negative, because of its losses from zone side b to zone side a, opposite of calculation of QTra_design

Modelica.Blocks.Sources.RealExpression incExp1(y=incInt + Modelica.Constants.pi)
"Inclination angle";
Expand Down Expand Up @@ -141,6 +139,10 @@ public
if hasCavity and sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort
"1-port model for open door"
annotation (Placement(transformation(extent={{-10,58},{10,78}})));
initial equation
QTra_design=U_value*A*(TRefZon - TRef_b)
"TRefZon is the reference temperature for heat loss calculations of the zone connected to propsbus_a,
TRef_b is the reference temperature for heat loss calculations of the zone connected to propsBus_b";
equation
assert(hasCavity == false or IDEAS.Utilities.Math.Functions.isAngle(incInt, IDEAS.Types.Tilt.Wall),
"In " + getInstanceName() + ": Cavities are only supported for vertical walls, but inc=" + String(incInt) + ". The model is not accurate.",
Expand Down Expand Up @@ -203,7 +205,6 @@ equation
-58},{56,20.1},{-100.1,20.1}}, color={0,0,127}));
connect(q50_zone.using_custom_q50, propsBus_b.use_custom_q50) annotation (Line(points={{79,-52},
{56,-52},{56,20.1},{-100.1,20.1}}, color={0,0,127}));

annotation (
Icon(coordinateSystem(preserveAspectRatio=false,extent={{-60,-100},{60,100}}),
graphics={
Expand Down Expand Up @@ -264,6 +265,11 @@ We assume that the value of <code>A</code> excludes the surface area of the cavi
</html>", revisions="<html>
<ul>
<li>
November 7, 2024, by Anna Dell'Isola and Jelger Jansen:<br/>
Update calculation of transmission design losses.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1337\">#1337</a>
</li>
<li>
August 2, 2022, by Filip Jorissen:<br/>
Activating thermal model when using OnePorts.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1291\">
Expand Down
Loading

0 comments on commit e953b5c

Please sign in to comment.