kicad2ems.pcbqs.pdn.viewer

The DC solve where kicad2ems's viewer reads results, beside the figures: the
board, the mesh and, per layer, the drop and the current on a grid, so the maps
can be turned, cut and probed instead of only looked at.

    write_viewer(out, board, dc, volts, nets, ground, refs)
        the files' names, for pdn.json

It writes
    <out>/pdn_board.json    the board read for the solve, the rail tree's and
                            the return's copper marked
    <out>/pdn_mesh_pdn.npz  the DC mesh (triangles, each sheet at its layer's z)
    <out>/pdn/exc_power/    the rail's copper: per layer,
                            dump_V_drop_<layer>_fd.npz (mV below the source) and
                            dump_J_<layer>_fd.npz (the sheet current, A per mm
                            of width, a vector as large as the solve's own J)
    <out>/pdn/exc_ground/   the return's: dump_V_rise_<layer>_fd.npz (mV above
                            the source's ground), and J
with a dump_info.json in each, as the near-field tool's H dumps have: plane
dumps at 0 Hz, zero off the copper. A triangle's current is constant over it and
the voltage linear, so the grid holds what the mesh does down to its cell (the
board's longer side over 600, at least 0.05 mm).
kicad2ems.pcbqs.pdn.viewer.dump_layout(board, nets, outline, crop=False)[source]
What write_info draws the dumps over: the nets' copper over the outline,
their vias (crop: only those inside it), the copper layers' heights and the
board's thickness.
kicad2ems.pcbqs.pdn.viewer.grid_of(bounds, cells=600, min_cell=0.05)[source]
The x and y lines (mm) of a grid over a box, square cells.
kicad2ems.pcbqs.pdn.viewer.on_grid(sh, x, y)[source]
A sheet's voltage (V; NaN off its copper) and its sheet current (A/mm, x
and y) at the grid's points: (nx, ny), (nx, ny, 2). The voltage is
interpolated over the triangle a point lies in, the current that triangle's
own; where matplotlib cannot search the mesh (a degenerate triangle), the
nearest vertex and triangle of the points on the copper.
kicad2ems.pcbqs.pdn.viewer.write_viewer(out, board, dc, volts, nets, ground, refs=())[source]
Write the files above; returns dict(board=, mesh=, dumps=[{side, layer,
field, file}]) for pdn.json. nets: the rail tree's; ground: the return's;
refs: the parts to show as the solve's own (source, loads, series parts,
decaps).