Add lossy RLGC ladder model to transmission line element#338
Open
esaruoho wants to merge 1 commit intopfalstad:devfrom
Open
Add lossy RLGC ladder model to transmission line element#338esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho wants to merge 1 commit intopfalstad:devfrom
Conversation
7 tasks
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]>
3febd16 to
2959b9c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Delay,Impedance(existing)Resistance(new, total Ω)Conductance(new, total S)Internally:
L_total = Z0 · delay,C_total = delay / Z0derived from existing parameters — no new electrical inputs other than R and G.[4, 50]based ondelay/timestepso the ladder resolves the propagation correctly at the current simulation timestep.InductorElm/CapacitorElm.R == 0 && G == 0→ falls back to the original delay-line code, no overhead.Addresses both points from #309
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.🤖 Generated with Claude Code