kicad2ems.pcbqs.circuit.kicad¶
KiCad into the general model: the parts, their values and their nodes from a
schematic, a netlist or a board.
document = read(path) # .kicad_sch (through kicad-cli), a
# KiCad XML netlist, or a .kicad_pcb
model = model_from(document) # a new model of everything that can
# be taken over
model = apply(model, document, refs) # or into a model that exists: add
# these parts, or bring them up to
# date
python -m kicad2ems.pcbqs.circuit --from-kicad board.kicad_pcb > model.json
What is taken over, each a part between the two nets its pins are on:
R, C, L by its symbol, its reference (R1) or its footprint's library;
the value as KiCad writes it (4k7, 22u, 0R01, 47uH); ESR, ESL
and DCR from fields of those names
a diode reference D<n> or a D symbol: anode to cathode by its pins'
names (A, K), else pad 2 to pad 1 as KiCad numbers them; Vf
from a field Vf, 0.45 V for a Schottky, else 0.7 V
a MOSFET pins named D, G, S: a switch from its drain's net to its
source's, on the model's first drive
KiCad's Sim.* Sim.Library and Sim.Name (a vendor's .subckt or .model in
that library; the path from the schematic's folder,
${KIPRJMOD} and other variables expanded) make a diode's or a
MOSFET's model the vendor's: Sim.Pins (symbol pin = model
pin) puts D, G, S (or A, K) in the subcircuit's order, its
other pins on their nets or, unconnected, on their own;
Sim.Params of a built-in VDMOS or diode are its SPICE
parameters
A node is the net's name (without KiCad's leading '/'); the board's own name is
kept in board.nets where it differs, and a board that was read becomes the
model's board, so its copper can be put in (circuit/copper.py).
What KiCad does not say is left to add: which connector is the source and which
the load, what drives the switches and how fast, and what to measure. status()
says for each part what would be done with it and why not.
- kicad2ems.pcbqs.circuit.kicad.apply(model, document, refs, update_connections=True)[source]¶
The model with the document's components `refs` added, or brought up to date where the model has them (value, parasitic fields, and the nodes when update_connections). The model given is left as it is.
- kicad2ems.pcbqs.circuit.kicad.model_from(document, name=None)[source]¶
A new model of every component of the document that can be taken over and is fitted.
- kicad2ems.pcbqs.circuit.kicad.node_of(net)[source]¶
A net's name as a node: KiCad's leading '/' (a net named on the root sheet) left off.
- kicad2ems.pcbqs.circuit.kicad.pad_functions(text)[source]¶
{reference: {pad: its pin's name}} from a board file's text: what KiCad writes as (pinfunction "...").
- kicad2ems.pcbqs.circuit.kicad.part_of(c, drives=(), folder=None)[source]¶
A document's component as a part of the general model, or why it is not one: (part | None, reason). folder: where the document is (a Sim.Library's path is from it).
- kicad2ems.pcbqs.circuit.kicad.read(path)[source]¶
The document of a KiCad file: a board (.kicad_pcb), a schematic (.kicad_sch, needs kicad-cli) or a KiCad XML netlist.
- kicad2ems.pcbqs.circuit.kicad.read_board(path)[source]¶
A board as the document read_schematic gives: {components: [{ref, value, kind, value_si, pins: [{number, name, net}], dnp, exclude_from_sim, fields, ...}], ...}, from its footprints, their pads' nets and their pads' pin names.