kicad2ems.fem.palace.cap

Capacitance between nets, by Palace's electrostatic solver on the real stack:
the dielectric slabs inside the board outline (finite, as built), air around
them, the copper of each net a conductor.

    python -m kicad2ems.fem.palace.cap board.kicad_pcb \
        --net SW --net VIN --net GND --out cap_sw
    r = solve(board, ['SW', 'VIN', 'GND'], 'cap_sw')
        # r['C']: the Maxwell matrix (F), r['names']

- Each `--net` is one conductor (a terminal); `A+B` joins nets into one. Copper
  of other nets is left out, not floating: name what matters.
- Copper is a zero-thickness sheet on its layer, or with `--thick` a solid of
  its thickness (the outer layers outward): the side walls' capacitance, which
  is not small between close traces. Vias are solid cylinders.
- The outer faces of the air box carry no charge (`--far open`, the default: the
  conductors' charges sum to zero) or are grounded (`--far ground`: a shield
  `--margin` mm away, default half the board's longer side). The two bracket the
  capacitance between two conductors far from anything else, open from above;
  they differ by a few % on a small board in air and less on a dielectric. The
  capacitance to the surroundings needs `--far ground` and falls as 1 / margin.
- Mesh: `--h` at the copper edges (default: the smallest of the slab thicknesses
  and the gaps between conductors on a layer), growing to `--hmax` away from
  them. The charge peaks at the edges, so the answer falls towards the true one
  in proportion to `--h`: about 5% high at the default on a trace 1.5 slabs
  wide, 1% at a tenth of it. Refine `--h` until the answer stops moving.

The Maxwell matrix C: Q_i = sum_j C_ij V_j, so C_ii is conductor i's capacitance
with every other grounded and -C_ij the capacitance between i and j. Palace also
writes the mutual (SPICE) form, r['Cm'].
kicad2ems.fem.palace.cap.cap_model(board, nets, path, thick=False, h=None, hmax=None, margin=None, crop=None, grade=3.0, tol=0.01, log=<built-in function print>, threads=8, binary=True)[source]
Mesh the dielectric and the air around the conductors of `nets` and write
it to `path` (gmsh 2.2). Returns dict(diel=[(attribute, er)], air, outer,
terminals=[(name, attribute)], h, hmax, margin, tets, nodes).
kicad2ems.fem.palace.cap.parser(prog='kicad2ems-fem-cap', doc="\nCapacitance between nets, by Palace's electrostatic solver on the real stack:\nthe dielectric slabs inside the board outline (finite, as built), air around\nthem, the copper of each net a conductor.\n\n    python -m kicad2ems.fem.palace.cap board.kicad_pcb \\\n        --net SW --net VIN --net GND --out cap_sw\n    r = solve(board, ['SW', 'VIN', 'GND'], 'cap_sw')\n        # r['C']: the Maxwell matrix (F), r['names']\n\n- Each `--net` is one conductor (a terminal); `A+B` joins nets into one. Copper\n  of other nets is left out, not floating: name what matters.\n- Copper is a zero-thickness sheet on its layer, or with `--thick` a solid of\n  its thickness (the outer layers outward): the side walls' capacitance, which\n  is not small between close traces. Vias are solid cylinders.\n- The outer faces of the air box carry no charge (`--far open`, the default: the\n  conductors' charges sum to zero) or are grounded (`--far ground`: a shield\n  `--margin` mm away, default half the board's longer side). The two bracket the\n  capacitance between two conductors far from anything else, open from above;\n  they differ by a few % on a small board in air and less on a dielectric. The\n  capacitance to the surroundings needs `--far ground` and falls as 1 / margin.\n- Mesh: `--h` at the copper edges (default: the smallest of the slab thicknesses\n  and the gaps between conductors on a layer), growing to `--hmax` away from\n  them. The charge peaks at the edges, so the answer falls towards the true one\n  in proportion to `--h`: about 5% high at the default on a trace 1.5 slabs\n  wide, 1% at a tenth of it. Refine `--h` until the answer stops moving.\n\nThe Maxwell matrix C: Q_i = sum_j C_ij V_j, so C_ii is conductor i's capacitance\nwith every other grounded and -C_ij the capacitance between i and j. Palace also\nwrites the mutual (SPICE) form, r['Cm'].\n")[source]
The tool's options.
kicad2ems.fem.palace.cap.read_c(postpro, n, name='terminal-C.csv')[source]
An (n, n) matrix (F) from Palace's terminal-C.csv (Maxwell) or
terminal-Cm.csv (mutual).
kicad2ems.fem.palace.cap.report(r)[source]
The matrix as text, pF.
kicad2ems.fem.palace.cap.solve(board, nets, out, thick=False, h=None, hmax=None, margin=None, crop=None, order=2, far='open', np_=None, log=<built-in function print>)[source]
The capacitance matrix between `nets` (each a conductor; 'A+B' joins
nets). Returns dict(names, C, Cm (F), tets, h, hmax, margin, seconds) and
writes it to <out>/cap.json; Palace's case is in <out>/palace.