This is a partial model of an instantaneously mixed volume. It is used as the base class for all fluid volumes of the package Buildings.Fluid.MixingVolumes.
Set the constant sensibleOnly=true
if the model that extends
or instantiates this model sets mWat_flow = 0
.
Set the constant simplify_mWat_flow = true
to simplify the equation
port_a.m_flow + port_b.m_flow = - mWat_flow;
to
port_a.m_flow + port_b.m_flow = 0;
This causes an error in the mass balance of about 0.5%, but generally leads to simpler equations because the pressure drop equations are then decoupled from the mass exchange in this component.
To increase the numerical robustness of the model, the constant
prescribedHeatFlowRate
can be set by the user.
This constant only has an effect if the model has exactly two fluid ports connected,
and if it is used as a steady-state model.
Use the following settings:
prescribedHeatFlowRate=true
if the only means of heat transfer
at the heatPort
is a prescribed heat flow rate that
is not a function of the temperature difference
between the medium and an ambient temperature. Examples include an ideal electrical heater,
a pump that rejects heat into the fluid stream, or a chiller that removes heat based on a performance curve.
If the heatPort
is not connected, then set prescribedHeatFlowRate=true
as
in this case, heatPort.Q_flow=0
.
prescribedHeatFlowRate=false
if there is heat flow at the heatPort
computed as K * (T-heatPort.T), for some temperature T and some conductance K,
which may itself be a function of temperature or mass flow rate.prescribedHeatFlowRate=false
.
Set the parameter use_C_flow = true
to enable an input connector
for the trace substance flow rate.
If the model is (i) operated in steady-state,
(ii) has two fluid ports connected, and
(iii) prescribedHeatFlowRate=true
or allowFlowReversal=false
,
then the model uses
Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation
in order to use
the same energy and mass balance implementation as is used as in
steady-state component models.
In this situation, the functions inStream
are used for the two
flow directions rather than the function
actualStream
, which is less efficient.
However, the use of inStream
has the disadvantage
that hOut
has to be computed, in
Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation,
using
if allowFlowReversal then hOut = Buildings.Utilities.Math.Functions.regStep(y1=port_b.h_outflow, y2=port_a.h_outflow, x=port_a.m_flow, x_small=m_flow_small/1E3); else hOut = port_b.h_outflow; end if;
Hence, for allowFlowReversal=true
, if hOut
were to be used to compute the temperature that
drives heat transfer such as by conduction,
then the heat transfer would depend on upstream and the downstream
temperatures for small mass flow rates.
This can give wrong results. Consider for example a mass flow rate that is positive
but very close to zero. Suppose the upstream temperature is 20°C,
the downstream temperature is 10°C, and the heat port is
connected through a heat conductor to a boundary condition of 20°C.
Then, hOut = (port_b.h_outflow + port_a.h_outflow)/2
and hence
the temperature heatPort.T
is 15°C. Therefore, heat is added to the component.
As the mass flow rate is by assumption very small, the fluid that leaves the component
will have a very high temperature, violating the 2nd law.
To avoid this situation, if
prescribedHeatFlowRate=false
, then the model
Buildings.Fluid.Interfaces.ConservationEquation
is used instead of
Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation.
For simple models that uses this model, see Buildings.Fluid.MixingVolumes.
Xi
to X
so that it also works
with media that have reducedX=true
.steBal.hOut
so that T_start
can be used which is not known in that instance.getInstanceName()
to flow
reversal check.
This if or
issue 1228.
constant
to a parameter
.partial
keyword as this model is not partial.C_flow
and use_C_flow
to child classes.QSen_flow
and
QLat_flow
.use_mWat_flow
rather than sensibleOnly
.
protected
block masExc
as
this revision introduces a conditional connector for the
moisture flow rate in the energy and mass balance models.
This change was done to use the same modeling concept for the
moisture input as is used for the trace substance input.
C_flow
for
handling trace substance insertions.
simplify_mWat_flow
to remove dependencies of the pressure drop
calculation on the moisture balance.
prescribedHeatFlowRate=prescribedHeatflowRate
for
Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation.
This results in equations that are solved more easily.
See
issue 282 for a discussion.
heatPort.T
and changed
type of T
to Medium.Temperature
rather than
Modelica.Units.SI.Temperature
to avoid an
error because of conflicting start values if
Buildings.Fluid.Chillers.Carnot_y
is translated using pedantic mode in Dymola 2016.
This is for
#426.
dynBal.U.start
from instance dynBal
to the actual model implementation.
This is required for a pedantic model check in Dymola 2016.
It addresses
issue 266.
final parameter Boolean useSteadyStateTwoPort=(nPorts == 2) and prescribedHeatFlowRate and ...to
final parameter Boolean useSteadyStateTwoPort=(nPorts == 2) and (prescribedHeatFlowRate or (not allowFlowReversal)) and ...The reason is that if there is no flow reversal, then Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation computes
hOut = port_b.h_outflow;
, and hence
it is correct to use hOut
to compute
temperature-driven heat flow, such as by conduction or convection.
See also the model documentation.initalize_p
from a parameter
to a
constant
. This is only required in finite volume models
of heat exchangers (to avoid consistent but redundant initial conditions)
and hence it should be set as a constant
.
mFactor
final, and changed computation of
density to use default medium states as are also used to compute the
specific heat capacity.
mFactor
to increase the thermal capacity.
initialize_p
. This is required
to enable the coil models to initialize the pressure in the first
volume, but not in the downstream volumes. Otherwise,
the initial equations will be overdetermined, but consistent.
This change was done to avoid a long information message that appears
when translating models.
Evaluate=true
.
Q_flow
and added QSen_flow
.
This was done to clarify what is sensible and total heat flow rate
as part of the correction of issue
#197.
show_V_flow
to instance steBal
as it has no longer this parameter.
rho_nominal
to rho_start
because this quantity is computed using start values and not
nominal values.
cardinality
function.
Buildings.Fluid.Interfaces
.
medium
as this is already used in dynBal
.
Removing the base properties led to 30% faster computing time for a solar thermal system
that contains many fluid volumes.
medium
the parameter assignment
preferredMediumStates=true
to
preferredMediumStates= not (energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState)
.
Otherwise, for a steady-state model, Dymola 2012 may differentiate the model to obtain T
as a state. See ticket Dynasim #13596.
actualStream(...)
, the
inStream(...)
formulation is used.
This changed required the introduction of a new parameter m_flow_nominal
which
is used for smoothing in the steady-state balance equations of the model with two fluid ports.
This implementation also simplifies the implementation of
Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort,
which now uses the same equations as this model.
use_HeatTransfer
as there is
no noticeable overhead in always having the heatPort
connector present.
mC
to avoid wrong trajectory
when concentration is around 1E-7.
See also
https://trac.modelica.org/Modelica/ticket/393.
PartialLumpedVessel
.