Skip to content

AdaptiveLNC: bound FLL tracking around nominal line frequency - #182

Merged
cboulay merged 2 commits into
devfrom
adaptive-lnc-freq-bounds
Jul 22, 2026
Merged

AdaptiveLNC: bound FLL tracking around nominal line frequency#182
cboulay merged 2 commits into
devfrom
adaptive-lnc-freq-bounds

Conversation

@cboulay

@cboulay cboulay commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Add a configurable bound around the nominal mains frequency for AdaptiveLNC's frequency-locked loop, preventing weak or absent line estimates from allowing the tracker to random-walk toward DC.

Changes

  • Add AdaptiveLNCSettings.max_freq_deviation, defaulting to ±2 Hz around line_freq.
  • Cache the corresponding angular-frequency bounds in processor state, clipped to DC and Nyquist.
  • Clamp every FLL update to those bounds in both notch and subtract cancellation modes.
  • Allow max_freq_deviation=None to preserve unbounded tracking when explicitly requested.
  • Reject negative deviations.
  • Ignore the local .codegraph/ index directory.

Testing

  • Added coverage for clamping in both directions around the nominal frequency.
  • AdaptiveLNC unit tests: 18 passed.
  • Full suite: 3669 passed, 7 skipped, 6 deselected.
  • Ruff lint and formatting checks pass.

cboulay added 2 commits July 22, 2026 08:11
New max_freq_deviation setting (default ±2 Hz; None for unbounded)
clamps the FLL's tracked frequency so a weak or absent line component
cannot random-walk the NCO away from the mains frequency. The bounds
are additionally limited to [0, fs/2].
@cboulay
cboulay merged commit 72dc66a into dev Jul 22, 2026
14 checks passed
@cboulay
cboulay deleted the adaptive-lnc-freq-bounds branch July 22, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant