modelMixingVolume
Extends from Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume (Partial mixing volume with inlet and outlet ports (flow reversal is allowed)).
Information
This model represents an instantaneously mixed volume.
Potential and kinetic energy at the port are neglected,
and there is no pressure drop at the ports.
The volume can exchange heat through its heatPort.
The volume can be parameterized as a steady-state model or as dynamic model.
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:
- Set
prescribedHeatFlowRate=trueif the only means of heat transfer at theheatPortis 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 theheatPortis not connected, then setprescribedHeatFlowRate=trueas in this case,heatPort.Q_flow=0. - Set
prescribedHeatFlowRate=falseif there is heat flow at theheatPortcomputed 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.
If there is a combination of K * (T-heatPort.T) and a prescribed heat flow rate, for example a solar collector that dissipates heat to the ambient and receives heat from the solar radiation, then setprescribedHeatFlowRate=false.
Options
The parameter mSenFac can be used to increase the thermal mass of this model
without increasing its volume. This way, species concentrations are still calculated
correctly even though the thermal mass increases. The additional thermal mass is calculated
based on the density and the value of the function HeatCapacityCp
of the medium state state_default.
This parameter can for instance be useful in a pipe model when the developer wants to
lump the pipe thermal mass to the fluid volume. By default mSenFac = 1, hence
the mass is unchanged. For higher values of mSenFac, the mass will be scaled proportionally.
Set the parameter use_C_flow = true to enable an input connector for the trace substance flow rate.
This allows to directly add or subtract trace substances such as
CO2 to the volume.
See
Buildings.Fluid.Sensors.Examples.PPM
for an example.
Implementation
If the model is operated in steady-state and has two fluid ports connected,
then the same energy and mass balance implementation is used as in
steady-state component models, i.e., the use of actualStream
is not used for the properties at the port.
The implementation of these balance equations is done in the instances
dynBal for the dynamic balance and steBal
for the steady-state balance. Both models use the same input variables:
-
The variable
Q_flowis used to add sensible and latent heat to the fluid. For example,Q_flowparticipates in the steady-state energy balanceport_b.h_outflow = inStream(port_a.h_outflow) + Q_flow * m_flowInv;wherem_flowInvapproximates the expression1/m_flow. -
The variable
mXi_flowis used to add a species mass flow rate to the fluid.
For the rationale of selecting different energy and mass balances, and for the
use of prescribedHeatFlowRate, see the documentation of
Buildings.Fluid.MixingVolumes.BaseClasses.PartialMixingVolume.
For simple models that uses this model, see Buildings.Fluid.HeatExchangers.HeaterCooler_u and Buildings.Fluid.Humidifiers.Humidifier_u.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | prescribedHeatFlowRate (from PartialMixingVolume) | false | Set to true if the model has a prescribed heat flow at its heatPort. If the heat flow rate at the heatPort is only based on temperature difference, then set to false |
| Boolean | simplify_mWat_flow (from PartialMixingVolume) | true | Set to true to cause port_a.m_flow + port_b.m_flow = 0 even if mWat_flow is non-zero |
| Modelica.Units.SI.Volume | V (from PartialMixingVolume) | Volume | |
| Dynamics › Conservation equations | |||
| Modelica.Fluid.Types.Dynamics | energyDynamics (from LumpedVolumeDeclarations) | Modelica.Fluid.Types.Dynamics.DynamicFreeInitial | Type of energy balance: dynamic (3 initialization options) or steady state |
| Modelica.Fluid.Types.Dynamics | substanceDynamics (from LumpedVolumeDeclarations) | energyDynamics | Type of independent mass fraction balance: dynamic (3 initialization options) or steady state |
| Modelica.Fluid.Types.Dynamics | traceDynamics (from LumpedVolumeDeclarations) | energyDynamics | Type of trace substance balance: dynamic (3 initialization options) or steady state |
| Advanced › Dynamics | |||
| Modelica.Fluid.Types.Dynamics | massDynamics (from LumpedVolumeDeclarations) | energyDynamics | Type of mass balance: dynamic (3 initialization options) or steady state, must be steady state if energyDynamics is steady state |
| Initialization | |||
| Medium.AbsolutePressure | p_start (from LumpedVolumeDeclarations) | Medium.p_default | Start value of pressure |
| Medium.Temperature | T_start (from LumpedVolumeDeclarations) | Medium.T_default | Start value of temperature |
| Medium.MassFraction[Medium.nX] | X_start (from LumpedVolumeDeclarations) | Medium.X_default | Start value of mass fractions m_i/m |
| Medium.ExtraProperty[Medium.nC] | C_start (from LumpedVolumeDeclarations) | fill(0, Medium.nC) | Start value of trace substances |
| Medium.ExtraProperty[Medium.nC] | C_nominal (from LumpedVolumeDeclarations) | fill(1E-2, Medium.nC) | Nominal value of trace substances. (Set to typical order of magnitude.) |
| Dynamics | |||
| Real | mSenFac (from LumpedVolumeDeclarations) | 1 | Factor for scaling the sensible thermal mass of the volume |
| Advanced | |||
| Boolean | initialize_p (from PartialMixingVolume) | not Medium.singleState | = true to set up initial equations for pressure |
| Modelica.Units.SI.MassFlowRate | m_flow_small (from PartialMixingVolume) | 1E-4*abs(m_flow_nominal) | Small mass flow rate for regularization of zero flow |
| Boolean | use_C_flow | false | Set to true to enable input connector for trace substance |
| Nominal condition | |||
| Modelica.Units.SI.MassFlowRate | m_flow_nominal (from PartialMixingVolume) | Nominal mass flow rate | |
| General › Ports | |||
| Integer | nPorts (from PartialMixingVolume) | 0 | Number of ports |
| Assumptions | |||
| Boolean | allowFlowReversal (from PartialMixingVolume) | true | = false to simplify equations, assuming, but not enforcing, no flow reversal. Used only if model has two ports. |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b[nPorts] | ports (from PartialMixingVolume) | Fluid inlets and outlets | |
| Modelica.Blocks.Interfaces.RealOutput | U (from PartialMixingVolume) | Internal energy of the component | |
| Modelica.Blocks.Interfaces.RealOutput | m (from PartialMixingVolume) | Mass of the component | |
| Modelica.Blocks.Interfaces.RealOutput[Medium.nXi] | mXi (from PartialMixingVolume) | Species mass of the component | |
| Modelica.Blocks.Interfaces.RealOutput[Medium.nC] | mC (from PartialMixingVolume) | Trace substance mass of the component | |
| Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a | heatPort | Heat port for heat exchange with the control volume | |
| Modelica.Blocks.Interfaces.RealInput | C_flow | Trace substance mass flow rate added to the medium |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Medium.Temperature | T (from PartialMixingVolume) | Medium.temperature_phX(p = p, h = hOut_internal, X = if Medium.reducedX then cat(1, Xi, {1 - sum(Xi)}) else Xi) | Temperature of the fluid |
| Modelica.Units.SI.Pressure | p (from PartialMixingVolume) | if nPorts > 0 then ports[1].p else p_start | Pressure of the fluid |
| Modelica.Units.SI.MassFraction[Medium.nXi] | Xi (from PartialMixingVolume) | XiOut_internal | Species concentration of the fluid |
| Medium.ExtraProperty[Medium.nC] | C (from PartialMixingVolume) | COut_internal | Trace substance mixture content |
Revisions
-
October 19, 2017, by Michael Wetter:
Setinitialize_ptofinalso that it does not appear as a user-selectable parameter. This is done becauseinitialize_phas been changed from aconstantto aparameterfor Buildings, issue 1013. -
April 11, 2017, by Michael Wetter:
Changed comment of heat port, as this needs to be the total heat flow rate in order to be able to use this model for modeling steam humidifiers and adiabatic humidifiers.
Removed blocksQSen_flowandQLat_flow.
This is for issue Buildings #704. -
April 11, 2016 by Michael Wetter:
Corrected wrong hyperlink in documentation for issue 450. -
January 19, 2016, by Michael Wetter:
Updated documentation due to the addition of an input for trace substance in the mixing volume. This is for issue 372. -
January 17, 2016, by Michael Wetter:
RemovedprotectedblockmasExcas 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. -
December 2, 2015, by Filip Jorissen:
Changed code for handling trace substance insertions using inputC_flow. -
May 1, 2015 by Michael Wetter
Setfinalkeyword formasExc(final k=0). This addresses issue 230. -
February 11, 2014 by Michael Wetter:
Redesigned implementation of latent and sensible heat flow rates as port of the correction of issue #197. -
February 7, 2012 by Michael Wetter:
Revised base classes for conservation equations inBuildings.Fluid.Interfaces. -
September 17, 2011 by Michael Wetter:
Removed instancemediumas this is already used indynBal. Removing the base properties led to 30% faster computing time for a solar thermal system that contains many fluid volumes. -
September 13, 2011 by Michael Wetter:
Changed in declaration ofmediumthe parameter assignmentpreferredMediumStates=truetopreferredMediumStates= not (energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState). Otherwise, for a steady-state model, Dymola 2012 may differentiate the model to obtainTas a state. See ticket Dynasim #13596. -
July 26, 2011 by Michael Wetter:
Revised model to use new declarations from Buildings.Fluid.Interfaces.LumpedVolumeDeclarations. -
July 14, 2011 by Michael Wetter:
Added start values for mass and internal energy of dynamic balance model. -
May 25, 2011 by Michael Wetter:
-
Changed implementation of balance equation. The new implementation uses a different model if
exactly two fluid ports are connected, and in addition, the model is used as a steady-state
component. For this model configuration, the same balance equations are used as were used
for steady-state component models, i.e., instead of
actualStream(...), theinStream(...)formulation is used. This changed required the introduction of a new parameterm_flow_nominalwhich is used for smoothing in the steady-state balance equations of the model with two fluid ports. -
Another revision was the removal of the parameter
use_HeatTransferas there is no noticeable overhead in always having theheatPortconnector present.
-
Changed implementation of balance equation. The new implementation uses a different model if
exactly two fluid ports are connected, and in addition, the model is used as a steady-state
component. For this model configuration, the same balance equations are used as were used
for steady-state component models, i.e., instead of
-
July 30, 2010 by Michael Wetter:
Added nominal value formCto avoid wrong trajectory when concentration is around 1E-7. See also https://trac.modelica.org/Modelica/ticket/393. -
February 7, 2010 by Michael Wetter:
Simplified model and its base classes by removing the port data and the vessel area. Eliminated the base classPartialLumpedVessel. -
October 12, 2009 by Michael Wetter:
Changed base class to Buildings.Fluid.MixingVolumes.BaseClasses.ClosedVolume.