Changed names

This commit is contained in:
znetsixe
2025-10-14 08:36:45 +02:00
parent 856477df57
commit fa30be5e2d
5 changed files with 22 additions and 26 deletions

View File

@@ -1,17 +1,17 @@
{ {
"name": "basin", "name": "pumpingStation",
"version": "1.0.0", "version": "1.0.0",
"description": "Control module", "description": "Control module",
"main": "basin.js", "main": "pumpingStation.js",
"scripts": { "scripts": {
"test": "node basin.js" "test": "node pumpingStation.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://gitea.centraal.wbd-rd.nl/RnD/basin.git" "url": "https://gitea.centraal.wbd-rd.nl/RnD/pumpingStation.git"
}, },
"keywords": [ "keywords": [
"basin", "pumpingStation",
"node-red", "node-red",
"recipient", "recipient",
"water" "water"
@@ -23,7 +23,7 @@
}, },
"node-red": { "node-red": {
"nodes": { "nodes": {
"basin": "basin.js" "pumpingStation": "pumpingStation.js"
} }
} }
} }

View File

@@ -1,16 +1,13 @@
<script src="/measurement/menu.js"></script> <!-- Load the menu script for dynamic dropdowns --> <script src="/pumpingStation/menu.js"></script> <!-- Load the menu script for dynamic dropdowns -->
<script src="/measurement/configData.js"></script> <!-- Load the config script for node information --> <script src="/pumpingStation/configData.js"></script> <!-- Load the config script for node information -->
<script>//test <script>//test
RED.nodes.registerType("measurement", { RED.nodes.registerType("pumpingStation", {
category: "EVOLV", category: "EVOLV",
color: "#e4a363", // color for the node based on the S88 schema color: "#e4a363", // color for the node based on the S88 schema
defaults: { defaults: {
// Define default properties
name: { value: "sensor" }, // use asset category as name
// Define specific properties // Define specific properties
scaling: { value: false }, scaling: { value: false },
i_min: { value: 0, required: true }, i_min: { value: 0, required: true },

View File

@@ -1,4 +1,4 @@
const nameOfNode = 'basin'; // this is the name of the node, it should match the file name and the node type in Node-RED const nameOfNode = 'pumpingStation'; // this is the name of the node, it should match the file name and the node type in Node-RED
const nodeClass = require('./src/nodeClass.js'); // this is the specific node class const nodeClass = require('./src/nodeClass.js'); // this is the specific node class
const { MenuManager, configManager } = require('generalFunctions'); const { MenuManager, configManager } = require('generalFunctions');
@@ -19,7 +19,7 @@ module.exports = function(RED) {
// Register the different menu's for the measurement node (in the future we could automate this further by refering to the config) // Register the different menu's for the measurement node (in the future we could automate this further by refering to the config)
RED.httpAdmin.get(`/${nameOfNode}/menu.js`, (req, res) => { RED.httpAdmin.get(`/${nameOfNode}/menu.js`, (req, res) => {
try { try {
const script = menuMgr.createEndpoint(nameOfNode, ['logger']); const script = menuMgr.createEndpoint(nameOfNode, ['logger','position']);
res.type('application/javascript').send(script); res.type('application/javascript').send(script);
} catch (err) { } catch (err) {
res.status(500).send(`// Error generating menu: ${err.message}`); res.status(500).send(`// Error generating menu: ${err.message}`);

View File

@@ -109,7 +109,7 @@ class nodeClass {
* Execute a single tick: update measurement, format and send outputs. * Execute a single tick: update measurement, format and send outputs.
*/ */
_tick() { _tick() {
this.source.tick(); //this.source.tick();
const raw = this.source.getOutput(); const raw = this.source.getOutput();
const processMsg = this._output.formatMsg(raw, this.config, 'process'); const processMsg = this._output.formatMsg(raw, this.config, 'process');
@@ -125,14 +125,14 @@ class nodeClass {
_attachInputHandler() { _attachInputHandler() {
this.node.on('input', (msg, send, done) => { this.node.on('input', (msg, send, done) => {
switch (msg.topic) { switch (msg.topic) {
case 'simulator': this.source.toggleSimulation(); break; //example
case 'outlierDetection': this.source.toggleOutlierDetection(); break; /*case 'simulator':
case 'calibrate': this.source.calibrate(); break; this.source.toggleSimulation();
case 'measurement':
if (typeof msg.payload === 'number') {
this.source.inputValue = parseFloat(msg.payload);
}
break; break;
default:
this.source.handleInput(msg);
break;
*/
} }
done(); done();
}); });

View File

@@ -1,12 +1,12 @@
const EventEmitter = require('events'); const EventEmitter = require('events');
const {logger,configUtils,configManager,MeasurementContainer,coolprop} = require('generalFunctions'); const {logger,configUtils,configManager,MeasurementContainer,coolprop} = require('generalFunctions');
class Basin { class pumpingStation {
constructor(config={}) { constructor(config={}) {
this.emitter = new EventEmitter(); // Own EventEmitter this.emitter = new EventEmitter(); // Own EventEmitter
this.configManager = new configManager(); this.configManager = new configManager();
this.defaultConfig = this.configManager.getConfig('basin'); this.defaultConfig = this.configManager.getConfig('pumpingStation');
this.configUtils = new configUtils(this.defaultConfig); this.configUtils = new configUtils(this.defaultConfig);
this.config = this.configUtils.initConfig(config); this.config = this.configUtils.initConfig(config);
@@ -19,7 +19,7 @@ class Basin {
windowSize: this.config.smoothing.smoothWindow windowSize: this.config.smoothing.smoothWindow
}); });
// Basin-specific properties // pumpingStation-specific properties
this.flowrate = null; // Function to calculate flow rate based on water level rise or fall this.flowrate = null; // Function to calculate flow rate based on water level rise or fall
this.timeBeforeOverflow = null; // Time before the basin overflows at current inflow rate this.timeBeforeOverflow = null; // Time before the basin overflows at current inflow rate
this.timeBeforeEmpty = null; // Time before the basin empties at current outflow rate this.timeBeforeEmpty = null; // Time before the basin empties at current outflow rate
@@ -131,7 +131,6 @@ class Basin {
this.crossSectionalArea = this.config.basin.crossSectionalArea || 1; // Default to 1 m² if not specified this.crossSectionalArea = this.config.basin.crossSectionalArea || 1; // Default to 1 m² if not specified
} }
measurement
getOutput() { getOutput() {
return { return {