forked from p.vanderwilt/settler
Compare commits
4 Commits
9c98f1a139
...
dev-Pieter
| Author | SHA1 | Date | |
|---|---|---|---|
| 172f634e77 | |||
| 55ae9edaa7 | |||
| d5183bdca0 | |||
| 7f2d326612 |
22
settler.html
22
settler.html
@@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
RED.nodes.registerType("settler", {
|
RED.nodes.registerType("settler", {
|
||||||
category: "WWTP",
|
category: "EVOLV",
|
||||||
color: "#e4a363",
|
color: "#e4a363",
|
||||||
defaults: {
|
defaults: {
|
||||||
name: { value: "" },
|
name: { value: "" },
|
||||||
TS_set: { value: 0.1, required: true },
|
model: { value: "mb-model", required: true },
|
||||||
inlet: { value: 1, required: true }
|
|
||||||
|
enableLog: { value: false },
|
||||||
|
logLevel: { value: "error" },
|
||||||
|
|
||||||
|
positionVsParent: { value: "" }
|
||||||
},
|
},
|
||||||
inputs: 1,
|
inputs: 1,
|
||||||
outputs: 3,
|
outputs: 3,
|
||||||
@@ -31,6 +35,14 @@
|
|||||||
type:"num",
|
type:"num",
|
||||||
types:["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() {
|
oneditsave: function() {
|
||||||
// save logger fields
|
// save logger fields
|
||||||
@@ -51,6 +63,10 @@
|
|||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</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 -->
|
<!-- Logger fields injected here -->
|
||||||
<div id="logger-fields-placeholder"></div>
|
<div id="logger-fields-placeholder"></div>
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ class nodeClass {
|
|||||||
functionality: {
|
functionality: {
|
||||||
positionVsParent: uiConfig.positionVsParent || 'atEquipment', // Default to 'atEquipment' if not specified
|
positionVsParent: uiConfig.positionVsParent || 'atEquipment', // Default to 'atEquipment' if not specified
|
||||||
softwareType: "settler" // should be set in config manager
|
softwareType: "settler" // should be set in config manager
|
||||||
}
|
},
|
||||||
|
model: uiConfig.model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,24 @@ class Settler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get getEffluent() {
|
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}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mass balance model.
|
||||||
|
*
|
||||||
|
* - assumes complete seperation of solids and effluent
|
||||||
|
* - assumes known solids concentration given by sensor or set manually
|
||||||
|
* - assumes primacy of recirculation flow, with leftover sludge being designated as waste sludge
|
||||||
|
*/
|
||||||
|
_mbModel() {
|
||||||
// constrain flow to prevent negatives
|
// 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_s = Math.min((this.F_in * this.Cs_in[12]) / this.C_TS, this.F_in);
|
||||||
const F_eff = this.F_in - F_s;
|
const F_eff = this.F_in - F_s;
|
||||||
@@ -53,9 +71,24 @@ class Settler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ topic: "Fluent", payload: { inlet: 0, F: F_eff, C: Cs_eff }, timestamp: Date.now() },
|
{ topic: "Fluent", payload: { inlet: 0, F: F_eff, C: Cs_eff } }, // Effluent
|
||||||
{ topic: "Fluent", payload: { inlet: 1, F: F_so, C: Cs_s }, timestamp: Date.now() },
|
{ topic: "Fluent", payload: { inlet: 1, F: F_so, C: Cs_s } }, // Sludge sink
|
||||||
{ topic: "Fluent", payload: { inlet: 2, F: F_sr, C: Cs_s }, timestamp: Date.now() }
|
{ topic: "Fluent", payload: { inlet: 2, F: F_sr, C: Cs_s } } // Sludge recirculation
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takacs model (Not implemented)
|
||||||
|
*
|
||||||
|
* More mechanistic model
|
||||||
|
*/
|
||||||
|
_tModel() {
|
||||||
|
this.logger.error("Not implemented yet.");
|
||||||
|
|
||||||
|
return [
|
||||||
|
{ topic: "Fluent", payload: { inlet: 0, F: null, C: null } }, // Effluent
|
||||||
|
{ topic: "Fluent", payload: { inlet: 1, F: null, C: null } }, // Sludge sink
|
||||||
|
{ topic: "Fluent", payload: { inlet: 2, F: null, C: null } } // Sludge recirculation
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user