Minor optimisations
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user