kicad2ems.pcbqs.mqs

pcbqs.mqs - the magneto-quasistatic currents of a board's copper (the board much
smaller than a wavelength: a DC-DC converter's 0.1-30 MHz): where an AC current
flows (its return pulled under its path as the frequency rises, or around a
slot), the loop's R and L, and the near magnetic field it makes (Biot-Savart:
pcbqs.biot).

    q = MQS(board, nets={'VIN', 'GND', 'SW'},
            terminals={'U1.VIN': [('F.Cu', pad)], ...}, region=box(...),
            dmax=0.5)
    q.source('hot', 'U1.VIN', 'U1.PGND', part_h=0.5)
        # a current source in the part between its pads
    q.element('C1', 'C1.1', 'C1.2', C=10e-6, ESR=3e-3, ESL=0.4e-9)
    r = q.solve([1e6, 3e6])  # per frequency: currents, the sources'
                             # Z = R + j w L
    H = q.h_field(r, 0, pts)  # (n, 3) A/m at points (m) for 1 A in the sources

The copper of the nets on every layer (cropped to `region`, mm) is meshed by
pcbqs's mesher (pdn.mesh, the pads' outlines as mesh edges; `fine`, a shapely
region in mm, meshed at dmax_fine: the loop's own area) and carries RWG
currents; a via is a filament between the layers it joins; a part (a source, a
capacitor) a branch between its terminals, drawn for the field as a filament
`part_h` above its pads. The unknowns are the loop currents of the branch graph
(a spanning tree's cotree: Kirchhoff's current law holds by construction, no
node potentials), so a sweep is one small solve per frequency:
    Z_loops = C^T (R + j w L) C,   R: the sheets' Gram matrix / (sigma t) and
                                   the barrels',  L: mu0 / 4 pi of
    int int f_m . f_n / R (pcbqs's 1/R moments, analytic inner integral, between
                                   layers at their offset), the vias'
    partial inductances (parallel filaments), and the parts' series R, L, C.
Horizontal and vertical currents do not couple (orthogonal); the parts' own
fields count, their mutual inductance to the copper does not (a part's body: a
short filament well above it).

With capacitance=True, a homogeneous-dielectric surface-charge PEEC model
replaces the closed-loop constraint by charge continuity (pcbqs.peec).
It also provides Maxwell capacitance and Coulomb E; see docs/quasistatic.md.
class kicad2ems.pcbqs.mqs.Result(f: numpy.ndarray, i: numpy.ndarray, z: dict, names: list, zc: dict = None, charge: numpy.ndarray = None, potential: numpy.ndarray = None)[source]
kicad2ems.pcbqs.mqs.filament_mutual(z0a, z1a, z0b, z1b, s)[source]
Partial mutual inductance (H) of two parallel filaments along z, a from
z0a to z1a and b from z0b to z1b (m), s apart (the self term: s = the
radius). Grover: mu0 / 4 pi [g(a1 - b0) + g(a0 - b1) - g(a1 - b1) - g(a0 -
b0)], g(u) = u asinh(u / s) - sqrt(u^2 + s^2).
kicad2ems.pcbqs.mqs.spanning_tree(n_nodes, ends, is_src, first=None)[source]
A spanning forest of the branches `ends` [(a, b)] but the sources
(is_src): (tree (nb,) bool, comp (each node's component), up, upb, ups (each
node's parent in it, the branch to it and that branch's sense from the
parent), depth). The `first` branches (the copper) are a breadth-first
forest, each island's from its most central node; the rest (the parts) only
join islands the copper leaves apart, as before, so a source's loop crosses
a part only where the copper has no way round it (its copper alone,
Result.zc, is that loop's). The tree had been the branches' order: a mean
loop of 20-30 branches where breadth first gives 13-20 (the CM5's converter,
the wpthb ports, mom25d's demo board), the longest a third to two thirds as
long, with the same answers.
kicad2ems.pcbqs.mqs.via_inductance(vseg, rows=512)[source]
The via segments' partial inductance matrix (H): filaments along z, (x,
y, r, z0, z1) a row (m). Segments of one barrel (coaxial, i == j included)
take the barrel's radius, so stacked segments add up to the whole barrel. In
blocks of `rows` (a Python double loop had taken ~15 s at 2,500
segments).
kicad2ems.pcbqs.mqs.via_resistance(vseg, sigma, plating)[source]
Each via segment's DC resistance (ohm): its barrel's plated ring, (x, y,
r, z0, z1) a row (m).