kicad2ems.core.lines.calc

The impedance of a stack-up, without a board: a line's width, its pair's gap,
the copper and the dielectrics in; Z0, the pair's Zdiff and eeff out, from the
2D field solver (xsection), and the width or gap that gives a target.

    line = Line(w=0.35, t=0.035, below=[(0.2, 4.3, 0.02)])
        # microstrip on 0.2 mm of FR-4
    r = calculate(line)
        # r['z0'], r['eeff'], r['delay_ps_mm']
    line = fit(line, 50.0)
        # the width of 50 ohm
    pair = fit(Line(w=0.15, gap=0.15, t=0.035, below=[(0.1, 4.1, 0.02)]),
               100.0, what='zdiff')
    Line.on_board('board.kicad_pcb', 'In2.Cu', w=0.14, gap=0.15)
        # that board's stack around In2.Cu
    e = element(line)
        # for lines.sections.solve: the field

    python -m kicad2ems.core.lines.calc --w 0.35 --h 0.2 --er 4.3 --t 0.035
    kicad2ems-z0 --board board.kicad_pcb --layer F.Cu --target 50 --plot z0.png

A Line is one strip, or a symmetric pair (gap), `t` thick, standing on the
dielectrics `below` it (from the plane under it up to the copper's lower face)
with the dielectrics `above` over it (from the copper's upper face up; the first
of them also fills in beside the copper; none: air). Thicknesses are between
copper faces, as a board's stack-up gives them and as the line model's cuts take
them. `top_plane` closes the stack with a plane (a stripline), `ground_gap` puts
coplanar ground beside the copper, `mask` a solder mask that follows it. The
planes are solid and wide; what the board's copper really does beside a trace is
the line model's job (--lines-field).

Quasi-static, as the solver is: no dispersion and no conductor loss (the
dielectric's is given). Nothing is snapped to the line model's 1 % steps here
(xsection.SIMILAR): a fitted width is to the tolerance asked for.
class kicad2ems.core.lines.calc.Line(w: float, t: float = 0.035, below: list = <factory>, above: list = <factory>, top_plane: bool = False, gap: float = None, ground_gap: float = None, ground_width: float = None, mask: float = 0.0, er_mask: float = 3.5, tand_mask: float = 0.0)[source]
A strip (or a symmetric pair) in a stack of dielectrics over a plane. mm;
the module docstring has the rest.
property kind[source]
What it is called: 'microstrip', 'embedded microstrip', 'stripline',
each maybe 'coplanar'.
classmethod on_board(path, layer, w, **kw)[source]
A line on copper layer `layer` of a board file's stack-up, between
the copper layers next to it taken as planes (an outer layer: the one
inside it, and its solder mask if the stack-up has one): the dielectrics
and the copper's thickness from Board Setup > Physical Stackup. An inner
layer's copper is taken to be pressed into the dielectric over it. kw:
gap, ground_gap, t (to override) ...
kicad2ems.core.lines.calc.board_layers(path)[source]
The copper layers of a board file's stack-up, top first: what
Line.on_board takes; [] without a stack-up.
kicad2ems.core.lines.calc.calculate(line, f=None)[source]
What the field solver gives for a Line: dict(kind, z0, eeff, delay_ps_mm,
c_pf_m, l_nh_m, tand_eff, nodes; a pair also zdiff, zcommon, zodd, zeven,
eeff_odd, eeff_even, coupling (the voltage coupling of matched lines, (Ze -
Zo) / (Ze + Zo)), with z0 one strip's, the other grounded; `formula`: (name,
Z0, eeff) of the closed form where one applies). f (Hz): also loss_db_m, the
dielectric's loss at f (the conductor's is not solved).
kicad2ems.core.lines.calc.cross_section(line)[source]
The xsection.CrossSection of a Line: the plane under it at z = 0, the
copper centred on x = 0.
kicad2ems.core.lines.calc.describe(line)[source]
One line about a Line: 'microstrip pair: w 0.15, gap 0.15, t 0.035 mm on
0.1 mm er 4.1'.
kicad2ems.core.lines.calc.element(line, r=None)[source]
The Line as a drawing element of the line model (lines.sections.solve(e),
the GUI's Section view): its cross-section to solve and draw, a pair with
its odd and even modes.
kicad2ems.core.lines.calc.fit(line, target, what=None, vary='w', tol=0.001, limits=None)[source]
The Line whose `what` ('z0'; a pair's 'zdiff' by default, 'zcommon',
'zodd', 'zeven') is `target` ohm, by changing `vary` ('w', 'gap' or
'ground_gap'): a root search around the solver, to `tol` of the target.
ValueError when no value within the limits (LIMITS, mm) gives it, with what
they do give.
kicad2ems.core.lines.calc.line_of(a)[source]
The Line of parsed arguments (parser()).
kicad2ems.core.lines.calc.plot(line, path, r=None, mode=None)[source]
The field across the Line as a picture: |E| in colour, equipotentials,
the copper and the dielectrics' faces. mode: 'odd' or 'even' for a pair (odd
by default).
kicad2ems.core.lines.calc.report(line, r)[source]
The lines a command prints for calculate()'s result.