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).
| Name | Description |
|---|---|
| Model of a pipe with finite volume discretization along the flow path |
Buildings.Fluid.FixedResistances.BaseClasses.Pipe
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.FixedResistanceDpM
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).
| Type | Name | Default | Description |
|---|---|---|---|
| replaceable package Medium | PartialMedium | Medium in the component | |
| Integer | nSeg | 10 | Number of volume segments |
| Length | thicknessIns | Thickness of insulation [m] | |
| ThermalConductivity | lambdaIns | Heat conductivity of insulation [W/(m.K)] | |
| Length | diameter | Pipe diameter (without insulation) [m] | |
| Length | length | Length of the pipe [m] | |
| Nominal condition | |||
| MassFlowRate | m_flow_nominal | Nominal mass flow rate [kg/s] | |
| Pressure | dp_nominal | Pressure [Pa] | |
| Initialization | |||
| MassFlowRate | m_flow.start | 0 | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s] |
| Pressure | dp.start | 0 | Pressure difference between port_a and port_b [Pa] |
| Dynamics | |||
| Equations | |||
| Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Formulation of energy balance |
| Dynamics | massDynamics | energyDynamics | Formulation of mass balance |
| Initialization | |||
| AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
| Temperature | T_start | Medium.T_default | Start value of temperature [K] |
| MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
| ExtraProperty | C_start[Medium.nC] | fill(0, Medium.nC) | Start value of trace substances |
| ExtraProperty | C_nominal[Medium.nC] | fill(1E-2, Medium.nC) | Nominal value of trace substances. (Set to typical order of magnitude.) |
| Assumptions | |||
| Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
| Advanced | |||
| MassFlowRate | m_flow_small | 1E-4*abs(m_flow_nominal) | Small mass flow rate for regularization of zero flow [kg/s] |
| Boolean | homotopyInitialization | true | = true, use homotopy method |
| Diagnostics | |||
| Boolean | show_V_flow | false | = true, if volume flow rate at inflowing port is computed |
| Boolean | show_T | true | = true, if actual temperature at port is computed (may lead to events) |
| Flow resistance | |||
| Boolean | computeFlowResistance | (abs(dp_nominal) > Modelica.... | =true, compute flow resistance. Set to false to assume no friction |
| Boolean | from_dp | false | = true, use m_flow = f(dp) else dp = f(m_flow) |
| Boolean | linearizeFlowResistance | false | = true, use linear relation between m_flow and dp for any flow rate |
| Real | deltaM | 0.1 | Fraction of nominal flow rate where flow transitions to laminar |
| Real | ReC | 4000 | Reynolds number where transition to turbulent starts |
| Type | Name | Description |
|---|---|---|
| FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
| FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
model Pipe
"Model of a pipe with finite volume discretization along the flow path"
extends Buildings.Fluid.Interfaces.LumpedVolumeDeclarations;
extends Buildings.Fluid.Interfaces.PartialTwoPortInterface(
showDesignFlowDirection = false,
final show_T=true);
extends Buildings.Fluid.Interfaces.TwoPortFlowResistanceParameters(
final computeFlowResistance=(abs(dp_nominal) > Modelica.Constants.eps));
parameter Integer nSeg(min=2) = 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";
Buildings.Fluid.FixedResistances.FixedResistanceDpM res(
redeclare final package Medium = Medium,
final from_dp=from_dp,
use_dh=true,
dh=diameter,
final show_T=show_T,
final m_flow_nominal=m_flow_nominal,
final dp_nominal=dp_nominal,
final allowFlowReversal=allowFlowReversal,
final show_V_flow=show_V_flow,
final linearized=linearizeFlowResistance,
final ReC=ReC,
final homotopyInitialization=homotopyInitialization) "Flow resistance";
Buildings.Fluid.MixingVolumes.MixingVolume[nSeg] vol(
redeclare each final package Medium = Medium,
each energyDynamics=energyDynamics,
each massDynamics=massDynamics,
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 homotopyInitialization=homotopyInitialization,
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_start = Medium.setState_pTX(
T=T_start,
p=p_start,
X=X_start[1:Medium.nXi]) "Start state";
parameter Modelica.SIunits.Density rho_nominal = Medium.density(state_start);
parameter Modelica.SIunits.DynamicViscosity mu_nominal = Medium.dynamicViscosity(state_start)
"Dynamic viscosity at nominal condition";
equation
connect(port_a, res.port_a);
connect(res.port_b, vol[1].ports[1]);
for i in 1:(nSeg - 1) loop
connect(vol[i].ports[2], vol[i + 1].ports[1]);
end for;
connect(vol[nSeg].ports[2], port_b);
end Pipe;