forked from RnD/EVOLV
updates
This commit is contained in:
@@ -57,11 +57,11 @@
|
|||||||
waitForMenuData();
|
waitForMenuData();
|
||||||
|
|
||||||
// your existing project‐settings & asset dropdown logic can remain here
|
// your existing project‐settings & asset dropdown logic can remain here
|
||||||
document.getElementById("node-input-speed"),
|
document.getElementById("node-input-speed");
|
||||||
document.getElementById("node-input-startup"),
|
document.getElementById("node-input-startup");
|
||||||
document.getElementById("node-input-warmup"),
|
document.getElementById("node-input-warmup");
|
||||||
document.getElementById("node-input-shutdown"),
|
document.getElementById("node-input-shutdown");
|
||||||
document.getElementById("node-input-cooldown")
|
document.getElementById("node-input-cooldown");
|
||||||
|
|
||||||
},
|
},
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class nodeClass {
|
|||||||
// Load default & UI config
|
// Load default & UI config
|
||||||
this._loadConfig(uiConfig,this.node);
|
this._loadConfig(uiConfig,this.node);
|
||||||
|
|
||||||
// Instantiate core Measurement class
|
// Instantiate core class
|
||||||
this._setupSpecificClass(uiConfig);
|
this._setupSpecificClass(uiConfig);
|
||||||
|
|
||||||
// Wire up event and lifecycle handlers
|
// 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
|
* Bind events to Node-RED status updates. Using internal emitter. --> REMOVE LATER WE NEED ONLY COMPLETE CHILDS AND THEN CHECK FOR UPDATES
|
||||||
*/
|
*/
|
||||||
_bindEvents() {
|
_bindEvents() {
|
||||||
this.source.emitter.on('mAbs', (val) => {
|
|
||||||
this.node.status({ fill: 'green', shape: 'dot', text: `${val} ${this.config.general.unit}` });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateNodeStatus() {
|
_updateNodeStatus() {
|
||||||
@@ -205,7 +203,7 @@ class nodeClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the periodic tick loop to drive the Measurement class.
|
* Start the periodic tick loop.
|
||||||
*/
|
*/
|
||||||
_startTickLoop() {
|
_startTickLoop() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -268,9 +266,9 @@ class nodeClass {
|
|||||||
const { source: esSource, action: esAction } = msg.payload;
|
const { source: esSource, action: esAction } = msg.payload;
|
||||||
m.handleInput(esSource, esAction);
|
m.handleInput(esSource, esAction);
|
||||||
break;
|
break;
|
||||||
case 'showCompleteCurve':
|
case 'showWorkingCurves':
|
||||||
m.showCompleteCurve();
|
m.showWorkingCurves();
|
||||||
send({ topic : "Showing curve" , payload: m.showCompleteCurve() });
|
send({ topic : "Showing curve" , payload: m.showWorkingCurves() });
|
||||||
break;
|
break;
|
||||||
case 'CoG':
|
case 'CoG':
|
||||||
m.showCoG();
|
m.showCoG();
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Machine {
|
|||||||
this.model = machineConfig.asset.model; // Get the model from the machineConfig
|
this.model = machineConfig.asset.model; // Get the model from the machineConfig
|
||||||
this.curve = this.model ? loadCurve(this.model) : null;
|
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);
|
this.config = this.configUtils.initConfig(machineConfig);
|
||||||
|
|
||||||
if (!this.model || !this.curve) {
|
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.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.state = new state(stateConfig, this.logger); // Init State manager and pass logger
|
||||||
this.errorMetrics = new nrmse(errorMetricsConfig, this.logger);
|
this.errorMetrics = new nrmse(errorMetricsConfig, this.logger);
|
||||||
|
|
||||||
@@ -111,8 +109,6 @@ class Machine {
|
|||||||
this.updatePosition();
|
this.updatePosition();
|
||||||
});
|
});
|
||||||
|
|
||||||
//this.calcCog();
|
|
||||||
|
|
||||||
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
|
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -204,7 +200,7 @@ class Machine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setMode(newMode) {
|
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)) {
|
if (!availableModes.includes(newMode)) {
|
||||||
this.logger.warn(`Invalid mode '${newMode}'. Allowed modes are: ${availableModes.join(', ')}`);
|
this.logger.warn(`Invalid mode '${newMode}'. Allowed modes are: ${availableModes.join(', ')}`);
|
||||||
return;
|
return;
|
||||||
@@ -549,6 +545,23 @@ class Machine {
|
|||||||
return distance;
|
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
|
// Calculate the center of gravity for current pressure
|
||||||
calcCog() {
|
calcCog() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user