Buildings.Fluids.BaseClasses

Package with base classes for fluid models

Information


This package contains base classes that are used to construct the models in 
Buildings.Fluids.

Package Content

NameDescription
Buildings.Fluids.BaseClasses.PartialResistance PartialResistance Partial model for a hydraulic resistance
Buildings.Fluids.BaseClasses.PartialThreeWayResistance PartialThreeWayResistance Flow splitter with partial resistance model at each port


Buildings.Fluids.BaseClasses.PartialResistance Buildings.Fluids.BaseClasses.PartialResistance

Partial model for a hydraulic resistance

Buildings.Fluids.BaseClasses.PartialResistance

Information


Partial model for a flow resistance, possible with variable flow coefficient.


Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
MassFlowRatem_small_flow Mass flow rate where transition to laminar occurs [kg/s]
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
Booleanfrom_dptrue= true, use m_flow = f(dp) else dp = f(m_flow)
Booleanlinearizedfalse= true, use linear relation between m_flow and dp for any flow rate

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 PartialResistance 
  "Partial model for a hydraulic resistance" 
    extends Modelica_Fluid.Interfaces.PartialTwoPortTransport(
          medium_a(T(start = Medium.T_default), h(start=Medium.h_default),
                   p(start=Medium.p_default)),
          medium_b(T(start = Medium.T_default), h(start=Medium.h_default),
                   p(start=Medium.p_default)));
    extends Buildings.BaseClasses.BaseIcon;
  
  
  parameter Boolean from_dp = true 
    "= true, use m_flow = f(dp) else dp = f(m_flow)";
  parameter Modelica.SIunits.MassFlowRate m_small_flow 
    "Mass flow rate where transition to laminar occurs";
  parameter Boolean linearized = false 
    "= true, use linear relation between m_flow and dp for any flow rate";
protected 
  Real k(unit="(kg*m)^(1/2)", start=1) "Flow coefficient, k=m_flow/sqrt(dp)";
  Real kInv(unit="1/kg/m", start=1) 
    "Flow coefficient for inverse flow computation, kInv=dp/m_flow^2";
  
  Modelica.SIunits.AbsolutePressure dp_small 
    "Turbulent flow if |dp| >= dp_small, not a parameter because k can be a function of time";
  parameter Medium.ThermodynamicState sta0(T=Medium.T_default, p=Medium.p_default);
  
  parameter Modelica.SIunits.DynamicViscosity eta0=Medium.dynamicViscosity(sta0) 
    "Dynamic viscosity, used to compute laminar/turbulent transition";
  parameter Modelica.SIunits.SpecificEnthalpy h0=Medium.h_default 
    "Initial value for solver for specific enthalpy";           //specificEnthalpy(sta0) 
  
initial equation 
                 // this equation can be deleted, it here for debugging during library transition 
  assert(abs(eta0-Medium.dynamicViscosity(medium_a)) < 0.1*eta0, "Wrong parameter for eta.\n"
    + "  medium_a.T                              = " + realString(medium_a.T) + "\n"
    + "  medium_a.p                              = " + realString(medium_a.p) + "\n"
    + "  Medium.dynamicViscosity(medium_a)       = " + realString(Medium.dynamicViscosity(medium_a)) + "\n"
    + "  eta0                                    = " + realString(eta0) + "\n"
    + "  Medium.dynamicViscosity(medium_a)/ eta0 = " + realString(Medium.dynamicViscosity(medium_a)/eta0));
  
equation 
  1=k*k*kInv;
  dp_small = kInv * m_small_flow^2;
  if linearized then
     m_flow = k * dp;
  else
    if from_dp then
       m_flow = Buildings.Fluids.Utilities.massFlowRate_dp(             dp=dp, dp_small=dp_small, k=k);
    else
       dp = Buildings.Fluids.Utilities.pressureLoss_m_flow(             m_flow=m_flow,m_small_flow=m_small_flow,k=kInv);
    end if;
  end if;
  ///////////////////////////////////////////////////////////////////////////////////
  // 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 PartialResistance;

Buildings.Fluids.BaseClasses.PartialThreeWayResistance Buildings.Fluids.BaseClasses.PartialThreeWayResistance

Flow splitter with partial resistance model at each port

Buildings.Fluids.BaseClasses.PartialThreeWayResistance

Information


Partial model for flow resistances with three ports such as a flow mixer/splitter or a three way valve.


Parameters

TypeNameDefaultDescription
PartialTwoPortTransportres1redeclare Modelica_Fluid.Int...Partial model, to be replaced with a fluid component
PartialTwoPortTransportres2redeclare Modelica_Fluid.Int...Partial model, to be replaced with a fluid component
PartialTwoPortTransportres3redeclare Modelica_Fluid.Int...Partial model, to be replaced with a fluid component
Advanced
Booleanfrom_dptrue= true, use m_flow = f(dp) else dp = f(m_flow)
TempflowDirectionModelica_Fluid.Types.FlowDir...Unidirectional (port_1 -> port_2) or bidirectional flow component

Connectors

TypeNameDescription
FluidPort_bport_1 
FluidPort_bport_2 
FluidPort_bport_3 

Modelica definition

partial model PartialThreeWayResistance 
  "Flow splitter with partial resistance model at each port" 
    extends Buildings.BaseClasses.BaseIcon;
  replaceable package Medium = Modelica.Media.Interfaces.PartialMedium 
    "Fluid medium model";
  Modelica_Fluid.Interfaces.FluidPort_b port_1(
        redeclare package Medium = Medium,
        m_flow(start=0,min=if allowFlowReversal then -Modelica.Constants.inf else 0));
  Modelica_Fluid.Interfaces.FluidPort_b port_2(
        redeclare package Medium = Medium,
        m_flow(start=0,max=if allowFlowReversal then +Modelica.Constants.inf else 0));
  // For port_3, allowFlowReversal must not be specified because the flow
  // direction is different for a mixer and splitter
  Modelica_Fluid.Interfaces.FluidPort_b port_3(redeclare package Medium = 
        Medium);
  
 parameter Boolean from_dp = true 
    "= true, use m_flow = f(dp) else dp = f(m_flow)";
 parameter Modelica_Fluid.Types.FlowDirection.Temp flowDirection=
                   Modelica_Fluid.Types.FlowDirection.Bidirectional 
    "Unidirectional (port_1 -> port_2) or bidirectional flow component";
  replaceable Modelica_Fluid.Interfaces.PartialTwoPortTransport res1(redeclare 
      package Medium = Medium) 
    "Partial model, to be replaced with a fluid component";
  replaceable Modelica_Fluid.Interfaces.PartialTwoPortTransport res2(redeclare 
      package Medium = Medium) 
    "Partial model, to be replaced with a fluid component";
  replaceable Modelica_Fluid.Interfaces.PartialTwoPortTransport res3(redeclare 
      package Medium = Medium) 
    "Partial model, to be replaced with a fluid 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";
protected 
  Modelica_Fluid.Interfaces.FluidPort_b port_m(redeclare package Medium = 
        Medium) "Mixing port";
equation 
  connect(port_1, res1.port_a);
  connect(res2.port_a, port_2);
  connect(res3.port_a, port_3);
  connect(res1.port_b, port_m);
  connect(res2.port_b, port_m);
  connect(res3.port_b, port_m);
end PartialThreeWayResistance;

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