Skip to content

fix(math): make resonance points transformer-independent and consistent#127

Merged
dc0sk merged 2 commits into
mainfrom
fix/resonance-points-consistency
Jul 4, 2026
Merged

fix(math): make resonance points transformer-independent and consistent#127
dc0sk merged 2 commits into
mainfrom
fix/resonance-points-consistency

Conversation

@dc0sk

@dc0sk dc0sk commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #125. Fixes the resonance-point handling that the #125 review flagged: five separate places built resonance point-sets from the transformer-corrected quarter-wave, so choosing a Unun/Balun silently shifted the physical resonance geometry, and the sets disagreed with each other.

All five now use the uncorrected quarter-wave (71.32/f · VF) — resonance is a property of the wire, not the feed:

  • non-resonant avoid-set (calculate_non_resonant_optima)
  • resonant-compromise optimizer
  • OCFD split clearance optimizer
  • on-screen resonant_points_in_window
  • exported resonant_points_in_window

They now always agree, and none shift with the transformer ratio. The transformer-length heuristic still adjusts the displayed build lengths (corrected_*) — unchanged.

Review findings addressed (from #125)

  • [4] resonant-mode display/export vs compromise recommendations now use the same point set → consistent.
  • [2] the non-resonant clearance and the displayed/exported points now derive from the same set → no longer contradictory.
  • [1] the advise "recommended length" is now (correctly) the same for every ratio; added a one-line note so the constant column isn't misread as a bug.
  • [5]/[6] do not arise — no half-wave sparsity, no empty-window fallback.

Design decision (deliberate)

This does not adopt the earlier half-wave avoid-set idea. The review showed it introduces a second, conflicting definition of "resonance" versus the display/export/compromise sets. Keeping the tool's documented, unified "avoid all quarter-wave resonances" model (staying in the moderate-reactance region between resonances) is internally consistent and defensible for a tuner-fed non-resonant wire. A high-Z/low-Z point-type distinction would be a larger UX feature; noted for future work.

Test plan

  • new resonance_point_optimizers_are_transformer_independent guards all three optimizers against per-ratio drift (asserts corrected lengths DO change but resonance points do NOT)
  • cargo test all pass (366 lib + integration), clippy clean, fmt clean
  • docs/math.md §5/§6 updated

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jf8uBU8AYxkrG8fa8yo6tC

dc0sk and others added 2 commits July 4, 2026 12:05
…nt (A6)

The five places that build resonance point-sets each used the
transformer-corrected quarter-wave, so a Unun/Balun choice silently shifted
the physical resonance geometry, and the sets disagreed with one another:
- non-resonant avoid-set (calculate_non_resonant_optima)
- resonant-compromise optimizer
- OCFD split clearance optimizer
- on-screen resonant_points_in_window
- exported resonant_points_in_window

All five now use the uncorrected quarter-wave (71.32/f·VF), which is a
property of the wire geometry, not the feed. The optimizers, the on-screen
list and the export now always agree and never move with the transformer
ratio. The transformer-length heuristic still adjusts the displayed *build*
lengths (corrected_*), which is unchanged.

Deliberately does NOT adopt the earlier half-wave avoid-set idea: the review
showed it introduces a second, conflicting definition of "resonance" versus
the display/export/compromise sets. Keeping the tool's documented, unified
"avoid all quarter-wave resonances" model is consistent and defensible for a
tuner-fed non-resonant wire.

- advise: note that the recommended length is the same for every ratio
  (resonance is independent of the feed) so the constant column isn't misread
- docs/math.md §5/§6: points are uncorrected and transformer-independent
- test: resonance_point_optimizers_are_transformer_independent guards all three
  optimizers against per-ratio drift

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

Addresses the #127 code-review findings:

- [2][3][4] The previous commit switched the five resonance-point sites to the
  fully-raw quarter_wave_m, which dropped the *conductor-diameter* correction
  (a real geometry effect) along with the transformer heuristic (intended). A
  thick-conductor build could then be recommended sitting on a real resonance.
  Introduce WireCalculation::resonant_quarter_wave_m = quarter_wave_m x
  conductor_diameter_correction_factor(d) — conductor-corrected but
  transformer-independent — and use it everywhere.

- [7] Extract one shared band_resonant_points_m() helper; all five consumers
  (non-resonant avoid-set, compromise, OCFD clearance, on-screen list, export)
  now go through it, so the harmonic loop can't drift between copies again.

- [6] The non-resonant avoid-set uses a 1 m edge pad (for honest boundary
  clearance) while the others list strictly in-window points; docs/comments no
  longer overclaim the lists are byte-identical, only that the harmonic
  positions come from the same feed-independent formula.

- [5] Mirror the CLI's "length is the same for every ratio" note in the TUI
  advise panel.

- tests: resonant_points_keep_conductor_diameter_correction guards the physical
  correction is retained (thick < thin, and != raw quarter-wave).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dc0sk

dc0sk commented Jul 4, 2026

Copy link
Copy Markdown
Owner Author

Applied the high-effort review findings in ceaf121:

  • [2][3][4] Restored the physical conductor-diameter correction to the resonance points (the prior commit dropped it along with the transformer heuristic). New WireCalculation::resonant_quarter_wave_m is conductor-corrected but transformer-independent, and all five sites use it.
  • [7] Extracted one shared band_resonant_points_m() helper — the five copies of the harmonic loop are gone, so they can't drift again.
  • [6] Softened the docs/comment 'always agree' overclaim (the non-resonant avoid-set keeps a 1 m edge pad for honest boundary clearance; positions still come from the same feed-independent formula).
  • [5] Added the CLI's 'length is the same for every ratio' note to the TUI advise panel too.
  • New test resonant_points_keep_conductor_diameter_correction guards the physical correction.

All 367 lib tests + integration pass; clippy + fmt clean.

@dc0sk
dc0sk merged commit 3f8822e into main Jul 4, 2026
10 checks passed
@dc0sk
dc0sk deleted the fix/resonance-points-consistency branch July 4, 2026 10:25
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