Compare commits
19 Commits
dev-Rene
...
ea33b3bba3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea33b3bba3 | ||
|
|
f363ee53ef | ||
|
|
4cf46f33c9 | ||
|
|
7b9fdd7342 | ||
|
|
bb986c2dc8 | ||
|
|
46dd2ca37a | ||
|
|
ccfa90394b | ||
|
|
e236cccfd6 | ||
|
|
99b45c87e4 | ||
|
|
0a98b12224 | ||
|
|
b6d268659a | ||
|
|
303dfc477d | ||
|
|
ac40a93ef1 | ||
|
|
a8fb56bfb8 | ||
|
|
d7cc6a4a8b | ||
|
|
37e6523c55 | ||
| 5a14f44fdd | |||
|
|
c081acae4e | ||
| 08185243bc |
@@ -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 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<h3>Output Formats</h3>
|
||||
<div class="form-row">
|
||||
<label for="node-input-processOutputFormat"><i class="fa fa-random"></i> Process Output</label>
|
||||
<select id="node-input-processOutputFormat" style="width:60%;">
|
||||
<option value="process">process</option>
|
||||
<option value="json">json</option>
|
||||
<option value="csv">csv</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-dbaseOutputFormat"><i class="fa fa-database"></i> Database Output</label>
|
||||
<select id="node-input-dbaseOutputFormat" style="width:60%;">
|
||||
<option value="influxdb">influxdb</option>
|
||||
<option value="json">json</option>
|
||||
<option value="csv">csv</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Asset fields injected here -->
|
||||
<div id="asset-fields-placeholder"></div>
|
||||
|
||||
|
||||
@@ -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,26 +301,30 @@ 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;
|
||||
}
|
||||
case 'simulateMeasurement':
|
||||
{
|
||||
const payload = msg.payload || {};
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user