Refactor updateState and getOutput methods for clarity; rename getPumpFlow to updatePumpFlow and adjust flow measurement position
This commit is contained in:
@@ -13,22 +13,23 @@ class liquidFlowHandler {
|
||||
}
|
||||
|
||||
updateState(timeStamp) {
|
||||
this.getPumpFlow();
|
||||
let effluent = this.reactors[1].getEffluent;
|
||||
this.updatePumpFlow();
|
||||
const effluent = this.reactors[1].getEffluent;
|
||||
effluent.payload.F = this.flow;
|
||||
effluent.payload.inlet = 1;
|
||||
this.reactors[0].setInfluent = effluent;
|
||||
}
|
||||
|
||||
getPumpFlow() {
|
||||
this.flow = this.pump.measurements.type("flow").variant("measured").position("atEquipment").getCurrentValue() || 0;
|
||||
updatePumpFlow() {
|
||||
this.flow = this.pump.measurements.type("flow").variant("measured").position("downstream").getCurrentValue() || 0;
|
||||
}
|
||||
|
||||
getOutput() {
|
||||
let mainEffluent = this.reactors[1].getEffluent;
|
||||
let sideStream = structuredClone(mainEffluent);
|
||||
mainEffluent.payload.F -= this.flow;
|
||||
sideStream.payload.F = this.flow;
|
||||
const mainEffluent = this.reactors[1].getEffluent;
|
||||
const sideStream = structuredClone(mainEffluent);
|
||||
const F_in = mainEffluent.payload.F;
|
||||
mainEffluent.payload.F = Math.max(F_in - this.flow, 0);
|
||||
sideStream.payload.F = F_in < this.flow ? F_in : this.flow;
|
||||
sideStream.payload.inlet = 1;
|
||||
return {payload: [mainEffluent.payload, sideStream.payload]};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user