From 24a7b968838d36c41a4d01555b14a20a5e7e82db Mon Sep 17 00:00:00 2001 From: "p.vanderwilt" Date: Thu, 24 Jul 2025 15:38:27 +0200 Subject: [PATCH] Implemented basic process output --- src/nodeClass.js | 2 +- src/specificClass.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/nodeClass.js b/src/nodeClass.js index 16a467a..8d51d9f 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -80,7 +80,7 @@ class nodeClass { * Execute a single tick and send outputs. */ _tick() { - processMsg = null; + processMsg = this.source.getOutput(); influxMsg = null; // Send only updated outputs on ports 0 & 1 diff --git a/src/specificClass.js b/src/specificClass.js index eee7a8b..8ddc30c 100644 --- a/src/specificClass.js +++ b/src/specificClass.js @@ -14,17 +14,26 @@ class liquidFlowHandler { updateState(timeStamp) { effluent = this.reactors[1].getEffluent(); - effluent.F = this.debit; + effluent.payload.F = this.debit; this.reactors[0].setInfluent = effluent; } handleChildChange() { - + return; } handlePressureChange(machine) { this.debit = machine.measurements.type("flow").variant("predicted").position("downstream").getCurrentValue(); } + + getOutput() { + mainEffluent = this.reactors[1].getEffluent(); + sideStream = structuredClone(mainEffluent); + mainEffluent.payload.F -= this.debit; + sideStream.payload.F = this.debit; + sideStream.payload.inlet = 1; + return {payload: [mainEffluent.payload, sideStream.payload]}; + } } module.exports = { liquidFlowHandler }; \ No newline at end of file