kicad2ems.core.rlgc

kicad2ems.core.rlgc - per-unit-length R(f), L(f), G(f), C(f) of transmission
lines: a cross-section given by its sizes, or every distinct cross-section of a
board's nets (each coupled group and each single trace as the line model cuts
the board across it). R and L have the skin and proximity effects and the
return's own crowding in the planes (kicad2ems.core.lines.mqs: a 2D
eddy-current solve with the copper meshed inside); G and C are the field
solver's (kicad2ems.core.lines.xsection).

    python -m kicad2ems.core.rlgc board.kicad_pcb --nets 'DQ*,CLK*' --out o
        [--layers F.Cu,In2.Cu] [--min-length 1]
    python -m kicad2ems.core.rlgc --xs microstrip --w 0.15 --lines 2
        --gap 0.15 --h 0.2 --er 4.3 --t 0.035 --out o
    python -m kicad2ems.core.rlgc --xs stripline --w 0.1 --h 0.15 --h2 0.15
        --er 3.7 --t 0.018 --out o
    python -m kicad2ems.core.rlgc --xs section.json --out o
        # an xsection.CrossSection's to_dict()
      common: [--fmin 0.001] [--fmax 20] GHz [--per-decade 5] [--sigma 5.8e7]
              [--rough um] [--diel fixed|wideband] [--diel-fref 1] GHz
              [--length mm] [--z0 50]

Each section gets
  <out>/<name>.rlgc       the W-element's RLGC file (HSPICE's RLGCfile=): Lo
                          the external inductance, Co, Ro the DC resistance,
                          Go 0, Rs and Gd fitted (R = Ro + Rs sqrt(f) (1 + j),
                          G = Gd f): the analytic model
  <out>/<name>_w.inc      the W-element's tabular model (MODELTYPE=TABLE: the
                          four `sp` models, every frequency, DC first)
  <out>/<name>.s<2N>p     its S-parameters over its length (ports 1..N the near
                          ends, N+1..2N the far ends), reference z0
  <out>/rlgc_<name>.png   R and L of each line over frequency (the FIGURES
                          longest sections)
and <out>/rlgc.json every section: its nets, layer, length, cross-section, the
matrices at every frequency, its modes' attenuation and impedance at fmax.

On a board, the nets are those whose names match a pattern (fnmatch, as
core.coupling has them); the line model of those nets is built with every
section on the board's cut (field 'all'), the reference copper every net that
is not a routed signal (ipc's impedance map's rule). Sections of one net (or
one group of nets) on one layer with the same cross-section are one, their
lengths added; a section shorter than --min-length mm is left out (a pad's
breakout), and so is a stretch of no reference copper. The planes' and the
other layers' copper get their own layers' thickness.
class kicad2ems.core.rlgc.LineParameters[source]
Per-unit-length RLGC of a board's lines (this module).
check()[source]
(usable, one line): its version and origin, or what is missing and
how to get it.
command(values, board, out, preview=False, results=None)[source]
[program, argument ...] that runs it into folder `out`; ValueError:
what is missing.
curves(folder)[source]
What the result in `folder` holds, to plot: a list of curve sets.
figures(folder)[source]
The figures of the answer in `folder`, by name: [dict(name, value,
unit)], or [].
options()[source]
Its settings, [Option].
report(folder)[source]
What the result in `folder` holds, to read (the module docstring has
the form), or None.
status(line)[source]
The progress a line of its output states, or None.
tag(values)[source]
A short name for a run of these settings (its folder's).
kicad2ems.core.rlgc.board_sections(path, patterns, layers=None, min_length=1.0, echo=<built-in function print>)[source]
(sections, left out, the board's nets matched): each distinct
cross-section of the nets matching `patterns` on the board, as the line
model cuts it: [dict(name, nets, layer, kind, length_mm, pieces, source,
xs, plane_t, sheet_t)].
kicad2ems.core.rlgc.frequencies(fmin_ghz, fmax_ghz, per_decade=5)[source]
DC, then fmin to fmax (GHz) per_decade points a decade (Hz).
kicad2ems.core.rlgc.given_section(a)[source]
The CrossSection the command line describes (--xs microstrip,
stripline, or a JSON file).
kicad2ems.core.rlgc.impedances(r)[source]
The lossless impedances: a single line's Z0, a pair's differential and
common (2 Zodd, Zeven / 2), from C and C_air (as xsection gives them).
kicad2ems.core.rlgc.modes(r, i)[source]
The modes of the lines at frequency index i: [(attenuation dB/mm,
eeff)], the fastest first (a single line's one; a pair's even mode is the
slower on microstrip).
kicad2ems.core.rlgc.plot(r, names, path, title)[source]
R and L of each line (its self terms) over frequency.
kicad2ems.core.rlgc.run(a, echo=<built-in function print>)[source]
Solve and write; returns the result dict.
kicad2ems.core.rlgc.write_rlgc(path, r, title='')[source]
The W-element's RLGC file (HSPICE's RLGCfile=): N, then the lower
triangles of Lo (the external inductance, H/m), Co (F/m), Ro (the DC
resistance, ohm/m), Go (0), Rs (ohm/(m sqrt(Hz))) and Gd (S/(m Hz)) of
R(f) = Ro + sqrt(f) (1 + j) Rs and G(f) = f Gd: Rs fitted where the skin
is thinner than the copper (R - Ro above Ro; else the top third of the
band), Gd at the top frequency.
kicad2ems.core.rlgc.write_sparams(path, r, length_mm, z0, names)[source]
The S-parameters of length_mm of the lines (above DC), Touchstone.
kicad2ems.core.rlgc.write_table(path, r, name)[source]
The W-element's tabular model (MODELTYPE=TABLE): `sp` models of L, C,
R and G over every frequency (lower triangles, SPACING=NONUNIFORM), and
the W model naming them; a W element then takes TABLEMODEL=<name>.