From 472402c62db0d3a56238ca279fd55adf1e1f8ce3 Mon Sep 17 00:00:00 2001 From: znetsixe Date: Sun, 17 May 2026 19:43:55 +0200 Subject: [PATCH] =?UTF-8?q?feat(mgc):=20rendezvous=20planner=20=E2=80=94?= =?UTF-8?q?=20same-time=20landing=20across=20all=20modes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Routes every dispatch through a tick-aware planner so all pumps reach their setpoint at the same wall-clock instant t* = max(eta_i), regardless of control strategy or per-pump reaction speed. Architecture (src/movement/): - machineProfile.js – pure snapshot of a registered child (state, position, velocityPctPerS, ladder timings, flowAt / positionForFlow). Reads timings from child.state.config.time (the actual storage location — previous fallback paths silently produced 0 s, collapsing every eta to ramp-only). - moveTrajectory.js – seconds-to-target per machine; handles idle / starting / warmingup / operational / cooling. - movementScheduler.js – t* = max eta over ALL non-noop moves. Every command is delayed so its move finishes at t*. Startup execsequence fires at 0; its flowmovement is gated by max(ladderS, t* − rampS) so a fast pump waits before ramping rather than landing early. useRendezvous=false collapses to all fireAtTickN=0 (legacy fire-and-forget). - movementExecutor.js – wall-clock virtual cursor: each tick fires every command whose fireAtTickN ≤ floor(elapsed/tickS). tick() no longer awaits pending fireCommand promises — the synchronous prologue of handleInput claims the latest-wins gate, which is what race-favouring relies on. Shared dispatch path (src/specificClass.js): - _dispatchFlowDistribution(distribution) — extracted from _optimalControl. Builds profiles, calls movementScheduler.plan, replans the executor, ticks once. Reads config.planner.useRendezvous (default true). - _optimalControl computes its bestCombination and hands off. - equalFlowControl (priorityControl mode) computes its flowDistribution and hands off via ctx.mgc._dispatchFlowDistribution. Same-time landing now applies in BOTH modes. Editor toggle (mgc.html + src/nodeClass.js): - New "Same-time landing" checkbox under Control Strategy. - nodeClass.buildDomainConfig bridges uiConfig.useRendezvous → config.planner.useRendezvous. Default ON. Tests: - New: planner-convergence.integration.test.js (real-time end-to-end diagnostic — drives a 3-pump mixed-state dispatch and asserts both convergence to the demand setpoint AND same-time landing within one tick). - New: planner-rendezvous.integration.test.js (schedule-shape assertions against real pump objects). - New: movementScheduler.basic.test.js — includes a mixed-speed multi-startup case proving the fast pumps wait so all three land together (the regression that prompted this work). - New: movementExecutor.basic.test.js + moveTrajectory.basic.test.js. - Updated executor contract test: tick() must NOT await pending fires. Commands + wiki: - handlers.js: source/mode allow-list gate moved into a shared _gate() helper; every command now checks isValidActionForMode + isValidSourceForMode before dispatching. Status-level commands (set.mode, set.scaling) are allowed in every mode. - commands.basic.test.js: coverage for the new gate behaviour. - wiki regen: Home.md visual-first rewrite + Reference-{Architecture, Contracts,Examples,Limitations}.md split with _Sidebar.md index. Co-Authored-By: Claude Opus 4.7 (1M context) --- mgc.html | 77 +++- mgc.js | 13 + src/commands/handlers.js | 30 ++ src/control/strategies.js | 21 +- src/editor/index.js | 34 ++ src/editor/mode-cards.js | 142 ++++++++ src/editor/oneditprepare.js | 16 + src/movement/machineProfile.js | 90 +++++ src/movement/moveTrajectory.js | 86 +++++ src/movement/movementExecutor.js | 121 +++++++ src/movement/movementScheduler.js | 245 +++++++++++++ src/nodeClass.js | 3 + src/specificClass.js | 146 +++++++- test/_output-manifest.md | 2 +- test/basic/commands.basic.test.js | 152 +++++++- test/basic/moveTrajectory.basic.test.js | 142 ++++++++ test/basic/movementExecutor.basic.test.js | 136 +++++++ test/basic/movementScheduler.basic.test.js | 307 ++++++++++++++++ .../planner-convergence.integration.test.js | 254 +++++++++++++ .../planner-rendezvous.integration.test.js | 210 +++++++++++ wiki/Home.md | 342 ++++++------------ wiki/Reference-Architecture.md | 261 +++++++++++++ wiki/Reference-Contracts.md | 196 ++++++++++ wiki/Reference-Examples.md | 155 ++++++++ wiki/Reference-Limitations.md | 128 +++++++ wiki/_Sidebar.md | 19 + 26 files changed, 3048 insertions(+), 280 deletions(-) create mode 100644 src/editor/index.js create mode 100644 src/editor/mode-cards.js create mode 100644 src/editor/oneditprepare.js create mode 100644 src/movement/machineProfile.js create mode 100644 src/movement/moveTrajectory.js create mode 100644 src/movement/movementExecutor.js create mode 100644 src/movement/movementScheduler.js create mode 100644 test/basic/moveTrajectory.basic.test.js create mode 100644 test/basic/movementExecutor.basic.test.js create mode 100644 test/basic/movementScheduler.basic.test.js create mode 100644 test/integration/planner-convergence.integration.test.js create mode 100644 test/integration/planner-rendezvous.integration.test.js create mode 100644 wiki/Reference-Architecture.md create mode 100644 wiki/Reference-Contracts.md create mode 100644 wiki/Reference-Examples.md create mode 100644 wiki/Reference-Limitations.md create mode 100644 wiki/_Sidebar.md diff --git a/mgc.html b/mgc.html index 3d9b295..acfb330 100644 --- a/mgc.html +++ b/mgc.html @@ -8,8 +8,32 @@ | **Control Module** | `#a9daee` | zwart | --> - - + + + + + + + + +