modelStaticTwoPortHeatMassExchanger
Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model with two ports and declaration of quantities that are used by many models), Buildings.Fluid.Interfaces.TwoPortFlowResistanceParameters (Parameters for flow resistance for models with two ports).
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=trueif the only means of heat transfer at theheatPortis 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 theheatPortis not connected, then setprescribedHeatFlowRate=trueas in this case,heatPort.Q_flow=0. - Set
prescribedHeatFlowRate=falseif there is heat flow at theheatPortcomputed 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 setprescribedHeatFlowRate=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.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | sensibleOnly | Set to true if sensible exchange only | |
| Boolean | prescribedHeatFlowRate | Set to true if the heat flow rate is not a function of the component temperature | |
| Boolean | homotopyInitialization | true | = true, use homotopy method |
| Assumptions | |||
| Boolean | allowFlowReversal (from PartialTwoPort) | true | = false to simplify equations, assuming, but not enforcing, no flow reversal |
| Nominal condition | |||
| Modelica.Units.SI.MassFlowRate | m_flow_nominal (from PartialTwoPortInterface) | Nominal mass flow rate | |
| Modelica.Units.SI.PressureDifference | dp_nominal (from TwoPortFlowResistanceParameters) | Pressure difference | |
| Advanced | |||
| Modelica.Units.SI.MassFlowRate | m_flow_small (from PartialTwoPortInterface) | 1E-4*abs(m_flow_nominal) | Small mass flow rate for regularization of zero flow |
| Advanced › Diagnostics | |||
| Boolean | show_T (from PartialTwoPortInterface) | false | = true, if actual temperature at port is computed |
| Flow resistance | |||
| Boolean | computeFlowResistance (from TwoPortFlowResistanceParameters) | true | =true, compute flow resistance. Set to false to assume no friction |
| Boolean | from_dp (from TwoPortFlowResistanceParameters) | false | = true, use m_flow = f(dp) else dp = f(m_flow) |
| Real | n (from TwoPortFlowResistanceParameters) | 2 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| Boolean | linearizeFlowResistance (from TwoPortFlowResistanceParameters) | false | = true, use linear relation between m_flow and dp for any flow rate |
| Real | deltaM (from TwoPortFlowResistanceParameters) | 0.1 | Fraction of nominal flow rate where flow transitions to laminar |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Fluid.Interfaces.FluidPort_a | port_a (from PartialTwoPort) | Fluid connector a (positive design flow direction is from port_a to port_b) | |
| Modelica.Fluid.Interfaces.FluidPort_b | port_b (from PartialTwoPort) | Fluid connector b (positive design flow direction is from port_a to port_b) | |
| Modelica.Blocks.Interfaces.RealOutput | hOut | Leaving temperature of the component | |
| Modelica.Blocks.Interfaces.RealOutput[Medium.nXi] | XiOut | Leaving species concentration of the component | |
| Modelica.Blocks.Interfaces.RealOutput[Medium.nC] | COut | Leaving trace substances of the component |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.MassFlowRate | m_flow (from PartialTwoPortInterface) | port_a.m_flow | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) |
| Modelica.Units.SI.PressureDifference | dp (from PartialTwoPortInterface) | port_a.p - port_b.p | Pressure difference between port_a and port_b |
| Medium.ThermodynamicState | sta_a (from PartialTwoPortInterface) | if allowFlowReversal then Medium.setState_phX(port_a.p, noEvent(actualStream(port_a.h_outflow)), noEvent(actualStream(port_a.Xi_outflow))) else Medium.setState_phX(port_a.p, noEvent(inStream(port_a.h_outflow)), noEvent(inStream(port_a.Xi_outflow))) | Medium properties in port_a |
| Medium.ThermodynamicState | sta_b (from PartialTwoPortInterface) | if allowFlowReversal then Medium.setState_phX(port_b.p, noEvent(actualStream(port_b.h_outflow)), noEvent(actualStream(port_b.Xi_outflow))) else Medium.setState_phX(port_b.p, noEvent(port_b.h_outflow), noEvent(port_b.Xi_outflow)) | Medium properties in port_b |
| Modelica.Units.SI.HeatFlowRate | Q_flow | Heat transferred into the medium | |
| Modelica.Units.SI.MassFlowRate | mWat_flow | Moisture mass flow rate added to the medium | |
| Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation | vol | Control volume for steady-state energy and mass balance | |
| Buildings.Fluid.FixedResistances.PressureDrop | preDro | Flow resistance |
Revisions
-
June 17, 2026, by Michael Wetter:
Updated implementation to allow a flow coefficientnthat is different from2. This allows use of the model for not fully turbulent flow.
This is for Buildings, #4620. -
April 14, 2020, by Michael Wetter:
ChangedhomotopyInitializationto a constant.
This is for IBPSA, #1341. -
April 11, 2017, by Michael Wetter:
Updated documentation to make clear thatQ_flowincludes latent heat flow rate.
This is for issue Buildings #704. -
December 1, 2016, by Michael Wetter:
Updated model asuse_dhis no longer a parameter in the pressure drop model.
This is for #480. -
January 22, 2016 by Michael Wetter:
Removed assignment ofsensibleOnlyinbal1andbal2as this constant has been removed in Buildings.Fluid.Interfaces.StaticTwoPortHeatMassExchanger. -
November 19, 2015, by Michael Wetter:
Removed assignment of parametershowDesignFlowDirectioninextendsstatement. This is for #349. -
July 2, 2015 by Michael Wetter:
Revised implementation of conservation equations, added default values for outlet quantities atport_aifallowFlowReversal=falseand updated documentation. See issue 281 for a discussion. -
July 1, 2015 by Filip Jorissen:
Renameduse_safeDivisionintoprescribedHeatFlowRate. See issue 282 for a discussion. -
November 13, 2013 by Michael Wetter:
Added parameterhomotopyInitializationas it has been removed in the base class. -
October 8, 2013 by Michael Wetter:
Removed propagation ofshow_V_flowto pressure drop calculation, as this model no longer has that parameter. -
July 30, 2013 by Michael Wetter:
Changed connectormXi_flow[Medium.nXi]to a scalar input connectormWat_flow. The reason is thatmXi_flowdoes not allow to compute the other components inmX_flowand therefore leads to an ambiguous use of the model. By only requestingmWat_flow, the mass balance and species balance can be implemented correctly. -
March 27, 2013 by Michael Wetter:
Removed wrong unit attribute ofCOut, and added min and max attributes forXiOut. -
February 8, 2012 by Michael Wetter:
Changed model to use graphical modeling. -
December 14, 2011 by Michael Wetter:
Changed assignment ofhOut,XiOutandCOutto no longer declare that it is continuous. The declaration of continuity, i.e, thesmooth(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 ofhOut,XiOutandCOutto 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 ifm_flow=0. -
March 27, 2011, by Michael Wetter:
Addedhomotopyoperator. -
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 atport_bwas multiplied with the mass flow rate atport_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 was0.005 kg/kg, then the error was0.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 constantsensibleOnlyto 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.