Buildings.Fluid.Sources

Define fixed or prescribed boundary conditions

Information


Package Sources contains generic sources for fluid connectors to define fixed or prescribed ambient conditions.

Package Content

NameDescription
Buildings.Fluid.Sources.Boundary_pT Boundary_pT Boundary with prescribed pressure, temperature, composition and trace substances
Buildings.Fluid.Sources.Boundary_ph Boundary_ph Boundary with prescribed pressure, specific enthalpy, composition and trace substances
Buildings.Fluid.Sources.FixedBoundary FixedBoundary Boundary source component
Buildings.Fluid.Sources.MassFlowSource_T MassFlowSource_T Ideal flow source that produces a prescribed mass flow with prescribed temperature, mass fraction and trace substances
Buildings.Fluid.Sources.MassFlowSource_h MassFlowSource_h Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, mass fraction and trace substances
Buildings.Fluid.Sources.PrescribedExtraPropertyFlowRate PrescribedExtraPropertyFlowRate Source with mass flow that does not take part in medium mass balance (such as CO2)
Buildings.Fluid.Sources.Examples Examples Collection of models that illustrate model use and test models


Buildings.Fluid.Sources.Boundary_pT Buildings.Fluid.Sources.Boundary_pT

Boundary with prescribed pressure, temperature, composition and trace substances

Buildings.Fluid.Sources.Boundary_pT

Information


Defines prescribed values for boundary conditions:

If use_p_in is false (default option), the p parameter is used as boundary pressure, and the p_in input connector is disabled; if use_p_in is true, then the p parameter is ignored, and the value provided by the input connector is used instead.

The same thing goes for the temperature, composition and trace substances.

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary pressure, do not have an effect.


Extends from Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model within the source
Booleanuse_p_infalseGet the pressure from the input connector
Booleanuse_T_infalseGet the temperature from the input connector
Booleanuse_X_infalseGet the composition from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
AbsolutePressurepMedium.p_defaultFixed value of pressure [Pa]
TemperatureTMedium.T_defaultFixed value of temperature [K]
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputp_inPrescribed boundary pressure
input RealInputT_inPrescribed boundary temperature
input RealInputX_in[Medium.nX]Prescribed boundary composition
input RealInputC_in[Medium.nC]Prescribed boundary trace substances

Modelica definition

model Boundary_pT 
  "Boundary with prescribed pressure, temperature, composition and trace substances"
  extends Modelica.Fluid.Sources.BaseClasses.PartialSource;
  parameter Boolean use_p_in = false 
    "Get the pressure from the input connector";
  parameter Boolean use_T_in= false 
    "Get the temperature from the input connector";
  parameter Boolean use_X_in = false 
    "Get the composition from the input connector";
  parameter Boolean use_C_in = false 
    "Get the trace substances from the input connector";
  parameter Medium.AbsolutePressure p = Medium.p_default 
    "Fixed value of pressure";
  parameter Medium.Temperature T = Medium.T_default 
    "Fixed value of temperature";
  parameter Medium.MassFraction X[Medium.nX] = Medium.X_default 
    "Fixed value of composition";
  parameter Medium.ExtraProperty C[Medium.nC](
       quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) 
    "Fixed values of trace substances";
  Modelica.Blocks.Interfaces.RealInput p_in if              use_p_in 
    "Prescribed boundary pressure";
  Modelica.Blocks.Interfaces.RealInput T_in if         use_T_in 
    "Prescribed boundary temperature";
  Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if 
                                                        use_X_in 
    "Prescribed boundary composition";
  Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if 
                                                        use_C_in 
    "Prescribed boundary trace substances";
protected 
  Modelica.Blocks.Interfaces.RealInput p_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput T_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] 
    "Needed to connect to conditional connector";
equation 
  Modelica.Fluid.Utilities.checkBoundary(Medium.mediumName, Medium.substanceNames,
    Medium.singleState, true, X_in_internal, "Boundary_pT");
  connect(p_in, p_in_internal);
  connect(T_in, T_in_internal);
  connect(X_in, X_in_internal);
  connect(C_in, C_in_internal);
  if not use_p_in then
    p_in_internal = p;
  end if;
  if not use_T_in then
    T_in_internal = T;
  end if;
  if not use_X_in then
    X_in_internal = X;
  end if;
  if not use_C_in then
    C_in_internal = C;
  end if;
  medium.p = p_in_internal;
  medium.T = T_in_internal;
  medium.Xi = X_in_internal[1:Medium.nXi];
  ports.C_outflow = fill(C_in_internal, nPorts);
end Boundary_pT;

Buildings.Fluid.Sources.Boundary_ph Buildings.Fluid.Sources.Boundary_ph

Boundary with prescribed pressure, specific enthalpy, composition and trace substances

Buildings.Fluid.Sources.Boundary_ph

Information


Defines prescribed values for boundary conditions:

If use_p_in is false (default option), the p parameter is used as boundary pressure, and the p_in input connector is disabled; if use_p_in is true, then the p parameter is ignored, and the value provided by the input connector is used instead.

The same thing goes for the specific enthalpy and composition

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary pressure, do not have an effect.


Extends from Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model within the source
Booleanuse_p_infalseGet the pressure from the input connector
Booleanuse_h_infalseGet the specific enthalpy from the input connector
Booleanuse_X_infalseGet the composition from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
AbsolutePressurepMedium.p_defaultFixed value of pressure [Pa]
SpecificEnthalpyhMedium.h_defaultFixed value of specific enthalpy [J/kg]
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputp_inPrescribed boundary pressure
input RealInputh_inPrescribed boundary specific enthalpy
input RealInputX_in[Medium.nX]Prescribed boundary composition
input RealInputC_in[Medium.nC]Prescribed boundary trace substances

Modelica definition

model Boundary_ph 
  "Boundary with prescribed pressure, specific enthalpy, composition and trace substances"
  extends Modelica.Fluid.Sources.BaseClasses.PartialSource;
  parameter Boolean use_p_in = false 
    "Get the pressure from the input connector";
  parameter Boolean use_h_in= false 
    "Get the specific enthalpy from the input connector";
  parameter Boolean use_X_in = false 
    "Get the composition from the input connector";
  parameter Boolean use_C_in = false 
    "Get the trace substances from the input connector";
  parameter Medium.AbsolutePressure p = Medium.p_default 
    "Fixed value of pressure";
  parameter Medium.SpecificEnthalpy h = Medium.h_default 
    "Fixed value of specific enthalpy";
  parameter Medium.MassFraction X[Medium.nX] = Medium.X_default 
    "Fixed value of composition";
  parameter Medium.ExtraProperty C[Medium.nC](
       quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) 
    "Fixed values of trace substances";
  Modelica.Blocks.Interfaces.RealInput p_in if              use_p_in 
    "Prescribed boundary pressure";
  Modelica.Blocks.Interfaces.RealInput h_in if              use_h_in 
    "Prescribed boundary specific enthalpy";
  Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if 
                                                        use_X_in 
    "Prescribed boundary composition";
  Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if 
                                                        use_C_in 
    "Prescribed boundary trace substances";
protected 
  Modelica.Blocks.Interfaces.RealInput p_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput h_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] 
    "Needed to connect to conditional connector";
equation 
  Modelica.Fluid.Utilities.checkBoundary(Medium.mediumName, Medium.substanceNames,
    Medium.singleState, true, X_in_internal, "Boundary_ph");
  connect(p_in, p_in_internal);
  connect(h_in, h_in_internal);
  connect(X_in, X_in_internal);
  connect(C_in, C_in_internal);
  if not use_p_in then
    p_in_internal = p;
  end if;
  if not use_h_in then
    h_in_internal = h;
  end if;
  if not use_X_in then
    X_in_internal = X;
  end if;
  if not use_C_in then
    C_in_internal = C;
  end if;
  medium.p = p_in_internal;
  medium.h = h_in_internal;
  medium.Xi = X_in_internal[1:Medium.nXi];
  ports.C_outflow = fill(C_in_internal, nPorts);
end Boundary_ph;

Buildings.Fluid.Sources.FixedBoundary Buildings.Fluid.Sources.FixedBoundary

Boundary source component

Buildings.Fluid.Sources.FixedBoundary

Information


Model FixedBoundary defines constant values for boundary conditions:

Note, that boundary temperature, density, specific enthalpy, mass fractions and trace substances have only an effect if the mass flow is from the Boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary pressure, do not have an effect.


Extends from Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model within the source
Boundary pressure or Boundary density
Booleanuse_ptrueselect p or d
AbsolutePressurepMedium.p_defaultBoundary pressure [Pa]
DensitydMedium.density_pTX(Medium.p_...Boundary density [kg/m3]
Boundary temperature or Boundary specific enthalpy
Booleanuse_Ttrueselect T or h
TemperatureTMedium.T_defaultBoundary temperature [K]
SpecificEnthalpyhMedium.h_defaultBoundary specific enthalpy [J/kg]
Only for multi-substance flow
MassFractionX[Medium.nX]Medium.X_defaultBoundary mass fractions m_i/m [kg/kg]
Only for trace-substance flow
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Boundary trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 

Modelica definition

model FixedBoundary "Boundary source component"
  extends Modelica.Fluid.Sources.BaseClasses.PartialSource;
  parameter Boolean use_p=true "select p or d";
  parameter Medium.AbsolutePressure p=Medium.p_default "Boundary pressure";
  parameter Medium.Density d=Medium.density_pTX(Medium.p_default, Medium.T_default, Medium.X_default) 
    "Boundary density";
  parameter Boolean use_T=true "select T or h";
  parameter Medium.Temperature T=Medium.T_default "Boundary temperature";
  parameter Medium.SpecificEnthalpy h=Medium.h_default 
    "Boundary specific enthalpy";
  parameter Medium.MassFraction X[Medium.nX](
       quantity=Medium.substanceNames)=Medium.X_default 
    "Boundary mass fractions m_i/m";

  parameter Medium.ExtraProperty C[Medium.nC](
       quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) 
    "Boundary trace substances";


equation 
  Modelica.Fluid.Utilities.checkBoundary(Medium.mediumName, Medium.substanceNames,
                                        Medium.singleState, use_p, X,
                                        "FixedBoundary");
  if use_p or Medium.singleState then
    medium.p = p;
  else
    medium.d = d;
  end if;
  if use_T then
    medium.T = T;
  else
    medium.h = h;
  end if;

  medium.Xi = X[1:Medium.nXi];

  ports.C_outflow = fill(C, nPorts);
end FixedBoundary;

Buildings.Fluid.Sources.MassFlowSource_T Buildings.Fluid.Sources.MassFlowSource_T

Ideal flow source that produces a prescribed mass flow with prescribed temperature, mass fraction and trace substances

Buildings.Fluid.Sources.MassFlowSource_T

Information


Models an ideal flow source, with prescribed values of flow rate, temperature, composition and trace substances:

If use_m_flow_in is false (default option), the m_flow parameter is used as boundary pressure, and the m_flow_in input connector is disabled; if use_m_flow_in is true, then the m_flow parameter is ignored, and the value provided by the input connector is used instead.

The same thing goes for the temperature and composition

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary flow rate, do not have an effect.


Extends from Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model within the source
Booleanuse_m_flow_infalseGet the mass flow rate from the input connector
Booleanuse_T_infalseGet the temperature from the input connector
Booleanuse_X_infalseGet the composition from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]
TemperatureTMedium.T_defaultFixed value of temperature [K]
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputm_flow_inPrescribed mass flow rate
input RealInputT_inPrescribed fluid temperature
input RealInputX_in[Medium.nX]Prescribed fluid composition
input RealInputC_in[Medium.nC]Prescribed boundary trace substances

Modelica definition

model MassFlowSource_T 
  "Ideal flow source that produces a prescribed mass flow with prescribed temperature, mass fraction and trace substances"
  extends Modelica.Fluid.Sources.BaseClasses.PartialSource;
  parameter Boolean use_m_flow_in = false 
    "Get the mass flow rate from the input connector";
  parameter Boolean use_T_in= false 
    "Get the temperature from the input connector";
  parameter Boolean use_X_in = false 
    "Get the composition from the input connector";
  parameter Boolean use_C_in = false 
    "Get the trace substances from the input connector";
  parameter Medium.MassFlowRate m_flow = 0 
    "Fixed mass flow rate going out of the fluid port";
  parameter Medium.Temperature T = Medium.T_default 
    "Fixed value of temperature";
  parameter Medium.MassFraction X[Medium.nX] = Medium.X_default 
    "Fixed value of composition";
  parameter Medium.ExtraProperty C[Medium.nC](
       quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) 
    "Fixed values of trace substances";
  Modelica.Blocks.Interfaces.RealInput m_flow_in if     use_m_flow_in 
    "Prescribed mass flow rate";
  Modelica.Blocks.Interfaces.RealInput T_in if         use_T_in 
    "Prescribed fluid temperature";
  Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if 
                                                        use_X_in 
    "Prescribed fluid composition";
  Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if 
                                                        use_C_in 
    "Prescribed boundary trace substances";
protected 
  Modelica.Blocks.Interfaces.RealInput m_flow_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput T_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] 
    "Needed to connect to conditional connector";
equation 
  Modelica.Fluid.Utilities.checkBoundary(
    Medium.mediumName,
    Medium.substanceNames,
    Medium.singleState,
    true,
    X_in_internal,
    "MassFlowSource_T");
  connect(m_flow_in, m_flow_in_internal);
  connect(T_in, T_in_internal);
  connect(X_in, X_in_internal);
  connect(C_in, C_in_internal);
  if not use_m_flow_in then
    m_flow_in_internal = m_flow;
  end if;
  if not use_T_in then
    T_in_internal = T;
  end if;
  if not use_X_in then
    X_in_internal = X;
  end if;
  if not use_C_in then
    C_in_internal = C;
  end if;
  sum(ports.m_flow) = -m_flow_in_internal;
  medium.T = T_in_internal;
  medium.Xi = X_in_internal[1:Medium.nXi];
  ports.C_outflow = fill(C_in_internal, nPorts);
end MassFlowSource_T;

Buildings.Fluid.Sources.MassFlowSource_h Buildings.Fluid.Sources.MassFlowSource_h

Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, mass fraction and trace substances

Buildings.Fluid.Sources.MassFlowSource_h

Information


Models an ideal flow source, with prescribed values of flow rate, temperature and composition:

If use_m_flow_in is false (default option), the m_flow parameter is used as boundary pressure, and the m_flow_in input connector is disabled; if use_m_flow_in is true, then the m_flow parameter is ignored, and the value provided by the input connector is used instead.

The same thing goes for the temperature and composition

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary flow rate, do not have an effect.


Extends from Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model within the source
Booleanuse_m_flow_infalseGet the mass flow rate from the input connector
Booleanuse_h_infalseGet the specific enthalpy from the input connector
Booleanuse_X_infalseGet the composition from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]
SpecificEnthalpyhMedium.h_defaultFixed value of specific enthalpy [J/kg]
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputm_flow_inPrescribed mass flow rate
input RealInputh_inPrescribed fluid specific enthalpy
input RealInputX_in[Medium.nX]Prescribed fluid composition
input RealInputC_in[Medium.nC]Prescribed boundary trace substances

Modelica definition

model MassFlowSource_h 
  "Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, mass fraction and trace substances"
  extends Modelica.Fluid.Sources.BaseClasses.PartialSource;
  parameter Boolean use_m_flow_in = false 
    "Get the mass flow rate from the input connector";
  parameter Boolean use_h_in= false 
    "Get the specific enthalpy from the input connector";
  parameter Boolean use_X_in = false 
    "Get the composition from the input connector";
  parameter Boolean use_C_in = false 
    "Get the trace substances from the input connector";
  parameter Medium.MassFlowRate m_flow = 0 
    "Fixed mass flow rate going out of the fluid port";
  parameter Medium.SpecificEnthalpy h = Medium.h_default 
    "Fixed value of specific enthalpy";
  parameter Medium.MassFraction X[Medium.nX] = Medium.X_default 
    "Fixed value of composition";
  parameter Medium.ExtraProperty C[Medium.nC](
       quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) 
    "Fixed values of trace substances";
  Modelica.Blocks.Interfaces.RealInput m_flow_in if     use_m_flow_in 
    "Prescribed mass flow rate";
  Modelica.Blocks.Interfaces.RealInput h_in if              use_h_in 
    "Prescribed fluid specific enthalpy";
  Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if 
                                                        use_X_in 
    "Prescribed fluid composition";
  Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if 
                                                        use_C_in 
    "Prescribed boundary trace substances";
protected 
  Modelica.Blocks.Interfaces.RealInput m_flow_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput h_in_internal 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] 
    "Needed to connect to conditional connector";
  Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] 
    "Needed to connect to conditional connector";
equation 
  Modelica.Fluid.Utilities.checkBoundary(
    Medium.mediumName,
    Medium.substanceNames,
    Medium.singleState,
    true,
    X_in_internal,
    "MassFlowSource_h");
  connect(m_flow_in, m_flow_in_internal);
  connect(h_in, h_in_internal);
  connect(X_in, X_in_internal);
  connect(C_in, C_in_internal);
  if not use_m_flow_in then
    m_flow_in_internal = m_flow;
  end if;
  if not use_h_in then
    h_in_internal = h;
  end if;
  if not use_X_in then
    X_in_internal = X;
  end if;
  if not use_C_in then
    C_in_internal = C;
  end if;
  sum(ports.m_flow) = -m_flow_in_internal;
  medium.h = h_in_internal;
  medium.Xi = X_in_internal[1:Medium.nXi];
  ports.C_outflow = fill(C_in_internal, nPorts);
end MassFlowSource_h;

Buildings.Fluid.Sources.PrescribedExtraPropertyFlowRate Buildings.Fluid.Sources.PrescribedExtraPropertyFlowRate

Source with mass flow that does not take part in medium mass balance (such as CO2)

Buildings.Fluid.Sources.PrescribedExtraPropertyFlowRate

Information


This model adds a mass flow rate to the port for an auxiliary
medium that does not take part in the mass balance of the medium
model. Instead, this mass transfer is tracked separately. A typical
use of this source is to add carbon dioxide to a room, since the 
carbon dioxide concentration is typically so small that it need not be added to the
room mass balance.

Extends from Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model within the source
StringsubstanceName"CO2"Name of trace substance
Booleanuse_m_flow_infalseGet the trace substance mass flow rate from the input connector
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputm_flow_inPrescribed mass flow rate for extra property

Modelica definition

model PrescribedExtraPropertyFlowRate 
  "Source with mass flow that does not take part in medium mass balance (such as CO2)"
  extends Modelica.Fluid.Sources.BaseClasses.PartialSource(nPorts=1);


  parameter String substanceName = "CO2" "Name of trace substance";
  parameter Boolean use_m_flow_in = false 
    "Get the trace substance mass flow rate from the input connector";

  parameter Medium.MassFlowRate m_flow = 0 
    "Fixed mass flow rate going out of the fluid port";
  Modelica.Blocks.Interfaces.RealInput m_flow_in if 
       use_m_flow_in "Prescribed mass flow rate for extra property";

protected 
  Modelica.Blocks.Interfaces.RealInput m_flow_in_internal 
    "Needed to connect to conditional connector";
  parameter Medium.ExtraProperty C_in_internal[Medium.nC](
       fixed=false,
       quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) 
    "Boundary trace substances";
initial algorithm 
  for i in 1:Medium.nC loop
    if ( Modelica.Utilities.Strings.isEqual(Medium.extraPropertiesNames[i], substanceName)) then
      C_in_internal[i] := 1;
    else
      C_in_internal[i] := 0;
    end if;
  end for;
  assert(sum(C_in_internal) > 0, "Trace substance '" + substanceName + "' is not present in medium '"
         + Medium.mediumName + "'.\n"
         + "Check source parameter and medium model.");
equation 
  connect(m_flow_in, m_flow_in_internal);
  if not use_m_flow_in then
    m_flow_in_internal = m_flow;
  end if;

  assert(sum(m_flow_in_internal) >= 0, "Reverse flow for species source is not yet implemented.");
  sum(ports.m_flow) = -m_flow_in_internal;
  medium.T = Medium.T_default;
  medium.Xi = Medium.X_default[1:Medium.nXi];
  ports.C_outflow = fill(C_in_internal, nPorts);
end PrescribedExtraPropertyFlowRate;

HTML-documentation generated by Dymola Tue Sep 29 08:09:18 2009.