Skip to content

fix(v1.6.36): smooth COMTRADE scrub presentation at display cadence - #315

Merged
masarray merged 7 commits into
trial/scl-golden-wire-v1636from
fix/v1636-comtrade-interaction-easing
Sep 16, 2026
Merged

masarray merged 7 commits into
trial/scl-golden-wire-v1636from
fix/v1636-comtrade-interaction-easing

Conversation

@masarray

Copy link
Copy Markdown
Owner

Scope

Narrow continuation from exact qualified v1.6.36 head 4f5c2742f978a0ccc9be426c0ff15e468eba28c9.

The previous analyzer easing advanced only when a new native analysis result arrived, so sparse/irregular native cadence could still look stepped while scrubbing. This PR keeps cursor/native analysis exact and immediate, but animates only the derived Phasor/Harmonics presentation toward the latest native target on WPF composition frames.

Phasor

  • Keep exact native voltage/current target vectors separate from displayed vectors.
  • Existing 78 ms exponential/shortest-angle easing now advances on CompositionTarget.Rendering.
  • First sample/topology change still snaps; normal scrub transitions ease continuously.
  • Presentation settles exactly to the native target after a bounded 260 ms window.

Harmonics

  • Keep exact native target spectra separate from displayed spectra.
  • Existing 92 ms easing now advances on one composition-frame pump.
  • Presentation settles exactly to the native target after a bounded 300 ms window.

Interaction/performance invariants

  • Cursor movement itself remains synchronous/direct; no input lag is added.
  • Existing latest-wins, single-worker native scrub scheduler is unchanged.
  • No DispatcherTimer and no per-vector/per-channel timers.
  • Animation is presentation-only; raw engineering/native data, history and evidence remain exact.
  • Rendering pump detaches on Unloaded and after settling.

Regression protection

Adds ComtradePresentationAnimationRegressionTests to lock the composition-driven presentation contract and preserve the existing latest-wins native scrub scheduler.

Changed source relative to exact qualified base: only Controls/ComtradePhasorView.cs, Controls/ComtradeHarmonicsWorkstationView.cs, and the new regression test.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cea3d38a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Controls/ComtradePhasorView.cs Outdated
Comment on lines +149 to +152
var now = Stopwatch.GetTimestamp();
_lastPresentationTimestamp = now;
_presentationAnimationStartedTimestamp = now;
if (_presentationRenderingHooked) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the frame timestamp when retargeting

During the checked live-scrub path in ComtradeWorkspaceWindow.P1D4LiveScrub.cs, native results can arrive between composition frames; every such result calls this method and overwrites _lastPresentationTimestamp before the already-hooked guard, so the next frame eases only for the small result-to-frame interval rather than the full frame interval. If results repeatedly arrive shortly before rendering, the vectors barely advance while dragging and then visibly catch up after release, defeating the display-cadence smoothing. Initialize the frame timestamp only when attaching the handler (while still restarting the settle deadline for a new target), and apply the same correction to ComtradeHarmonicsWorkstationView.StartPresentationAnimation.

AGENTS.md reference: AGENTS.md:L103-L106

Useful? React with 👍 / 👎.

_smoothedSpectra = CloneSpectra(_targetSpectra);
StopPresentationAnimation();
}
RefreshPreparedSpectra();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reuse prepared harmonic presentation assets across frames

For the supported eight-channel overview, every composition tick calls RefreshPreparedSpectra, which rebuilds all plot-bin arrays, formatted labels, and two frozen brushes per channel, while SmoothSpectra also allocates a new record for every native bin. A continuously retargeted scrub therefore creates thousands of UI-thread objects per second and moves the normalization/formatting work that this class previously performed once per native result into the 60 Hz frame path, introducing avoidable GC and frame-time pressure in the exact interaction this change is intended to smooth. Cache the static row assets and update only the animated numeric state or otherwise reuse the per-frame buffers.

AGENTS.md reference: AGENTS.md:L133-L135

Useful? React with 👍 / 👎.

@masarray
masarray merged commit a0e0e09 into trial/scl-golden-wire-v1636 Sep 16, 2026
4 checks passed
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