Modelica.Fluid.Fittings

Adaptors for connections of fluid components and the regulation of fluid flow

Information



Extends from Modelica.Fluid.Icons.VariantLibrary (Icon for a library that contains several variants of one component).

Package Content

NameDescription
Modelica.Fluid.Fittings.SimpleGenericOrifice SimpleGenericOrifice Simple generic orifice defined by pressure loss coefficient and diameter (only for flow from port_a to port_b)
Modelica.Fluid.Fittings.SharpEdgedOrifice SharpEdgedOrifice Pressure drop due to sharp edged orifice (for both flow directions)
Modelica.Fluid.Fittings.AbruptAdaptor AbruptAdaptor Pressure drop in pipe due to suddenly expanding or reducing area (for both flow directions)
Modelica.Fluid.Fittings.MultiPort MultiPort Multiply a port; useful if multiple connections shall be made to a port exposing a state
Modelica.Fluid.Fittings.TeeJunctionIdeal TeeJunctionIdeal Splitting/joining component with static balances for an infinitesimal control volume
Modelica.Fluid.Fittings.TeeJunctionVolume TeeJunctionVolume Splitting/joining component with static balances for a dynamic control volume
Modelica.Fluid.Fittings.BaseClasses BaseClasses Base classes used in the Fittings package (only of interest to build new component models)


Modelica.Fluid.Fittings.SimpleGenericOrifice Modelica.Fluid.Fittings.SimpleGenericOrifice

Simple generic orifice defined by pressure loss coefficient and diameter (only for flow from port_a to port_b)

Modelica.Fluid.Fittings.SimpleGenericOrifice

Information


This pressure drop component defines a simple, generic orifice, where the loss factor ζ is provided for one flow direction (e.g., from loss table of a book):

   Δp = 0.5*ζ*ρ*v*|v|
      = 8*ζ/(π^2*D^4*ρ) * m_flow*|m_flow|

where

Since the pressure loss factor zeta is provided only for a mass flow from port_a to port_b, the pressure loss is not correct when the flow is reversing. If reversing flow only occurs in a short time interval, this is most likely uncritical. If significant reversing flow can appear, this component should not be used.

Extends from Modelica.Fluid.Interfaces.PartialTwoPortTransport (Partial element transporting fluid between two ports without storage of mass or energy), Modelica.Fluid.Interfaces.PartialLumpedFlow (Base class for a lumped momentum balance).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
LengthpathLength0Length flow path [m]
Diameterdiameter Diameter of orifice [m]
Realzeta Loss factor for flow of port_a -> port_b
Booleanuse_zetatrue= false to obtain zeta from dp_nominal and m_flow_nominal
AbsolutePressuredp_nominal1e3Nominal pressure drop [Pa]
MassFlowRatem_flow_nominal1Mass flow rate for dp_nominal [kg/s]
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
DynamicsmomentumDynamicsTypes.Dynamics.SteadyStateFormulation of momentum balance
Advanced
AbsolutePressuredp_start0.01*system.p_startGuess value of dp = port_a.p - port_b.p [Pa]
MassFlowRatem_flow_startsystem.m_flow_startGuess value of m_flow = port_a.m_flow [kg/s]
MassFlowRatem_flow_smallsystem.m_flow_smallSmall mass flow rate for regularization of zero flow [kg/s]
Booleanfrom_dptrue= true, use m_flow = f(dp) else dp = f(m_flow)
AbsolutePressuredp_smallsystem.dp_smallTurbulent flow if |dp| >= dp_small [Pa]
Diagnostics
Booleanshow_Ttrue= true, if temperatures at port_a and port_b are computed
Booleanshow_V_flowtrue= true, if volume flow rate at inflowing port is computed

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

model SimpleGenericOrifice 
  "Simple generic orifice defined by pressure loss coefficient and diameter (only for flow from port_a to port_b)"

  extends Modelica.Fluid.Interfaces.PartialTwoPortTransport;

  extends Modelica.Fluid.Interfaces.PartialLumpedFlow(
    final pathLength = 0,
    final momentumDynamics = Types.Dynamics.SteadyState);

  parameter SI.Diameter diameter "Diameter of orifice";
  parameter Real zeta "Loss factor for flow of port_a -> port_b";
  parameter Boolean use_zeta = true 
    "= false to obtain zeta from dp_nominal and m_flow_nominal";

  // Operational conditions
  parameter SI.AbsolutePressure dp_nominal = 1e3 "Nominal pressure drop";
  parameter SI.MassFlowRate m_flow_nominal = 1 "Mass flow rate for dp_nominal";

  parameter Boolean from_dp = true 
    "= true, use m_flow = f(dp) else dp = f(m_flow)";
  parameter Medium.AbsolutePressure dp_small = system.dp_small 
    "Turbulent flow if |dp| >= dp_small";

  // Variables
  Real zeta_nominal(start = zeta);
  Medium.Density d = 0.5*(Medium.density(state_a) + Medium.density(state_b));
  Modelica.SIunits.Pressure dp_fg(start=dp_start) 
    "pressure loss due to friction and gravity";
  Modelica.SIunits.Area A_mean = Modelica.Constants.pi/4*diameter^2 
    "mean cross flow area";

equation 
  if use_zeta then
    zeta_nominal = zeta;
  else
    dp_nominal = BaseClasses.lossConstant_D_zeta(diameter, zeta_nominal)/d*m_flow_nominal^2;
  end if;

  Ib_flow = 0;
  F_p = A_mean*(Medium.pressure(state_b) - Medium.pressure(state_a));
  F_fg = A_mean*dp_fg;

  /*
   dp = 0.5*zeta*d*v*|v|
      = 0.5*zeta*d*1/(d*A)^2 * m_flow * |m_flow|
      = 0.5*zeta/A^2 *1/d * m_flow * |m_flow|
      = k/d * m_flow * |m_flow|
   k  = 0.5*zeta/A^2
      = 0.5*zeta/(pi*(D/2)^2)^2
      = 8*zeta/(pi*D^2)^2
  */
  if from_dp then
    m_flow = Utilities.regRoot2(
        dp_fg,
        dp_small,
        Medium.density(state_a)/BaseClasses.lossConstant_D_zeta(diameter, zeta_nominal),
        Medium.density(state_b)/BaseClasses.lossConstant_D_zeta(diameter, zeta_nominal));
  else
    dp_fg = Utilities.regSquare2(
        m_flow,
        m_flow_small,
        BaseClasses.lossConstant_D_zeta(diameter, zeta_nominal)/Medium.density(state_a),
        BaseClasses.lossConstant_D_zeta(diameter, zeta_nominal)/Medium.density(state_b));
  end if;

  // Isenthalpic state transformation (no storage and no loss of energy)
  port_a.h_outflow = inStream(port_b.h_outflow);
  port_b.h_outflow = inStream(port_a.h_outflow);

end SimpleGenericOrifice;

Modelica.Fluid.Fittings.SharpEdgedOrifice Modelica.Fluid.Fittings.SharpEdgedOrifice

Pressure drop due to sharp edged orifice (for both flow directions)

Modelica.Fluid.Fittings.SharpEdgedOrifice

Information


Extends from BaseClasses.QuadraticTurbulent.BaseModel (Generic pressure drop component with constant turbulent loss factor data and without an icon).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
LossFactorDatadataBaseClasses.QuadraticTurbule...Loss factor data
Lengthlength Length of orifice [m]
Diameterdiameter Inner diameter of pipe (= same at port_a and port_b) [m]
DiameterleastDiameter Smallest diameter of orifice [m]
Angle_degalpha Angle of orifice [deg]
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Advanced
AbsolutePressuredp_start0.01*system.p_startGuess value of dp = port_a.p - port_b.p [Pa]
MassFlowRatem_flow_startsystem.m_flow_startGuess value of m_flow = port_a.m_flow [kg/s]
MassFlowRatem_flow_smallsystem.m_flow_smallSmall mass flow rate for regularization of zero flow [kg/s]
Booleanfrom_dptrue= true, use m_flow = f(dp) else dp = f(m_flow)
Booleanuse_Refalse= true, if turbulent region is defined by Re, otherwise by dp_small or m_flow_small
AbsolutePressuredp_smallsystem.dp_smallTurbulent flow if |dp| >= dp_small [Pa]
Diagnostics
Booleanshow_Ttrue= true, if temperatures at port_a and port_b are computed
Booleanshow_V_flowtrue= true, if volume flow rate at inflowing port is computed
Booleanshow_Refalse= true, if Reynolds number is included for plotting

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

model SharpEdgedOrifice 
  "Pressure drop due to sharp edged orifice (for both flow directions)"
    import NonSI = Modelica.SIunits.Conversions.NonSIunits;
  extends BaseClasses.QuadraticTurbulent.BaseModel(final data=
          BaseClasses.QuadraticTurbulent.LossFactorData.sharpEdgedOrifice(
          diameter,
          leastDiameter,
          length,
          alpha));
  parameter SI.Length length "Length of orifice";
  parameter SI.Diameter diameter 
    "Inner diameter of pipe (= same at port_a and port_b)";
  parameter SI.Diameter leastDiameter "Smallest diameter of orifice";
  parameter NonSI.Angle_deg alpha "Angle of orifice";

end SharpEdgedOrifice;

Modelica.Fluid.Fittings.AbruptAdaptor Modelica.Fluid.Fittings.AbruptAdaptor

Pressure drop in pipe due to suddenly expanding or reducing area (for both flow directions)

Modelica.Fluid.Fittings.AbruptAdaptor

Information



Extends from BaseClasses.QuadraticTurbulent.BaseModelNonconstantCrossSectionArea (Generic pressure drop component with constant turbulent loss factor data and without an icon, for non-constant cross section area).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
LossFactorDatadataBaseClasses.QuadraticTurbule...Loss factor data
Diameterdiameter_a Inner diameter of pipe at port_a [m]
Diameterdiameter_b Inner diameter of pipe at port_b [m]
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Advanced
AbsolutePressuredp_start0.01*system.p_startGuess value of dp = port_a.p - port_b.p [Pa]
MassFlowRatem_flow_startsystem.m_flow_startGuess value of m_flow = port_a.m_flow [kg/s]
MassFlowRatem_flow_smallsystem.m_flow_smallSmall mass flow rate for regularization of zero flow [kg/s]
AbsolutePressuredp_smallsystem.dp_smallTurbulent flow if |dp| >= dp_small [Pa]
Diagnostics
Booleanshow_Ttrue= true, if temperatures at port_a and port_b are computed
Booleanshow_V_flowtrue= true, if volume flow rate at inflowing port is computed
Booleanshow_Refalse= true, if Reynolds number is included for plotting
Booleanshow_totalPressuresfalse= true, if total pressures are included for plotting
Booleanshow_portVelocitiesfalse= true, if port velocities are included for plotting

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

model AbruptAdaptor 
  "Pressure drop in pipe due to suddenly expanding or reducing area (for both flow directions)"
  extends BaseClasses.QuadraticTurbulent.BaseModelNonconstantCrossSectionArea(final data
      =   BaseClasses.QuadraticTurbulent.LossFactorData.suddenExpansion(
          diameter_a, diameter_b));
  parameter SI.Diameter diameter_a "Inner diameter of pipe at port_a";
  parameter SI.Diameter diameter_b "Inner diameter of pipe at port_b";

end AbruptAdaptor;

Modelica.Fluid.Fittings.MultiPort Modelica.Fluid.Fittings.MultiPort

Multiply a port; useful if multiple connections shall be made to a port exposing a state

Modelica.Fluid.Fittings.MultiPort

Information


This model is useful if multiple connections shall be made to a port of a volume model exposing a state, like a pipe with ModelStructure av_vb. The mixing is shifted into the volume connected to port_a and the result is propageted back to each ports_b.

If multiple connections were directly made to the volume, then ideal mixing would take place in the connection set, outside the volume. This is normally not intended.

Connectors

TypeNameDescription
FluidPort_aport_a 
FluidPorts_bports_b[nPorts_b] 

Modelica definition

model MultiPort 
  "Multiply a port; useful if multiple connections shall be made to a port exposing a state"

  function positiveMax
    input Real x;
    output Real y;
  algorithm 
    y :=max(x, 1e-10);
  end positiveMax;

  import Modelica.Constants;

  replaceable package Medium=Modelica.Media.Interfaces.PartialMedium;

  // Ports
  parameter Integer nPorts_b=0 
    "Number of outlet ports (mass is distributed evenly between the outlet ports";

  Modelica.Fluid.Interfaces.FluidPort_a port_a(
    redeclare package Medium=Medium);
  Modelica.Fluid.Interfaces.FluidPorts_b ports_b[nPorts_b](
    redeclare each package Medium=Medium);

  Medium.MassFraction ports_b_Xi_inStream[nPorts_b,Medium.nXi] 
    "inStream mass fractions at ports_b";
  Medium.ExtraProperty ports_b_C_inStream[nPorts_b,Medium.nC] 
    "inStream extra properties at ports_b";

equation 
  // Only one connection allowed to a port to avoid unwanted ideal mixing
  for i in 1:nPorts_b loop
    assert(cardinality(ports_b[i]) <= 1,"
each ports_b[i] of boundary shall at most be connected to one component.
If two or more connections are present, ideal mixing takes
place with these connections, which is usually not the intention
of the modeller. Increase nPorts_b to add an additional port.
");
  end for;

  // mass and momentum balance
  0 = port_a.m_flow + sum(ports_b.m_flow);
  ports_b.p = fill(port_a.p, nPorts_b);

  // mixing at port_a
  port_a.h_outflow = sum({positiveMax(ports_b[j].m_flow)*inStream(ports_b[j].h_outflow) for j in 1:nPorts_b})
                       / sum({positiveMax(ports_b[j].m_flow) for j in 1:nPorts_b});
  for j in 1:nPorts_b loop
     // expose stream values from port_a to ports_b
     ports_b[j].h_outflow  = inStream(port_a.h_outflow);
     ports_b[j].Xi_outflow = inStream(port_a.Xi_outflow);
     ports_b[j].C_outflow  = inStream(port_a.C_outflow);

     ports_b_Xi_inStream[j,:] = inStream(ports_b[j].Xi_outflow);
     ports_b_C_inStream[j,:] = inStream(ports_b[j].C_outflow);
  end for;
  for i in 1:Medium.nXi loop
    port_a.Xi_outflow[i] = (positiveMax(ports_b.m_flow)*ports_b_Xi_inStream[:,i])
                         / sum(positiveMax(ports_b.m_flow));
  end for;
  for i in 1:Medium.nC loop
    port_a.C_outflow[i] = (positiveMax(ports_b.m_flow)*ports_b_C_inStream[:,i])
                         / sum(positiveMax(ports_b.m_flow));
  end for;
end MultiPort;

Modelica.Fluid.Fittings.TeeJunctionIdeal Modelica.Fluid.Fittings.TeeJunctionIdeal

Splitting/joining component with static balances for an infinitesimal control volume

Modelica.Fluid.Fittings.TeeJunctionIdeal

Information


  This model is the simplest implementation for a splitting/joining component for
  three flows. Its use is not required. It just formulates the balance
  equations in the same way that the connect symmantics would formulate them anyways.
  The main advantage of using this component is, that the user does not get
  confused when looking at the specific enthalpy at each port which might be confusing
  when not using a splitting/joining component. The reason for the confusion is that one exmanins the mixing
  enthalpy of the infinitesimal control volume introduced with the connect statement when
  looking at the specific enthalpy in the connector which
  might not be equal to the specific enthalpy at the port in the "real world".

Extends from Modelica.Fluid.Fittings.BaseClasses.PartialTeeJunction (Base class for a splitting/joining component with three ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component

Connectors

TypeNameDescription
FluidPort_aport_1 
FluidPort_bport_2 
FluidPort_aport_3 

Modelica definition

model TeeJunctionIdeal 
  "Splitting/joining component with static balances for an infinitesimal control volume"
  extends Modelica.Fluid.Fittings.BaseClasses.PartialTeeJunction;

equation 
  connect(port_1, port_2);
  connect(port_1, port_3);
end TeeJunctionIdeal;

Modelica.Fluid.Fittings.TeeJunctionVolume Modelica.Fluid.Fittings.TeeJunctionVolume

Splitting/joining component with static balances for a dynamic control volume

Modelica.Fluid.Fittings.TeeJunctionVolume

Information


  This model introduces a mixing volume into a junction.
  This might be useful to examine the non-ideal mixing taking place in a real junction.

Extends from Modelica.Fluid.Fittings.BaseClasses.PartialTeeJunction (Base class for a splitting/joining component with three ports), Modelica.Fluid.Interfaces.PartialLumpedVolume (Lumped volume with mass and energy balance).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VolumefluidVolumeVVolume [m3]
VolumeV Mixing volume inside junction [m3]
Assumptions
Dynamics
DynamicsenergyDynamicssystem.energyDynamicsFormulation of energy balance
DynamicsmassDynamicssystem.massDynamicsFormulation of mass balance
Initialization
AbsolutePressurep_startsystem.p_startStart value of pressure [Pa]
Booleanuse_T_starttrue= true, use T_start, otherwise h_start
TemperatureT_startif use_T_start then system.T...Start value of temperature [K]
SpecificEnthalpyh_startif use_T_start then Medium.s...Start value of specific enthalpy [J/kg]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances

Connectors

TypeNameDescription
FluidPort_aport_1 
FluidPort_bport_2 
FluidPort_aport_3 

Modelica definition

model TeeJunctionVolume 
  "Splitting/joining component with static balances for a dynamic control volume"
  extends Modelica.Fluid.Fittings.BaseClasses.PartialTeeJunction;
  extends Modelica.Fluid.Interfaces.PartialLumpedVolume(
    final fluidVolume = V);

  parameter SI.Volume V "Mixing volume inside junction";

equation 
  // Only one connection allowed to a port to avoid unwanted ideal mixing
  assert(cardinality(port_1) <= 1,"
port_1 of volume can at most be connected to one component.
If two or more connections are present, ideal mixing takes
place with these connections which is usually not the intention
of the modeller.
");
  assert(cardinality(port_2) <= 1,"
port_2 of volume can at most be connected to one component.
If two or more connections are present, ideal mixing takes
place with these connections which is usually not the intention
of the modeller.
");
  assert(cardinality(port_3) <= 1,"
port_3 of volume can at most be connected to one component.
If two or more connections are present, ideal mixing takes
place with these connections which is usually not the intention
of the modeller.
");

  // Boundary conditions
  port_1.h_outflow = medium.h;
  port_2.h_outflow = medium.h;
  port_3.h_outflow = medium.h;

  port_1.Xi_outflow = medium.Xi;
  port_2.Xi_outflow = medium.Xi;
  port_3.Xi_outflow = medium.Xi;

  port_1.C_outflow = C;
  port_2.C_outflow = C;
  port_3.C_outflow = C;

  // Mass balances
  mb_flow = port_1.m_flow + port_2.m_flow + port_3.m_flow "Mass balance";
  mbXi_flow = port_1.m_flow*actualStream(port_1.Xi_outflow)
              + port_2.m_flow*actualStream(port_2.Xi_outflow)
              + port_3.m_flow*actualStream(port_3.Xi_outflow) 
    "Component mass balances";

  mbC_flow  = port_1.m_flow*actualStream(port_1.C_outflow)
            + port_2.m_flow*actualStream(port_2.C_outflow)
            + port_3.m_flow*actualStream(port_3.C_outflow) 
    "Trace substance mass balances";

  // Momentum balance (suitable for compressible media)
  port_1.p = medium.p;
  port_2.p = medium.p;
  port_3.p = medium.p;

  // Energy balance
  Hb_flow = port_1.m_flow*actualStream(port_1.h_outflow)
            + port_2.m_flow*actualStream(port_2.h_outflow)
            + port_3.m_flow*actualStream(port_3.h_outflow);
  Qb_flow = 0;
  Wb_flow = 0;

end TeeJunctionVolume;

HTML-documentation generated by Dymola Sun Jan 17 21:12:16 2010.