Add "Home"

2026-03-04 20:16:45 +00:00
commit 9d6eac0ef8

109
Home.md Normal file

@@ -0,0 +1,109 @@
# generalFunctions
Shared utility library used by all EVOLV Node-RED nodes. This is NOT a Node-RED node itself - it is a dependency library.
## Overview
| Property | Value |
|----------|-------|
| **Version** | 1.0.0 |
| **Type** | Utility library |
| **Part of** | [EVOLV](https://gitea.wbd-rd.nl/RnD/EVOLV) |
## Purpose
`generalFunctions` provides centralized, reusable functionality for all EVOLV nodes. It is the foundation layer that ensures consistent behavior across the entire platform.
**Important:** Changes to this library affect ALL 13 EVOLV nodes. Backward compatibility must be verified before any modification.
## Exported Modules
### Measurement and Signal Processing
| Export | Description |
|--------|-------------|
| `MeasurementContainer` | Signal conditioning with canonical unit conversion |
| `predict` | TensorFlow.js predictive model interface |
| `interpolation` | Curve interpolation utilities |
### Control
| Export | Description |
|--------|-------------|
| `PIDController` | Standard PID controller implementation |
| `CascadePIDController` | Cascade PID for multi-loop control |
### Configuration
| Export | Description |
|--------|-------------|
| `configManager` | Node configuration management and persistence |
| `MenuManager` | Dynamic menu generation for Node-RED editor |
| `assetApiConfig` | Asset registry API configuration |
### Data and I/O
| Export | Description |
|--------|-------------|
| `outputUtils` | Standard output formatting (3-port pattern) |
| `logger` | Structured logging utility |
| `validation` | Input validation helpers |
| `loadModel` | Load TensorFlow.js models |
| `loadCurve` | Load asset performance curves |
### Physics and Conversion
| Export | Description |
|--------|-------------|
| `convert` | Unit conversion utilities |
| `coolprop` | CoolProp thermodynamic calculations |
| `gravity` | Gravity-related calculations |
## Canonical Units
All internal calculations use these SI-derived units:
| Quantity | Canonical Unit |
|----------|---------------|
| Pressure | Pa (Pascal) |
| Flow | m3/s (cubic meters per second) |
| Power | W (Watt) |
| Temperature | K (Kelvin) |
Conversion to/from user-facing units happens at node boundaries using the `convert` module.
## Usage
```javascript
const {
MeasurementContainer,
PIDController,
configManager,
MenuManager,
outputUtils,
convert,
logger
} = require('../generalFunctions');
```
## Dependencies
- **TensorFlow.js** - For predictive models
- **CoolProp** - For thermodynamic property calculations
## Technical Requirements
- Node.js >= 18
## Development Notes
- This library is included as a git submodule in the main EVOLV repository
- All nodes import from `../generalFunctions` (relative path within `nodes/`)
- The `MenuManager` class serves dynamic editor menus via HTTP endpoints
- The `configManager` handles node configuration persistence and migration
## Testing
```bash
node --test test/basic/*.test.js
```