MultipleSubstancesMultiple Substances |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
When writing the model of a multiple-substance medium, a fundamental issue concerns how to consider the mass fractions of the fluid. If there are nS substances, there are also nS mass fractions; however, one of them is redundant, as sum(X) = 1. Therefore there are basically two options, concerning the number of independent mass fractions nXi:
The medium implementer can declare the value reducedX as final. In this way only one implementation must be given. For instance, Modelica.Media.IdealGases models declare final reducedX = false, so that the implementation can always assume nXi = nX. The same is true for Air.MoistAir, which declares final reducedX = true, and always assumes nXi = nX - 1 = 1.
It is also possible to leave reducedX modifiable. In this case, the BaseProperties model and all additional functions should check for the actual value of reducedX, and provide the corresponding implementation.
If fixedX is left modifiable, then the implementation should also handle the case fixedX = true properly.
Fluid connectors should always use composition vectors of size Xi, such as in the Modelica.Fluid library:
connector FluidPort replaceable package Medium = Modelica.Media.Interfaces.PartialMedium; Medium.AbsolutePressure p; flow Medium.MassFlowRate m_flow; Medium.SpecificEnthalpy h; flow Medium.EnthalpyFlowRate H_flow; Medium.MassFraction Xi [Medium.nXi]; flow Medium.MassFlowRate mX_flow[Medium.nXi]; end FluidPort;
For further details, refer to the implementation of MixtureGasNasa model and MoistAir model.