Complete general functions

This commit is contained in:
znetsixe
2025-05-26 17:09:18 +02:00
parent 47dfe3850f
commit 2e57034f14
44 changed files with 6776 additions and 0 deletions

406
configs/machineConfig.json Normal file
View File

@@ -0,0 +1,406 @@
{
"general": {
"name": {
"default": "Rotating Machine",
"rules": {
"type": "string",
"description": "A human-readable name or label for this machine configuration."
}
},
"id": {
"default": null,
"rules": {
"type": "string",
"nullable": true,
"description": "A unique identifier for this configuration. If not provided, defaults to null."
}
},
"unit": {
"default": "m3/h",
"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": "machine",
"rules": {
"type": "string",
"description": "Specified software type for this configuration."
}
},
"role": {
"default": "RotationalDeviceController",
"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": "pump",
"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": "Centrifugal",
"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 machine or sensor, typically as a percentage or absolute value."
}
},
"machineCurve": {
"default": {
"nq": {
"1": {
"x": [
1,
2,
3,
4,
5
],
"y": [
10,
20,
30,
40,
50
]
}
},
"np": {
"1": {
"x": [
1,
2,
3,
4,
5
],
"y": [
10,
20,
30,
40,
50
]
}
}
},
"rules": {
"type": "machineCurve",
"description": "All machine curves must have a 'nq' and 'np' curve. nq stands for the flow curve, np stands for the power curve. Together they form the efficiency curve."
}
}
},
"mode": {
"current": {
"default": "auto",
"rules": {
"type": "enum",
"values": [
{
"value": "auto",
"description": "Machine accepts setpoints from a parent controller 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 machine."
}
},
"allowedActions":{
"default":{},
"rules": {
"type": "object",
"schema":{
"auto": {
"default": ["statusCheck", "execMovement", "execSequence", "emergencyStop"],
"rules": {
"type": "set",
"itemType": "string",
"description": "Actions allowed in auto mode."
}
},
"virtualControl": {
"default": ["statusCheck", "execMovement", "execSequence", "emergencyStop"],
"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 machine."
}
},
"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 machine."
}
}
},
"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 machine."
}
},
"action": {
"default": "statusCheck",
"rules": {
"type": "enum",
"values": [
{
"value": "statusCheck",
"description": "Checks the machine's state (mode, submode, operational status)."
},
{
"value": "execMovement",
"description": "Allows control through auto or GUI setpoints."
},
{
"value": "execSequence",
"description": "Allows execution of sequences through auto or GUI controls."
},
{
"value": "emergencyStop",
"description": "Overrides all commands and stops the machine immediately (safety scenarios)."
}
],
"description": "Defines the possible actions that can be performed on the machine."
}
},
"sequences":{
"default":{},
"rules": {
"type": "object",
"schema": {
"startup": {
"default": ["starting","warmingup","operational"],
"rules": {
"type": "set",
"itemType": "string",
"description": "Sequence of states for starting up the machine."
}
},
"shutdown": {
"default": ["stopping","coolingdown","idle"],
"rules": {
"type": "set",
"itemType": "string",
"description": "Sequence of states for shutting down the machine."
}
},
"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 machine."
}
}
}
},
"description": "Predefined sequences of states for the machine."
},
"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."
}
}
}

View File

@@ -0,0 +1,349 @@
{
"general": {
"name": {
"default": "Measurement Configuration",
"rules": {
"type": "string",
"description": "A human-readable name or label for this measurement 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 unit of measurement 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": "measurement",
"rules": {
"type": "string",
"description": "Specified software type for this configuration."
}
},
"role": {
"default": "Sensor",
"rules": {
"type": "string",
"description": "Indicates the role this configuration plays (e.g., sensor, controller, etc.)."
}
}
},
"asset": {
"uuid": {
"default": null,
"rules": {
"type": "string",
"nullable": true,
"description": "Asset tag number which is a universally unique identifier for this asset. May be null if not assigned."
}
},
"geoLocation": {
"default": {
"x": 0,
"y": 0,
"z": 0
},
"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": "sensor",
"rules": {
"type": "enum",
"values": [
{
"value": "sensor",
"description": "A device that detects or measures a physical property and responds to it (e.g. temperature sensor)."
}
]
}
},
"subType": {
"default": "pressure",
"rules": {
"type": "string",
"description": "A more specific classification within 'type'. For example, 'pressure' for a pressure sensor."
}
},
"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 sensor, typically represented as a percentage or absolute value."
}
},
"repeatability": {
"default": null,
"rules": {
"type": "number",
"nullable": true,
"description": "The repeatability of the sensor, typically represented as a percentage or absolute value."
}
}
},
"scaling": {
"enabled": {
"default": false,
"rules": {
"type": "boolean",
"description": "Indicates whether input scaling is active. If true, input values will be scaled according to the parameters below."
}
},
"inputMin": {
"default": 0,
"rules": {
"type": "number",
"description": "The minimum expected input value before scaling."
}
},
"inputMax": {
"default": 1,
"rules": {
"type": "number",
"description": "The maximum expected input value before scaling."
}
},
"absMin": {
"default": 50,
"rules": {
"type": "number",
"description": "The absolute minimum value that can be read or displayed after scaling."
}
},
"absMax": {
"default": 100,
"rules": {
"type": "number",
"description": "The absolute maximum value that can be read or displayed after scaling."
}
},
"offset": {
"default": 0,
"rules": {
"type": "number",
"description": "A constant offset to apply to the scaled output (e.g., to calibrate zero-points)."
}
}
},
"smoothing": {
"smoothWindow": {
"default": 10,
"rules": {
"type": "number",
"min": 1,
"description": "Determines the size of the data window (number of samples) used for smoothing operations."
}
},
"smoothMethod": {
"default": "mean",
"rules": {
"type": "enum",
"values": [
{
"value": "none",
"description": "No smoothing is applied; raw data is passed through."
},
{
"value": "mean",
"description": "Calculates the simple arithmetic mean (average) of the data points in a window."
},
{
"value": "min",
"description": "Selects the smallest (minimum) value among the data points in a window."
},
{
"value": "max",
"description": "Selects the largest (maximum) value among the data points in a window."
},
{
"value": "sd",
"description": "Computes the standard deviation to measure the variation or spread of the data."
},
{
"value": "lowPass",
"description": "Filters out high-frequency components, allowing only lower frequencies to pass."
},
{
"value": "highPass",
"description": "Filters out low-frequency components, allowing only higher frequencies to pass."
},
{
"value": "weightedMovingAverage",
"description": "Applies varying weights to each data point in a window before averaging."
},
{
"value": "bandPass",
"description": "Filters the signal to allow only frequencies within a specific range to pass."
},
{
"value": "median",
"description": "Selects the median (middle) value in a window, minimizing the effect of outliers."
},
{
"value": "kalman",
"description": "Applies a Kalman filter to combine noisy measurements over time for more accurate estimates."
},
{
"value": "savitzkyGolay",
"description": "Uses a polynomial smoothing filter on a moving window, which can also provide derivative estimates."
}
]
}
}
},
"simulation": {
"enabled": {
"default": false,
"rules": {
"type": "boolean",
"description": "If true, the system operates in simulation mode, generating simulated values instead of using real inputs."
}
},
"safeCalibrationTime": {
"default": 100,
"rules": {
"type": "number",
"min": 100,
"description": "Time to wait before finalizing calibration in simulation mode (in milliseconds or appropriate unit)."
}
}
},
"interpolation": {
"percentMin": {
"default": 0,
"rules": {
"type": "number",
"min": 0,
"description": "Minimum percentage for interpolation or data scaling operations."
}
},
"percentMax": {
"default": 100,
"rules": {
"type": "number",
"max": 100,
"description": "Maximum percentage for interpolation or data scaling operations."
}
}
},
"outlierDetection": {
"enabled": {
"default": false,
"rules": {
"type": "boolean",
"description": "Indicates whether outlier detection is enabled. If true, outliers will be identified and handled according to the method specified."
}
},
"method": {
"default": "zScore",
"rules": {
"type": "enum",
"values": [
{
"value": "zScore",
"description": "Uses the Z-score method to identify outliers based on standard deviations from the mean."
},
{
"value": "iqr",
"description": "Uses the Interquartile Range (IQR) method to identify outliers based on the spread of the middle 50% of the data."
},
{
"value": "modifiedZScore",
"description": "Uses a modified Z-score method that is more robust to small sample sizes."
}
]
}
},
"threshold": {
"default": 3,
"rules": {
"type": "number",
"description": "The threshold value used by the selected outlier detection method. For example, a Z-score threshold of 3.0."
}
}
}
}