Refactor settler node: remove unused inlet input and enhance effluent calculation logic
This commit is contained in:
@@ -42,11 +42,6 @@
|
||||
if (window.EVOLV?.nodes?.measurement?.positionMenu?.saveEditor) {
|
||||
window.EVOLV.nodes.rotatingMachine.positionMenu.saveEditor(this);
|
||||
}
|
||||
|
||||
const inlet = parseInt($("#node-input-n_inlets").typedInput("value"));
|
||||
if (inlet < 1) {
|
||||
RED.notify("Number of inlets not set correctly", {type: "error"});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -56,10 +51,6 @@
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-inlet"><i class="fa fa-tag"></i> Assigned inlet return line</label>
|
||||
<input type="text" id="node-input-inlet" placeholder="#">
|
||||
</div>
|
||||
|
||||
<!-- Logger fields injected here -->
|
||||
<div id="logger-fields-placeholder"></div>
|
||||
|
||||
@@ -100,7 +100,7 @@ class nodeClass {
|
||||
}
|
||||
|
||||
_tick(){
|
||||
this.node.send([null, null, null]);
|
||||
this.node.send([this.source.getEffluent, null, null]);
|
||||
}
|
||||
|
||||
_attachCloseHandler() {
|
||||
|
||||
@@ -14,11 +14,49 @@ class Settler {
|
||||
this.returnPump = null;
|
||||
|
||||
// state variables
|
||||
this.F_in = 0;
|
||||
this.F_in = 0; // debit in
|
||||
this.Cs_in = new Array(13).fill(0); // Concentrations in
|
||||
this.C_TS = 2500; // Total solids concentration sludge
|
||||
}
|
||||
|
||||
get getEffluent() {
|
||||
return;
|
||||
// constrain flow to prevent negatives
|
||||
const F_s = Math.min((this.F_in * this.Cs_in[12]) / this.C_TS, this.F_in);
|
||||
const F_eff = this.F_in - F_s;
|
||||
|
||||
let F_sr = 0;
|
||||
if (this.returnPump) {
|
||||
F_sr = Math.min(this.returnPump.measurements.type("flow").variant("measured").position("atEquipment").getCurrentValue(), F_s);
|
||||
}
|
||||
const F_so = F_s - F_sr;
|
||||
|
||||
// effluent
|
||||
const Cs_eff = structuredClone(this.Cs_in);
|
||||
if (F_s > 0) {
|
||||
Cs_eff[7] = 0;
|
||||
Cs_eff[8] = 0;
|
||||
Cs_eff[9] = 0;
|
||||
Cs_eff[10] = 0;
|
||||
Cs_eff[11] = 0;
|
||||
Cs_eff[12] = 0;
|
||||
}
|
||||
|
||||
// sludge
|
||||
const Cs_s = structuredClone(this.Cs_in);
|
||||
if (F_s > 0) {
|
||||
Cs_s[7] = this.F_in * this.Cs_in[7] / F_s;
|
||||
Cs_s[8] = this.F_in * this.Cs_in[8] / F_s;
|
||||
Cs_s[9] = this.F_in * this.Cs_in[9] / F_s;
|
||||
Cs_s[10] = this.F_in * this.Cs_in[10] / F_s;
|
||||
Cs_s[11] = this.F_in * this.Cs_in[11] / F_s;
|
||||
Cs_s[12] = this.F_in * this.Cs_in[12] / F_s;
|
||||
}
|
||||
|
||||
return [
|
||||
{ topic: "Fluent", payload: { inlet: 0, F: F_eff, C: Cs_eff }, timestamp: Date.now() },
|
||||
{ topic: "Fluent", payload: { inlet: 1, F: F_so, C: Cs_s }, timestamp: Date.now() },
|
||||
{ topic: "Fluent", payload: { inlet: 2, F: F_sr, C: Cs_s }, timestamp: Date.now() }
|
||||
];
|
||||
}
|
||||
|
||||
registerChild(child, softwareType) {
|
||||
@@ -73,7 +111,7 @@ class Settler {
|
||||
}
|
||||
|
||||
if (reactorChild.config.functionality.positionVsParent != "upstream") {
|
||||
this.logger.warn("Reactor children of reactors should always be upstream.");
|
||||
this.logger.warn("Reactor children of settlers should be upstream.");
|
||||
}
|
||||
|
||||
this.upstreamReactor = reactorChild;
|
||||
@@ -97,6 +135,18 @@ class Settler {
|
||||
this.returnPump = machineChild;
|
||||
}
|
||||
}
|
||||
|
||||
_updateMeasurement(measurementType, value, position, context) {
|
||||
switch(measurementType) {
|
||||
case "quantity (TSS)":
|
||||
this.C_TS = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
this.logger.error(`Type '${measurementType}' not recognized for measured update.`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { Settler };
|
||||
Reference in New Issue
Block a user