Add generic peak cycle detector

This commit is contained in:
2026-09-04 08:00:59 +02:00
parent f017d187eb
commit 5068c95158
9 changed files with 521 additions and 8 deletions
+16
View File
@@ -39,3 +39,19 @@ Future calculation state is stored per calculation instance and relevant
context partition. It enables safe continuation (for example an open peak
cycle), while the source interval recorded on results keeps a historical run
reproducible by fetching ENLYZE data again.
## Peak-cycle semantics
The generic peak detector maintains an open cycle maximum. A reset begins when
a sample falls below `drop_ratio * current_peak`; it is confirmed only after
actual subsequent below-threshold samples support `hold_seconds` of elapsed
time. It emits only maxima at least `min_peak`, starts a fresh cycle after a
completed reset, and suppresses duplicates during the continuing low phase.
This is calculation-domain logic, with no ENLYZE transport dependency.
The detector uses timestamps rather than a sample count. An interval longer
than the configured positive `max_sample_gap_seconds` restarts a reset candidate,
so a timestamp alone does not establish that a signal was continuously below
threshold. Equal
timestamps are processed in arrival order but contribute no elapsed time, and
backwards timestamps are rejected. Reset values are not assumed to be zero.