Skip to content

Commit

Permalink
Changed constraining type. (#2473)
Browse files Browse the repository at this point in the history
* Changed constraining type.

This integrates #2471 into v7.0.x maintenance
  • Loading branch information
mwetter authored May 3, 2021
1 parent c890bfe commit 0d56d83
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 37 deletions.
11 changes: 9 additions & 2 deletions Buildings/Fluid/CHPs/BaseClasses/EnergyConversionNormal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ equation
{-160,40}}, color={0,0,127}));
connect(heaGen.y, QGen_flow)
annotation (Line(points={{82,-40},{160,-40}}, color={0,0,127}));
connect(QGen_flow, QGen_flow)
annotation (Line(points={{160,-40},{160,-40}}, color={0,0,127}));
connect(masFloAir.y, mAir_flow)
annotation (Line(points={{121,0},{160,0}}, color={0,0,127}));
connect(etaE.TWatIn, TWatIn) annotation (Line(points={{-82,-6},{-100,-6},{-100,
Expand Down Expand Up @@ -109,6 +107,15 @@ the fuel flow rate.
</html>", revisions="<html>
<ul>
<li>
April 30, 2021, by Michael Wetter:<br/>
Reformulated replaceable class to avoid access of components that are not in the constraining type.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2471\">issue #2471</a>.
</li>
<li>
April 30, 2021, by Michael Wetter:<br/>
Removed connector to itself.
</li>
<li>
October 31, 2019, by Jianjun Hu:<br/>
Refactored implementation.
</li>
Expand Down
15 changes: 9 additions & 6 deletions Buildings/Fluid/CHPs/ThermalElectricalFollowing.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
within Buildings.Fluid.CHPs;
model ThermalElectricalFollowing
extends Buildings.Fluid.Interfaces.TwoPortHeatMassExchanger(
final vol(V=per.capHeaRec/rhoWat/cWat),
redeclare Buildings.Fluid.MixingVolumes.MixingVolume vol(
final V=per.capHeaRec/rhoWat/cWat),
final dp_nominal=3458*m_flow_nominal + 5282 "The correlation between nominal pressure drop and mass flow rate is derived from manufacturers data");

replaceable parameter Buildings.Fluid.CHPs.Data.Generic per
Expand Down Expand Up @@ -220,8 +221,6 @@ equation
{160,20},{200,20}},color={0,0,127}));
connect(eneCon.PEleNet, PEleNet) annotation (Line(points={{-38,38},{160,38},{160,
60},{200,60}}, color={0,0,127}));
connect(mFue_flow, mFue_flow) annotation (Line(points={{200,20},{200,20}},
color={0,0,127}));
connect(TWatOut.port, vol.heatPort) annotation (Line(points={{60,-60},{-20,
-60},{-20,-10},{-9,-10}}, color={191,0,0}));
connect(powCon.opeMod, opeMod.opeMod) annotation (Line(points={{119,100},{80,
Expand Down Expand Up @@ -275,9 +274,8 @@ equation
{-160,-120},{-140,-120}}, color={191,0,0}));
connect(TRooSen.T, eneCon.TRoo) annotation (Line(points={{-120,-120},{-90,
-120},{-90,26},{-62,26}}, color={0,0,127}));
connect(theFol, cooWatCon.trigger) annotation (Line(points={{-200,260},{-58,
260},{-58,338}},
color={255,0,255}));
connect(theFol, cooWatCon.trigger) annotation (Line(points={{-200,260},{-56,260},
{-56,338}}, color={255,0,255}));
connect(elePowDem.y, swi.u1) annotation (Line(points={{22,350},{80,350},{80,
268},{98,268}}, color={0,0,127}));
annotation (
Expand Down Expand Up @@ -358,6 +356,11 @@ programs</i>, Section III. <a href=\"https://strathprints.strath.ac.uk/6704/\">
</html>", revisions="<html>
<ul>
<li>
April 30, 2021, by Michael Wetter:<br/>
Reformulated replaceable class to avoid access of components that are not in the constraining type.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2471\">issue #2471</a>.
</li>
<li>
April 8, 2020, by Antoine Gautier:<br/>
Refactored implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ model Case600 "Case 600FF, but with dual-setpoint for heating and cooling"
annotation (Placement(transformation(extent={{-92,30},{-84,38}})));
BaseClasses.DaySchedule TSetCoo(table=[0.0,273.15 + 27]) "Cooling setpoint"
annotation (Placement(transformation(extent={{-92,8},{-84,16}})));
Controls.OBC.CDL.Continuous.MovingMean PHea(delta=3600)
Buildings.Controls.OBC.CDL.Continuous.MovingMean PHea(delta=3600)
"Hourly averaged heating power"
annotation (Placement(transformation(extent={{-20,48},{-12,56}})));
Controls.OBC.CDL.Continuous.MovingMean PCoo(delta=3600)
Buildings.Controls.OBC.CDL.Continuous.MovingMean PCoo(delta=3600)
"Hourly averaged cooling power"
annotation (Placement(transformation(extent={{-20,-8},{-12,0}})));
equation
connect(TRooAir.T,conHea. u_m) annotation (Line(
points={{-78,-24},{-78,24},{-68,24},{-68,29.2}},
points={{2,-15},{-80,-15},{-80,24},{-68,24},{-68,29.2}},
color={0,0,127},
smooth=Smooth.None));
connect(conCoo.u_m, TRooAir.T) annotation (Line(
points={{-68,7.2},{-68,0},{-78,0},{-78,-24}},
points={{-68,7.2},{-68,-15},{2,-15}},
color={0,0,127},
smooth=Smooth.None));
connect(conHea.y,gaiHea. u) annotation (Line(
Expand Down Expand Up @@ -113,7 +113,7 @@ equation
color={0,0,127},
smooth=Smooth.None));
connect(preHea.port, roo.heaPorAir) annotation (Line(
points={{6,24},{12,24},{12,-15},{50.25,-15}},
points={{6,24},{16,24},{16,-15},{50.25,-15}},
color={191,0,0},
smooth=Smooth.None));
annotation (__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/ThermalZones/Detailed/Validation/BESTEST/Cases6xx/Case600.mos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ model Case600FF
nStaRef=nStaRef)}) "Exterior wall"
annotation (Placement(transformation(extent={{20,84},{34,98}})));
parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic
matFlo(final nLay=
2,
absIR_a=0.9,
absIR_b=0.9,
absSol_a=0.6,
absSol_b=0.6,
matFlo(
final nLay=2,
absIR_a=0.9,
absIR_b=0.9,
absSol_a=0.6,
absSol_b=0.6,
material={Buildings.HeatTransfer.Data.Solids.Generic(
x=1.003,
k=0.040,
Expand Down Expand Up @@ -100,14 +100,14 @@ model Case600FF
til={Z_},
azi={S_}),
lat=weaDat.lat,
massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
"Room model for Case 600"
massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Room model"
annotation (Placement(transformation(extent={{36,-30},{66,0}})));
Modelica.Blocks.Sources.Constant qConGai_flow(k=80/48) "Convective heat gain"
annotation (Placement(transformation(extent={{-56,64},{-48,72}})));
Modelica.Blocks.Sources.Constant qRadGai_flow(k=120/48) "Radiative heat gain"
annotation (Placement(transformation(extent={{-44,72},{-36,80}})));
Modelica.Blocks.Routing.Multiplex3 multiplex3_1
"Multiplex for internal gains"
annotation (Placement(transformation(extent={{-18,64},{-10,72}})));
Modelica.Blocks.Sources.Constant qLatGai_flow(k=0) "Latent heat gain"
annotation (Placement(transformation(extent={{-44,56},{-36,64}})));
Expand All @@ -125,7 +125,8 @@ model Case600FF
annotation (Placement(transformation(
extent={{0,0},{-8,8}},
origin={72,-52})));
parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic roof(nLay=3,
parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic roof(
nLay=3,
absIR_a=0.9,
absIR_b=0.9,
absSol_a=0.6,
Expand All @@ -147,8 +148,7 @@ model Case600FF
d=950,
nStaRef=nStaRef)}) "Roof"
annotation (Placement(transformation(extent={{60,84},{74,98}})));
Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.Win600
window600(
Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.Win600 window600(
UFra=3,
haveExteriorShade=false,
haveInteriorShade=false) "Window"
Expand Down Expand Up @@ -181,15 +181,20 @@ model Case600FF
"0.41 ACH adjusted for the altitude (0.5 at sea level)"
annotation (Placement(transformation(extent={{-96,-78},{-88,-70}})));
Modelica.Blocks.Math.Product product
"Product to compute infiltration mass flow rate"
annotation (Placement(transformation(extent={{-50,-60},{-40,-50}})));
Buildings.Fluid.Sensors.Density density(redeclare package Medium = MediumA)
Buildings.Fluid.Sensors.Density density(
redeclare package Medium = MediumA)
"Air density inside the building"
annotation (Placement(transformation(extent={{-40,-76},{-50,-66}})));
Buildings.BoundaryConditions.WeatherData.Bus weaBus
"Weather data bus"
annotation (Placement(transformation(extent={{-4,-96},{12,-80}})));
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TRooAir
"Room air temperature"
annotation (Placement(transformation(extent={{-86,-28},{-78,-20}})));
annotation (Placement(transformation(extent={{5,-5},{-5,5}},
rotation=0,
origin={7,-15})));
replaceable parameter
Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating
staRes(
Expand All @@ -200,6 +205,7 @@ model Case600FF
"Reference results from ASHRAE/ANSI Standard 140"
annotation (Placement(transformation(extent={{80,40},{94,54}})));
Modelica.Blocks.Math.MultiSum multiSum(nu=1)
"Multi sum for infiltration air flow rate"
annotation (Placement(transformation(extent={{-78,-80},{-66,-68}})));
Controls.OBC.CDL.Continuous.MovingMean TRooHou(delta=3600)
"Hourly averaged room air temperature"
Expand Down Expand Up @@ -239,7 +245,7 @@ equation
color={0,0,127},
smooth=Smooth.None));
connect(product.y, sinInf.m_flow_in) annotation (Line(
points={{-39.5,-55},{-36,-55},{-36,-55.2},{4,-55.2}},
points={{-39.5,-55},{-36,-55},{-36,-55.2},{2.8,-55.2}},
color={0,0,127},
smooth=Smooth.None));
connect(density.port, roo.ports[1]) annotation (Line(
Expand Down Expand Up @@ -275,15 +281,15 @@ equation
index=-1,
extent={{-6,3},{-6,3}}));
connect(roo.heaPorAir, TRooAir.port) annotation (Line(
points={{50.25,-15},{-90,-15},{-90,-24},{-86,-24}},
points={{50.25,-15},{12,-15}},
color={191,0,0},
smooth=Smooth.None));
connect(sinInf.ports[1], roo.ports[2]) annotation (Line(
points={{16,-60},{30,-60},{30,-22.5},{39.75,-22.5}},
color={0,127,255},
smooth=Smooth.None));
connect(multiSum.y, product.u1) annotation (Line(
points={{-64.98,-74},{-54,-74},{-54,-52},{-51,-52}},
points={{-64.98,-74},{-58,-74},{-58,-52},{-51,-52}},
color={0,0,127},
smooth=Smooth.None));
connect(InfiltrationRate.y, multiSum.u[1]) annotation (Line(
Expand All @@ -292,15 +298,15 @@ equation
smooth=Smooth.None));

connect(TRooAir.T, TRooHou.u) annotation (Line(
points={{-78,-24},{-68.8,-24}},
points={{2,-15},{-80,-15},{-80,-24},{-68.8,-24}},
color={0,0,127},
smooth=Smooth.None));
connect(TRooAir.T, TRooAnn.u) annotation (Line(
points={{-78,-24},{-72,-24},{-72,-36},{-68.8,-36}},
points={{2,-15},{-80,-15},{-80,-36},{-68.8,-36}},
color={0,0,127},
smooth=Smooth.None));
connect(souInf.ports[1], roo.ports[3]) annotation (Line(points={{-12,-28},{14,
-28},{14,-20.5},{39.75,-20.5}}, color={0,127,255}));
connect(souInf.ports[1], roo.ports[3]) annotation (Line(points={{-12,-28},{28,
-28},{28,-20.5},{39.75,-20.5}}, color={0,127,255}));
annotation (
experiment(Tolerance=1e-06, StopTime=3.1536e+07),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/ThermalZones/Detailed/Validation/BESTEST/Cases6xx/Case600FF.mos"
Expand Down Expand Up @@ -350,6 +356,7 @@ Added reference results.
Changed implementation to make this model the base class
for all BESTEST cases.
Added computation of hourly and annual averaged room air temperature.
</li>
<li>
October 6, 2011, by Michael Wetter:<br/>
First implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case650FF
"Case 600, no heating, no cooling, and ventilation as in case 650"
extends Case600FF(
staRes(
redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating staRes(
minT( Min=-23.0+273.15, Max=-21.6+273.15, Mean=-22.7+273.15),
maxT( Min=63.2+273.15, Max=68.2+273.15, Mean=64.7+273.15),
meanT(Min=18.0+273.15, Max=19.6+273.15, Mean=18.7+273.15)),
Expand Down Expand Up @@ -33,6 +33,12 @@ heating and no cooling.
</html>", revisions="<html>
<ul>
<li>
April 30, 2021, by Michael Wetter:<br/>
Added redeclaration to avoid access of component that is not in constraining type.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2471\">#2471</a>.
</li>
<li>
July 15, 2012, by Michael Wetter:<br/>
Revised implementation to extend from base case to avoid duplicate code.
Merged model into the Buildings library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ model Case900FF "Case 600FF, but with high thermal mass"
extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600FF(
matExtWal = extWalCase900,
matFlo = floorCase900,
staRes(
redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating staRes(
minT( Min=-6.4+273.15, Max=-1.6+273.15, Mean=-4.2+273.15),
maxT( Min=41.6+273.15, Max=44.8+273.15, Mean=43.1+273.15),
meanT(Min=24.5+273.15, Max=25.9+273.15, Mean=25.2+273.15)));
Expand All @@ -28,6 +28,11 @@ The room temperature is free floating.
</html>", revisions="<html>
<ul>
<li>
April 30, 2021, by Michael Wetter:<br/>
Reformulated replaceable class to avoid access of components that are not in the constraining type.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2471\">issue #2471</a>.
</li>
<li>
July 29, 2016, by Michael Wetter:<br/>
Added missing parameter declarations.
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ model Case950FF
18*3600, -1703.16/3600;
24*3600, -1703.16/3600])
"Ventilation air flow rate"
annotation (Placement(transformation(extent={{-88,-68},{-80,-60}})));
annotation (Placement(transformation(extent={{-94,-60},{-86,-52}})));
equation
connect(multiSum.u[2],vent.y[1]) annotation (Line(
points={{-72,-44},{-76,-44},{-76,-64},{-79.6,-64}},
points={{-78,-74},{-82,-74},{-82,-56},{-85.2,-56}},
color={0,0,127},
smooth=Smooth.None));

Expand All @@ -34,6 +34,17 @@ heating and no cooling.
</html>", revisions="<html>
<ul>
<li>
April 30, 2021, by Michael Wetter:<br/>
Reformulated replaceable class to avoid access of components that are not in the constraining type.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2471\">issue #2471</a>.
</li>
<li>
April 30, 2021, by Michael Wetter:<br/>
Added redeclaration to avoid access of component that is not in constraining type.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2471\">#2471</a>.
</li>
<li>
July 16, 2012, by Michael Wetter:<br/>
Revised implementation to extend from base case to avoid duplicate code.
Merged model into the Buildings library.
Expand Down

0 comments on commit 0d56d83

Please sign in to comment.