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