modelTwoWayFlowElement

Flow resistance that uses the power law

Extends from Buildings.Fluid.Interfaces.PartialFourPortInterface (Partial model with four ports and declaration of quantities that are used by many models), Buildings.Airflow.Multizone.BaseClasses.ErrorControl (Interface that defines parameters for error control).

Information

This is a partial model for models that describe the bi-directional air flow through large openings.

Models that extend this model need to compute mAB_flow and mBA_flow, or alternatively VAB_flow and VBA_flow, and the face area area. The face area is a variable to allow this partial model to be used for doors that can be open or closed as a function of an input signal.

Parameters

TypeNameDefaultDescription
Modelica.Units.SI.VelocityvZer0.001Minimum velocity to prevent zero flow. Recommended: 0.001
Assumptions
BooleanallowFlowReversal1 (from PartialFourPort)true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2 (from PartialFourPort)true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
Nominal condition
Modelica.Units.SI.MassFlowRatem1_flow_nominal (from PartialFourPortInterface)Nominal mass flow rate
Modelica.Units.SI.MassFlowRatem2_flow_nominal (from PartialFourPortInterface)Nominal mass flow rate
Advanced
Medium1.MassFlowRatem1_flow_small (from PartialFourPortInterface)1E-4*abs(m1_flow_nominal)Small mass flow rate for regularization of zero flow
Medium2.MassFlowRatem2_flow_small (from PartialFourPortInterface)1E-4*abs(m2_flow_nominal)Small mass flow rate for regularization of zero flow
BooleanforceErrorControlOnFlow (from ErrorControl)trueFlag to force error control on m_flow. Set to true if interested in flow rate
Advanced › Diagnostics
Booleanshow_T (from PartialFourPortInterface)false= true, if actual temperature at port is computed

Connectors

TypeNameDefaultDescription
Modelica.Fluid.Interfaces.FluidPort_aport_a1 (from PartialFourPort)Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
Modelica.Fluid.Interfaces.FluidPort_bport_b1 (from PartialFourPort)Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
Modelica.Fluid.Interfaces.FluidPort_aport_a2 (from PartialFourPort)Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
Modelica.Fluid.Interfaces.FluidPort_bport_b2 (from PartialFourPort)Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)

Components

TypeNameDefaultDescription
Medium1.MassFlowRatem1_flow (from PartialFourPortInterface)port_a1.m_flowMass flow rate from port_a1 to port_b1 (m1_flow > 0 is design flow direction)
Modelica.Units.SI.PressureDifferencedp1 (from PartialFourPortInterface)port_a1.p - port_b1.pPressure difference between port_a1 and port_b1
Medium2.MassFlowRatem2_flow (from PartialFourPortInterface)port_a2.m_flowMass flow rate from port_a2 to port_b2 (m2_flow > 0 is design flow direction)
Modelica.Units.SI.PressureDifferencedp2 (from PartialFourPortInterface)port_a2.p - port_b2.pPressure difference between port_a2 and port_b2
Medium1.ThermodynamicStatesta_a1 (from PartialFourPortInterface)if allowFlowReversal1 then Medium1.setState_phX(port_a1.p, noEvent(actualStream(port_a1.h_outflow)), noEvent(actualStream(port_a1.Xi_outflow))) else Medium1.setState_phX(port_a1.p, inStream(port_a1.h_outflow), inStream(port_a1.Xi_outflow))Medium properties in port_a1
Medium1.ThermodynamicStatesta_b1 (from PartialFourPortInterface)if allowFlowReversal1 then Medium1.setState_phX(port_b1.p, noEvent(actualStream(port_b1.h_outflow)), noEvent(actualStream(port_b1.Xi_outflow))) else Medium1.setState_phX(port_b1.p, port_b1.h_outflow, port_b1.Xi_outflow)Medium properties in port_b1
Medium2.ThermodynamicStatesta_a2 (from PartialFourPortInterface)if allowFlowReversal2 then Medium2.setState_phX(port_a2.p, noEvent(actualStream(port_a2.h_outflow)), noEvent(actualStream(port_a2.Xi_outflow))) else Medium2.setState_phX(port_a2.p, inStream(port_a2.h_outflow), inStream(port_a2.Xi_outflow))Medium properties in port_a2
Medium2.ThermodynamicStatesta_b2 (from PartialFourPortInterface)if allowFlowReversal2 then Medium2.setState_phX(port_b2.p, noEvent(actualStream(port_b2.h_outflow)), noEvent(actualStream(port_b2.Xi_outflow))) else Medium2.setState_phX(port_b2.p, port_b2.h_outflow, port_b2.Xi_outflow)Medium properties in port_b2
Modelica.Units.SI.VolumeFlowRateVAB_flowVolume flow rate from A to B if positive
Modelica.Units.SI.VolumeFlowRateVBA_flowVolume flow rate from B to A if positive
Modelica.Units.SI.MassFlowRatemAB_flowMass flow rate from A to B if positive
Modelica.Units.SI.MassFlowRatemBA_flowMass flow rate from B to A if positive
Modelica.Units.SI.VelocityvABAverage velocity from A to B
Modelica.Units.SI.VelocityvBAAverage velocity from B to A
Modelica.Units.SI.Densityrho_a1_inflowDensity of air flowing in from port_a1
Modelica.Units.SI.Densityrho_a2_inflowDensity of air flowing in from port_a2
Modelica.Units.SI.AreaAFace area

Contents

NameDescription
MediumMedium in the component

Revisions

  • September 22, 2025, by Michael Wetter:
    Set unbounded=true for mExcAB_flow and mExcBA_flow to avoid spikes in port_a.m_flow in Buildings.Airflow.Multizone.Examples.OneOpenDoor.
    This is for Buildings, #4360.
  • September 19, 2025, by Michael Wetter:
    Refactored implementation of underlying function that computes the flow rate to allow function to be inlined. This leads to a 20% faster simulation of Buildings.Airflow.Multizone.Examples.OneOpenDoor compared to the previous implementation.
    This is for IBPSA, #2043.
  • May 12, 2020, by Michael Wetter:
    Changed assignment of m1_flow_small and m2_flow_small to final. These quantities are not used in this model and models that extend from it. Hence there is no need for the user to change the value.
  • January 18, 2019, by Jianjun Hu:
    Limited the media choice to moist air only. See #1050.
  • September 13, 2018, by Michael Wetter:
    Set allowFlowReversal=true as the flow can be slightly negative due to the regularization, in which case the m_flow(min=0) that is set in the base class Buildings.Fluid.Interfaces.PartialFourPort is violated.
    See #937.
  • November 3, 2016, by Michael Wetter:
    Removed start values for inflowing density to simplify the parameter window, and because this can usually be computed from the state variables.
    This is for #552.
  • February 24, 2015 by Michael Wetter:
    Changed model to use Buildings.Utilities.Psychrometrics.Functions.density_pTX for the density computation as Buildings.Media.Air.density does not depend on temperature.
  • June 18, 2014 by Michael Wetter:
    Added start values and fixed=true attribute for mExcAB and mExcBA. This avoids a warning during translation.
  • July 20, 2010 by Michael Wetter:
    Migrated model to Modelica 3.1 and integrated it into the Buildings library.
  • February 4, 2005 by Michael Wetter:
    Released first version.