modelMassFractionTwoPort

Ideal two port mass fraction sensor

Extends from Buildings.Fluid.Sensors.BaseClasses.PartialDynamicFlowSensor (Partial component to model sensors that measure flow properties using a dynamic model), Buildings.Fluid.BaseClasses.IndexMassFraction (Computes the index of a substance in the mass fraction vector Xi), Modelica.Icons.RoundSensor (Icon representing a round measurement device).

Information

This model outputs the mass fraction of the passing fluid. The sensor is ideal, i.e. it does not influence the fluid. If the parameter tau is non-zero, then its output is computed using a first order differential equation. Setting tau=0 is not recommend. See Buildings.Fluid.Sensors.UsersGuide for an explanation.

Parameters

TypeNameDefaultDescription
Modelica.Units.SI.Timetau (from PartialDynamicFlowSensor)1Time constant at nominal flow rate (use tau=0 for steady-state sensor, but see user guide for potential problems)
StringsubstanceName (from IndexMassFraction)""Name of species substance
Assumptions
BooleanallowFlowReversal (from PartialTwoPort)true= false to simplify equations, assuming, but not enforcing, no flow reversal
Nominal condition
Modelica.Units.SI.MassFlowRatem_flow_nominal (from PartialFlowSensor)Nominal mass flow rate, used for regularization near zero flow
Advanced
Modelica.Units.SI.MassFlowRatem_flow_small (from PartialFlowSensor)1E-4*m_flow_nominalFor bi-directional flow, temperature is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)
Initialization
Modelica.Blocks.Types.InitinitType (from PartialDynamicFlowSensor)Modelica.Blocks.Types.Init.InitialStateType of initialization (InitialState and InitialOutput are identical)
Medium.MassFractionX_startMedium.X_default[i_x]Initial or guess value of output (= state)

Connectors

TypeNameDefaultDescription
Modelica.Fluid.Interfaces.FluidPort_aport_a (from PartialTwoPort)Fluid connector a (positive design flow direction is from port_a to port_b)
Modelica.Fluid.Interfaces.FluidPort_bport_b (from PartialTwoPort)Fluid connector b (positive design flow direction is from port_a to port_b)
Modelica.Blocks.Interfaces.RealOutputXMass fraction of the passing fluid

Revisions

  • June 25, 2026, by Michael Wetter:
    Added nominal attribute to state variable.
    This is for IBPSA, #2132.
  • February 25, 2020, by Michael Wetter:
    Changed icon to display its operating state.
    This is for #1294.
  • January 26, 2016, by Michael Wetter:
    Corrected wrong assignment XiVec[Medium.nXi](quantity=Medium.extraPropertiesNames) to XiVec[Medium.nXi](quantity=Medium.substanceNames[1:Medium.nXi]).
    Changed unit of output signal from 1 to kg/kg to indicate that it is a mass fraction, and declared the assignment final.
  • January 18, 2016 by Filip Jorissen:
    Using parameter tauInv since this now exists in Buildings.Fluid.Sensors.BaseClasses.PartialDynamicFlowSensor. This is for #372.
  • September 10, 2013, by Michael Wetter:
    Changed min and max values for output signals to allow for numerical approximation error without violating these bounds.
    Changed medium declaration in the extends statement to replaceable to avoid a translation error in OpenModelica.
  • August 31, 2013, by Michael Wetter:
    Revised model to use base class Buildings.Fluid.BaseClasses.IndexMassFraction.
  • November 3, 2011, by Michael Wetter:
    Moved der(X) := 0; from the initial algorithm section to the initial equation section as this assignment does not conform to the Modelica specification.
  • June 3, 2011 by Michael Wetter:
    Revised implementation to add dynamics in such a way that the time constant increases as the mass flow rate tends to zero. This significantly improves the numerics.
  • February 22, by Michael Wetter:
    Improved code that searches for index of the substance name in the medium model.
  • Feb. 8, 2011 by Michael Wetter:
    First implementation.