WOLFRAM SYSTEM MODELER

MultipleSubstances

Multiple Substances

Wolfram Language

In[1]:=
SystemModel["Modelica.Media.UsersGuide.MediumDefinition.MultipleSubstances"]
Out[1]:=

Information

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:

  • Reduced-state models: reducedX = true and nXi = nS - 1. In this case, the number of independent mass fractions nXi is the minimum possible. The full state vector X is provided by equations declared in the base class Interfaces.PartialMedium.BaseProperties: the first nXi elements are equal to Xi, and the last one is 1 - sum(Xi).
  • Full-state models: reducedX = false and nXi = nS. In this case, Xi = X, i.e., all the elements of the composition vector are considered as independent variables, and the constraint sum(X) = 1 is never written explicitly. Although this kind of model is heavier, as it provides one extra state variable, it can be less prone to numerical and/or symbolic problems, which can be caused by that constraint.
  • Fixed-composition models: fixedX = true and nXi = 0. In this case X = reference_X, i.e., all the elements of the composition vector are fixed.

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.