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

Added check for air pressure to be within reasonable limits #3320

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
16 changes: 12 additions & 4 deletions Buildings/Resources/Scripts/BuildingsPy/conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
optimica:
comment: 'The system is structurally singular. Modelon #2023012739000252'
translate: false
- model_name: Buildings.DHC.Loads.BaseClasses.Examples.CouplingSpawnZ1
openmodelica:
comment: Internal error BackendDAECreate due to when equation not handled
translate: false
- model_name: Buildings.DHC.Loads.BaseClasses.Examples.CouplingSpawnZ6
openmodelica:
comment: Internal error BackendDAECreate due to when equation not handled
translate: false
- model_name: Buildings.DHC.Loads.BaseClasses.Examples.CouplingTimeSeries
openmodelica:
comment: simulation terminated by an assertion at initialization.
Expand Down Expand Up @@ -104,7 +112,7 @@
dymola:
time_out: 600
openmodelica:
comment: 'Simulation works locally, see https://github.com/lbl-srg/modelica-buildings/issues/3910'
comment: Simulation works locally, see https://github.com/lbl-srg/modelica-buildings/issues/3910
translate: false
optimica:
time_out: 600
Expand Down Expand Up @@ -452,21 +460,21 @@
time_out: 600
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.Validation.FMUZoneAdapterZones1
openmodelica:
comment: "Could not load the FMU binary: libc.so.6: version `GLIBC_2.34' not found"
comment: 'Could not load the FMU binary: libc.so.6: version `GLIBC_2.34'' not found'
simulate: false
dymola:
comment: Requires docker update to Ubuntu 22.04 due to libgc.
simulate: false
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.Validation.FMUZoneAdapterZones2
openmodelica:
comment: "Could not load the FMU binary: libc.so.6: version `GLIBC_2.34' not found"
comment: 'Could not load the FMU binary: libc.so.6: version `GLIBC_2.34'' not found'
simulate: false
dymola:
comment: Requires docker update to Ubuntu 22.04 due to libgc.
simulate: false
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.Validation.FMUZoneAdapterZones3
openmodelica:
comment: "Could not load the FMU binary: libc.so.6: version `GLIBC_2.34' not found"
comment: 'Could not load the FMU binary: libc.so.6: version `GLIBC_2.34'' not found'
simulate: false
dymola:
comment: Requires docker update to Ubuntu 22.04 due to libgc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,32 @@ model ThermalZoneAdapter
final unit="K",
displayUnit="degC")
"Zone air temperature"
annotation (Placement(transformation(extent={{-140,60},{-100,100}}),iconTransformation(extent={{-140,60},{-100,100}})));
annotation (Placement(transformation(extent={{-140,80},{-100,120}}),iconTransformation(extent={{-140,80},
{-100,120}})));
Modelica.Blocks.Interfaces.RealInput X_w(
final unit="kg/kg")
"Zone air mass fraction in kg/kg total air"
annotation (Placement(transformation(extent={{-140,20},{-100,60}}),iconTransformation(extent={{-140,20},{-100,60}})));
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),iconTransformation(extent={{-140,40},
{-100,80}})));
Modelica.Blocks.Interfaces.RealInput m_flow[nFluPor](
each final unit="kg/s")
"Mass flow rate"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
annotation (Placement(transformation(extent={{-140,0},{-100,40}}),
iconTransformation(extent={{-140,0},{-100,40}})));
Modelica.Blocks.Interfaces.RealInput TInlet[nFluPor](
each final unit="K",
each displayUnit="degC")
"Air inlet temperatures"
annotation (Placement(transformation(extent={{-140,-60},{-100,-20}})));
each displayUnit="degC") "Air inlet temperatures"
annotation (Placement(transformation(extent={{-140,-40},{-100,0}}),
iconTransformation(extent={{-140,-40},{-100,0}})));
Modelica.Blocks.Interfaces.RealInput p(
final unit="Pa",
displayUnit="bar") "Air pressure" annotation (Placement(transformation(extent={{-140,
-80},{-100,-40}}), iconTransformation(extent={{-140,-80},{-100,-40}})));
Modelica.Blocks.Interfaces.RealInput QGaiRad_flow(
final unit="W")
"Radiative heat gain"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}}),iconTransformation(extent={{-140,-100},{-100,-60}})));
annotation (Placement(transformation(extent={{-140,-120},{-100,-80}}),iconTransformation(extent={{-140,
-120},{-100,-80}})));
Modelica.Blocks.Interfaces.RealOutput TRad(
final unit="K",
displayUnit="degC")
Expand All @@ -87,6 +95,10 @@ model ThermalZoneAdapter
annotation (Placement(transformation(extent={{100,-70},{120,-50}}),iconTransformation(extent={{100,-70},{120,-50}})));

protected
constant Modelica.Units.SI.AbsolutePressure pMin = 30E3
"Minimum allowed pressure; this is below the pressure on 8000 m, and hence certainly a modeling error";
constant Modelica.Units.SI.AbsolutePressure pMax = 110E3
"Maximum allowed pressure; this is higher than the maximum pressure measured in an anti-cyclone, and hence certainly a modeling error";
constant Integer nParOut=3
"Number of parameter values retrieved from EnergyPlus";
constant Integer nInp=5
Expand Down Expand Up @@ -256,6 +268,18 @@ equation

// Synchronization with EnergyPlus
when {time >= pre(tNext)} then
// The assertions below are inside an if-clause to work around an issue in OPTIMICA,
// see https://github.com/lbl-srg/modelica-buildings/issues/3319#issuecomment-1494960744
if (p >= pMax or p <= pMin) then
// Monitor pressure to catch cases where a user may forget to add a flow path for exhaust air
assert(p < pMax,
"In " + getInstanceName() + ": Air pressure is above physically reasonable limit.
Require " + String(pMin) + " < p < " + String(pMax) + ", but p = " + String(p) + " Pa. Model seems to have fresh air supply but no exhaust air or exfiltration.");
assert(p > pMin,
"In " + getInstanceName() + ": Air pressure is below physically reasonable limit.
Require " + String(pMin) + " < p < " + String(pMax) + ", but p = " + String(p) + " Pa. Model seems to have exhaust air but no supply air or infiltration.");
end if;

// Initialization of output variables.
TRooLast=T;
dtLast=time-pre(tLast);
Expand Down Expand Up @@ -314,6 +338,12 @@ of its class <code>adapter</code>, of EnergyPlus.
revisions="<html>
<ul>
<li>
June 10, 2024, by Michael Wetter:<br/>
Added check for air pressure to be within reasonable limits.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3319\">#3319</a>.
</li>
<li>
March 22, 2024, by Michael Wetter:<br/>
Changed radiative heat flow rate sent to EnergyPlus to be the average over the last
synchronization time step rather than the instantaneuous value, and set the initial value to zero.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ model FMUZoneAdapterZones1
Modelica.Blocks.Sources.RealExpression mIn_flow(
y=0)
"Inlet mass flow rate"
annotation (Placement(transformation(extent={{-90,0},{-70,20}})));
annotation (Placement(visible = true, transformation( extent={{-90,0},
{-70,20}}, rotation = 0)));
Modelica.Blocks.Math.Gain mOut_flow(
k=-1)
"Outlet mass flow rate"
annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
annotation (Placement(visible = true, transformation(origin = {0, 0}, extent = {{-40, 20}, {-20, 40}}, rotation = 0)));
Modelica.Blocks.Sources.RealExpression TIn[2](
each y=293.15)
"Inlet temperature"
annotation (Placement(transformation(extent={{-90,-28},{-70,-8}})));
each y=293.15) "Inlet temperature"
annotation (Placement(visible = true, transformation(origin={0,-22}, extent = {{-90, -28}, {-70, -8}}, rotation = 0)));
Modelica.Blocks.Sources.RealExpression QGaiRad_flow(
y=0)
"Radiative heat gain for the zone"
annotation (Placement(transformation(extent={{-88,-50},{-68,-30}})));
annotation (Placement(visible = true, transformation(origin={-2,-20}, extent = {{-88, -50}, {-68, -30}}, rotation = 0)));
Modelica.Blocks.Continuous.Integrator TZonCor(
k=1/CZon,
initType=Modelica.Blocks.Types.Init.InitialState,
Expand All @@ -60,25 +60,30 @@ model FMUZoneAdapterZones1
"Zone air temperature"
annotation (Placement(transformation(extent={{60,20},{80,40}})));

Modelica.Blocks.Sources.RealExpression p(y=101325) "Fluid pressure"
annotation (Placement(visible=true, transformation(extent={{-90,-30},{-70,
-10}}, rotation=0)));
equation
connect(X_w.y,fmuZonCor.X_w)
annotation (Line(points={{-69,50},{0,50},{0,34},{18,34}},color={0,0,127}));
annotation (Line(points={{-69,50},{0,50},{0,36},{18,36}},color={0,0,127}));
connect(fmuZonCor.m_flow[1],mIn_flow.y)
annotation (Line(points={{18,29.5},{-4,29.5},{-4,10},{-69,10}},
color={0,0,127}));
annotation (Line(points={{18,31.5},{2,31.5},{2,10},{-69,10}},
color={0,0,127}, pattern = LinePattern.Solid));
connect(mOut_flow.u,mIn_flow.y)
annotation (Line(points={{-42,30},{-60,30},{-60,10},{-69,10}},color={0,0,127}));
annotation (Line(points={{-42,30},{-60,30},{-60,10},{-69,10}}, color={0,0,127}, pattern = LinePattern.Solid));
connect(mOut_flow.y,fmuZonCor.m_flow[2])
annotation (Line(points={{-19,30},{-10,30},{-10,30.5},{18,30.5}},
color={0,0,127}));
annotation (Line(points={{-19,30},{0.5,30},{0.5,32.5},{18,32.5}},
color={0,0,127}, pattern = LinePattern.Solid));
connect(TIn.y,fmuZonCor.TInlet)
annotation (Line(points={{-69,-18},{6,-18},{6,26},{18,26}},color={0,0,127}));
annotation (Line(points={{-69,-40},{6,-40},{6,28},{18,28}}, color={0,0,127}, pattern = LinePattern.Solid));
connect(fmuZonCor.QGaiRad_flow,QGaiRad_flow.y)
annotation (Line(points={{18,22},{10,22},{10,-40},{-67,-40}},color={0,0,127}));
annotation (Line(points={{18,20},{10,20},{10,-60},{-69,-60}}, color={0,0,127}, pattern = LinePattern.Solid));
connect(TZonCor.y,fmuZonCor.T)
annotation (Line(points={{81,30},{88,30},{88,60},{8,60},{8,38},{18,38}},color={0,0,127}));
annotation (Line(points={{81,30},{88,30},{88,60},{8,60},{8,40},{18,40}},color={0,0,127}));
connect(fmuZonCor.QCon_flow,TZonCor.u)
annotation (Line(points={{41,32},{48,32},{48,30},{58,30}},color={0,0,127}));
connect(p.y, fmuZonCor.p) annotation (Line(points={{-69,-20},{8,-20},{8,24},{
18,24}}, color={0,0,127}));
annotation (
Documentation(
info="<html>
Expand All @@ -94,6 +99,12 @@ for Linux 64 bit by JModelica.
revisions="<html>
<ul>
<li>
March 30, 2023, by Michael Wetter:<br/>
Added check for air pressure to be within reasonable limits.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3319\">#3319</a>.
</li>
<li>
March 23, 2022, by Michael Wetter:<br/>
Changed model to use the instance name of the <code>building</code> instance as is done for the other Spawn models.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ model FMUZoneAdapterZones2
Modelica.Blocks.Sources.RealExpression TIn[2](
each y=293.15)
"Inlet temperature"
annotation (Placement(transformation(extent={{-88,-24},{-68,-4}})));
annotation (Placement(transformation(extent={{-88,-50},{-68,-30}})));
Modelica.Blocks.Sources.RealExpression QGaiRad_flow(
y=0)
"Radiative heat gain for the zone"
annotation (Placement(transformation(extent={{-88,-46},{-68,-26}})));
annotation (Placement(transformation(extent={{-88,-72},{-68,-52}})));
Modelica.Blocks.Continuous.Integrator TZonCor(
k=1/CZon,
initType=Modelica.Blocks.Types.Init.InitialState,
Expand Down Expand Up @@ -85,41 +85,49 @@ model FMUZoneAdapterZones2
"Zone air temperature"
annotation (Placement(transformation(extent={{60,-20},{80,0}})));

Modelica.Blocks.Sources.RealExpression p(y=101325) "Fluid pressure"
annotation (Placement(visible=true, transformation(extent={{-88,-30},{-68,
-10}}, rotation=0)));
equation
connect(X_w.y,fmuZonCor.X_w)
annotation (Line(points={{-67,54},{-16,54},{-16,34},{18,34}},color={0,0,127}));
annotation (Line(points={{-67,54},{-16,54},{-16,36},{18,36}},color={0,0,127}));
connect(fmuZonCor.m_flow[1],mIn_flow.y)
annotation (Line(points={{18,29.5},{-6,29.5},{-6,10},{-67,10}},
annotation (Line(points={{18,31.5},{-6,31.5},{-6,10},{-67,10}},
color={0,0,127}));
connect(mOut_flow.u,mIn_flow.y)
annotation (Line(points={{-52,30},{-60,30},{-60,10},{-67,10}},color={0,0,127}));
connect(mOut_flow.y,fmuZonCor.m_flow[2])
annotation (Line(points={{-29,30},{-10,30},{-10,30.5},{18,30.5}},
annotation (Line(points={{-29,30},{-10,30},{-10,32.5},{18,32.5}},
color={0,0,127}));
connect(TIn.y,fmuZonCor.TInlet)
annotation (Line(points={{-67,-14},{-4,-14},{-4,26},{18,26}},color={0,0,127}));
annotation (Line(points={{-67,-40},{-4,-40},{-4,28},{18,28}},color={0,0,127}));
connect(fmuZonCor.QGaiRad_flow,QGaiRad_flow.y)
annotation (Line(points={{18,22},{0,22},{0,-36},{-67,-36}},color={0,0,127}));
annotation (Line(points={{18,20},{0,20},{0,-62},{-67,-62}},color={0,0,127}));
connect(X_w.y,fmuZonSou.X_w)
annotation (Line(points={{-67,54},{-16,54},{-16,-6},{18,-6}},color={0,0,127}));
annotation (Line(points={{-67,54},{-16,54},{-16,-4},{18,-4}},color={0,0,127}));
connect(fmuZonSou.m_flow[1],mIn_flow.y)
annotation (Line(points={{18,-10.5},{-20,-10.5},{-20,10},{-67,10}},
annotation (Line(points={{18,-8.5},{-20,-8.5},{-20,10},{-67,10}},
color={0,0,127}));
connect(mOut_flow.y,fmuZonSou.m_flow[2])
annotation (Line(points={{-29,30},{-10,30},{-10,-9.5},{18,-9.5}},
annotation (Line(points={{-29,30},{-10,30},{-10,-7.5},{18,-7.5}},
color={0,0,127}));
connect(TIn.y,fmuZonSou.TInlet)
annotation (Line(points={{-67,-14},{18,-14}},color={0,0,127}));
annotation (Line(points={{-67,-40},{-24,-40},{-24,-12},{18,-12}},
color={0,0,127}));
connect(fmuZonSou.QGaiRad_flow,QGaiRad_flow.y)
annotation (Line(points={{18,-18},{0,-18},{0,-36},{-67,-36}},color={0,0,127}));
annotation (Line(points={{18,-20},{0,-20},{0,-62},{-67,-62}},color={0,0,127}));
connect(TZonCor.y,fmuZonCor.T)
annotation (Line(points={{81,30},{88,30},{88,50},{10,50},{10,38},{18,38}},color={0,0,127}));
annotation (Line(points={{81,30},{88,30},{88,50},{10,50},{10,40},{18,40}},color={0,0,127}));
connect(fmuZonCor.QCon_flow,TZonCor.u)
annotation (Line(points={{41,32},{50,32},{50,30},{58,30}},color={0,0,127}));
connect(fmuZonSou.QCon_flow,TZonSou.u)
annotation (Line(points={{41,-8},{50,-8},{50,-10},{58,-10}},color={0,0,127}));
connect(TZonSou.y,fmuZonSou.T)
annotation (Line(points={{81,-10},{86,-10},{86,12},{10,12},{10,-2},{18,-2}},color={0,0,127}));
annotation (Line(points={{81,-10},{86,-10},{86,12},{10,12},{10,0},{18,0}}, color={0,0,127}));
connect(p.y, fmuZonCor.p) annotation (Line(points={{-67,-20},{-26,-20},{-26,
24},{18,24}}, color={0,0,127}));
connect(p.y, fmuZonSou.p) annotation (Line(points={{-67,-20},{-26,-20},{-26,
-16},{18,-16}}, color={0,0,127}));
annotation (
Documentation(
info="<html>
Expand All @@ -135,6 +143,12 @@ for Linux 64 bit by JModelica.
revisions="<html>
<ul>
<li>
March 30, 2023, by Michael Wetter:<br/>
Added check for air pressure to be within reasonable limits.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3319\">#3319</a>.
</li>
<li>
March 23, 2022, by Michael Wetter:<br/>
Changed model to use the instance name of the <code>building</code> instance as is done for the other Spawn models.
</li>
Expand Down
Loading
Loading