kicad2ems.core.si¶
kicad2ems.core.si - crosstalk between traces: the near end (NEXT) and the far
end (FEXT), and what in the layout makes it
python -m kicad2ems.core.si board.kicad_pcb --nets D0,D1,D2 --out out/xt
[--aggressor D1] [--near U1] [--mode both|next|fext] [--rise 100]
[--limit 3] [--solvers lines[,mom25d]] [--ground B.Cu] [--fmax GHz]
[--z0 50]
The traces are named by their nets. Each gets a port at its two ends (the ends
of its routed copper: a pad where one is there, else the track's end), the near
end the one at the part `--near` names (else the ends nearest the first trace's
first end), and the S-parameters between all of them are solved: by the line
model (its coupled sections from the 2D field solver; milliseconds), and by a
full-wave solver beside it when one is named.
A differential pair (its legs by their names: D0_P / D0_N, TX+ / TX-) is one
trace in its differential mode, as it drives and as its receiver sees it (the
voltage share between modes: kicad2ems.core.coupling's channels); --legs takes
its legs as two traces. With trace a driven at its near end (the aggressor), a
victim v's
NEXT is S(v near, a near): what comes back at the victim's near end
FEXT is S(v far, a near): what arrives at its far end
over frequency (dB), and in time for an edge of `--rise` ps (10 to 90 %): the
largest voltage at each end as a share of the aggressor's swing, from the
S-parameters (a trapezoid's Fourier series through them). Each trace is the
aggressor in turn unless `--aggressor` names them; a victim with several
aggressors also gets their sum (the worst case in time, the power sum in
frequency).
The layout's part (crosstalk.json's `sections`): every stretch where an
aggressor and a victim run side by side, with its length, gap and layer, and
from its cross-section's capacitance and inductance matrices
Kc = Cm / C, Kl = Lm / L the capacitive and the inductive coupling
NEXT = (Kc + Kl) / 4 saturated: an edge shorter than twice the
stretch's delay; below, in proportion (2
Td / rise)
FEXT = (Kc - Kl) / 2 x Td / rise grows with the length; zero where Kc = Kl
(stripline: one dielectric)
and what a wider gap would give (the same section solved with the victim moved
away). The estimates explain; the figures reported are the solved network's.
Results: <out>/crosstalk.json (this module's), the run's own files beside it
(<name>_<solver>.sNp, <name>_lines.json).
- class kicad2ems.core.si.Crosstalk[source]¶
Crosstalk between traces (this module).
- check_with(sets)[source]¶
(usable, one line) of one of its variants (the settings `sets` fixes): its own check.
- command(values, board, out, preview=False, results=None)[source]¶
[program, argument ...] that runs it into folder `out`; ValueError: what is missing.
- discover(values, board)[source]¶
A command that proposes settings from the board, or None: it has none.
- figures(folder)[source]¶
The figures of the answer in `folder`, by name: [dict(name, value, unit)], or [].
- kicad2ems.core.si.as_channels(S, names, unknown, aggressors, z0, pairs=True)[source]¶
S of the traces as their channels' (kicad2ems.core.coupling.channels: a differential pair one, by its legs' names): (S of each channel's main mode at its two ends, as voltage ratios between modes of other impedance (a pair's differential 2 z0, a single trace's z0), its names {label: (channel, end)}, the unknown terms by those labels, the aggressors as channels). With no pair (or pairs False), S, names, unknown and aggressors as given.
- kicad2ems.core.si.crosstalk(f, S, names, rise_s, aggressors=None, unknown=())[source]¶
The crosstalk of S (nf x n x n, ports `names`: {port: (net, 'near' | 'far')} in order): [dict(aggressor, victim, next_db, fext_db (lists over f), next_peak_db, next_peak_Hz, fext_peak_db, fext_peak_Hz, next_pct, fext_pct (the edge's largest share of the swing, %), next_t / next_v, fext_t / fext_v (the edge's waveforms, ns and share))].
- kicad2ems.core.si.edge_response(f, H, rise_s, taper=0.2)[source]¶
(t, v): the voltage H's port sees for an edge of 10-90 % rise `rise_s` (s) and unit swing at the driven port, over the edge and what follows it. f (Hz, rising), H (complex, on f). A trapezoid of a long period is put through H as its Fourier series; below f[0] H runs to 0 at DC (coupling has none), the top `taper` of the band is faded out.
- kicad2ems.core.si.find_pairs(kb, reach=3.0, min_length=3.0, most=12)[source]¶
The pairs of nets whose tracks run side by side on one layer: [dict(nets, layer, length_mm, gap_mm)], the longest and closest first. Two tracks count where they are nearly parallel and nearer each other, edge to edge, than `reach` times the wider one's width; a pair of less than min_length mm is left out, and nets with zones (planes, pours) are not traces.
- kicad2ems.core.si.order_ends(ends, near=())[source]¶
{net: (near end, far end)}: a trace's near end is the one on a pad of a part in `near`; else the one nearest the first trace's near end (the first trace's own: its first).
- kicad2ems.core.si.port_specs(ordered)[source]¶
(the --port specs, {port name: (net, 'near' | 'far')}): trace k's near end P(2k+1), its far end P(2k+2).
- kicad2ems.core.si.renormalised(S, zold, znew)[source]¶
S (nf x n x n) at the real port impedances zold (a number or one a port) as at znew (a number): each trace terminated in znew.
- kicad2ems.core.si.run(a, echo=<built-in function print>)[source]¶
Run the question for parsed arguments `a`; returns the result (crosstalk.json's dict).
- kicad2ems.core.si.sections(lines, nets, rise_s, widen=3, notes=None)[source]¶
The stretches where two of `nets` run side by side, from a line model's drawing (<name>_lines.json's dict): [dict(nets (the two), layer, length_mm, gap_mm (edge to edge; None: on different layers), dz_mm, delay_ps, z0, kc, kl, next_pct (the estimate for this edge), next_sat_pct (saturated), saturated, fext_pct, wider=[dict(gap_mm, next_pct, fext_pct)])], the worst first. The `widen` worst stretches on one layer are solved again at the GAPS (the report shows those; each is three solves, which every pair of a bus had had). A stretch whose cut the solver cannot take is left out, said in `notes` (a list) when given.
- kicad2ems.core.si.time_grid(fmax_hz, length_mm, er, base=401, cap=16001)[source]¶
(fmin, points) of the linear grid the crosstalk's edge responses are made on, to fmax_hz: fine enough for the longest trace (length_mm, its delay td at sqrt(er)): S ripples in frequency with a period of 1 / (2 td), and edge_response interpolates S linearly, so 16 samples a ripple (a 5 % coupler 1 m long under a 25 ps edge read 1.92 % of its 2.5 % plateau on the fixed 401 points, 2.51 % on this grid: R-E16).
- kicad2ems.core.si.trace_ends(kb, net, tol=0.001, layer=None)[source]¶
The two ends of net's routed copper on board kb (importers.kicad.KiCadBoard), [dict(x, y, layer, pad, at)]: the pair of free track ends furthest apart along the tracks (a net of several separate pieces: its longest). pad: (ref, name) of the pad the end is on, or None; at: a point INSET mm in from a free end. KiCad mm. layer: its stretch on that copper layer alone (its tracks there, not joined through vias: it ends where it leaves the layer).
- kicad2ems.core.si.unknown_terms(path)[source]¶
The S terms a Touchstone file of kicad2ems's says it did not compute (written as 0: the line model's ports with no path between them), as {(row port, column port)}.
- kicad2ems.core.si.victims(rows, f)[source]¶
Each victim with all its aggressors: [dict(victim, aggressors, next_pct, fext_pct (the sum of their peaks: the worst case), psnext_db, psfext_db (their power sum over f), psnext_peak_db, psfext_peak_db)].
- kicad2ems.core.si.worst(res)[source]¶
The largest NEXT and FEXT of the answer's pairs (one aggressor at a time), and whether the limit is met for the mode asked: None (not judged) where a pair's coupling was not computed (the line model with no coupled section between them: its 0 is no answer), listed in not_modelled.