kicad2ems.pcbqs.circuit.deck

The ngspice deck of a resolved model: every part and coupling it lists, and
nothing else.

    deck = build(model, state=None)  # model: model.resolve()'s; state:
                                     # engine.end_state()'s, to continue a run
    result = deck.run(folder, 1 / period, cycles=..., ...)

It is power_spice.Circuit (the passives with their parasitics, the switch
models, the run) with the parts that were missing: a diode, a source, a load, a
coupling between two inductors, and a switch driven by a drive of any duty,
phase and dead time. Every two-terminal part is sensed the same way: <ref>.V is
the voltage from its first node to its second, <ref>.I the current entering its
first node, so V x I is the power it absorbs.
class kicad2ems.pcbqs.circuit.deck.Deck[source]
power_spice.Circuit and the general parts.
diode(ref, anode, cathode, model, initial_V=None)[source]
Vf_V at If_A sets the saturation current for the emission coefficient
n; R_ohm in series, Cj_F the junction capacitance at zero bias, TT_s the
transit time (reverse recovery).
load(ref, a, b, part)[source]
A resistance; or a constant power or a constant current, drawn by a
source of current that is a resistor below min_V (a tenth of a volt by
default), so the circuit can start from nothing.
source(ref, plus, minus, part, saved=None)[source]
A voltage source (dc_V, or a wave) with R_ohm and L_H in series, or a
current source (dc_A) pushing its current out of its + node.
kicad2ems.pcbqs.circuit.deck.build(model, state=None, copper=None)[source]
The deck of a resolved model. state: {ref: {initial_V, initial_A,
initial_I}} from a previous run's end (engine.end_state): every capacitor,
inductor and switch starts where that run stopped, and the run uses them
(uic); None: ngspice works out the DC solution at time zero, where every
gate is still low. copper (copper.prepare's): the board's copper between the
parts' pads, each pad a node of its own.
kicad2ems.pcbqs.circuit.deck.gate_timing(drive, invert, model, period)[source]
(delay, width, T) of a switch's gate pulse from its drive: on for duty x
T from phase (its complement: the rest of the period), each edge held back
by half the dead time, so a switch and its complement are never on together.
T is the drive's own period.
kicad2ems.pcbqs.circuit.deck.period_of(model)[source]
The analysis period (s): analysis.period_s when given, else the common
period of the drives and of the periodic sources (frequencies in
whole-number ratio; 200 kHz and 300 kHz share 10 us).