k = m ⁄ √ΔP.
For models of valves and air dampers, see Buildings.Fluid.Actuators. For models of flow resistances as part of the building constructions, see Buildings.Airflow.Multizone.
The model Buildings.Fluid.FixedResistances.FixedResistanceDpM is a fixed flow resistance that takes as parameter a nominal flow rate and a nominal pressure drop. The actual resistance is scaled using the above equation.
The model Buildings.Fluid.FixedResistances.LosslessPipe is an ideal pipe segment with no pressure drop. It is primarily used in models in which the above pressure drop model need to be replaced by a model with no pressure drop.
The model Buildings.Fluid.FixedResistances.SplitterFixedResistanceDpM can be used to model flow splitters or flow merges.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Name | Description |
---|---|
FixedResistanceDpM | Fixed flow resistance with dp and m_flow as parameter |
LosslessPipe | Pipe with no flow friction and no heat transfer |
Pipe | Pipe with finite volume discretization along flow path |
SplitterFixedResistanceDpM | Flow splitter with fixed resistance at each port |
Examples | Collection of models that illustrate model use and test models |
BaseClasses |
This is a model of a resistance with a fixed flow coefficient. The mass flow rate is computed as
ṁ = k √ΔP,
where k is a constant and ΔP is the pressure drop. The constant k is equal tok=m_flow_nominal/dp_nominal
,
where m_flow_nominal
and dp_nominal
are parameters.
In the region
abs(m_flow) < m_flow_turbulent
,
the square root is replaced by a differentiable function
with finite slope.
The value of m_flow_turbulent
is
computed as follows:
use_dh
is false
(the default setting),
the equation
m_flow_turbulent = deltaM * abs(m_flow_nominal)
,
where deltaM=0.3
and
m_flow_nominal
are parameters that can be set by the user.
m_flow_turbulent = eta_nominal*dh/4*π*ReC
is used,
where
eta_nominal
is the dynamic viscosity, obtained from
the medium model. The parameter
dh
is the hydraulic diameter and
ReC=4000
is the critical Reynolds number, which both
can be set by the user.
The figure below shows the pressure drop for the parameters
m_flow_nominal=5
kg/s,
dp_nominal=10
Pa and
deltaM=0.3
.
If the parameters
show_V_flow
or
show_T
are set to true
,
then the model will compute the volume flow rate and the
temperature at its ports. Note that this can lead to state events
when the mass flow rate approaches zero,
which can increase computing time.
The parameter from_dp
is used to determine
whether the mass flow rate is computed as a function of the
pressure drop (if from_dp=true
), or vice versa.
This setting can affect the size of the nonlinear system of equations.
If the parameter linearized
is set to true
,
then the pressure drop is computed as a linear function of the
mass flow rate.
Setting allowFlowReversal=false
can lead to simpler
equations. However, this should only be set to false
if one can guarantee that the flow never reverses its direction.
This can be difficult to guarantee, as pressure imbalance after
the initialization, or due to medium expansion and contraction,
can lead to reverse flow.
For more detailed models that compute the actual flow friction,
models from the package
Modelica.Fluid
can be used and combined with models from the
Buildings
library.
The pressure drop is computed by calling a function in the package Buildings.Fluid.BaseClasses.FlowModels, This package contains regularized implementations of the equation
m = sign(Δp) k √ Δp
and its inverse function.
To decouple the energy equation from the mass equations, the pressure drop is a function of the mass flow rate, and not the volume flow rate. This leads to simpler equations.
Extends from Buildings.Fluid.BaseClasses.PartialResistance (Partial model for a hydraulic resistance).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
MassFlowRate | m_flow_turbulent | if (computeFlowResistance an... | Turbulent flow if |m_flow| >= m_flow_turbulent [kg/s] |
Boolean | use_dh | false | Set to true to specify hydraulic diameter |
Length | dh | 1 | Hydraulic diameter [m] |
Real | ReC | 4000 | Reynolds number where transition to turbulent starts |
Real | deltaM | 0.3 | Fraction of nominal mass flow rate where transition to turbulent occurs |
Nominal condition | |||
MassFlowRate | m_flow_nominal | Nominal mass flow rate [kg/s] | |
Pressure | dp_nominal | Pressure drop at nominal mass flow rate [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] |
Assumptions | |||
Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Advanced | |||
Boolean | homotopyInitialization | true | = true, use homotopy method |
Boolean | from_dp | false | = true, use m_flow = f(dp) else dp = f(m_flow) |
Boolean | linearized | false | = true, use linear relation between m_flow and dp for any flow rate |
Diagnostics | |||
Boolean | show_V_flow | false | = true, if volume flow rate at inflowing port is computed |
Boolean | show_T | false | = true, if actual temperature at port is computed (may lead to events) |
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 FixedResistanceDpM "Fixed flow resistance with dp and m_flow as parameter" extends Buildings.Fluid.BaseClasses.PartialResistance( final m_flow_turbulent = if (computeFlowResistance and use_dh) then eta_default*dh/4*Modelica.Constants.pi*ReC elseif (computeFlowResistance) then deltaM * m_flow_nominal_pos else 0); parameter Boolean use_dh = false "Set to true to specify hydraulic diameter"; parameter Modelica.SIunits.Length dh=1 "Hydraulic diameter"; parameter Real ReC(min=0)=4000 "Reynolds number where transition to turbulent starts"; parameter Real deltaM(min=0.01) = 0.3 "Fraction of nominal mass flow rate where transition to turbulent occurs"; final parameter Real k(unit="") = if computeFlowResistance then m_flow_nominal_pos / sqrt(dp_nominal_pos) else 0 "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; protected final parameter Boolean computeFlowResistance=(dp_nominal_pos > Modelica.Constants.eps) "Flag to enable/disable computation of flow resistance"; initial equation if computeFlowResistance then assert(m_flow_turbulent > 0, "m_flow_turbulent must be bigger than zero."); end if; assert(m_flow_nominal_pos > 0, "m_flow_nominal_pos must be non-zero. Check parameters."); if ( m_flow_turbulent > m_flow_nominal_pos) then Modelica.Utilities.Streams.print("Warning: In FixedResistanceDpM, m_flow_nominal is smaller than m_flow_turbulent." + "\n" + " m_flow_nominal = " + String(m_flow_nominal) + "\n" + " dh = " + String(dh) + "\n" + " To fix, set dh < " + String( 4*m_flow_nominal/eta_default/Modelica.Constants.pi/ReC) + "\n" + " Suggested value: dh = " + String(1/10*4*m_flow_nominal/eta_default/Modelica.Constants.pi/ReC)); end if; equation // Pressure drop calculation if computeFlowResistance then if linearized then m_flow*m_flow_nominal_pos = k^2*dp; else if homotopyInitialization then if from_dp then m_flow=homotopy(actual=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(dp=dp, k=k, m_flow_turbulent=m_flow_turbulent), simplified=m_flow_nominal_pos*dp/dp_nominal_pos); else dp=homotopy(actual=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(m_flow=m_flow, k=k, m_flow_turbulent=m_flow_turbulent), simplified=dp_nominal_pos*m_flow/m_flow_nominal_pos); end if; // from_dp else // do not use homotopy if from_dp then m_flow=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(dp=dp, k=k, m_flow_turbulent=m_flow_turbulent); else dp=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(m_flow=m_flow, k=k, m_flow_turbulent=m_flow_turbulent); end if; // from_dp end if; // homotopyInitialization end if; // linearized else // do not compute flow resistance dp = 0; end if; // computeFlowResistanceend FixedResistanceDpM;
Model of a pipe with no flow resistance, no heat loss and no transport delay.
This model can be used to replace a replaceable
pipe model
in flow legs in which no friction should be modeled.
This is for example done in the outlet port of the
base class for three way valves,
Buildings.Fluid.Actuators.BaseClasses.PartialThreeWayValve.
Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy), Buildings.BaseClasses.BaseIcon (Base icon).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Nominal condition | |||
MassFlowRate | m_flow_nominal | Nominal mass flow rate [kg/s] | |
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] |
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 | false | = true, if actual temperature at port is computed (may lead to events) |
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 LosslessPipe "Pipe with no flow friction and no heat transfer" extends Buildings.Fluid.Interfaces.PartialTwoPortInterface( show_T=false, show_V_flow=false); extends Buildings.BaseClasses.BaseIcon; final parameter Boolean from_dp=true "Used to satisfy replaceable models"; equation dp=0; // 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); // Mass balance (no storage) port_a.m_flow + port_b.m_flow = 0; // Transport of substances port_a.Xi_outflow = inStream(port_b.Xi_outflow); port_b.Xi_outflow = inStream(port_a.Xi_outflow); port_a.C_outflow = inStream(port_b.C_outflow); port_b.C_outflow = inStream(port_a.C_outflow);end LosslessPipe;
Model of a pipe with flow resistance and optional heat exchange with environment.
If useMultipleHeatPorts=false
(default option), the pipe uses a single heat port
for the heat exchange with the environment.
If useMultipleHeatPorts=true
, then one heat port for each segment of the pipe is
used for the heat exchange with the environment.
If the heat port is unconnected, then the pipe has no heat loss.
The default value for the parameter diameter
is computed such that the flow velocity
is equal to v_nominal=0.15
for a mass flow rate of m_flow_nominal
.
Both parameters, diameter
and v_nominal
, can be overwritten
by the user.
The default value for dp_nominal
is two times the pressure drop that the pipe
would have if it were straight with no fittings.
The factor of two that takes into account the pressure loss of fittings can be overwritten.
These fittings could also be explicitely modeled outside of this component using models from
the package
Modelica.Fluid.Fittings.
For mass flow rates other than m_flow_nominal
, the model
Buildings.Fluid.FixedResistances.FixedResistanceDpM is used to
compute the pressure drop.
For a steady-state model of a flow resistance, use Buildings.Fluid.FixedResistances.FixedResistanceDpM instead of this model.
Extends from Buildings.Fluid.FixedResistances.BaseClasses.Pipe (Model of a pipe with finite volume discretization along the flow path).
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 | sqrt(4*m_flow_nominal/rho_no... | Pipe diameter (without insulation) [m] |
Length | length | Length of the pipe [m] | |
Velocity | v_nominal | 0.15 | Velocity at m_flow_nominal (used to compute default diameter) [m/s] |
Length | roughness | 2.5e-5 | Absolute roughness of pipe, with a default for a smooth steel pipe (dummy if use_roughness = false) [m] |
Boolean | useMultipleHeatPorts | false | = true to use one heat port for each segment of the pipe, false to use a single heat port for the entire pipe |
Nominal condition | |||
MassFlowRate | m_flow_nominal | Nominal mass flow rate [kg/s] | |
Pressure | dp_nominal | 2*dpStraightPipe_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 |
Flow resistance | |||
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) |
HeatPort_a | heatPort | Single heat port that connects to outside of pipe wall (default, enabled when useMultipleHeatPorts=false) |
HeatPorts_a | heatPorts[nSeg] | Multiple heat ports that connect to outside of pipe wall (enabled if useMultipleHeatPorts=true) |
model Pipe "Pipe with finite volume discretization along flow path" extends Buildings.Fluid.FixedResistances.BaseClasses.Pipe( diameter=sqrt(4*m_flow_nominal/rho_nominal/v_nominal/Modelica.Constants.pi), dp_nominal=2*dpStraightPipe_nominal, res(dp(nominal=length*10))); // Because dp_nominal is a non-literal value, we set // dp.nominal=100 instead of the default dp.nominal=dp_nominal, // because the latter is ignored by Dymola 2012 FD 01. parameter Modelica.SIunits.Velocity v_nominal = 0.15 "Velocity at m_flow_nominal (used to compute default diameter)"; parameter Modelica.SIunits.Length roughness(min=0) = 2.5e-5 "Absolute roughness of pipe, with a default for a smooth steel pipe (dummy if use_roughness = false)"; final parameter Modelica.SIunits.Pressure dpStraightPipe_nominal= Modelica.Fluid.Pipes.BaseClasses.WallFriction.Detailed.pressureLoss_m_flow( m_flow=m_flow_nominal, rho_a=rho_nominal, rho_b=rho_nominal, mu_a=mu_nominal, mu_b=mu_nominal, length=length, diameter=diameter, roughness=roughness, m_flow_small=m_flow_small) "Pressure loss of a straight pipe at m_flow_nominal"; parameter Boolean useMultipleHeatPorts=false "= true to use one heat port for each segment of the pipe, false to use a single heat port for the entire pipe";Modelica.Thermal.HeatTransfer.Components.ThermalConductor conPipWal[nSeg]( each G=2*Modelica.Constants.pi*lambdaIns*length/nSeg/Modelica.Math.log(( diameter/2.0 + thicknessIns)/(diameter/2.0))) "Thermal conductance through pipe wall"; Modelica.Thermal.HeatTransfer.Components.ThermalCollector colAllToOne(m=nSeg) if not useMultipleHeatPorts "Connector to assign multiple heat ports to one heat port"; Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort if not useMultipleHeatPorts "Single heat port that connects to outside of pipe wall (default, enabled when useMultipleHeatPorts=false)"; Modelica.Fluid.Interfaces.HeatPorts_a heatPorts[nSeg] if useMultipleHeatPorts "Multiple heat ports that connect to outside of pipe wall (enabled if useMultipleHeatPorts=true)"; equationconnect(conPipWal.port_b, vol.heatPort); if useMultipleHeatPorts thenconnect(heatPorts, conPipWal.port_a); elseconnect(colAllToOne.port_a, conPipWal.port_a); connect(colAllToOne.port_b, heatPort); end if;end Pipe;
Model of a flow splitter or mixer with a fixed resistance in each flow leg. In each flow lag, a pressure drop can be modelled, and at the fluid junction, a mixing volume can be modelled.
The pressure drop is implemented using the model Buildings.Fluid.FixedResistances.FixedResistanceDpM. If its nominal pressure drop is set to zero, then the pressure drop model will be removed. For example, the pressure drop declaration
m_flow_nominal={ 0.1, 0.1, -0.2}, dp_nominal = {500, 0, -6000}
would model a mixer that has the nominal flow rates and associated pressure drops
as shown in the figure below. Note that port_3
is set to negative values.
The negative values indicate that at the nominal conditions, fluid is leaving the component.
Optionally, at the fluid junction, a control volume can be modelled.
This is implemented using the model
Buildings.Fluid.Delays.DelayFirstOrder.
The fluid volume is modelled if
dynamicBalance=true
, and it is removed if
dynamicBalance=false
.
The control volume has the size
V = sum(abs(m_flow_nominal[:])/3)*tau/rho_nominal
where tau
is a parameter and rho_nominal
is the density
of the medium in the volume at nominal condition.
Setting dynamicBalance=true
can help reducing the size of the nonlinear
system of equations.
Extends from Buildings.BaseClasses.BaseIcon (Base icon), Buildings.Fluid.BaseClasses.PartialThreeWayResistance (Flow splitter with partial resistance model at each port).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Boolean | use_dh | false | Set to true to specify hydraulic diameter |
Real | deltaM | 0.3 | Fraction of nominal mass flow rate where transition to turbulent occurs |
Length | dh[3] | {1,1,1} | Hydraulic diameter [m] |
Real | ReC[3] | {4000,4000,4000} | Reynolds number where transition to turbulent starts |
Nominal condition | |||
MassFlowRate | m_flow_nominal[3] | Mass flow rate. Set negative at outflowing ports. [kg/s] | |
Pressure | dp_nominal[3] | Pressure. Set negative at outflowing ports. [Pa] | |
Dynamics | |||
Equations | |||
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Formulation of energy balance |
Dynamics | massDynamics | energyDynamics | Formulation of mass balance |
Boolean | dynamicBalance | true | Set to true to use a dynamic balance, which often leads to smaller systems of equations |
MassFlowRate | mDyn_flow_nominal | sum(abs(m_flow_nominal[:])/3) | Nominal mass flow rate for dynamic momentum and energy balance [kg/s] |
Nominal condition | |||
Time | tau | 10 | Time constant at nominal flow for dynamic energy and momentum balance [s] |
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.) |
Advanced | |||
Boolean | from_dp | true | = true, use m_flow = f(dp) else dp = f(m_flow) |
Boolean | homotopyInitialization | true | = true, use homotopy method |
Boolean | linearized | false | = true, use linear relation between m_flow and dp for any flow rate |
Type | Name | Description |
---|---|---|
FluidPort_a | port_1 | |
FluidPort_b | port_2 | |
FluidPort_a | port_3 |
model SplitterFixedResistanceDpM "Flow splitter with fixed resistance at each port" extends Buildings.BaseClasses.BaseIcon; extends Buildings.Fluid.BaseClasses.PartialThreeWayResistance( mDyn_flow_nominal = sum(abs(m_flow_nominal[:])/3), redeclare Buildings.Fluid.FixedResistances.FixedResistanceDpM res1( redeclare package Medium=Medium, final allowFlowReversal=true, from_dp=from_dp, final m_flow_nominal=m_flow_nominal[1], final dp_nominal=dp_nominal[1], final ReC=ReC[1], final dh=dh[1], linearized=linearized, homotopyInitialization=homotopyInitialization, deltaM=deltaM), redeclare Buildings.Fluid.FixedResistances.FixedResistanceDpM res2( redeclare package Medium=Medium, final allowFlowReversal=true, from_dp=from_dp, final m_flow_nominal=m_flow_nominal[2], final dp_nominal=dp_nominal[2], final ReC=ReC[2], final dh=dh[2], linearized=linearized, homotopyInitialization=homotopyInitialization, deltaM=deltaM), redeclare Buildings.Fluid.FixedResistances.FixedResistanceDpM res3( redeclare package Medium=Medium, final allowFlowReversal=true, from_dp=from_dp, final m_flow_nominal=m_flow_nominal[3], final dp_nominal=dp_nominal[3], final ReC=ReC[3], final dh=dh[3], linearized=linearized, homotopyInitialization=homotopyInitialization, deltaM=deltaM)); parameter Boolean use_dh = false "Set to true to specify hydraulic diameter"; parameter Modelica.SIunits.MassFlowRate[3] m_flow_nominal "Mass flow rate. Set negative at outflowing ports."; parameter Modelica.SIunits.Pressure[3] dp_nominal(each displayUnit = "Pa") "Pressure. Set negative at outflowing ports."; parameter Real deltaM(min=0) = 0.3 "Fraction of nominal mass flow rate where transition to turbulent occurs"; parameter Modelica.SIunits.Length[3] dh={1, 1, 1} "Hydraulic diameter"; parameter Real[3] ReC(each min=0)={4000, 4000, 4000} "Reynolds number where transition to turbulent starts"; parameter Boolean linearized = false "= true, use linear relation between m_flow and dp for any flow rate"; parameter Boolean homotopyInitialization = true "= true, use homotopy method";end SplitterFixedResistanceDpM;