--- title: 3D Pump Curve Architecture created: 2026-04-07 updated: 2026-04-07 status: proven tags: [predict, curves, interpolation, rotatingMachine] sources: [nodes/generalFunctions/src/predict/predict_class.js, nodes/rotatingMachine/src/specificClass.js] --- # 3D Pump Curve Prediction ## Data Structure A family of 2D curves indexed by pressure (f-dimension): - **X-axis**: control position (0-100%) - **Y-axis**: flow (nq) or power (np) in canonical units - **F-dimension**: pressure (Pa) — the 3rd dimension Raw curves are in curve units (m3/h, kW, mbar). `_normalizeMachineCurve()` converts to canonical (m3/s, W, Pa). ## Interpolation Monotonic cubic spline (Fritsch-Carlson) in both dimensions: - **X-Y splines**: at each discrete pressure level - **F-splines**: across pressure levels for intermediate pressure interpolation ## Prediction Flow ``` predict.y(x): 1. Clamp x to [currentFxyXMin, currentFxyXMax] 2. Normalize x to [normMin, normMax] 3. Evaluate spline at normalized x for current fDimension 4. Return y in canonical units (m3/s or W) ``` ## Unit Conversion Chain ``` Raw curve (m3/h, kW, mbar) → _normalizeMachineCurve → canonical (m3/s, W, Pa) → predict class → canonical output → MeasurementContainer.getCurrentValue(outputUnit) → output units ``` No double-conversion. Clean separation: specificClass handles units, predict handles normalization/interpolation. ## Three Predict Instances per Machine - `predictFlow`: control % → flow (nq curve) - `predictPower`: control % → power (np curve) - `predictCtrl`: flow → control % (reversed nq curve) ## Boundary Behavior - Below/above curve X range: flat extrapolation (clamped) - Below/above f-dimension range: clamped to min/max pressure level ## Performance - `y(x)`: O(log n), effectively O(1) for 5-10 data points - `buildAllFxyCurves`: sub-10ms for typical curves - Full caching of normalized curves, splines, and calculated curves