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

Issue1353 simple door #1442

Merged
merged 35 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b17ef04
Changed icon to distinguish it from new model [ci skip]
mwetter Oct 7, 2020
f54dd33
Started adding new door model
mwetter Oct 7, 2020
a68192e
Revised model, added validation
mwetter Oct 9, 2020
766909d
Added examples [ci skip]
mwetter Oct 9, 2020
2537a91
Added reference results
mwetter Oct 9, 2020
c3aac23
Exposed flow coefficient as it is used in CONTAM validation, added va…
mwetter Oct 9, 2020
691dc8c
Cleaned up files
mwetter Oct 12, 2020
c632ab2
Cleaned up files
mwetter Oct 12, 2020
e5edef6
Revised documentation
mwetter Oct 12, 2020
452316f
Updated documentation
mwetter Oct 12, 2020
f85b453
Added operable door
mwetter Oct 12, 2020
7d5c3df
Added operable door
mwetter Oct 12, 2020
48438d4
Added example, refactored implementation to compute v
mwetter Oct 13, 2020
ffde1ae
Rearranged parameters
mwetter Oct 13, 2020
64a3a2c
Added regression test
mwetter Oct 13, 2020
06f6b50
Updated documentation
mwetter Oct 13, 2020
5588499
Adapted stack effect in kT according to CONTAM documentation
kldjonge Dec 15, 2020
e9fdd97
Adapted Validation Case for door models
kldjonge Dec 15, 2020
f6433cb
Updated documentation
kldjonge Jan 19, 2021
1516754
Merge pull request #1438 from kldjonge/KDJ_simpleDoor
mwetter Jan 21, 2021
67cb5ec
Corrected formatting of info section and revised info section
mwetter Jan 21, 2021
0342a2f
Cleaned up implementation
mwetter Jan 21, 2021
1f196e6
Revised buyoancy driven flow
mwetter Jan 23, 2021
56fc870
Cleaned up code
mwetter Jan 23, 2021
abf1dbd
Cleaned up code
mwetter Jan 23, 2021
9d5c4da
Merge branch 'master' into issue1353_simpleDoor
mwetter Jan 23, 2021
daf51fd
Corrected html
mwetter Jan 23, 2021
6d7eec5
Cleaned up annotation
mwetter Jan 23, 2021
bcea122
Updated variable name
mwetter Jan 25, 2021
9d8a4dc
Updated variable name
mwetter Jan 25, 2021
46184ce
Revised documentation
mwetter Jan 25, 2021
096aa2a
fixed typo in comment for #1353
Mathadon Jan 25, 2021
482b241
Corrected plot command, increased tolerance for CVode
mwetter Jan 26, 2021
3e1960d
Removed algorithm annotation
mwetter Jan 26, 2021
cf7a6f0
Corrected tolerance
mwetter Jan 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions IBPSA/Airflow/Multizone/BaseClasses/Door.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
within IBPSA.Airflow.Multizone.BaseClasses;
partial model Door
"Partial door model for bi-directional flow"
extends IBPSA.Fluid.Interfaces.PartialFourPortInterface(
redeclare final package Medium1 = Medium,
redeclare final package Medium2 = Medium,
final allowFlowReversal1=true,
final allowFlowReversal2=true,
final m1_flow_nominal=10/3600*1.2,
final m2_flow_nominal=m1_flow_nominal,
final m1_flow_small=1E-4*abs(m1_flow_nominal),
final m2_flow_small=1E-4*abs(m2_flow_nominal));

replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium "Medium in the component"
annotation (choices(
choice(redeclare package Medium = IBPSA.Media.Air "Moist air")));

parameter Modelica.SIunits.Length wOpe=0.9 "Width of opening"
annotation (Dialog(group="Geometry"));
parameter Modelica.SIunits.Length hOpe=2.1 "Height of opening"
annotation (Dialog(group="Geometry"));

parameter Modelica.SIunits.PressureDifference dp_turbulent(
min=0,
displayUnit="Pa") = 0.01
"Pressure difference where laminar and turbulent flow relation coincide"
annotation(Dialog(tab="Advanced"));

Modelica.SIunits.VolumeFlowRate VAB_flow(nominal=0.001)
"Volume flow rate from A to B if positive";
Modelica.SIunits.VolumeFlowRate VBA_flow(nominal=0.001)
"Volume flow rate from B to A if positive";

input Modelica.SIunits.Velocity vAB(nominal=0.01) "Average velocity from A to B";
input Modelica.SIunits.Velocity vBA(nominal=0.01) "Average velocity from B to A";

protected
final parameter Modelica.SIunits.Area AOpe = wOpe*hOpe "Open aperture area";

constant Real conTP = IBPSA.Media.Air.dStp*Modelica.Media.IdealGases.Common.SingleGasesData.Air.R
"Conversion factor for converting temperature difference to pressure difference";

parameter Medium.ThermodynamicState sta_default=Medium.setState_pTX(
T=Medium.T_default,
p=Medium.p_default,
X=Medium.X_default);

parameter Modelica.SIunits.Density rho_default=Medium.density(sta_default)
"Density";

Modelica.SIunits.VolumeFlowRate VABp_flow(nominal=0.001)
"Volume flow rate from A to B if positive due to static pressure difference";
Modelica.SIunits.MassFlowRate mABt_flow(nominal=0.001)
"Mass flow rate from A to B if positive due to buoyancy";

equation
// Net flow rate
port_a1.m_flow = (rho_default * VABp_flow/2 + mABt_flow);
port_b2.m_flow = (rho_default * VABp_flow/2 - mABt_flow);

// Average velocity (using the whole orifice area)
VAB_flow = (max(port_a1.m_flow, 0) + max(port_b2.m_flow, 0))/rho_default;
VBA_flow = (max(port_a2.m_flow, 0) + max(port_b1.m_flow, 0))/rho_default;

// Energy balance (no storage, no heat loss/gain)
port_a1.h_outflow = inStream(port_b1.h_outflow);
port_b1.h_outflow = inStream(port_a1.h_outflow);
port_a2.h_outflow = inStream(port_b2.h_outflow);
port_b2.h_outflow = inStream(port_a2.h_outflow);

// Mass balance (no storage)
port_a1.m_flow = -port_b1.m_flow;
port_a2.m_flow = -port_b2.m_flow;

port_a1.Xi_outflow = inStream(port_b1.Xi_outflow);
port_b1.Xi_outflow = inStream(port_a1.Xi_outflow);
port_a2.Xi_outflow = inStream(port_b2.Xi_outflow);
port_b2.Xi_outflow = inStream(port_a2.Xi_outflow);

// Transport of trace substances
port_a1.C_outflow = inStream(port_b1.C_outflow);
port_b1.C_outflow = inStream(port_a1.C_outflow);
port_a2.C_outflow = inStream(port_b2.C_outflow);
port_b2.C_outflow = inStream(port_a2.C_outflow);

annotation (
Icon(graphics={
Rectangle(
extent={{-60,80},{60,-84}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={85,75,55},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-54,72},{56,-84}},
lineColor={0,0,0},
fillColor={215,215,215},
fillPattern=FillPattern.Solid),
Polygon(
points={{56,72},{-36,66},{-36,-90},{56,-84},{56,72}},
lineColor={0,0,0},
fillColor={95,95,95},
fillPattern=FillPattern.Solid),
Polygon(
points={{-30,-10},{-16,-8},{-16,-14},{-30,-16},{-30,-10}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,0},
fillPattern=FillPattern.Solid)}),
Documentation(info="<html>
<p>
This is a partial model for the bi-directional air flow through a door.
</p>
</html>",
revisions="<html>
<ul>
<li>
October 6, 2020, by Michael Wetter:<br/>
First implementation for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1353\">#1353</a>.
</li>
</ul>
</html>"));
end Door;
11 changes: 9 additions & 2 deletions IBPSA/Airflow/Multizone/BaseClasses/DoorDiscretized.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ partial model DoorDiscretized

parameter Integer nCom=10 "Number of compartments for the discretization";

parameter Modelica.SIunits.PressureDifference dp_turbulent(min=0) = 0.01
parameter Modelica.SIunits.PressureDifference dp_turbulent(
min=0,
displayUnit="Pa") = 0.01
"Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01";

Modelica.SIunits.PressureDifference dpAB[nCom](each nominal=1)
Expand Down Expand Up @@ -93,7 +95,12 @@ equation
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,0},
fillPattern=FillPattern.Solid)}),
fillPattern=FillPattern.Solid),
Line(points={{-54,48},{-36,48}}, color={0,0,0}),
Line(points={{-54,20},{-36,20}}, color={0,0,0}),
Line(points={{-54,-6},{-36,-6}}, color={0,0,0}),
Line(points={{-54,-58},{-36,-58}}, color={0,0,0}),
Line(points={{-54,-32},{-36,-32}}, color={0,0,0})}),
Documentation(info="<html>
<p>
This is a partial model for the bi-directional air flow through a door.
Expand Down
1 change: 1 addition & 0 deletions IBPSA/Airflow/Multizone/BaseClasses/package.order
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Door
DoorDiscretized
ErrorControl
PowerLawResistance
Expand Down
212 changes: 212 additions & 0 deletions IBPSA/Airflow/Multizone/DoorOpen.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
within IBPSA.Airflow.Multizone;
model DoorOpen
"Door model for bi-directional air flow between rooms"
extends IBPSA.Airflow.Multizone.BaseClasses.Door(
final vAB = VAB_flow/AOpe,
final vBA = VBA_flow/AOpe);

parameter Real CD=0.65 "Discharge coefficient"
annotation (Dialog(group="Orifice characteristics"));

parameter Real m = 0.5 "Flow coefficient"
annotation (Dialog(group="Orifice characteristics"));


protected
constant Real gamma(min=1) = 1.5
"Normalized flow rate where dphi(0)/dpi intersects phi(1)";
constant Real a = gamma
"Polynomial coefficient for regularized implementation of flow resistance";
parameter Real b = 1/8*m^2 - 3*gamma - 3/2*m + 35.0/8
"Polynomial coefficient for regularized implementation of flow resistance";
parameter Real c = -1/4*m^2 + 3*gamma + 5/2*m - 21.0/4
"Polynomial coefficient for regularized implementation of flow resistance";
parameter Real d = 1/8*m^2 - gamma - m + 15.0/8
"Polynomial coefficient for regularized implementation of flow resistance";

parameter Real kVal=CD*AOpe*sqrt(2/rho_default) "Flow coefficient, k = V_flow/ dp^m";
parameter Real kT = rho_default * CD * AOpe/3 *
sqrt(Modelica.Constants.g_n /(Medium.T_default*conTP) * hOpe)
"Constant coefficient for buoyancy driven air flow rate";

parameter Modelica.SIunits.MassFlowRate m_flow_turbulent=
kVal * rho_default * sqrt(dp_turbulent)
"Mass flow rate where regularization to laminar flow occurs for temperature-driven flow";

equation
// Air flow rate due to static pressure difference
VABp_flow = IBPSA.Airflow.Multizone.BaseClasses.powerLawFixedM(
k=kVal,
dp=port_a1.p-port_a2.p,
m=m,
a=a,
b=b,
c=c,
d=d,
dp_turbulent=dp_turbulent);
// Air flow rate due to buoyancy
// Because powerLawFixedM requires as an input a pressure difference pa-pb,
// we convert Ta-Tb by multiplying it with rho*R, and we divide
// above the constant expression by (rho*R)^m on the right hand-side of kT.
// Note that here, k is for mass flow rate, whereas in powerLawFixedM, it is for volume flow rate.
// We can use m=0.5 as this is from Bernoulli.
mABt_flow = IBPSA.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(
k=kT,
dp=conTP*(Medium.temperature(state_a1_inflow)-Medium.temperature(state_a2_inflow)),
m_flow_turbulent=m_flow_turbulent);

annotation (defaultComponentName="doo",
Documentation(info="<html>
<p>
Model for bi-directional air flow through a large opening such as a door.
</p>
<p>
In this model, the air flow is composed of two components,
a one-directional bulk air flow
due to static pressure difference in the adjoining two thermal zones, and
a two-directional airflow due to temperature-induced differences in density
of the air in the two thermal zones.
Although turbulent air flow is a nonlinear phenomenon,
the model is based on the simplifying assumption that these two
air flow rates can be superposed.
(Superposition is only exact for laminar flow.)
This assumption is made because
it leads to a simple model and because there is significant uncertainty
and assumptions anyway in such simplified a model for bidirectional flow through a door.
</p>
<h4>Main equations</h4>
<p>
The air flow rate due to static pressure difference is
</p>
<p align=\"center\" style=\"font-style:italic;\">
V&#775;<sub>ab,p</sub> = C<sub>D</sub> w h (2/&rho;<sub>0</sub>)<sup>0.5</sup> &Delta;p<sup>m</sup>,
</p>
<p>
where
<i>V&#775;</i> is the volumetric air flow rate,
<i>C<sub>D</sub></i> is the discharge coefficient,
<i>w</i> and <i>h</i> are the width and height of the opening,
<i>&rho;<sub>0</sub></i> is the mass density at the medium default pressure, temperature and humidity,
<i>m</i> is the flow exponent and
<i>&Delta;p = p<sub>a</sub> - p<sub>b</sub></i> is the static pressure difference between
the thermal zones.
For this model explanation, we will assume <i>p<sub>a</sub> &gt; p<sub>b</sub></i>.
For turbulent flow, <i>m=1/2</i> and for laminar flow <i>m=1</i>.
</p>
<p>
The air flow rate due to temperature difference in the thermal zones is
<i>V&#775;<sub>ab,t</sub></i> for flow from thermal zone <i>a</i> to <i>b</i>,
and
<i>V&#775;<sub>ba,t</sub></i> for air flow rate from thermal zone <i>b</i> to <i>a</i>.
The model has two air flow paths to allow bi-directional air flow.
The mass flow rates at these two air flow paths are
</p>
<p align=\"center\" style=\"font-style:italic;\">
m&#775;<sub>a1</sub> = &rho;<sub>0</sub> &nbsp; (+V&#775;<sub>ab,p</sub>/2 + &nbsp; V&#775;<sub>ab,t</sub>),
</p>
<p>
and, similarly,
</p>
<p align=\"center\" style=\"font-style:italic;\">
V&#775;<sub>ba</sub> = &rho;<sub>0</sub> &nbsp; (-V&#775;<sub>ab,p</sub>/2 + &nbsp; V&#775;<sub>ba,t</sub>),
</p>
<p>
where we simplified the calculation by using the density <i>&rho;<sub>0</sub></i>.
To calculate <i>V&#775;<sub>ba,t</sub></i>, we again use the density <i>&rho;<sub>0</sub></i>
and because of this simplification, we can write
</p>
<p align=\"center\" style=\"font-style:italic;\">
m&#775;<sub>ab,t</sub> = -m&#775;<sub>ba,t</sub> = &rho;<sub>0</sub> &nbsp; V&#775;<sub>ab,t</sub>
= -&rho;<sub>0</sub> &nbsp; V&#775;<sub>ba,t</sub>,
</p>
<p>
from which follows that the neutral height, e.g., the height where the air flow rate due to flow
induced by temperature difference is zero, is at <i>h/2</i>.
Hence,
</p>
<p align=\"center\" style=\"font-style:italic;\">
V&#775;<sub>ab,t</sub> = C<sub>D</sub> &int;<sub>0</sub><sup>h/2</sup> w v(z) dz,
</p>
<p>
where <i>v(z)</i> is the velocity at height <i>z</i>. From the Bernoulli equation, we obtain
</p>
<p align=\"center\" style=\"font-style:italic;\">
v(z) = (2 g z &Delta;&rho; &frasl; &rho;<sub>0</sub>)<sup>1/2</sup>.
</p>
<p>
The density difference can be written as
</p>
<p align=\"center\" style=\"font-style:italic;\">
&Delta;&rho; = &rho;<sub>a</sub>-&rho;<sub>b</sub>
&asymp; &rho;<sub>0</sub> (T<sub>b</sub> - T<sub>a</sub>) &frasl; T<sub>0</sub>,
</p>
<p>
where we used
<i>&rho;<sub>a</sub> = p<sub>0</sub> /(R T<sub>a</sub>)</i> and
<i>T<sub>a</sub> T<sub>b</sub> &asymp; T<sub>0</sub><sup>2</sup></i>.
Substituting this expression into the integral and integrating from <i>0</i> to <i>z</i> yields
</p>
<p align=\"center\" style=\"font-style:italic;\">
V&#775;<sub>ab,t</sub> = 1&frasl;3 C<sub>D</sub> w h
(g h &frasl; (R T<sub>0</sub> &rho;<sub>0</sub>))<sup>1/2</sup> &Delta;p<sup>1/2</sup>.
</p>
<p>
The above equation is equivalent to (6) in Brown and Solvason (1962).
<h4>Main assumptions</h4>
<p>
The main assumptions are as follows:
</p>
<ul>
<li>
<p>
The air flow rates due to static pressure difference and due to temperature-difference can be superposed.
</p>
</li>
<li>
<p>
For buoyancy-driven air flow, a constant density can be used to convert air volume flow rate to air mass flow rate.
</p>
</li>
</ul>
<p>
From these assumptions follows that the neutral height for buoyancy-driven air flow is at half of the height
of the opening.
</p>
<h4>Notes</h4>
<p>
For a more detailed model, use
<a href=\"modelica://IBPSA.Airflow.Multizone.DoorDiscretizedOpen\">
IBPSA.Airflow.Multizone.DoorDiscretizedOpen</a>.
</p>
<h4>References</h4>
<ul>
<li>
Brown, W.G. and K. R. Solvason.
Natural Convection through rectangular openings in partitions - 1.
<i>Int. Journal of Heat and Mass Transfer</i>.
Vol. 5, p. 859-868. 1962.
<a href=\"https://doi.org/10.1016/0017-9310(62)90184-9\">doi:10.1016/0017-9310(62)90184-9</a>.<br/>
Also available at
<a href=\"https://nrc-publications.canada.ca/eng/view/ft/?id=081c0ace-7c31-449c-9b3b-e6c14864b196\">
https://nrc-publications.canada.ca/eng/view/ft/?id=081c0ace-7c31-449c-9b3b-e6c14864b196</a>.
</li>
</ul>
</html>",
revisions="<html>
<ul>
<li>
January 22, 2020, by Michael Wetter:<br/>
Revised buoyancy-driven flow based on Brown and Solvason (1962).
</li>
<li>
January 19, 2020, by Klaas De Jonge:<br/>
Revised influence of stack effect.
</li>
<li>
October 6, 2020, by Michael Wetter:<br/>
First implementation for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1353\">#1353</a>.
</li>
</ul>
</html>"));
end DoorOpen;
Loading