Buildings.Fluid.MixingVolumes

Package with mixing volumes

Information

This package contains models for completely mixed volumes.

For most situations, the model Buildings.Fluid.MixingVolumes.MixingVolume should be used. The other models are only of interest if water should be added to or subtracted from the fluid volume, such as in a coil with water vapor condensation.

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Buildings.Fluid.MixingVolumes.MixingVolume MixingVolume Mixing volume with inlet and outlet ports (flow reversal is allowed)
Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir MixingVolumeMoistAir Mixing volume with heat port for latent heat exchange, to be used if moisture is added or removed
Buildings.Fluid.MixingVolumes.Examples Examples Collection of models that illustrate model use and test models
Buildings.Fluid.MixingVolumes.Validation Validation Collection of validation models
Buildings.Fluid.MixingVolumes.BaseClasses BaseClasses Package with base classes for Buildings.Fluid.MixingVolumes

Buildings.Fluid.MixingVolumes.MixingVolume Buildings.Fluid.MixingVolumes.MixingVolume

Mixing volume with inlet and outlet ports (flow reversal is allowed)

Buildings.Fluid.MixingVolumes.MixingVolume

Information

This model represents an instantaneously mixed volume. Potential and kinetic energy at the port are neglected, and there is no pressure drop at the ports. The volume can exchange heat through its heatPort.

The volume can be parameterized as a steady-state model or as dynamic model.

To increase the numerical robustness of the model, the constant prescribedHeatFlowRate can be set by the user. This constant only has an effect if the model has exactly two fluid ports connected, and if it is used as a steady-state model. Use the following settings:

Options

The parameter mSenFac can be used to increase the thermal mass of this model without increasing its volume. This way, species concentrations are still calculated correctly even though the thermal mass increases. The additional thermal mass is calculated based on the density and the value of the function HeatCapacityCp of the medium state state_default.
This parameter can for instance be useful in a pipe model when the developer wants to lump the pipe thermal mass to the fluid volume. By default mSenFac = 1, hence the mass is unchanged. For higher values of mSenFac, the mass will be scaled proportionally.

Set the parameter use_C_flow = true to enable an input connector for the trace substance flow rate. This allows to directly add or subtract trace substances such as CO2 to the volume. See Buildings.Fluid.Sensors.Examples.PPM for an example.

Implementation

If the model is operated in steady-state and has two fluid ports connected, then the same energy and mass balance implementation is used as in steady-state component models, i.e., the use of actualStream is not used for the properties at the port.

The implementation of these balance equations is done in the instances dynBal for the dynamic balance and steBal for the steady-state balance. Both models use the same input variables:

For the rationale of selecting different energy and mass balances, and for the use of prescribedHeatFlowRate, see the documentation of Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume.

For simple models that uses this model, see Buildings.Fluid.HeatExchangers.HeaterCooler_u and Buildings.Fluid.Humidifiers.Humidifier_u.

Extends from Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume (Partial mixing volume with inlet and outlet ports (flow reversal is allowed)).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VolumeV Volume [m3]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
DynamicsmassDynamicsenergyDynamicsType of mass balance: dynamic (3 initialization options) or steady state
RealmSenFac1Factor for scaling the sensible thermal mass of the volume
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
ExtraPropertyC_nominal[Medium.nC]fill(1E-2, Medium.nC)Nominal value of trace substances. (Set to typical order of magnitude.)
Advanced
Booleaninitialize_pnot Medium.singleState= true to set up initial equations for pressure
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Booleanuse_C_flowfalseSet to true to enable input connector for trace substance
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal. Used only if model has two ports.

Connectors

TypeNameDescription
VesselFluidPorts_bports[nPorts]Fluid inlets and outlets
output RealOutputUInternal energy of the component [J]
output RealOutputmMass of the component [kg]
output RealOutputmXi[Medium.nXi]Species mass of the component [kg]
output RealOutputmC[Medium.nC]Trace substance mass of the component [kg]
HeatPort_aheatPortHeat port for heat exchange with the control volume
input RealInputC_flow[Medium.nC]Trace substance mass flow rate added to the medium

Modelica definition

model MixingVolume "Mixing volume with inlet and outlet ports (flow reversal is allowed)" extends Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume( final initialize_p = not Medium.singleState, steBal(final use_C_flow = use_C_flow), dynBal(final use_C_flow = use_C_flow)); parameter Boolean use_C_flow = false "Set to true to enable input connector for trace substance"; Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort( T(start=T_start)) "Heat port for heat exchange with the control volume"; Modelica.Blocks.Interfaces.RealInput[Medium.nC] C_flow if use_C_flow "Trace substance mass flow rate added to the medium"; equation connect(heaFloSen.port_a, heatPort); connect(C_flow, steBal.C_flow); connect(C_flow, dynBal.C_flow); end MixingVolume;

Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir

Mixing volume with heat port for latent heat exchange, to be used if moisture is added or removed

Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir

Information

Model for an ideally mixed fluid volume and the ability to store mass and energy. The volume is fixed, and latent and sensible heat can be exchanged.

This model represents the same physics as Buildings.Fluid.MixingVolumes.MixingVolume, but in addition, it allows adding or subtracting water to the control volume. The mass flow rate of the added or subtracted water is specified at the port mWat_flow. Adding mWat_flow itself does not affect the energy balance in this model. Hence, the enthalpy that is added or removed with the flow of mWat_flow needs to be added to the heat port heatPort.

To increase the numerical robustness of the model, the constant prescribedHeatFlowRate can be set by the user. This constant only has an effect if the model has exactly two fluid ports connected, and if it is used as a steady-state model. Use the following settings:

Options

The parameter mSenFac can be used to increase the thermal mass of this model without increasing its volume. This way, species concentrations are still calculated correctly even though the thermal mass increases. The additional thermal mass is calculated based on the density and the value of the function HeatCapacityCp of the medium state state_default.
This parameter can for instance be useful in a pipe model when the developer wants to lump the pipe thermal mass to the fluid volume. By default mSenFac = 1, hence the mass is unchanged. For higher values of mSenFac, the mass will be scaled proportionally.

Set the parameter use_C_flow = true to enable an input connector for the trace substance flow rate. This allows to directly add or subtract trace substances such as CO2 to the volume. See Buildings.Fluid.Sensors.Examples.PPM for an example.

Extends from Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume (Partial mixing volume with inlet and outlet ports (flow reversal is allowed)).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VolumeV Volume [m3]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
DynamicsmassDynamicsenergyDynamicsType of mass balance: dynamic (3 initialization options) or steady state
RealmSenFac1Factor for scaling the sensible thermal mass of the volume
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
ExtraPropertyC_nominal[Medium.nC]fill(1E-2, Medium.nC)Nominal value of trace substances. (Set to typical order of magnitude.)
Advanced
Booleaninitialize_pnot Medium.singleState= true to set up initial equations for pressure
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Booleanuse_C_flowfalseSet to true to enable input connector for trace substance
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal. Used only if model has two ports.

Connectors

TypeNameDescription
VesselFluidPorts_bports[nPorts]Fluid inlets and outlets
output RealOutputUInternal energy of the component [J]
output RealOutputmMass of the component [kg]
output RealOutputmXi[Medium.nXi]Species mass of the component [kg]
output RealOutputmC[Medium.nC]Trace substance mass of the component [kg]
input RealInputmWat_flowWater flow rate added into the medium [kg/s]
output RealOutputX_wSpecies composition of medium [kg/kg]
HeatPort_aheatPortHeat port for sensible plus latent heat exchange with the control volume
input RealInputC_flow[Medium.nC]Trace substance mass flow rate added to the medium

Modelica definition

model MixingVolumeMoistAir "Mixing volume with heat port for latent heat exchange, to be used if moisture is added or removed" extends Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume( dynBal( final use_mWat_flow = true, final use_C_flow = use_C_flow), steBal(final use_mWat_flow = true, final use_C_flow = use_C_flow), final initialize_p = not Medium.singleState); parameter Boolean use_C_flow = false "Set to true to enable input connector for trace substance"; Modelica.Blocks.Interfaces.RealInput mWat_flow(final quantity="MassFlowRate", final unit = "kg/s") "Water flow rate added into the medium"; Modelica.Blocks.Interfaces.RealOutput X_w(final unit="kg/kg") "Species composition of medium"; Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort( T(start=T_start)) "Heat port for sensible plus latent heat exchange with the control volume"; Modelica.Blocks.Interfaces.RealInput[Medium.nC] C_flow if use_C_flow "Trace substance mass flow rate added to the medium"; protected parameter Real s[Medium.nXi] = { if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i], string2="Water", caseSensitive=false) then 1 else 0 for i in 1:Medium.nXi} "Vector with zero everywhere except where species is"; Modelica.Blocks.Sources.RealExpression XLiq(y=s*Xi) "Species composition of the medium"; equation connect(mWat_flow, steBal.mWat_flow); connect(mWat_flow, dynBal.mWat_flow); connect(XLiq.y, X_w); connect(heaFloSen.port_a, heatPort); connect(C_flow, steBal.C_flow); connect(C_flow, dynBal.C_flow); end MixingVolumeMoistAir;