Evaluates a pump performance curve y = f(x, r_N)
using monotone cubic Hermite interpolation between the support
points (x_curve[i], y_curve[i]), with linear
extrapolation outside the data range and a smooth blending of the
relative speed r_N = N/N_nominal near zero.
The function is used by the pump head, flow, and power
characteristic models to apply pump affinity-law scaling: the
abscissa is normalised by the relative-speed factor (ratio =
x/r_R) before the curve lookup, where r_R is
r_N itself for r_N > delta and a cubic
Hermite blend down to 0.5*delta for r_N ≤
delta (clamped to 0.5*delta for negative
r_N). This avoids division-by-zero singularities when
the pump is stopped or near stopped.
x, r_N — time-varying inputs.x_curve, y_curve, delta
— parameters that fix the curve shape.d — spline tangents at the support points.
Defaults to splineDerivatives(x_curve, y_curve,
isMonotonic(y_curve, false)); pass it explicitly (computed
once as a final parameter in the calling model) so the
symbolic engine does not re-evaluate it on every call.smoothOrder = 1 declares the result is C¹ in
x and r_N. The derivative
annotation provides PerformanceCurve_der
as the analytic time derivative, with x_curve,
y_curve, d and delta
declared zeroDerivative. This lets Dymola build
analytic Jacobians for systems containing pump curves — previously
the chain rule descended into splineDerivatives and
failed.
function PerformanceCurve input Real x "Value of interest"; input Real x_curve[:] "Abcissa"; input Real y_curve[size(x_curve, 1)] "Ordinate"; input Real d[size(x_curve, 1)] = TRANSFORM.Math.splineDerivatives(x = x_curve, y = y_curve, ensureMonotonicity = TRANSFORM.Math.isMonotonic(x = y_curve, strict = false)) "Derivatives at the support points (precomputed; default keeps backward compatibility)"; input Real r_N(unit = "1") "Relative revolution, r_N=N/N_nominal"; input Real delta = 0.05 "Small value for switching implementation around zero rpm"; output Real y "Output at x"; end PerformanceCurve;