Skip to content

Add lossy RLGC ladder model to transmission line element#338

Open
esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho:transmission-line-rlgc-losses
Open

Add lossy RLGC ladder model to transmission line element#338
esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho:transmission-line-rlgc-losses

Conversation

@esaruoho
Copy link
Copy Markdown

Summary

Adds optional series resistance (R) and shunt conductance (G) to TransLineElm. When both are zero the element is the original lossless delay line. When either is non-zero, the element switches to an N-segment RLGC lumped-element ladder, giving distributed attenuation and dispersion.

Supersedes #309. That PR started as a simple two-port resistance approximation, which @pfalstad correctly noted didn't model real lossy lines (no dispersion, instant attenuation). I reworked it into the RLGC ladder mid-PR but the conflicting comments and history made it hard to review. Opening this as a clean PR with one focused commit.

What's new

Parameter Behavior
Delay, Impedance (existing) Unchanged
Resistance (new, total Ω) Series R distributed across segments
Conductance (new, total S) Shunt G distributed across segments

Internally:

  • L_total = Z0 · delay, C_total = delay / Z0 derived from existing parameters — no new electrical inputs other than R and G.
  • N segments auto-selected in [4, 50] based on delay/timestep so the ladder resolves the propagation correctly at the current simulation timestep.
  • Each segment uses trapezoidal companion models for L and C, matching InductorElm / CapacitorElm.
  • Series R and inductor companion resistance combined into a single Norton equivalent per segment to minimise added internal nodes.
  • R == 0 && G == 0 → falls back to the original delay-line code, no overhead.

Addresses both points from #309

@pfalstad concern How RLGC ladder addresses it
"Not showing attenuation over the length of the line" — at R=500 attenuation was instant Losses accumulate per segment, visible in the voltage coloring along the line
"Real lossy line has dispersion and this model doesn't show that" The LC ladder naturally produces frequency-dependent propagation; pulses broaden as they travel

A proper SPICE LTRA (lossy transmission line, distributed) implementation would still be more accurate for high-frequency / high-Q work, but the lumped RLGC ladder is a substantial step up from the previous two-port resistance and is the standard educational/intermediate model.

Test plan

  • R = G = 0 (default for old circuits): identical to the existing lossless delay line.
  • R = 100 Ω: signal attenuates progressively along the line; voltage coloring shows the gradient.
  • Step input on a lossy line: rise time visibly broadens at the far end (dispersion).
  • Reflection from open/short termination: amplitudes attenuated by round-trip loss.
  • Save/load: R and G round-trip via XML attrs; old circuits load with R=G=0.
  • Vary timestep: N adapts so the visible behaviour stays consistent.

🤖 Generated with Claude Code

@esaruoho esaruoho changed the base branch from v3-dev to dev April 15, 2026 09:50
Adds optional series resistance R and shunt conductance G to
TransLineElm. When both are zero the element behaves as the original
lossless delay line. When either is non-zero the element switches to
an N-segment lumped-element ladder where each segment is a series
R/N + L/N and a shunt C/N + G/N pair, giving distributed attenuation
and dispersion that the previous simple-port-resistance model lacked.

Rationale per @pfalstad on the earlier draft (pfalstad#309): the original
two-port resistance approximation showed instant attenuation with no
dispersion, which isn't representative of a real lossy line. The
RLGC ladder produces frequency-dependent propagation so pulses
broaden as they travel, and losses accumulate visibly along the
length.

Implementation:
- L_total = Z0 * delay; C_total = delay / Z0 (derived from the
  existing Delay and Impedance parameters - no new electrical
  inputs other than R and G).
- N is auto-selected in the 4..50 range based on delay/timestep so
  the ladder resolves the propagation accurately at the simulation
  timestep.
- Each segment uses trapezoidal companion models for L and C
  matching the existing Inductor/CapacitorElm approach.
- The series R and inductor companion resistance are combined into
  a single Norton equivalent per segment, so no extra intermediate
  nodes are added beyond what the segmentation requires.

Supersedes the work in pfalstad#309 (which started as a simple two-port
resistance and was reworked into the present RLGC ladder mid-PR;
the history made the PR confusing to review, so opening a clean
one).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@esaruoho esaruoho force-pushed the transmission-line-rlgc-losses branch from 3febd16 to 2959b9c Compare April 15, 2026 10:37
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