kicad2ems.pcbqs.pdn.rail

A power rail as the board has it: the nets it spans (the rail tree), the parts
on it and what each one is.

    r = Rail(board, '+3V3', ground=('GND',), loads={'U21': 2.0, 'U14': 1.0})
    r.nets    # {'+3V3', '/DCDC/3V3_OUT'}: joined through the series parts in
              # r.series
    r.series  # [Series(part, a, b, kind, R, z100)]: sense / 0 ohm resistors,
              # beads, jumpers
    r.source  # the terminal the rail is fed from (a power inductor's output
              # pad, or the part named source=)
    r.ground_source, r.decaps, r.loads

The tree is grown from `net` through two-pad parts between two non-ground nets
that are, by their reference and value,
  resistors up to max_ohms (default 1 ohm: current-sense and 0 ohm links; a
    feedback divider's 10 k is not),
  ferrite beads (FB*, or an L* whose value reads like one: 600R@100MHz, BLM...,
    bead), jumpers and net ties (JP*, NT*),
and any part named in through=; never one in stop=. A power inductor (an L* in
henries) is where it ends: the regulator's output, and the default source (its
pad on the tree, the regulator's ground pads the return's source). An inductor
named in through= is instead a series inductor of the tree (an input filter):
its inductance and its DC resistance (dcr=, else a DCR field, else an assumed
DEFAULT_INDUCTOR_DCR) both stay in the model. dcr= {ref: ohms} also overrides
any series part's resistance.

The board is board.json's dict with its footprints (prims.footprints: ref,
value, props, lib, side, dnp, pads with name, net, layers, geom). A terminal is
a part's pads on some nets: [(layer, shapely polygon)] per pad, a through-hole
pad on every copper layer of the stack.
class kicad2ems.pcbqs.pdn.rail.Pad(part: str, name: str, net: str, layers: list, geom: object, xy: tuple)[source]
class kicad2ems.pcbqs.pdn.rail.Part(ref: str, value: str, props: dict, lib: str, side: str, pads: list, raw: dict = None)[source]
class kicad2ems.pcbqs.pdn.rail.Rail(board: dict, net: str, ground: tuple = ('GND', ), loads: dict = <factory>, source: str = None, ground_source: str = None, max_ohms: float = 1.0, through: tuple = (), stop: tuple = (), dcr: dict = <factory>, returns: dict = <factory>)[source]
is_decap(p)[source]
Whether part p is a decap footprint of the rail: a two-pad C (C1,
CA1, CE1 ...) from the tree to ground.
pads_of(part, role=None)[source]
(rail pads, ground pads) of a part: the source's are source_pads and
ground_source_pads.
sites()[source]
Every decap footprint of the rail, fitted or not (DNP), by
reference: where a capacitor can go (pdn.decoupling's sites).
class kicad2ems.pcbqs.pdn.rail.Series(part: kicad2ems.pcbqs.pdn.rail.Part, a: str, b: str, kind: str, R: float, z100: float = None, defaulted: bool = False, L: float = 0.0)[source]
pads(side)[source]
Its pads on net a or b (side 'a' or 'b').
kicad2ems.pcbqs.pdn.rail.classify(p, max_ohms=1.0)[source]
(kind, R ohms, z100, defaulted) of a two-net part that can join a rail
tree, ('inductor', henries, ...) for a power inductor, or None.
kicad2ems.pcbqs.pdn.rail.field_loads(board, nets)[source]
The loads the parts' own fields give for a rail of `nets`: ({ref: amps},
{ref: its return's ref}, notes).

A part's `pdn.load` field (KiCad: a field of the symbol, a property of the
footprint) is the current it draws:
    0.5        500m       2 A  amps, from this rail when the part has a pad
                               on it
    +3V3=0.4, +1V8=100m        a part on several rails: by net
    1.5@Q2                     returning through another part's ground pads
                               (--load REF=A@RETURN)
A part on none of the nets, or whose field names other nets, is not a load
of this rail; a field that cannot be read is named in the notes and gives
none.
kicad2ems.pcbqs.pdn.rail.field_value(fp, *keys)[source]
The value of the first of a part's fields `keys` (any case, or sim.<key>)
that has one, or None.
kicad2ems.pcbqs.pdn.rail.part_value(fp)[source]
The first value among a footprint's Val / Value fields, as libraries
and BOMs write it ('0.1 uF', '100nF/50V', 'R_0R001_0805', 'R_0603_10k': a
package code is no value), or None. fp: a footprint dict or a Part.
kicad2ems.pcbqs.pdn.rail.parts_of(board, dnp=False)[source]
The board's parts (Part), the unfitted ones (DNP) too when dnp.
kicad2ems.pcbqs.pdn.rail.return_part(pad_nets, ref, ground, rail=())[source]
The one part a load with no pad on ground returns through, or None (none
such, or several): of the load's kind (its reference's letters: a half
bridge's low-side switch for its high-side one), on one of the load's nets
that is no rail (not of the rail's tree `rail`, at most RETURN_NET parts)
and on ground. pad_nets:
{reference: the nets of its pads}.
kicad2ems.pcbqs.pdn.rail.terminal(pads, layers)[source]
[(layer, polygon)] of pads: an SMD pad on its layer, a through-hole one
(*.Cu, or several layers) on each of `layers` (the stack's copper layers,
names).