Merge commit 'f7c3dc2' into HEAD

# Conflicts:
#	src/nodeClass.js
This commit is contained in:
znetsixe
2026-03-31 18:11:37 +02:00
4 changed files with 476 additions and 28 deletions

View File

@@ -39,33 +39,16 @@ class nodeClass {
/**
* Load and merge default config with user-defined settings.
* Uses ConfigManager.buildConfig() for base sections (general, asset, functionality),
* then adds measurement-specific domain config.
* @param {object} uiConfig - Raw config from Node-RED UI.
*/
_loadConfig(uiConfig,node) {
const cfgMgr = new configManager();
this.defaultConfig = cfgMgr.getConfig(this.name);
// Merge UI config over defaults
this.config = {
general: {
name: this.name,
id: node.id, // node.id is for the child registration process
unit: uiConfig.unit, // add converter options later to convert to default units (need like a model that defines this which units we are going to use and then conver to those standards)
logging: {
enabled: uiConfig.enableLog,
logLevel: uiConfig.logLevel
}
},
asset: {
uuid: uiConfig.assetUuid, //need to add this later to the asset model
tagCode: uiConfig.assetTagCode, //need to add this later to the asset model
tagNumber: uiConfig.assetTagNumber,
supplier: uiConfig.supplier,
category: uiConfig.category, //add later to define as the software type
type: uiConfig.assetType,
model: uiConfig.model,
unit: uiConfig.unit
},
// Build config: base sections + measurement-specific domain config
this.config = cfgMgr.buildConfig(this.name, uiConfig, node.id, {
scaling: {
enabled: uiConfig.scaling,
inputMin: uiConfig.i_min,
@@ -80,12 +63,8 @@ class nodeClass {
},
simulation: {
enabled: uiConfig.simulator
},
functionality: {
positionVsParent: uiConfig.positionVsParent,// Default to 'atEquipment' if not specified
distance: uiConfig.hasDistance ? uiConfig.distance : undefined
}
};
});
// Utility for formatting outputs
this._output = new outputUtils();

View File

@@ -385,7 +385,7 @@ class Measurement {
const lowPass = this.lowPassFilter(arr); // Apply low-pass filter
const highPass = this.highPassFilter(arr); // Apply high-pass filter
return arr.map((val, idx) => lowPass + highPass - val).pop(); // Combine the filters
return arr.map((val, _idx) => lowPass + highPass - val).pop(); // Combine the filters
}
weightedMovingAverage(arr) {
@@ -565,7 +565,7 @@ const configuration = {
enabled: true,
},
functionality: {
positionVsParent: "upstream"
positionVsParent: POSITIONS.UPSTREAM
}
};