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 |
MixingVolumeReverseFlow
|
Test model for mixing volume with flow reversal |
MoistureMixingConservation
|
Partial for checking conservation of mass for independent mass fraction |
TraceSubstanceConservation
|
This test checks if trace substance mass flow rates are conserved |
Test model for mixing volume with flow reversal
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
Type | Name | Default | Description |
Pressure | dp_nominal | 10 | Nominal pressure drop [Pa] |
MassFlowRate | m_flow_nominal | 2.0 | Nominal mass flow rate [kg/s] |
MixingVolume | volDyn | redeclare Buildings.Fluid.Mi... | Volume with dynamic balance |
MixingVolume | volSte | redeclare Buildings.Fluid.Mi... | Volume with steady-state balance |
Modelica definition
partial model MixingVolumeReverseFlow
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
constant Boolean prescribedHeatFlowRate = false
;
parameter Modelica.SIunits.Pressure dp_nominal = 10 ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 2.0
;
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) ;
Sources.Boundary_pT bou(
redeclare package Medium = Medium,
T=303.15,
nPorts=2) ;
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)
;
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)
;
Modelica.Blocks.Math.Gain gain
;
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) ;
Modelica.Blocks.Sources.Ramp m_flow(
height=-2*m_flow_nominal,
duration=10,
offset=m_flow_nominal) ;
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;
Partial for checking conservation of mass for independent mass fraction
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
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sources.MassFlowSource_h sou1(
redeclare package Medium = Medium,
nPorts=1,
m_flow=2,
X={0,1}) ;
Buildings.Fluid.Sources.MassFlowSource_h sou2(
redeclare package Medium = Medium,
nPorts=1,
m_flow=1,
X={0,1}) ;
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)
;
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)
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1) ;
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)
;
Modelica.Blocks.Sources.Constant mWatFlo1(k=0.001) ;
Modelica.Blocks.Sources.Constant mWatFlo3(k=-(mWatFlo1.k + mWatFlo2.k))
;
Modelica.Blocks.Sources.Constant mWatFlo2(k=0.003) ;
Modelica.Blocks.Math.Add cheMasFra(k2=-1)
;
Buildings.Fluid.Sensors.MassFractionTwoPort senMasFra(
redeclare package Medium = Medium,
m_flow_nominal=1,
tau=0,
allowFlowReversal=false) ;
Modelica.Blocks.Sources.Constant mWatFloSol ;
Buildings.Fluid.Sensors.MassFlowRate senMasFlo(
redeclare package Medium =
Medium, allowFlowReversal=false) ;
Modelica.Blocks.Math.Add cheMasFlo(k2=-1)
;
Modelica.Blocks.Sources.Constant mFloSol ;
Sensors.EnthalpyFlowRate senSpeEnt(
redeclare package Medium = Medium,
allowFlowReversal=false,
m_flow_nominal=1,
tau=0) ;
Modelica.Blocks.Math.Add cheSpeEnt(k2=-1)
;
Modelica.Blocks.Sources.Constant hSol ;
protected
Modelica.Fluid.Interfaces.FluidPort_a port_a(
redeclare package Medium = Medium)
;
equation
connect(sou1.ports[1], vol.ports[1]);
connect(sou2.ports[1], vol1.ports[1]);
connect(mWatFlo1.y, vol.mWat_flow);
connect(mWatFlo3.y, vol2.mWat_flow);
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;
This test checks if trace substance mass flow rates are conserved
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
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)) ;
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)
;
Modelica.Blocks.Sources.Constant mWatFlo(k=0.001) ;
Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubIn(
redeclare package Medium = Medium,
m_flow_nominal=1,
tau=0,
allowFlowReversal=false,
substanceName=substanceName) ;
Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubOut(
redeclare package Medium = Medium,
m_flow_nominal=1,
tau=0,
allowFlowReversal=false,
substanceName=substanceName)
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1) ;
Sensors.MassFlowRate senMasFloIn(
redeclare package Medium = Medium,
allowFlowReversal=false) ;
Sensors.MassFlowRate senMasFloOut(
redeclare package Medium = Medium,
allowFlowReversal=false) ;
Modelica.Blocks.Math.Product CfloIn ;
Modelica.Blocks.Math.Product CfloOut
;
equation
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;