Buildings.Fluid.BaseClasses.FlowModels

Flow models for pressure drop calculations

Information

This package contains basic flow models that are used by the various models that compute pressure drop.

Assumption and limitations

Because the density does not change signficantly in heating, ventilation and air conditioning systems for buildings, the flow models compute the pressure drop based on the mass flow rate and not the volume flow rate. This typically leads to simpler equations because it does not require the mass density, which changes when the flow is reversed. Although, for conceptual design of building energy system, there is in general not enough information available that would warrant a more detailed pressure drop calculation. If a more detailed computation of the flow resistance is needed, then a user can use models from the Modelica.Fluid library.

All functions have an argument m_flow_turbulent that determines where the flow transitions to fully turbulent flow. For smaller mass flow rates, the power-law relation is replaced by a function that has a finite slope near zero pressure drop. This is done for numerical reasons, and to approximate laminar flow, although the implementation does not use a linear function.

Implementation

The four main functions are

These functions compute the mass flow rate or the pressure drop, respectively. The first two functions assume that the flow resistance is quadratic in the mass flow rate, and the other two functions allow for a flow exponent between 1 and 2. All these functions are two times continuously differentiable. First and second order derivatives are provided in the function that have the suffix _der and _der2.

For the powerLaw functions, the coefficients that are an argument to the functions can be computed using the function Buildings.Fluid.BaseClasses.FlowModels.powerLawData. This computation is done outside the above functions because the arguments generally are all parameters, and hence precomputing them avoid repetitive evaluation.

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

Package Content

Name Description
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp basicFlowFunction_dp Function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der basicFlowFunction_dp_der 1st derivative of function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2 basicFlowFunction_dp_der2 2nd derivative of function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow basicFlowFunction_m_flow Function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der basicFlowFunction_m_flow_der 1st derivative of function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2 basicFlowFunction_m_flow_der2 2nd derivative of function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.powerLawData powerLawData Function that computes the coefficients used by powerLaw_dp and powerLaw_m_flow
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp powerLaw_dp Power law used in pressure drop equations when the flow exponent is constant and may be different from 2
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der powerLaw_dp_der 1st derivative of function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der2 powerLaw_dp_der2 2nd derivative of function that computes mass flow rate for given pressure drop
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow powerLaw_m_flow Inverse of power law used in pressure drop equations when the flow exponent is constant and may be different from 2
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der powerLaw_m_flow_der 1st derivative of function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der2 powerLaw_m_flow_der2 2nd derivative of function that computes pressure drop for given mass flow rate
Buildings.Fluid.BaseClasses.FlowModels.Validation Validation Collection of validation models

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp

Function that computes mass flow rate for given pressure drop

Information

Function that computes the pressure drop of flow elements as

ṁ = sign(Δp) k √ Δp  

with regularization near the origin. Therefore, the flow coefficient is

k = ṁ ⁄ √ Δp  

The input m_flow_turbulent determines the location of the regularization.

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]

Outputs

TypeNameDescription
MassFlowRatem_flowMass flow rate in design flow direction [kg/s]

Modelica definition

function basicFlowFunction_dp "Function that computes mass flow rate for given pressure drop" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der); input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(min=0, unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; output Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real dpNorm=dp/dp_turbulent "Normalised pressure difference"; Real dpNormSq=dpNorm^2 "Square of normalised pressure difference"; algorithm m_flow := smooth(2, if noEvent(abs(dp)>dp_turbulent) then sign(dp)*k*sqrt(abs(dp)) else (1.40625 + (0.15625*dpNormSq - 0.5625)*dpNormSq)*m_flow_turbulent*dpNorm); end basicFlowFunction_dp;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der

1st derivative of function that computes mass flow rate for given pressure drop

Information

Function that implements the first order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp, assuming a constant flow coefficient.

When called with dp_der=der(dp), this function returns the time derivative of m_flow. When called with dp_der=1, this function returns the derivative of m_flow with respect to dp.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realdp_der Derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Outputs

TypeNameDescription
Realm_flow_derDerivative of mass flow rate in design flow direction

Modelica definition

function basicFlowFunction_dp_der "1st derivative of function that computes mass flow rate for given pressure drop" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2); extends Modelica.Icons.Function; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(min=0, unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real dp_der "Derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; output Real m_flow_der "Derivative of mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real dpNormSq=(dp/dp_turbulent)^2 "Square of normalised pressure difference"; algorithm m_flow_der := (if noEvent(abs(dp)>dp_turbulent) then 0.5*k/sqrt(abs(dp)) else (1.40625 + (0.78125*dpNormSq - 1.6875)*dpNormSq)*m_flow_turbulent/dp_turbulent)*dp_der; end basicFlowFunction_dp_der;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2 Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2

2nd derivative of function that computes mass flow rate for given pressure drop

Information

Function that implements the second order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp, assuming a constant flow coefficient.

When called with dp_der=der(dp) and dp_der2=der(dp_der), this function returns the second order derivative of m_flow with respect to time. When called with dp_der=1 and dp_der2=0, this function returns the second order derivative of m_flow with respect to dp.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realdp_der 1st derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)
Realdp_der2 2nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Outputs

TypeNameDescription
Realm_flow_der22nd derivative of mass flow rate in design flow direction

Modelica definition

function basicFlowFunction_dp_der2 "2nd derivative of function that computes mass flow rate for given pressure drop" extends Modelica.Icons.Function; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real k(min=0, unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real dp_der "1st derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; input Real dp_der2 "2nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; output Real m_flow_der2 "2nd derivative of mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real dpNorm=dp/dp_turbulent "Normalised pressure difference"; Real dpNormSq=dpNorm^2 "Square of normalised pressure difference"; algorithm m_flow_der2 := if noEvent(abs(dp)>dp_turbulent) then 0.5*k/sqrt(abs(dp))*(-0.5/dp * dp_der^2 + dp_der2) else m_flow_turbulent/dp_turbulent*( (1.40625 + (0.78125*dpNormSq - 1.6875)*dpNormSq)*dp_der2 + (-3.375 + 3.125*dpNormSq)*dpNorm/dp_turbulent*dp_der^2); end basicFlowFunction_dp_der2;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow

Function that computes pressure drop for given mass flow rate

Information

Function that computes the pressure drop of flow elements as

Δp = sign(ṁ) (ṁ ⁄ k)2

with regularization near the origin. Therefore, the flow coefficient is

k = ṁ ⁄ √ Δp  

The input m_flow_turbulent determines the location of the regularization.

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate in design flow direction [kg/s]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]

Outputs

TypeNameDescription
PressureDifferencedpPressure difference between port_a and port_b (= port_a.p - port_b.p) [Pa]

Modelica definition

function basicFlowFunction_m_flow "Function that computes pressure drop for given mass flow rate" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der); input Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; output Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real m_flowNorm = m_flow/m_flow_turbulent "Normalised mass flow rate"; Real m_flowNormSq = m_flowNorm^2 "Square of normalised mass flow rate"; algorithm dp := smooth(2, if noEvent(abs(m_flow)>m_flow_turbulent) then sign(m_flow)*(m_flow/k)^2 else (0.375 + (0.75-0.125*m_flowNormSq)*m_flowNormSq)*dp_turbulent*m_flowNorm); end basicFlowFunction_m_flow;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der

1st derivative of function that computes pressure drop for given mass flow rate

Information

Function that implements the first order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow, assuming a constant flow coefficient.

When called with m_flow_der=der(m_flow), this function returns the time derivative of dp. When called with m_flow_der=1, this function returns the derivative of dp with respect to m_flow.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate in design flow direction [kg/s]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realm_flow_der Derivative of mass flow rate in design flow direction

Outputs

TypeNameDescription
Realdp_derDerivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Modelica definition

function basicFlowFunction_m_flow_der "1st derivative of function that computes pressure drop for given mass flow rate" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2); extends Modelica.Icons.Function; input Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real m_flow_der "Derivative of mass flow rate in design flow direction"; output Real dp_der "Derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real m_flowNormSq = (m_flow/m_flow_turbulent)^2 "Square of normalised mass flow rate"; algorithm dp_der :=(if noEvent(abs(m_flow)>m_flow_turbulent) then sign(m_flow)*2*m_flow/k^2 else (0.375 + (2.25 - 0.625*m_flowNormSq)*m_flowNormSq)*dp_turbulent/m_flow_turbulent)*m_flow_der; end basicFlowFunction_m_flow_der;

Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2 Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2

2nd derivative of function that computes pressure drop for given mass flow rate

Information

Function that implements the second order derivative of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow, assuming a constant flow coefficient.

When called with m_flow_der=der(m_flow) and m_flow_der2=der(m_flow_der), this function returns the second order derivative of dp with respect to time. When called with m_flow_der=1 and m_flow_der2=0, this function returns the second order derivative of dp with respect to m_flow.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate in design flow direction [kg/s]
Realk Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
Realm_flow_der 1st derivative of mass flow rate in design flow direction
Realm_flow_der2 2nd derivative of mass flow rate in design flow direction

Outputs

TypeNameDescription
Realdp_der22nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)

Modelica definition

function basicFlowFunction_m_flow_der2 "2nd derivative of function that computes pressure drop for given mass flow rate" extends Modelica.Icons.Function; input Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate in design flow direction"; input Real k(unit="") "Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Real m_flow_der "1st derivative of mass flow rate in design flow direction"; input Real m_flow_der2 "2nd derivative of mass flow rate in design flow direction"; output Real dp_der2 "2nd derivative of pressure difference between port_a and port_b (= port_a.p - port_b.p)"; protected Modelica.Units.SI.PressureDifference dp_turbulent=(m_flow_turbulent/k)^2 "Pressure where flow changes to turbulent"; Real m_flowNorm = m_flow/m_flow_turbulent "Normalised mass flow rate"; Real m_flowNormSq = m_flowNorm^2 "Square of normalised mass flow rate"; algorithm dp_der2 :=if noEvent(abs(m_flow)>m_flow_turbulent) then sign(m_flow)*2/k^2 * (m_flow_der^2 + m_flow * m_flow_der2) else dp_turbulent/m_flow_turbulent*( (0.375 + (2.25 - 0.625*m_flowNormSq)*m_flowNormSq)*m_flow_der2 + (4.5 - 2.5*m_flowNormSq)*m_flowNorm/m_flow_turbulent*m_flow_der^2); end basicFlowFunction_m_flow_der2;

Buildings.Fluid.BaseClasses.FlowModels.powerLawData Buildings.Fluid.BaseClasses.FlowModels.powerLawData

Function that computes the coefficients used by powerLaw_dp and powerLaw_m_flow

Information

This function computes the coefficients that are used by the functions Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp and Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow.

The coefficients dp_turbulent, m, a1, a3 and a5 are used by Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp, while the coefficients C, b1, b3 and b5 are used by Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow.

The coefficients only depend on the k, n and m_flow_turbulent which often are parameters in a model. In this case, this function allows to compute the coefficients only once as parameters and then pass them to the above functions, which avoids recomputing them during the time step simulation.

Inputs

TypeNameDefaultDescription
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]

Outputs

TypeNameDescription
PressureDifferencedp_turbulentPressure difference where turbulent flow occurs [Pa]
RealmFlow exponent for the pressure drop
Reala1Polynomial coefficient for regularized implementation of flow resistance
Reala3Polynomial coefficient for regularized implementation of flow resistance
Reala5Polynomial coefficient for regularized implementation of flow resistance
RealCCoefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1Polynomial coefficient for regularized implementation of flow resistance
Realb3Polynomial coefficient for regularized implementation of flow resistance
Realb5Polynomial coefficient for regularized implementation of flow resistance

Modelica definition

function powerLawData "Function that computes the coefficients used by powerLaw_dp and powerLaw_m_flow" input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; output Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; output Real m "Flow exponent for the pressure drop"; output Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; output Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; output Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; output Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; output Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; output Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; output Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; algorithm // Coefficients used by powerLaw_dp m := 1 / n; dp_turbulent := (m_flow_turbulent^n) / k; a1 := (k * (m - 3) * (m - 5) / 8) * (dp_turbulent^(m - 1)); a3 := (k * (m - 1) * (5 - m) / 4) * (dp_turbulent^(m - 3)); a5 := (k * (m - 1) * (m - 3) / 8) * (dp_turbulent^(m - 5)); // Coefficients used by powerLaw_m_flow C := 1 / (k^n); // These coefficients match the value, 1st derivative, and 2nd derivative // of the function f(x) = C * x^n at the point x = m_flow_turbulent b1 := (C * (n - 3) * (n - 5) / 8) * (m_flow_turbulent^(n - 1)); b3 := (C * (n - 1) * (5 - n) / 4) * (m_flow_turbulent^(n - 3)); b5 := (C * (n - 1) * (n - 3) / 8) * (m_flow_turbulent^(n - 5)); end powerLawData;

Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp

Power law used in pressure drop equations when the flow exponent is constant and may be different from 2

Information

This model describes the mass flow rate and pressure difference relation of a flow resistance in the form

ṁ = k sign(Δp) |Δp|1/n

where ṁ is the mass flow rate, k > 0 is a flow coefficient Δ p is the pressure drop and n ∈ [1, 2] is a flow exponent. The equation is regularized for |Δp| < Δpt, where Δpt is a parameter that is computed from the input m_flow_turbulent. For laminar flow, set n=1 and for turbulent flow, set n=2.

The polynomial coefficients a1, a3 and a5, the flow exponent m and the pressure difference dp_turbulent are computed by the function Buildings.Fluid.BaseClasses.FlowModels.powerLawData and passed as inputs. As these quantities only depend on the parameters k, n and m_flow_turbulent, they can be computed once as parameters rather than at each function evaluation.

The model is used for the fluid flow models that are neither fully laminar nor fully turbulent. It is identical to Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM except that it is formulated for mass flow rate rather than volume flow rate.

Note regarding arguments

This function takes as inputs not only the coefficients dp_turbulent, m, a1, a3 and a5 that are used in its own implementation, but also the coefficients C, b1, b3 and b5 that are used by its inverse function Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow. These additional arguments are needed so that the inverse annotation can pass the input arguments of this function directly to its inverse function. Therefore, this function and its inverse function Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow have the same input arguments, except that this function takes the pressure difference dp as the first argument while its inverse takes the mass flow rate m_flow as the first argument. The coefficients C, b1, b3 and b5 are computed by the function Buildings.Fluid.BaseClasses.FlowModels.powerLawData.

Implementation

For |Δp| < Δpt, the equation is regularized so that it is twice continuously differentiable in Δp, and that it has an infinite number of continuous derivatives in n and in k.

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference [Pa]
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
PressureDifferencedp_turbulent Pressure difference where turbulent flow occurs [Pa]
Realm Flow exponent for the pressure drop
Reala1 Polynomial coefficient for regularized implementation of flow resistance
Reala3 Polynomial coefficient for regularized implementation of flow resistance
Reala5 Polynomial coefficient for regularized implementation of flow resistance
RealC Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1 Polynomial coefficient for regularized implementation of flow resistance
Realb3 Polynomial coefficient for regularized implementation of flow resistance
Realb5 Polynomial coefficient for regularized implementation of flow resistance

Outputs

TypeNameDescription
MassFlowRatem_flowMass flow rate [kg/s]

Modelica definition

function powerLaw_dp "Power law used in pressure drop equations when the flow exponent is constant and may be different from 2" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der); input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference"; input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; input Real m(min=0.5, max=1) "Flow exponent for the pressure drop"; input Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; input Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; output Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate"; protected Modelica.Units.SI.PressureDifference abs_dp = abs(dp) "Absolute value of pressure difference"; algorithm m_flow := if abs_dp < dp_turbulent then dp * (a1 + dp * dp * (a3 + dp * dp * a5)) else if dp > 0 then k * dp^m else - k * abs_dp^m; end powerLaw_dp;

Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der

1st derivative of function that computes mass flow rate for given pressure drop

Information

Function that implements the first order derivative of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp with respect to the pressure difference dp, assuming constant flow coefficients.

When called with dp_der=der(dp), this function returns the time derivative of m_flow. When called with dp_der=1, this function returns the derivative of m_flow with respect to dp.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference [Pa]
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
PressureDifferencedp_turbulent Pressure difference where turbulent flow occurs [Pa]
Realm Flow exponent for the pressure drop
Reala1 Polynomial coefficient for regularized implementation of flow resistance
Reala3 Polynomial coefficient for regularized implementation of flow resistance
Reala5 Polynomial coefficient for regularized implementation of flow resistance
RealC Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1 Polynomial coefficient for regularized implementation of flow resistance
Realb3 Polynomial coefficient for regularized implementation of flow resistance
Realb5 Polynomial coefficient for regularized implementation of flow resistance
Realdp_der Derivative of pressure difference

Outputs

TypeNameDescription
Realm_flow_derDerivative of mass flow rate in design flow direction

Modelica definition

function powerLaw_dp_der "1st derivative of function that computes mass flow rate for given pressure drop" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der2); extends Modelica.Icons.Function; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference"; input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; input Real m(min=0.5, max=1) "Flow exponent for the pressure drop"; input Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; input Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real dp_der "Derivative of pressure difference"; output Real m_flow_der "Derivative of mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference abs_dp = abs(dp) "Absolute value of pressure difference"; algorithm m_flow_der := (if abs_dp < dp_turbulent then a1 + dp*dp * (3*a3 + dp*dp * 5*a5) else k * m * abs_dp^(m - 1)) * dp_der; end powerLaw_dp_der;

Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der2 Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der2

2nd derivative of function that computes mass flow rate for given pressure drop

Information

Function that implements the second order derivative of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp with respect to the pressure difference dp, assuming constant flow coefficients.

When called with dp_der=der(dp) and dp_der2=der(dp_der), this function returns the second order derivative of m_flow with respect to time. When called with dp_der=1 and dp_der2=0, this function returns the second order derivative of m_flow with respect to dp.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PressureDifferencedp Pressure difference [Pa]
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
PressureDifferencedp_turbulent Pressure difference where turbulent flow occurs [Pa]
Realm Flow exponent for the pressure drop
Reala1 Polynomial coefficient for regularized implementation of flow resistance
Reala3 Polynomial coefficient for regularized implementation of flow resistance
Reala5 Polynomial coefficient for regularized implementation of flow resistance
RealC Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1 Polynomial coefficient for regularized implementation of flow resistance
Realb3 Polynomial coefficient for regularized implementation of flow resistance
Realb5 Polynomial coefficient for regularized implementation of flow resistance
Realdp_der 1st derivative of pressure difference
Realdp_der2 2nd derivative of pressure difference

Outputs

TypeNameDescription
Realm_flow_der22nd derivative of mass flow rate in design flow direction

Modelica definition

function powerLaw_dp_der2 "2nd derivative of function that computes mass flow rate for given pressure drop" extends Modelica.Icons.Function; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference"; input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; input Real m(min=0.5, max=1) "Flow exponent for the pressure drop"; input Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; input Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real dp_der "1st derivative of pressure difference"; input Real dp_der2 "2nd derivative of pressure difference"; output Real m_flow_der2 "2nd derivative of mass flow rate in design flow direction"; protected Modelica.Units.SI.PressureDifference abs_dp = abs(dp) "Absolute value of pressure difference"; algorithm m_flow_der2 := if abs_dp < dp_turbulent then (a1 + 3*a3*dp^2 + 5*a5*dp^4)*dp_der2 + (6*a3*dp + 20*a5*dp^3)*dp_der^2 else k * m * abs_dp^(m - 1) * dp_der2 + k * m * (m - 1) * sign(dp) * abs_dp^(m - 2) * dp_der^2; end powerLaw_dp_der2;

Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow

Inverse of power law used in pressure drop equations when the flow exponent is constant and may be different from 2

Information

This model describes the pressure difference and mass flow rate relation of a flow resistance in the form

Δp = sign(ṁ) (ṁ ⁄ k)n

where Δp is the pressure drop, k > 0 is a flow coefficient, ṁ is the mass flow rate, and n ∈ [1, 2] is a flow exponent. The equation is regularized for |ṁ| < ṁt, where ṁt is a parameter. For laminar flow, set n=1 and for turbulent flow, set n=2.

The coefficient C and the polynomial coefficients b1, b3 and b5 are computed by the function Buildings.Fluid.BaseClasses.FlowModels.powerLawData and passed as inputs. As these quantities only depend on the parameters k, n and m_flow_turbulent, they can be computed once as parameters rather than at each function evaluation.

The model is used for the fluid flow models that are neither fully laminar nor fully turbulent.

Note regarding arguments

This function takes as inputs not only the coefficients C, b1, b3 and b5 that are used in its own implementation, but also the coefficients dp_turbulent, m, a1, a3 and a5 that are used by its inverse function Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp. These additional arguments are needed so that the inverse annotation can pass the input arguments of this function directly to its inverse function. Therefore, this function and its inverse function Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp have the same input arguments, except that this function takes the mass flow rate m_flow as the first argument while its inverse takes the pressure difference dp as the first argument. The coefficients dp_turbulent, m, a1, a3 and a5 are computed by the function Buildings.Fluid.BaseClasses.FlowModels.powerLawData.

Implementation

For |ṁ| < ṁt, the equation is regularized so that it is twice continuously differentiable in ṁ, and that it has an infinite number of continuous derivatives in n and in k.

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate [kg/s]
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
PressureDifferencedp_turbulent Pressure difference where turbulent flow occurs [Pa]
Realm Flow exponent for the pressure drop
Reala1 Polynomial coefficient for regularized implementation of flow resistance
Reala3 Polynomial coefficient for regularized implementation of flow resistance
Reala5 Polynomial coefficient for regularized implementation of flow resistance
RealC Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1 Polynomial coefficient for regularized implementation of flow resistance
Realb3 Polynomial coefficient for regularized implementation of flow resistance
Realb5 Polynomial coefficient for regularized implementation of flow resistance

Outputs

TypeNameDescription
PressureDifferencedpPressure difference [Pa]

Modelica definition

function powerLaw_m_flow "Inverse of power law used in pressure drop equations when the flow exponent is constant and may be different from 2" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der); input Modelica.Units.SI.MassFlowRate m_flow(displayUnit="kg/s") "Mass flow rate"; input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; input Real m(min=0.5, max=1) "Flow exponent for the pressure drop"; input Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; input Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; output Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference"; protected Modelica.Units.SI.MassFlowRate abs_m = abs(m_flow) "Absolute value of mass flow rate"; algorithm dp := if abs_m < m_flow_turbulent then m_flow * (b1 + m_flow * m_flow * (b3 + m_flow * m_flow * b5)) else if m_flow > 0 then C * m_flow^n else -C * abs_m^n; end powerLaw_m_flow;

Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der

1st derivative of function that computes pressure drop for given mass flow rate

Information

Function that implements the first order derivative of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow with respect to the mass flow rate m_flow, assuming constant flow coefficients.

When called with m_flow_der=der(m_flow), this function returns the time derivative of dp. When called with m_flow_der=1, this function returns the derivative of dp with respect to m_flow.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate [kg/s]
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
PressureDifferencedp_turbulent Pressure difference where turbulent flow occurs [Pa]
Realm Flow exponent for the pressure drop
Reala1 Polynomial coefficient for regularized implementation of flow resistance
Reala3 Polynomial coefficient for regularized implementation of flow resistance
Reala5 Polynomial coefficient for regularized implementation of flow resistance
RealC Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1 Polynomial coefficient for regularized implementation of flow resistance
Realb3 Polynomial coefficient for regularized implementation of flow resistance
Realb5 Polynomial coefficient for regularized implementation of flow resistance
Realm_flow_der Derivative of mass flow rate in design flow direction

Outputs

TypeNameDescription
Realdp_derDerivative of pressure difference

Modelica definition

function powerLaw_m_flow_der "1st derivative of function that computes pressure drop for given mass flow rate" annotation(derivative=Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der2); extends Modelica.Icons.Function; input Modelica.Units.SI.MassFlowRate m_flow(displayUnit="kg/s") "Mass flow rate"; input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; input Real m(min=0.5, max=1) "Flow exponent for the pressure drop"; input Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; input Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real m_flow_der "Derivative of mass flow rate in design flow direction"; output Real dp_der "Derivative of pressure difference"; protected Modelica.Units.SI.MassFlowRate abs_m = abs(m_flow) "Absolute value of mass flow rate"; algorithm dp_der := (if abs_m < m_flow_turbulent then b1 + m_flow*m_flow * (3*b3 + m_flow*m_flow * 5*b5) else C * n * abs_m^(n - 1)) * m_flow_der; end powerLaw_m_flow_der;

Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der2 Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der2

2nd derivative of function that computes pressure drop for given mass flow rate

Information

Function that implements the second order derivative of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow with respect to the mass flow rate m_flow, assuming constant flow coefficients.

When called with m_flow_der=der(m_flow) and m_flow_der2=der(m_flow_der), this function returns the second order derivative of dp with respect to time. When called with m_flow_der=1 and m_flow_der2=0, this function returns the second order derivative of dp with respect to m_flow.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFlowRatem_flow Mass flow rate [kg/s]
Realk Flow coefficient, k = m_flow/ dp^(1/n)
Realn Flow exponent, n=1 for laminar, n=2 for turbulent
MassFlowRatem_flow_turbulent Mass flow rate where transition to turbulent flow occurs [kg/s]
PressureDifferencedp_turbulent Pressure difference where turbulent flow occurs [Pa]
Realm Flow exponent for the pressure drop
Reala1 Polynomial coefficient for regularized implementation of flow resistance
Reala3 Polynomial coefficient for regularized implementation of flow resistance
Reala5 Polynomial coefficient for regularized implementation of flow resistance
RealC Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)
Realb1 Polynomial coefficient for regularized implementation of flow resistance
Realb3 Polynomial coefficient for regularized implementation of flow resistance
Realb5 Polynomial coefficient for regularized implementation of flow resistance
Realm_flow_der 1st derivative of mass flow rate in design flow direction
Realm_flow_der2 2nd derivative of mass flow rate in design flow direction

Outputs

TypeNameDescription
Realdp_der22nd derivative of pressure difference

Modelica definition

function powerLaw_m_flow_der2 "2nd derivative of function that computes pressure drop for given mass flow rate" extends Modelica.Icons.Function; input Modelica.Units.SI.MassFlowRate m_flow(displayUnit="kg/s") "Mass flow rate"; input Real k "Flow coefficient, k = m_flow/ dp^(1/n)"; input Real n(min=1, max=2) "Flow exponent, n=1 for laminar, n=2 for turbulent"; input Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0) "Mass flow rate where transition to turbulent flow occurs"; input Modelica.Units.SI.PressureDifference dp_turbulent(displayUnit="Pa") "Pressure difference where turbulent flow occurs"; input Real m(min=0.5, max=1) "Flow exponent for the pressure drop"; input Real a1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real a5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real C "Coefficient 1/k^n, based on the definition k = m_flow / dp^(1/n)"; input Real b1 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b3 "Polynomial coefficient for regularized implementation of flow resistance"; input Real b5 "Polynomial coefficient for regularized implementation of flow resistance"; input Real m_flow_der "1st derivative of mass flow rate in design flow direction"; input Real m_flow_der2 "2nd derivative of mass flow rate in design flow direction"; output Real dp_der2 "2nd derivative of pressure difference"; protected Modelica.Units.SI.MassFlowRate abs_m = abs(m_flow) "Absolute value of mass flow rate"; algorithm dp_der2 := if abs_m < m_flow_turbulent then (b1 + 3*b3*m_flow^2 + 5*b5*m_flow^4)*m_flow_der2 + (6*b3*m_flow + 20*b5*m_flow^3)*m_flow_der^2 else C * n * abs_m^(n - 1) * m_flow_der2 + C * n * (n - 1) * sign(m_flow) * abs_m^(n - 2) * m_flow_der^2; end powerLaw_m_flow_der2;