Compare commits

..

1 Commits

Author SHA1 Message Date
znetsixe
297c6713de 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) <noreply@anthropic.com>
2026-05-11 16:04:47 +02:00

View File

@@ -75,6 +75,16 @@ class Reactor extends BaseDomain {
updateState(t) { this.engine.updateState(t); this.notifyOutputChanged(); } 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 getEffluent() { return this.engine.getEffluent; }
get getGridProfile() { return this.engine.getGridProfile; } get getGridProfile() { return this.engine.getGridProfile; }
get temperature() { return this.engine.temperature; } get temperature() { return this.engine.temperature; }