Minor optimisations

This commit is contained in:
2025-07-21 17:28:09 +02:00
parent b1719376cf
commit 57aafe3e0b
2 changed files with 8 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ class Reactor {
this.logger = new logger(undefined, undefined, config.general.name);
this.emitter = new EventEmitter();
this.measurements = new MeasurementContainer();
this.upstreamReactor = null;
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
this.asm = new ASM3();
@@ -115,6 +116,10 @@ class Reactor {
updateState(newTime) { // expect update with timestamp
const day2ms = 1000 * 60 * 60 * 24;
if (this.upstreamReactor) {
this.setInfluent = this.upstreamReactor.getEffluent;
}
let n_iter = Math.floor(this.speedUpFactor * (newTime-this.currentTime) / (this.timeStep*day2ms));
if (n_iter) {
let n = 0;
@@ -123,7 +128,7 @@ class Reactor {
n += 1;
}
this.currentTime += n_iter * this.timeStep * day2ms / this.speedUpFactor;
this.emitter.emit("stateChange", this.getEffluent);
this.emitter.emit("stateChange", newTime);
}
}
}