Changed to new valve code

This commit is contained in:
2025-11-11 13:50:57 +01:00
parent e69825a48e
commit c331ba860e
3 changed files with 8 additions and 12 deletions

View File

@@ -254,6 +254,7 @@ class nodeClass {
const childId = msg.payload;
const childObj = this.RED.nodes.getNode(childId);
v.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
v.logger.info("CHECK THIS CHILD____________", childObj);
break;
case 'setMode':
v.setMode(msg.payload);

View File

@@ -90,7 +90,7 @@ class Valve {
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
this.vCurve = this.curve[1.204]; // specificy the desired density RECALC THIS AUTOMTICALLY BASED ON DENSITY OF AIR LATER OLIFANT!!
this.predictKv = new predict({curve:this.vCurve}); // load valve size (x : ctrl , y : kv relationship)
//this.logger.debug(`PredictKv initialized with curve: ${JSON.stringify(this.predictKv)}`);
this.logger.debug(`PredictKv initialized with curve: ${JSON.stringify(this.predictKv)}`);
}
// -------- Config -------- //
@@ -288,7 +288,9 @@ class Valve {
switch (variant) {
case ("measured"):
// put value in measurements container
this.logger.info('---------------------- updating measured flow ------------------ ');
this.measurements.type("flow").variant("measured").position(position).value(value);
this.logger.info('---------------------- updating measured flow finished ------------------ ');
// get latest downstream pressure measurement
const measuredDownStreamP = this.measurements.type("pressure").variant("measured").position("downstream").getCurrentValue(); //update downstream pressure measurement
// update predicted flow measurement
@@ -297,7 +299,9 @@ class Valve {
case ("predicted"):
// put value in measurements container
this.logger.info('---------------------- updating predicted flow ------------------ ');
this.measurements.type("flow").variant("predicted").position(position).value(value);
this.logger.info('---------------------- updating predicted flow finished ------------------ ');
const predictedDownStreamP = this.measurements.type("pressure").variant("measured").position("downstream").getCurrentValue(); //update downstream pressure measurement
this.updateDeltaPKlep(value,this.kv,predictedDownStreamP,this.rho,this.T); //update deltaP based on new flow
break;

View File

@@ -1,20 +1,11 @@
<!--
| S88-niveau | Primair (blokkleur) | Tekstkleur |
| ---------------------- | ------------------- | ---------- |
| **Area** | `#0f52a5` | wit |
| **Process Cell** | `#0c99d9` | wit |
| **Unit** | `#50a8d9` | zwart |
| **Equipment (Module)** | `#86bbdd` | zwart |
| **Control Module** | `#a9daee` | zwart |
-->
<script src="/valve/menu.js"></script> <!-- Load the menu script for dynamic dropdowns -->
<script src="/valve/configData.js"></script> <!-- Load the config script for node information -->
<script>
RED.nodes.registerType("valve", {
category: "EVOLV",
color: "#86bbdd", // color for the node based on the S88 schema
color: "#e4a363", // color for the node based on the S88 schema
defaults: {
// Define default properties
@@ -49,7 +40,7 @@
outputs: 3,
inputLabels: ["Input"],
outputLabels: ["process", "dbase", "parent"],
icon: "font-awesome/fa-toggle-on",
icon: "font-awesome/fa-tachometer",
label: function () {
return this.positionIcon + " " + this.category.slice(0, -1) || "Valve";