Compare commits

...

3 Commits

4 changed files with 17 additions and 141 deletions

119
package-lock.json generated
View File

@@ -1,119 +0,0 @@
{
"name": "settler",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "settler",
"version": "0.0.1",
"license": "SEE LICENSE",
"dependencies": {
"generalFunctions": "git+https://gitea.centraal.wbd-rd.nl/RnD/generalFunctions.git",
"mathjs": "^14.5.2"
}
},
"node_modules/@babel/runtime": {
"version": "7.28.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz",
"integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/complex.js": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.2.tgz",
"integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==",
"license": "MIT",
"engines": {
"node": "*"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/rawify"
}
},
"node_modules/decimal.js": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
"integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
"license": "MIT"
},
"node_modules/escape-latex": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz",
"integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==",
"license": "MIT"
},
"node_modules/fraction.js": {
"version": "5.3.4",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz",
"integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==",
"license": "MIT",
"engines": {
"node": "*"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/rawify"
}
},
"node_modules/generalFunctions": {
"version": "1.0.0",
"resolved": "git+https://gitea.centraal.wbd-rd.nl/RnD/generalFunctions.git#9b7a8ae2c8ae149f48608e2fa5a180b486700978",
"license": "SEE LICENSE"
},
"node_modules/javascript-natural-sort": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
"integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==",
"license": "MIT"
},
"node_modules/mathjs": {
"version": "14.9.1",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-14.9.1.tgz",
"integrity": "sha512-xhqv8Xjf+caWG3WlaPekg4v8QFOR3D5+8ycfcjMcPcnCNDgAONQLaLfyGgrggJrcHx2yUGCpACRpiD4GmXwX+Q==",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.26.10",
"complex.js": "^2.2.5",
"decimal.js": "^10.4.3",
"escape-latex": "^1.2.0",
"fraction.js": "^5.2.1",
"javascript-natural-sort": "^0.7.1",
"seedrandom": "^3.0.5",
"tiny-emitter": "^2.1.0",
"typed-function": "^4.2.1"
},
"bin": {
"mathjs": "bin/cli.js"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/seedrandom": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz",
"integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==",
"license": "MIT"
},
"node_modules/tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
"license": "MIT"
},
"node_modules/typed-function": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz",
"integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==",
"license": "MIT",
"engines": {
"node": ">= 18"
}
}
}
}

View File

@@ -4,7 +4,7 @@
"description": "Sludge settler model for Node-Red",
"repository": {
"type": "git",
"url": "https://gitea.centraal.wbd-rd.nl/p.vanderwilt/settler.git"
"url": "https://gitea.centraal.wbd-rd.nl/RnD/settler.git"
},
"keywords": [
"settler",

View File

@@ -2,12 +2,15 @@
<script type="text/javascript">
RED.nodes.registerType("settler", {
category: "WWTP",
category: "EVOLV",
color: "#e4a363",
defaults: {
name: { value: "" },
TS_set: { value: 0.1, required: true },
inlet: { value: 1, required: true }
enableLog: { value: false },
logLevel: { value: "error" },
positionVsParent: { value: "" }
},
inputs: 1,
outputs: 3,

View File

@@ -60,6 +60,11 @@ class Settler {
}
registerChild(child, softwareType) {
if(!child) {
this.logger.error(`Invalid ${softwareType} child provided.`);
return;
}
switch (softwareType) {
case "measurement":
this.logger.debug(`Registering measurement child...`);
@@ -80,11 +85,6 @@ class Settler {
}
_connectMeasurement(measurementChild) {
if (!measurementChild) {
this.logger.error("Invalid measurement provided.");
return;
}
const position = measurementChild.config.functionality.positionVsParent;
const measurementType = measurementChild.config.asset.type;
const eventName = `${measurementType}.measured.${position}`;
@@ -105,11 +105,6 @@ class Settler {
}
_connectReactor(reactorChild) {
if (!reactorChild) {
this.logger.error("Invalid reactor provided.");
return;
}
if (reactorChild.config.functionality.positionVsParent != "upstream") {
this.logger.warn("Reactor children of settlers should be upstream.");
}
@@ -125,20 +120,17 @@ class Settler {
}
_connectMachine(machineChild) {
if (!machineChild) {
this.logger.error("Invalid rotating machine provided.");
if (machineChild.config.functionality.positionVsParent == "downstream") {
machineChild.upstreamSource = this;
this.returnPump = machineChild;
return;
}
if (machineChild.config.functionality.positionVsParent == "downstream") {
machineChild.upstreamReactor = this;
this.returnPump = machineChild;
}
this.logger.warn(`Failed to register machine child.`);
}
_updateMeasurement(measurementType, value, position, context) {
switch(measurementType) {
case "quantity (TSS)":
case "quantity (tss)":
this.C_TS = value;
break;