LBL logo

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

NameDescription
Buildings.Fluid.MixingVolumes.MixingVolume MixingVolume Mixing volume with inlet and outlet ports (flow reversal is allowed)
Buildings.Fluid.MixingVolumes.MixingVolumeDryAir MixingVolumeDryAir Mixing volume with heat port for latent heat exchange, to be used with dry air
Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir MixingVolumeMoistAir Mixing volume with heat port for latent heat exchange, to be used with media that contain water
Buildings.Fluid.MixingVolumes.Examples Examples Collection of models that illustrate model use and test 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 parameter prescribedHeatFlowRate can be set by the user. This parameter 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:

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 simple models that uses this model, see Buildings.Fluid.HeatExchangers.HeaterCoolerPrescribed and Buildings.Fluid.MassExchangers.HumidifierPrescribed.

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...Formulation of energy balance
DynamicsmassDynamicsenergyDynamicsFormulation of mass balance
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
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal in medium, false restricts to design direction (ports[1] -> ports[2]). Used only if model has two ports.
Heat transfer
BooleanprescribedHeatFlowRatefalseSet to true if the model has a prescribed heat flow at its heatPort

Connectors

TypeNameDescription
VesselFluidPorts_bports[nPorts]Fluid inlets and outlets
HeatPort_aheatPortHeat port connected to outflowing medium

Modelica definition

model MixingVolume 
  "Mixing volume with inlet and outlet ports (flow reversal is allowed)"
  extends Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume;
protected 
  Modelica.Blocks.Sources.Constant       masExc[Medium.nXi](k=zeros(Medium.nXi)) if 
       Medium.nXi > 0 "Block to set mass exchange in volume";
  Modelica.Blocks.Sources.RealExpression heaInp(y=heatPort.Q_flow) 
    "Block to set heat input into volume";
equation 
  connect(heaInp.y, steBal.Q_flow);
  connect(heaInp.y, dynBal.Q_flow);
  connect(masExc.y, steBal.mXi_flow);
  connect(masExc.y, dynBal.mXi_flow);
end MixingVolume;

Buildings.Fluid.MixingVolumes.MixingVolumeDryAir Buildings.Fluid.MixingVolumes.MixingVolumeDryAir

Mixing volume with heat port for latent heat exchange, to be used with dry air

Buildings.Fluid.MixingVolumes.MixingVolumeDryAir

Information

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

This model has the same ports as Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir. However, there is no mass exchange with the medium other than through the port ports.

For media that do provide water as a species, use the model Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir to add or subtract moisture using a signal that is connected to the port mWat_flow and TWat.

Extends from BaseClasses.PartialMixingVolumeWaterPort (Partial mixing volume that allows adding or subtracting water vapor).

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...Formulation of energy balance
DynamicsmassDynamicsenergyDynamicsFormulation of mass balance
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
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal in medium, false restricts to design direction (ports[1] -> ports[2]). Used only if model has two ports.
Heat transfer
BooleanprescribedHeatFlowRatefalseSet to true if the model has a prescribed heat flow at its heatPort

Connectors

TypeNameDescription
VesselFluidPorts_bports[nPorts]Fluid inlets and outlets
HeatPort_aheatPortHeat port connected to outflowing medium
input RealInputmWat_flowWater flow rate added into the medium [kg/s]
input RealInputTWatTemperature of liquid that is drained from or injected into volume [K]
output RealOutputX_wSpecies composition of medium

Modelica definition

model MixingVolumeDryAir 
  "Mixing volume with heat port for latent heat exchange, to be used with dry air"
  extends BaseClasses.PartialMixingVolumeWaterPort(
    steBal(final sensibleOnly = true));

protected 
  Modelica.Blocks.Sources.Constant
    masExc[Medium.nXi](k=zeros(Medium.nXi)) if 
       Medium.nXi > 0 "Block to set mass exchange in volume";
  Modelica.Blocks.Sources.RealExpression heaInp(y=heatPort.Q_flow) 
    "Block to set heat input into volume";
equation 
  HWat_flow = 0;
  mXi_flow  = zeros(Medium.nXi);
// Assign output port
  X_w = 0;
  connect(heaInp.y, steBal.Q_flow);
  connect(masExc.y, steBal.mXi_flow);
  connect(heaInp.y, dynBal.Q_flow);
  connect(masExc.y, dynBal.mXi_flow);
end MixingVolumeDryAir;

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

Mixing volume with heat port for latent heat exchange, to be used with media that contain water

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 in liquid phase. The mass flow rate of the added or subtracted water is specified at the port mWat_flow. The water flow rate is assumed to be added or subtracted at the temperature of the input port TWat. Adding water causes a change in enthalpy and species concentration in the volume.

Note that this model can only be used with medium models that include water as a substance. In particular, the medium model needs to implement the function enthalpyOfLiquid(T) and the integer variable Water that contains the index to the water substance. For medium that do not provide this functionality, use Buildings.Fluid.MixingVolumes.MixingVolumeDryAir.

Extends from BaseClasses.PartialMixingVolumeWaterPort (Partial mixing volume that allows adding or subtracting water vapor).

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...Formulation of energy balance
DynamicsmassDynamicsenergyDynamicsFormulation of mass balance
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
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal in medium, false restricts to design direction (ports[1] -> ports[2]). Used only if model has two ports.
Heat transfer
BooleanprescribedHeatFlowRatefalseSet to true if the model has a prescribed heat flow at its heatPort

Connectors

TypeNameDescription
VesselFluidPorts_bports[nPorts]Fluid inlets and outlets
HeatPort_aheatPortHeat port connected to outflowing medium
input RealInputmWat_flowWater flow rate added into the medium [kg/s]
input RealInputTWatTemperature of liquid that is drained from or injected into volume [K]
output RealOutputX_wSpecies composition of medium
replaceable package Medium 

Modelica definition

model MixingVolumeMoistAir 
  "Mixing volume with heat port for latent heat exchange, to be used with media that contain water"
  extends BaseClasses.PartialMixingVolumeWaterPort(
    steBal(final sensibleOnly = false));
  // redeclare Medium with a more restricting base class. This improves the error
  // message if a user selects a medium that does not contain the function
  // enthalpyOfLiquid(.)
  replaceable package Medium = Modelica.Media.Interfaces.PartialCondensingGases;

protected 
  parameter Integer i_w(min=1, fixed=false) "Index for water substance";
  parameter Real s[Medium.nXi](each fixed=false) 
    "Vector with zero everywhere except where species is";

protected 
  Modelica.Blocks.Sources.RealExpression
    masExc[Medium.nXi](y=mXi_flow) if 
       Medium.nXi > 0 "Block to set mass exchange in volume";
  Modelica.Blocks.Sources.RealExpression heaInp(y=heatPort.Q_flow + HWat_flow) 
    "Block to set heat input into volume";
initial algorithm 
  i_w:= -1;
  for i in 1:Medium.nXi loop
      if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i],
                                            string2="Water",
                                            caseSensitive=false) then
      i_w := i;
      s[i] :=1;
    else
      s[i] :=0;
    end if;
   end for;
    assert(i_w > 0, "Substance 'water' is not present in medium '"
         + Medium.mediumName + "'.\n"
         + "Check medium model.");

equation 
  HWat_flow = mWat_flow * Medium.enthalpyOfLiquid(TWat);
  // We obtain the substance concentration with a vector multiplication
  // because Dymola 7.4 cannot find the derivative in the model
  // Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPControl
  // if we set mXi_flow[i] = if ( i == i_w) then mWat_flow else 0;
    mXi_flow = mWat_flow * s;
// Medium species concentration
  X_w = s * Xi;

  connect(heaInp.y, steBal.Q_flow);
  connect(masExc.y, steBal.mXi_flow);
  connect(heaInp.y, dynBal.Q_flow);
  connect(masExc.y, dynBal.mXi_flow);
end MixingVolumeMoistAir;

Automatically generated Wed May 15 11:56:19 2013.