Skip to content

Commit

Permalink
Merge pull request #586 from RWTH-EBC/mergeIBPSA_forRelease0.6.0
Browse files Browse the repository at this point in the history
Merge ibpsa for release0.6.0
  • Loading branch information
PMehrfeld authored Aug 8, 2018
2 parents 552c5f7 + 9543655 commit 60f5827
Show file tree
Hide file tree
Showing 947 changed files with 89,592 additions and 2,166 deletions.
627 changes: 612 additions & 15 deletions AixLib/.copiedFiles.txt

Large diffs are not rendered by default.

57 changes: 40 additions & 17 deletions AixLib/Airflow/Multizone/BaseClasses/DoorDiscretized.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ partial model DoorDiscretized

parameter Modelica.SIunits.PressureDifference dp_turbulent(min=0) = 0.01
"Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01";
parameter Real CD=0.65 "|Orifice characteristics|Discharge coefficient";
parameter Real CD=0.65 "Discharge coefficient"
annotation (Dialog(group="Orifice characteristics"));

Modelica.SIunits.PressureDifference dpAB[nCom](each nominal=1)
"Pressure difference between compartments";
Expand All @@ -18,6 +19,22 @@ partial model DoorDiscretized

protected
parameter Modelica.SIunits.Length dh=hOpe/nCom "Height of each compartment";

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, used to compute fluid volume";

parameter Real hAg[nCom](each unit="m2/s2")=
{Modelica.Constants.g_n*(hA - (i - 0.5)*dh) for i in 1:nCom}
"Product g*h_i for each compartment";

parameter Real hBg[nCom](each unit="m2/s2")=
{Modelica.Constants.g_n*(hB - (i - 0.5)*dh) for i in 1:nCom}
"Product g*h_i for each compartment";
Modelica.SIunits.AbsolutePressure pA[nCom](each nominal=101325)
"Pressure in compartments of room A";
Modelica.SIunits.AbsolutePressure pB[nCom](each nominal=101325)
Expand All @@ -29,36 +46,30 @@ protected
"Volume flow rate through compartment from A to B if positive";
Modelica.SIunits.VolumeFlowRate dVBA_flow[nCom]
"Volume flow rate through compartment from B to A if positive";
Modelica.SIunits.VolumeFlowRate VZerCom_flow = VZer_flow/nCom
"Small flow rate for regularization";

Real m(min=0.5, max=1) "Flow exponent, m=0.5 for turbulent, m=1 for laminar";
Real kVal "Flow coefficient for each compartment, k = V_flow/ dp^m";
Modelica.SIunits.Area dA "Compartment area";

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, used to compute fluid volume";

Real gaiFlo[nCom] "Gain to sum up the positive flows and set the negative to zero in a differentiable way";
equation
dA = A/nCom;

for i in 1:nCom loop
// pressure drop in each compartment
pA[i] = port_a1.p + rho_a1_inflow*Modelica.Constants.g_n*(hA - (i - 0.5)*dh);
pB[i] = port_a2.p + rho_a2_inflow*Modelica.Constants.g_n*(hB - (i - 0.5)*dh);
pA[i] = port_a1.p + rho_a1_inflow*hAg[i];
pB[i] = port_a2.p + rho_a2_inflow*hBg[i];
dpAB[i] = pA[i] - pB[i];
v[i] = dV_flow[i]/dA;
// assignment of net volume flows
dVAB_flow[i] = dV_flow[i]*
AixLib.Utilities.Math.Functions.smoothHeaviside(x=dV_flow[i], delta=
VZer_flow/nCom) + VZer_flow/nCom;
dVBA_flow[i] = -dV_flow[i] + dVAB_flow[i] + 2*VZer_flow/nCom;
gaiFlo[i] = AixLib.Utilities.Math.Functions.smoothHeaviside(x=dV_flow[i], delta=VZerCom_flow);
dVAB_flow[i] = dV_flow[i] * gaiFlo[i];
dVBA_flow[i] = -dV_flow[i] * (1-gaiFlo[i]);
end for;
// add positive and negative flows
VAB_flow = ones(nCom)*dVAB_flow;
VBA_flow = ones(nCom)*dVBA_flow;
VAB_flow = sum(dVAB_flow);
VBA_flow = sum(dVBA_flow);
vTop = v[nCom];
vBot = v[1];
annotation (
Expand Down Expand Up @@ -102,6 +113,17 @@ using the model for a door that can be open or closed.
revisions="<html>
<ul>
<li>
June 27, 2018, by Michael Wetter:<br/>
Corrected old parameter annotation.
</li>
<li>
June 6, 2018, by Michael Wetter:<br/>
Removed term that assures non-zero flow rate in each path, and
reformulated flow balance to ensure that model is symmetric.
This is
for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/937\">#937</a>.
</li>
<li>
January 22, 2016, by Michael Wetter:<br/>
Corrected type declaration of pressure difference.
This is
Expand All @@ -128,6 +150,7 @@ Renamed protected parameters for consistency with the naming conventions.
</li>
<li><i>February 8, 2005</i> by Michael Wetter:<br/>
Released first version.
</li>
</ul>
</html>"));
end DoorDiscretized;
21 changes: 15 additions & 6 deletions AixLib/Airflow/Multizone/BaseClasses/ErrorControl.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
within AixLib.Airflow.Multizone.BaseClasses;
model ErrorControl "Interface that defines parameters for error control"
parameter Boolean forceErrorControlOnFlow = true
"Flag to force error control on m_flow. Set to true if interested in flow rate";
"Flag to force error control on m_flow. Set to true if interested in flow rate"
annotation(Dialog(tab="Advanced"));

annotation (Documentation(info="<html>
<p>
This is an interface that defines parameters used for error control.
Expand All @@ -19,17 +21,24 @@ on the exchanged mass, which can be defined as
dm/dt = m_flow.
</pre>
<p>
By setting <code>enforceErrorControlOnFlow = true</code>, such an equation is imposed
By setting <code>forceErrorControlOnFlow = true</code>, such an equation is imposed
by models that extend this class.
</p>
</html>",
revisions="<html>
<ul>
<li><i>July 20, 2010</i> by Michael Wetter:<br/>
Integrated model into the Buildings library.
<li>
June 27, 2018, by Michael Wetter:<br/>
Moved parameter <code>forceErrorControlOnFlow</code> to the Advanced tab.
</li>
<li>
July 20, 2010 by Michael Wetter:<br/>
Integrated model into the Buildings library.
</li>
<li>
November 1, 2005 by Michael Wetter:<br/>
Released first version.
</li>
<li><i>November 1, 2005</i> by Michael Wetter:<br/>
Released first version.
</ul>
</html>"));
end ErrorControl;
32 changes: 23 additions & 9 deletions AixLib/Airflow/Multizone/BaseClasses/PowerLawResistance.mo
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
within AixLib.Airflow.Multizone.BaseClasses;
partial model PowerLawResistance "Flow resistance that uses the power law"
extends AixLib.Fluid.Interfaces.PartialTwoPortInterface(
final allowFlowReversal=true,
final m_flow_nominal=rho_default*k*dp_turbulent);
extends AixLib.Airflow.Multizone.BaseClasses.ErrorControl;

parameter Modelica.SIunits.Area A "|Orifice characteristics|Area of orifice";

parameter Real m(min=0.5, max=1)
"Flow exponent, m=0.5 for turbulent, m=1 for laminar";
parameter Boolean useDefaultProperties=true
"Set to false to use density and viscosity based on actual medium state, rather than using default values"
annotation (Evaluate=true);
annotation(Evaluate=true, Dialog(tab="Advanced"));
parameter Modelica.SIunits.PressureDifference dp_turbulent(min=0, displayUnit="Pa") = 0.1
"Pressure difference where laminar and turbulent flow relation coincide. Recommended = 0.1";
parameter Modelica.SIunits.Length lWet=sqrt(A)
"Wetted perimeter used for Reynolds number calculation";
"Pressure difference where laminar and turbulent flow relation coincide. Recommended = 0.1"
annotation(Dialog(tab="Advanced"));

parameter Boolean homotopyInitialization = true "= true, use homotopy method"
annotation(Evaluate=true, Dialog(tab="Advanced"));
Expand All @@ -23,7 +21,6 @@ partial model PowerLawResistance "Flow resistance that uses the power law"
"Volume flow rate through the component";
Modelica.SIunits.Velocity v(nominal=1) "Average velocity";
Modelica.SIunits.Density rho "Fluid density at port_a";
Real Re "Reynolds number";

protected
constant Real gamma(min=1) = 1.5
Expand Down Expand Up @@ -95,8 +92,6 @@ equation
dp_turbulent=dp_turbulent);

port_a.m_flow = rho*V_flow;
v = V_flow/A;
Re = v*lWet*rho/dynVis;

// Isenthalpic state transformation (no storage and no loss of energy)
port_a.h_outflow = inStream(port_b.h_outflow);
Expand Down Expand Up @@ -133,6 +128,25 @@ The model is used as a base for the interzonal air flow models.
revisions="<html>
<ul>
<li>
June 24, 2018, by Michael Wetter:<br/>
Removed parameter <code>A</code> because
<a href=\"modelica://AixLib.Airflow.Multizone.EffectiveAirLeakageArea\">
AixLib.Airflow.Multizone.EffectiveAirLeakageArea</a>
uses the effective leakage area <code>L</code> rather than <code>A</code>.<br/>
Removed calculation <code>v=V_flow/A</code> as parameter <code>A</code> has been removed.<br/>
Removed parameter <code>lWet</code> as this is only used to compute
the Reynolds number, and the Reynolds number is not used by this model.
Also removed the variable <code>Re</code> for the Reynolds number.<br/>
This change is non-backward compatible.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/932\">AixLib, #932</a>.
</li>
<li>
May 1, 2018, by Filip Jorissen:<br/>
Set <code>final allowFlowReversal=true</code>.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/877\">#877</a>.
</li>
<li>
January 22, 2016, by Michael Wetter:<br/>
Corrected type declaration of pressure difference.
This is
Expand Down
26 changes: 18 additions & 8 deletions AixLib/Airflow/Multizone/BaseClasses/TwoWayFlowElementBuoyancy.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ partial model TwoWayFlowElementBuoyancy
"Flow resistance that uses the power law"
extends AixLib.Airflow.Multizone.BaseClasses.TwoWayFlowElement;

parameter Modelica.SIunits.Length wOpe=0.9 "|Geometry|Width of opening";
parameter Modelica.SIunits.Length hOpe=2.1 "|Geometry|Height of opening";
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.Length hA=2.7/2
"|Geometry|Height of reference pressure zone A";
"Height of reference pressure zone A"
annotation (Dialog(group="Geometry"));
parameter Modelica.SIunits.Length hB=2.7/2
"|Geometry|Height of reference pressure zone B";
"Height of reference pressure zone B"
annotation (Dialog(group="Geometry"));

annotation (Documentation(info="<html>
<p>
Expand All @@ -27,11 +31,17 @@ for doors that can be open or closed as a function of an input signal.
</html>",
revisions="<html>
<ul>
<li><i>July 20, 2010</i> by Michael Wetter:<br/>
Migrated model to Modelica 3.1 and integrated it into the Buildings library.
<li>
June 27, 2018, by Michael Wetter:<br/>
Corrected old parameter annotation.
</li>
<li><i>February 4, 2005</i> by Michael Wetter:<br/>
Released first version.
<li>
July 20, 2010 by Michael Wetter:<br/>
Migrated model to Modelica 3.1 and integrated it into the Buildings library.
</li>
<li>
February 4, 2005 by Michael Wetter:<br/>
Released first version.
</ul>
</html>"));
end TwoWayFlowElementBuoyancy;
21 changes: 15 additions & 6 deletions AixLib/Airflow/Multizone/BaseClasses/ZonalFlow.mo
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,30 @@ equation
port_b2.C_outflow = inStream(port_a2.C_outflow);

annotation ( Icon(graphics={
Line(points={{-86,-46},{0,-34},{88,-52}}, color={0,0,127}),
Line(points={{-92,50},{0,34},{84,48}}, color={0,0,127}),
Rectangle(
extent={{-100,-100},{100,100}},
lineColor={0,0,127},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(points={{-84,54},{-40,34},{0,68},{36,42},{72,50}},
color={0,0,127},
smooth=Smooth.Bezier),
Polygon(
points={{-7,1},{9,1},{7,9},{-7,1}},
points={{7,-1},{-9,-1},{-7,-9},{7,-1}},
lineColor={0,0,127},
fillColor={0,0,127},
fillPattern=FillPattern.Solid,
origin={-87,-49},
origin={79,55},
rotation=360),
Line(points={{76,-62},{32,-82},{-8,-48},{-44,-74},{-80,-66}},
color={0,0,127},
smooth=Smooth.Bezier),
Polygon(
points={{7,-1},{-9,-1},{-7,-9},{7,-1}},
points={{-7,-1},{9,-1},{7,-9},{-7,-1}},
lineColor={0,0,127},
fillColor={0,0,127},
fillPattern=FillPattern.Solid,
origin={85,53},
origin={-79,-63},
rotation=360)}),
Documentation(info="<html>
<p>
Expand Down
28 changes: 15 additions & 13 deletions AixLib/Airflow/Multizone/DoorDiscretizedOpen.mo
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,24 @@ revisions="<html>
December 14, 2012 by Michael Wetter:<br/>
Renamed protected parameters for consistency with the naming conventions.
</li>
<li><i>December 6, 2011</i> by Michael Wetter:<br/>
Changed the computation of the discharge coefficient to use the
nominal density instead of the actual density.
Computing <code>sqrt(2/rho)</code> sometimes causes warnings from the solver,
as it seems to try negative values for the density during iterative solutions.
<li>December 6, 2011 by Michael Wetter:<br/>
Changed the computation of the discharge coefficient to use the
nominal density instead of the actual density.
Computing <code>sqrt(2/rho)</code> sometimes causes warnings from the solver,
as it seems to try negative values for the density during iterative solutions.
</li>
<li><i>August 12, 2011</i> by Michael Wetter:<br/>
Changed model to use the new function
<a href=\"modelica://AixLib.Airflow.Multizone.BaseClasses.powerLawFixedM\">
Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM</a>.
<li>August 12, 2011 by Michael Wetter:<br/>
Changed model to use the new function
<a href=\"modelica://AixLib.Airflow.Multizone.BaseClasses.powerLawFixedM\">
Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM</a>.
</li>
<li><i>July 20, 2010</i> by Michael Wetter:<br/>
Migrated model to Modelica 3.1 and integrated it into the Buildings library.
<li>July 20, 2010 by Michael Wetter:<br/>
Migrated model to Modelica 3.1 and integrated it into the Buildings library.
</li>
<li>
February 10, 2005 by Michael Wetter:<br/>
Released first version.
</li>
<li><i>February 10, 2005</i> by Michael Wetter:<br/>
Released first version.
</ul>
</html>"));
end DoorDiscretizedOpen;
Loading

0 comments on commit 60f5827

Please sign in to comment.