forked from p.vanderwilt/settler
Implement model switcher
This commit is contained in:
@@ -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 } }
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user