Files
machineGroupControl/src/optimizer/index.js
znetsixe 619b1311d2 P4 wave 1: extract MGC concerns into focused modules
src/groupOps/        groupOperatingPoint + groupCurves (pure functions)
  src/totals/          totalsCalculator (dynamic + absolute + active)
  src/combinatorics/   pumpCombinations (validPumpCombinations + checkSpecialCases)
  src/optimizer/       bestCombination (CoG) + bepGravitation (BEP-G + marginal-cost)
  src/efficiency/      groupEfficiency (calc + distance helpers)
  src/dispatch/        demandDispatcher (LatestWinsGate-based; replaces
                       _dispatchInFlight + _delayedCall)
  src/commands/        canonical names from start (set.mode/scaling/demand,
                       child.register) + legacy aliases
  CONTRACT.md          inputs/outputs/events surface

53 basic tests pass (52 new + 1 pre-existing).
specificClass.js / nodeClass.js untouched — integration in P4 wave 2.

Findings flagged via agents (TODO append to OPEN_QUESTIONS.md):
  - calcGroupEfficiency.maxEfficiency is actually the mean (misleading name)
  - checkSpecialCases has a no-op `return false` inside forEach
  - MGC doesn't route cmd.startup/shutdown/estop — confirm if station broadcasts need it

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 20:45:23 +02:00

18 lines
617 B
JavaScript

const cog = require('./bestCombination');
const bep = require('./bepGravitation');
// Pick the optimizer module by config string.
// Anything other than the two BEP variants falls back to CoG.
function pickOptimizer(method) {
if (method === 'BEP-Gravitation' || method === 'BEP-Gravitation-Directional') return bep;
return cog;
}
module.exports = {
pickOptimizer,
calcBestCombination: cog.calcBestCombination,
calcBestCombinationBEPGravitation: bep.calcBestCombinationBEPGravitation,
estimateSlopesAtBEP: bep.estimateSlopesAtBEP,
redistributeFlowBySlope: bep.redistributeFlowBySlope,
};