Files
machineGroupControl/src/groupOps/groupCurves.js

28 lines
1.0 KiB
JavaScript
Raw Normal View History

// Group-scope read helpers for pump curves.
//
// Optimizers and totals evaluate each pump at the GROUP operating point
// (set by GroupOperatingPoint.equalize), not the pump's individual sensor-
// driven point. Each pump exposes a parallel "group*" predict object —
// these helpers fall back to the individual predicts when the pump hasn't
// been initialised for group operation yet (first tick after register).
function groupFlow(machine /*, ctx */) {
return machine.groupPredictFlow ?? machine.predictFlow;
}
function groupPower(machine /*, ctx */) {
return machine.groupPredictPower ?? machine.predictPower;
}
function groupNCog(machine /*, ctx */) {
return machine.groupPredictFlow ? (machine.groupNCog ?? 0) : (machine.NCog ?? 0);
}
function groupCalcPower(machine, flow /*, ctx */) {
return typeof machine.groupCalcPower === 'function'
? machine.groupCalcPower(flow)
: machine.inputFlowCalcPower(flow);
}
module.exports = { groupFlow, groupPower, groupNCog, groupCalcPower };