diff --git a/src/configs/valveGroupControl.json b/src/configs/valveGroupControl.json new file mode 100644 index 0000000..1fd26a2 --- /dev/null +++ b/src/configs/valveGroupControl.json @@ -0,0 +1,371 @@ +{ + "general": { + "name": { + "default": "ValveGroupControl", + "rules": { + "type": "string", + "description": "A human-readable name or label for this valveGroupControl configuration." + } + }, + "id": { + "default": null, + "rules": { + "type": "string", + "nullable": true, + "description": "A unique identifier for this configuration. If not provided, defaults to null." + } + }, + "unit": { + "default": "unitless", + "rules": { + "type": "string", + "description": "The default measurement unit for this configuration (e.g., 'meters', 'seconds', 'unitless')." + } + }, + + + "logging": { + "logLevel": { + "default": "info", + "rules": { + "type": "enum", + "values": [ + { + "value": "debug", + "description": "Log messages are printed for debugging purposes." + }, + { + "value": "info", + "description": "Informational messages are printed." + }, + { + "value": "warn", + "description": "Warning messages are printed." + }, + { + "value": "error", + "description": "Error messages are printed." + } + ] + } + }, + "enabled": { + "default": true, + "rules": { + "type": "boolean", + "description": "Indicates whether logging is active. If true, log messages will be generated." + } + } + } + }, + "functionality": { + "softwareType": { + "default": "valveGroupControl", + "rules": { + "type": "string", + "description": "Specified software type for this configuration." + } + }, + "role": { + "default": "ValveGroupController", + "rules": { + "type": "string", + "description": "Indicates the role this configuration plays within the system." + } + } + }, + "asset": { + "uuid": { + "default": null, + "rules": { + "type": "string", + "nullable": true, + "description": "A universally unique identifier for this asset. May be null if not assigned." + } + }, + "geoLocation": { + "default": {}, + "rules": { + "type": "object", + "description": "An object representing the asset's physical coordinates or location.", + "schema": { + "x": { + "default": 0, + "rules": { + "type": "number", + "description": "X coordinate of the asset's location." + } + }, + "y": { + "default": 0, + "rules": { + "type": "number", + "description": "Y coordinate of the asset's location." + } + }, + "z": { + "default": 0, + "rules": { + "type": "number", + "description": "Z coordinate of the asset's location." + } + } + } + } + }, + "supplier": { + "default": "Unknown", + "rules": { + "type": "string", + "description": "The supplier or manufacturer of the asset." + } + }, + "type": { + "default": "valve", + "rules": { + "type": "string", + "description": "A general classification of the asset tied to the specific software. This is not chosen from the asset dropdown menu." + } + }, + "subType": { + "default": "Unknown", + "rules": { + "type": "string", + "description": "A more specific classification within 'type'. For example, 'centrifugal' for a centrifugal pump." + } + }, + "model": { + "default": "Unknown", + "rules": { + "type": "string", + "description": "A user-defined or manufacturer-defined model identifier for the asset." + } + }, + "accuracy": { + "default": null, + "rules": { + "type": "number", + "nullable": true, + "description": "The accuracy of the valve or sensor, typically as a percentage or absolute value." + } + } + }, + "mode": { + "current": { + "default": "auto", + "rules": { + "type": "enum", + "values": [ + { + "value": "auto", + "description": "ValveGroupController accepts inputs from a parents and childs and runs autonomously." + }, + { + "value": "virtualControl", + "description": "Controlled via GUI setpoints; ignores parent commands." + }, + { + "value": "fysicalControl", + "description": "Controlled via physical buttons or switches; ignores external automated commands." + }, + { + "value": "maintenance", + "description": "No active control from auto, virtual, or fysical sources." + } + ], + "description": "The operational mode of the valveGroupControl." + } + }, + "allowedActions":{ + "default":{}, + "rules": { + "type": "object", + "schema":{ + "auto": { + "default": ["statusCheck", "execSequence", "emergencyStop", "valvePositionChange", "totalFlowChange", "valveDeltaPchange"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Actions allowed in auto mode." + } + }, + "virtualControl": { + "default": ["statusCheck", "execSequence", "emergencyStop", "valvePositionChange", "totalFlowChange", "valveDeltaPchange"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Actions allowed in virtualControl mode." + } + }, + "fysicalControl": { + "default": ["statusCheck", "emergencyStop"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Actions allowed in fysicalControl mode." + } + }, + "maintenance": { + "default": ["statusCheck"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Actions allowed in maintenance mode." + } + } + }, + "description": "Information about valid command sources recognized by the valve." + } + }, + "allowedSources":{ + "default": {}, + "rules": { + "type": "object", + "schema":{ + "auto": { + "default": ["parent", "GUI", "fysical"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sources allowed in auto mode." + } + }, + "virtualControl": { + "default": ["GUI", "fysical"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sources allowed in virtualControl mode." + } + }, + "fysicalControl": { + "default": ["fysical"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sources allowed in fysicalControl mode." + } + } + }, + "description": "Information about valid command sources recognized by the valveGroupControl." + } + } + }, + "source": { + "default": "parent", + "rules": { + "type": "enum", + "values": [ + { + "value": "parent", + "description": "Commands are received from a parent controller." + }, + { + "value": "GUI", + "description": "Commands are received from a graphical user interface." + }, + { + "value": "fysical", + "description": "Commands are received from physical buttons or switches." + } + ], + "description": "Information about valid command sources recognized by the valveGroupControl." + } + }, + "action": { + "default": "statusCheck", + "rules": { + "type": "enum", + "values": [ + { + "value": "statusCheck", + "description": "Checks the valveGroupControl's state (mode, submode, operational status)." + }, + { + "value": "valvePositionChange", + "description": "If child valve position change, the new flow for each child valve is determined" + }, + { + "value": "execSequence", + "description": "Allows execution of sequences through auto or GUI controls." + }, + { + "value": "totalFlowChange", + "description": "If total flow change, the new flow for each child valve is determined" + }, + { + "value": "valveDeltaPchange", + "description": "If deltaP change, the deltaPmax is determined" + }, + { + "value": "emergencyStop", + "description": "Overrides all commands and stops the valveGroupControl immediately (safety scenarios)." + } + ], + "description": "Defines the possible actions that can be performed on the valveGroupControl." + } + }, + "sequences":{ + "default":{}, + "rules": { + "type": "object", + "schema": { + "startup": { + "default": ["starting","warmingup","operational"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sequence of states for starting up the valve." + } + }, + "shutdown": { + "default": ["stopping","coolingdown","idle"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sequence of states for shutting down the valveGroupControl." + } + }, + "emergencystop": { + "default": ["emergencystop","off"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sequence of states for an emergency stop." + } + }, + "boot": { + "default": ["idle","starting","warmingup","operational"], + "rules": { + "type": "set", + "itemType": "string", + "description": "Sequence of states for booting up the valveGroupControl." + } + } + } + }, + "description": "Predefined sequences of states for the valveGroupControl." + + }, + "calculationMode": { + "default": "medium", + "rules": { + "type": "enum", + "values": [ + { + "value": "low", + "description": "Calculations run at fixed intervals (time-based)." + }, + { + "value": "medium", + "description": "Calculations run when new setpoints arrive or measured changes occur (event-driven)." + }, + { + "value": "high", + "description": "Calculations run on all event-driven info, including every movement." + } + ], + "description": "The frequency at which calculations are performed." + } + } + } diff --git a/src/helper/childRegistrationUtils.js b/src/helper/childRegistrationUtils.js index bb6db1e..c271709 100644 --- a/src/helper/childRegistrationUtils.js +++ b/src/helper/childRegistrationUtils.js @@ -189,7 +189,7 @@ class ChildRegistrationUtils { this.logger.info(`Valve ${valveId} registered successfully.`); } - connectMachineGroup(machineGroup) { + connectMachineGroup(machineGroup) { if (!machineGroup) { this.logger.warn("Invalid machineGroup provided."); return;