Update state handling in reactor class and optimize time iteration logic
This commit is contained in:
@@ -37,6 +37,7 @@ class nodeClass {
|
||||
break;
|
||||
case "Fluent":
|
||||
this.source.setInfluent = msg;
|
||||
this.source.updateState(msg.timestamp);
|
||||
break;
|
||||
case "OTR":
|
||||
this.source.setOTR = msg;
|
||||
|
||||
@@ -214,13 +214,13 @@ class Reactor {
|
||||
this.setInfluent = this.upstreamReactor.getEffluent[0];
|
||||
}
|
||||
|
||||
if (newTime === this.currentTime) {
|
||||
// no update necessary
|
||||
const n_iter = Math.floor(this.speedUpFactor * (newTime-this.currentTime) / (this.timeStep*DAY2MS));
|
||||
|
||||
if (n_iter == 0) {
|
||||
// no update required
|
||||
return;
|
||||
}
|
||||
|
||||
const n_iter = Math.floor(this.speedUpFactor * (newTime-this.currentTime) / (this.timeStep*DAY2MS));
|
||||
if (n_iter) {
|
||||
let n = 0;
|
||||
while (n < n_iter) {
|
||||
this.tick(this.timeStep);
|
||||
@@ -233,7 +233,6 @@ class Reactor {
|
||||
this.returnPump.updateSourceSink();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Reactor_CSTR extends Reactor {
|
||||
|
||||
Reference in New Issue
Block a user