Files
EVOLV/test
Rene De Ren 3c7d54e9c3
Some checks failed
CI / lint-and-test (push) Has been cancelled
Add 4 cross-node tests closing PS↔MGC integration gaps
- ps-mgc-flow-contract: asserts PS's view of MGC outflow equals the live
  per-pump aggregate at every tick. Currently FAILS — exposes that
  MGC's flow.predicted.downstream reverts to optimalControl's bestFlow
  target after handlePressureChange writes the correct flow.act, leaving
  PS with stale outflow values. The mirror added in dc27a56 is necessary
  but not sufficient.

- dead-zone-signal: asserts the Schmitt-trigger transitions
  (engaged 100% → keep-alive 1% → off 0%) across startLevel↓/stopLevel↓
  with proper rising-edge re-arm. Currently PASSES.

- inflow-overcapacity-stability: 45 s sim at 2× station capacity;
  asserts pumps don't thrash or park in accelerating residue. Currently
  FAILS — pumps end up at ctrl=0 in 'accelerating' state, suggesting
  the residue-unpark fix doesn't fully cover steady-state over-capacity.

- realistic-startup-timing: re-runs the varying-demand-during-startup
  scenario with PRODUCTION-default state.time (starting=10s, warm=5s)
  instead of the 1-2 s used elsewhere. Currently PASSES — confirms the
  dispatch-reorder fix holds under realistic transition windows.

Honest summary: 2 pass, 2 fail. The two failures expose genuine
remaining defects in the PS↔MGC measurement contract and the
residue-unpark policy. They're committed FAILING so the bugs are
captured under version control until the underlying fixes land.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 18:07:11 +02:00
..

EVOLV cross-node test harness

This folder hosts end-to-end tests that wire multiple EVOLV domain classes together the same way Node-RED would, but in pure Node.js so the simulation runs deterministically and every internal value is inspectable.

Scope rule. Tests that exercise a single node's behaviour live in that node's submodule under nodes/<name>/test/. Tests here cross node boundaries — they instantiate pumpingStation + machineGroupControl + multiple rotatingMachines together and drive the wired graph.

Examples of what belongs where:

Concern Lives in
MGC optimizer combination choice for a given demand nodes/machineGroupControl/test/integration/optimizer-combination-choice.integration.test.js
Pump curve interpolation across head values nodes/rotatingMachine/test/integration/...
PS hysteresis logic with mocked groups nodes/pumpingStation/test/integration/shifted-ramp-end-to-end.test.js
Whole plant: PS basin level + MGC dispatch + 3 pumps + physics simulator test/end-to-end-pumpingstation.test.js (this folder)

Run:

node --test test/end-to-end-pumpingstation.test.js

The harness in lib/wiring.js builds the parent-child relationships Node-RED would build via registerChild, lets you advance a controllable clock, and lib/recorder.js records every measurement / state / demand event into a flat trace.