From 297c6713de9e271a7140072ae40494150926d6ca Mon Sep 17 00:00:00 2001 From: znetsixe Date: Mon, 11 May 2026 16:04:47 +0200 Subject: [PATCH] fix: expose tick(dt) on Reactor wrapper P6.5 refactor introduced the BaseDomain wrapper around CSTR/PFR engines but didn't pass tick() through. BaseNodeAdapter's optional-chain source.tick?.() got undefined and the kinetics engine never integrated when driven through the new adapter (only via the explicit _emitOutputs override that calls updateState). Added tick(timeStep) that delegates to engine.tick + emits 'output-changed'. Tests that construct the wrapper (not the engine directly) now work. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/specificClass.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/specificClass.js b/src/specificClass.js index e78572f..bc3d079 100644 --- a/src/specificClass.js +++ b/src/specificClass.js @@ -75,6 +75,16 @@ class Reactor extends BaseDomain { updateState(t) { this.engine.updateState(t); this.notifyOutputChanged(); } + // Engine pass-through — needed so the BaseNodeAdapter tick loop (and + // tests calling reactor.tick(dt) directly) drive the ASM integration. + // Without this the Node-RED tick fires `source.tick?.()`, gets undefined, + // and the kinetics state never advances. + tick(timeStep) { + const result = this.engine.tick(timeStep); + this.notifyOutputChanged(); + return result; + } + get getEffluent() { return this.engine.getEffluent; } get getGridProfile() { return this.engine.getGridProfile; } get temperature() { return this.engine.temperature; }