kicad2ems.core.embed¶
Parts as internal ports, embedded after the solve (R-E5): a value changed, swept
or replaced by a vendor's measured model without solving the board again.
--part-ports all every two-pad R / L / C part a port across the gap
between its pads (or: C1,L2)
--part-value C1=1p,2.2p a value sweep of one part (repeat for others: every
combination, at most SWEEP_MAX)
--part-file C1=grm.s2p a part's vendor model, measured in series (port 1
to port 2 through the part)
The solvers solve the board with each such part as a lumped port across its gap
(a 'gap' port where the part's sheet would be, the part's reference its name),
every part port excited. Its S over the external and part ports is then closed
with each part's impedance: with Gamma = diag((Z_p - z_p) / (Z_p + z_p)) on the
part ports,
S_ext = S_ee + S_ep Gamma (I - S_pp Gamma)^-1 S_pe
which is the board with its parts (the external ports' columns those that were
excited). <name>_<solver>.sNp is the embedded result as a run without
--part-ports writes it; <name>_<solver>_ports.sMp the full one; a sweep writes
<name>_<solver>_<REF>=<value>[_...].sNp for each combination. A part's impedance
is its series R + jwL + 1/(jwC) (its value and sim.esr / sim.esl); a vendor
file's is 2 z0 (1 - S21) / S21, its series-through reading.
- kicad2ems.core.embed.close(S, names, zref, loads)[source]¶
S (nf, n, n) over `names` with the ports in `loads` ({name: Z (nf,)}) closed by those impedances: (S over the other ports, their names, their zref). A NaN column (a port not excited) stays NaN.
- kicad2ems.core.embed.file_impedance(path, f, z0=None)[source]¶
A two-port measured in series (a vendor's .s2p of a capacitor or inductor, port 1 to port 2 through it) as the impedance across the part: 2 z0 (1 - S21) / S21, interpolated to f. ValueError outside its band.
- kicad2ems.core.embed.impedance(R=None, L=None, C=None, f=None)[source]¶
A series R-L-C's impedance at f (Hz, array); None for each element absent.
- kicad2ems.core.embed.loads_of(parts, f, files=None, combo=())[source]¶
{ref: Z (nf,)} of the part ports: their own values, a vendor file's where one is given, a sweep's value.
- kicad2ems.core.embed.part_port(part, z0=50.0, name=None)[source]¶
The 'gap' Port across a part's gap (where its lumped sheet would be): named after the part.
- kicad2ems.core.embed.sweep(spec, parts)[source]¶
The combinations of --part-value ({REF: 'v1,v2'}) as [{REF: (R, L, C)}], at most SWEEP_MAX; ValueError for a part that is not a part port or a value that is not one. A value replaces the part's own element of its kind (a capacitor's C), its parasitics kept.