Function that computes the pressure drop of flow elements as
Δp = sign(m) (m ⁄ k)2
with regularization near the origin. Therefore, the flow coefficient is
k = m ⁄ √ Δp
The input m_flow_turbulent
determines the location of the regularization.
function basicFlowFunction_m_flow input Modelica.SIunits.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.SIunits.MassFlowRate m_flow_turbulent(min = 0) "Mass flow rate where transition to turbulent flow occurs"; output Modelica.SIunits.PressureDifference dp(displayUnit = "Pa") "Pressure difference between port_a and port_b (= port_a.p - port_b.p)"; end basicFlowFunction_m_flow;
smooth(..)
and smoothOrder
and changed Inline=true
to LateInline=true
.
This is for
issue 301.
Inline=true
for inlining to occur.
This is for
#279.
if-then
optimization that set dp=0
if m_flow=0
,
as this causes the derivative to be discontinuous at m_flow=0
.