Buildings.Fluid.MixingVolumes.Validation

Collection of validation models

Information

This package contains validation models for the classes in Buildings.Fluid.MixingVolumes.

Note that most validation models contain simple input data which may not be realistic, but for which the correct output can be obtained through an analytic solution. The examples plot various outputs, which have been verified against these solutions. These model outputs are stored as reference data and used for continuous validation whenever models in the library change.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesAir CoupledVolumesAir Validation model for two coupled volumes with air
Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesGlycol47 CoupledVolumesGlycol47 Validation model for two coupled volumes with glycol
Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedAirPerfectGas CoupledVolumesSpecializedAirPerfectGas Validation model for two coupled volumes with air as a perfect gas
Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterConstantProperties_pT CoupledVolumesSpecializedWaterConstantProperties_pT Validation model for two coupled volumes with water with constant properties
Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterTemperatureDependentDensity CoupledVolumesSpecializedWaterTemperatureDependentDensity Validation model for two coupled volumes with water with temperature dependent density
Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater CoupledVolumesWater Validation model for two coupled volumes with water
Buildings.Fluid.MixingVolumes.Validation.MixingVolume MixingVolume Test model for mixing volumes
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeAdiabaticCooling MixingVolumeAdiabaticCooling Validation model for mixing volume with adiabatic cooling
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlow MixingVolumeHeatReverseFlow Validation model for mixing volume with heat input and flow reversal
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlowPrescribedHeatFlowRate MixingVolumeHeatReverseFlowPrescribedHeatFlowRate Validation model for mixing volume with heat input and flow reversal and prescribed heat flow rate
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeInitialization MixingVolumeInitialization Test model for mixing volume initialization
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMFactor MixingVolumeMFactor A check for verifying the implementation of the parameter mSenFac
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow MixingVolumeMassFlow Test model for mass flow into and out of volume
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlow MixingVolumeMoistureReverseFlow Validation model for mixing volume with moisture input and flow reversal
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate Validation model for mixing volume with moisture input and flow reversal and prescribed heat flow rate
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeSteadyStateMass MixingVolumeSteadyStateMass Test model for steady state mass dynamics
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstance MixingVolumeTraceSubstance Test model for mixing volume with trace substance input
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlow MixingVolumeTraceSubstanceReverseFlow Validation model for mixing volume with trace substance input and flow reversal
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate Validation model for mixing volume with trace substance input and flow reversal, and prescribed heat flow rate
Buildings.Fluid.MixingVolumes.Validation.MixingVolumeZeroFlow MixingVolumeZeroFlow Mixing volume verification around zero flow with heat exchange
Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationDynamicBalance MoistureMixingConservationDynamicBalance This test checks if mass and energy is conserved when mixing fluid streams using dynamic balances
Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationSteadyState MoistureMixingConservationSteadyState This test checks if mass and energy is conserved when mixing fluid streams using steady state balances
Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationDynamicBalance TraceSubstanceConservationDynamicBalance This test checks if trace substance mass flow rates are conserved when a dynamic balance is used
Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationSteadyState TraceSubstanceConservationSteadyState This test checks if trace substance mass flow rates are conserved when steady state
Buildings.Fluid.MixingVolumes.Validation.BaseClasses BaseClasses Baseclasses package

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesAir Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesAir

Validation model for two coupled volumes with air

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesAir

Information

Validation model for two directly coupled volumes.

This tests whether a Modelica translator can perform the index reduction.

Extends from Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater (Validation model for two coupled volumes with water).

Parameters

TypeNameDefaultDescription
replaceable package MediumWaterMedium model

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model CoupledVolumesAir "Validation model for two coupled volumes with air" extends Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater( redeclare package Medium = Buildings.Media.Air); end CoupledVolumesAir;

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesGlycol47 Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesGlycol47

Validation model for two coupled volumes with glycol

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesGlycol47

Information

Validation model for two directly coupled volumes.

This tests whether a Modelica translator can perform the index reduction.

Extends from Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater (Validation model for two coupled volumes with water).

Parameters

TypeNameDefaultDescription
replaceable package MediumWaterMedium model

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model CoupledVolumesGlycol47 "Validation model for two coupled volumes with glycol" extends Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater( redeclare package Medium = Modelica.Media.Incompressible.Examples.Glycol47); end CoupledVolumesGlycol47;

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedAirPerfectGas Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedAirPerfectGas

Validation model for two coupled volumes with air as a perfect gas

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedAirPerfectGas

Information

Validation model for two directly coupled volumes.

This tests whether a Modelica translator can perform the index reduction.

Extends from Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater (Validation model for two coupled volumes with water).

Parameters

TypeNameDefaultDescription
replaceable package MediumWaterMedium model

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model CoupledVolumesSpecializedAirPerfectGas "Validation model for two coupled volumes with air as a perfect gas" extends Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater( redeclare package Medium = Buildings.Media.Specialized.Air.PerfectGas); end CoupledVolumesSpecializedAirPerfectGas;

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterConstantProperties_pT Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterConstantProperties_pT

Validation model for two coupled volumes with water with constant properties

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterConstantProperties_pT

Information

Validation model for two directly coupled volumes.

This tests whether a Modelica translator can perform the index reduction.

Extends from Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater (Validation model for two coupled volumes with water).

Parameters

TypeNameDefaultDescription
replaceable package MediumWaterMedium model

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model CoupledVolumesSpecializedWaterConstantProperties_pT "Validation model for two coupled volumes with water with constant properties" extends Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater( redeclare package Medium = Buildings.Media.Specialized.Water.ConstantProperties_pT); end CoupledVolumesSpecializedWaterConstantProperties_pT;

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterTemperatureDependentDensity Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterTemperatureDependentDensity

Validation model for two coupled volumes with water with temperature dependent density

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesSpecializedWaterTemperatureDependentDensity

Information

Validation model for two directly coupled volumes.

This tests whether a Modelica translator can perform the index reduction.

Extends from Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater (Validation model for two coupled volumes with water).

Parameters

TypeNameDefaultDescription
replaceable package MediumWaterMedium model

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model CoupledVolumesSpecializedWaterTemperatureDependentDensity "Validation model for two coupled volumes with water with temperature dependent density" extends Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater( redeclare package Medium = Buildings.Media.Specialized.Water.TemperatureDependentDensity); end CoupledVolumesSpecializedWaterTemperatureDependentDensity;

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater

Validation model for two coupled volumes with water

Buildings.Fluid.MixingVolumes.Validation.CoupledVolumesWater

Information

Validation model for two directly coupled volumes.

This tests whether a Modelica translator can perform the index reduction.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.WaterMedium model

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model CoupledVolumesWater "Validation model for two coupled volumes with water" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water constrainedby Modelica.Media.Interfaces.PartialMedium "Medium model"; Buildings.Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, nPorts=2, m_flow_nominal=1, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Buildings.Fluid.MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, m_flow_nominal=1, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts=1); Buildings.Fluid.Sources.Boundary_pT bou( redeclare package Medium = Medium, nPorts=1) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.PressureDrop res( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=100) "Resistance to decouple initialization of pressure state"; equation connect(bou.ports[1], res.port_a); connect(res.port_b, vol.ports[1]); connect(vol.ports[2], vol1.ports[1]); end CoupledVolumesWater;

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

Test model for mixing volumes

Buildings.Fluid.MixingVolumes.Validation.MixingVolume

Information

This model tests the implementation of the mixing volumes. It compares the results from the mixing volume of the Modelica Standard Library with the implementation in the Buildings library.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MixingVolume "Test model for mixing volumes" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp P( duration=0.5, startTime=0.5, height=-10, offset=101330); Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=293.15, use_p_in=true, nPorts=3); Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=3, use_p_in=false, p=101325, T=283.15); Buildings.Fluid.FixedResistances.PressureDrop res1( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=2, dp_nominal=2.5); MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=0.1, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, m_flow_nominal=2); Buildings.Fluid.FixedResistances.PressureDrop res2( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=2, dp_nominal=2.5); Buildings.Fluid.FixedResistances.PressureDrop res11( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=2, dp_nominal=2.5); Buildings.Fluid.FixedResistances.PressureDrop res12( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=2, dp_nominal=2.5); Modelica.Fluid.Vessels.ClosedVolume vol( redeclare package Medium = Medium, V=0.1, nPorts=2, h_start=45300.945, use_portsData=false, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Buildings.Utilities.Diagnostics.CheckEquality cheEqu1 "Check for equality of results"; Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat( redeclare package Medium = Medium, m_flow_nominal=2) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat1( redeclare package Medium = Medium, m_flow_nominal=2) "Enthalpy flow rate"; Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol2( redeclare package Medium = Medium, V=0.1, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, m_flow_nominal=2); Buildings.Fluid.FixedResistances.PressureDrop res21( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=2, dp_nominal=2.5); Buildings.Fluid.FixedResistances.PressureDrop res22( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=2, dp_nominal=2.5); Buildings.Utilities.Diagnostics.CheckEquality cheEqu2 "Check for equality of results"; Buildings.Fluid.Sensors.EnthalpyFlowRate entFloRat2( redeclare package Medium = Medium, m_flow_nominal=2) "Enthalpy flow rate"; Modelica.Blocks.Sources.Constant zero(k=0); inner Modelica.Fluid.System system; equation connect(P.y, sou.p_in); connect(res2.port_a, entFloRat.port_b); connect(entFloRat2.H_flow, cheEqu2.u2); connect(zero.y, vol2.mWat_flow); connect(sou.ports[1], res1.port_a); connect(sou.ports[2], res11.port_a); connect(sou.ports[3], res21.port_a); connect(sin.ports[1], res2.port_b); connect(sin.ports[2], res12.port_b); connect(res22.port_b, sin.ports[3]); connect(res1.port_b, vol.ports[1]); connect(vol.ports[2], entFloRat.port_a); connect(res11.port_b, vol1.ports[1]); connect(vol1.ports[2], entFloRat1.port_a); connect(res21.port_b, vol2.ports[1]); connect(vol2.ports[2], entFloRat2.port_a); connect(entFloRat2.port_b, res22.port_a); connect(entFloRat1.port_b, res12.port_a); connect(entFloRat.H_flow, cheEqu1.u1); connect(entFloRat.H_flow, cheEqu2.u1); connect(entFloRat1.H_flow, cheEqu1.u2); end MixingVolume;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeAdiabaticCooling Buildings.Fluid.MixingVolumes.Validation.MixingVolumeAdiabaticCooling

Validation model for mixing volume with adiabatic cooling

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeAdiabaticCooling

Information

This model validates the use of the mixing volume with adiabatic cooling. Water in liquid form at room temperature is added to the volume, which decreases its temperature. The instance volSim uses a simplified implementation of the mass balance that ignores the mass of the water added to the volume, whereas the instance volExa uses the exact formulation. The output of the instance relErr shows that the relative error on the temperature difference between these two options is less than 0.1%.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MixingVolumeAdiabaticCooling "Validation model for mixing volume with adiabatic cooling" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; MixingVolumeMoistAir volSim( redeclare package Medium = Medium, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, m_flow_nominal=1, V=1, final simplify_mWat_flow=true, nPorts=1) "Mixing volume with water vapor input and simplified water balance"; MixingVolumeMoistAir volExa( redeclare package Medium = Medium, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, m_flow_nominal=1, V=1, final simplify_mWat_flow=false, nPorts=1) "Mixing volume with water vapor input and exact water balance"; Modelica.Blocks.Sources.Constant mWatFlo(k=0.001) "Water mass flow rate "; Modelica.Blocks.Sources.RealExpression relErr( y=(volSim.heatPort.T - 20) /(if abs(volExa.heatPort.T - 20) < 1E-5 then 1 else (volExa.heatPort.T - 20))) "Relative error in the temperature difference"; Sources.FixedBoundary bou(redeclare package Medium = Medium, nPorts=2) "Fixed pressure boundary condition"; equation connect(volSim.mWat_flow, mWatFlo.y); connect(volExa.mWat_flow, mWatFlo.y); connect(bou.ports[1], volSim.ports[1]); connect(bou.ports[2], volExa.ports[1]); end MixingVolumeAdiabaticCooling;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlow Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlow

Validation model for mixing volume with heat input and flow reversal

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlow

Information

This model validates the use of the mixing volume with air flowing into and out of the volume and sensible heat added to the volume.

The model volDyn uses a dynamic balance, whereas the model volSte uses a steady-state balance. The mass flow rate starts positive and reverses its direction at t=5 seconds.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow (Test model for mixing volume with flow reversal).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal2.0Nominal mass flow rate [kg/s]
MixingVolumevolDynredeclare Buildings.Fluid.Mi...Volume with dynamic balance
MixingVolumevolSteredeclare Buildings.Fluid.Mi...Volume with steady-state balance

Modelica definition

model MixingVolumeHeatReverseFlow "Validation model for mixing volume with heat input and flow reversal" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow ( gain(k=10)); Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaDyn "Prescribed heat flow rate"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaSte "Prescribed heat flow rate"; equation connect(gain.y, preHeaDyn.Q_flow); connect(gain.y, preHeaSte.Q_flow); connect(preHeaDyn.port, volDyn.heatPort); connect(preHeaSte.port, volSte.heatPort); end MixingVolumeHeatReverseFlow;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlowPrescribedHeatFlowRate Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlowPrescribedHeatFlowRate

Validation model for mixing volume with heat input and flow reversal and prescribed heat flow rate

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlowPrescribedHeatFlowRate

Information

This model is identical to Buildings.Fluid.MixingVolumes.Validation.MixingVolumeHeatReverseFlow, except that the steady state volume volSte is configured to have a prescribed heat flow rate, which is in this case zero as the heat port is not connected. This configures volSte to use the two port steady state heat and mass balance model Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation.

Extends from MixingVolumeHeatReverseFlow (Validation model for mixing volume with heat input and flow reversal).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal2.0Nominal mass flow rate [kg/s]
MixingVolumevolDynredeclare Buildings.Fluid.Mi...Volume with dynamic balance
MixingVolumevolSteredeclare Buildings.Fluid.Mi...Volume with steady-state balance

Modelica definition

model MixingVolumeHeatReverseFlowPrescribedHeatFlowRate "Validation model for mixing volume with heat input and flow reversal and prescribed heat flow rate" extends MixingVolumeHeatReverseFlow( prescribedHeatFlowRate=true); end MixingVolumeHeatReverseFlowPrescribedHeatFlowRate;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeInitialization Buildings.Fluid.MixingVolumes.Validation.MixingVolumeInitialization

Test model for mixing volume initialization

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeInitialization

Information

This model tests the initialization of the mixing volume.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MixingVolumeInitialization "Test model for mixing volume initialization" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Buildings.Fluid.Sources.Boundary_pT sou1(redeclare package Medium = Medium, p=101330, nPorts=1, T=293.15); Buildings.Fluid.Sources.Boundary_pT sin1(redeclare package Medium = Medium, p=101320, nPorts=1, T=293.15); Modelica.Fluid.Pipes.StaticPipe pipe1( redeclare package Medium = Medium, length=1, diameter=0.25, flowModel(m_flow_nominal=2)); Modelica.Fluid.Pipes.StaticPipe pipe2( redeclare package Medium = Medium, length=1, diameter=0.25, flowModel(m_flow_nominal=2)); MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=0.1, nPorts=2, m_flow_nominal=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); inner Modelica.Fluid.System system; equation connect(sou1.ports[1], pipe1.port_a); connect(pipe1.port_b, vol1.ports[1]); connect(vol1.ports[2], pipe2.port_a); connect(pipe2.port_b, sin1.ports[1]); end MixingVolumeInitialization;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMFactor Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMFactor

A check for verifying the implementation of the parameter mSenFac

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMFactor

Information

This model contains two verifications for the implementation of mSenFac:

  1. The mixingVolume temperature vol.T should be constant. This is to check the correct implementation of the parameter mSenFac for moist air media.
  2. The temperature response of volMFactor.T and vol1.T should be nearly identical. Furthermore the response of the species concentration Xi demonstrates the difference between using an mSenFac = 10 and multiplying volume by 10.

See Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow for the rational of the selected initial conditions for the volumes.

Extends from Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow (Test model for mass flow into and out of volume).

Parameters

TypeNameDefaultDescription
PressureDifferencedp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal0.5Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeMFactor "A check for verifying the implementation of the parameter mSenFac" extends Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow( sou(X={0.02,0.98}, T=Medium.T_default), vol(mSenFac=10), bou(nPorts=3)); Buildings.Fluid.MixingVolumes.MixingVolume volMFactor( redeclare package Medium = Medium, mSenFac=10, V=1, nPorts=2, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Mixing volume using mSenFac = 10"; Buildings.Fluid.MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=10, nPorts=2, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "MixingVolume with V = 10 instead of mSenFac = 10"; Buildings.Fluid.Sources.MassFlowSource_T boundaryMFactor( redeclare package Medium = Medium, T=300, nPorts=1, m_flow=1, X={0.02,0.98}) "Flow source for mixing volume using mSenFac"; Buildings.Fluid.Sources.MassFlowSource_T boundary( redeclare package Medium = Medium, T=300, nPorts=1, m_flow=1, X={0.02,0.98}) "Flow source for mixing volume using larger volume"; equation connect(boundaryMFactor.ports[1],volMFactor. ports[1]); connect(boundary.ports[1], vol1.ports[1]); connect(bou.ports[2], volMFactor.ports[2]); connect(bou.ports[3], vol1.ports[2]); end MixingVolumeMFactor;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow

Test model for mass flow into and out of volume

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow

Information

This model demonstrates the use of the mixing volume with air flowing into and out of the volume.

The initial conditions for the volume is declared as fixed initial values for the energy dynamics, but free initial conditions for the mass dynamics. The reason for leaving the initial conditions unspecified for the mass dynamics is that the sink bou declares the pressure of the fluid. As there is no flow resistance between that boundary condition and the volume, the volume has the same pressure. Therefore, specifying an initial condition for the mass dynamics would yield to an overspecified initial value problem for the pressure of the medium.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
PressureDifferencedp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal0.5Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeMassFlow "Test model for mass flow into and out of volume" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; parameter Modelica.SIunits.PressureDifference dp_nominal = 10 "Nominal pressure drop"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 0.5 "Nominal mass flow rate"; Modelica.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=false, m_flow=m_flow_nominal, T=313.15) "Flow source and sink"; Sources.Boundary_pT bou( redeclare package Medium = Medium, T=303.15, nPorts=1) "Boundary condition"; Buildings.Fluid.MixingVolumes.MixingVolume vol( V=1, redeclare package Medium = Medium, nPorts=2, allowFlowReversal=false, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial); equation connect(sou.ports[1], vol.ports[1]); connect(bou.ports[1], vol.ports[2]); end MixingVolumeMassFlow;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlow Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlow

Validation model for mixing volume with moisture input and flow reversal

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlow

Information

This model validates the use of the mixing volume with air flowing into and out of the volume and moisture added to the volume.

The model volDyn uses a dynamic balance, whereas the model volSte uses a steady-state balance. The mass flow rate starts positive and reverses its direction at t=5 seconds.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow (Test model for mixing volume with flow reversal).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal2.0Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeMoistureReverseFlow "Validation model for mixing volume with moisture input and flow reversal" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow ( gain(k=0.005), redeclare MixingVolumeMoistAir volDyn, redeclare MixingVolumeMoistAir volSte); equation connect(volDyn.mWat_flow, gain.y); connect(gain.y, volSte.mWat_flow); end MixingVolumeMoistureReverseFlow;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate

Validation model for mixing volume with moisture input and flow reversal and prescribed heat flow rate

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate

Information

This model is identical to Buildings.Fluid.MixingVolumes.Validation.MixingVolumeMoistureReverseFlow, except that the steady state volume volSte is configured to have a prescribed heat flow rate, which is in this case zero as the heat port is not connected. This configures volSte to use the two port steady state heat and mass balance model Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation.

Extends from MixingVolumeMoistureReverseFlow (Validation model for mixing volume with moisture input and flow reversal).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal2.0Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate "Validation model for mixing volume with moisture input and flow reversal and prescribed heat flow rate" extends MixingVolumeMoistureReverseFlow( prescribedHeatFlowRate=true); end MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeSteadyStateMass Buildings.Fluid.MixingVolumes.Validation.MixingVolumeSteadyStateMass

Test model for steady state mass dynamics

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeSteadyStateMass

Information

This model shows that steady state mass dynamics are correctly simulated. A change in pressure does not lead to an exchange and/or creation of mass. The mixing volume temperature is also unaffected by a pressure change.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MixingVolumeSteadyStateMass "Test model for steady state mass dynamics" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Sources.MassFlowSource_T sou( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1) "Flow source and sink"; Sources.Boundary_pT bou( redeclare package Medium = Medium, nPorts=1) "Boundary condition"; Buildings.Fluid.MixingVolumes.MixingVolume vol( V=1, redeclare package Medium = Medium, m_flow_nominal=0.01, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=true, nPorts=2, mSenFac=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume with steady state mass dynamics"; Modelica.Blocks.Sources.Ramp ramp( duration=1, offset=1, height=-2) "Ramp input"; Modelica.Blocks.Math.Gain gain(k=0.01) "Gain for nominal mass flow rate"; FixedResistances.PressureDrop res( redeclare package Medium = Medium, m_flow_nominal=0.01, dp_nominal=1000) "Pressure drop"; equation connect(ramp.y, gain.u); connect(gain.y, sou.m_flow_in); connect(sou.ports[1], vol.ports[1]); connect(vol.ports[2], res.port_a); connect(res.port_b, bou.ports[1]); end MixingVolumeSteadyStateMass;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstance Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstance

Test model for mixing volume with trace substance input

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstance

Information

This model demonstrates the use of the mixing volume with air flowing into and out of the volume and trace substances added to the volume.

The model volDyn uses a dynamic balance, whereas the model volSte uses a steady-state balance.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal0.5Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeTraceSubstance "Test model for mixing volume with trace substance input" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}) "Medium model"; parameter Modelica.SIunits.Pressure dp_nominal = 10 "Nominal pressure drop"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 0.5 "Nominal mass flow rate"; Modelica.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=false, m_flow=m_flow_nominal, T=313.15) "Flow source and sink"; Sources.Boundary_pT bou( redeclare package Medium = Medium, T=303.15, nPorts=2) "Boundary condition"; Buildings.Fluid.MixingVolumes.MixingVolume volDyn( redeclare package Medium = Medium, V=1, nPorts=2, allowFlowReversal=false, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, use_C_flow=true) "Volume with dynamic balance"; Modelica.Blocks.Sources.Constant C_flow(k=m_flow_nominal/1000) "Trace substance mass flow rate"; Modelica.Fluid.Sources.MassFlowSource_T sou1( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=false, m_flow=m_flow_nominal, T=313.15) "Flow source and sink"; Buildings.Fluid.MixingVolumes.MixingVolume volSte( redeclare package Medium = Medium, V=1, nPorts=2, m_flow_nominal=m_flow_nominal, use_C_flow=true, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=false) "Volume with steady-state balance"; equation connect(sou.ports[1], volDyn.ports[1]); connect(C_flow.y, volDyn.C_flow[1]); connect(sou1.ports[1], volSte.ports[1]); connect(C_flow.y, volSte.C_flow[1]); connect(volSte.ports[2], bou.ports[1]); connect(volDyn.ports[2], bou.ports[2]); end MixingVolumeTraceSubstance;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlow Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlow

Validation model for mixing volume with trace substance input and flow reversal

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlow

Information

This model validates the use of the mixing volume with air flowing into and out of the volume and trace substances added to the volume.

The model volDyn uses a dynamic balance, whereas the model volSte uses a steady-state balance. The mass flow rate starts positive and reverses its direction at t=5 seconds.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow (Test model for mixing volume with flow reversal).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal2.0Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeTraceSubstanceReverseFlow "Validation model for mixing volume with trace substance input and flow reversal" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow ( Medium(extraPropertiesNames={"CO2"}), volDyn(use_C_flow=true), volSte(use_C_flow=true), gain(k=1/1000), bou(C={0.003})); equation connect(gain.y, volSte.C_flow[1]); connect(gain.y, volDyn.C_flow[1]); end MixingVolumeTraceSubstanceReverseFlow;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate

Validation model for mixing volume with trace substance input and flow reversal, and prescribed heat flow rate

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate

Information

This model is identical to Buildings.Fluid.MixingVolumes.Validation.MixingVolumeTraceSubstanceReverseFlow, except that the steady state volume volSte is configured to have a prescribed heat flow rate, which is in this case zero as the heat port is not connected. This configures volSte to use the two port steady state heat and mass balance model Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation.

Extends from MixingVolumeTraceSubstanceReverseFlow (Validation model for mixing volume with trace substance input and flow reversal).

Parameters

TypeNameDefaultDescription
Pressuredp_nominal10Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal2.0Nominal mass flow rate [kg/s]
MixingVolumevolDynvolDyn(use_C_flow=true)Volume with dynamic balance
MixingVolumevolStevolSte(use_C_flow=true)Volume with steady-state balance

Modelica definition

model MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate "Validation model for mixing volume with trace substance input and flow reversal, and prescribed heat flow rate" extends MixingVolumeTraceSubstanceReverseFlow( prescribedHeatFlowRate=true); end MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate;

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeZeroFlow Buildings.Fluid.MixingVolumes.Validation.MixingVolumeZeroFlow

Mixing volume verification around zero flow with heat exchange

Buildings.Fluid.MixingVolumes.Validation.MixingVolumeZeroFlow

Information

This model verifies whether the equations in Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation are consisent for all foreseeable cases. All MixingVolume instances contain the correct setting for prescribedHeatFlowRate. Switching the value will result in an error in each case. This error either is a non-physical solution to the (non-)linear system or a division by zero, which halts the simulation.

If you use Dymola, set Advanced.Define.AimForHighAccuracy = false to increase the chance of the error being produced for this simple example.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MixingVolumeZeroFlow "Mixing volume verification around zero flow with heat exchange" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.MixingVolumes.MixingVolume volNonLinSys( nPorts=2, redeclare package Medium = Medium, m_flow_nominal=1, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=false) "Steady state mixing volume requiring solution of non-linear system"; Buildings.Fluid.Sources.MassFlowSource_T sou2( nPorts=1, redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true) "Source"; Buildings.Fluid.Sources.Boundary_pT sin(nPorts=4, redeclare package Medium = Medium) "Sink"; Modelica.Blocks.Sources.Ramp ramp_m_flow( height=-1, duration=1, offset=1) "Mass flow rate ramp input"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea2 "Prescribed heat flow"; Modelica.Blocks.Sources.RealExpression reaExp(y=(290 - volNonLinSys.heatPort.T) /100*volNonLinSys.heatPort.T^(3/5)*time) "Non-linear thermal resistance equation"; Buildings.HeatTransfer.Sources.PrescribedTemperature preTem "Prescribed temperature"; Modelica.Blocks.Sources.Cosine cos1( freqHz=1, offset=283.15, amplitude=0.001) "Cosine input"; Buildings.Fluid.MixingVolumes.MixingVolume volT( nPorts=2, redeclare package Medium = Medium, m_flow_nominal=1, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=false) "Steady state mixing volume with prescribed temperature input"; Buildings.Fluid.Sources.MassFlowSource_T sou3( nPorts=1, redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true) "Source"; Buildings.Fluid.MixingVolumes.MixingVolume volLinSys( nPorts=2, redeclare package Medium = Medium, m_flow_nominal=1, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=false, prescribedHeatFlowRate=false) "Steady state mixing volume requiring solution of linear system"; Buildings.Fluid.Sources.MassFlowSource_T sou4( nPorts=1, redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true) "Source"; Modelica.Thermal.HeatTransfer.Components.ThermalResistor theRes(R=0.001) "Thermal resistor for creating linear system"; Modelica.Blocks.Sources.Ramp ramp_T( duration=2, offset=283.15, height=0) "Temperature ramp input"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea1 "Prescribed heat flow"; Buildings.Fluid.MixingVolumes.MixingVolume volQflow( nPorts=2, redeclare package Medium = Medium, m_flow_nominal=1, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=false, prescribedHeatFlowRate=true) "Steady state mixing volume with fixed heat flow rate input"; Buildings.Fluid.Sources.MassFlowSource_T sou1( nPorts=1, redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true) "Source"; Modelica.Blocks.Routing.RealPassThrough reaPasThr "Real pass through for unit conversion"; equation connect(sou2.ports[1], volNonLinSys.ports[1]); connect(volNonLinSys.ports[2], sin.ports[1]); connect(reaExp.y, preHea2.Q_flow); connect(preTem.T, cos1.y); connect(volT.ports[1],sou3. ports[1]); connect(volT.ports[2], sin.ports[2]); connect(volT.heatPort, preTem.port); connect(sou4.ports[1], volLinSys.ports[1]); connect(volLinSys.ports[2], sin.ports[3]); connect(theRes.port_a, volLinSys.heatPort); connect(theRes.port_b, preTem.port); connect(volNonLinSys.heatPort, preHea2.port); connect(volQflow.heatPort, preHea1.port); connect(sou1.ports[1], volQflow.ports[1]); connect(volQflow.ports[2], sin.ports[4]); connect(ramp_m_flow.y, sou1.m_flow_in); connect(ramp_m_flow.y, sou2.m_flow_in); connect(ramp_m_flow.y, sou3.m_flow_in); connect(ramp_m_flow.y, sou4.m_flow_in); connect(ramp_T.y, sou1.T_in); connect(ramp_T.y, sou2.T_in); connect(ramp_T.y, sou3.T_in); connect(ramp_T.y, sou4.T_in); connect(reaPasThr.y, preHea1.Q_flow); connect(reaPasThr.u, ramp_m_flow.y); end MixingVolumeZeroFlow;

Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationDynamicBalance Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationDynamicBalance

This test checks if mass and energy is conserved when mixing fluid streams using dynamic balances

Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationDynamicBalance

Information

This model verifies if mass and energy are conserved, using a dynamic balance. Two air streams with different mass flow rate are humidified by a mixing volume with two different vapor mass flow rates. These flows are then mixed. Boundary integrals are used to verify if air mass, vapour mass and internal energy are conserved.

Note, however, that there is some approximation error because in its default configuration, the conservation balance models simplify the treatment of the water that is added to the fluid. See Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation and Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation for a discussion.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation (Partial for checking conservation of mass for independent mass fraction).

Parameters

TypeNameDefaultDescription
Massm_start[3] Initial mass of the mixing volumes [kg]
InternalEnergyU_start[3] Initial energy of the mixing volumes [J]

Modelica definition

model MoistureMixingConservationDynamicBalance "This test checks if mass and energy is conserved when mixing fluid streams using dynamic balances" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation ( mWatFloSol(k={vol.X_start[1],vol1.X_start[1],vol2.X_start[1]}*m_start), vol(energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics= Modelica.Fluid.Types.Dynamics.FixedInitial), vol1(energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial), vol2(energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial), mFloSol(k=sum(m_start)), hSol(k=sum(U_start)), mWatFlo3(k=0)); parameter Modelica.SIunits.Mass[3] m_start(each fixed=false) "Initial mass of the mixing volumes"; parameter Modelica.SIunits.InternalEnergy[3] U_start(each fixed=false) "Initial energy of the mixing volumes"; Modelica.Blocks.Continuous.Integrator intMasFloVapIn( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integral of added vapour"; Modelica.Blocks.Math.Add3 add "Adder for injected water"; Modelica.Blocks.Sources.RealExpression masVapVol(y=vol.mXi[1] + vol1.mXi[1] + vol2.mXi[1]) "Vapour mass stored in mixing volumes"; Modelica.Blocks.Math.Add3 add3Vap(k3=-1) "Sum of vapour mass should be conserved"; Modelica.Blocks.Sources.RealExpression masVol(y=vol1.m + vol.m + vol2.m) "Mass stored in mixing volumes"; Modelica.Blocks.Continuous.Integrator intMasFloOut( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integral of leaving mass"; Modelica.Blocks.Math.Add3 add3Mass(k3=-1) "Adding 3 mass streams"; Modelica.Blocks.Continuous.Integrator intMasFloIn( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integral of added mass"; Modelica.Blocks.Sources.Constant masFloIn(k=sou1.m_flow + sou2.m_flow) "Added air mass flow rate"; Modelica.Blocks.Continuous.Integrator intEntOut( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integral of leaving enthalpy"; Modelica.Blocks.Continuous.Integrator intEntIn( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integral of added enthalpy"; Modelica.Blocks.Sources.RealExpression entVol(y=vol1.U + vol.U + vol2.U) "Energy stored in mixing volumes"; Modelica.Blocks.Math.Add3 add3Ent(k3=-1) "Adding 3 enthalpy streams"; Modelica.Blocks.Sources.Constant entIn( k=sou1.m_flow*sou1.h + sou2.m_flow*sou2.h) "Added enthalpy"; Modelica.Blocks.Math.Product pro "Water vapor flow rate"; Modelica.Blocks.Continuous.Integrator intMasVapOut( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integral of leaving vapor mass"; initial equation m_start = {vol.m, vol1.m,vol2.m}; U_start = {vol.U, vol1.U,vol2.U}; equation connect(add.u1, mWatFlo2.y); connect(add.u2, mWatFlo1.y); connect(add3Vap.y,cheMasFra.u2); connect(masVapVol.y,add3Vap. u2); connect(intMasFloVapIn.u, add.y); connect(intMasFloVapIn.y,add3Vap. u3); connect(senMasFlo.m_flow, intMasFloOut.u); connect(add3Mass.y,cheMasFlo.u2); connect(masVol.y, add3Mass.u2); connect(intMasFloIn.y, add3Mass.u3); connect(intMasFloIn.u, masFloIn.y); connect(add3Ent.y,cheSpeEnt.u2); connect(entVol.y, add3Ent.u2); connect(intEntIn.y, add3Ent.u3); connect(entIn.y, intEntIn.u); connect(add3Ent.u1, intEntOut.y); connect(intEntOut.u, senSpeEnt.H_flow); connect(add.u3, mWatFlo3.y); connect(pro.u1, senMasFra.X); connect(pro.u2, senMasFlo.m_flow); connect(intMasVapOut.y, add3Vap.u1); connect(intMasVapOut.u, pro.y); connect(add3Mass.u1, intMasFloOut.y); end MoistureMixingConservationDynamicBalance;

Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationSteadyState Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationSteadyState

This test checks if mass and energy is conserved when mixing fluid streams using steady state balances

Buildings.Fluid.MixingVolumes.Validation.MoistureMixingConservationSteadyState

Information

This test checks if water vapour mass is conserved. Two air streams with different mass flow rate are humidified by a mixing volume with two different vapor mass flow rates. These flows are then mixed. Afterwards the added water is removed again. The final water concentration, mass flow rate and enthalpy flow rate should then be equal to the initial values.

Note, however, that there is some approximation error because in its default configuration, the conservation balance models simplify the treatment of the water that is added to the fluid. See Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation and Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation for a discussion.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation (Partial for checking conservation of mass for independent mass fraction).

Modelica definition

model MoistureMixingConservationSteadyState "This test checks if mass and energy is conserved when mixing fluid streams using steady state balances" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation ( mWatFloSol(k=0), mFloSol(k=sou1.m_flow + sou2.m_flow), hSol(k=Medium.h_default*(sou1.m_flow + sou2.m_flow))); equation connect(cheMasFra.u2, senMasFra.X); connect(cheMasFlo.u2, senMasFlo.m_flow); connect(cheSpeEnt.u2, senSpeEnt.H_flow); end MoistureMixingConservationSteadyState;

Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationDynamicBalance Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationDynamicBalance

This test checks if trace substance mass flow rates are conserved when a dynamic balance is used

Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationDynamicBalance

Information

This test checks if the trace substance flow rate is conserved when adding moisture to a mixing volume that is configured to steady state.
The trace substance flow rate at the inlet and outlet should be equal since the trace substance concentration should not be affected by the independent mass fraction concentration.

Note, however, that there is some approximation error because in its default configuration, the conservation balance models simplify the treatment of the water that is added to the fluid. See Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation and Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation for a discussion.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation (This test checks if trace substance mass flow rates are conserved).

Modelica definition

model TraceSubstanceConservationDynamicBalance "This test checks if trace substance mass flow rates are conserved when a dynamic balance is used" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation (vol(massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)); Modelica.Blocks.Continuous.Integrator intTraSubIn( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integrator for trace substance inlet"; Modelica.Blocks.Continuous.Integrator intTraSubOut( k=1, initType=Modelica.Blocks.Types.Init.InitialState, y_start=0) "Integrator for trace substance outlet"; Modelica.Blocks.Sources.RealExpression reaExp(y=vol.m*vol.C[1]) "Mixing volume total species mass"; Modelica.Blocks.Math.Add cheConMas(k2=-1) "Check for conservation of mass"; Modelica.Blocks.Math.Add3 add3( k1=-1, k2=+1, k3=-1) "Conservation of mass"; Modelica.Blocks.Sources.Constant zero(k=0) "Zero input"; equation connect(reaExp.y, add3.u3); connect(intTraSubIn.y, add3.u2); connect(intTraSubOut.y, add3.u1); connect(add3.y, cheConMas.u1); connect(zero.y, cheConMas.u2); connect(intTraSubIn.u, CfloIn.y); connect(CfloOut.y, intTraSubOut.u); end TraceSubstanceConservationDynamicBalance;

Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationSteadyState Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationSteadyState

This test checks if trace substance mass flow rates are conserved when steady state

Buildings.Fluid.MixingVolumes.Validation.TraceSubstanceConservationSteadyState

Information

This test checks if the trace substance flow rate is conserved when adding moisture to a mixing volume that is configured to steady state.
The trace substance flow rate at the inlet and outlet should be equal since the trace substance concentration should not be affected by the independent mass fraction concentration.

Note, however, that there is some approximation error because in its default configuration, the conservation balance models simplify the treatment of the water that is added to the fluid. See Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation and Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation for a discussion.

Extends from Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation (This test checks if trace substance mass flow rates are conserved).

Modelica definition

model TraceSubstanceConservationSteadyState "This test checks if trace substance mass flow rates are conserved when steady state" extends Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation (sou(X={0,1})); Modelica.Blocks.Math.Add cheEquTra2(k2=-1) "Check for equality of trace substances"; Modelica.Blocks.Math.Add cheEquTra1(k2=-1) "Check for equality of trace substances"; Modelica.Blocks.Sources.Constant const(k=sou.m_flow*sou.C[1]) "Set point of trace substance concentration"; equation connect(const.y,cheEquTra1. u1); connect(cheEquTra1.u2, CfloIn.y); connect(cheEquTra2.u2, CfloIn.y); connect(cheEquTra2.u1, CfloOut.y); end TraceSubstanceConservationSteadyState;