Changed names
This commit is contained in:
12
package.json
12
package.json
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "basin",
|
||||
"name": "pumpingStation",
|
||||
"version": "1.0.0",
|
||||
"description": "Control module",
|
||||
"main": "basin.js",
|
||||
"main": "pumpingStation.js",
|
||||
"scripts": {
|
||||
"test": "node basin.js"
|
||||
"test": "node pumpingStation.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.centraal.wbd-rd.nl/RnD/basin.git"
|
||||
"url": "https://gitea.centraal.wbd-rd.nl/RnD/pumpingStation.git"
|
||||
},
|
||||
"keywords": [
|
||||
"basin",
|
||||
"pumpingStation",
|
||||
"node-red",
|
||||
"recipient",
|
||||
"water"
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"node-red": {
|
||||
"nodes": {
|
||||
"basin": "basin.js"
|
||||
"pumpingStation": "pumpingStation.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
|
||||
<script src="/measurement/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/menu.js"></script> <!-- Load the menu script for dynamic dropdowns -->
|
||||
<script src="/pumpingStation/configData.js"></script> <!-- Load the config script for node information -->
|
||||
|
||||
<script>//test
|
||||
RED.nodes.registerType("measurement", {
|
||||
RED.nodes.registerType("pumpingStation", {
|
||||
category: "EVOLV",
|
||||
color: "#e4a363", // color for the node based on the S88 schema
|
||||
defaults: {
|
||||
|
||||
// Define default properties
|
||||
name: { value: "sensor" }, // use asset category as name
|
||||
|
||||
// Define specific properties
|
||||
scaling: { value: false },
|
||||
i_min: { value: 0, required: true },
|
||||
@@ -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 { 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)
|
||||
RED.httpAdmin.get(`/${nameOfNode}/menu.js`, (req, res) => {
|
||||
try {
|
||||
const script = menuMgr.createEndpoint(nameOfNode, ['logger']);
|
||||
const script = menuMgr.createEndpoint(nameOfNode, ['logger','position']);
|
||||
res.type('application/javascript').send(script);
|
||||
} catch (err) {
|
||||
res.status(500).send(`// Error generating menu: ${err.message}`);
|
||||
@@ -109,7 +109,7 @@ class nodeClass {
|
||||
* Execute a single tick: update measurement, format and send outputs.
|
||||
*/
|
||||
_tick() {
|
||||
this.source.tick();
|
||||
//this.source.tick();
|
||||
|
||||
const raw = this.source.getOutput();
|
||||
const processMsg = this._output.formatMsg(raw, this.config, 'process');
|
||||
@@ -125,14 +125,14 @@ class nodeClass {
|
||||
_attachInputHandler() {
|
||||
this.node.on('input', (msg, send, done) => {
|
||||
switch (msg.topic) {
|
||||
case 'simulator': this.source.toggleSimulation(); break;
|
||||
case 'outlierDetection': this.source.toggleOutlierDetection(); break;
|
||||
case 'calibrate': this.source.calibrate(); break;
|
||||
case 'measurement':
|
||||
if (typeof msg.payload === 'number') {
|
||||
this.source.inputValue = parseFloat(msg.payload);
|
||||
}
|
||||
//example
|
||||
/*case 'simulator':
|
||||
this.source.toggleSimulation();
|
||||
break;
|
||||
default:
|
||||
this.source.handleInput(msg);
|
||||
break;
|
||||
*/
|
||||
}
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const EventEmitter = require('events');
|
||||
const {logger,configUtils,configManager,MeasurementContainer,coolprop} = require('generalFunctions');
|
||||
|
||||
class Basin {
|
||||
class pumpingStation {
|
||||
constructor(config={}) {
|
||||
|
||||
this.emitter = new EventEmitter(); // Own EventEmitter
|
||||
this.configManager = new configManager();
|
||||
this.defaultConfig = this.configManager.getConfig('basin');
|
||||
this.defaultConfig = this.configManager.getConfig('pumpingStation');
|
||||
this.configUtils = new configUtils(this.defaultConfig);
|
||||
this.config = this.configUtils.initConfig(config);
|
||||
|
||||
@@ -19,7 +19,7 @@ class Basin {
|
||||
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.timeBeforeOverflow = null; // Time before the basin overflows at current inflow 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
|
||||
}
|
||||
|
||||
measurement
|
||||
|
||||
getOutput() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user