Buildings.Fluid.FixedResistances.BaseClasses

Information

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

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Fluid.FixedResistances.BaseClasses.Pipe Pipe Model of a pipe with finite volume discretization along the flow path

Buildings.Fluid.FixedResistances.BaseClasses.Pipe Buildings.Fluid.FixedResistances.BaseClasses.Pipe

Model of a pipe with finite volume discretization along the flow path

Buildings.Fluid.FixedResistances.BaseClasses.Pipe

Information

Model of a pipe with flow resistance and optional heat storage. This model can be used for modeling the heat exchange between the pipe and environment. The model consists of a flow resistance Buildings.Fluid.FixedResistances.PressureDrop and nSeg mixing volumes Buildings.Fluid.MixingVolumes.MixingVolume.

Extends from Buildings.Fluid.Interfaces.LumpedVolumeDeclarations (Declarations for lumped volumes), Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy), Buildings.Fluid.Interfaces.TwoPortFlowResistanceParameters (Parameters for flow resistance for models with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
IntegernSeg10Number of volume segments
LengththicknessIns Thickness of insulation [m]
ThermalConductivitylambdaIns Heat conductivity of insulation [W/(m.K)]
Lengthdiameter Pipe diameter (without insulation) [m]
Lengthlength Length of the pipe [m]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal Pressure difference [Pa]
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
DynamicsmassDynamicsenergyDynamicsType of mass balance: dynamic (3 initialization options) or steady state
RealmSenFac1Factor for scaling the sensible thermal mass of the volume
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
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
ExtraPropertyC_nominal[Medium.nC]fill(1E-2, Medium.nC)Nominal value of trace substances. (Set to typical order of magnitude.)
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_Ttrue= true, if actual temperature at port is computed
Flow resistance
BooleancomputeFlowResistance(abs(dp_nominal) > Modelica....=true, compute flow resistance. Set to false to assume no friction
Booleanfrom_dpfalse= true, use m_flow = f(dp) else dp = f(m_flow)
BooleanlinearizeFlowResistancefalse= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM0.1Fraction of nominal flow rate where flow transitions to laminar
RealReC4000Reynolds number where transition to turbulent starts

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 Pipe "Model of a pipe with finite volume discretization along the flow path" extends Buildings.Fluid.Interfaces.LumpedVolumeDeclarations; extends Buildings.Fluid.Interfaces.PartialTwoPortInterface(final show_T=true); extends Buildings.Fluid.Interfaces.TwoPortFlowResistanceParameters(final computeFlowResistance=(abs(dp_nominal) > Modelica.Constants.eps)); parameter Integer nSeg(min=1) = 10 "Number of volume segments"; parameter Modelica.SIunits.Length thicknessIns "Thickness of insulation"; parameter Modelica.SIunits.ThermalConductivity lambdaIns "Heat conductivity of insulation"; parameter Modelica.SIunits.Length diameter "Pipe diameter (without insulation)"; parameter Modelica.SIunits.Length length "Length of the pipe"; parameter Real ReC=4000 "Reynolds number where transition to turbulent starts"; parameter Boolean homotopyInitialization=true "= true, use homotopy method"; Buildings.Fluid.FixedResistances.PressureDrop preDro( redeclare final package Medium = Medium, final from_dp=from_dp, final show_T=show_T, final m_flow_nominal=m_flow_nominal, final dp_nominal=dp_nominal, final allowFlowReversal=allowFlowReversal, final linearized=linearizeFlowResistance, final homotopyInitialization=homotopyInitialization) "Flow resistance"; Buildings.Fluid.MixingVolumes.BaseClasses.MixingVolumeHeatPort[nSeg] vol( redeclare each final package Medium = Medium, each energyDynamics=energyDynamics, each massDynamics=massDynamics, final initialize_p={(i == 1 and (not Medium.singleState)) for i in 1:nSeg}, each final V=VPipe/nSeg, each nPorts=2, each final m_flow_nominal=m_flow_nominal, each prescribedHeatFlowRate=true, each p_start=p_start, each T_start=T_start, each X_start=X_start, each C_start=C_start, each C_nominal=C_nominal, each final m_flow_small=m_flow_small, each final allowFlowReversal=allowFlowReversal) "Volume for pipe fluid"; protected parameter Modelica.SIunits.Volume VPipe=Modelica.Constants.pi*(diameter/2.0)^2 *length "Pipe volume"; parameter Medium.ThermodynamicState state_default=Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default[1:Medium.nXi]) "Default state"; parameter Modelica.SIunits.Density rho_default=Medium.density(state_default); parameter Modelica.SIunits.DynamicViscosity mu_default= Medium.dynamicViscosity(state_default) "Dynamic viscosity at nominal condition"; equation connect(port_a, preDro.port_a); connect(preDro.port_b, vol[1].ports[1]); if nSeg > 1 then for i in 1:(nSeg - 1) loop connect(vol[i].ports[2], vol[i + 1].ports[1]); end for; end if; connect(vol[nSeg].ports[2], port_b); end Pipe;