forked from p.vanderwilt/settler
Compare commits
2 Commits
7f2d326612
...
55ae9edaa7
| Author | SHA1 | Date | |
|---|---|---|---|
| 55ae9edaa7 | |||
| d5183bdca0 |
13
settler.html
13
settler.html
@@ -6,6 +6,7 @@
|
||||
color: "#e4a363",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
model: { value: "mb-model", required: true },
|
||||
|
||||
enableLog: { value: false },
|
||||
logLevel: { value: "error" },
|
||||
@@ -34,6 +35,14 @@
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
|
||||
$("#node-input-model").typedInput({type:"model", types:[{
|
||||
value: "model",
|
||||
options: [
|
||||
{ value: "mb-model", label: "Mass balance" },
|
||||
{ value: "t-model", label: "Takács model" }
|
||||
]
|
||||
}]});
|
||||
},
|
||||
oneditsave: function() {
|
||||
// save logger fields
|
||||
@@ -54,6 +63,10 @@
|
||||
<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-model"><i class="fa fa-tag"></i> Model</label>
|
||||
<input type="text" id="node-input-model">
|
||||
</div>
|
||||
|
||||
<!-- Logger fields injected here -->
|
||||
<div id="logger-fields-placeholder"></div>
|
||||
|
||||
@@ -66,7 +66,8 @@ class nodeClass {
|
||||
functionality: {
|
||||
positionVsParent: uiConfig.positionVsParent || 'atEquipment', // Default to 'atEquipment' if not specified
|
||||
softwareType: "settler" // should be set in config manager
|
||||
}
|
||||
},
|
||||
model: uiConfig.model
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
this.logger.error("Not implemented yet.");
|
||||
|
||||
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