Implement model switcher

This commit is contained in:
2025-11-14 15:12:20 +01:00
parent 7f2d326612
commit d5183bdca0
3 changed files with 39 additions and 4 deletions

View File

@@ -20,6 +20,17 @@ class Settler {
}
get getEffluent() {
switch (this.config.model) {
case "mb-model":
return this._mbModel();
case "t-model":
return this._tModel();
default:
this.logger.error(`Unknown settler model: ${this.config.model}`);
}
}
_mbModel() {
// 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;
@@ -53,9 +64,19 @@ class Settler {
}
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() }
{ topic: "Fluent", payload: { inlet: 0, F: F_eff, C: Cs_eff } },
{ topic: "Fluent", payload: { inlet: 1, F: F_so, C: Cs_s } },
{ topic: "Fluent", payload: { inlet: 2, F: F_sr, C: Cs_s } }
];
}
_tModel() {
return [
{ topic: "Fluent", payload: { inlet: 0, F: null, C: null } },
{ topic: "Fluent", payload: { inlet: 1, F: null, C: null } },
{ topic: "Fluent", payload: { inlet: 2, F: null, C: null } }
];
}