Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyad-pnnl committed Feb 15, 2024
2 parents eacda5a + 6716d8d commit a9d8574
Show file tree
Hide file tree
Showing 120 changed files with 1,616 additions and 1,376 deletions.
18 changes: 13 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ env:
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.Templates\""
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.Templates\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.Templates\""
- TEST_ARG="make test-templates-optimica"
- TEST_ARG="make test-templates-dymola"

before_install:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- if [[ "$TEST_ARG" == *test-dymola* || "$TEST_ARG" == *test-bestest* || "$TEST_ARG" == *spawn-portability* ]]; then
- if [[ "$TEST_ARG" == *test-dymola* || "$TEST_ARG" == *test-templates-dymola* || "$TEST_ARG" == *test-bestest* || "$TEST_ARG" == *spawn-portability* ]]; then
docker pull "$DOCKER_REPONAME"/${DYMOLA_VERSION};
cp Buildings/Resources/Scripts/travis/dymola/dymola $HOME/bin/;
fi;
- if [[ "$TEST_ARG" == *test-optimica* ]]; then
- if [[ "$TEST_ARG" == *test-optimica* || "$TEST_ARG" == *test-templates-optimica* ]]; then
docker pull "$DOCKER_REPONAME"/${OPTIMICA_VERSION};
cp Buildings/Resources/Scripts/travis/optimica/jm_ipython.sh $HOME/bin/jm_ipython.sh;
fi;
Expand All @@ -144,7 +146,7 @@ before_install:
cd -;
echo "Installed modelica-json in ${MODELICA_JSON_HOME}";
fi;
- if [[ "$TEST_ARG" == *test-openmodelica* ]]; then
- if [[ "$TEST_ARG" == *test-openmodelica* || "$TEST_ARG" == *test-templates-openmodelica* ]]; then
docker pull lbnlblum/${OMC_VERSION};
cp Buildings/Resources/Scripts/travis/omc/omc $HOME/bin/omc;
fi;
Expand All @@ -158,7 +160,7 @@ install:
- pip3 install --upgrade pip wheel
- pip3 install --only-binary=numpy,scipy,matplotlib numpy==1.21.4 scipy==1.7.3 matplotlib==3.5.1
- pip3 install git+https://github.com/lbl-srg/${BUILDINGSPY_VERSION}
- if [[ "$TEST_ARG" == *test-energyplus* ]]; then
- if [[ "$TEST_ARG" == *test-energyplus* ]] || [[ "$TEST_ARG" == *test-templates* ]]; then
export ENERGYPLUS_9_6_0=${ENERGYPLUS_9_6_0};
export ENERGYPLUS_23_1_0=${ENERGYPLUS_23_1_0};
pip3 install pandas==1.3.5;
Expand All @@ -175,7 +177,13 @@ install:

# Execute tests
script:
- (cd Buildings/Resources/Scripts/travis && travis_wait 90 $TEST_ARG)
- |
TRAVIS_WAIT=90
if [[ "$TEST_ARG" == *test-templates* ]]; then
TRAVIS_WAIT=180
fi
(cd Buildings/Resources/Scripts/travis && travis_wait $TRAVIS_WAIT $TEST_ARG)
after_failure:
- |
Expand Down
3 changes: 3 additions & 0 deletions Buildings/.copiedFiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,7 @@ Buildings/Fluid/Sensors/EntropyFlowRate.mo
Buildings/Fluid/Sensors/Examples/Density.mo
Buildings/Fluid/Sensors/Examples/EnthalpyFlowRate.mo
Buildings/Fluid/Sensors/Examples/EntropyFlowRate.mo
Buildings/Fluid/Sensors/Examples/HeatMeter.mo
Buildings/Fluid/Sensors/Examples/MassFraction.mo
Buildings/Fluid/Sensors/Examples/MoistAirEnthalpyFlowRate.mo
Buildings/Fluid/Sensors/Examples/PPM.mo
Expand All @@ -1696,6 +1697,7 @@ Buildings/Fluid/Sensors/Examples/Velocity.mo
Buildings/Fluid/Sensors/Examples/VolumeFlowRate.mo
Buildings/Fluid/Sensors/Examples/package.mo
Buildings/Fluid/Sensors/Examples/package.order
Buildings/Fluid/Sensors/HeatMeter.mo
Buildings/Fluid/Sensors/LatentEnthalpyFlowRate.mo
Buildings/Fluid/Sensors/MassFlowRate.mo
Buildings/Fluid/Sensors/MassFraction.mo
Expand Down Expand Up @@ -2690,6 +2692,7 @@ Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Conversions/Examples/To_VolumeF
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/Density.mos
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/EnthalpyFlowRate.mos
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/EntropyFlowRate.mos
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/HeatMeter.mos
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/MassFraction.mos
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/MoistAirEnthalpyFlowRate.mos
Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/PPM.mos
Expand Down
2 changes: 1 addition & 1 deletion Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ model SimpleHouse0
parameter Modelica.Units.SI.Density rhoWall = 2000 "Wall density";
parameter Modelica.Units.SI.SpecificHeatCapacity cpWall = 1000 "Wall specific heat capacity";
Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
ModelicaServices.ExternalReferences.loadResource(
Modelica.Utilities.Files.loadResource(
"modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"))
"Weather data reader"
annotation (Placement(transformation(extent={{-180,-10},{-160,10}})));
Expand Down
13 changes: 9 additions & 4 deletions Buildings/Fluid/FMI/Conversion/AirToOutlet.mo
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ block AirToOutlet
if allowFlowReversal
"Temperature of the backward flowing medium in the connector outlet"
annotation (Placement(
visible=allowFloWReserval,
visible=allowFlowReversal,
transformation(extent={{20,20},{-20,-20}},
rotation=90,
origin={-60,-120}),
Expand All @@ -61,7 +61,7 @@ block AirToOutlet
if Medium.nXi > 0 and allowFlowReversal
"Water mass fraction per total air mass of the backward flowing medium in the connector outlet"
annotation (Placement(
visible=allowFloWReserval,
visible=allowFlowReversal,
transformation(extent={{20,20},{-20,-20}},
rotation=90,
origin={0,-120}),
Expand All @@ -74,7 +74,7 @@ block AirToOutlet
if allowFlowReversal
"Trace substances of the backward flowing medium in the connector outlet"
annotation (Placement(
visible=allowFloWReserval,
visible=allowFlowReversal,
transformation(extent={{20,20},{-20,-20}},
rotation=90,
origin={60,-120}),
Expand All @@ -93,7 +93,7 @@ protected
"Internal connector for water vapor concentration in kg/kg total air";

// Conditional connectors for the backward flowing medium
Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal(
output Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal(
redeclare final package Medium = Medium)
"Internal connector for fluid properties for back flow";

Expand Down Expand Up @@ -174,6 +174,11 @@ for its usage.
</html>", revisions="<html>
<ul>
<li>
February 1, 2024, by Michael Wetter:<br/>
Added causality.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1829\">#1829</a>.
</li>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice to moist air only.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
Expand Down
13 changes: 9 additions & 4 deletions Buildings/Fluid/FMI/Conversion/InletToAir.mo
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ block InletToAir
if allowFlowReversal
"Zone air temperature"
annotation (Placement(
visible=allowFloWReserval,
visible=allowFlowReversal,
transformation(extent={{-20,-20},{20,20}},
rotation=90,
origin={-60,-120}),
Expand All @@ -37,7 +37,7 @@ block InletToAir
if Medium.nXi > 0 and allowFlowReversal
"Zone air water mass fraction per total air mass"
annotation (Placement(
visible=allowFloWReserval,
visible=allowFlowReversal,
transformation(extent={{-20,-20},{20,20}},
rotation=90,
origin={0,-120}),
Expand All @@ -50,7 +50,7 @@ block InletToAir
if allowFlowReversal
"Zone air trace substances"
annotation (Placement(
visible=allowFloWReserval,
visible=allowFlowReversal,
transformation(extent={{-20,-20},{20,20}},
rotation=90,
origin={60,-120}),
Expand All @@ -77,7 +77,7 @@ block InletToAir
annotation (Placement(transformation(extent={{100,-100},{140,-60}})));

protected
Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal(
input Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal(
redeclare final package Medium = Medium)
"Internal connector for fluid properties for back flow";

Expand Down Expand Up @@ -172,6 +172,11 @@ for its usage.
</html>", revisions="<html>
<ul>
<li>
February 1, 2024, by Michael Wetter:<br/>
Added causality.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1829\">#1829</a>.
</li>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice to moist air only.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
Expand Down
2 changes: 1 addition & 1 deletion Buildings/Fluid/Movers/Data/Generic.mo
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ record Generic "Generic data record for movers"
parameter Boolean motorCooledByFluid=true
"If true, then motor heat is added to fluid stream"
annotation(Dialog(group="Motor heat rejection"));
parameter Modelica.Units.SI.Power WMot_nominal(final displayUnit="W")=
parameter Modelica.Units.SI.Power WMot_nominal=
if max(power.P)>Modelica.Constants.eps
then
if powerOrEfficiencyIsHydraulic
Expand Down
2 changes: 1 addition & 1 deletion Buildings/Fluid/Movers/FlowControlled_dp.mo
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ model FlowControlled_dp

Modelica.Blocks.Interfaces.RealInput dpMea(
final quantity="PressureDifference",
final displayUnit="Pa",
displayUnit="Pa",
final unit="Pa")=gain.u if prescribeSystemPressure
"Measurement of pressure difference between two points where the set point should be obtained"
annotation (Placement(transformation(
Expand Down
77 changes: 77 additions & 0 deletions Buildings/Fluid/Sensors/Examples/HeatMeter.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
within Buildings.Fluid.Sensors.Examples;
model HeatMeter
extends Modelica.Icons.Example;

package Medium = Buildings.Media.Water
"Medium model";

parameter Modelica.Units.SI.MassFlowRate m_flow_nominal = 10 "Nominal mass flow rate";

Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
m_flow=m_flow_nominal,
nPorts=1) "Mass flow source"
annotation (Placement(transformation(extent={{-70,-10},{-50,10}})));
Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1)
"Sink"
annotation (Placement(transformation(extent={{70,-10},{50,10}})));
Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow heaFloRat(Q_flow=
m_flow_nominal*10*4200) "Heat flow rate"
annotation (Placement(transformation(extent={{-50,30},{-30,50}})));
MixingVolumes.MixingVolume vol(
redeclare package Medium = Medium,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
m_flow_nominal=m_flow_nominal,
V=0.1,
nPorts=2)
"Mixing volume"
annotation (Placement(transformation(extent={{-10,30},{10,50}})));
TemperatureTwoPort senT(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal)
annotation (Placement(transformation(extent={{-30,-10},{-10,10}})));
Buildings.Fluid.Sensors.HeatMeter senHeaFlo(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal)
annotation (Placement(transformation(extent={{10,-10},{30,10}})));
equation
connect(sou.ports[1], senT.port_a)
annotation (Line(points={{-50,0},{-30,0}}, color={0,127,255}));
connect(senT.port_b, vol.ports[1]) annotation (Line(points={{-10,0},{-2,0},{
-2,30},{-1,30}}, color={0,127,255}));
connect(vol.ports[2], senHeaFlo.port_a) annotation (Line(points={{1,30},{2,30},
{2,0},{10,0}}, color={0,127,255}));
connect(senHeaFlo.port_b, sin.ports[1])
annotation (Line(points={{30,0},{50,0}}, color={0,127,255}));
connect(senT.T, senHeaFlo.TExt) annotation (Line(points={{-20,11},{-20,18},{
-6,18},{-6,6},{8,6}}, color={0,0,127}));
connect(heaFloRat.port, vol.heatPort)
annotation (Line(points={{-30,40},{-10,40}}, color={191,0,0}));
annotation (
experiment(Tolerance=1e-6, StopTime=60),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/HeatMeter.mos"
"Simulate and plot"),
Documentation(info="<html>
<p>
This example tests the heat meter sensor for the situation where heat is exchanged with a control volume.
</p>
</html>",
revisions="<html>
<ul>
<li>
February 1, 2024, by Michael Wetter:<br/>
Revised implementation.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1831\">IBPSA, #1831</a>.
</li>
<li>
February 1, 2024, by Jan Gall:<br/>
First implementation.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1831\">IBPSA, #1831</a>.
</li>
</ul>
</html>"));
end HeatMeter;
59 changes: 39 additions & 20 deletions Buildings/Fluid/Sensors/Examples/PPM.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ model PPM "Test model for the extra property sensor outputting PPM"
package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"})
"Medium model";

parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=volDyn.V*
senPPMTwoPort.tau*3*rho_default
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=
volDyn.V*senPPMTwoPort.tau*3*rho_default
"Mass flow rate into and out of the volume";

Buildings.Fluid.MixingVolumes.MixingVolume volDyn(
Expand All @@ -20,7 +20,7 @@ model PPM "Test model for the extra property sensor outputting PPM"
redeclare package Medium = Medium,
nPorts=2,
m_flow=m_flow_nominal) "Fresh air supply"
annotation (Placement(transformation(extent={{-40,30},{-20,50}})));
annotation (Placement(transformation(origin = {-28, 0}, extent = {{-40, 30}, {-20, 50}})));

Buildings.Fluid.Sensors.PPM senPPMVol(
redeclare package Medium = Medium,
Expand Down Expand Up @@ -82,32 +82,44 @@ model PPM "Test model for the extra property sensor outputting PPM"
redeclare package Medium = Medium,
nPorts=1,
m_flow=m_flow_nominal) "Fresh air supply for steady state volume"
annotation (Placement(transformation(extent={{-40,110},{-20,130}})));
annotation (Placement(transformation(origin = {-28, 0}, extent = {{-40, 110}, {-20, 130}})));
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=2) "Exhaust air"
annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
annotation (Placement(transformation(origin = {-30, 0}, extent = {{-40, -60}, {-20, -40}})));

Buildings.Fluid.FixedResistances.PressureDrop dp(
redeclare package Medium = Medium,
dp_nominal = 200,
m_flow_nominal = m_flow_nominal)
"Pressure drop to decouple volume pressure from boundary pressure"
annotation (
Placement(transformation(origin = {-28, -50}, extent = {{-2, -10}, {18, 10}})));

protected
final parameter Medium.ThermodynamicState state_default = Medium.setState_pTX(
T=Medium.T_default,
p=Medium.p_default,
X=Medium.X_default[1:Medium.nXi]) "Medium state at default values";
X=Medium.X_default[1:Medium.nXi]) "Medium state at default values"
annotation(Evaluate=true);
// Density at medium default values, used to compute the size of control volumes
final parameter Modelica.Units.SI.Density rho_default=Medium.density(state=
state_default) "Density, used to compute fluid mass";
final parameter Modelica.Units.SI.Density rho_default=Medium.density(
state=state_default)
"Density, used to compute fluid mass"
annotation(Evaluate=true);

equation
connect(mSou.ports[1], volDyn.ports[1]) annotation (Line(points={{-20,42},{
77.3333,42},{77.3333,50}}, color={0,127,255}));
connect(mSou.ports[1], volDyn.ports[1]) annotation (Line(points={{-48,39},{
-48,50},{78.6667,50}},
color={0,127,255}));
connect(CO2In.y, volDyn.C_flow[1]) annotation (Line(points={{21,70},{32,70},{32,
54},{68,54}}, color={0,0,127}));
connect(senPPMVol.port, volDyn.ports[2]) annotation (Line(points={{130,40},{80,
40},{80,50}}, color={0,127,255}));
40},{80,50}},color={0,127,255}));
connect(senPPMIn.port, mSou.ports[2])
annotation (Line(points={{-10,80},{-10,38},{-20,38}}, color={0,127,255}));
annotation (Line(points={{-10,80},{-10,41},{-48,41}}, color={0,127,255}));
connect(senPPMTwoPort.port_a, volDyn.ports[3]) annotation (Line(points={{80,20},
{80,50},{82.6667,50}}, color={0,127,255}));
{80,50},{81.3333,50}}, color={0,127,255}));
connect(senPPMNoRev.port_a, senPPMTwoPort.port_b)
annotation (Line(points={{80,-20},{80,0}}, color={0,127,255}));
connect(senPPMRev.port_b, senPPMNoRev.port_b) annotation (Line(points={{60,-50},
Expand All @@ -116,15 +128,17 @@ equation
annotation (Line(points={{20,-50},{30,-50},{40,-50}}, color={0,127,255}));
connect(CO2In.y,volSte. C_flow[1]) annotation (Line(points={{21,70},{32,70},{32,
84},{68,84}}, color={0,0,127}));
connect(volSte.ports[1], senPPMVol2.port) annotation (Line(points={{77.3333,
connect(volSte.ports[1], senPPMVol2.port) annotation (Line(points={{78.6667,
80},{130,80}}, color={0,127,255}));
connect(mSouSta.ports[1], volSte.ports[2]) annotation (Line(points={{-20,120},
connect(mSouSta.ports[1], volSte.ports[2]) annotation (Line(points={{-48,120},
{54,120},{54,80},{80,80}}, color={0,127,255}));
connect(sin.ports[1], senPPMSta.port_b) annotation (Line(points={{-20,-48},{-10,
-48},{-10,-50},{0,-50}}, color={0,127,255}));
connect(sin.ports[2], volSte.ports[3]) annotation (Line(points={{-20,-52},{
-20,-80},{110,-80},{110,80},{82.6667,80}},
color={0,127,255}));
connect(sin.ports[1], volSte.ports[3]) annotation (
Line(points={{-50,-51},{-50,-80},{110,-80},{110,80},{81.3333,80}}, color = {0, 127, 255}));
connect(dp.port_b, senPPMSta.port_b) annotation (
Line(points = {{-10, -50}, {0, -50}}, color = {0, 127, 255}));
connect(dp.port_a, sin.ports[2]) annotation (
Line(points={{-30,-50},{-40,-50},{-40,-49},{-50,-49}},
color = {0, 127, 255}));
annotation (
experiment(Tolerance=1e-6, StopTime=3),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Fluid/Sensors/Examples/PPM.mos"
Expand All @@ -142,6 +156,11 @@ and with or without dynamics are tested.
revisions="<html>
<ul>
<li>
February 1, 2024, by Michael Wetter:<br/>
Added pressure drop to avoid redundant initial conditions for pressure of control volume.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1830\"> #1830</a>.
</li>
<li>
May 2, 2019, by Jianjun Hu:<br/>
Replaced fluid source. This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1072\"> #1072</a>.
Expand Down
1 change: 1 addition & 0 deletions Buildings/Fluid/Sensors/Examples/package.order
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Density
EnthalpyFlowRate
EntropyFlowRate
HeatMeter
MassFraction
MoistAirEnthalpyFlowRate
PPM
Expand Down
Loading

0 comments on commit a9d8574

Please sign in to comment.