The function is used for continuous fading of variable inputs within a defined range. It allows a differentiable and smooth transition between function outputs, e.g., laminar and turbulent pressure drop or correlations for certain ranges.
The tanh-function is used, since it provides an existing
derivative and the derivative is zero at the borders
[nofunc, func] of the
interpolation domain (smooth derivative for transitions).
In order to work correctly, the internal interpolation range in
terms of the external arbitrary input x needs to
be scaled such that:
f(func) = 0.5 π f(nofunc) = -0.5 π
In the picture below the input x is increased from 0 to 1. The range of interpolation is defined by:
function Stepsmoother extends Modelica.Icons.Function; input Real func "input value for that result = 100%"; input Real nofunc "input value for that result = 0%"; input Real x "input variable for continuous interpolation"; output Real result "output value"; end Stepsmoother;