BuildSysPro.IBPSA.Fluid.Interfaces.StaticTwoPortHeatMassExchanger

# .BuildSysPro.IBPSA.Fluid.Interfaces.StaticTwoPortHeatMassExchanger

Partial model transporting fluid between two ports without storing mass or energy

## Information

This component transports fluid between its two ports, without storing mass or energy. It is based on Modelica.Fluid.Interfaces.PartialTwoPortTransport but it does use a different implementation for handling reverse flow because in this component, mass flow rate can be added or removed from the medium.

If `dp_nominal > Modelica.Constants.eps`, this component computes pressure drop due to flow friction. The pressure drop is defined by a quadratic function that goes through the point `(m_flow_nominal, dp_nominal)`. At `|m_flow| < deltaM * m_flow_nominal`, the pressure drop vs. flow relation is linearized. If the parameter `linearizeFlowResistance` is set to true, then the whole pressure drop vs. flow resistance curve is linearized.

#### Implementation

This model uses inputs and constants that need to be set by models that extend or instantiate this model. The following inputs need to be assigned:

- `Q_flow`, which is the sensible and latent heat flow rate added to the medium.
- `mWat_flow`, which is the moisture mass flow rate added to the medium.

Set the constant `sensibleOnly=true` if the model that extends or instantiates this model sets `mWat_flow = 0`.

To increase the numerical robustness of the model, the constant `prescribedHeatFlowRate` can be set. Use the following settings:

- Set `prescribedHeatFlowRate=true` if the only means of heat transfer at the `heatPort` is a prescribed heat flow rate that is not a function of the temperature difference between the medium and an ambient temperature. Examples include an ideal electrical heater, a pump that rejects heat into the fluid stream, or a chiller that removes heat based on a performance curve. If the `heatPort` is not connected, then set `prescribedHeatFlowRate=true` as in this case, `heatPort.Q_flow=0`.
- Set `prescribedHeatFlowRate=false` if there is heat flow at the `heatPort` computed as K * (T-heatPort.T), for some temperature T and some conductance K, which may itself be a function of temperature or mass flow rate.
  If there is a combination of K * (T-heatPort.T) and a prescribed heat flow rate, for example a solar collector that dissipates heat to the ambient and receives heat from the solar radiation, then set `prescribedHeatFlowRate=false`.

If `prescribedHeatFlow=true`, then energy and mass balance equations are formulated to guard against numerical problems near zero flow that can occur if `Q_flow` or `m_flow` are the results of an iterative solver.

## Revisions

- April 14, 2020, by Michael Wetter:
  Changed `homotopyInitialization` to a constant.
  This is for IBPSA, #1341.
- April 11, 2017, by Michael Wetter:
  Updated documentation to make clear that `Q_flow` includes latent heat flow rate.
  This is for issue Buildings #704.
- December 1, 2016, by Michael Wetter:
  Updated model as `use_dh` is no longer a parameter in the pressure drop model.
  This is for #480.
- January 22, 2016 by Michael Wetter:
  Removed assignment of `sensibleOnly` in `bal1` and `bal2` as this constant has been removed in IBPSA.Fluid.Interfaces.StaticTwoPortHeatMassExchanger.
- November 19, 2015, by Michael Wetter:
  Removed assignment of parameter `showDesignFlowDirection` in `extends` statement. This is for #349.
- July 2, 2015 by Michael Wetter:
  Revised implementation of conservation equations, added default values for outlet quantities at `port_a` if `allowFlowReversal=false` and updated documentation. See issue 281 for a discussion.
- July 1, 2015 by Filip Jorissen:
  Renamed `use_safeDivision` into `prescribedHeatFlowRate`. See issue 282 for a discussion.
- November 13, 2013 by Michael Wetter:
  Added parameter `homotopyInitialization` as it has been removed in the base class.
- October 8, 2013 by Michael Wetter:
  Removed propagation of `show_V_flow` to pressure drop calculation, as this model no longer has that parameter.
- July 30, 2013 by Michael Wetter:
  Changed connector `mXi_flow[Medium.nXi]` to a scalar input connector `mWat_flow`. The reason is that `mXi_flow` does not allow to compute the other components in `mX_flow` and therefore leads to an ambiguous use of the model. By only requesting `mWat_flow`, the mass balance and species balance can be implemented correctly.
- March 27, 2013 by Michael Wetter:
  Removed wrong unit attribute of `COut`, and added min and max attributes for `XiOut`.
- February 8, 2012 by Michael Wetter:
  Changed model to use graphical modeling.
- December 14, 2011 by Michael Wetter:
  Changed assignment of `hOut`, `XiOut` and `COut` to no longer declare that it is continuous. The declaration of continuity, i.e, the `smooth(0, if (port_a.m_flow >= 0) then ...)` declaration, was required for Dymola 2012 to simulate, but it is no longer needed for Dymola 2012 FD01.
- August 19, 2011, by Michael Wetter:
  Changed assignment of `hOut`, `XiOut` and `COut` to declare that it is not differentiable.
- August 4, 2011, by Michael Wetter:
  Moved linearized pressure drop equation from the function body to the equation section. With the previous implementation, the symbolic processor may not rearrange the equations, which can lead to coupled equations instead of an explicit solution.
- March 29, 2011, by Michael Wetter:
  Changed energy and mass balance to avoid a division by zero if `m_flow=0`.
- March 27, 2011, by Michael Wetter:
  Added `homotopy` operator.
- August 19, 2010, by Michael Wetter:
  Fixed bug in energy and moisture balance that affected results if a component adds or removes moisture to the air stream. In the old implementation, the enthalpy and species outflow at `port_b` was multiplied with the mass flow rate at `port_a`. The old implementation led to small errors that were proportional to the amount of moisture change. For example, if the moisture added by the component was `0.005 kg/kg`, then the error was `0.5%`. Also, the results for forward flow and reverse flow differed by this amount. With the new implementation, the energy and moisture balance is exact.
- March 22, 2010, by Michael Wetter:
  Added constant `sensibleOnly` to simplify species balance equation.
- April 10, 2009, by Michael Wetter:
  Added model to compute flow friction.
- April 22, 2008, by Michael Wetter:
  Revised to add mass balance.
- March 17, 2008, by Michael Wetter:
  First implementation.

Generated at 2026-05-12T20:19:03Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos