Periodic Signal Processing

Twelve one-minute observations describe three rounds of a small greenhouse controller. A Flow groups observations by minute modulo four, counts states within each phase, and reports phases with mixed observations. Phase 3 records two idle readings and one vent reading, so the repeating schedule alone cannot explain every reading.

php examples/periodic-signal-processing.php
Phase 0: pump × 3
Phase 1: idle × 3
Phase 2: vent × 3
Phase 3: idle × 2, vent × 1 (mixed)

Use a known sampling interval and cycle length. If a reading can be missing, carry its actual minute index through the pipeline. Otherwise a single missing observation shifts the phase of every subsequent sample.

The synthetic data belongs to Darkwood Code Calendar 2026 edition 02. Open the PHP source.

Edit this page on GitHub