Skip to content

SEL CWS / rolling phase estimator: V/I ordering fix, optimizations, missing-data handling, and unit tests#538

Merged
ritchiecarroll merged 7 commits into
masterfrom
IVOrderSwitch
May 23, 2026
Merged

SEL CWS / rolling phase estimator: V/I ordering fix, optimizations, missing-data handling, and unit tests#538
ritchiecarroll merged 7 commits into
masterfrom
IVOrderSwitch

Conversation

@ritchiecarroll
Copy link
Copy Markdown
Member

Hardens the SEL CWS (continuous wave streaming) rolling phase estimator and adds test coverage. Built on the discovery that SEL CWS transmits voltages before currents (VA, VB, VC, IA, IB, IC) — the opposite of the original assumption:

  1. Corrected V/I channel ordering
  2. Review fixes + hot-path optimizations
  3. Missing-data handling — coast/resync
  4. Added unit tests

ritchiecarroll and others added 7 commits May 22, 2026 09:22
…h optimizations

- Remove duplicate reference-angle Atan2; replace publish-schedule zero-ns sentinel with a bool flag
- Hoist constant subexpressions out of the per-sample/per-publish hot paths (RMS magnitude scale, 1-alpha EMA complements, frequency clamp bounds)
- Replace per-sample buffer-index modulo with compare/reset and the recalc trigger with an aligned countdown
- Simplify instantaneous frequency to deltaPhase/(2*pi*dt) (algebraically equivalent, fewer ops, better conditioning)
- Add FUTURE notes for positive-sequence frequency source and quality reporting

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…hase estimator

Detects dropped samples from the input timestamp cadence and either coasts small gaps with
phase-continued synthesis or resynchronizes large ones; adds the MaxGapFillSamples parameter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ator

Adds GSF.PhasorProtocols.Tests (MSTest) covering frequency, magnitude, angle and the
coast/resync gap handling; exposes internals via InternalsVisibleTo and retires the
stale in-library test harness.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ard timestamp

A non-increasing input timestamp (e.g., source restart/loop or a re-basing config frame) no
longer wedges reporting: a backward jump resets onto the new timeline and a duplicate is
skipped, so estimates resume after the window refills.
@ritchiecarroll ritchiecarroll merged commit edceca8 into master May 23, 2026
2 checks passed
@ritchiecarroll ritchiecarroll deleted the IVOrderSwitch branch May 23, 2026 17:22
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