Rename basin/control thresholds to wiki naming; trim stale comments

Aligns the code with the 5-threshold convention used throughout the
wiki (basin model + per-mode transfer-function diagrams):

  heightInlet       → inflowLevel
  heightOutlet      → outflowLevel
  heightOverflow    → overflowLevel
  stopLevel         → minLevel
  maxFlowLevel      → maxLevel
  minFlowLevel      → removed (collapsed into startLevel; they were
                      always supposed to hold the same value)
  minVolIn          → minVolAtInflow
  minVolOut         → minVolAtOutflow
  maxVolOverflow    → maxVolAtOverflow
  startLevel        → unchanged

Config schema (generalFunctions/src/configs/pumpingStation.json) is
updated in a parallel commit in that submodule.

Also:
- Stripped the ~150-line ASCII basin diagram from initBasinProperties
  JSDoc; it now points at wiki/functional-description.md#basin-model.
- Trimmed the top-of-class JSDoc — the config-sections breakdown was
  drifting from the schema anyway; wiki is now the source of truth.
- Tidied inline comments in _controlLevelBased, _scaleLevelToFlowPercent.
- Editor order reshuffled to match the bottom→top basin order:
  minLevel, startLevel, maxLevel.

Breaking change for saved flows: existing pumpingStation nodes in
production flows reference the old field names and will need to be
re-entered in the editor. No compat shim — node is RnD/trial.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-04-22 16:13:59 +02:00
parent 4637448c49
commit a2189457f6
5 changed files with 232 additions and 141 deletions

View File

@@ -29,9 +29,9 @@ function makeConfig(overrides = {}) {
basin: {
volume: 50, // m3 (empty basin volume)
height: 5, // m
heightInlet: 0.3, // m
heightOutlet: 0.2, // m
heightOverflow: 4.0, // m
inflowLevel: 0.3, // m
outflowLevel: 0.2, // m
overflowLevel: 4.0, // m
},
hydraulics: {
refHeight: 'NAP',
@@ -87,31 +87,31 @@ describe('pumpingStation specificClass', () => {
expect(ps.basin.maxVol).toBe(50);
});
it('should calculate maxVolOverflow = heightOverflow * surfaceArea', () => {
it('should calculate maxVolAtOverflow = overflowLevel * surfaceArea', () => {
const ps = new PumpingStation(makeConfig());
// 4.0 * 10 = 40
expect(ps.basin.maxVolOverflow).toBe(40);
expect(ps.basin.maxVolAtOverflow).toBe(40);
});
it('should calculate minVol = heightOutlet * surfaceArea', () => {
it('should calculate minVol = outflowLevel * surfaceArea', () => {
const ps = new PumpingStation(makeConfig());
// 0.2 * 10 = 2
expect(ps.basin.minVol).toBeCloseTo(2, 5);
});
it('should calculate minVolOut = heightInlet * surfaceArea', () => {
it('should calculate minVolAtOutflow = inflowLevel * surfaceArea', () => {
const ps = new PumpingStation(makeConfig());
// 0.3 * 10 = 3
expect(ps.basin.minVolOut).toBeCloseTo(3, 5);
expect(ps.basin.minVolAtOutflow).toBeCloseTo(3, 5);
});
it('should store the raw config values on basin', () => {
const ps = new PumpingStation(makeConfig());
expect(ps.basin.volEmptyBasin).toBe(50);
expect(ps.basin.heightBasin).toBe(5);
expect(ps.basin.heightInlet).toBe(0.3);
expect(ps.basin.heightOutlet).toBe(0.2);
expect(ps.basin.heightOverflow).toBe(4.0);
expect(ps.basin.inflowLevel).toBe(0.3);
expect(ps.basin.outflowLevel).toBe(0.2);
expect(ps.basin.overflowLevel).toBe(4.0);
});
});
@@ -246,13 +246,13 @@ describe('pumpingStation specificClass', () => {
describe('edge cases', () => {
it('should handle basin with zero height gracefully', () => {
// surfaceArea = volume / height => division by 0 gives Infinity
const config = makeConfig({ basin: { volume: 50, height: 0, heightInlet: 0, heightOutlet: 0, heightOverflow: 0 } });
const config = makeConfig({ basin: { volume: 50, height: 0, inflowLevel: 0, outflowLevel: 0, overflowLevel: 0 } });
const ps = new PumpingStation(config);
expect(ps.basin.surfaceArea).toBe(Infinity);
});
it('should handle basin with very small dimensions', () => {
const config = makeConfig({ basin: { volume: 0.001, height: 0.001, heightInlet: 0, heightOutlet: 0, heightOverflow: 0.0005 } });
const config = makeConfig({ basin: { volume: 0.001, height: 0.001, inflowLevel: 0, outflowLevel: 0, overflowLevel: 0.0005 } });
const ps = new PumpingStation(config);
expect(ps.basin.surfaceArea).toBeCloseTo(1, 5);
});