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 },
|
cooldown: { value: 0 },
|
||||||
movementMode : { value: "staticspeed" }, // static or dynamic
|
movementMode : { value: "staticspeed" }, // static or dynamic
|
||||||
machineCurve : { value: {}},
|
machineCurve : { value: {}},
|
||||||
|
processOutputFormat: { value: "process" },
|
||||||
|
dbaseOutputFormat: { value: "influxdb" },
|
||||||
|
|
||||||
//define asset properties
|
//define asset properties
|
||||||
uuid: { value: "" },
|
uuid: { value: "" },
|
||||||
@@ -148,6 +150,24 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</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 -->
|
<!-- Asset fields injected here -->
|
||||||
<div id="asset-fields-placeholder"></div>
|
<div id="asset-fields-placeholder"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class nodeClass {
|
|||||||
* @param {object} uiConfig - Raw config from Node-RED UI.
|
* @param {object} uiConfig - Raw config from Node-RED UI.
|
||||||
*/
|
*/
|
||||||
_loadConfig(uiConfig,node) {
|
_loadConfig(uiConfig,node) {
|
||||||
|
const cfgMgr = new configManager();
|
||||||
const resolvedAssetUuid = uiConfig.assetUuid || uiConfig.uuid || null;
|
const resolvedAssetUuid = uiConfig.assetUuid || uiConfig.uuid || null;
|
||||||
const resolvedAssetTagCode = uiConfig.assetTagCode || uiConfig.assetTagNumber || null;
|
const resolvedAssetTagCode = uiConfig.assetTagCode || uiConfig.assetTagNumber || null;
|
||||||
const flowUnit = this._resolveUnitOrFallback(uiConfig.unit, 'volumeFlowRate', 'm3/h', 'flow');
|
const flowUnit = this._resolveUnitOrFallback(uiConfig.unit, 'volumeFlowRate', 'm3/h', 'flow');
|
||||||
@@ -52,33 +53,24 @@ class nodeClass {
|
|||||||
control: this._resolveControlUnitOrFallback(uiConfig.curveControlUnit, '%'),
|
control: this._resolveControlUnitOrFallback(uiConfig.curveControlUnit, '%'),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Merge UI config over defaults
|
// Build config: base sections + rotatingMachine-specific domain config
|
||||||
this.config = {
|
this.config = cfgMgr.buildConfig(this.name, uiConfig, node.id, {
|
||||||
general: {
|
flowNumber: uiConfig.flowNumber
|
||||||
name: this.name,
|
});
|
||||||
id: node.id, // node.id is for the child registration process
|
|
||||||
unit: flowUnit,
|
// Override asset with rotatingMachine-specific fields
|
||||||
logging: {
|
this.config.asset = {
|
||||||
enabled: uiConfig.enableLog,
|
...this.config.asset,
|
||||||
logLevel: uiConfig.logLevel
|
uuid: resolvedAssetUuid,
|
||||||
}
|
tagCode: resolvedAssetTagCode,
|
||||||
},
|
tagNumber: uiConfig.assetTagNumber || null,
|
||||||
asset: {
|
unit: flowUnit,
|
||||||
uuid: resolvedAssetUuid, // support both legacy and current editor field names
|
curveUnits
|
||||||
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
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ensure general unit uses resolved flow unit
|
||||||
|
this.config.general.unit = flowUnit;
|
||||||
|
|
||||||
// Utility for formatting outputs
|
// Utility for formatting outputs
|
||||||
this._output = new outputUtils();
|
this._output = new outputUtils();
|
||||||
}
|
}
|
||||||
@@ -253,7 +245,7 @@ class nodeClass {
|
|||||||
this.node.send([
|
this.node.send([
|
||||||
null,
|
null,
|
||||||
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);
|
}, 100);
|
||||||
}
|
}
|
||||||
@@ -299,7 +291,7 @@ class nodeClass {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
switch(msg.topic) {
|
switch(msg.topic) {
|
||||||
case 'registerChild':
|
case 'registerChild': {
|
||||||
// Register this node as a child of the parent node
|
// Register this node as a child of the parent node
|
||||||
const childId = msg.payload;
|
const childId = msg.payload;
|
||||||
const childObj = this.RED.nodes.getNode(childId);
|
const childObj = this.RED.nodes.getNode(childId);
|
||||||
@@ -309,26 +301,30 @@ class nodeClass {
|
|||||||
}
|
}
|
||||||
m.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
m.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'setMode':
|
case 'setMode':
|
||||||
m.setMode(msg.payload);
|
m.setMode(msg.payload);
|
||||||
break;
|
break;
|
||||||
case 'execSequence':
|
case 'execSequence': {
|
||||||
const { source, action, parameter } = msg.payload;
|
const { source, action, parameter } = msg.payload;
|
||||||
m.handleInput(source, action, parameter);
|
m.handleInput(source, action, parameter);
|
||||||
break;
|
break;
|
||||||
case 'execMovement':
|
}
|
||||||
|
case 'execMovement': {
|
||||||
const { source: mvSource, action: mvAction, setpoint } = msg.payload;
|
const { source: mvSource, action: mvAction, setpoint } = msg.payload;
|
||||||
m.handleInput(mvSource, mvAction, Number(setpoint));
|
m.handleInput(mvSource, mvAction, Number(setpoint));
|
||||||
break;
|
break;
|
||||||
case 'flowMovement':
|
}
|
||||||
|
case 'flowMovement': {
|
||||||
const { source: fmSource, action: fmAction, setpoint: fmSetpoint } = msg.payload;
|
const { source: fmSource, action: fmAction, setpoint: fmSetpoint } = msg.payload;
|
||||||
m.handleInput(fmSource, fmAction, Number(fmSetpoint));
|
m.handleInput(fmSource, fmAction, Number(fmSetpoint));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'emergencystop':
|
}
|
||||||
|
case 'emergencystop': {
|
||||||
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 'simulateMeasurement':
|
case 'simulateMeasurement':
|
||||||
{
|
{
|
||||||
const payload = msg.payload || {};
|
const payload = msg.payload || {};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const EventEmitter = require('events');
|
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({
|
const CANONICAL_UNITS = Object.freeze({
|
||||||
pressure: 'Pa',
|
pressure: 'Pa',
|
||||||
|
|||||||
Reference in New Issue
Block a user