Compare commits

..

1 Commits

Author SHA1 Message Date
znetsixe
2cc5bec1d7 Merge branch 'main' into sjoerdfijnje-main 2025-11-25 15:16:34 +01:00
50 changed files with 3107 additions and 13525 deletions

View File

@@ -1,40 +0,0 @@
# monster — Claude Code context
Multi-parameter biological process monitoring.
Part of the [EVOLV](https://gitea.wbd-rd.nl/RnD/EVOLV) wastewater-automation platform.
## S88 classification
| Level | Colour | Placement lane |
|---|---|---|
| **Unit** | `#50a8d9` | L4 |
## Flow layout rules
When wiring this node into a multi-node demo or production flow, follow the
placement rule set in the **EVOLV superproject**:
> `.claude/rules/node-red-flow-layout.md` (in the EVOLV repo root)
Key points for this node:
- Place on lane **L4** (x-position per the lane table in the rule).
- Stack same-level siblings vertically.
- Parent/children sit on adjacent lanes (children one lane left, parent one lane right).
- Wrap in a Node-RED group box coloured `#50a8d9` (Unit).
## Folder & File Layout
Every per-node file MUST use the folder name (`monster`) **exactly**, case-sensitive. Full rule: [`.claude/rules/node-architecture.md`](https://gitea.wbd-rd.nl/RnD/EVOLV/src/branch/development/.claude/rules/node-architecture.md) in the EVOLV superproject.
| Path | Required name |
|---|---|
| Entry file | `monster.js` |
| Editor HTML | `monster.html` |
| Node adapter | `src/nodeClass.js` |
| Domain logic | `src/specificClass.js` |
| Editor JS modules | `src/editor/*.js` (extract when inline editor JS exceeds ~50 lines) |
| Tests | `test/{basic,integration,edge}/*.test.js` |
| Example flows | `examples/*.flow.json` |
When adding new files, read the rule above first to avoid drift.

View File

@@ -1,49 +0,0 @@
# monster — Contract
Hand-maintained for Phase 6; the `## Inputs` table is generated from
`src/commands/index.js` (see Phase 9 generator). Keep ≤ 80 lines.
## Inputs (msg.topic on Port 0)
| Canonical | Aliases (deprecated) | Payload | Effect |
|---|---|---|---|
| `cmd.start` | `i_start` | truthy/falsy | Sets `source.i_start`. On the next tick a sampling run begins if flow bounds validate. |
| `set.schedule` | `monsternametijden` | array of AQUON rows (`SAMPLE_NAME`, `DESCRIPTION`, `SAMPLED_DATE`, `START_DATE`, `END_DATE`) | Stores the schedule and recomputes `nextDate` + `daysPerYear` for the configured `aquonSampleName`. |
| `set.rain` | `rain_data` | per-location rain forecast (Open-Meteo shape) | Aggregates hourly precipitation into `sumRain` / `avgRain`; feeds the rain-scaled flow prediction. |
| `data.flow` | `input_q` | `{ value: number, unit: string }` | Converts to m³/h and pushes into `flow.manual.atequipment`. Blends with measured-child flow in `getEffectiveFlow()`. |
| `set.mode` | `setMode` | string | Delegated to `source.setMode()` if defined. Reserved for future use. |
| `set.model-prediction` | `model_prediction` | numeric | Delegated to `source.setModelPrediction()` if defined. Reserved for future use. |
Aliases log a one-time deprecation warning the first time they fire.
## Outputs (msg.topic on Port 0/1/2)
- **Port 0 (process):** `msg.topic = config.general.name`. Payload built
by `outputUtils.formatMsg(..., 'process')` from `getOutput()`. Delta-
compressed — only changed fields are emitted. Carries `pulse`, `running`,
`bucketVol`, `sumPuls`, `predFlow`, `m3PerPuls`, `q`, `timeLeft`,
`targetVolumeM3`, `targetProgressPct`, `targetDeltaL`, `predictedRateM3h`,
`sumRain`, `avgRain`, `nextDate`, plus the flat measurements snapshot.
- **Port 1 (InfluxDB telemetry):** same shape as Port 0, formatted with the
`'influxdb'` formatter.
- **Port 2 (registration):** at startup the node sends one
`{ topic: 'child.register', payload: <node.id>, positionVsParent, distance }`
to its parent.
## Events emitted by `source.measurements.emitter`
The `MeasurementContainer` fires `<type>.measured.<position>` whenever a
matching series receives a new value. monster writes:
- `flow.manual.atequipment` — operator-supplied manual flow.
- `flow.measured.<position>` — re-emitted when a child measurement fires
(one of `flow.measured.upstream`, `flow.measured.downstream`,
`flow.measured.atequipment`).
## Children accepted
`measurement` only. The router subscribes to a child's
`flow.measured.<position>` events when the child's `config.asset.type` is
`'flow'` (or missing). Other asset types are ignored. monster has no
position-based filtering — all three positions are wired and the latest
value wins for each.

View File

@@ -1,13 +1,3 @@
# monster
# convert
Monsternamekast control node for EVOLV.
Primary responsibilities:
- combine measured/manual flow, rain context and schedule context
- predict sampling demand and pulse distribution over sampling window
- enforce bucket/sampling constraints (volume, weight, cooldown)
- emit process fields used by PLC pulse output, report tooling (e.g. Z-Info), and dashboards
Examples:
- `nodes/monster/examples/monster-dashboard.flow.json` (dashboard-ready visualization flow)
- `nodes/monster/examples/monster-api-dashboard.flow.json` (full API orchestration template with placeholder credentials)
Makes unit conversions

870
config/exampleArray.js Normal file
View File

@@ -0,0 +1,870 @@
const inputExample =
//tensor 1
[
// 1 prediction per hour
[
// 24 window size
[
//166 features of which the first feature is the hour of the day all the other values are precipation values
//These values are meaningless they need to be translated first into the correct format
//How do the transformations work?
-0.65066296, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-0.50620914, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-0.36175531, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-0.21730149, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-0.07284767, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
0.07160615, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
0.21605998, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
0.3605138, -0.1888816, -0.19213369, -0.19328518, -0.18170043, -0.18223418,
-0.18370405, -0.18517574, -0.18551063, -0.18683789, -0.18886069,
-0.18927826, -0.18696358, -0.17307445, -0.17702805, -0.17851964,
-0.17654074, -0.17762018, -0.1796983, -0.18136519, -0.18139249,
-0.18250296, -0.18198996, -0.18138494, -0.18618596, -0.1889744,
-0.18739212, -0.17126027, -0.17405689, -0.1762726, -0.18029169,
-0.1885969, -0.18849469, -0.19095787, -0.18038477, -0.18214581,
-0.18189491, -0.18189534, -0.18381298, -0.18393834, -0.18939162,
-0.17176759, -0.17026471, -0.17394295, -0.17903634, -0.19020126,
-0.18912097, -0.18823564, -0.17929266, -0.18775292, -0.18869072,
-0.18756475, -0.18702924, -0.18671379, -0.17348625, -0.18026013,
-0.1814532, -0.18132141, -0.18308498, -0.18331088, -0.18624909,
-0.18811531, -0.19032778, -0.18967649, -0.18800643, -0.18892376,
-0.18933033, -0.18079819, -0.18595871, -0.18796106, -0.18773453,
-0.19043156, -0.1891853, -0.18971276, -0.18899542, -0.18666336,
-0.1879662, -0.18708836, -0.1893528, -0.18959058, -0.18611566,
-0.19272971, -0.19552121, -0.19478238, -0.19681337, -0.19944471,
-0.19903339, -0.19263975, -0.18716142, -0.1877408, -0.18708849,
-0.18419774, -0.18278112, -0.18275773, -0.19600511, -0.19538267,
-0.19162537, -0.192591, -0.19787251, -0.19998388, -0.19278597,
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
-0.19189596, -0.19348373, -0.19015691, -0.1844006, -0.18490676,
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
-0.19192091, -0.18874464, -0.18849974, -0.1898807, -0.18982206,
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
-0.18945748, -0.1898998, -0.18970484, -0.18697297, -0.1889949,
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
],
[
0.50496762, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
0.64942144, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
0.79387527, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
0.93832909, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542, -0.144808,
-0.1452933, -0.14522589, -0.14659725, -0.18959058, -0.18611566,
-0.19272971, -0.19552121, -0.19478238, -0.19681337, -0.19944471,
-0.19903339, -0.19263975, -0.18716142, -0.1877408, -0.18708849,
-0.18419774, -0.18278112, -0.18275773, -0.19600511, -0.19538267,
-0.19162537, -0.192591, -0.19787251, -0.19998388, -0.19278597,
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
-0.19189596, -0.19348373, -0.19015691, -0.1844006, -0.18490676,
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
-0.19192091, -0.18874464, -0.18849974, -0.1898807, -0.18982206,
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
-0.18945748, -0.1898998, -0.18970484, -0.18697297, -0.1889949,
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
],
[
1.08278291, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
1.22723673, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.15728894, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.16854493, -0.16853073, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.16891474, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
1.37169056, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
1.51614438, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
1.6605982, -0.1888816, -0.19213369, -0.19328518, -0.18170043, -0.18223418,
-0.18370405, -0.18517574, -0.18551063, -0.18683789, -0.18886069,
-0.18927826, -0.18696358, -0.17307445, -0.17702805, -0.17851964,
-0.17654074, -0.17762018, -0.1796983, -0.18136519, -0.18139249,
-0.18250296, -0.18198996, -0.18138494, -0.18618596, -0.1889744,
-0.18739212, -0.17126027, -0.17405689, -0.1762726, -0.18029169,
-0.1885969, -0.18849469, -0.19095787, -0.18038477, -0.18214581,
-0.18189491, -0.18189534, -0.18381298, -0.18393834, -0.18939162,
-0.17176759, -0.17026471, -0.17394295, -0.17903634, -0.19020126,
-0.18912097, -0.18823564, -0.17929266, -0.18775292, -0.18869072,
-0.18756475, -0.18702924, -0.18671379, -0.17348625, -0.18026013,
-0.1814532, -0.18132141, -0.18308498, -0.18331088, -0.18624909,
-0.18811531, -0.19032778, -0.18967649, -0.18800643, -0.18892376,
-0.18933033, -0.18079819, -0.18595871, -0.18796106, -0.18773453,
-0.19043156, -0.1891853, -0.18971276, -0.18899542, -0.18666336,
-0.1879662, -0.18708836, -0.1893528, -0.18959058, -0.18611566,
-0.19272971, -0.19552121, -0.19478238, -0.19681337, -0.19944471,
-0.19903339, -0.19263975, -0.18716142, -0.1877408, -0.18708849,
-0.18419774, -0.18278112, -0.18275773, -0.19600511, -0.19538267,
-0.19162537, -0.192591, -0.19787251, -0.19998388, -0.19278597,
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
-0.19189596, -0.19348373, -0.19015691, -0.1844006, -0.18490676,
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
-0.19192091, -0.18874464, -0.18849974, -0.1898807, -0.18982206,
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
-0.18945748, -0.1898998, -0.18970484, -0.18697297, -0.1889949,
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
],
[
-1.66183972, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-1.51738589, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-1.37293207, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.15955445, -0.13803715, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.16164522, -0.14849295, -0.16853073, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.13901581,
-0.06342139, -0.18912097, -0.16787941, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.14169274, 0.01964936, -0.08233806,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.16748919, -0.0445072, 0.10122311, -0.08402621, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
0.16237384, -0.00447424, -0.17137192, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, 0.12352589, -0.00387522, -0.15085347,
-0.18786678, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
-0.06793555, -0.02713845, -0.12841841, -0.1844006, -0.18490676,
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
-0.19192091, -0.18874464, -0.18849974, -0.10893781, -0.14900896,
-0.1882855, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
-0.18945748, -0.16930273, -0.16915384, -0.16665951, -0.1889949,
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
],
[
-1.22847825, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.15955445, -0.13803715, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.16854493, -0.14856677, -0.17007908, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.14870851, -0.14752318, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.16281155, -0.12272718,
-0.16566951, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.08546801, -0.08402621, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.07174405, 0.03876113, -0.12883628, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.09073971, 0.03970448, -0.08795472,
-0.16710221, -0.18582166, -0.18569262, -0.18191596, -0.18098748,
-0.18121272, -0.19626444, -0.19792468, -0.19207762, -0.18952964,
-0.15057582, -0.08951793, -0.10783891, -0.16435934, -0.18490676,
-0.18425256, -0.18282198, -0.18047893, -0.17963261, -0.19567896,
-0.19192091, -0.18874464, -0.18849974, -0.16964498, -0.12860241,
-0.16800538, -0.19054112, -0.18959366, -0.18676196, -0.18424004,
-0.18355161, -0.18516647, -0.19370953, -0.19216638, -0.19084519,
-0.18945748, -0.1898998, -0.16915384, -0.18697297, -0.1889949,
-0.19083625, -0.19014625, -0.19090196, -0.19471276, -0.19409975,
-0.1935458, -0.19110129, -0.18852621, -0.1896783, -0.19012038,
-0.18907574, -0.19738469, -0.19826875, -0.19619434, -0.19351482,
-0.19247084, -0.19158516, -0.18882761, -0.19663896, -0.19387078,
-0.19137178, -0.19101838, -0.18902259, -0.18740881, -0.18577042,
],
[
-1.08402443, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-0.9395706, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
[
-0.79511678, -0.1888816, -0.19213369, -0.19328518, -0.18170043,
-0.18223418, -0.18370405, -0.18517574, -0.18551063, -0.18683789,
-0.18886069, -0.18927826, -0.18696358, -0.17307445, -0.17702805,
-0.17851964, -0.17654074, -0.17762018, -0.1796983, -0.18136519,
-0.18139249, -0.18250296, -0.18198996, -0.18138494, -0.18618596,
-0.1889744, -0.18739212, -0.17126027, -0.17405689, -0.1762726,
-0.18029169, -0.1885969, -0.18849469, -0.19095787, -0.18038477,
-0.18214581, -0.18189491, -0.18189534, -0.18381298, -0.18393834,
-0.18939162, -0.17176759, -0.17026471, -0.17394295, -0.17903634,
-0.19020126, -0.18912097, -0.18823564, -0.17929266, -0.18775292,
-0.18869072, -0.18756475, -0.18702924, -0.18671379, -0.17348625,
-0.18026013, -0.1814532, -0.18132141, -0.18308498, -0.18331088,
-0.18624909, -0.18811531, -0.19032778, -0.18967649, -0.18800643,
-0.18892376, -0.18933033, -0.18079819, -0.18595871, -0.18796106,
-0.18773453, -0.19043156, -0.1891853, -0.18971276, -0.18899542,
-0.18666336, -0.1879662, -0.18708836, -0.1893528, -0.18959058,
-0.18611566, -0.19272971, -0.19552121, -0.19478238, -0.19681337,
-0.19944471, -0.19903339, -0.19263975, -0.18716142, -0.1877408,
-0.18708849, -0.18419774, -0.18278112, -0.18275773, -0.19600511,
-0.19538267, -0.19162537, -0.192591, -0.19787251, -0.19998388,
-0.19278597, -0.18786678, -0.18582166, -0.18569262, -0.18191596,
-0.18098748, -0.18121272, -0.19626444, -0.19792468, -0.19207762,
-0.18952964, -0.19189596, -0.19348373, -0.19015691, -0.1844006,
-0.18490676, -0.18425256, -0.18282198, -0.18047893, -0.17963261,
-0.19567896, -0.19192091, -0.18874464, -0.18849974, -0.1898807,
-0.18982206, -0.1882855, -0.19054112, -0.18959366, -0.18676196,
-0.18424004, -0.18355161, -0.18516647, -0.19370953, -0.19216638,
-0.19084519, -0.18945748, -0.1898998, -0.18970484, -0.18697297,
-0.1889949, -0.19083625, -0.19014625, -0.19090196, -0.19471276,
-0.19409975, -0.1935458, -0.19110129, -0.18852621, -0.1896783,
-0.19012038, -0.18907574, -0.19738469, -0.19826875, -0.19619434,
-0.19351482, -0.19247084, -0.19158516, -0.18882761, -0.19663896,
-0.19387078, -0.19137178, -0.19101838, -0.18902259, -0.18740881,
-0.18577042,
],
]
];

701
dependencies/monster/SpeficicClass.js vendored Normal file

File diff suppressed because one or more lines are too long

122
dependencies/monster/modelLoader.js vendored Normal file
View File

@@ -0,0 +1,122 @@
const tf = require('@tensorflow/tfjs');
class ModelLoader {
constructor(logger) {
this.logger = logger || console;
this.model = null;
}
async loadModel(modelUrl, inputShape = [null, 24, 166]) {
try {
this.logger.debug(`Fetching model JSON from: ${modelUrl}`);
const response = await fetch(modelUrl);
const modelJSON = await response.json();
// Fix input shape
this.configureInputLayer(modelJSON, inputShape);
// Extract base path
const baseUrl = this.getBaseUrl(modelUrl);
this.fixWeightPaths(modelJSON, baseUrl);
// Ensure weight specs are there
if (
!modelJSON.weightsManifest ||
!modelJSON.weightsManifest[0].weights ||
modelJSON.weightsManifest[0].weights.length === 0
) {
throw new Error("Model JSON is missing weight specifications.");
}
// Load the binary weight data
const weightUrl = modelJSON.weightsManifest[0].paths[0];
const weightResponse = await fetch(weightUrl);
const weightBuffer = await weightResponse.arrayBuffer();
console.log('modelJSON.weightsManifest:', JSON.stringify(modelJSON.weightsManifest, null, 2));
if (
!modelJSON.weightsManifest ||
!modelJSON.weightsManifest[0].weights ||
modelJSON.weightsManifest[0].weights.length === 0
) {
console.error("❌ modelJSON.weightsManifest is missing weight specs!");
} else {
console.log("✅ Weight specs found:", modelJSON.weightsManifest[0].weights.length);
}
// Create ModelArtifacts object
const artifacts = {
modelTopology: modelJSON.modelTopology,
weightSpecs: modelJSON.weightsManifest[0].weights, // ✅ CORRECT FIELD NAME
weightData: weightBuffer
};
// Load from memory
this.model = await tf.loadLayersModel(tf.io.fromMemory(artifacts));
this.logger.debug('Model loaded successfully');
return this.model;
} catch (error) {
this.logger.error(`Failed to load model: ${error.message}`);
throw error;
}
}
configureInputLayer(modelJSON, inputShape) {
const layers = modelJSON.modelTopology.model_config.config.layers;
if (layers && layers.length > 0) {
const firstLayer = layers[0];
if (firstLayer.class_name === 'InputLayer') {
if (firstLayer.config.batch_shape) {
firstLayer.config.batchInputShape = firstLayer.config.batch_shape;
delete firstLayer.config.batch_shape;
this.logger.debug('Converted batch_shape to batchInputShape:', firstLayer);
} else if (!firstLayer.config.batchInputShape && !firstLayer.config.inputShape) {
firstLayer.config.batchInputShape = inputShape;
this.logger.debug('Configured input layer:', firstLayer);
} else {
this.logger.debug('Input shape already set:', firstLayer.config);
}
}
}
}
getBaseUrl(url) {
return url.substring(0, url.lastIndexOf('/') + 1);
}
fixWeightPaths(modelJSON, baseUrl) {
for (const group of modelJSON.weightsManifest) {
group.paths = group.paths.map(path => {
path = path.replace(/^\/+/, '');
return path.startsWith('http') ? path : `${baseUrl}${path}`;
});
}
}
}
const modelLoader = new ModelLoader();
(async () => {
try {
const localURL = "http://localhost:1880/generalFunctions/datasets/lstmData/tfjs_model/model.json";
const model = await modelLoader.loadModel(localURL);
console.log('Model loaded successfully');
const denseLayer = model.getLayer('dense_8');
const weights = denseLayer.getWeights();
const weightArray = await weights[0].array();
console.log('Dense layer kernel (sample):', weightArray.slice(0, 5));
} catch (error) {
console.error('Failed to load model:', error);
}
})();
module.exports = ModelLoader;

256
dependencies/monster/monsterConfig.json vendored Normal file
View File

@@ -0,0 +1,256 @@
{
"general": {
"name": {
"default": "Monster Configuration",
"rules": {
"type": "string",
"description": "A human-readable name or label for this 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 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": "monster",
"rules": {
"type": "string",
"description": "Specified software type for this configuration."
}
},
"role": {
"default": "samplingCabinet",
"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."
}
},
"emptyWeightBucket": {
"default": 3,
"rules": {
"type": "number",
"description": "The weight of the empty bucket in kilograms."
}
}
},
"constraints": {
"samplingtime": {
"default": 0,
"rules": {
"type": "number",
"description": "The time interval between sampling events (in seconds) if not using a flow meter."
}
},
"samplingperiod": {
"default": 24,
"rules": {
"type": "number",
"description": "The fixed period in hours in which a composite sample is collected."
}
},
"minVolume": {
"default": 5,
"rules": {
"type": "number",
"min": 5,
"description": "The minimum volume in liters."
}
},
"maxWeight": {
"default": 23,
"rules": {
"type": "number",
"max": 23,
"description": "The maximum weight in kilograms."
}
},
"subSampleVolume": {
"default": 50,
"rules": {
"type": "number",
"min": 50,
"max": 50,
"description": "The volume of each sub-sample in milliliters."
}
},
"storageTemperature": {
"default": {
"min": 1,
"max": 5
},
"rules": {
"type": "object",
"description": "Acceptable storage temperature range for samples in degrees Celsius.",
"schema": {
"min": {
"default": 1,
"rules": {
"type": "number",
"min": 1,
"description": "Minimum acceptable storage temperature in degrees Celsius."
}
},
"max": {
"default": 5,
"rules": {
"type": "number",
"max": 5,
"description": "Maximum acceptable storage temperature in degrees Celsius."
}
}
}
}
},
"flowmeter": {
"default": true,
"rules": {
"type": "boolean",
"description": "Indicates whether a flow meter is used for proportional sampling."
}
},
"closedSystem": {
"default": false,
"rules": {
"type": "boolean",
"description": "Indicates if the sampling system is closed (true) or open (false)."
}
},
"intakeSpeed": {
"default": 0.3,
"rules": {
"type": "number",
"description": "Minimum intake speed in meters per second."
}
},
"intakeDiameter": {
"default": 12,
"rules": {
"type": "number",
"description": "Minimum inner diameter of the intake tubing in millimeters."
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +0,0 @@
# Monster Example Flows
Import-ready Node-RED examples for `monster`.
## Files
- `basic.flow.json`
- Purpose: quick-start flow with dashboard charts for key monster outputs.
- `integration.flow.json`
- Purpose: lightweight integration contract example (`registerChild` path).
- `edge.flow.json`
- Purpose: unknown-topic/edge handling smoke example.
- `monster-dashboard.flow.json`
- Purpose: richer dashboard-focused visualization of process output.
- Includes:
- manual flow input
- manual start trigger
- seeded `rain_data` and `monsternametijden`
- parsed report fields (`m3Total`, `m3PerPuls`, `pulse`, `running`)
- `monster-api-dashboard.flow.json`
- Purpose: full orchestration template around `monster` with API paths and dashboard output.
- Includes:
- Open-Meteo weather fetch -> `rain_data`
- Aquon SFTP CSV fetch -> `monsternametijden`
- Z-Info token + import payload builder for `m3Total`/`m3PerPuls`
- dashboard API publish template (Grafana)
- placeholder-only credentials/hosts (`__SET_*__`)
## Notes
- `basic.flow.json` and `monster-dashboard.flow.json` are intentionally API-free.
- `monster-api-dashboard.flow.json` is the full API template variant and must be hardened with environment-backed secrets before production use.
- `ui-chart` uses series by `msg.topic` (`category: "topic"`, `categoryType: "msg"`).

View File

@@ -1,365 +0,0 @@
[
{
"id": "monster_basic_tab",
"type": "tab",
"label": "monster basic",
"disabled": false,
"info": "monster basic dashboard example"
},
{
"id": "ui_base_monster_basic",
"type": "ui-base",
"name": "EVOLV Demo",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": [
"ui-notification",
"ui-control"
],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default"
},
{
"id": "ui_theme_monster_basic",
"type": "ui-theme",
"name": "Monster Theme",
"colors": {
"surface": "#ffffff",
"primary": "#4f8582",
"bgPage": "#efefef",
"groupBg": "#ffffff",
"groupOutline": "#d8d8d8"
},
"sizes": {
"density": "default",
"pagePadding": "14px",
"groupGap": "14px",
"groupBorderRadius": "6px",
"widgetGap": "12px"
}
},
{
"id": "ui_page_monster_basic",
"type": "ui-page",
"name": "Monster Basic",
"ui": "ui_base_monster_basic",
"path": "/monster-basic",
"icon": "science",
"layout": "grid",
"theme": "ui_theme_monster_basic",
"breakpoints": [
{
"name": "Default",
"px": "0",
"cols": "12"
}
],
"order": 1,
"className": ""
},
{
"id": "ui_group_monster_basic_ctrl",
"type": "ui-group",
"name": "Input",
"page": "ui_page_monster_basic",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": ""
},
{
"id": "ui_group_monster_basic_obs",
"type": "ui-group",
"name": "Output",
"page": "ui_page_monster_basic",
"width": "12",
"height": "1",
"order": 2,
"showTitle": true,
"className": ""
},
{
"id": "monster_basic_node",
"type": "monster",
"z": "monster_basic_tab",
"name": "monster basic",
"samplingtime": "24",
"minvolume": "5",
"maxweight": "23",
"nominalFlowMin": "1000",
"flowMax": "6000",
"maxRainRef": "10",
"minSampleIntervalSec": "60",
"emptyWeightBucket": "8.3",
"aquon_sample_name": "112150",
"enableLog": false,
"logLevel": "error",
"positionVsParent": "atEquipment",
"positionIcon": "⊥",
"hasDistance": false,
"distance": "",
"x": 710,
"y": 220,
"wires": [
[
"monster_basic_parse"
],
[
"monster_basic_dbg_influx"
],
[
"monster_basic_dbg_parent"
]
]
},
{
"id": "monster_basic_inj_flow",
"type": "inject",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_ctrl",
"name": "flow 1800 m3/h",
"props": [
{
"p": "payload"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": "1",
"topic": "",
"payload": "1800",
"payloadType": "num",
"x": 170,
"y": 180,
"wires": [
[
"monster_basic_build_flow"
]
]
},
{
"id": "monster_basic_build_flow",
"type": "function",
"z": "monster_basic_tab",
"name": "build input_q",
"func": "msg.topic='input_q';\nmsg.payload={value:Number(msg.payload),unit:'m3/h'};\nreturn Number.isFinite(msg.payload.value)?msg:null;",
"outputs": 1,
"noerr": 0,
"x": 390,
"y": 180,
"wires": [
[
"monster_basic_node"
]
]
},
{
"id": "monster_basic_inj_start",
"type": "inject",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_ctrl",
"name": "manual start",
"props": [
{
"p": "topic",
"vt": "str"
},
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "0.1",
"topic": "i_start",
"payload": "true",
"payloadType": "bool",
"x": 160,
"y": 240,
"wires": [
[
"monster_basic_node"
]
]
},
{
"id": "monster_basic_parse",
"type": "function",
"z": "monster_basic_tab",
"name": "parse output",
"func": "const p=(msg&&msg.payload&&typeof msg.payload==='object')?msg.payload:{};\nconst now=Date.now();\nreturn [\n Number.isFinite(Number(p.q))?{topic:'q_m3h',payload:Number(p.q),timestamp:now}:null,\n Number.isFinite(Number(p.m3Total))?{topic:'m3_total',payload:Number(p.m3Total),timestamp:now}:null,\n Number.isFinite(Number(p.bucketVol))?{topic:'bucket_l',payload:Number(p.bucketVol),timestamp:now}:null,\n Number.isFinite(Number(p.m3PerPuls||p.m3PerPulse))?{topic:'m3_per_pulse',payload:Number(p.m3PerPuls||p.m3PerPulse),timestamp:now}:null,\n {topic:'status',payload:`running=${Boolean(p.running)} | pulse=${Boolean(p.pulse)} | remaining=${Number(p.pulsesRemaining||0)}`}\n];",
"outputs": 5,
"noerr": 0,
"x": 930,
"y": 220,
"wires": [
[
"monster_basic_chart_q"
],
[
"monster_basic_chart_total"
],
[
"monster_basic_chart_bucket"
],
[
"monster_basic_chart_pulse"
],
[
"monster_basic_text_status"
]
]
},
{
"id": "monster_basic_chart_q",
"type": "ui-chart",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_obs",
"name": "q",
"label": "Flow q (m3/h)",
"order": 1,
"width": 6,
"height": 4,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisType": "time",
"xAxisPropertyType": "timestamp",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"removeOlder": "15",
"removeOlderUnit": "60",
"showLegend": false,
"action": "append",
"x": 1170,
"y": 120,
"wires": []
},
{
"id": "monster_basic_chart_total",
"type": "ui-chart",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_obs",
"name": "m3Total",
"label": "m3Total",
"order": 2,
"width": 6,
"height": 4,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisType": "time",
"xAxisPropertyType": "timestamp",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"removeOlder": "15",
"removeOlderUnit": "60",
"showLegend": false,
"action": "append",
"x": 1180,
"y": 180,
"wires": []
},
{
"id": "monster_basic_chart_bucket",
"type": "ui-chart",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_obs",
"name": "bucket",
"label": "Bucket (L)",
"order": 3,
"width": 6,
"height": 4,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisType": "time",
"xAxisPropertyType": "timestamp",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"removeOlder": "15",
"removeOlderUnit": "60",
"showLegend": false,
"action": "append",
"x": 1180,
"y": 240,
"wires": []
},
{
"id": "monster_basic_chart_pulse",
"type": "ui-chart",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_obs",
"name": "m3PerPuls",
"label": "m3PerPuls",
"order": 4,
"width": 6,
"height": 4,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisType": "time",
"xAxisPropertyType": "timestamp",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"removeOlder": "15",
"removeOlderUnit": "60",
"showLegend": false,
"action": "append",
"x": 1190,
"y": 300,
"wires": []
},
{
"id": "monster_basic_text_status",
"type": "ui-text",
"z": "monster_basic_tab",
"group": "ui_group_monster_basic_obs",
"name": "status",
"label": "Status",
"order": 5,
"width": 12,
"height": 1,
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 1170,
"y": 360,
"wires": []
},
{
"id": "monster_basic_dbg_influx",
"type": "debug",
"z": "monster_basic_tab",
"name": "influx output",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 930,
"y": 300,
"wires": []
},
{
"id": "monster_basic_dbg_parent",
"type": "debug",
"z": "monster_basic_tab",
"name": "parent output",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 920,
"y": 340,
"wires": []
}
]

182
monster oud.js Normal file
View File

@@ -0,0 +1,182 @@
module.exports = function (RED) {
function monster(config) {
// create node
RED.nodes.createNode(this, config);
// call this => node so whenver you want to call a node function type node and the function behind it
var node = this;
try{
// fetch monster object from monster.js
const Monster = require("./dependencies/monster/monster_class");
const OutputUtils = require("../generalFunctions/helper/outputUtils");
const mConfig={
general: {
name: config.name,
id: node.id,
unit: config.unit,
logging:{
logLevel: config.logLevel,
enabled: config.enableLog,
},
},
asset: {
supplier: config.supplier,
subType: config.subType,
model: config.model,
emptyWeightBucket: config.emptyWeightBucket,
},
constraints: {
minVolume: config.minVolume,
maxWeight: config.maxWeight,
samplingtime: config.samplingtime,
},
}
// make new monster on creation to work with.
const m = new Monster(mConfig);
// put m on node memory as source
node.source = m;
//load output utils
const output = new OutputUtils();
//internal vars
this.interval_id = null;
//updating node state
function updateNodeStatus() {
try{
const bucketVol = m.bucketVol;
const maxVolume = m.maxVolume;
const state = m.running;
const mode = "AI" ; //m.mode;
let status;
switch (state) {
case false:
status = { fill: "red", shape: "dot", text: `${mode}: OFF` };
break;
case true:
status = { fill: "green", shape: "dot", text: `${mode}: ON => ${bucketVol} | ${maxVolume}` };
break;
}
return status;
} catch (error) {
node.error("Error in updateNodeStatus: " + error);
return { fill: "red", shape: "ring", text: "Status Error" };
}
}
function tick(){
try{
// load status node
const status = updateNodeStatus();
// kick time based function in node
m.tick();
//show node status
node.status(status);
} catch (error) {
node.error("Error in tick function: " + error);
node.status({ fill: "red", shape: "ring", text: "Tick Error" });
}
}
// register child on first output this timeout is needed because of node - red stuff
setTimeout(
() => {
/*---execute code on first start----*/
let msgs = [];
msgs[2] = { topic : "registerChild" , payload: node.id, positionVsParent: "upstream" };
msgs[3] = { topic : "registerChild" , payload: node.id, positionVsParent: "downstream" };
//send msg
this.send(msgs);
},
100
);
//declare refresh interval internal node
setTimeout(
() => {
/*---execute code on first start----*/
this.interval_id = setInterval(function(){ tick() },1000)
},
1000
);
node.on('input', function (msg,send,done) {
try{
switch(msg.topic) {
case 'registerChild':
const childId = msg.payload;
const childObj = RED.nodes.getNode(childId);
m.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
break;
case 'setMode':
m.setMode(msg.payload);
break;
case 'start':
m.i_start = true;
break;
}
} catch (error) {
node.error("Error in input function: " + error);
node.status({ fill: "red", shape: "ring", text: "Input Error" });
}
if(msg.topic == "i_flow"){
monster.q = parseFloat(msg.payload);
}
if(msg.topic == "i_start"){
monster.i_start = true;
}
if(msg.topic == "model_prediction"){
let var1 = msg.payload.dagvoorheen;
let var2 = msg.payload.dagnadien;
monster.get_model_prediction(var1, var2);
}
if(msg.topic == "aquon_monsternametijden"){
monster.monsternametijden = msg.payload;
}
if(msg.topic == "rain_data"){
monster.rain_data = msg.payload;
}
//register child classes
if(msg.topic == "registerChild"){
let child = msg.payload;
monster.registerChild(child);
}
done();
});
// tidy up any async code here - shutdown connections and so on.
node.on('close', function() {
clearTimeout(this.interval_id);
});
} catch (error) {
node.error("Error in monster function: " + error);
node.status({ fill: "red", shape: "ring", text: "Monster Error" });
}
}
RED.nodes.registerType("monster", monster);
};

View File

@@ -6,21 +6,12 @@
RED.nodes.registerType("monster", {
category: "EVOLV",
color: "#4f8582",
defaults: {
defaults: {
// Define default properties
name: { value: "" },
processOutputFormat: { value: "process" },
dbaseOutputFormat: { value: "influxdb" },
// Define specific properties
samplingtime: { value: 0 },
minvolume: { value: 5 },
// Define specific properties
samplingtime: { value: 0 },
minvolume: { value: 5 },
maxweight: { value: 22 },
nominalFlowMin: { value: 0 },
flowMax: { value: 0 },
maxRainRef: { value: 10 },
minSampleIntervalSec: { value: 60 },
emptyWeightBucket: { value: 3 },
aquon_sample_name: { value: "" },
@@ -52,7 +43,7 @@
icon: "font-awesome/fa-tachometer",
label: function () {
return (this.positionIcon || "") + " " + (this.category ? this.category.slice(0, -1) : "Monster");
return this.positionIcon + " " + this.category.slice(0, -1) || "Monster";
},
oneditprepare: function() {
@@ -66,99 +57,12 @@
};
waitForMenuData();
// your existing project-settings & asset dropdown logic can remain here
// your existing projectsettings & asset dropdown logic can remain here
document.getElementById("node-input-samplingtime");
document.getElementById("node-input-minvolume");
document.getElementById("node-input-maxweight");
document.getElementById("node-input-nominalFlowMin");
document.getElementById("node-input-flowMax");
document.getElementById("node-input-maxRainRef");
document.getElementById("node-input-minSampleIntervalSec");
document.getElementById("node-input-emptyWeightBucket");
const aquonSelect = document.getElementById("node-input-aquon_sample_name");
if (aquonSelect) {
const menuData = window.EVOLV?.nodes?.monster?.menuData?.aquon || {};
const options = menuData.samples || [];
const specs = menuData.specs || {};
const defaultSpec = specs.defaults || {};
const specMap = specs.bySample || {};
const setReadOnly = () => {};
const applySpec = (spec) => {
const merged = {
samplingtime: defaultSpec.samplingtime,
minvolume: defaultSpec.minvolume,
maxweight: defaultSpec.maxweight,
emptyWeightBucket: defaultSpec.emptyWeightBucket,
...(spec || {})
};
const samplingTimeEl = document.getElementById("node-input-samplingtime");
const minVolumeEl = document.getElementById("node-input-minvolume");
const maxWeightEl = document.getElementById("node-input-maxweight");
const nominalFlowMinEl = document.getElementById("node-input-nominalFlowMin");
const flowMaxEl = document.getElementById("node-input-flowMax");
const maxRainEl = document.getElementById("node-input-maxRainRef");
const minSampleIntervalEl = document.getElementById("node-input-minSampleIntervalSec");
const emptyWeightEl = document.getElementById("node-input-emptyWeightBucket");
if (samplingTimeEl && merged.samplingtime !== undefined) {
samplingTimeEl.value = merged.samplingtime;
}
if (minVolumeEl && merged.minvolume !== undefined) {
minVolumeEl.value = merged.minvolume;
}
if (maxWeightEl && merged.maxweight !== undefined) {
maxWeightEl.value = merged.maxweight;
}
if (nominalFlowMinEl && merged.nominalFlowMin !== undefined) {
nominalFlowMinEl.value = merged.nominalFlowMin;
}
if (flowMaxEl && merged.flowMax !== undefined) {
flowMaxEl.value = merged.flowMax;
}
if (maxRainEl && merged.maxRainRef !== undefined) {
maxRainEl.value = merged.maxRainRef;
}
if (minSampleIntervalEl && merged.minSampleIntervalSec !== undefined) {
minSampleIntervalEl.value = merged.minSampleIntervalSec;
}
if (emptyWeightEl && merged.emptyWeightBucket !== undefined) {
emptyWeightEl.value = merged.emptyWeightBucket;
}
};
aquonSelect.innerHTML = "";
const emptyOption = document.createElement("option");
emptyOption.value = "";
emptyOption.textContent = "Select sample...";
aquonSelect.appendChild(emptyOption);
options.forEach((option) => {
const optionElement = document.createElement("option");
optionElement.value = option.code;
optionElement.textContent = `${option.code} - ${option.description}`;
optionElement.title = option.description || option.code;
aquonSelect.appendChild(optionElement);
});
if (this.aquon_sample_name) {
aquonSelect.value = this.aquon_sample_name;
}
aquonSelect.addEventListener("change", () => {
const selected = aquonSelect.value;
if (!selected) {
return;
}
const selectedSpec = specMap[selected] || {};
applySpec(selectedSpec);
});
}
document.getElementById("node-input-aquon_sample_name");
},
oneditsave: function() {
@@ -177,17 +81,9 @@
window.EVOLV.nodes.monster.positionMenu.saveEditor(this);
}
const normalizeNumber = (value) => {
if (typeof value !== "string") {
return value;
}
return value.replace(",", ".");
};
["samplingtime", "minvolume", "maxweight", "nominalFlowMin", "flowMax", "maxRainRef", "minSampleIntervalSec", "emptyWeightBucket"].forEach((field) => {
["samplingtime", "minvolume", "maxweight", "emptyWeightBucket"].forEach((field) => {
const element = document.getElementById(`node-input-${field}`);
const rawValue = normalizeNumber(element?.value || "");
const value = parseFloat(rawValue) || 0;
const value = parseFloat(element?.value) || 0;
console.log(`----------------> Saving ${field}: ${value}`);
node[field] = value;
});
@@ -206,8 +102,7 @@
<!-- Main UI Template -->
<script type="text/html" data-template-name="monster">
<!-- specific input -->
<h3>Sampling constraints</h3>
<!-- speficic input -->
<div class="form-row">
<label for="node-input-samplingtime"><i class="fa fa-clock-o"></i> Sampling time (h)</label>
<input type="number" id="node-input-samplingtime" style="width:60%;" />
@@ -220,33 +115,13 @@
<label for="node-input-maxweight"><i class="fa fa-clock-o"></i> Max weight (kg)</label>
<input type="number" id="node-input-maxweight" style="width:60%;" />
</div>
<h3>Hydraulic bounds</h3>
<div class="form-row">
<label for="node-input-nominalFlowMin"><i class="fa fa-clock-o"></i> Nominal min flow (m3/h)</label>
<input type="number" id="node-input-nominalFlowMin" style="width:60%;" />
</div>
<div class="form-row">
<label for="node-input-flowMax"><i class="fa fa-clock-o"></i> Max flow (m3/h)</label>
<input type="number" id="node-input-flowMax" style="width:60%;" />
</div>
<h3>Rain scaling</h3>
<div class="form-row">
<label for="node-input-maxRainRef"><i class="fa fa-cloud-rain"></i> Max rain reference (mm)</label>
<input type="number" id="node-input-maxRainRef" style="width:60%;" />
</div>
<div class="form-row">
<label for="node-input-minSampleIntervalSec"><i class="fa fa-hourglass"></i> Min sample interval (s)</label>
<input type="number" id="node-input-minSampleIntervalSec" style="width:60%;" />
</div>
<h3>Bucket</h3>
<div class="form-row">
<label for="node-input-emptyWeightBucket"><i class="fa fa-clock-o"></i> Empty weight of bucket (kg)</label>
<input type="number" id="node-input-emptyWeightBucket" style="width:60%;" />
</div>
<h3>Aquon</h3>
<div class="form-row">
<label for="node-input-aquon_sample_name"><i class="fa fa-clock-o"></i> Aquon sample name</label>
<select id="node-input-aquon_sample_name" style="width:60%;"></select>
<input type="text" id="node-input-aquon_sample_name" style="width:60%;" />
</div>
<!-- Asset fields injected here -->
@@ -263,6 +138,6 @@
<script type="text/html" data-help-name="monster">
<p><b>Monster node</b>: Configure a monster asset.</p>
<ul>
<li><b>Beta note:</b> values load from specs but remain editable in the editor for testing.</li>
</ul>
</script>
</script>

View File

@@ -1,5 +1,5 @@
const nameOfNode = 'monster';
const nodeClass = require('./src/nodeClass.js');
const nodeClass = require('./src/nodeClass.js');
const { MenuManager, configManager } = require('generalFunctions');
module.exports = function(RED) {
@@ -16,7 +16,7 @@ module.exports = function(RED) {
// Serve /monster/menu.js
RED.httpAdmin.get(`/${nameOfNode}/menu.js`, (req, res) => {
try {
const script = menuMgr.createEndpoint(nameOfNode, ['logger', 'position', 'aquon']);
const script = menuMgr.createEndpoint(nameOfNode, ['logger','position']);
res.type('application/javascript').send(script);
} catch (err) {
res.status(500).send(`// Error generating menu: ${err.message}`);
@@ -32,4 +32,4 @@ module.exports = function(RED) {
res.status(500).send(`// Error generating configData: ${err.message}`);
}
});
};
};

View File

@@ -4,10 +4,7 @@
"description": "Control module Monsternamekast",
"main": "monster.js",
"scripts": {
"test": "node --test test/basic/*.test.js test/integration/*.test.js test/edge/*.test.js",
"wiki:contract": "node ../generalFunctions/scripts/wikiGen.js contract ./src/commands/index.js --write ./wiki/Home.md",
"wiki:datamodel": "node ../generalFunctions/scripts/wikiGen.js datamodel ./src/specificClass.js --write ./wiki/Home.md",
"wiki:all": "npm run wiki:contract && npm run wiki:datamodel"
"test": "node monster.js"
},
"repository": {
"type": "git",

View File

@@ -1,54 +0,0 @@
'use strict';
// Handlers for monster input topics. Each is a pure function over the
// domain (source). Unit conversion for incoming flow happens in the
// handler (the legacy nodeClass did it inline) — anything else inbound
// is passed straight through to source.handleInput.
const { convert } = require('generalFunctions');
exports.cmdStart = (source, msg) => {
source.handleInput('i_start', Boolean(msg.payload));
};
exports.setSchedule = (source, msg) => {
source.handleInput('monsternametijden', msg.payload);
};
exports.setRain = (source, msg) => {
source.handleInput('rain_data', msg.payload);
};
exports.dataFlow = (source, msg, ctx) => {
const log = ctx?.logger || source.logger;
const value = Number(msg.payload?.value);
const unit = msg.payload?.unit;
if (!Number.isFinite(value) || !unit) {
log?.warn?.('data.flow payload must include numeric value and unit.');
return;
}
let converted = value;
try { converted = convert(value).from(unit).to('m3/h'); }
catch (err) { log?.warn?.(`data.flow unit conversion failed: ${err.message}`); return; }
source.handleInput('input_q', { value: converted, unit: 'm3/h' });
};
exports.setMode = (source, msg) => {
if (typeof source.setMode === 'function') source.setMode(msg.payload);
};
exports.setModelPrediction = (source, msg) => {
if (typeof source.setModelPrediction === 'function') source.setModelPrediction(msg.payload);
};
// Inbound child registration from a measurement (or other) child node.
// Ported from the legacy `case 'registerChild'` branch in nodeClass.
exports.childRegister = (source, msg, ctx) => {
const childId = msg.payload;
const childObj = ctx?.RED?.nodes?.getNode?.(childId);
if (!childObj?.source) {
(ctx?.logger || source.logger)?.warn?.(`child.register skipped: missing child/source for id=${childId}`);
return;
}
source.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent, msg.distance);
};

View File

@@ -1,63 +0,0 @@
'use strict';
// monster command registry. Canonical names follow CONTRACTS.md §1.
// Legacy names (i_start, monsternametijden, rain_data, input_q, setMode,
// model_prediction) are surfaced as aliases — they log a one-time
// deprecation warning on first use and are removed in Phase 7.
const handlers = require('./handlers');
module.exports = [
{
topic: 'cmd.start',
aliases: ['i_start'],
payloadSchema: { type: 'any' },
description: 'Trigger / release the sampler start gate.',
handler: handlers.cmdStart,
},
{
topic: 'set.schedule',
aliases: ['monsternametijden'],
payloadSchema: { type: 'any' },
description: 'Replace the sampling-times schedule.',
handler: handlers.setSchedule,
},
{
topic: 'set.rain',
aliases: ['rain_data'],
payloadSchema: { type: 'any' },
description: 'Push current rain-event data into the sampler logic.',
handler: handlers.setRain,
},
{
topic: 'data.flow',
aliases: ['input_q'],
payloadSchema: { type: 'object' },
// Compound payload `{value, unit}` — handler converts internally to m3/h.
// Registry-level normalisation is skipped (the handler reads payload.value /
// payload.unit directly; flattening would break it).
description: 'Push the upstream flow measurement (payload: {value, unit}).',
handler: handlers.dataFlow,
},
{
topic: 'set.mode',
aliases: ['setMode'],
payloadSchema: { type: 'any' },
description: 'Switch the monster between auto / manual modes.',
handler: handlers.setMode,
},
{
topic: 'set.model-prediction',
aliases: ['model_prediction'],
payloadSchema: { type: 'any' },
description: 'Push the upstream rain-prediction snapshot used by the sampler.',
handler: handlers.setModelPrediction,
},
{
topic: 'child.register',
aliases: ['registerChild'],
payloadSchema: { type: 'string' },
description: 'Register a child node (typically a measurement) with this monster.',
handler: handlers.childRegister,
},
];

View File

@@ -1,59 +0,0 @@
'use strict';
// Flow tracking — manual override + measured-child fan-in + effective
// blend (mean of the two when both present). Wraps the
// MeasurementContainer so the domain stays read-only on flow state.
const POSITIONS = ['upstream', 'downstream', 'atequipment'];
class FlowTracker {
constructor({ measurements, logger }) {
this.measurements = measurements;
this.logger = logger;
this.manualFlow = null;
}
updateManualFlow(payload = {}) {
const value = Number(payload.value);
if (!Number.isFinite(value)) return;
const unit = payload.unit || 'm3/h';
this.manualFlow = value;
this.measurements.type('flow').variant('manual').position('atequipment')
.value(value, Date.now(), unit);
}
handleMeasuredFlow(eventData) {
const value = Number(eventData?.value);
if (!Number.isFinite(value)) return;
const position = String(eventData.position || 'atequipment').toLowerCase();
const unit = eventData.unit || 'm3/h';
this.measurements.type('flow').variant('measured').position(position)
.value(value, eventData.timestamp || Date.now(), unit);
}
getMeasuredFlow() {
const values = [];
for (const pos of POSITIONS) {
const v = this.measurements.type('flow').variant('measured').position(pos).getCurrentValue();
if (Number.isFinite(v)) values.push(v);
}
if (!values.length) return null;
return values.reduce((s, c) => s + c, 0) / values.length;
}
getManualFlow() {
const v = this.measurements.type('flow').variant('manual').position('atequipment').getCurrentValue();
return Number.isFinite(v) ? v : null;
}
getEffectiveFlow() {
const measured = this.getMeasuredFlow();
const manual = this.getManualFlow();
if (measured != null && manual != null) return (measured + manual) / 2;
if (measured != null) return measured;
if (manual != null) return manual;
return 0;
}
}
module.exports = FlowTracker;

View File

@@ -1,70 +0,0 @@
'use strict';
// Output formatter — assembles the snapshot shape getOutput returns each
// tick. Heavy on derived fields (timeToNextPulse, targetDelta, ...) but
// every value is read-only on the domain, so this can stay a pure function.
const params = require('../parameters/parameters');
function buildOutput(m) {
const output = m.measurements.getFlattenedOutput();
const flowRate = Number(m.q) || 0;
const m3PerPulse = Number(m.m3PerPuls) || 0;
const pulseFraction = Number(m.temp_pulse) || 0;
const targetVolumeL = Number(m.targetVolume) > 0 ? m.targetVolume : 0;
const targetVolumeM3 = targetVolumeL > 0 ? targetVolumeL / 1000 : 0;
const flowToNextPulseM3 = m3PerPulse > 0 ? Math.max(0, (1 - pulseFraction) * m3PerPulse) : 0;
const timeToNextPulseSec = flowRate > 0 && flowToNextPulseM3 > 0
? Math.round((flowToNextPulseM3 / (flowRate / 3600)) * 100) / 100
: 0;
const targetProgressPct = targetVolumeL > 0
? Math.round((m.bucketVol / targetVolumeL) * 10000) / 100
: 0;
const targetDeltaL = targetVolumeL > 0
? Math.round((m.bucketVol - targetVolumeL) * 100) / 100
: 0;
const targetDeltaM3 = targetVolumeL > 0
? Math.round((targetDeltaL / 1000) * 10000) / 10000
: 0;
Object.assign(output, {
pulse: m.pulse,
running: m.running,
bucketVol: m.bucketVol,
bucketWeight: m.bucketWeight,
sumPuls: m.sumPuls,
predFlow: m.predFlow,
predM3PerSec: m.predM3PerSec,
timePassed: m.timePassed,
timeLeft: m.timeLeft,
m3Total: m.m3Total,
q: m.q,
nominalFlowMin: m.nominalFlowMin,
flowMax: m.flowMax,
invalidFlowBounds: m.invalidFlowBounds,
minSampleIntervalSec: m.minSampleIntervalSec,
missedSamples: m.missedSamples,
sampleCooldownMs: params.getSampleCooldownMs(m),
maxVolume: m.maxVolume,
minVolume: m.minVolume,
nextDate: m.nextDate,
daysPerYear: m.daysPerYear,
m3PerPuls: m.m3PerPuls,
m3PerPulse: m.m3PerPuls,
pulsesRemaining: Math.max(0, (m.targetPuls || 0) - (m.sumPuls || 0)),
pulseFraction,
flowToNextPulseM3,
timeToNextPulseSec,
targetVolumeM3,
targetProgressPct,
targetDeltaL,
targetDeltaM3,
predictedRateM3h: params.getPredictedFlowRate(m),
sumRain: m.rainAggregator?.sumRain ?? 0,
avgRain: m.rainAggregator?.avgRain ?? 0,
});
return output;
}
module.exports = { buildOutput };

View File

@@ -1,28 +0,0 @@
'use strict';
// Status-badge composition. Three states the editor cares about:
// - red ring : config error (flow bounds invalid)
// - yellow ring: sampling but cooldown is gating the next pulse
// - green dot : sampling normally
// - grey ring : idle
// Shape mirrors the legacy nodeClass._updateNodeStatus output verbatim.
const { statusBadge } = require('generalFunctions');
const params = require('../parameters/parameters');
function buildStatusBadge(m) {
if (m.invalidFlowBounds) {
return statusBadge.error(`Config error: nominalFlowMin (${m.nominalFlowMin}) >= flowMax (${m.flowMax})`);
}
if (m.running) {
const levelText = `${m.bucketVol}/${m.maxVolume} L`;
const cooldownMs = params.getSampleCooldownMs(m);
if (cooldownMs > 0) {
return statusBadge.compose([`SAMPLING (${Math.ceil(cooldownMs / 1000)}s)`, levelText], { fill: 'yellow', shape: 'ring' });
}
return statusBadge.compose([`AI: RUNNING`, levelText], { fill: 'green', shape: 'dot' });
}
return statusBadge.idle('AI: IDLE');
}
module.exports = { buildStatusBadge };

View File

@@ -1,36 +1,219 @@
'use strict';
/**
* node class.js
*
* Encapsulates all node logic in a reusable class. In future updates we can split this into multiple generic classes and use the config to specifiy which ones to use.
* This allows us to keep the Node-RED node clean and focused on wiring up the UI and event handlers.
*/
const { outputUtils, configManager } = require('generalFunctions');
const Specific = require("./specificClass");
const { BaseNodeAdapter } = require('generalFunctions');
const Monster = require('./specificClass');
const commands = require('./commands');
class nodeClass {
/**
* Create a Node.
* @param {object} uiConfig - Node-RED node configuration.
* @param {object} RED - Node-RED runtime API.
*/
constructor(uiConfig, RED, nodeInstance, nameOfNode) {
class nodeClass extends BaseNodeAdapter {
static DomainClass = Monster;
static commands = commands;
// Tick-driven: sampling integrator (m3PerTick → temp_pulse) needs
// wall-clock delta-time once per second.
static tickInterval = 1000;
static statusInterval = 1000;
// Preserve RED reference for HTTP endpoints if needed
this.node = nodeInstance; // This is the Node-RED node instance, we can use this to send messages and update status
this.RED = RED; // This is the Node-RED runtime API, we can use this to create endpoints if needed
this.name = nameOfNode; // This is the name of the node, it should match the file name and the node type in Node-RED
this.source = null; // Will hold the specific class instance
this.config = null; // Will hold the merged configuration
buildDomainConfig(uiConfig) {
return {
constraints: {
samplingtime: Number(uiConfig.samplingtime) || 0,
minVolume: Number(uiConfig.minvolume ?? uiConfig.minVolume) || 5,
maxWeight: Number(uiConfig.maxweight ?? uiConfig.maxWeight) || 23,
nominalFlowMin: Number(uiConfig.nominalFlowMin) || 0,
flowMax: Number(uiConfig.flowMax) || 0,
maxRainRef: Number(uiConfig.maxRainRef) || 10,
minSampleIntervalSec: Number(uiConfig.minSampleIntervalSec) || 60,
},
functionality: { role: 'samplingCabinet', aquonSampleName: uiConfig.aquon_sample_name || undefined },
asset: { emptyWeightBucket: Number(uiConfig.emptyWeightBucket) || 3 },
};
// Load default & UI config
this._loadConfig(uiConfig,this.node);
// Instantiate core class
this._setupSpecificClass(uiConfig);
// Wire up event and lifecycle handlers
this._bindEvents();
this._registerChild();
this._startTickLoop();
this._attachInputHandler();
this._attachCloseHandler();
}
extraSetup() {
const uiSampleName = this.config?.functionality?.aquonSampleName;
if (uiSampleName) this.source.aquonSampleName = uiSampleName;
/**
* Load and merge default config with user-defined settings.
* @param {object} uiConfig - Raw config from Node-RED UI.
*/
_loadConfig(uiConfig,node) {
// Merge UI config over defaults
this.config = {
general: {
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
supplier: uiConfig.supplier,
category: uiConfig.category, //add later to define as the software type
type: uiConfig.assetType,
model: uiConfig.model,
unit: uiConfig.unit
},
functionality: {
positionVsParent: uiConfig.positionVsParent
}
};
// Utility for formatting outputs
this._output = new outputUtils();
}
/**
* Instantiate the core Measurement logic and store as source.
*/
_setupSpecificClass(uiConfig) {
const monsterConfig = this.config;
this.source = new Specific(monsterConfig);
//store in node
this.node.source = this.source; // Store the source in the node instance for easy access
}
/**
* Bind events to Node-RED status updates. Using internal emitter. --> REMOVE LATER WE NEED ONLY COMPLETE CHILDS AND THEN CHECK FOR UPDATES
*/
_bindEvents() {
}
_updateNodeStatus() {
const m = this.source;
try{
const bucketVol = m.bucketVol;
const maxVolume = m.maxVolume;
const state = m.running;
const mode = "AI" ; //m.mode;
let status;
switch (state) {
case false:
status = { fill: "red", shape: "dot", text: `${mode}: OFF` };
break;
case true:
status = { fill: "green", shape: "dot", text: `${mode}: ON => ${bucketVol} | ${maxVolume}` };
break;
}
return status;
} catch (error) {
node.error("Error in updateNodeStatus: " + error);
return { fill: "red", shape: "ring", text: "Status Error" };
}
}
/**
* Register this node as a child upstream and downstream.
* Delayed to avoid Node-RED startup race conditions.
*/
_registerChild() {
setTimeout(() => {
this.node.send([
null,
null,
{ topic: 'registerChild', payload: this.config.general.id, positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' },
]);
}, 100);
}
/**
* Start the periodic tick loop.
*/
_startTickLoop() {
setTimeout(() => {
this._tickInterval = setInterval(() => this._tick(), 1000);
// Update node status on nodered screen every second ( this is not the best way to do this, but it works for now)
this._statusInterval = setInterval(() => {
const status = this._updateNodeStatus();
this.node.status(status);
}, 1000);
}, 1000);
}
/**
* Execute a single tick: update measurement, format and send outputs.
*/
_tick() {
this.source.tick();
const raw = this.source.getOutput();
const processMsg = this._output.formatMsg(raw, this.config, 'process');
const influxMsg = this._output.formatMsg(raw, this.config, 'influxdb');
// Send only updated outputs on ports 0 & 1
this.node.send([processMsg, influxMsg]);
}
/**
* Attach the node's input handler, routing control messages to the class.
*/
_attachInputHandler() {
this.node.on('input', (msg, send, done) => {
/* Update to complete event based node by putting the tick function after an input event */
const m = this.source;
switch(msg.topic) {
case 'registerChild':
// Register this node as a child of the parent node
const childId = msg.payload;
const childObj = this.RED.nodes.getNode(childId);
m.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
break;
case 'setMode':
m.setMode(msg.payload);
break;
case 'execSequence':
const { source, action, parameter } = msg.payload;
m.handleInput(source, action, parameter);
break;
case 'execMovement':
const { source: mvSource, action: mvAction, setpoint } = msg.payload;
m.handleInput(mvSource, mvAction, Number(setpoint));
break;
case 'flowMovement':
const { source: fmSource, action: fmAction, setpoint: fmSetpoint } = msg.payload;
m.handleInput(fmSource, fmAction, Number(fmSetpoint));
break;
case 'emergencystop':
const { source: esSource, action: esAction } = msg.payload;
m.handleInput(esSource, esAction);
break;
case 'showWorkingCurves':
m.showWorkingCurves();
send({ topic : "Showing curve" , payload: m.showWorkingCurves() });
break;
case 'CoG':
m.showCoG();
send({ topic : "Showing CoG" , payload: m.showCoG() });
break;
}
});
}
/**
* Clean up timers and intervals when Node-RED stops the node.
*/
_attachCloseHandler() {
this.node.on('close', (done) => {
clearInterval(this._tickInterval);
clearInterval(this._statusInterval);
done();
});
}
}

View File

@@ -1,60 +0,0 @@
'use strict';
// Sampling-cabinet boundary + target math + rain-scaled flow prediction.
// All operations are pure given a domain handle — the domain owns the
// mutable fields (maxVolume, targetPuls, …) so legacy tests that read
// `monster.maxVolume` keep working.
const RAIN_STALE_MS = 2 * 60 * 60 * 1000;
function applyBoundsAndTargets(m) {
m.maxVolume = m.maxWeight - m.emptyWeightBucket;
m.minPuls = Math.round(m.minVolume / m.volume_pulse);
m.maxPuls = Math.round(m.maxVolume / m.volume_pulse);
m.absMaxPuls = Math.round(m.cap_volume / m.volume_pulse);
m.targetVolume = m.minVolume * Math.sqrt(m.maxVolume / m.minVolume);
m.targetPuls = Math.round(m.targetVolume / m.volume_pulse);
}
function validateFlowBounds(m) {
// nominalFlowMin / flowMax must be declared in monster.json's `constraints`
// section. If they aren't, configUtils strips them as unknown keys and the
// bounds collapse to undefined → NaN → invalid here, which silently blocks
// every sampling run. (Fixed 2026-05-11.)
const min = Number(m.nominalFlowMin);
const max = Number(m.flowMax);
const valid = Number.isFinite(min) && Number.isFinite(max) && min >= 0 && max > 0 && min < max;
m.invalidFlowBounds = !valid;
if (!valid) m.logger.warn(`Invalid flow bounds. nominalFlowMin=${m.nominalFlowMin}, flowMax=${m.flowMax}`);
return valid;
}
function getRainIndex(m) {
if (!m.lastRainUpdate) return 0;
if (Date.now() - m.lastRainUpdate > RAIN_STALE_MS) return 0;
return Number.isFinite(m.avgRain) ? m.avgRain : 0;
}
function getPredictedFlowRate(m) {
const min = Number(m.nominalFlowMin);
const max = Number(m.flowMax);
if (!Number.isFinite(min) || !Number.isFinite(max) || min < 0 || max <= 0 || min >= max) return 0;
const rainIndex = getRainIndex(m);
const scale = Math.max(0, Math.min(1, m.rainMaxRef > 0 ? rainIndex / m.rainMaxRef : 0));
return min + (max - min) * scale;
}
function getSampleCooldownMs(m) {
if (!m.lastSampleTime) return 0;
const remaining = (m.minSampleIntervalSec * 1000) - (Date.now() - m.lastSampleTime);
return Math.max(0, remaining);
}
module.exports = {
applyBoundsAndTargets,
validateFlowBounds,
getRainIndex,
getPredictedFlowRate,
getSampleCooldownMs,
RAIN_STALE_MS,
};

View File

@@ -1,58 +0,0 @@
'use strict';
// Rain-data aggregator — sums per-location hourly precipitation, weighted
// by per-hour probability, and stores both the raw and probability-weighted
// values keyed by timestamp. sumRain/avgRain feed parameters.getRainIndex
// which scales the predicted flow rate between nominalFlowMin and flowMax.
class RainAggregator {
constructor({ logger } = {}) {
this.logger = logger;
this.aggregatedOutput = {};
this.sumRain = 0;
this.avgRain = 0;
}
// Returns the aggregated per-location object so callers can chain.
// Mutates this.aggregatedOutput / sumRain / avgRain in place.
update(value) {
if (!value) return this.aggregatedOutput;
const totalRaw = {};
const totalProb = {};
let numberOfLocations = 0;
Object.entries(value).forEach(([locationKey, location]) => {
numberOfLocations++;
const slot = (this.aggregatedOutput[locationKey] = {
tag: { latitude: location.latitude, longitude: location.longitude },
precipationRaw: {},
precipationProb: {},
});
Object.entries(location.hourly.time).forEach(([key, time]) => {
const currTimestamp = new Date(time).getTime();
let probability = 100;
if (typeof location.hourly.precipitation_probability !== 'undefined') {
probability = location.hourly.precipitation_probability[key];
}
if (probability > 0) probability /= 100;
if (totalRaw[currTimestamp] === undefined) totalRaw[currTimestamp] = 0;
if (totalProb[currTimestamp] === undefined) totalProb[currTimestamp] = 0;
totalRaw[currTimestamp] += location.hourly.precipitation[key];
totalProb[currTimestamp] += location.hourly.precipitation[key] * probability;
slot.precipationRaw[key] = { val: location.hourly.precipitation[key], time: currTimestamp };
slot.precipationProb[key] = { val: probability, time: currTimestamp };
});
});
this.sumRain = Object.values(totalProb).reduce((s, v) => s + v, 0);
this.avgRain = numberOfLocations > 0 ? this.sumRain / numberOfLocations : 0;
return this.aggregatedOutput;
}
}
module.exports = RainAggregator;

View File

@@ -1,113 +0,0 @@
'use strict';
// Sampling program — the time-driven core. Each tick:
// 1. on i_start or scheduled date → init a sampling run (m3PerPuls, stop_time)
// 2. while running: integrate m3PerTick into temp_pulse; emit a pulse when
// it crosses 1 unless the cooldown guard blocks it
// 3. after stop_time: clear running state.
// flowCalc derives m3PerTick from the latest q (m3/h) and the wall-clock
// delta since the last call — runs once per tick before sampling_program.
const params = require('../parameters/parameters');
const { regNextDate } = require('../schedule/schedule');
function getModelPrediction(m) {
const samplingHours = Number(m.sampling_time) || 0;
const predictedRate = params.getPredictedFlowRate(m);
const fallbackRate = m.flowTracker.getEffectiveFlow();
const flowM3PerHour = predictedRate > 0 ? predictedRate : fallbackRate;
m.predFlow = Math.max(0, flowM3PerHour * samplingHours);
return m.predFlow;
}
function flowCalc(m) {
const timePassed = m.flowTime > 0 ? (Date.now() - m.flowTime) / 1000 : 0;
m.m3PerTick = (m.q / 60 / 60) * timePassed;
m.flowTime = Date.now();
}
function _beginRun(m) {
m.running = true;
m.temp_pulse = 0;
m.pulse = false;
m.updateBucketVol(0);
m.sumPuls = 0;
m.m3Total = 0;
m.timePassed = 0;
m.timeLeft = 0;
m.predM3PerSec = 0;
getModelPrediction(m);
m.m3PerPuls = Math.round(m.predFlow / m.targetPuls);
m.predM3PerSec = m.predFlow / m.sampling_time / 60 / 60;
m.start_time = Date.now();
m.stop_time = Date.now() + (m.sampling_time * 60 * 60 * 1000);
regNextDate(m, m.monsternametijden);
m.i_start = false;
}
function _endRun(m) {
m.m3PerPuls = 0;
m.temp_pulse = 0;
m.pulse = false;
m.updateBucketVol(0);
m.sumPuls = 0;
m.timePassed = 0;
m.timeLeft = 0;
m.predFlow = 0;
m.predM3PerSec = 0;
m.m3Total = 0;
m.running = false;
}
function _maybeEmitPulse(m) {
if (!(m.temp_pulse >= 1 && m.sumPuls < m.absMaxPuls)) {
if (m.pulse) m.pulse = false;
return;
}
const now = Date.now();
const cooldownMs = m.minSampleIntervalSec * 1000;
const blocked = m.lastSampleTime && (now - m.lastSampleTime) < cooldownMs;
if (blocked) {
m.missedSamples++;
m.pulse = false;
m.temp_pulse = Math.min(m.temp_pulse, 1);
if (!m.lastSampleWarnTime || (now - m.lastSampleWarnTime) > cooldownMs) {
m.lastSampleWarnTime = now;
m.logger.warn(`Sampling too fast. Cooldown active for ${Math.ceil((cooldownMs - (now - m.lastSampleTime)) / 1000)}s.`);
}
return;
}
m.temp_pulse -= 1;
m.pulse = true;
m.lastSampleTime = now;
m.sumPuls++;
m.updateBucketVol(Math.round(m.sumPuls * m.volume_pulse * 100) / 100);
}
function samplingProgram(m) {
if (((m.i_start) || (Date.now() >= m.nextDate)) && !m.running) {
if (!params.validateFlowBounds(m)) {
m.running = false;
m.i_start = false;
return;
}
_beginRun(m);
}
if (m.stop_time > Date.now()) {
m.timePassed = Math.round((Date.now() - m.start_time) / 1000);
m.timeLeft = Math.round((m.stop_time - Date.now()) / 1000);
m.temp_pulse += m.m3PerTick / m.m3PerPuls;
m.m3Total += m.m3PerTick;
_maybeEmitPulse(m);
} else if (m.running) {
_endRun(m);
}
}
module.exports = { samplingProgram, flowCalc, getModelPrediction };

View File

@@ -1,42 +0,0 @@
'use strict';
// AQUON sample schedule helpers. updateMonsternametijden validates the
// row shape before storing; regNextDate walks the rows to find the next
// future START_DATE for the configured aquonSampleName and counts how
// many of those fall in the current calendar year.
function updateMonsternametijden(m, value) {
if (!m.init || !value || Object.keys(value).length === 0) return;
if (
typeof value[0]?.SAMPLE_NAME !== 'undefined' &&
typeof value[0]?.DESCRIPTION !== 'undefined' &&
typeof value[0]?.SAMPLED_DATE !== 'undefined' &&
typeof value[0]?.START_DATE !== 'undefined' &&
typeof value[0]?.END_DATE !== 'undefined'
) {
m.monsternametijden = value;
regNextDate(m, value);
}
}
function regNextDate(m, monsternametijden) {
let next_date = new Date(new Date().setFullYear(new Date().getFullYear() + 1));
let n_days_remaining = 0;
if (typeof monsternametijden !== 'undefined') {
Object.values(monsternametijden).forEach((line) => {
if (line.START_DATE === 'NULL') return;
const curr_date_conv = new Date(line.START_DATE);
const curr_date = curr_date_conv.getTime();
if (line.SAMPLE_NAME === m.aquonSampleName && curr_date > Date.now()) {
if (curr_date < next_date) next_date = curr_date;
if (new Date().getFullYear() === curr_date_conv.getFullYear()) n_days_remaining++;
}
});
}
m.daysPerYear = n_days_remaining;
m.nextDate = next_date;
}
module.exports = { updateMonsternametijden, regNextDate };

View File

@@ -1,163 +0,0 @@
'use strict';
// Monster — multi-parameter biological process monitoring (Unit-level).
// Orchestrator only: wires the parameters/flow/rain/schedule/sampling
// modules in configure() and calls them in tick(). The mutable sampling
// state (running, sumPuls, m3PerPuls, …) lives on `this` so the existing
// test surface (`monster.bucketVol`, `monster.q`, …) keeps working.
const { BaseDomain } = require('generalFunctions');
const params = require('./parameters/parameters');
const FlowTracker = require('./flow/flowTracker');
const RainAggregator = require('./rain/rainAggregator');
const schedule = require('./schedule/schedule');
const sampling = require('./sampling/samplingProgram');
const { buildOutput } = require('./io/output');
const { buildStatusBadge } = require('./io/statusBadge');
class Monster extends BaseDomain {
static name = 'monster';
configure() {
this.init = false;
this._initState();
this._initSamplingDefaults();
this.flowTracker = new FlowTracker({ measurements: this.measurements, logger: this.logger });
this.rainAggregator = new RainAggregator({ logger: this.logger });
if (Number.isFinite(this.config?.constraints?.maxRainRef)) {
this.rainMaxRef = this.config.constraints.maxRainRef;
}
this.init = true;
params.applyBoundsAndTargets(this);
this.router.onRegister('measurement', (child) => this._wireMeasurementChild(child));
}
_initState() {
this.aquonSampleName = '112100';
this.monsternametijden = {};
this.rain_data = {};
this.aggregatedOutput = {};
this.sumRain = 0;
this.avgRain = 0;
this.daysPerYear = 0;
this.lastRainUpdate = 0;
this.rainMaxRef = 10;
this.predFactor = 0.7;
this.start_time = Date.now();
this.stop_time = Date.now();
this.flowTime = 0;
this.timePassed = 0;
this.timeLeft = 0;
this.currHour = new Date().getHours();
}
_initSamplingDefaults() {
const c = this.config.constraints || {};
const a = this.config.asset || {};
this.pulse = false;
this.bucketVol = 0;
this.sumPuls = 0;
this.predFlow = 0;
this.bucketWeight = 0;
this.q = 0;
this.i_start = false;
this.sampling_time = c.samplingtime;
this.emptyWeightBucket = a.emptyWeightBucket;
this.nominalFlowMin = c.nominalFlowMin;
this.flowMax = c.flowMax;
this.minSampleIntervalSec = c.minSampleIntervalSec || 60;
this.temp_pulse = 0;
this.volume_pulse = 0.05;
this.minVolume = c.minVolume;
this.maxVolume = 0;
this.maxWeight = c.maxWeight;
this.cap_volume = 55;
this.targetVolume = 0;
this.minPuls = 0;
this.maxPuls = 0;
this.absMaxPuls = 0;
this.targetPuls = 0;
this.m3PerPuls = 0;
this.predM3PerSec = 0;
this.m3PerTick = 0;
this.m3Total = 0;
this.running = false;
this.invalidFlowBounds = false;
this.lastSampleTime = 0;
this.lastSampleWarnTime = 0;
this.missedSamples = 0;
}
_wireMeasurementChild(child) {
if (!child?.measurements?.emitter) return;
const childType = child?.config?.asset?.type;
if (childType && childType !== 'flow') return;
const handler = (eventData) => this.flowTracker.handleMeasuredFlow(eventData);
child.measurements.emitter.on('flow.measured.upstream', handler);
child.measurements.emitter.on('flow.measured.downstream', handler);
child.measurements.emitter.on('flow.measured.atequipment', handler);
}
handleInput(topic, payload) {
switch (topic) {
case 'i_start': this.i_start = Boolean(payload); break;
case 'monsternametijden': schedule.updateMonsternametijden(this, payload); break;
case 'rain_data': this.updateRainData(payload); break;
case 'input_q': this.flowTracker.updateManualFlow(payload); break;
default: break;
}
}
updateRainData(value) {
this.rain_data = value;
this.lastRainUpdate = Date.now();
if (this.init && !this.running) {
this.aggregatedOutput = this.rainAggregator.update(value);
this.sumRain = this.rainAggregator.sumRain;
this.avgRain = this.rainAggregator.avgRain;
}
}
updateBucketVol(val) {
this.bucketVol = val;
this.bucketWeight = val + this.emptyWeightBucket;
}
// Public surface kept for legacy tests (sampling-guards, factories.js).
getSampleCooldownMs() { return params.getSampleCooldownMs(this); }
validateFlowBounds() { return params.validateFlowBounds(this); }
getRainIndex() { return params.getRainIndex(this); }
getPredictedFlowRate() { return params.getPredictedFlowRate(this); }
getMeasuredFlow() { return this.flowTracker.getMeasuredFlow(); }
getManualFlow() { return this.flowTracker.getManualFlow(); }
getEffectiveFlow() { return this.flowTracker.getEffectiveFlow(); }
get_model_prediction() { return sampling.getModelPrediction(this); }
flowCalc() { sampling.flowCalc(this); }
sampling_program() { sampling.samplingProgram(this); }
set_boundries_and_targets() { params.applyBoundsAndTargets(this); }
regNextDate(rows) { schedule.regNextDate(this, rows); }
updateMonsternametijden(v) { schedule.updateMonsternametijden(this, v); }
updatePredRain(v) { return this.rainAggregator.update(v); }
tick() {
this.logger.debug('Monster tick running');
this.q = this.flowTracker.getEffectiveFlow();
this.flowCalc();
this.sampling_program();
this.notifyOutputChanged();
}
getOutput() { return buildOutput(this); }
getStatusBadge() { return buildStatusBadge(this); }
}
module.exports = Monster;

View File

@@ -1,12 +0,0 @@
# monster Test Suite Layout
Required EVOLV layout:
- basic/
- integration/
- edge/
- helpers/
Baseline structure tests:
- basic/structure-module-load.basic.test.js
- integration/structure-examples.integration.test.js
- edge/structure-examples-node-type.edge.test.js

View File

@@ -1,27 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const Monster = require('../../src/specificClass');
const { makeMonsterConfig } = require('../helpers/factories');
test('constructor initializes sampling boundaries and target values', () => {
const monster = new Monster(makeMonsterConfig());
assert.equal(monster.maxVolume, 20);
assert.equal(monster.minPuls, Math.round(monster.minVolume / monster.volume_pulse));
assert.equal(monster.absMaxPuls, Math.round(monster.cap_volume / monster.volume_pulse));
assert.ok(monster.targetPuls > 0);
});
test('output contract contains report tooling fields', () => {
const monster = new Monster(makeMonsterConfig());
const output = monster.getOutput();
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPuls'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPulse'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3Total'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulse'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulsesRemaining'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
});

View File

@@ -1,8 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
test('monster module load smoke', () => {
assert.doesNotThrow(() => {
require('../../monster.js');
});
});

View File

View File

@@ -1,58 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const Monster = require('../../src/specificClass');
const { makeMonsterConfig, withMockedDate } = require('../helpers/factories');
test('invalid flow bounds prevent sampling start', () => {
const monster = new Monster(
makeMonsterConfig({
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
nominalFlowMin: 10,
flowMax: 5,
minSampleIntervalSec: 60,
},
})
);
monster.handleInput('i_start', true);
monster.sampling_program();
assert.equal(monster.invalidFlowBounds, true);
assert.equal(monster.running, false);
assert.equal(monster.i_start, false);
});
test('cooldown guard blocks pulses when flow implies oversampling', () => {
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
const monster = new Monster(
makeMonsterConfig({
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
nominalFlowMin: 0,
flowMax: 6000,
maxRainRef: 10,
minSampleIntervalSec: 60,
},
})
);
monster.handleInput('input_q', { value: 200, unit: 'm3/h' });
monster.handleInput('i_start', true);
for (let i = 0; i < 80; i++) {
advance(1000);
monster.tick();
}
assert.ok(monster.sumPuls > 0);
assert.ok(monster.bucketVol > 0);
assert.ok(monster.missedSamples > 0);
assert.ok(monster.getSampleCooldownMs() > 0);
});
});

View File

@@ -1,21 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const dir = path.resolve(__dirname, '../../examples');
const exampleFlows = [
'basic.flow.json',
'integration.flow.json',
'edge.flow.json',
'monster-dashboard.flow.json',
'monster-api-dashboard.flow.json'
];
test('all example flows include node type monster', () => {
for (const file of exampleFlows) {
const flow = JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8'));
const count = flow.filter((n) => n && n.type === 'monster').length;
assert.equal(count >= 1, true, file + ' missing monster node');
}
});

View File

View File

@@ -1,128 +0,0 @@
const fs = require('node:fs');
const path = require('node:path');
const { MeasurementContainer } = require('generalFunctions');
function makeMonsterConfig(overrides = {}) {
return {
general: {
name: 'Monster Test',
logging: { enabled: false, logLevel: 'error' },
},
asset: {
emptyWeightBucket: 3,
},
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
nominalFlowMin: 1000,
flowMax: 6000,
maxRainRef: 10,
minSampleIntervalSec: 60,
},
...overrides,
};
}
function withMockedDate(iso, fn) {
const RealDate = Date;
let now = new RealDate(iso).getTime();
class MockDate extends RealDate {
constructor(...args) {
if (args.length === 0) {
super(now);
} else {
super(...args);
}
}
static now() {
return now;
}
}
global.Date = MockDate;
try {
return fn({
advance(ms) {
now += ms;
},
});
} finally {
global.Date = RealDate;
}
}
function parseMonsternametijdenCsv(filePath) {
const raw = fs.readFileSync(filePath, 'utf8').trim();
const lines = raw.split(/\r?\n/);
const header = lines.shift();
const columns = header.split(',');
return lines
.filter((line) => line && !line.startsWith('-----------'))
.map((line) => {
const parts = [];
let cur = '';
let inQ = false;
for (let i = 0; i < line.length; i++) {
const ch = line[i];
if (ch === '"') {
inQ = !inQ;
continue;
}
if (ch === ',' && !inQ) {
parts.push(cur);
cur = '';
} else {
cur += ch;
}
}
parts.push(cur);
const obj = {};
columns.forEach((col, idx) => {
obj[col] = parts[idx];
});
return obj;
});
}
function makeFlowMeasurementChild({
id = 'flow-child-1',
name = 'FlowSensor',
positionVsParent = 'downstream',
unit = 'm3/h',
} = {}) {
const measurements = new MeasurementContainer({
autoConvert: true,
defaultUnits: { flow: 'm3/h' },
});
return {
config: {
general: { id, name, unit },
functionality: { positionVsParent },
asset: { type: 'flow', unit },
},
measurements,
};
}
function loadRainSeed() {
const rainPath = path.join(__dirname, '..', 'seed_data', 'raindataFormat.json');
return JSON.parse(fs.readFileSync(rainPath, 'utf8'));
}
function loadScheduleSeed() {
const csvPath = path.join(__dirname, '..', 'seed_data', 'monsternametijden.csv');
return parseMonsternametijdenCsv(csvPath);
}
module.exports = {
makeMonsterConfig,
withMockedDate,
makeFlowMeasurementChild,
loadRainSeed,
loadScheduleSeed,
};

View File

@@ -1,49 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const Monster = require('../../src/specificClass');
const {
makeMonsterConfig,
withMockedDate,
makeFlowMeasurementChild,
loadRainSeed,
loadScheduleSeed,
} = require('../helpers/factories');
test('effective flow uses average of measured and manual flow', () => {
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
const monster = new Monster(makeMonsterConfig());
const child = makeFlowMeasurementChild({ positionVsParent: 'downstream' });
monster.registerChild(child, 'measurement');
child.measurements
.type('flow')
.variant('measured')
.position('downstream')
.value(60, Date.now(), 'm3/h');
monster.handleInput('input_q', { value: 20, unit: 'm3/h' });
advance(1000);
monster.tick();
assert.equal(monster.q, 40);
});
});
test('rain and schedule payloads update prediction context and next date', () => {
withMockedDate('2024-10-15T00:00:00Z', () => {
const monster = new Monster(makeMonsterConfig());
const rain = loadRainSeed();
const schedule = loadScheduleSeed();
monster.aquonSampleName = '112100';
monster.handleInput('rain_data', rain);
monster.handleInput('monsternametijden', schedule);
assert.ok(monster.avgRain >= 0);
assert.ok(monster.sumRain >= 0);
const nextDate = monster.nextDate instanceof Date ? monster.nextDate.getTime() : Number(monster.nextDate);
assert.ok(Number.isFinite(nextDate));
assert.ok(nextDate > Date.now());
});
});

View File

@@ -1,32 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const dir = path.resolve(__dirname, '../../examples');
const requiredFiles = [
'README.md',
'basic.flow.json',
'integration.flow.json',
'edge.flow.json',
'monster-dashboard.flow.json',
'monster-api-dashboard.flow.json'
];
const flowFiles = requiredFiles.filter((file) => file.endsWith('.flow.json'));
function loadJson(file) {
return JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8'));
}
test('examples package exists for monster', () => {
for (const file of requiredFiles) {
assert.equal(fs.existsSync(path.join(dir, file)), true, file + ' missing');
}
});
test('example flows are parseable arrays for monster', () => {
for (const file of flowFiles) {
const parsed = loadJson(file);
assert.equal(Array.isArray(parsed), true);
}
});

View File

@@ -1,257 +0,0 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const Monster = require('../src/specificClass');
const { MeasurementContainer } = require('generalFunctions');
function test(name, fn) {
try {
fn();
console.log(`ok - ${name}`);
} catch (err) {
console.error(`not ok - ${name}`);
console.error(err);
process.exitCode = 1;
}
}
function withMockedDate(iso, fn) {
const RealDate = Date;
let now = new RealDate(iso).getTime();
class MockDate extends RealDate {
constructor(...args) {
if (args.length === 0) {
super(now);
} else {
super(...args);
}
}
static now() {
return now;
}
}
global.Date = MockDate;
try {
return fn({
advance(ms) {
now += ms;
}
});
} finally {
global.Date = RealDate;
}
}
function buildConfig(overrides = {}) {
return {
general: {
name: 'Monster Test',
logging: { enabled: false, logLevel: 'error' }
},
asset: {
emptyWeightBucket: 3
},
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
nominalFlowMin: 1,
flowMax: 10
},
...overrides
};
}
function parseMonsternametijdenCsv(filePath) {
const raw = fs.readFileSync(filePath, 'utf8').trim();
const lines = raw.split(/\r?\n/);
const header = lines.shift();
const columns = header.split(',');
return lines
.filter((line) => line && !line.startsWith('-----------'))
.map((line) => {
const parts = [];
let cur = '';
let inQ = false;
for (let i = 0; i < line.length; i++) {
const ch = line[i];
if (ch === '"') {
inQ = !inQ;
continue;
}
if (ch === ',' && !inQ) {
parts.push(cur);
cur = '';
} else {
cur += ch;
}
}
parts.push(cur);
const obj = {};
columns.forEach((col, idx) => {
obj[col] = parts[idx];
});
return obj;
});
}
test('measured + manual flow averages into effective flow', () => {
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
const monster = new Monster(buildConfig());
const child = {
config: {
general: { id: 'child-1', name: 'FlowSensor' },
asset: { type: 'flow' }
},
measurements: new MeasurementContainer({
autoConvert: true,
defaultUnits: { flow: 'm3/h' }
})
};
monster.registerChild(child, 'measurement');
child.measurements
.type('flow')
.variant('measured')
.position('downstream')
.value(60, Date.now(), 'm3/h');
monster.handleInput('input_q', { value: 20, unit: 'm3/h' });
advance(1000);
monster.tick();
assert.strictEqual(monster.q, 40);
});
});
test('invalid flow bounds prevent sampling start', () => {
const monster = new Monster(buildConfig({
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
nominalFlowMin: 10,
flowMax: 5
}
}));
monster.handleInput('i_start', true);
monster.sampling_program();
assert.strictEqual(monster.invalidFlowBounds, true);
assert.strictEqual(monster.running, false);
assert.strictEqual(monster.i_start, false);
});
test('flowCalc uses elapsed time to compute m3PerTick', () => {
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
const monster = new Monster(buildConfig());
monster.q = 36; // m3/h
monster.flowCalc();
assert.strictEqual(monster.m3PerTick, 0);
advance(10000);
monster.flowCalc();
const expected = 0.1; // 36 m3/h -> 0.01 m3/s over 10s
assert.ok(Math.abs(monster.m3PerTick - expected) < 1e-6);
});
});
test('prediction fallback uses nominalFlowMin * sampling_time when rain is stale', () => {
const monster = new Monster(buildConfig());
monster.nominalFlowMin = 4;
monster.flowMax = 10;
monster.rainMaxRef = 8;
monster.sampling_time = 24;
monster.lastRainUpdate = 0;
const pred = monster.get_model_prediction();
assert.strictEqual(pred, 96);
});
test('pulses increment when running with manual flow and zero nominalFlowMin', () => {
withMockedDate('2024-10-15T00:00:00Z', ({ advance }) => {
const monster = new Monster(buildConfig({
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
nominalFlowMin: 0,
flowMax: 6000,
minSampleIntervalSec: 60,
maxRainRef: 10
}
}));
monster.handleInput('input_q', { value: 200, unit: 'm3/h' });
monster.handleInput('i_start', true);
for (let i = 0; i < 80; i++) {
advance(1000);
monster.tick();
}
assert.ok(monster.sumPuls > 0);
assert.ok(monster.bucketVol > 0);
assert.ok(monster.missedSamples > 0);
assert.ok(monster.getSampleCooldownMs() > 0);
});
});
test('rain data aggregation produces totals', () => {
const monster = new Monster(buildConfig());
const rainPath = path.join(__dirname, 'seed_data', 'raindataFormat.json');
const rainData = JSON.parse(fs.readFileSync(rainPath, 'utf8'));
monster.updateRainData(rainData);
assert.ok(Object.keys(monster.aggregatedOutput).length > 0);
assert.ok(monster.sumRain >= 0);
assert.ok(monster.avgRain >= 0);
});
test('monsternametijden schedule sets next date', () => {
withMockedDate('2024-10-15T00:00:00Z', () => {
const monster = new Monster(buildConfig());
const csvPath = path.join(__dirname, 'seed_data', 'monsternametijden.csv');
const rows = parseMonsternametijdenCsv(csvPath);
monster.aquonSampleName = '112100';
monster.updateMonsternametijden(rows);
const nextDate = monster.nextDate instanceof Date
? monster.nextDate.getTime()
: Number(monster.nextDate);
assert.ok(Number.isFinite(nextDate));
assert.ok(nextDate > Date.now());
});
});
test('output includes pulse and flow fields', () => {
const monster = new Monster(buildConfig());
const output = monster.getOutput();
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulse'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'q'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPuls'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPulse'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulsesRemaining'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulseFraction'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'flowToNextPulseM3'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'timeToNextPulseSec'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetVolumeM3'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetProgressPct'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaL'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
});

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,95 +0,0 @@
const Monster = require('../src/specificClass');
describe('monster specificClass', () => {
function createMonster(overrides = {}) {
return new Monster({
general: {
name: 'Monster Test',
unit: 'm3/h',
logging: {
enabled: false,
logLevel: 'error',
},
},
asset: {
emptyWeightBucket: 3,
},
constraints: {
samplingtime: 1,
minVolume: 5,
maxWeight: 23,
},
functionality: {
aquonSampleName: '112100',
},
...overrides,
});
}
test('aggregates rain data and exposes output state', () => {
const monster = createMonster();
monster.rain_data = [
{
latitude: 51.7,
longitude: 4.81,
hourly: {
time: ['2026-03-12T00:00', '2026-03-12T01:00'],
precipitation: [1, 3],
precipitation_probability: [100, 50],
},
},
{
latitude: 51.8,
longitude: 4.91,
hourly: {
time: ['2026-03-12T00:00', '2026-03-12T01:00'],
precipitation: [2, 2],
precipitation_probability: [100, 100],
},
},
];
const output = monster.getOutput();
expect(monster.sumRain).toBe(6.5);
expect(monster.avgRain).toBe(3.25);
expect(output.sumRain).toBe(6.5);
expect(output.avgRain).toBe(3.25);
});
test('supports external prediction input and starts sampling safely', () => {
const monster = createMonster();
monster.setModelPrediction(120);
monster.q = 3600;
monster.i_start = true;
monster.flowTime = Date.now() - 1000;
monster.tick();
const output = monster.getOutput();
expect(output.running).toBe(true);
expect(output.predFlow).toBe(120);
expect(output.predM3PerSec).toBeCloseTo(120 / 3600, 6);
});
test('calculates the next AQUON date from monsternametijden input', () => {
const monster = createMonster();
const nextMonth = new Date();
nextMonth.setMonth(nextMonth.getMonth() + 1);
monster.monsternametijden = [
{
SAMPLE_NAME: '112100',
DESCRIPTION: 'future sample',
SAMPLED_DATE: null,
START_DATE: nextMonth.toISOString(),
END_DATE: nextMonth.toISOString(),
},
];
expect(monster.daysPerYear).toBeGreaterThanOrEqual(0);
expect(monster.nextDate).toBeGreaterThan(Date.now());
});
});

View File

@@ -1,172 +0,0 @@
# monster
![code-ref](https://img.shields.io/badge/code--ref-cd185dc-blue) ![s88](https://img.shields.io/badge/S88-Unit-50a8d9) ![status](https://img.shields.io/badge/status-stub--tier-orange)
A `monster` models the physical "monsternamekast" (composite-sampling cabinet) on a wastewater treatment plant. It runs an AQUON-scheduled, flow-proportional sampling program: aggregates measured + manual flow, blends in a rain-scaled prediction, integrates volume, and emits a `pulse` event whenever the integrated volume crosses `m³ per pulse`. Used downstream of `reactor` / `settler` for compliance + process diagnostics — but note that the node only **integrates flow** in the current implementation; multi-constituent reporting (NH4, NO3, COD, TSS, …) is a downstream consumer concern, not produced by this node.
> [!NOTE]
> Pending full node review (2026-05). Content reflects `CONTRACT.md` and current source only.
---
## At a glance
| Thing | Value |
|:---|:---|
| What it represents | One composite-sampling cabinet running AQUON-scheduled, flow-proportional sampling |
| S88 level | Unit |
| Use it when | You need scheduled composite samples with flow-proportional pulses for a benchtop analyser / lab pickup |
| Don't use it for | Generic flow totalising (use `measurement`), ad-hoc grab samples (fire `cmd.start` once instead), or analyser results — monster emits pulses, not analyte values |
| Children it accepts | `measurement` with `asset.type='flow'` (or unset) |
| Parents it talks to | Any node that issues `cmd.start` / `set.schedule` / `set.rain` / `data.flow` (typically a Process Cell coordinator) |
---
## How it fits
```mermaid
flowchart LR
parent[plant parent<br/>Process Cell]:::pc
monster[monster<br/>Unit]:::unit
flow_up[measurement<br/>type=flow<br/>position=upstream]:::ctrl
flow_at[measurement<br/>type=flow<br/>position=atequipment]:::ctrl
flow_dn[measurement<br/>type=flow<br/>position=downstream]:::ctrl
op[(operator / AQUON)]
weather[(Open-Meteo)]
flow_up -->|flow.measured.upstream| monster
flow_at -->|flow.measured.atequipment| monster
flow_dn -->|flow.measured.downstream| monster
op -->|set.schedule / data.flow / cmd.start| monster
weather -->|set.rain| monster
monster -->|child.register| parent
monster -.evt output (pulse / bucketVol).-> parent
classDef pc fill:#0c99d9,color:#fff
classDef unit fill:#50a8d9,color:#000
classDef ctrl fill:#a9daee,color:#000
```
S88 colours are anchored in `.claude/rules/node-red-flow-layout.md`. The editor node tile in `monster.html` is currently `#4f8582` (teal) and pending cleanup — Section 16 of the layout rules tracks it.
---
## Try it &mdash; 3-minute demo
Import the basic example flow, deploy, and drive the sampler through a single run.
```bash
curl -X POST -H 'Content-Type: application/json' \
--data @nodes/monster/examples/basic.flow.json \
http://localhost:1880/flow
```
What to click after deploy (the inject buttons map to the topics in [Reference &mdash; Contracts](Reference-Contracts#topic-contract)):
1. `set.rain` &mdash; push an Open-Meteo precipitation snapshot so `sumRain` / `avgRain` populate (otherwise the rain-scaled prediction stays at `nominalFlowMin`).
2. `set.schedule` &mdash; push an AQUON row array so `nextDate` arms.
3. `data.flow = {value: 240, unit: 'm3/h'}` &mdash; supply a manual flow value (or wire a `measurement` child for the measured path).
4. `cmd.start = true` &mdash; releases the start gate. On the next 1000 ms tick the sampling program checks `validateFlowBounds`; if `nominalFlowMin < flowMax`, `_beginRun` fires, `running` flips to `true`, and the bucket integrator starts.
5. Watch Port 0: `pulse` blips to `true` for one tick whenever `temp_pulse` crosses 1; `bucketVol` rises in 50 mL steps (the hard-coded `subSampleVolume`); `sumPuls` increments.
6. After `constraints.samplingtime` hours `_endRun` fires and `running` flips to `false`.
> [!IMPORTANT]
> **GIF needed.** Demo recording of steps 1&ndash;6 with the live status panel. Save as `wiki/_partial-gifs/monster/basic-demo.gif`, target &le; 1&nbsp;MB after `gifsicle -O3 --lossy=80`.
---
## The seven things you'll send
| Topic | Aliases | Payload | What it does |
|:---|:---|:---|:---|
| `cmd.start` | `i_start` | truthy / falsy | Sets `source.i_start`. On the next tick a sampling run begins if `validateFlowBounds` passes. |
| `set.schedule` | `monsternametijden` | array of AQUON rows (`SAMPLE_NAME`, `DESCRIPTION`, `SAMPLED_DATE`, `START_DATE`, `END_DATE`) | Stores the schedule and recomputes `nextDate` + `daysPerYear` for the configured `aquonSampleName`. |
| `set.rain` | `rain_data` | per-location rain forecast (Open-Meteo shape) | Aggregates hourly precipitation into `sumRain` / `avgRain`; feeds the rain-scaled flow prediction. Ignored while `running=true`. |
| `data.flow` | `input_q` | `{ value: number, unit: string }` | Converts to m³/h and pushes into `flow.manual.atequipment`. Blends with measured-child flow in `getEffectiveFlow()`. |
| `set.mode` | `setMode` | string | Reserved &mdash; handler delegates to `source.setMode()` which is currently undefined. No-op today. |
| `set.model-prediction` | `model_prediction` | numeric | Reserved &mdash; handler delegates to `source.setModelPrediction()` which is currently undefined. No-op today. |
| `child.register` | `registerChild` | string (child node id) | Register a `measurement` child. Port 2 wiring does this automatically. |
There is no `query.*` topic on monster (unlike `rotatingMachine`'s `query.curves` / `query.cog`). All state is on Port 0.
---
## What you'll see come out
Sample Port 0 message (mid-run snapshot, delta-compressed):
```json
{
"topic": "monster#cabinet_1",
"payload": {
"running": true,
"pulse": false,
"bucketVol": 1.25,
"bucketWeight": 4.25,
"sumPuls": 25,
"m3PerPuls": 4,
"m3Total": 100.0,
"q": 215.4,
"predFlow": 240.0,
"predM3PerSec": 0.067,
"timeLeft": 12340,
"timePassed": 600,
"targetVolumeM3": 0.005,
"targetProgressPct": 41.6,
"targetDeltaL": -2.93,
"predictedRateM3h": 240.0,
"sumRain": 3.2,
"avgRain": 0.13,
"nextDate": 1746940800000,
"daysPerYear": 12,
"missedSamples": 0,
"sampleCooldownMs": 0,
"invalidFlowBounds": false
}
}
```
| Field | Meaning |
|:---|:---|
| `running` | Run/idle flag &mdash; monster has no formal FSM, just this boolean and the timer fields below. |
| `pulse` | `true` for the tick on which a pulse is emitted; falls back to `false` on the next tick. |
| `bucketVol` / `bucketWeight` | Accumulated composite volume (L) and total bucket mass (kg = vol + `emptyWeightBucket`). |
| `sumPuls` / `pulsesRemaining` | Pulses fired this run vs target ceiling. |
| `m3PerPuls` | Volume per pulse, set at `_beginRun` from `predFlow / targetPuls`. |
| `m3Total` | Total integrated flow this run (m³). |
| `q` | Effective flow (m³/h) &mdash; `flowTracker.getEffectiveFlow()` blends measured + manual. |
| `predFlow` / `predM3PerSec` | Predicted total volume over the run window (m³) and its average rate. |
| `timeLeft` / `timePassed` | Run-window seconds remaining / elapsed. |
| `targetVolumeM3` / `targetProgressPct` / `targetDeltaL` | Target composite volume (m³), % of target accumulated, signed L delta against target. |
| `predictedRateM3h` | Rain-scaled flow prediction (m³/h) &mdash; between `nominalFlowMin` and `flowMax`. |
| `sumRain` / `avgRain` | Probability-weighted hourly precipitation, summed / averaged across locations. |
| `nextDate` / `daysPerYear` | Next scheduled run epoch ms; count of remaining runs this calendar year. |
| `missedSamples` / `sampleCooldownMs` | Cooldown-blocked pulse count; ms remaining on the active cooldown. |
| `invalidFlowBounds` | True when `nominalFlowMin >= flowMax` &mdash; gates `_beginRun`. |
Full Port-0 key list: see [Reference &mdash; Contracts &mdash; Data model](Reference-Contracts#data-model--getoutput-shape).
Key shape is **flat scalars on the snapshot** plus a `MeasurementContainer.getFlattenedOutput()` flush of `flow.<variant>.<position>` entries. monster does **not** use the four-segment `<type>.<variant>.<position>.<childId>` shape that `rotatingMachine` emits — no `childId` is appended because monster fans incoming children into the same three positions and the latest value wins.
---
## Status badge
| State | Badge | Fill |
|:---|:---|:---|
| `invalidFlowBounds=true` | `Config error: nominalFlowMin (…) >= flowMax (…)` | red |
| `running=true` + cooldown active | `SAMPLING (Ns) · <bucketVol>/<maxVolume> L` | yellow ring |
| `running=true` + normal | `AI: RUNNING · <bucketVol>/<maxVolume> L` | green dot |
| idle | `AI: IDLE` | grey ring |
---
## Need more?
| Page | What you'll find |
|:---|:---|
| [Reference &mdash; Contracts](Reference-Contracts) | Full topic contract, config schema, child registration filters |
| [Reference &mdash; Architecture](Reference-Architecture) | Code map, sampling-program loop, prediction + cooldown pipeline |
| [Reference &mdash; Examples](Reference-Examples) | Shipped example flows + debug recipes |
| [Reference &mdash; Limitations](Reference-Limitations) | When not to use, known limitations, open questions |
[EVOLV master wiki](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Home) &middot; [Topology Patterns](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Topology-Patterns) &middot; [Topic Conventions](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Topic-Conventions)

View File

@@ -1,245 +0,0 @@
# Reference &mdash; Architecture
![code-ref](https://img.shields.io/badge/code--ref-cd185dc-blue)
> [!NOTE]
> Code structure for `monster`: the three-tier sandwich, the `src/` layout, the sampling-program loop, the rain-scaled flow prediction, the cooldown guard, the lifecycle, and the output-port pipeline. For an intuitive overview, return to [Home](Home).
> [!NOTE]
> Pending full node review (2026-05). Content reflects `CONTRACT.md` and current source only.
---
## Three-tier code layout
```
nodes/monster/
|
+-- monster.js entry: RED.nodes.registerType('monster', NodeClass)
|
+-- src/
| nodeClass.js extends BaseNodeAdapter (Node-RED bridge)
| specificClass.js extends BaseDomain (orchestration only)
| |
| +-- commands/
| | index.js topic descriptors (cmd.start / set.schedule / …)
| | handlers.js pure handler functions
| |
| +-- parameters/
| | parameters.js applyBoundsAndTargets / validateFlowBounds /
| | getRainIndex / getPredictedFlowRate /
| | getSampleCooldownMs
| |
| +-- flow/
| | flowTracker.js measured-child latch + manual flow blend
| |
| +-- rain/
| | rainAggregator.js Open-Meteo precipitation fold (sumRain / avgRain)
| |
| +-- schedule/
| | schedule.js AQUON next-date parser + daysPerYear count
| |
| +-- sampling/
| | samplingProgram.js _beginRun / _endRun / _maybeEmitPulse /
| | flowCalc / samplingProgram / getModelPrediction
| |
| +-- io/
| output.js buildOutput() — Port 0 snapshot
| statusBadge.js buildStatusBadge() — editor badge composer
```
### Tier responsibilities
| Tier | File | What it owns | Touches `RED.*` |
|:---|:---|:---|:---:|
| entry | `monster.js` | Type registration; `/monster/menu.js` + `/monster/configData.js` HTTP endpoints | Yes |
| nodeClass | `src/nodeClass.js` | `tickInterval = 1000` (sampling integrator needs wall-clock delta), `statusInterval = 1000`, `buildDomainConfig` slice, `extraSetup` propagates `aquonSampleName` | Yes |
| specificClass | `src/specificClass.js` | Wire concern modules in `configure()`; expose the public surface legacy tests call (`monster.bucketVol`, `monster.q`, `monster.sampling_program()`, …); delegate everything else | No |
`specificClass` is orchestration. Real work lives in the concern modules: pure math in `parameters/`, schedule walking in `schedule/`, aggregation in `rain/`, the sampling integrator in `sampling/`.
---
## Sampling program &mdash; the time-driven core
monster has **no formal FSM**. The `running` boolean toggles when `_beginRun` / `_endRun` fire. The closest analogue to a state diagram is the per-tick decision tree:
```mermaid
flowchart TB
tick[tick&#40;&#41; — every 1000 ms]
tick --> q[q = flowTracker.getEffectiveFlow&#40;&#41;]
q --> fc[flowCalc&#40;&#41;<br/>m3PerTick = q/3600 * dt]
fc --> sp[samplingProgram&#40;&#41;]
sp --> trig{i_start OR<br/>now ≥ nextDate?<br/>AND NOT running}
trig -- yes --> vb{validateFlowBounds?}
vb -- no --> done[return — running stays false]
vb -- yes --> begin[_beginRun<br/>m3PerPuls = predFlow / targetPuls<br/>stop_time = now + samplingtime·h]
trig -- no --> active{stop_time &gt; now?}
begin --> active
active -- yes --> integ[temp_pulse += m3PerTick / m3PerPuls<br/>m3Total += m3PerTick]
integ --> pulse[_maybeEmitPulse]
pulse --> emit{temp_pulse ≥ 1<br/>AND sumPuls &lt; absMaxPuls?}
emit -- no --> notify[notifyOutputChanged]
emit -- yes --> cd{cooldown<br/>blocked?}
cd -- yes --> miss[missedSamples++<br/>warn one-shot]
miss --> notify
cd -- no --> fire[temp_pulse -= 1<br/>pulse = true<br/>sumPuls++<br/>bucketVol += 50 mL]
fire --> notify
active -- no, running --> endR[_endRun — running = false]
endR --> notify
```
Key invariants:
- One pulse per integrated `m³ per pulse`. The cooldown guard suppresses pulses inside `minSampleIntervalSec` and increments `missedSamples` (without rolling the integrator back &mdash; `temp_pulse` is clamped to `1` so subsequent ticks land on the same threshold once the cooldown clears).
- `_beginRun` rounds `m3PerPuls = round(predFlow / targetPuls)`. With low `predFlow` this can round to 0; the integrator then divides by zero and `temp_pulse` becomes `Infinity`. Tracked &mdash; see [Limitations](Reference-Limitations#mperpuls-can-round-to-zero).
- `subSampleVolume` is hard-coded at 50 mL via `volume_pulse = 0.05`. The schema enforces `min=max=50` so the field is informational only.
- `set.rain` updates are **skipped while `running=true`** &mdash; the rain band is only re-evaluated between runs.
---
## Rain-scaled flow prediction
`parameters.getPredictedFlowRate` linearly scales between `nominalFlowMin` and `flowMax`:
```
scale = clamp(avgRain / maxRainRef, 0, 1)
predicted = nominalFlowMin + (flowMax - nominalFlowMin) * scale
```
with `avgRain` zeroed after `RAIN_STALE_MS = 2 hours` since the last `set.rain` update.
`rainAggregator.update` folds the Open-Meteo per-location payload by timestamp, multiplying each hour's `precipitation` by its `precipitation_probability/100` and summing across locations. `avgRain` is the per-location mean of the probability-weighted sum.
`getModelPrediction` (called inside `_beginRun`) computes the run's expected volume:
```
predFlow = max(0, predictedRate · samplingtime)
// falls back to getEffectiveFlow when predictedRate is 0
```
So `predFlow` is total m³ over the run window, and `m3PerPuls = round(predFlow / targetPuls)`.
---
## Flow blending
`flowTracker` owns three writers:
| Source | Where it writes |
|:---|:---|
| `data.flow` (operator / parent) | `flow.manual.atequipment` |
| Child `flow.measured.upstream` | `flow.measured.upstream` |
| Child `flow.measured.atequipment` | `flow.measured.atequipment` |
| Child `flow.measured.downstream` | `flow.measured.downstream` |
`getEffectiveFlow()` blends:
```
measured = mean(flow.measured.upstream/atequipment/downstream where present)
manual = flow.manual.atequipment
effective = (measured + manual) / 2 if both present
= measured if only measured present
= manual if only manual present
= 0 otherwise
```
There is no source-priority / preference policy &mdash; both sources contribute equally when both are present. Contrast with `rotatingMachine`'s `pressureSelector` which prefers real over virtual children.
---
## Lifecycle &mdash; what one event does
```mermaid
sequenceDiagram
autonumber
participant child as measurement child
participant ops as operator / AQUON
participant monster as monster
participant ft as flowTracker
participant ra as rainAggregator
participant sp as samplingProgram
participant out as Port 0 / 1
child->>monster: flow.measured.<position>
monster->>ft: handleMeasuredFlow(eventData)
ops->>monster: set.schedule / cmd.start / data.flow / set.rain
Note over monster: every 1000 ms tick
monster->>ft: getEffectiveFlow() → q
monster->>sp: flowCalc → m3PerTick
monster->>sp: samplingProgram
alt i_start OR now ≥ nextDate
sp->>sp: validateFlowBounds → _beginRun
end
alt running AND stop_time > now
sp->>sp: integrate temp_pulse
sp->>sp: _maybeEmitPulse (cooldown-guarded)
else stop_time elapsed
sp->>sp: _endRun
end
monster->>out: notifyOutputChanged (Port 0/1 delta)
```
### Tick interval
`static tickInterval = 1000` (ms). Set on `nodeClass`. Required by the integrator &mdash; `flowCalc` derives `m3PerTick` from the wall-clock delta since the last tick, so the loop must run at a stable cadence.
### Status interval
`static statusInterval = 1000` (ms). The status badge re-renders at the same cadence as the tick.
---
## Output ports
| Port | Carries | Sample shape |
|:---|:---|:---|
| 0 (process) | Delta-compressed state snapshot &mdash; `pulse`, `running`, `bucketVol`, `sumPuls`, `m3PerPuls`, `q`, `predFlow`, `timeLeft`, target deltas, rain summary, `nextDate` | `{topic, payload: {running, pulse, bucketVol, ...}}` |
| 1 (telemetry) | InfluxDB line-protocol payload (same fields as Port 0) | `monster,id=cabinet_1 running=true,pulse=false,bucketVol=1.25,m3PerPuls=4,...` |
| 2 (register / control) | `child.register` upward at init | `{topic: 'child.register', payload: {ref, softwareType, config, positionVsParent, distance}}` |
monster does **not** include a `<childId>` segment on flattened measurement keys (it has no per-child key disambiguation &mdash; the latest value per position wins).
See [EVOLV &mdash; Telemetry](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Telemetry) for the full InfluxDB layout.
---
## Event sources
| Source | Where it fires | What it triggers |
|:---|:---|:---|
| Child measurement emitter | `child.measurements.emitter` on `flow.measured.<upstream/atequipment/downstream>` | `flowTracker.handleMeasuredFlow` |
| Inbound `msg.topic` | Node-RED input wire | `commandRegistry` dispatch → handler |
| `setInterval(tickInterval = 1000)` | `BaseNodeAdapter` | `tick()``flowCalc``samplingProgram``notifyOutputChanged` |
| `setInterval(statusInterval = 1000)` | `BaseNodeAdapter` | Status badge re-render |
There is no per-state emitter (no `stateChange` / `positionChange`) &mdash; monster is purely tick-driven.
---
## Where to start reading
| If you're changing... | Read first |
|:---|:---|
| Sampling-run init / pulse emission / cooldown | `src/sampling/samplingProgram.js` |
| Bounds + targets math, rain index, flow prediction | `src/parameters/parameters.js` |
| Flow source priority, dead-band, manual blend | `src/flow/flowTracker.js` |
| Open-Meteo aggregation, forecast horizon | `src/rain/rainAggregator.js` |
| Schedule arming, sample-name filtering, daysPerYear | `src/schedule/schedule.js` |
| Topic registration, payload validation, alias deprecation | `src/commands/{index, handlers}.js` |
| Port-0 payload shape, derived fields | `src/io/output.js` |
| Status badge composition | `src/io/statusBadge.js` |
| Node-RED config slice, tick interval | `src/nodeClass.js` `buildDomainConfig` |
---
## Related pages
| Page | Why |
|:---|:---|
| [Home](Home) | Intuitive overview |
| [Reference &mdash; Contracts](Reference-Contracts) | Topic + config + child filters |
| [Reference &mdash; Examples](Reference-Examples) | Shipped flows + debug recipes |
| [Reference &mdash; Limitations](Reference-Limitations) | Known issues and open questions |
| [EVOLV &mdash; Architecture](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Architecture) | Platform-wide three-tier pattern |

View File

@@ -1,204 +0,0 @@
# Reference &mdash; Contracts
![code-ref](https://img.shields.io/badge/code--ref-cd185dc-blue)
> [!NOTE]
> Full topic contract, configuration schema, and child-registration filters for `monster`. Source of truth: `src/commands/index.js`, `src/specificClass.js` `configure()`, and the schema at `generalFunctions/src/configs/monster.json`.
>
> For an intuitive overview, return to the [Home](Home).
> [!NOTE]
> Pending full node review (2026-05). Content reflects `CONTRACT.md` and current source only.
---
## Topic contract
The registry lives in `src/commands/index.js`. Each descriptor maps a canonical `msg.topic` to its handler; aliases emit a one-time deprecation warning the first time they fire.
<!-- BEGIN AUTOGEN: topic-contract -->
| Canonical topic | Aliases | Payload | Unit | Effect |
|---|---|---|---|---|
| `cmd.start` | `i_start` | any | — | Trigger / release the sampler start gate. |
| `set.schedule` | `monsternametijden` | any | — | Replace the sampling-times schedule. |
| `set.rain` | `rain_data` | any | — | Push current rain-event data into the sampler logic. |
| `data.flow` | `input_q` | `object` | — | Push the upstream flow measurement (payload: {value, unit}). |
| `set.mode` | `setMode` | any | — | Switch the monster between auto / manual modes. |
| `set.model-prediction` | `model_prediction` | any | — | Push the upstream rain-prediction snapshot used by the sampler. |
| `child.register` | `registerChild` | `string` | — | Register a child node (typically a measurement) with this monster. |
<!-- END AUTOGEN: topic-contract -->
### Mode / source / action allow-lists
monster has **no allow-list enforcement**. There is no `flowController.handle` equivalent and no `mode.allowedActions` / `mode.allowedSources` config slice. The `set.mode` handler is a placeholder. Compare `rotatingMachine`, which gates every topic through the mode matrix &mdash; on monster, every topic dispatches unconditionally.
---
## Data model &mdash; `getOutput()` shape
Composed each tick by `src/io/output.js` `buildOutput()`. Delta-compressed: consumers see only the keys that changed.
### Flat measurement keys
For every `(type, variant, position)` stored in MeasurementContainer, `getFlattenedOutput()` emits the three-segment key (note: monster does **not** add a `<childId>` segment, unlike `rotatingMachine`):
| Key | Type | Unit | Notes |
|:---|:---|:---|:---|
| `flow.manual.atequipment` | number | m³/h | Last `data.flow` value (after conversion). |
| `flow.measured.upstream` | number | m³/h | Last measured-child reading at this position. |
| `flow.measured.atequipment` | number | m³/h | Same. |
| `flow.measured.downstream` | number | m³/h | Same. |
### Scalar keys
<!-- BEGIN AUTOGEN: data-model — populate via wiki-gen tool (TODO) -->
| Key | Type | Source | Notes |
|:---|:---|:---|:---|
| `running` | boolean | `m.running` | True between `_beginRun` and `_endRun`. |
| `pulse` | boolean | `m.pulse` | True only on the tick a pulse is emitted; false otherwise. |
| `bucketVol` | number (L) | `m.bucketVol` | Composite volume accumulated this run. |
| `bucketWeight` | number (kg) | `m.bucketWeight` | `bucketVol + emptyWeightBucket`. |
| `sumPuls` | number | `m.sumPuls` | Pulses emitted this run. |
| `pulsesRemaining` | number | `targetPuls - sumPuls` | Clamped to ≥ 0. |
| `m3PerPuls` | number (m³) | `m.m3PerPuls` | Volume per pulse; set in `_beginRun` from `predFlow / targetPuls`. |
| `m3PerPulse` | number (m³) | (alias of `m3PerPuls`) | Both keys emitted; kept for legacy consumers. |
| `m3Total` | number (m³) | `m.m3Total` | Integrated total flow this run. |
| `q` | number (m³/h) | `m.q` | Effective flow (`getEffectiveFlow`). |
| `predFlow` | number (m³) | `m.predFlow` | Predicted total volume over the run window. |
| `predM3PerSec` | number (m³/s) | `m.predM3PerSec` | Predicted average rate during the run. |
| `predictedRateM3h` | number (m³/h) | `params.getPredictedFlowRate` | Rain-scaled flow band between `nominalFlowMin` and `flowMax`. |
| `timePassed` | number (s) | `m.timePassed` | Seconds since `start_time`. |
| `timeLeft` | number (s) | `m.timeLeft` | Seconds remaining until `stop_time`. |
| `pulseFraction` | number | `m.temp_pulse` | Sub-pulse integrator value (0..1+). |
| `flowToNextPulseM3` | number (m³) | derived | Volume left to integrate before the next pulse trigger. |
| `timeToNextPulseSec` | number (s) | derived | ETA to next pulse at current `q`; 0 when `q=0`. |
| `targetVolumeM3` | number (m³) | derived from `targetVolume` (L) | Target composite volume converted to m³. |
| `targetProgressPct` | number | derived | `bucketVol / targetVolume × 100`, 2-dp. |
| `targetDeltaL` | number (L) | derived | Signed L difference vs `targetVolume`. |
| `targetDeltaM3` | number (m³) | derived | Same in m³, 4-dp. |
| `nextDate` | number (epoch ms) | `m.nextDate` | Next scheduled START_DATE for `aquonSampleName`. `null` if never set. |
| `daysPerYear` | number | `m.daysPerYear` | Count of remaining scheduled runs this calendar year. |
| `sumRain` | number | `m.rainAggregator.sumRain` | Probability-weighted hourly precipitation sum. |
| `avgRain` | number | `m.rainAggregator.avgRain` | `sumRain / numberOfLocations`. |
| `nominalFlowMin` | number (m³/h) | config | Lower band for prediction. |
| `flowMax` | number (m³/h) | config | Upper band for prediction. |
| `minVolume` | number (L) | config | Lower bucket bound. |
| `maxVolume` | number (L) | derived | `maxWeight - emptyWeightBucket`. |
| `invalidFlowBounds` | boolean | derived | True when `nominalFlowMin >= flowMax`. |
| `missedSamples` | number | `m.missedSamples` | Pulse attempts blocked by cooldown. |
| `sampleCooldownMs` | number (ms) | derived | Ms remaining on the active cooldown; 0 when none. |
| `minSampleIntervalSec` | number (s) | config | Cooldown window. |
<!-- END AUTOGEN -->
### Status badge
`buildStatusBadge` in `io/statusBadge.js`:
| Condition | Badge | Fill | Shape |
|:---|:---|:---|:---|
| `invalidFlowBounds=true` | `Config error: nominalFlowMin (…) >= flowMax (…)` | red | (error preset) |
| `running=true` + `sampleCooldownMs > 0` | `SAMPLING (Ns) · <bucketVol>/<maxVolume> L` | yellow | ring |
| `running=true` + cooldown clear | `AI: RUNNING · <bucketVol>/<maxVolume> L` | green | dot |
| idle | `AI: IDLE` | grey | (idle preset) |
---
## Configuration schema &mdash; editor form to config keys
Source of truth: `generalFunctions/src/configs/monster.json` plus `nodeClass.buildDomainConfig`.
### General (`config.general`)
| Form field | Config key | Default | Notes |
|:---|:---|:---|:---|
| Name | `general.name` | `"Monster Configuration"` | Free-text. |
| (auto-assigned) | `general.id` | `null` | Node-RED node id. |
| Default unit | `general.unit` | `unitless` | Not used by the sampling program. |
| Enable logging | `general.logging.enabled` | `true` | Master switch. |
| Log level | `general.logging.logLevel` | `info` | `debug` / `info` / `warn` / `error`. |
### Functionality (`config.functionality`)
| Form field | Config key | Default | Notes |
|:---|:---|:---|:---|
| (hidden) | `functionality.softwareType` | `monster` | Constant. |
| (hidden) | `functionality.role` | `samplingCabinet` | Constant. |
| AQUON sample name | `functionality.aquonSampleName` | _unset_ | Forwarded to `source.aquonSampleName` in `extraSetup`. Falls back to `'112100'` in `_initState`. |
### Asset (`config.asset`)
| Form field | Config key | Default | Notes |
|:---|:---|:---|:---|
| Asset UUID | `asset.uuid` | `null` | Globally-unique identifier. |
| Geolocation | `asset.geoLocation` | `{x:0, y:0, z:0}` | |
| Supplier | `asset.supplier` | `"Unknown"` | Schema only &mdash; not used by the sampling program. |
| Type | `asset.type` | `"sensor"` (enum) | Schema only. |
| SubType | `asset.subType` | `"pressure"` | Schema only; misleading default for a sampling cabinet (flag). |
| Model | `asset.model` | `"Unknown"` | Schema only. |
| Empty bucket weight (kg) | `asset.emptyWeightBucket` | `3` | Used in `bucketWeight = bucketVol + emptyWeightBucket` and in `maxVolume = maxWeight - emptyWeightBucket`. |
### Constraints (`config.constraints`)
| Form field | Config key | Default | Range | Notes |
|:---|:---|:---|:---|:---|
| Sampling time (hr) | `constraints.samplingtime` | `0` | ≥ 0 | Run length. Used as `samplingtime · 3600 · 1000` ms for `stop_time`. |
| Sampling period (hr) | `constraints.samplingperiod` | `24` | ≥ 1 | Documented as the fixed composite-collection period; not enforced by `samplingProgram` &mdash; the AQUON schedule arms the run. |
| Min volume (L) | `constraints.minVolume` | `5` | ≥ 5 | Used in `targetVolume = minVolume · √(maxVolume / minVolume)`. |
| Max weight (kg) | `constraints.maxWeight` | `23` | ≤ 23 | Bucket-overload bound; `maxVolume = maxWeight - emptyWeightBucket`. |
| Sub-sample volume (mL) | `constraints.subSampleVolume` | `50` | fixed | Schema enforces `min=max=50`. Hard-coded as `volume_pulse = 0.05` in domain. |
| Storage temperature (°C) | `constraints.storageTemperature.min/max` | `{1, 5}` | per-leg | Schema only &mdash; informational. |
| Flowmeter present | `constraints.flowmeter` | `true` | bool | ⚠️ In schema but **not** wired in `buildDomainConfig`. Effectively always `true`. |
| Closed system | `constraints.closedSystem` | `false` | bool | Schema only. |
| Intake speed (m/s) | `constraints.intakeSpeed` | `0.3` | ≥ 0 | Schema only &mdash; informational. |
| Intake diameter (mm) | `constraints.intakeDiameter` | `12` | ≥ 0 | Schema only &mdash; informational. |
| Nominal flow min (m³/h) | `constraints.nominalFlowMin` | `0` | ≥ 0 | Lower bound of rain-driven flow prediction. |
| Flow max (m³/h) | `constraints.flowMax` | `0` | ≥ 0 | Upper bound of rain-driven flow prediction. |
| Max rain reference | `constraints.maxRainRef` | `10` | > 0 | Rain index that maps to `flowMax`. |
| Min sample interval (s) | `constraints.minSampleIntervalSec` | `60` | ≥ 0 | Cooldown guard. |
> [!WARNING]
> **Default `flowMax = 0` blocks every run.** `validateFlowBounds` requires `0 ≤ nominalFlowMin < flowMax`. Out of the box the bounds are invalid and `_beginRun` never fires. Set `flowMax` to a realistic upper bound before deploying.
### Unit policy
monster has **no `requireUnitForTypes` policy** declared in `specificClass`. Conversions happen at the boundary:
| Quantity | Canonical (internal) | Carried as | Notes |
|:---|:---|:---|:---|
| Flow (`data.flow`) | m³/h | m³/h | `handlers.dataFlow` converts inbound via `convert(value).from(unit).to('m3/h')`. |
| Flow (measured-child) | as supplied | as supplied | `flowTracker.handleMeasuredFlow` defaults to `'m3/h'` when `unit` is missing; **does not convert**. Wire children that emit in m³/h. |
| Volume (`bucketVol`) | L | L | Output also exposes m³ derivations (`targetVolumeM3`, `targetDeltaM3`). |
| Weight | kg | kg | |
| Time | s (timers) / ms (timestamps) | mixed | `timePassed` / `timeLeft` in s, `nextDate` in epoch ms. |
---
## Child registration
Source: `src/specificClass.js` `_wireMeasurementChild`. The registrar subscribes to all three `flow.measured.<position>` events on the child's measurement emitter as long as the child's `config.asset.type` is `'flow'` or unset.
| Software type | Filter | Wired to | Side-effect |
|:---|:---|:---|:---|
| `measurement` | `asset.type='flow'` (or missing) | `flowTracker.handleMeasuredFlow` (handles all three positions) | Latches latest measured flow per position; `getEffectiveFlow` blends across positions and with `manualFlow`. |
| `measurement` | `asset.type` anything else | _ignored_ | The branch returns early; no listener is attached. |
monster has **no position-based filtering**. Unlike `rotatingMachine` (which routes upstream pressure separately from downstream), all three flow positions are wired to the same handler and the latest value per position wins.
There are **no auto-registered virtual children** (no `dashboard-sim-*` equivalent). Inject simulated flow via `data.flow` instead.
---
## Related pages
| Page | Why |
|:---|:---|
| [Home](Home) | Intuitive overview |
| [Reference &mdash; Architecture](Reference-Architecture) | Code map, sampling-program loop, prediction + cooldown pipeline |
| [Reference &mdash; Examples](Reference-Examples) | Shipped flows + debug recipes |
| [Reference &mdash; Limitations](Reference-Limitations) | Known issues and open questions |
| [EVOLV &mdash; Topic Conventions](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Topic-Conventions) | Platform-wide topic rules |
| [EVOLV &mdash; Telemetry](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Telemetry) | Port 0 / 1 / 2 InfluxDB layout |

View File

@@ -1,156 +0,0 @@
# Reference &mdash; Examples
![code-ref](https://img.shields.io/badge/code--ref-cd185dc-blue)
> [!NOTE]
> Every example flow shipped under `nodes/monster/examples/`, plus how to load them, what they show, and the debug recipes that go with them. Live source: `nodes/monster/examples/`.
> [!NOTE]
> Pending full node review (2026-05). Content reflects `CONTRACT.md`, `examples/README.md`, and current source only. Example flows have not been validated end-to-end on a live Docker instance.
---
## Shipped examples
| File | Tier | Dependencies | What it shows |
|:---|:---:|:---|:---|
| `basic.flow.json` | 1 | EVOLV only | Quick-start flow &mdash; manual flow inject, manual start, seeded `rain_data` and `monsternametijden`, debug taps on the three ports. **Status: pending validation.** |
| `02-integrated-e2e.json` | 2 | EVOLV only | End-to-end integration &mdash; measurement child wired in, schedule arming, sampling-run completion. **Status: pending validation.** |
Per `examples/README.md`, the following files are also referenced but **not currently in this directory** at `cd185dc`:
| Referenced filename | Status |
|:---|:---|
| `integration.flow.json` | Referenced in README; not present in `examples/` &mdash; possibly renamed to `02-integrated-e2e.json`. Flag for review. |
| `edge.flow.json` | Referenced in README; not present. Flag for review. |
| `monster-dashboard.flow.json` | Referenced in README + top-level `README.md`; not present. Flag for review. |
| `monster-api-dashboard.flow.json` | Referenced in README + top-level `README.md`; not present. Flag for review. The README warns that production use requires hardening of placeholder credentials (`__SET_*__`). |
> [!IMPORTANT]
> Reconcile the example flow inventory: either restore the four referenced flows from history, or update `examples/README.md` + the top-level `README.md` to remove dangling references. Tracked.
---
## Loading a flow
### Via the editor
1. Open the Node-RED editor at `http://localhost:1880`.
2. Menu &rarr; Import &rarr; drag the JSON file.
3. Click Deploy.
### Via the Admin API
```bash
curl -X POST -H 'Content-Type: application/json' \
--data @"nodes/monster/examples/basic.flow.json" \
http://localhost:1880/flows
```
---
## Example 01 &mdash; Basic (`basic.flow.json`)
Single-cabinet flow with the minimum inputs to drive one sampling run. Pending live validation.
### Suggested click order after deploy
1. **Seed the rain forecast.** Click the `set.rain` inject. `sumRain` / `avgRain` populate; `predictedRateM3h` jumps from `nominalFlowMin` to a band-scaled value. (Skip this step and the prediction collapses to `nominalFlowMin`, which is `0` out of the box &mdash; the run will still start, but `predFlow` will be 0 and `m3PerPuls` will round to 0; see [Limitations](Reference-Limitations#mperpuls-can-round-to-zero).)
2. **Seed the schedule.** Click the `set.schedule` inject with an AQUON row array containing at least one `START_DATE` in the future for `aquonSampleName=112100` (the default).
3. **Push a manual flow.** Click `data.flow = {value: 240, unit: 'm3/h'}`.
4. **Start.** Click `cmd.start = true`. On the next tick `validateFlowBounds` runs &mdash; if `nominalFlowMin < flowMax`, `_beginRun` fires and `running` flips to `true`.
5. **Watch Port 0.** `pulse` blips to `true` for one tick on each integrated-volume threshold cross. `bucketVol` rises in 50 mL steps. `sumPuls` increments.
6. **Stop.** Either wait `samplingtime` hours for `_endRun`, or redeploy.
> [!IMPORTANT]
> **Screenshot needed.** Editor capture of `basic.flow.json` after step 4. Save as `wiki/_partial-screenshots/monster/basic-running.png`.
### Try the cooldown guard
After the first pulse:
1. Push a higher manual flow (`data.flow = {value: 1200, unit: 'm3/h'}`) so the integrator races past `m3PerPuls` again within `minSampleIntervalSec` (default 60 s).
2. Watch the log: `Sampling too fast. Cooldown active for Ns.`
3. `missedSamples` increments, `pulse` stays `false`, `sampleCooldownMs` ticks down to 0, then the next pulse fires.
---
## Example 02 &mdash; Integrated end-to-end (`02-integrated-e2e.json`)
> [!IMPORTANT]
> **Screenshot needed.** Editor capture of `02-integrated-e2e.json`. Save as `wiki/_partial-screenshots/monster/02-integrated.png`. Replace this callout with the image link.
One monster + one or more `measurement` flow children. Demonstrates:
- Auto-registration via Port 2 at deploy (each child's `child.register` reaches the monster).
- Measured + manual flow blend &mdash; `getEffectiveFlow` averages both when present.
- Schedule-armed sampling run &mdash; `nextDate` triggers `_beginRun` without an `i_start` click.
Detailed click order: pending review.
---
## Dashboard / API example flows
The `examples/README.md` references `monster-dashboard.flow.json` (FlowFuse charts for `pulse`, `bucket`, `predFlow`) and `monster-api-dashboard.flow.json` (Open-Meteo + AQUON SFTP + Grafana publish template with placeholder credentials). Neither file is present at `cd185dc`. See the inventory note at the top of this page.
When restored, the API flow MUST be hardened before production:
- Replace every `__SET_*__` placeholder with an env-backed secret.
- Pin the Open-Meteo endpoint and Aquon SFTP host to environment variables.
- Route the dashboard publish through `dashboardAPI`, not a hardcoded Grafana URL.
---
## Docker compose snippet
To bring up Node-RED + InfluxDB with EVOLV nodes pre-loaded:
```yaml
# docker-compose.yml (extract)
services:
nodered:
build: ./docker/nodered
ports: ['1880:1880']
volumes:
- ./docker/nodered/data:/data/evolv
influxdb:
image: influxdb:2.7
ports: ['8086:8086']
```
Full file: [EVOLV/docker-compose.yml](https://gitea.wbd-rd.nl/RnD/EVOLV/src/branch/development/docker-compose.yml).
---
## Debug recipes
| Symptom | First thing to check | Where to look |
|:---|:---|:---|
| `pulse` never fires | Is `running=true`? If not, check `validateFlowBounds` &mdash; the `Invalid flow bounds. nominalFlowMin=…, flowMax=…` warn means the default `flowMax=0` is in play. Set `nominalFlowMin < flowMax` in the editor. | `parameters/parameters.js → validateFlowBounds` |
| `pulse` never fires (bounds OK) | Is `m3PerPuls` zero? `_beginRun` rounds `predFlow / targetPuls` to nearest integer m³. Low `predFlow` rounds to 0; integrator divides by 0 → `temp_pulse = Infinity`, the `sumPuls < absMaxPuls` guard then runs out. | `sampling/samplingProgram.js → _beginRun` |
| Pulses arrive too fast / skipped | Cooldown guard active. Inspect `missedSamples` + `sampleCooldownMs`. Look for `Sampling too fast. Cooldown active for Ns.` in the log. | `sampling/samplingProgram.js → _maybeEmitPulse` |
| `q` always zero | Measured-flow child not registered, manual flow not pushed. Watch Port 2 + `data.flow` history. | `flow/flowTracker.js` |
| Measurement child ignored at register | Child's `config.asset.type` is set to something other than `"flow"` (e.g. `"flow-electromagnetic"`). monster only accepts `asset.type = "flow"` or unset. Set `asset.type: "flow"` on the measurement node. | `specificClass.js → _wireMeasurementChild` |
| Measured-flow values look 60&times; high or wrong unit | `flowTracker.handleMeasuredFlow` does **not** convert: it stores the value as-supplied (defaulting unit to `'m3/h'`). Wire children that already emit m³/h or fix at the source. | `flow/flowTracker.js → handleMeasuredFlow` |
| `nextDate` not arming | `set.schedule` payload didn't include any rows matching `aquonSampleName` with a future `START_DATE`. | `schedule/schedule.js → regNextDate` |
| `sumRain` stays zero with rain input | `set.rain` is ignored while `running=true` &mdash; only consumed between runs. Wait for `_endRun` or push the rain payload before `cmd.start`. | `specificClass.js → updateRainData` |
| `data.flow` payloads dropped silently | The handler requires `{value: <number>, unit: <string>}`. Bare numbers or missing `unit` log `data.flow payload must include numeric value and unit.` | `commands/handlers.js → dataFlow` |
| `predictedRateM3h` stays at `nominalFlowMin` | `set.rain` not sent, `lastRainUpdate` is 0, or > 2 hours have passed (`RAIN_STALE_MS`). Re-push the rain payload. | `parameters/parameters.js → getRainIndex` |
| `flowmeter=false` has no effect | `constraints.flowmeter` is in the schema but **not** wired in `buildDomainConfig`. The sampling program always runs in proportional mode. | `src/nodeClass.js → buildDomainConfig` |
| `set.mode` / `set.model-prediction` no-op | Handlers delegate to `source.setMode()` / `source.setModelPrediction()` which don't exist. These topics are reserved for future use. | `commands/handlers.js` |
| Status badge stuck at `Config error: …` | `nominalFlowMin >= flowMax`. Fix the bounds and redeploy. | `io/statusBadge.js` |
> Never ship `enableLog: 'debug'` in a demo &mdash; fills the container log within seconds and obscures real errors.
---
## Related pages
| Page | Why |
|:---|:---|
| [Home](Home) | Intuitive overview |
| [Reference &mdash; Contracts](Reference-Contracts) | Topic + config + child filters |
| [Reference &mdash; Architecture](Reference-Architecture) | Code map, sampling-program loop, prediction + cooldown pipeline |
| [Reference &mdash; Limitations](Reference-Limitations) | Known issues and open questions |
| [EVOLV &mdash; Topology Patterns](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Topology-Patterns) | Where monster fits in a larger plant |

View File

@@ -1,127 +0,0 @@
# Reference &mdash; Limitations
![code-ref](https://img.shields.io/badge/code--ref-cd185dc-blue)
> [!NOTE]
> What `monster` does not do, current rough edges, and open questions. Open items live in `.agents/improvements/IMPROVEMENTS_BACKLOG.md` in the superproject.
> [!NOTE]
> Pending full node review (2026-05). Content reflects `CONTRACT.md` and current source only. Known limitations enumerated in `CONTRACT.md` Section 14 are propagated below; additional issues may surface during the planned audit.
---
## When you would not use this node
| Scenario | Use instead |
|:---|:---|
| Ad-hoc single grab sample | Fire `cmd.start` once and tear it down &mdash; monster is overkill for one-off work. A `measurement` child with a one-shot inject is lighter. |
| Generic flow totaliser | `measurement` with the right type/variant, or a dedicated integrator function on the upstream parent. |
| Multi-constituent analyser (NH4, NO3, COD, TSS, …) | monster only emits **pulse + bucket-volume** events &mdash; it does **not** model analyte concentrations. The Home page framing ("multi-parameter biological process monitor") describes the **downstream** consumer of the composite sample, not the monster node's outputs. Pending review whether the framing should change or whether analyte fields should be added to Port 0. |
| Time-mode sampling (no flow source) | Not exercised. `constraints.flowmeter = false` exists in the schema but is **not** forwarded in `buildDomainConfig`; the sampling program always runs in flow-proportional mode. |
---
## Known limitations
### `m3PerPuls` can round to zero
`_beginRun` computes `m3PerPuls = Math.round(predFlow / targetPuls)`. With low `predFlow` (e.g. an unconfigured `flowMax`, a stale rain forecast, or a very short `samplingtime`) this rounds to 0. The integrator then divides by 0; `temp_pulse` becomes `Infinity`; the first iteration of `_maybeEmitPulse` ramps `sumPuls` up to `absMaxPuls` in one tick and stops. **Symptom: instant bucket fill, then idle.** Workaround: ensure `predFlow ≥ targetPuls` (typical `targetPuls` is 200), e.g. `flowMax ≥ 200 m³` or longer `samplingtime`. Tracked.
### Default `flowMax = 0` blocks every run
The schema defaults `nominalFlowMin = 0` and `flowMax = 0`. `validateFlowBounds` requires `min >= 0 && max > 0 && min < max`, so the default config is invalid and the run never starts. The status badge surfaces this as `Config error: nominalFlowMin (0) >= flowMax (0)`. Fix the bounds before deploying. Tracked.
### `set.rain` is dropped while `running=true`
`updateRainData` short-circuits when `running` is true &mdash; the rain forecast is only consumed between runs. During a long `samplingtime` (e.g. 24 h) the rain forecast goes stale silently. `getRainIndex` does enforce a 2-hour `RAIN_STALE_MS` cap on `avgRain`, but only **outside** a run; during a run the cached `predFlow` is whatever `_beginRun` froze. Open question.
### `set.mode` and `set.model-prediction` are reserved
Both handlers delegate to optional methods (`source.setMode()`, `source.setModelPrediction()`) that don't exist on `Monster`. Sending these topics is a no-op. They survive the registry only as forward-compatibility placeholders. Scheduled to either be implemented or removed in a later phase.
### `constraints.flowmeter` is not wired
The schema field exists with a `true` default, but `nodeClass.buildDomainConfig` does **not** forward it. The sampling program assumes a flow source unconditionally. Setting `flowmeter=false` in the editor has no runtime effect. Tracked.
### `subSampleVolume` is hard-coded at 50 mL
`volume_pulse = 0.05` in `_initSamplingDefaults` is a constant. The schema enforces `min=max=50` so the field is informational only. Bucket-and-target math (`minPuls`, `maxPuls`, `absMaxPuls`, `targetPuls`) all assume 50 mL. Changing this requires a coordinated change across `parameters.js`, the schema, and any consumer that decodes pulse counts back to volume. Tracked.
### Measured-flow handler does not convert units
`flowTracker.handleMeasuredFlow` reads `eventData.unit` but only uses it to label the stored measurement &mdash; the **value is not converted**. If a measurement child emits in `l/s`, monster stores the raw number and labels it `l/s`, but `getEffectiveFlow` is consumed as if it were m³/h. Wire children that already emit in m³/h, or set `default unit` on the child to `m3/h`. Tracked.
### Edge test `sampling-guards.edge.test.js` cooldown-guard case fails
A pre-existing failure documented in `CONTRACT.md` Section 14. The cooldown skip increments `missedSamples` but the assertion expects different timing. Tracked.
### S88 colour cleanup pending
The editor node colour in `monster.html` is `#4f8582` (teal). The correct Unit-level S88 colour is `#50a8d9`. The Mermaid diagrams in this wiki already use the correct colour. The editor node tile must be updated separately. Tracked in `.claude/rules/node-red-flow-layout.md` Section 16.
### No formal FSM
Unlike `rotatingMachine` (idle → starting → warmingup → operational → …) monster only has the `running` boolean. There is no protected-state guarantee, no abort token, no sequence registry. Cooldown and bounds are the only safety guards. If a future requirement needs e.g. a `pausing` / `paused` state, the sampling program needs to be lifted onto the platform's `state` module. Open question.
### No multi-parent registration audit
`childRegistrationUtils.registerChild` runs unconditionally. Whether monster can be safely wired under multiple parents (e.g. one reactor and one settler), and whether teardown ordering is correct, has not been audited. Open question.
### Multi-constituent reporting absent
The node's framing in the project memory ("multi-parameter biological process monitor &mdash; surrogate for a benchtop analyser") suggests monster reports NH4 / NO3 / COD / TSS / etc. **The current implementation does not.** monster emits volumetric pulse + bucket state only. Lab analyte values are produced by a separate downstream consumer that ingests the physical composite sample collected on the monster's pulses. Either:
- the framing should be tightened to "composite sampler / sampling-cabinet controller", or
- analyte fields (with timestamps and per-pulse correlations) should be added to Port 0.
Pending decision-gate review.
---
## Open questions (tracked)
| Question | Where it lives |
|:---|:---|
| Should `set.rain` updates apply mid-run (best-effort `predFlow` re-compute) or stay run-frozen? | Internal &mdash; not yet ticketed |
| Implement or remove `set.mode` + `set.model-prediction` placeholders | Internal |
| Wire `constraints.flowmeter` and exercise the time-mode path | Internal |
| Add unit conversion to `flowTracker.handleMeasuredFlow` | Internal |
| Round-to-zero `m3PerPuls` &mdash; clamp to ≥ 1 or refuse to start? | Internal |
| Multi-parent registration safety audit | Internal |
| Add formal FSM (`idle` / `armed` / `running` / `cooldown`)? | Open |
| Add analyte / multi-constituent reporting to Port 0, or rephrase the node's framing | Decision-gate &mdash; pending |
| Restore or remove the dangling `monster-dashboard.flow.json` + `monster-api-dashboard.flow.json` references | Internal |
---
## Migration notes
### From legacy topic aliases
The pre-canonical topics (`i_start`, `monsternametijden`, `rain_data`, `input_q`, `setMode`, `model_prediction`) are accepted as aliases and emit a one-time deprecation warning. They are scheduled for removal in Phase 7. Update flows to use the canonical names from [Reference &mdash; Contracts](Reference-Contracts#topic-contract):
| Legacy | Canonical |
|:---|:---|
| `i_start` | `cmd.start` |
| `monsternametijden` | `set.schedule` |
| `rain_data` | `set.rain` |
| `input_q` | `data.flow` |
| `setMode` | `set.mode` |
| `model_prediction` | `set.model-prediction` |
| `registerChild` | `child.register` |
### Pre-2026-05-11 invalid-bounds silent skip
Before 2026-05-11 `nominalFlowMin` / `flowMax` were not declared in `monster.json`'s `constraints` section. `configUtils` stripped them as unknown keys; bounds collapsed to undefined → NaN → invalid, silently blocking every run. Fixed in the schema; ensure your `monster.json` is at the current commit.
---
## Related pages
| Page | Why |
|:---|:---|
| [Home](Home) | Intuitive overview |
| [Reference &mdash; Contracts](Reference-Contracts) | Topic + config + child filters (alias map at the top) |
| [Reference &mdash; Architecture](Reference-Architecture) | Code map, sampling-program loop, prediction + cooldown pipeline |
| [Reference &mdash; Examples](Reference-Examples) | Shipped flows + debug recipes |
| [EVOLV &mdash; Architecture](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Architecture) | Platform-wide three-tier pattern |

View File

@@ -1,21 +0,0 @@
### monster
- [Home](Home)
**Reference**
- [Contracts](Reference-Contracts)
- [Architecture](Reference-Architecture)
- [Examples](Reference-Examples)
- [Limitations](Reference-Limitations)
**Related**
- [EVOLV master wiki](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Home)
- [measurement wiki](https://gitea.wbd-rd.nl/RnD/measurement/wiki/Home)
- [reactor wiki](https://gitea.wbd-rd.nl/RnD/reactor/wiki/Home)
- [settler wiki](https://gitea.wbd-rd.nl/RnD/settler/wiki/Home)
- [dashboardAPI wiki](https://gitea.wbd-rd.nl/RnD/dashboardAPI/wiki/Home)
- [Topology Patterns](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Topology-Patterns)
- [Topic Conventions](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Topic-Conventions)
- [Telemetry](https://gitea.wbd-rd.nl/RnD/EVOLV/wiki/Telemetry)