Refactor advanced-reactor node to improve input handling and initialize reactor properties

This commit is contained in:
2025-06-13 15:10:57 +02:00
parent 05d33b7f39
commit d71698d94e
3 changed files with 57 additions and 34 deletions

View File

@@ -9,14 +9,23 @@ class Reactor_CSTR {
this.asm = new ASM3();
this.Vl = volume; // fluid volume reactor [m3]
this.F = 1.0; // fluid debit [m3 d-1]
this.C_in = [0., 30., 100., 16., 0., 0., 5., 25., 75., 30., 0., 0., 125.]; // composition influent
this.OTR = 100.0; // oxygen transfer rate [g O2 d-1]
this.F = 0.0; // fluid debit [m3 d-1]
this.C_in = Array(13).fill(0.0); // composition influent
this.OTR = 0.0; // oxygen transfer rate [g O2 d-1]
this.currentTime = Date.now(); // milliseconds since epoch [ms]
this.timeStep = 1/(24*60*15) // time step [d]
}
set setInflux(input) { // setter for C_in (WIP)
this.F = input.payload.F;
this.C_in = input.payload.C_in;
}
set setOTR(input) { // setter for OTR (WIP) [g O2 d-1]
this.OTR = input.payload;
}
// expect update with timestamp
updateState(input) {
let newTime = input.payload;