kicad2ems.mom25d.board

mom25d.board - a board in kicad2ems's file format (<name>_board.json, format
kicad2ems-board) as a mom25d model: the canonical board kicad2ems gives every
solver, read without kicad2ems.

    import json
    from kicad2ems.mom25d.board import BoardModel
    model = BoardModel(json.load(open('out/filter_board.json',
                                      encoding='utf-8')))
        # or kicad2ems's Board.to_dict()
    sim = model.simulation(dmax=0.3e-3, fmin=1e9, fmax=6e9)
    res = mom25d.api.solve_board('out/filter_board.json', freqs)
        # the same in one call

The board is in mm with y up; the model in metres. What a planar solver takes
from it:

  ground  the board's ground layer, else the lowest copper layer covering half
          the outline: the solver's infinite plane at z = 0 (its copper is not
          meshed); copper below it is left out (with a note). ground='none': the
          whole stack instead, no infinite plane: every copper layer meshed
          (planes too), the lowest on interface 0, air above and below
          (LayerStack bottom='open'), ports referenced to the nearest plane
          under or over them
  stack   the dielectric layers above the ground (whole stack: between the
          lowest and highest copper), copper layers on their interfaces
  copper  per interface; the outline is not modelled: MoM's dielectrics are
          laterally infinite
  vias    between the interfaces they span that have metal at the via (the
          ground counts)
  planes  planes='pec' (default): solid planes (pec_planes: in one piece over
          the whole board, no holes, ground nets only) as the stack's own PEC:
          the highest one under every other copper layer is the ground (the
          copper below it left out), the lowest over them a PEC cover
          (LayerStack top='pec'; the copper above it left out). None of their
          copper is meshed. 'mesh': only the ground is
  pads    stitching_pads='drop' (default): a ground via's pad with nothing else
          on its layer (lone_pads; not a part's or a port's) left out, the via
          kept as its barrel through that layer. 'keep': meshed
  walls   rows of vias every wall_pitch: a planar solver has no vertical sheets
  parts   a series R / L / C element across the gap between the pads, the gap
          bridged by a strip (a 0 ohm part: the strip alone)
  ports   the vertical ports: de-embedded wave ports where a straight feed
          allows, else lumped (via) ports; with pairs=True the legs of a
          differential port are one mixed-mode port. A gap port (a dipole or
          slot feed) has no planar equivalent.
kicad2ems.mom25d.board.ground_apertures(data, ground)[source]
Where the copper of layer `ground` is missing under the signal copper
above it (every net but the ground nets): a slot, a defected ground, a
patterned or partial ground, which mom25d's infinite ground plane fills in.
Counted within APERTURE_REACH heights (the dielectric between the ground and
the lowest signal copper, at least 1 mm) of the signal copper, and leaving
out a via's antipad (within max(3 r, r + 0.75 mm) of a via through the
layer), a pour's pullback (within APERTURE_EDGE of the outline) and pieces
under APERTURE_AREA. [(polygon, mm2)], largest first; [] for a complete
ground.
kicad2ems.mom25d.board.lone_pads(data, layers)[source]
stitching_pads='drop': {layer: [polygon index]} of the pads of ground
vias with nothing else on their layer (`layers`): a ground net, under
PAD_AREA, a ground via through it, touching no other copper there, no port
or part on it.
kicad2ems.mom25d.board.pec_planes(data, ground)[source]
planes='pec': (ground, cover) - the highest solid plane (_solid) from the
ground `ground` up that every other copper layer is above, and the lowest
solid plane above them all (None: there is none). With no copper but solid
planes: (ground, None).
kicad2ems.mom25d.board.plane_holes(data, lay, gnets, outline)[source]
planes='holes': copper layer `lay` as a PEC plane inside the stack
(mom25d.frill): one piece of ground-net copper over SOLID of the outline, no
port or part on it, whose every hole is the hole of one via through it (not
a ground via, not one that ends there), round or nearly, the via near its
middle. Other nets' copper on the layer must be those vias' own pads inside
their holes (left out: the pad's rim is the gap's inner edge). Returns (the
plane's polygon with its holes, [(via index, hole radius mm, inner radius mm
or None)]), or None.
kicad2ems.mom25d.board.slot_plane(data, lay, gnets, outline)[source]
planes='slots': copper layer `lay` (the ground) as a PEC plane of the
stack, infinite, its openings meshed (mom25d.slots). Its ground-net copper
must be one piece over SLOT_PLANE of the outline with no other net's copper
on the layer, no port or part on it, and no via in an opening. Returns (the
plane's polygon, [openings]) in mm; ValueError saying why not.
kicad2ems.mom25d.board.wall_points(walls, pitch, taken=())[source]
[(wall index, x, y)] (mm) of the vias that stand for edge walls [(axis,
at, t0, t1, z0, z1)], every `pitch` mm along each. A point within WALL_GAP
of a via already there (`taken`, or an earlier wall's: walls meeting at a
corner share their end) is left out: two vias in one place make the via
block singular (the SMA launch: 4 duplicated wall ends, an exact null space
a complex64 LU cannot factor).