Buildings.Fluids.Interfaces

Package with interfaces for fluid models

Package Content

NameDescription
PartialDoubleFluidParameters Partial model with parameters that are shared by flow models
Buildings.Fluids.Interfaces.PartialDynamicFourPortTransformer PartialDynamicFourPortTransformer Partial element transporting two fluid streams between four ports with storing mass or energy
PartialSingleFluidParameters Partial model with parameters that are shared by flow models
Buildings.Fluids.Interfaces.PartialStaticFourPortHeatMassTransfer PartialStaticFourPortHeatMassTransfer Partial element transporting two fluid streams between four ports without storing mass or energy
Buildings.Fluids.Interfaces.PartialStaticFourPortInterface PartialStaticFourPortInterface Partial element transporting fluid between two ports without storing mass or energy
Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer PartialStaticTwoPortHeatMassTransfer Partial element transporting fluid between two ports without storing mass or energy
Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface PartialStaticTwoPortInterface Partial element transporting fluid between two ports without storing mass or energy
Buildings.Fluids.Interfaces.PartialStaticTwoPortTransformer PartialStaticTwoPortTransformer Partial element transporting fluid between two ports without storing mass or energy


Buildings.Fluids.Interfaces.PartialDoubleFluidParameters

Partial model with parameters that are shared by flow models

Information


This model contains parameters that are used by models that have two fluids.


Parameters

TypeNameDefaultDescription
Advanced
TempflowDirection_1Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component
TempflowDirection_2Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

Modelica definition

partial model PartialDoubleFluidParameters 
  "Partial model with parameters that are shared by flow models" 
  
  replaceable package Medium_1 = Modelica.Media.Interfaces.PartialMedium 
    "Fluid 1";
  replaceable package Medium_2 = Modelica.Media.Interfaces.PartialMedium 
    "Fluid 2";
  
 parameter Modelica_Fluid.Types.FlowDirection.Temp flowDirection_1=
       Modelica_Fluid.Types.FlowDirection.Bidirectional 
    "Unidirectional (port_a -> port_b) or bidirectional flow component";
 parameter Modelica_Fluid.Types.FlowDirection.Temp flowDirection_2=
       Modelica_Fluid.Types.FlowDirection.Bidirectional 
    "Unidirectional (port_a -> port_b) or bidirectional flow component";
  
  
    final parameter Boolean allowFlowReversal_1=
     flowDirection_1 == Modelica_Fluid.Types.FlowDirection.Bidirectional 
    "= false, if flow only from port_a to port_b, otherwise reversing flow allowed";
    final parameter Boolean allowFlowReversal_2=
     flowDirection_2 == Modelica_Fluid.Types.FlowDirection.Bidirectional 
    "= false, if flow only from port_a to port_b, otherwise reversing flow allowed";
end PartialDoubleFluidParameters;

Buildings.Fluids.Interfaces.PartialDynamicFourPortTransformer Buildings.Fluids.Interfaces.PartialDynamicFourPortTransformer

Partial element transporting two fluid streams between four ports with storing mass or energy

Buildings.Fluids.Interfaces.PartialDynamicFourPortTransformer

Information


This component transports two fluid streams between four ports. It provides the basic model for implementing a dynamic heat exchanger. It is used by HeatExchangers.BaseClasses.HexElement. The variable names follow the conventions used in Modelica_Fluid.HeatExchangers.BasicHX.


Parameters

TypeNameDefaultDescription
MixingVolumeDryAirvol_2redeclare Buildings.Fluids.M...Volume for fluid 2
HeatCapacityC2Heat capacity of metal (= cp*m) [J/K]
Fluid 1
replaceable package Medium_1PartialMediumFluid 1
Fluid 2
replaceable package Medium_2PartialMediumFluid 2
Initialization
MassFlowRatem_flow_1 Mass flow rate from port_a1 to port_b1 (m_flow_1 > 0 is design flow direction) [kg/s]
MassFlowRatem_flow_2 Mass flow rate from port_a2 to port_b2 (m_flow_2 > 0 is design flow direction) [kg/s]
Pressuredp_1 Pressure difference between port_a1 and port_b1 [Pa]
Pressuredp_2 Pressure difference between port_a2 and port_b2 [Pa]
Nominal condition
Timetau_160Time constant at nominal flow [s]
MassFlowRatem0_flow_1 Mass flow rate [kg/s]
Timetau_260Time constant at nominal flow [s]
MassFlowRatem0_flow_2 Mass flow rate [kg/s]
Advanced
TempflowDirection_1Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component
TempflowDirection_2Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

Connectors

TypeNameDescription
FluidPort_aport_a1Fluid connector a for medium 1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b for medium 1 (positive design flow direction is from port_a to port_b)
FluidPort_aport_a2Fluid connector a for medium 2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b for medium 2 (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialDynamicFourPortTransformer 
  "Partial element transporting two fluid streams between four ports with storing mass or energy" 
  extends Buildings.Fluids.Interfaces.PartialStaticFourPortInterface;
  import Modelica.Constants;
  
  
  Buildings.Fluids.MixingVolumes.MixingVolume vol_1(
    redeclare package Medium = Medium_1,
    nP = 2,
    V=m0_flow_1*tau_1/rho0_1,
    medium(T(stateSelect=StateSelect.always))) "Volume for fluid 1";
  
  replaceable Buildings.Fluids.MixingVolumes.MixingVolumeDryAir vol_2(
    redeclare package Medium = Medium_2,
    nP = 2,
    V=m0_flow_2*tau_2/rho0_2) 
        extends 
    Buildings.Fluids.MixingVolumes.BaseClasses.PartialMixingVolumeWaterPort 
    "Volume for fluid 2";
  
  parameter Modelica.SIunits.Time tau_1 = 60 "Time constant at nominal flow";
  parameter Modelica.SIunits.MassFlowRate m0_flow_1(min=0) "Mass flow rate";
  
  parameter Modelica.SIunits.Time tau_2 = 60 "Time constant at nominal flow";
  parameter Modelica.SIunits.MassFlowRate m0_flow_2(min=0) "Mass flow rate";
  
  Modelica.Thermal.HeatTransfer.HeatCapacitor mas(C=C, T(stateSelect=StateSelect.always)) 
    "Mass of metal";
  Modelica.Thermal.HeatTransfer.Convection con1 
    "Convection (and conduction) on fluid side 1";
  parameter Modelica.SIunits.HeatCapacity C=2 "Heat capacity of metal (= cp*m)";
  Modelica.Thermal.HeatTransfer.Convection con2 
    "Convection (and conduction) on fluid side 2";
  Modelica.Thermal.HeatTransfer.TemperatureSensor temSen 
    "Temperature sensor of metal";
  Modelica.Thermal.HeatTransfer.HeatFlowSensor heaFloSen_1 
    "Heat input into fluid 1";
  Modelica.Thermal.HeatTransfer.HeatFlowSensor heaFloSen_2 
    "Heat input into fluid 1";
protected 
  parameter Medium_1.ThermodynamicState sta0_1(T=293.15, p=101325);
  parameter Modelica.SIunits.Density rho0_1=Medium_1.density(sta0_1) 
    "Density, used to compute fluid volume";
  parameter Medium_2.ThermodynamicState sta0_2(T=293.15, p=101325);
  parameter Modelica.SIunits.Density rho0_2=Medium_2.density(sta0_2) 
    "Density, used to compute fluid volume";
equation 
  Q_flow_1 = heaFloSen_1.Q_flow;
  Q_flow_2 = heaFloSen_2.Q_flow;
  
  connect(con1.solid, mas.port);
  connect(con2.solid, mas.port);
  connect(mas.port, temSen.port);
  connect(con1.fluid, heaFloSen_1.port_a);
  connect(con2.fluid, heaFloSen_2.port_a);
  connect(heaFloSen_2.port_b, vol_2.thermalPort);
  connect(heaFloSen_1.port_b, vol_1.thermalPort);
  connect(port_a1, vol_1.port[1]);
  connect(vol_1.port[2], port_b1);
  connect(port_a2, vol_2.port[1]);
  connect(vol_2.port[2], port_b2);
end PartialDynamicFourPortTransformer;

Buildings.Fluids.Interfaces.PartialSingleFluidParameters

Partial model with parameters that are shared by flow models

Information


This model contains parameters that are used by models that have one fluid.


Parameters

TypeNameDefaultDescription
Advanced
TempflowDirectionModelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

Modelica definition

partial model PartialSingleFluidParameters 
  "Partial model with parameters that are shared by flow models" 
  import SI = Modelica.SIunits;
  import Modelica.Constants;
  replaceable package Medium = 
      Modelica.Media.Interfaces.PartialMedium "Medium in the component";
  
 parameter Modelica_Fluid.Types.FlowDirection.Temp flowDirection=Modelica_Fluid.
       Types.FlowDirection.Bidirectional 
    "Unidirectional (port_a -> port_b) or bidirectional flow component";
  
protected 
    parameter Boolean allowFlowReversal=
     flowDirection == Modelica_Fluid.Types.FlowDirection.Bidirectional 
    "= false, if flow only from port_a to port_b, otherwise reversing flow allowed";
end PartialSingleFluidParameters;

Buildings.Fluids.Interfaces.PartialStaticFourPortHeatMassTransfer Buildings.Fluids.Interfaces.PartialStaticFourPortHeatMassTransfer

Partial element transporting two fluid streams between four ports without storing mass or energy

Buildings.Fluids.Interfaces.PartialStaticFourPortHeatMassTransfer

Information


This component transports two fluid streams between four ports, without storing mass or energy. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but does not include the energy, mass and substance balance, and it uses four ports. Reversal and zero mass flow rate is taken care of, for details see definition of built-in operator semiLinear(). The variable names follow the conventions used in Modelica_Fluid.HeatExchangers.BasicHX.

When using this partial component, equations for the momentum balance have to be added by specifying a relationship between the pressure drop dpi and the mass flow rate m_flowi, where i=1, 2 and the energy and mass balances, such as

  port_a1.H_flow   + port_b1.H_flow = 0;
  port_a1.m_flow   + port_b1.m_flow = 0;
  port_a1.mXi_flow + port_b1.mXi_flow = zeros(Medium_1.nXi);
 
  port_a2.H_flow   + port_b2.H_flow = 0;
  port_a2.m_flow   + port_b2.m_flow = 0;
  port_a2.mXi_flow + port_b2.mXi_flow = zeros(Medium_2.nXi);


Parameters

TypeNameDefaultDescription
Fluid 1
replaceable package Medium_1PartialMediumFluid 1
Fluid 2
replaceable package Medium_2PartialMediumFluid 2
Initialization
MassFlowRatem_flow_1 Mass flow rate from port_a1 to port_b1 (m_flow_1 > 0 is design flow direction) [kg/s]
MassFlowRatem_flow_2 Mass flow rate from port_a2 to port_b2 (m_flow_2 > 0 is design flow direction) [kg/s]
Pressuredp_1 Pressure difference between port_a1 and port_b1 [Pa]
Pressuredp_2 Pressure difference between port_a2 and port_b2 [Pa]
Advanced
TempflowDirection_1Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component
TempflowDirection_2Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

Connectors

TypeNameDescription
FluidPort_aport_a1Fluid connector a for medium 1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b for medium 1 (positive design flow direction is from port_a to port_b)
FluidPort_aport_a2Fluid connector a for medium 2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b for medium 2 (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialStaticFourPortHeatMassTransfer 
  "Partial element transporting two fluid streams between four ports without storing mass or energy" 
  extends Buildings.Fluids.Interfaces.PartialStaticFourPortInterface;
  import Modelica.Constants;
  
  
  Medium_1.MassFlowRate mXi_flow_1[Medium_1.nXi] 
    "Mass flow rates of independent substances added to the medium 1";
  Medium_2.MassFlowRate mXi_flow_2[Medium_2.nXi] 
    "Mass flow rates of independent substances added to the medium 2";
protected 
  parameter Real one = 1 
    "Dummy parameter to break semiLinear sequence (Dynasim support request #8991)";
equation 
  /* Handle reverse and zero flow */
  // enthalpy balance
  port_a1.H_flow   = if port_a1.m_flow >= 0 then (port_a1.m_flow * port_a1.h) else 
                         -port_b1.m_flow * port_b1.h - Q_flow_1;
  
  port_a2.H_flow   = if port_a2.m_flow >= 0 then (port_a2.m_flow * port_a2.h) else 
                         -port_b2.m_flow * port_b2.h - Q_flow_2;
  
  // species flow balance (taking into account the species influx
  for i in 1:Medium_1.nXi loop
     port_a1.mXi_flow[i] = if port_a1.m_flow >= 0 then 
                               (port_a1.m_flow * port_a1.Xi[i]) else 
                               -port_b1.m_flow * port_b1.Xi[i] - mXi_flow_1[i];
  end for;
  for i in 1:Medium_2.nXi loop
     port_a2.mXi_flow[i] = if port_a2.m_flow >= 0 then 
                               (port_a2.m_flow * port_a2.Xi[i]) else 
                               -port_b2.m_flow * port_b2.Xi[i] - mXi_flow_2[i];
  end for;
  
  /* Energy, mass and substance mass balance */
  0 = port_a1.H_flow + port_b1.H_flow     + Q_flow_1;
  0 = port_a1.m_flow + port_b1.m_flow     + sum(mXi_flow_1);
  zeros(Medium_1.nXi) = port_a1.mXi_flow + one * port_b1.mXi_flow + mXi_flow_1;
  
  0 = port_a2.H_flow + port_b2.H_flow     + Q_flow_2;
  0 = port_a2.m_flow + port_b2.m_flow     + sum(mXi_flow_2);
  zeros(Medium_2.nXi) = port_a2.mXi_flow + one * port_b2.mXi_flow + mXi_flow_2;
  
end PartialStaticFourPortHeatMassTransfer;

Buildings.Fluids.Interfaces.PartialStaticFourPortInterface Buildings.Fluids.Interfaces.PartialStaticFourPortInterface

Partial element transporting fluid between two ports without storing mass or energy

Buildings.Fluids.Interfaces.PartialStaticFourPortInterface

Information


This component defines the interface for models that transport two fluid streams between four ports. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but does not include the energy, mass and substance balance.

The model is used by other models in this package that add heat transfer, mass transfer and pressure drop equations.


Parameters

TypeNameDefaultDescription
Fluid 1
replaceable package Medium_1PartialMediumFluid 1
Fluid 2
replaceable package Medium_2PartialMediumFluid 2
Advanced
TempflowDirection_1Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component
TempflowDirection_2Modelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

Connectors

TypeNameDescription
FluidPort_aport_a1Fluid connector a for medium 1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b for medium 1 (positive design flow direction is from port_a to port_b)
FluidPort_aport_a2Fluid connector a for medium 2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b for medium 2 (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialStaticFourPortInterface 
  "Partial element transporting fluid between two ports without storing mass or energy" 
  extends Buildings.Fluids.Interfaces.PartialDoubleFluidParameters;
  
  
  Modelica_Fluid.Interfaces.FluidPort_a port_a1(redeclare package Medium = 
        Medium_1, m_flow(start=0, min=if allowFlowReversal_1 then -Modelica.Constants.inf else 
                0)) 
    "Fluid connector a for medium 1 (positive design flow direction is from port_a1 to port_b1)";
  Modelica_Fluid.Interfaces.FluidPort_b port_b1(redeclare package Medium = 
        Medium_1, m_flow(start=0, max=if allowFlowReversal_1 then +Modelica.Constants.inf else 
                0)) 
    "Fluid connector b for medium 1 (positive design flow direction is from port_a to port_b)";
  Modelica_Fluid.Interfaces.FluidPort_a port_a2(redeclare package Medium = 
        Medium_2, m_flow(start=0, min=if allowFlowReversal_2 then -Modelica.Constants.inf else 
                0)) 
    "Fluid connector a for medium 2 (positive design flow direction is from port_a2 to port_b2)";
  Modelica_Fluid.Interfaces.FluidPort_b port_b2(redeclare package Medium = 
        Medium_2, m_flow(start=0, max=if allowFlowReversal_2 then +Modelica.Constants.inf else 
                0)) 
    "Fluid connector b for medium 2 (positive design flow direction is from port_a to port_b)";
  Medium_1.BaseProperties medium_a1(T(start = Medium_1.T_default), h(start=Medium_1.h_default),
                   p(start=Medium_1.p_default)) "Medium properties in port_a1";
  Medium_1.BaseProperties medium_b1(T(start = Medium_1.T_default), h(start=Medium_1.h_default),
                   p(start=Medium_1.p_default)) "Medium properties in port_b1";
  
  Medium_2.BaseProperties medium_a2(T(start = Medium_2.T_default), h(start=Medium_2.h_default),
                   p(start=Medium_2.p_default)) "Medium properties in port_a2";
  Medium_2.BaseProperties medium_b2(T(start = Medium_2.T_default), h(start=Medium_2.h_default),
                   p(start=Medium_2.p_default)) "Medium properties in port_b2";
  
  Medium_1.MassFlowRate m_flow_1(start=0) 
    "Mass flow rate from port_a1 to port_b1 (m_flow_1 > 0 is design flow direction)";
  Medium_2.MassFlowRate m_flow_2(start=0) 
    "Mass flow rate from port_a2 to port_b2 (m_flow_2 > 0 is design flow direction)";
  
  Modelica.SIunits.HeatFlowRate Q_flow_1 
    "Heat transfered from solid into medium 1";
  Modelica.SIunits.HeatFlowRate Q_flow_2 
    "Heat transfered from solid into medium 2";
  
  Modelica.SIunits.VolumeFlowRate V_flow_a1 "Volume flow rate at port_a1";
  
  Modelica.SIunits.VolumeFlowRate V_flow_a2 "Volume flow rate at port_a2";
  
  Modelica.SIunits.Pressure dp_1(start=0) 
    "Pressure difference between port_a1 and port_b1";
  Modelica.SIunits.Pressure dp_2(start=0) 
    "Pressure difference between port_a2 and port_b2";
  
equation 
  // Properties in the ports
  // Medium 1
  port_a1.p   = medium_a1.p;
  port_a1.h   = medium_a1.h;
  port_a1.Xi = medium_a1.Xi;
  port_b1.p   = medium_b1.p;
  port_b1.h   = medium_b1.h;
  port_b1.Xi = medium_b1.Xi;
  // Medium 2
  port_a2.p   = medium_a2.p;
  port_a2.h   = medium_a2.h;
  port_a2.Xi = medium_a2.Xi;
  port_b2.p   = medium_b2.p;
  port_b2.h   = medium_b2.h;
  port_b2.Xi = medium_b2.Xi;
  
  // Design direction of mass flow rate
  m_flow_1 = port_a1.m_flow;
  m_flow_2 = port_a2.m_flow;
  
  // Volume flow rates
  V_flow_a1 = port_a1.m_flow/medium_a1.d;
  V_flow_a2 = port_a2.m_flow/medium_a2.d;
  
  // Pressure difference between ports
  dp_1 = port_a1.p - port_b1.p;
  dp_2 = port_a2.p - port_b2.p;
  
  ///////////////////////////////////////////////////////////////////////////////////
  // Extra species flow. This may be removed when upgrading to the new Modelica.Fluid.  
  port_a1.mC_flow = semiLinear(port_a1.m_flow, port_a1.C, port_b1.C);
  port_a1.mC_flow + port_b1.mC_flow = zeros(Medium_1.nC);
  port_a2.mC_flow = semiLinear(port_a2.m_flow, port_a2.C, port_b2.C);
  port_a2.mC_flow + port_b2.mC_flow = zeros(Medium_2.nC);
  ///////////////////////////////////////////////////////////////////////////////////
  
end PartialStaticFourPortInterface;

Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer

Partial element transporting fluid between two ports without storing mass or energy

Buildings.Fluids.Interfaces.PartialStaticTwoPortHeatMassTransfer

Information


This component transports fluid between its two ports, without storing mass or energy. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but it does use a different implementation for handling reverse flow because in this component, mass flow rate can be added or removed from the medium.

When using this partial component, an equation for the momentum balance has to be added by specifying a relationship between the pressure drop dp and the mass flow rate m_flow and the energy and mass balances, such as

  dp = 0;
  mWat_flow = u * m0_flow;
  Q_flow = Medium.enthalpyOfLiquid(TWat) * mWat_flow;
  for i in 1:Medium.nXi loop
     mXi_flow[i] = if ( i == Medium.Water) then  mWat_flow else 0;
  end for;


Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Initialization
MassFlowRatem_flow Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s]
Pressuredp Pressure difference between port_a and port_b [Pa]
Advanced
TempflowDirectionModelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

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

partial model PartialStaticTwoPortHeatMassTransfer 
  "Partial element transporting fluid between two ports without storing mass or energy" 
  extends Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface;
  import Modelica.Constants;
  
  Modelica.SIunits.HeatFlowRate Q_flow "Heat transfered into the medium";
  Medium.MassFlowRate mXi_flow[Medium.nXi] 
    "Mass flow rates of independent substances added to the medium";
equation 
  /* Handle reverse and zero flow */
  port_a.H_flow   = if port_a.m_flow >= 0 then (port_a.m_flow * port_a.h) else 
                         -port_b.m_flow * port_b.h - Q_flow;
  port_a.mXi_flow = if port_a.m_flow >= 0 then (port_a.m_flow * port_a.Xi) else 
                         -port_b.m_flow * port_b.Xi - mXi_flow;
  
  /* Energy, mass and substance mass balance */
  0 = port_a.H_flow + port_b.H_flow     + Q_flow;
  0 = port_a.m_flow + port_b.m_flow     + sum(mXi_flow);
  zeros(Medium.nXi) = port_a.mXi_flow + port_b.mXi_flow + mXi_flow;
end PartialStaticTwoPortHeatMassTransfer;

Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface

Partial element transporting fluid between two ports without storing mass or energy

Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface

Information


This component defines the interface for models that transports a fluid between its two ports. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but does not include the energy, mass and substance balance.

The model is used by other models in this package that add heat transfer, mass transfer and pressure drop equations. See for example PartialStaticTwoPortHeatMassTransfer.


Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Advanced
TempflowDirectionModelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

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

partial model PartialStaticTwoPortInterface 
  "Partial element transporting fluid between two ports without storing mass or energy" 
  extends Buildings.Fluids.Interfaces.PartialSingleFluidParameters;
  import Modelica.Constants;
  
  
  Modelica_Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = 
        Medium, m_flow(start=0, min=if allowFlowReversal then -Constants.inf else 
                0)) 
    "Fluid connector a (positive design flow direction is from port_a to port_b)";
  Modelica_Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = 
        Medium, m_flow(start=0, max=if allowFlowReversal then +Constants.inf else 
                0)) 
    "Fluid connector b (positive design flow direction is from port_a to port_b)";
  Medium.BaseProperties medium_a(T(start = Medium.T_default), h(start=Medium.h_default),
                   p(start=Medium.p_default)) "Medium properties in port_a";
  Medium.BaseProperties medium_b(T(start = Medium.T_default), h(start=Medium.h_default),
                   p(start=Medium.p_default)) "Medium properties in port_b";
  Medium.MassFlowRate m_flow(start=0) 
    "Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction)";
  Modelica.SIunits.VolumeFlowRate V_flow_a "Volume flow rate at port_a";
  Modelica.SIunits.Pressure dp(start=0) 
    "Pressure difference between port_a and port_b";
  
equation 
  // Properties in the ports
  port_a.p   = medium_a.p;
  port_a.h   = medium_a.h;
  port_a.Xi = medium_a.Xi;
  port_b.p   = medium_b.p;
  port_b.h   = medium_b.h;
  port_b.Xi = medium_b.Xi;
  
  // Design direction of mass flow rate
  m_flow = port_a.m_flow;
  
  // Volume flow rate
  V_flow_a = port_a.m_flow/medium_a.d;
  
  // Pressure difference between ports
  dp = port_a.p - port_b.p;
  
  ///////////////////////////////////////////////////////////////////////////////////
  // Extra species flow. This may be removed when upgrading to the new Modelica.Fluid.  
  port_a.mC_flow = semiLinear(port_a.m_flow, port_a.C, port_b.C);
  port_a.mC_flow + port_b.mC_flow = zeros(Medium.nC);
  ///////////////////////////////////////////////////////////////////////////////////
  
end PartialStaticTwoPortInterface;

Buildings.Fluids.Interfaces.PartialStaticTwoPortTransformer Buildings.Fluids.Interfaces.PartialStaticTwoPortTransformer

Partial element transporting fluid between two ports without storing mass or energy

Buildings.Fluids.Interfaces.PartialStaticTwoPortTransformer

Information


This component transports fluid between its two ports, without storing mass or energy. It is based on Modelica_Fluid.Interfaces.PartialTwoPortTransport but does not include the energy, mass and substance balance. Reversal and zero mass flow rate is taken care of, for details see definition of built-in operator semiLinear().

When using this partial component, an equation for the momentum balance has to be added by specifying a relationship between the pressure drop dp and the mass flow rate m_flow and the energy and mass balances, such as

  port_a.H_flow + port_b.H_flow = 0;
  port_a.m_flow + port_b.m_flow = 0;
  port_a.mXi_flow + port_b.mXi_flow = zeros(Medium.nXi);


Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Initialization
MassFlowRatem_flow Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s]
Pressuredp Pressure difference between port_a and port_b [Pa]
Advanced
TempflowDirectionModelica_Fluid.Types.FlowDir...Unidirectional (port_a -> port_b) or bidirectional flow component

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

partial model PartialStaticTwoPortTransformer 
  "Partial element transporting fluid between two ports without storing mass or energy" 
  extends Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface;
  import Modelica.Constants;
  
  
equation 
  /* Handle reverse and zero flow */
  port_a.H_flow   = semiLinear(port_a.m_flow, port_a.h,  port_b.h);
  port_a.mXi_flow = semiLinear(port_a.m_flow, port_a.Xi, port_b.Xi);
  
  /* Energy, mass and substance mass balance */
  // to be added by child classes port_a.H_flow + port_b.H_flow = 0;
  // to be added by child classes port_a.m_flow + port_b.m_flow = 0;
  // to be added by child classes port_a.mXi_flow + port_b.mXi_flow = zeros(Medium.nXi);  
end PartialStaticTwoPortTransformer;

HTML-documentation generated by Dymola Tue Sep 30 14:24:33 2008.