This commit is contained in:
znetsixe
2025-07-24 13:15:33 +02:00
parent 3fc8dbefe8
commit fa7c59fcab
3 changed files with 30 additions and 19 deletions

View File

@@ -57,11 +57,11 @@
waitForMenuData();
// your existing projectsettings & asset dropdown logic can remain here
document.getElementById("node-input-speed"),
document.getElementById("node-input-startup"),
document.getElementById("node-input-warmup"),
document.getElementById("node-input-shutdown"),
document.getElementById("node-input-cooldown")
document.getElementById("node-input-speed");
document.getElementById("node-input-startup");
document.getElementById("node-input-warmup");
document.getElementById("node-input-shutdown");
document.getElementById("node-input-cooldown");
},
oneditsave: function() {

View File

@@ -25,7 +25,7 @@ class nodeClass {
// Load default & UI config
this._loadConfig(uiConfig,this.node);
// Instantiate core Measurement class
// Instantiate core class
this._setupSpecificClass(uiConfig);
// Wire up event and lifecycle handlers
@@ -107,9 +107,7 @@ class nodeClass {
* Bind events to Node-RED status updates. Using internal emitter. --> REMOVE LATER WE NEED ONLY COMPLETE CHILDS AND THEN CHECK FOR UPDATES
*/
_bindEvents() {
this.source.emitter.on('mAbs', (val) => {
this.node.status({ fill: 'green', shape: 'dot', text: `${val} ${this.config.general.unit}` });
});
}
_updateNodeStatus() {
@@ -205,7 +203,7 @@ class nodeClass {
}
/**
* Start the periodic tick loop to drive the Measurement class.
* Start the periodic tick loop.
*/
_startTickLoop() {
setTimeout(() => {
@@ -268,9 +266,9 @@ class nodeClass {
const { source: esSource, action: esAction } = msg.payload;
m.handleInput(esSource, esAction);
break;
case 'showCompleteCurve':
m.showCompleteCurve();
send({ topic : "Showing curve" , payload: m.showCompleteCurve() });
case 'showWorkingCurves':
m.showWorkingCurves();
send({ topic : "Showing curve" , payload: m.showWorkingCurves() });
break;
case 'CoG':
m.showCoG();

View File

@@ -63,7 +63,7 @@ class Machine {
this.model = machineConfig.asset.model; // Get the model from the machineConfig
this.curve = this.model ? loadCurve(this.model) : null;
//Always initialize config first
//Init config and check if it is valid
this.config = this.configUtils.initConfig(machineConfig);
if (!this.model || !this.curve) {
@@ -85,8 +85,6 @@ class Machine {
this.predictCtrl = new predict({ curve: this.reverseCurve(this.config.asset.machineCurve.nq) }); // load reversed nq (x: flow, y: ctrl relationship)
}
this.state = new state(stateConfig, this.logger); // Init State manager and pass logger
this.errorMetrics = new nrmse(errorMetricsConfig, this.logger);
@@ -111,8 +109,6 @@ class Machine {
this.updatePosition();
});
//this.calcCog();
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
}
@@ -204,7 +200,7 @@ class Machine {
}
setMode(newMode) {
const availableModes = defaultConfig.mode.current.rules.values.map(v => v.value);
const availableModes = this.defaultConfig.mode.current.rules.values.map(v => v.value);
if (!availableModes.includes(newMode)) {
this.logger.warn(`Invalid mode '${newMode}'. Allowed modes are: ${availableModes.join(', ')}`);
return;
@@ -549,6 +545,23 @@ class Machine {
return distance;
}
showWorkingCurves() {
// Show the current curves for debugging
const { powerCurve, flowCurve } = this.getCurrentCurves();
return {
powerCurve: powerCurve,
flowCurve: flowCurve,
cog: this.cog,
cogIndex: this.cogIndex,
NCog: this.NCog,
minEfficiency: this.minEfficiency,
currentEfficiencyCurve: this.currentEfficiencyCurve,
absDistFromPeak: this.absDistFromPeak,
relDistFromPeak: this.relDistFromPeak
};
}
// Calculate the center of gravity for current pressure
calcCog() {