Refactor reactor node configuration to remove n_inlets and simplify inlet handling
This commit is contained in:
13
reactor.html
13
reactor.html
@@ -11,7 +11,6 @@
|
||||
length: { value: 0.},
|
||||
resolution_L: { value: 0.},
|
||||
alpha: {value: 0},
|
||||
n_inlets: { value: 1, required: true},
|
||||
kla: { value: null },
|
||||
|
||||
S_O_init: { value: 0., required: true },
|
||||
@@ -58,10 +57,6 @@
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
$("#node-input-n_inlets").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
$("#node-input-length").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
@@ -128,10 +123,6 @@
|
||||
if (isNaN(volume) || volume <= 0) {
|
||||
RED.notify("Fluid volume not set correctly", {type: "error"});
|
||||
}
|
||||
let n_inlets = parseInt($("#node-input-n_inlets").typedInput("value"));
|
||||
if (isNaN(n_inlets) || n_inlets < 1) {
|
||||
RED.notify("Number of inlets not set correctly", {type: "error"});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -165,10 +156,6 @@
|
||||
<input type="text" id="node-input-alpha">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-n_inlets"><i class="fa fa-tag"></i> Number of inlets</label>
|
||||
<input type="text" id="node-input-n_inlets" placeholder="#">
|
||||
</div>
|
||||
<h3> Internal mass transfer calculation (optional) </h3>
|
||||
<div class="form-row">
|
||||
<label for="node-input-kla"><i class="fa fa-tag"></i> kLa [d-1]</label>
|
||||
|
||||
@@ -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