diff --git a/rotatingMachine.html b/rotatingMachine.html
index 97620fa..10fbc90 100644
--- a/rotatingMachine.html
+++ b/rotatingMachine.html
@@ -26,6 +26,8 @@
cooldown: { value: 0 },
movementMode : { value: "staticspeed" }, // static or dynamic
machineCurve : { value: {}},
+ processOutputFormat: { value: "process" },
+ dbaseOutputFormat: { value: "influxdb" },
//define asset properties
uuid: { value: "" },
@@ -148,6 +150,24 @@
+
Output Formats
+
+
+
+
+
+
+
+
+
diff --git a/src/nodeClass.js b/src/nodeClass.js
index 324d51a..f6885c7 100644
--- a/src/nodeClass.js
+++ b/src/nodeClass.js
@@ -42,6 +42,7 @@ class nodeClass {
* @param {object} uiConfig - Raw config from Node-RED UI.
*/
_loadConfig(uiConfig,node) {
+ const cfgMgr = new configManager();
const resolvedAssetUuid = uiConfig.assetUuid || uiConfig.uuid || null;
const resolvedAssetTagCode = uiConfig.assetTagCode || uiConfig.assetTagNumber || null;
const flowUnit = this._resolveUnitOrFallback(uiConfig.unit, 'volumeFlowRate', 'm3/h', 'flow');
@@ -52,33 +53,24 @@ class nodeClass {
control: this._resolveControlUnitOrFallback(uiConfig.curveControlUnit, '%'),
};
- // Merge UI config over defaults
- this.config = {
- general: {
- name: this.name,
- id: node.id, // node.id is for the child registration process
- unit: flowUnit,
- logging: {
- enabled: uiConfig.enableLog,
- logLevel: uiConfig.logLevel
- }
- },
- asset: {
- uuid: resolvedAssetUuid, // support both legacy and current editor field names
- tagCode: resolvedAssetTagCode, // support both legacy and current editor field names
- tagNumber: uiConfig.assetTagNumber || null,
- supplier: uiConfig.supplier,
- category: uiConfig.category, //add later to define as the software type
- type: uiConfig.assetType,
- model: uiConfig.model,
- unit: flowUnit,
- curveUnits
- },
- functionality: {
- positionVsParent: uiConfig.positionVsParent
- }
+ // Build config: base sections + rotatingMachine-specific domain config
+ this.config = cfgMgr.buildConfig(this.name, uiConfig, node.id, {
+ flowNumber: uiConfig.flowNumber
+ });
+
+ // Override asset with rotatingMachine-specific fields
+ this.config.asset = {
+ ...this.config.asset,
+ uuid: resolvedAssetUuid,
+ tagCode: resolvedAssetTagCode,
+ tagNumber: uiConfig.assetTagNumber || null,
+ unit: flowUnit,
+ curveUnits
};
+ // Ensure general unit uses resolved flow unit
+ this.config.general.unit = flowUnit;
+
// Utility for formatting outputs
this._output = new outputUtils();
}
@@ -253,7 +245,7 @@ class nodeClass {
this.node.send([
null,
null,
- { topic: 'registerChild', payload: this.config.general.id, positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' },
+ { topic: 'registerChild', payload: this.node.id, positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' },
]);
}, 100);
}
@@ -299,7 +291,7 @@ class nodeClass {
try {
switch(msg.topic) {
- case 'registerChild':
+ case 'registerChild': {
// Register this node as a child of the parent node
const childId = msg.payload;
const childObj = this.RED.nodes.getNode(childId);
@@ -309,23 +301,26 @@ class nodeClass {
}
m.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
break;
+ }
case 'setMode':
m.setMode(msg.payload);
break;
- case 'execSequence':
+ case 'execSequence': {
const { source, action, parameter } = msg.payload;
m.handleInput(source, action, parameter);
break;
- case 'execMovement':
+ }
+ case 'execMovement': {
const { source: mvSource, action: mvAction, setpoint } = msg.payload;
m.handleInput(mvSource, mvAction, Number(setpoint));
break;
- case 'flowMovement':
+ }
+ case 'flowMovement': {
const { source: fmSource, action: fmAction, setpoint: fmSetpoint } = msg.payload;
m.handleInput(fmSource, fmAction, Number(fmSetpoint));
-
break;
- case 'emergencystop':
+ }
+ case 'emergencystop': {
const { source: esSource, action: esAction } = msg.payload;
m.handleInput(esSource, esAction);
break;
diff --git a/src/specificClass.js b/src/specificClass.js
index 6356756..7dd9b4e 100644
--- a/src/specificClass.js
+++ b/src/specificClass.js
@@ -1,5 +1,5 @@
const EventEmitter = require('events');
-const {loadCurve,gravity,logger,configUtils,configManager,state, nrmse, MeasurementContainer, predict, interpolation , childRegistrationUtils,coolprop, convert} = require('generalFunctions');
+const {loadCurve,gravity,logger,configUtils,configManager,state, nrmse, MeasurementContainer, predict, interpolation , childRegistrationUtils,coolprop, convert, POSITIONS} = require('generalFunctions');
const CANONICAL_UNITS = Object.freeze({
pressure: 'Pa',