Add calibrated Bento spreader 3 consumption

This commit is contained in:
admin committed 2026-10-02 16:35:48 +02:00
1 parent 7ff452d36c
commit 7ff3087775
12 files changed
+485 -31

No files matched your search

+80 -4
View File
@@ -3,8 +3,7 @@
## Three distinct quantities
All **fresh bentonite** values exclude the third recycled/recovered-material
scatterer. Only the two actual rpm signals listed below are used; no SET signals
All **fresh bentonite** values exclude the separate spreader 3. Only the two actual rpm signals listed below are used; no SET signals
are introduced. The specific discharge is central calibration
data: **2.75 kg/(revolution × metre product width)**.
@@ -56,7 +55,7 @@ Scope Grafana queries by calculation ID and
`material_snapshot_timestamp` for auditability.
`config/bento1-material-consumption.yaml` opts into process snapshots through
`process_application_calculation_id`. This generic option requires rotational
`process_application_calculation_id`. This generic option requires calibrated
sources and a positive speed gate. Both outputs reuse the same configured ACT
signals, discharge factor and samples. Process points use source timestamps,
including bootstrap samples from disjoint runs; no interpolation or hold-forward
@@ -103,7 +102,7 @@ cleanup was performed as part of this implementation.
`config/bento1-material-consumption.yaml` defines
`bento1-fresh-bentonite-consumption`, an estimate of **fresh bentonite consumption**
from actual spreader roll speeds. Both needle rolls apply sequentially across the
full web width. The recycled/recovered third spreader is excluded.
full web width. Spreader 3 is excluded.
The generic `rotational_discharge` source converts one or more rpm signals to the
existing integrator's kg/h: `sum(rpm) × nominal_width_m × specific_discharge_kg_per_rev_m × 60`.
@@ -155,6 +154,83 @@ and persistence semantics.
Tests use realistic rpm values and synthetic samples, including disjoint-run
bootstrap and persisted resume. They are not a new replay of recorded ENLYZE data.
## Separate spreader 3 material source
Spreader 1+2 remains fresh bentonite from actual roll rpm, calibrated at
**2.75 kg/(rev*m)**. Spreader 3 is a separate material source: it can contain
bentonite or sand depending on the product. No material identity is inferred,
and no spreader-3 value is added to fresh-bentonite consumption or efficiency.
No total-bentonite aggregate or sand calibration is implemented.
`config/bento1-spreader3-material-consumption.yaml` uses generic
`linear_signal_discharge` with central calibration
`bento1-spreader-3-bentonite`: **0.4691089108910891 kg/(signal_unit*m)**,
gravimetric tray, 2026-09-08. Reference: **3.03 signal @ 2.3 m/min → 618 g/m²**.
The exact factor is `618 * 2.3 / (3.03 * 1000) = 2369/5050`; the supplied
approximation 0.4693069307 differs from this measurement-derived value.
Source `c5611859-275c-44c4-aec0-dfaccc87d478`, display name
“Austragsbehälter Austragsschnecke Geschwindigkeit Istwert”, origin
`AUFSTREUUNG_2/DischargeHopper_Output_Screw/ACT_Speed`.
ENLYZE's kg/m² metadata is not used as physical truth. Observed values on
2026-09-09 were around 3.0 during operation and 0.0 when inactive.
- Application: `signal_sum * factor * 1000 / line_speed_m_min`, independent of width.
- Consumption rate: `signal_sum * factor * nominal_width_m` in kg/min,
multiplied by 60 for the existing kg/h integrator. This equals
`application_g_m2 * nominal_width_m * line_speed_m_min / 1000`.
- Same ERP nominal-width provider, `Bento 1-{production_order}` formatting,
gate signal `fef41976-1103-4090-b780-eaeecc02fdfa` strictly > 0.3 m/min,
previous-value integration, 20-second maximum gap, and disjoint-run boundaries.
- Application points are emitted only while the gate is active; zero source
signal emits zero application during production.
| Calculation ID | Persistence |
| --- | --- |
| `bento1-spreader3-application` | `material_application_snapshots.application_g_m2` |
| `bento1-spreader3-consumption` | `material_consumption_snapshots.consumption_kg` |
The new linear source namespaces JSON checkpoints under
`<state-directory>/<sha256(consumption-calculation-id)>/`; existing 1+2 and K7
checkpoint paths remain unchanged. Use a separate supervised consumption runner
with the spreader-3 config. No schema changes are needed if the existing generic
snapshot tables are present; otherwise apply `db/schema.sql` before starting it.
Do not reset 1+2 state. No migration, deployment, or service restart was performed.
Production validation, 30 Sep 2026 10:00–13:00 Europe/Berlin, order `12026000984`,
article `180205` (Bfix NSP 4900, 5,00 x 40 m): `8.999 @ 4.999 m/min` gives
**844.471112 g/m²**. Adding the measured 1+2 average of 3915.961 gives
**4760.432112 g/m²**, within the expected 4400–4800 range.
Before redeployment, stop the spreader 3 runner and back up its checkpoints and
snapshots. Clear only its consumption checkpoint directory:
`<state-directory>/c8d0426504f2ce2ff214818e4ffa9b4daf4182131c0af3c5a1cca23a3dee566a/`.
With the default state root this is
`/opt/git-projects/production-analytics/data/state/material/c8d0426504f2ce2ff214818e4ffa9b4daf4182131c0af3c5a1cca23a3dee566a/`.
There is no separate application checkpoint directory. Clear all affected snapshot
rows, across orders and timestamps, using these exact predicates:
```sql
DELETE FROM material_application_snapshots
WHERE calculation_id = 'bento1-spreader3-application'
AND machine_id = '5f42a4f6-9ca0-4f6f-9786-40d50a35b230';
DELETE FROM material_consumption_snapshots
WHERE calculation_id = 'bento1-spreader3-consumption'
AND machine_id = '5f42a4f6-9ca0-4f6f-9786-40d50a35b230';
```
Perform cleanup before restarting with the corrected model; arrange a replay for
historical orders if corrected history is needed. Snapshot writes use
`ON CONFLICT DO NOTHING`, so existing application rows cannot correct themselves.
Leave spreaders 1+2 and K7 checkpoints and snapshots intact. These are instructions
only; no stored data has been deleted by this code change.
This calibration is valid only for bentonite. Enable this runner only for
validated bentonite operation; until reliable material identification is available,
its output is a bentonite-calibrated estimate, not material-aware consumption.
Future sand support needs independently measured calibration and reliable
material/order attribution, with explicit handling of material changes and
checkpoint/history separation. Current ERP width is assumed constant per order.
## Historical migration from SET to rpm: review before execution
The following records the earlier source-model migration, **not a prerequisite
+36 -6
View File
@@ -2,7 +2,7 @@
Process calibration values live in the version-controlled
`config/material-calibrations.yaml`. Calculations refer to opaque IDs; IDs have
no special meaning to the parser. The current entry is:
no special meaning to the parser. The spreader 1+2 entry is:
```yaml
calibrations:
@@ -40,7 +40,7 @@ consumption; the calculation algorithms are unchanged. There is no unit conversi
Missing/unreadable files, missing IDs, invalid metadata and incompatible type or
unit raise `CalculationConfigError` before a runner starts. Existing direct numeric
configurations remain supported; specifying both a reference and a direct factor
is rejected. References are currently supported by rotational discharge consumers.
is rejected. References are supported by rotational discharge and linear signal application consumers.
K7 uses direct mass rate and does not load or require a calibration file.
## Updating a calibration
@@ -67,7 +67,37 @@ On 2026-09-08, an independent gravimetric tray measurement found 4068 g/m² at
rounded factor **2.75 kg/(rev*m)**. The original measurement remains recorded,
without fitting or adjusting the runtime value to reproduce it exactly.
Only fresh-bentonite spreaders 1 and 2 are included. Before adding spreader 3,
confirm its material scope, actual signal units, independent calibration and
whether its output belongs in the fresh-material KPIs. No spreader 3 support is
included here.
Spreader 3 has an independent entry in the same registry:
```yaml
bento1-spreader-3-bentonite:
type: linear_signal_discharge
value: 0.4691089108910891
unit: kg_per_signal_unit_m
calibrated_at: 2026-09-08
method: gravimetric_tray
description: Bento 1 spreader 3, bentonite
reference:
measured_application_g_m2: 618
signal_value: 3.03
line_speed_m_min: 2.3
```
The generic linear consumer requires type `linear_signal_discharge`, unit
`kg_per_signal_unit_m`, a positive value, and an explicit calibration reference.
It resolves `specific_discharge_kg_per_signal_unit_m`; this runtime field cannot
be configured directly as a substitute for the central reference.
Calibration measurement: **3.03 signal @ 2.3 m/min → 618 g/m²**.
The exact derived discharge factor is `618 * 2.3 / (3.03 * 1000) = 2369/5050`,
stored at float precision as **0.4691089108910891 kg/(signal_unit*m)**.
The previously supplied approximation 0.4693069307 does not equal that expression.
Application is `signal_sum * factor * 1000 / line_speed_m_min`, independent of width.
Mass flow is `signal_sum * factor * nominal_width_m` kg/min, independent of speed;
the existing kg/h integrator receives this discharge multiplied by 60.
This measured bentonite calibration does not establish physical units from
ENLYZE metadata and must not be used for sand. Spreader 3 may carry sand on other
products. Its application, consumption and checkpoints remain separate from
fresh-bentonite spreaders 1+2, with no inferred material identity or automatic
sum. See [Bento material documentation](bento1-fresh-bentonite.md) for configuration,
formulas and operating assumptions.