Buildings.Fluid.MixingVolumes.Validation.BaseClasses

Baseclasses package

Information

This package contains base classes that are used to construct the models in Buildings.Fluid.MixingVolumes.Validation.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow MixingVolumeReverseFlow Test model for mixing volume with flow reversal
Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation MoistureMixingConservation Partial for checking conservation of mass for independent mass fraction
Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation TraceSubstanceConservation This test checks if trace substance mass flow rates are conserved

Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow

Test model for mixing volume with flow reversal

Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow

Information

This model is the base class to validate the mixing volume with air flowing into and out of the volume and heat, moisture or trace substance 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 Modelica.Icons.Example (Icon for runnable examples).

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

partial model MixingVolumeReverseFlow "Test model for mixing volume with flow reversal" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; constant Boolean prescribedHeatFlowRate = false "Flag that affects what steady state balance is used in the volume"; parameter Modelica.SIunits.Pressure dp_nominal = 10 "Nominal pressure drop"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 2.0 "Nominal mass flow rate"; Modelica.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, nPorts=1, m_flow=m_flow_nominal, use_m_flow_in=true, T=313.15) "Flow source and sink"; Sources.Boundary_pT bou( redeclare package Medium = Medium, T=303.15, nPorts=2) "Boundary condition"; replaceable Buildings.Fluid.MixingVolumes.MixingVolume volDyn constrainedby Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume( redeclare package Medium = Medium, V=1, nPorts=2, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Volume with dynamic balance"; replaceable Buildings.Fluid.MixingVolumes.MixingVolume volSte constrainedby Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume( redeclare package Medium = Medium, final prescribedHeatFlowRate = prescribedHeatFlowRate, V=1, nPorts=2, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Volume with steady-state balance"; Modelica.Blocks.Math.Gain gain "Gain to add heat, moisture or trace substance flow rate"; Modelica.Fluid.Sources.MassFlowSource_T sou1( redeclare package Medium = Medium, nPorts=1, m_flow=m_flow_nominal, use_m_flow_in=true, T=313.15) "Flow source and sink"; Modelica.Blocks.Sources.Ramp m_flow( height=-2*m_flow_nominal, duration=10, offset=m_flow_nominal) "Mass flow rate"; equation connect(sou.ports[1], volDyn.ports[1]); connect(sou1.ports[1], volSte.ports[1]); connect(volSte.ports[2], bou.ports[1]); connect(volDyn.ports[2], bou.ports[2]); connect(sou.m_flow_in, m_flow.y); connect(m_flow.y, sou1.m_flow_in); connect(m_flow.y, gain.u); end MixingVolumeReverseFlow;

Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation

Partial for checking conservation of mass for independent mass fraction

Buildings.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation

Information

This is a partial model that is used in the validation tests of the mixing volume.

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

Modelica definition

partial model MoistureMixingConservation "Partial for checking conservation of mass for independent mass fraction" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.MassFlowSource_h sou1( redeclare package Medium = Medium, nPorts=1, m_flow=2, X={0,1}) "Air source"; Buildings.Fluid.Sources.MassFlowSource_h sou2( redeclare package Medium = Medium, nPorts=1, m_flow=1, X={0,1}) "Air source"; Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol( redeclare package Medium = Medium, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, m_flow_nominal=1, V=1, nPorts=2, allowFlowReversal=false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Mixing volume for adding water"; Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol1( redeclare package Medium = Medium, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, m_flow_nominal=1, V=1, nPorts=2, allowFlowReversal=false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Mixing volume for adding water"; Buildings.Fluid.Sources.Boundary_pT sin(redeclare package Medium = Medium, nPorts=1) "Air sink"; Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol2( redeclare package Medium = Medium, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, m_flow_nominal=1, V=1, nPorts=2, allowFlowReversal=false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Mixing volume for removing water"; Modelica.Blocks.Sources.Constant mWatFlo1(k=0.001) "Water mass flow rate 1"; Modelica.Blocks.Sources.Constant TWat(k=273.15) "Watter supply temperature"; Modelica.Blocks.Sources.Constant mWatFlo3(k=-(mWatFlo1.k + mWatFlo2.k)) "Withdrawn water rate"; Modelica.Blocks.Sources.Constant mWatFlo2(k=0.003) "Water mass flow rate 2"; Modelica.Blocks.Math.Add cheMasFra(k2=-1) "Check for water conservation"; Buildings.Fluid.Sensors.MassFractionTwoPort senMasFra( redeclare package Medium = Medium, m_flow_nominal=1, tau=0, allowFlowReversal=false) "Sensor for measuring water content"; Modelica.Blocks.Sources.Constant mWatFloSol "Solution mass fraction water"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo(redeclare package Medium = Medium, allowFlowReversal=false) "Mass flow rate sensor"; Modelica.Blocks.Math.Add cheMasFlo(k2=-1) "Check for conservation of mass"; Modelica.Blocks.Sources.Constant mFloSol "Solution mass flow rate"; Sensors.EnthalpyFlowRate senSpeEnt( redeclare package Medium = Medium, allowFlowReversal=false, m_flow_nominal=1, tau=0) "Specific enthalpy flow rate sensor"; Modelica.Blocks.Math.Add cheSpeEnt(k2=-1) "Check for conservation of energy"; Modelica.Blocks.Sources.Constant hSol "Solution mass flow rate"; protected Modelica.Fluid.Interfaces.FluidPort_a port_a( redeclare package Medium = Medium) "Fluid port for using fluid stream mixing implementation"; equation connect(sou1.ports[1], vol.ports[1]); connect(sou2.ports[1], vol1.ports[1]); connect(mWatFlo1.y, vol.mWat_flow); connect(vol1.TWat,TWat. y); connect(vol.TWat,TWat. y); connect(mWatFlo3.y, vol2.mWat_flow); connect(vol2.TWat,TWat. y); connect(mWatFlo2.y, vol1.mWat_flow); connect(vol1.ports[2], port_a); connect(vol.ports[2], port_a); connect(port_a, vol2.ports[1]); connect(mWatFloSol.y,cheMasFra. u1); connect(senMasFlo.port_b, senMasFra.port_a); connect(vol2.ports[2], senSpeEnt.port_a); connect(senSpeEnt.port_b, senMasFlo.port_a); connect(hSol.y,cheSpeEnt. u1); connect(mFloSol.y,cheMasFlo. u1); connect(senMasFra.port_b, sin.ports[1]); end MoistureMixingConservation;

Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation

This test checks if trace substance mass flow rates are conserved

Buildings.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation

Information

This model is reconfigured to a steady state or dynamic check for conservation of trace substances.

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

Modelica definition

model TraceSubstanceConservation "This test checks if trace substance mass flow rates are conserved" extends Modelica.Icons.Example; constant String substanceName="CO2"; package Medium = Buildings.Media.Air(extraPropertiesNames={substanceName}); Buildings.Fluid.Sources.MassFlowSource_h sou( redeclare package Medium = Medium, nPorts=1, m_flow=1, X={0.01,0.99}, C=fill(0.001, Medium.nC)) "Air source with moisture and trace substances"; Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol( redeclare package Medium = Medium, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, m_flow_nominal=1, V=1, nPorts=2, allowFlowReversal=false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Mixing volume for adding moisture"; Modelica.Blocks.Sources.Constant TWat(k=273.15) "Water supply temperature"; Modelica.Blocks.Sources.Constant mWatFlo(k=0.001) "Water mass flow rate "; Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubIn( redeclare package Medium = Medium, m_flow_nominal=1, tau=0, allowFlowReversal=false, substanceName=substanceName) "Measured inlet trace substance concentration"; Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubOut( redeclare package Medium = Medium, m_flow_nominal=1, tau=0, allowFlowReversal=false, substanceName=substanceName) "Measured outlet trace substance concentration"; Buildings.Fluid.Sources.Boundary_pT sin(redeclare package Medium = Medium, nPorts=1) "Air sink"; Sensors.MassFlowRate senMasFloIn(redeclare package Medium = Medium, allowFlowReversal=false) "Fluid mass flow rate at inlet"; Sensors.MassFlowRate senMasFloOut(redeclare package Medium = Medium, allowFlowReversal=false) "Fluid mass flow rate at outlet"; Modelica.Blocks.Math.Product CfloIn "Trace substance mass flow rate at inlet"; Modelica.Blocks.Math.Product CfloOut "Trace substance mass flow rate at outlet"; equation connect(vol.TWat, TWat.y); connect(mWatFlo.y, vol.mWat_flow); connect(sou.ports[1], senTraSubIn.port_a); connect(senTraSubIn.port_b, senMasFloIn.port_a); connect(senMasFloIn.port_b, vol.ports[1]); connect(sin.ports[1], senMasFloOut.port_b); connect(senMasFloOut.port_a, senTraSubOut.port_b); connect(CfloIn.u2, senTraSubIn.C); connect(CfloIn.u1, senMasFloIn.m_flow); connect(CfloOut.u1, senMasFloOut.m_flow); connect(CfloOut.u2, senTraSubOut.C); connect(vol.ports[2], senTraSubOut.port_a); end TraceSubstanceConservation;