Refactor reactor node configuration to remove n_inlets and simplify inlet handling
This commit is contained in:
@@ -88,7 +88,6 @@ class nodeClass {
|
||||
length: parseFloat(uiConfig.length),
|
||||
resolution_L: parseInt(uiConfig.resolution_L),
|
||||
alpha: parseFloat(uiConfig.alpha),
|
||||
n_inlets: parseInt(uiConfig.n_inlets),
|
||||
kla: parseFloat(uiConfig.kla),
|
||||
initialState: [
|
||||
parseFloat(uiConfig.S_O_init),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const ASM3 = require('./reaction_modules/asm3_class.js');
|
||||
const { create, all, isArray } = require('mathjs');
|
||||
const { create, all, isArray, i } = require('mathjs');
|
||||
const { assertNoNaN } = require('./utils.js');
|
||||
const { childRegistrationUtils, logger, MeasurementContainer } = require('generalFunctions');
|
||||
const EventEmitter = require('events');
|
||||
@@ -38,8 +38,8 @@ class Reactor {
|
||||
|
||||
this.volume = config.volume; // fluid volume reactor [m3]
|
||||
|
||||
this.Fs = Array(config.n_inlets).fill(0); // fluid debits per inlet [m3 d-1]
|
||||
this.Cs_in = Array.from(Array(config.n_inlets), () => new Array(NUM_SPECIES).fill(0)); // composition influents
|
||||
this.Fs = [0]; // fluid debits per inlet [m3 d-1]
|
||||
this.Cs_in = [Array(NUM_SPECIES).fill(0)]; // composition influents
|
||||
this.OTR = 0.0; // oxygen transfer rate [g O2 d-1 m-3]
|
||||
this.temperature = 20; // temperature [C]
|
||||
|
||||
@@ -55,9 +55,15 @@ class Reactor {
|
||||
* @param {object} input - Input object (msg) containing payload with inlet index, flow rate, and concentrations.
|
||||
*/
|
||||
set setInfluent(input) {
|
||||
let index_in = input.payload.inlet;
|
||||
this.Fs[index_in] = input.payload.F;
|
||||
this.Cs_in[index_in] = input.payload.C;
|
||||
const i_in = input.payload.inlet;
|
||||
if (this.Fs.length <= i_in) {
|
||||
this.logger.debug(`Adding new inlet index ${i_in}.`);
|
||||
this.Fs.push(0);
|
||||
this.Cs_in.push(Array(NUM_SPECIES).fill(0));
|
||||
this.setInfluent = input;
|
||||
}
|
||||
this.Fs[i_in] = input.payload.F;
|
||||
this.Cs_in[i_in] = input.payload.C;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +183,7 @@ class Reactor {
|
||||
|
||||
_connectMachine(machineChild) {
|
||||
if (machineChild.config.functionality.positionVsParent == "downstream") {
|
||||
machineChild.upstreamReactor = this;
|
||||
machineChild.upstreamSource = this;
|
||||
this.returnPump = machineChild;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user