65 Commits

Author SHA1 Message Date
znetsixe
11d196f363 fix: pass returnToOperational:true for shutdown/estop abort path
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 12:01:49 +02:00
znetsixe
510a4233e6 fix: remove trace instrumentation + update tests for corrected curve bounds
The bogus machineCurve default at pressure "1" (fixed in generalFunctions
086e5fe) made fValues.min=1, which let sub-curve differentials pass
unclamped. With the fix, fValues.min=70000 (the real curve minimum) and
low differentials get clamped. Three tests that accidentally depended on
the bogus min=1 behavior are updated:

- coolprop test: expects fDimension clamped to curve minimum when
  differential < curve range
- pressure-initialization test: uses pressures whose differential falls
  WITHIN the curve range (900 mbar = 90000 Pa > 70000 Pa minimum)
- sequences test: tests upper-bound constraint with setpoint > max,
  then confirms a valid setpoint is applied as-is (was incorrectly
  asserting any setpoint would be clamped to max)

Trace instrumentation from debugging session removed.

91/91 tests green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 10:28:13 +02:00
znetsixe
26e253d030 fix: clamp flow/power predictions to 0 when controller position ≤ 0
At ctrl=0% with high backpressure, the curve prediction extrapolates to
large negative values (backflow through a stopped pump). This produced
confusing chart readings (-200+ m³/h for an idle pump) and polluted
downstream consumers like MGC efficiency calculations.

Fix: in both calcFlow and calcPower, if the controller position x ≤ 0
the prediction is clamped to 0 regardless of what the spline returns.
For x > 0, predictions are also clamped to ≥ 0 (negative flow/power
from a running pump is physically implausible for a centrifugal machine).

91/91 tests still green — no existing test asserted on negative
flow/power values at ctrl=0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 10:07:02 +02:00
znetsixe
c464b66b27 docs: add CLAUDE.md with S88 classification and superproject rule reference
References the flow-layout rule set in the EVOLV superproject
(.claude/rules/node-red-flow-layout.md) so Claude Code sessions working
in this repo know the S88 level, colour, and placement lane for this node.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 07:47:21 +02:00
znetsixe
17b88870bb fix: interruptible shutdown/emergencystop + dual-curve test coverage
Runtime:
- executeSequence now normalizes sequenceName to lowercase so parent
  orchestrators that use 'emergencyStop' (capital S) route correctly to
  the 'emergencystop' sequence key. Closes the "Sequence 'emergencyStop'
  not defined" warn seen when commands reach the node during accelerating.
- When a shutdown or emergencystop sequence is requested while the FSM is
  in accelerating/decelerating, the active movement is aborted via
  state.abortCurrentMovement() and the sequence waits (up to 2s) for the
  FSM to return to 'operational' before proceeding. New helper
  _waitForOperational listens on the state emitter for the transition.
- Single-side pressure warning: fix "acurate" typo and make the message
  actionable.

Tests (+15, now 91/91 passing):
- test/integration/interruptible-movement.integration.test.js (+3):
  shutdown during accelerating -> idle; emergencystop during accelerating
  -> off; mixed-case sequence-name normalization.
- test/integration/curve-prediction.integration.test.js (+12):
  parametrized across both shipped pump curves (hidrostal-H05K-S03R and
  hidrostal-C5-D03R-SHN1). Verifies loader integrity, mid-range prediction
  sanity, flow monotonicity in ctrl, inverse-pressure monotonicity, CoG
  finiteness, and reverse-predictor round-trip.

E2E:
- test/e2e/curve-prediction-benchmark.py: live Dockerized Node-RED
  benchmark that deploys one rotatingMachine per curve and runs a per-pump
  (pressure x ctrl) sweep inside each curve's envelope. Reports envelope
  compliance and monotonicity.
- test/e2e/README.md documents the benchmark and a known limitation:
  pressure below the curve's minimum slice extrapolates wildly
  (defended by upstream measurement-node clamping in production).

UX:
- rotatingMachine.html: added placeholders and descriptions for Reaction
  Speed / Startup / Warmup / Shutdown / Cooldown. Expanded the Node-RED
  help panel with a topic reference, port documentation, state diagram,
  and prediction rules.

Docs:
- README.md rewritten (was a single line) with install, quick start,
  topic/port reference, state machine, predictions, testing, production
  status.

Depends on generalFunctions commit 75d16c6 (state.js abort recovery and
rotatingMachine schema additions).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:21:48 +02:00
znetsixe
07af7cef40 fix: production hardening — safety fixes, prediction accuracy, test coverage
Safety:
- Async input handler: await all handleInput() calls, prevents unhandled rejections
- Fix emergencyStop case mismatch: "emergencyStop" → "emergencystop" matching config
- Implement showCoG() method (was routing to undefined)
- Null guards on 6 methods for missing curve data
- Editor menu polling timeout (5s max)
- Listener cleanup on node close (child measurements + state emitter)
- Tick loop race condition: track startup timeout, clear on close

Prediction accuracy:
- Remove efficiency rounding that destroyed signal in canonical units
- Fix calcEfficiency variant: hydraulic power reads from correct variant
- Guard efficiency calculations against negative/zero values
- Division-by-zero protection in calcRelativeDistanceFromPeak
- Curve data anomaly detection (cross-pressure median-y ratio check)
- calcEfficiencyCurve O(n²) → O(n) with running min
- updateCurve bootstraps predictors when they were null

Tests: 43 new tests (76 total) covering emergency stop, shutdown/maintenance
sequences, efficiency/CoG, movement lifecycle, output format, null guards,
and listener cleanup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 13:41:00 +02:00
znetsixe
ea33b3bba3 fix: add missing closing brace in emergencystop case block
The emergencystop case was missing its closing } before the
simulateMeasurement case, causing a SyntaxError on load.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 08:44:49 +02:00
znetsixe
f363ee53ef Merge commit '4cf46f3' into HEAD
# Conflicts:
#	src/nodeClass.js
#	src/specificClass.js
2026-03-31 18:23:38 +02:00
Rene De Ren
4cf46f33c9 Expose output format selectors in editor 2026-03-12 16:39:25 +01:00
Rene De Ren
7b9fdd7342 fix: correct logging config path and child registration ID
Fixed eneableLog typo accessing wrong config path — now uses
machineConfig.general.logging.enabled/logLevel. Changed _registerChild
to use this.node.id consistent with all other nodes. Removed debug console.log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 09:33:28 +01:00
Rene De Ren
bb986c2dc8 refactor: adopt POSITIONS constants and fix ESLint warnings
Replace hardcoded position strings with POSITIONS.* constants.
Prefix unused variables with _ to resolve no-unused-vars warnings.
Fix no-prototype-builtins where applicable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:35:28 +01:00
Rene De Ren
46dd2ca37a Migrate _loadConfig to use ConfigManager.buildConfig()
Replaces manual base config construction with shared buildConfig() method.
Node now only specifies domain-specific config sections.

Part of #1: Extract base config schema

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:59:35 +01:00
Rene De Ren
ccfa90394b Fix ESLint errors and bugs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:39:57 +01:00
znetsixe
6b2a8239f2 updates 2026-03-11 11:13:26 +01:00
znetsixe
33f3c2ef61 update 2026-02-23 13:17:18 +01:00
znetsixe
b5137ba9c2 before functional changes by Codex 2026-02-19 17:36:44 +01:00
znetsixe
405be33626 updates to rotating machine struct 2026-02-12 10:48:44 +01:00
znetsixe
c63701db38 updates 2026-01-29 13:32:39 +01:00
znetsixe
e236cccfd6 Merge branch 'dev-Rene' 2025-12-19 10:23:25 +01:00
znetsixe
108d2e23ca bug fixes 2025-11-30 09:24:37 +01:00
znetsixe
446ef81f24 adjusted input for measurement container 2025-11-28 09:59:51 +01:00
znetsixe
966ba06faa some minor addons to measurement container 2025-11-27 17:46:56 +01:00
znetsixe
e8c96c4b1e removed useless parameter 2025-11-25 16:19:23 +01:00
znetsixe
f083e7596a update 2025-11-20 22:29:24 +01:00
znetsixe
6ca6e536a5 fixed dropdown speed selection 2025-11-20 11:09:44 +01:00
p.vanderwilt
99b45c87e4 Rename _updateSourceSink to updateSourceSink for outside access 2025-11-14 12:55:11 +01:00
znetsixe
fb75fb8a11 Removed error when machine doesnt have curve so node-red doesnt crash when you dont select a machine 2025-11-13 19:39:05 +01:00
znetsixe
6528c966d8 added default liquid temp and atm pressure, added nhyd - specific flow and specific energy consumption 2025-11-12 17:40:38 +01:00
znetsixe
994cf641a3 removed some old comments 2025-11-07 15:10:46 +01:00
p.vanderwilt
0a98b12224 Merge pull request 'Implement reactor recirculation' (#4) from dev-Pieter into main
Reviewed-on: https://gitea.centraal.wbd-rd.nl/RnD/rotatingMachine/pulls/4
2025-11-06 13:58:25 +00:00
p.vanderwilt
b6d268659a Refactor flow handling: rename reactor references to source and sink and fix config minor bug 2025-11-06 14:50:40 +01:00
znetsixe
6ae622b6bf fixed bugs with db output formatting 2025-11-06 11:19:08 +01:00
znetsixe
4b5ec33c1d fixed bugs for rotating machine execSequence 2025-11-05 17:15:47 +01:00
znetsixe
51f966cfb9 Added sanitizing of input for handleInput for rotating machine 2025-11-05 15:47:39 +01:00
znetsixe
4ae6beba37 updated measurement node to match selected units from user and convert it properly 2025-10-31 18:35:40 +01:00
p.vanderwilt
303dfc477d Add flow number configuration and UI input for rotating machine 2025-10-31 14:16:00 +01:00
p.vanderwilt
ac40a93ef1 Simplify child registration error handling 2025-10-31 13:07:52 +01:00
p.vanderwilt
a8fb56bfb8 Add upstream and downstream reactor handling; improve error logging 2025-10-22 14:41:35 +02:00
HorriblePerson555
d7cc6a4a8b Enhance child registration logging and add validation for measurement child 2025-10-17 13:38:05 +02:00
HorriblePerson555
37e6523c55 Refactor child registration to use dedicated connection methods for measurement and reactor types 2025-10-16 16:32:20 +02:00
5a14f44fdd Merge pull request 'dev-Rene' (#2) from dev-Rene into main
Reviewed-on: https://gitea.centraal.wbd-rd.nl/RnD/rotatingMachine/pulls/2
2025-10-16 13:21:38 +00:00
znetsixe
d2a0274eb3 changed colours and icon based on s88 2025-10-14 13:52:39 +02:00
p.vanderwilt
c081acae4e Remove non-implemented temperature handling function 2025-10-10 13:27:31 +02:00
znetsixe
2073207df1 removed old readme 2025-10-07 18:10:45 +02:00
08185243bc Merge pull request 'dev-Rene' (#1) from dev-Rene into main
Reviewed-on: https://gitea.centraal.wbd-rd.nl/RnD/rotatingMachine/pulls/1
2025-10-06 14:16:18 +00:00
Rene De ren
bc916c0165 log updates 2025-10-03 15:41:53 +02:00
znetsixe
5357290b41 Several fixes, especially measurement and pressure updates and triggers where flawed 2025-10-02 17:09:24 +02:00
znetsixe
000bee7190 changed some old comment 2025-09-23 15:51:16 +02:00
znetsixe
b0c18e7bae added warning when model is not specified so user knows. 2025-09-23 15:11:06 +02:00
znetsixe
38408c7bc3 updates 2025-09-22 16:06:18 +02:00