updates to rotating machine struct

This commit is contained in:
znetsixe
2026-02-12 10:48:44 +01:00
parent c63701db38
commit 405be33626
15 changed files with 1978 additions and 7 deletions

View File

@@ -118,7 +118,7 @@ class nodeClass {
const mode = m.currentMode;
const state = m.state.getCurrentState();
const flow = Math.round(m.measurements.type("flow").variant("predicted").position('downstream').getCurrentValue('m3/h'));
const power = Math.round(m.measurements.type("power").variant("predicted").position('atequipment').getCurrentValue('kW'));
const power = Math.round(m.measurements.type("power").variant("predicted").position('atEquipment').getCurrentValue('kW'));
let symbolState;
switch(state){
case "off":
@@ -189,7 +189,7 @@ class nodeClass {
}
return status;
} catch (error) {
node.error("Error in updateNodeStatus: " + error.message);
this.node.error("Error in updateNodeStatus: " + error.message);
return { fill: "red", shape: "ring", text: "Status Error" };
}
}
@@ -271,6 +271,40 @@ class nodeClass {
const { source: esSource, action: esAction } = msg.payload;
m.handleInput(esSource, esAction);
break;
case 'simulateMeasurement':
{
const payload = msg.payload || {};
const type = String(payload.type || '').toLowerCase();
const position = payload.position || 'atEquipment';
const value = Number(payload.value);
const unit = payload.unit;
const context = {
timestamp: payload.timestamp || Date.now(),
unit,
childName: 'dashboard-sim',
childId: 'dashboard-sim',
};
if (!Number.isFinite(value)) {
this.node.warn('simulateMeasurement payload.value must be a finite number');
break;
}
switch (type) {
case 'pressure':
m.updateMeasuredPressure(value, position, context);
break;
case 'flow':
m.updateMeasuredFlow(value, position, context);
break;
case 'temperature':
m.updateMeasuredTemperature(value, position, context);
break;
default:
this.node.warn(`Unsupported simulateMeasurement type: ${type}`);
}
}
break;
case 'showWorkingCurves':
m.showWorkingCurves();
send({ topic : "Showing curve" , payload: m.showWorkingCurves() });