Collection of validation models
Information
This package contains validation models for the classes in
Annex60.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 |
MixingVolume
|
Test model for mixing volumes |
MixingVolumeAdiabaticCooling
|
Validation model for mixing volume with adiabatic cooling |
MixingVolumeHeatReverseFlow
|
Validation model for mixing volume with heat input and flow reversal |
MixingVolumeHeatReverseFlowPrescribedHeatFlowRate
|
Validation model for mixing volume with heat input and flow reversal and prescribed heat flow rate |
MixingVolumeInitialization
|
Test model for mixing volume initialization |
MixingVolumeMFactor
|
A check for verifying the implementation of the parameter mSenFac |
MixingVolumeMassFlow
|
Test model for mass flow into and out of volume |
MixingVolumeMoistureReverseFlow
|
Validation model for mixing volume with moisture input and flow reversal |
MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate
|
Validation model for mixing volume with moisture input and flow reversal and prescribed heat flow rate |
MixingVolumeSteadyStateMass
|
Test model for steady state mass dynamics |
MixingVolumeTraceSubstance
|
Test model for mixing volume with trace substance input |
MixingVolumeTraceSubstanceReverseFlow
|
Validation model for mixing volume with trace substance input and flow reversal |
MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate
|
Validation model for mixing volume with trace substance input and flow reversal, and prescribed heat flow rate |
MixingVolumeZeroFlow
|
Mixing volume verification around zero flow with heat exchange |
MoistureMixingConservationDynamicBalance
|
This test checks if mass and energy is conserved when mixing fluid streams using dynamic balances |
MoistureMixingConservationSteadyState
|
This test checks if mass and energy is conserved when mixing fluid streams using steady state balances |
TraceSubstanceConservationDynamicBalance
|
This test checks if trace substance mass flow rates are conserved when a dynamic balance is used |
TraceSubstanceConservationSteadyState
|
This test checks if trace substance mass flow rates are conserved when steady state |
BaseClasses
|
Baseclasses package |
Test model for mixing volumes
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 Annex60
library.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model MixingVolume
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
Modelica.Blocks.Sources.Ramp P(
duration=0.5,
startTime=0.5,
height=-10,
offset=101330);
Annex60.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
T=293.15,
use_p_in=true,
nPorts=3);
Annex60.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=3,
use_p_in=false,
p=101325,
T=283.15);
Annex60.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);
Annex60.Fluid.FixedResistances.PressureDrop res2(
redeclare package Medium = Medium,
from_dp=true,
m_flow_nominal=2,
dp_nominal=2.5);
Annex60.Fluid.FixedResistances.PressureDrop res11(
redeclare package Medium = Medium,
from_dp=true,
m_flow_nominal=2,
dp_nominal=2.5);
Annex60.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);
Modelica.Blocks.Math.Add cheEqu1(k2=-1) ;
Annex60.Fluid.Sensors.EnthalpyFlowRate entFloRat(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
Annex60.Fluid.Sensors.EnthalpyFlowRate entFloRat1(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
Annex60.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);
Annex60.Fluid.FixedResistances.PressureDrop res21(
redeclare package Medium = Medium,
from_dp=true,
m_flow_nominal=2,
dp_nominal=2.5);
Annex60.Fluid.FixedResistances.PressureDrop res22(
redeclare package Medium = Medium,
from_dp=true,
m_flow_nominal=2,
dp_nominal=2.5);
Modelica.Blocks.Math.Add cheEqu2(k2=-1) ;
Annex60.Fluid.Sensors.EnthalpyFlowRate entFloRat2(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
Modelica.Blocks.Sources.Constant zero(k=0);
Modelica.Blocks.Sources.Constant TLiq(k=283.15);
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(TLiq.y, vol2.TWat);
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;
Validation model for mixing volume with adiabatic cooling
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
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
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)
;
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) ;
Modelica.Blocks.Sources.Constant mWatFlo(k=0.001) ;
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TWat
;
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)))
;
Sources.FixedBoundary bou(
redeclare package Medium = Medium, nPorts=2)
;
equation
connect(volSim.mWat_flow, mWatFlo.y);
connect(TWat.T, volSim.TWat);
connect(volSim.heatPort, TWat.port);
connect(volExa.mWat_flow, mWatFlo.y);
connect(TWat.T, volExa.TWat);
connect(bou.ports[1], volSim.ports[1]);
connect(bou.ports[2], volExa.ports[1]);
end MixingVolumeAdiabaticCooling;
Validation model for mixing volume with heat input and flow reversal
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 Annex60.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow (Test model for mixing volume with flow reversal).
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 Annex60.Fluid.Mixi... | Volume with dynamic balance |
MixingVolume | volSte | redeclare Annex60.Fluid.Mixi... | Volume with steady-state balance |
Modelica definition
Validation model for mixing volume with heat input and flow reversal and prescribed heat flow rate
Information
This model is identical to
Annex60.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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation.
Extends from MixingVolumeHeatReverseFlow (Validation model for mixing volume with heat input and flow reversal).
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 Annex60.Fluid.Mixi... | Volume with dynamic balance |
MixingVolume | volSte | redeclare Annex60.Fluid.Mixi... | Volume with steady-state balance |
Modelica definition
model MixingVolumeHeatReverseFlowPrescribedHeatFlowRate
extends MixingVolumeHeatReverseFlow(
prescribedHeatFlowRate=true);
end MixingVolumeHeatReverseFlowPrescribedHeatFlowRate;
Test model for mixing volume initialization
Information
This model tests the initialization of the mixing volume.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model MixingVolumeInitialization
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air;
Annex60.Fluid.Sources.Boundary_pT sou1(
redeclare package Medium =
Medium,
p=101330,
nPorts=1,
T=293.15);
Annex60.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;
A check for verifying the implementation of the parameter mSenFac
Information
This model contains two verifications for the implementation of mSenFac
:
-
The mixingVolume temperature
vol.T
should be constant.
This is to check the correct implementation of the parameter mSenFac
for moist air media.
-
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
Annex60.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow
for the rational of the selected initial conditions for the volumes.
Extends from Annex60.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow (Test model for mass flow into and out of volume).
Parameters
Modelica definition
model MixingVolumeMFactor
extends Annex60.Fluid.MixingVolumes.Validation.MixingVolumeMassFlow(
sou(X={0.02,0.98},
T=Medium.T_default),
vol(mSenFac=10),
bou(nPorts=3));
Annex60.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)
;
Annex60.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)
;
Annex60.Fluid.Sources.MassFlowSource_T boundaryMFactor(
redeclare package Medium = Medium,
T=300,
nPorts=1,
m_flow=1,
X={0.02,0.98}) ;
Annex60.Fluid.Sources.MassFlowSource_T boundary(
redeclare package Medium = Medium,
T=300,
nPorts=1,
m_flow=1,
X={0.02,0.98}) ;
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;
Test model for mass flow into and out of volume
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
Modelica definition
model MixingVolumeMassFlow
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
parameter Modelica.SIunits.PressureDifference dp_nominal = 10
;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 0.5
;
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) ;
Sources.Boundary_pT bou(
redeclare package Medium = Medium,
T=303.15,
nPorts=1) ;
Annex60.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;
Validation model for mixing volume with moisture input and flow reversal
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 Annex60.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow (Test model for mixing volume with flow reversal).
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] |
Modelica definition
Validation model for mixing volume with moisture input and flow reversal and prescribed heat flow rate
Information
This model is identical to
Annex60.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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation.
Extends from MixingVolumeMoistureReverseFlow (Validation model for mixing volume with moisture input and flow reversal).
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] |
Modelica definition
model MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate
extends MixingVolumeMoistureReverseFlow(
prescribedHeatFlowRate=true);
end MixingVolumeMoistureReverseFlowPrescribedHeatFlowRate;
Test model for steady state mass dynamics
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
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air;
Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1) ;
Sources.Boundary_pT bou(
redeclare package Medium = Medium,
nPorts=1) ;
Annex60.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)
;
Modelica.Blocks.Sources.Ramp ramp(
duration=1,
offset=1,
height=-2) ;
Modelica.Blocks.Math.Gain gain(k=0.01) ;
FixedResistances.PressureDrop res(
redeclare package Medium = Medium,
m_flow_nominal=0.01,
dp_nominal=1000) ;
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;
Test model for mixing volume with trace substance input
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
Type | Name | Default | Description |
Pressure | dp_nominal | 10 | Nominal pressure drop [Pa] |
MassFlowRate | m_flow_nominal | 0.5 | Nominal mass flow rate [kg/s] |
Modelica definition
model MixingVolumeTraceSubstance
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air(extraPropertiesNames={"CO2"})
;
parameter Modelica.SIunits.Pressure dp_nominal = 10 ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 0.5
;
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) ;
Sources.Boundary_pT bou(
redeclare package Medium = Medium,
T=303.15,
nPorts=2) ;
Annex60.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) ;
Modelica.Blocks.Sources.Constant C_flow(k=m_flow_nominal/1000)
;
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) ;
Annex60.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) ;
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;
Validation model for mixing volume with trace substance input and flow reversal
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 Annex60.Fluid.MixingVolumes.Validation.BaseClasses.MixingVolumeReverseFlow (Test model for mixing volume with flow reversal).
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] |
Modelica definition
model MixingVolumeTraceSubstanceReverseFlow
extends Annex60.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;
Validation model for mixing volume with trace substance input and flow reversal, and prescribed heat flow rate
Information
This model is identical to
Annex60.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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation.
Extends from MixingVolumeTraceSubstanceReverseFlow (Validation model for mixing volume with trace substance input and flow reversal).
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 | volDyn(use_C_flow=true) | Volume with dynamic balance |
MixingVolume | volSte | volSte(use_C_flow=true) | Volume with steady-state balance |
Modelica definition
model MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate
extends MixingVolumeTraceSubstanceReverseFlow(
prescribedHeatFlowRate=true);
end MixingVolumeTraceSubstanceReverseFlowPrescribedHeatFlowRate;
Mixing volume verification around zero flow with heat exchange
Information
This model verifies whether the equations in
Annex60.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
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Water;
Annex60.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)
;
Annex60.Fluid.Sources.MassFlowSource_T sou2(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=true) ;
Annex60.Fluid.Sources.Boundary_pT sin(nPorts=4,
redeclare package Medium =
Medium) ;
Modelica.Blocks.Sources.Ramp ramp_m_flow(
height=-1,
duration=1,
offset=1) ;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea2
;
Modelica.Blocks.Sources.RealExpression reaExp(y=(290 - volNonLinSys.heatPort.T)
/100*volNonLinSys.heatPort.T^(3/5)*time)
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature preTem
;
Modelica.Blocks.Sources.Cosine cos1(
freqHz=1,
offset=283.15,
amplitude=0.001) ;
Annex60.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)
;
Annex60.Fluid.Sources.MassFlowSource_T sou3(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=true) ;
Annex60.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)
;
Annex60.Fluid.Sources.MassFlowSource_T sou4(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=true) ;
Modelica.Thermal.HeatTransfer.Components.ThermalResistor theRes(R=0.001)
;
Modelica.Blocks.Sources.Ramp ramp_T(
duration=2,
offset=283.15,
height=0) ;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea1
;
Annex60.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)
;
Annex60.Fluid.Sources.MassFlowSource_T sou1(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=true) ;
Modelica.Blocks.Routing.RealPassThrough reaPasThr
;
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;
This test checks if mass and energy is conserved when mixing fluid streams using dynamic balances
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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
and
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
for a discussion.
Extends from Annex60.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation (Partial for checking conservation of mass for independent mass fraction).
Parameters
Type | Name | Default | Description |
Mass | m_start[3] | | Initial mass of the mixing volumes [kg] |
InternalEnergy | U_start[3] | | Initial energy of the mixing volumes [J] |
Modelica definition
model MoistureMixingConservationDynamicBalance
extends Annex60.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)
;
parameter Modelica.SIunits.InternalEnergy[3] U_start(
each fixed=false)
;
Modelica.Blocks.Continuous.Integrator intMasFloVapIn(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
Modelica.Blocks.Math.Add3 add ;
Modelica.Blocks.Sources.RealExpression masVapVol(y=vol.mXi[1] + vol1.mXi[1] +
vol2.mXi[1]) ;
Modelica.Blocks.Math.Add3 add3Vap(k3=-1)
;
Modelica.Blocks.Sources.RealExpression masVol(y=vol1.m + vol.m + vol2.m)
;
Modelica.Blocks.Continuous.Integrator intMasFloOut(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
Modelica.Blocks.Math.Add3 add3Mass(k3=-1) ;
Modelica.Blocks.Continuous.Integrator intMasFloIn(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
Modelica.Blocks.Sources.Constant masFloIn(k=sou1.m_flow + sou2.m_flow)
;
Modelica.Blocks.Continuous.Integrator intEntOut(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
Modelica.Blocks.Continuous.Integrator intEntIn(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
Modelica.Blocks.Sources.RealExpression entVol(y=vol1.U + vol.U + vol2.U)
;
Modelica.Blocks.Math.Add3 add3Ent(k3=-1) ;
Modelica.Blocks.Sources.Constant entIn(k=sou1.m_flow*sou1.h + sou2.m_flow*
sou2.h +
Medium.enthalpyOfLiquid(TWat.k)*(mWatFlo1.k + mWatFlo2.k))
;
Modelica.Blocks.Math.Product pro ;
Modelica.Blocks.Continuous.Integrator intMasVapOut(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
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;
This test checks if mass and energy is conserved when mixing fluid streams using steady state balances
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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
and
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
for a discussion.
Extends from Annex60.Fluid.MixingVolumes.Validation.BaseClasses.MoistureMixingConservation (Partial for checking conservation of mass for independent mass fraction).
Modelica definition
model MoistureMixingConservationSteadyState
extends Annex60.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;
This test checks if trace substance mass flow rates are conserved when a dynamic balance is used
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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
and
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
for a discussion.
Extends from Annex60.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation (This test checks if trace substance mass flow rates are conserved).
Modelica definition
model TraceSubstanceConservationDynamicBalance
extends Annex60.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) ;
Modelica.Blocks.Continuous.Integrator intTraSubOut(
k=1,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0) ;
Modelica.Blocks.Sources.RealExpression reaExp(y=vol.m*vol.C[1])
;
Modelica.Blocks.Math.Add cheConMas(k2=-1) ;
Modelica.Blocks.Math.Add3 add3(
k1=-1,
k2=+1,
k3=-1) ;
Modelica.Blocks.Sources.Constant zero(k=0) ;
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;
This test checks if trace substance mass flow rates are conserved when steady state
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
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
and
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
for a discussion.
Extends from Annex60.Fluid.MixingVolumes.Validation.BaseClasses.TraceSubstanceConservation (This test checks if trace substance mass flow rates are conserved).
Modelica definition
http://iea-annex60.org