kicad2ems.pcbqs.conducted¶
pcbqs.conducted - the conducted emission of a switching circuit as a CISPR test
measures it: the circuit (pcbqs.circuit, ngspice, on its board's copper when
asked) fed through a line impedance stabilisation network (LISN, an artificial
network) in each supply line, the voltage at the networks' EUT terminals taken
over a steady period to its spectrum, read by a CISPR 16-1-1 receiver (peak,
quasi-peak and average detectors) and set against CISPR 32's or CISPR 25's
limits.
python -m kicad2ems.pcbqs.conducted buck.json --standard cispr32 \
--cispr-class B --out emc
python -m kicad2ems.pcbqs.conducted buck.json --standard cispr25 \
--cispr-class 5 --cm-cap sw=15p --copper --out emc25
from kicad2ems.pcbqs import conducted
res = conducted.run(model, 'emc', standard='cispr32', klass='B')
res['cases'][0]['margins'] # per band and detector: the worst line's dB
The networks (one per supply line, the model's DC source moved behind them):
cispr16 the 50 ohm / 50 uH + 5 ohm V-network of CISPR 16-1-2 (9 kHz - 30
MHz; CISPR 32's): its impedance at the EUT terminal 50 || (5 + j w
50 uH). Realised as 50 uH from the EUT terminal to a node held to the
reference by 5 ohm in series with 8 uF and fed from the supply
through 250 uH, and the receiver's 50 ohm behind 1 uF: within 0.9 %
of the standard's impedance from 150 kHz to 30 MHz, 15 % at 9 kHz
(the standard allows 20 %).
cispr25 the 5 uH / 50 ohm artificial network of CISPR 25 (0.15 - 108 MHz): 5
uH from the supply to the EUT terminal, 1 uF to the reference on the
supply side, the receiver's 50 ohm (and 1 kohm) behind 0.1 uF: 50 ||
j w 5 uH within 5 %.
The source's minus is the reference (the ground plane the networks stand on);
the return line has its network too (`--lines +` leaves it out: then the board's
return is the reference, and there is no common mode). The disturbance voltage
reported is the EUT terminal's against the reference, as the receiver's reading
corrected by the network's voltage-division factor gives it. Each line's (L+,
L-) is read; the differential mode is (V+ - V-) / 2, the common mode (V+ + V-)
/ 2.
The common mode needs a path from the circuit to the reference: each model
node's copper has a capacitance to a plane `--height-mm` below the board
(CISPR 25: 50 mm, the EUT on its support; CISPR 32: 400 mm, its distance to the
vertical reference plane), from pcbqs's electrostatic kernel (the nets' copper
meshed, the plane as images; the board's dielectric left out: it changes a
capacitance to a plane that far little), put in as capacitors to the reference;
and `--cm-cap NODE=VALUE` adds one of the user's (a heatsink on the switch node,
a chassis-mounted part's tab).
The receiver (CISPR 16-1-1), its band by frequency:
band A 9 - 150 kHz RBW 200 Hz QP charge 45 ms, discharge 500 ms,
meter 160 ms
band B 0.15 - 30 MHz RBW 9 kHz QP 1 ms, 160 ms, meter 160 ms
band C 30 - 1000 MHz RBW 120 kHz QP 1 ms, 550 ms, meter 100 ms
The steady state is periodic, so the voltage is a line spectrum at multiples of
1 / period. Tuned to f, the IF filter (Gaussian, the RBW its 6 dB width) passes
sum_k a_k H(f_k - f) e^{j 2 pi f_k t}, exactly, in the steady state; its
envelope over one period gives the peak (its largest), the average (its mean)
and the quasi-peak (the detector's charge and discharge run on the envelope to
their own periodic state, read by the critically damped meter, scaled so a
constant envelope reads itself), each as the RMS of a sine (/ sqrt 2), as a
receiver indicates. Lines further
apart than twice the RBW are read one at a time, and all three detectors agree;
closer lines (a period of many switching cycles, a burst) beat in the filter and
the detectors part. The receiver is tuned at every line and, where lines are
closer than 2 RBW, every quarter RBW. What it leaves out: the IF filter's shape
beyond its 6 dB width (CISPR's mask allows a range; a Gaussian is taken), its
settling (the input is periodic, so none is needed), anything not periodic in
the circuit's period (spread-spectrum, noise).
Limits: CISPR 32's AC mains port, class A or B (quasi-peak and average, dBuV);
CISPR 25's conducted voltage method, classes 1 to 5 (peak, quasi-peak and
average in its broadcast and mobile bands). The values are the tool's
transcription (limits() below): check them against the edition your test plan
names, or give your own (`--limits FILE`: lines of detector, f1_Hz, f2_Hz,
dBuV1, dBuV2; log-linear between f1 and f2). The margin of a band is the limit
minus the reading at its worst frequency, per detector, of the worse line.
The run: the circuit alone first (<out>/alone, no copper, no strict reported
run: its state is all that is wanted), then with the networks started where it
settled (their inductors at its input current, their capacitors at its DC;
their own states not judged for repeating: their modes, 2-4 kHz, are far below
the band) and reported at needed_samples' steps (<out>/circuit).
<out>/conducted.json: the standard, network, the capacitances put in, and per
case the margins and the worst frequencies; <out>/circuit/<case>/conducted.csv
the readings (f, band, detector, L+, L-, DM, CM, limit); <out>/conducted.png
(the first case's readings with the limit lines).
- kicad2ems.pcbqs.conducted.board_cm(model, height_mm, log=<built-in function print>)[source]¶
[(node, farads)] for the model's nodes from its board (plane_capacitance of their nets), and what was solved; ([], None) with no board.
- kicad2ems.pcbqs.conducted.capacitance_to_plane(nodes, tris, z, owner, plane, count=None)[source]¶
The Maxwell capacitance matrix (F) of conductors of flat triangles (nodes (N, 2) m, tris, each triangle's z (m) and its conductor `owner`) over a ground plane at z = plane, the plane and infinity the reference: a charge constant on each triangle, the potential its average over each (pcbqs's 1/R moments for the triangles' own, centroid to centroid for their images: the image is twice the height away).
- kicad2ems.pcbqs.conducted.case_readings(folder, info, period, fmin, fmax, lim)[source]¶
A case's spectrum, readings and margins from its circuit folder.
- kicad2ems.pcbqs.conducted.dbuv(v)[source]¶
V (RMS) to dBuV, no lower than FLOOR_DBUV (1 nV: nothing).
- kicad2ems.pcbqs.conducted.figure(path, res, lim, title)[source]¶
The readings of the worse line (peak as stems, QP and average as points: a scan between lines reads little more than the filter's skirt) and the limit lines; the common and differential modes' QP faint behind.
- kicad2ems.pcbqs.conducted.find_source(model, ref=None)[source]¶
The model's DC voltage supply: the part named, or its one source with dc_V. ValueError: none, or several and none named.
- kicad2ems.pcbqs.conducted.impedance(network, f, source_ohm=0.0)[source]¶
The network's impedance at its EUT terminal (ohm), its supply an ideal source behind source_ohm.
- kicad2ems.pcbqs.conducted.insert(model, network='cispr16', source=None, lines=('+', '-'), cm=())[source]¶
(the model with a network in each supply line, what was put in). The source's + terminal is fed through its network to the node it was on (the EUT terminal); its - terminal is the reference, the return's network between it and the node it was on (lines: '+' alone leaves that out, the return then the reference itself). cm: [(node, farads)] capacitors from model nodes to the reference. On a board, the networks' EUT ends take the source's own footprint (its pins' pads), the source itself goes off the board.
- kicad2ems.pcbqs.conducted.limit_at(rows, f)[source]¶
The limit (dBuV) at frequencies f from one detector's rows; NaN outside them. Where two rows meet the lower applies (CISPR: the lower limit at a transition frequency).
- kicad2ems.pcbqs.conducted.limits(standard, klass)[source]¶
{detector: [(band name, f1, f2, dBuV at f1, dBuV at f2)]}: log-linear in f between f1 and f2, nothing outside the bands.
- kicad2ems.pcbqs.conducted.lines_of(t, v, period)[source]¶
(f, complex peak amplitudes) of v over the last period of a uniformly sampled run: v(t) = Re sum a_k e^{j 2 pi f_k t}, f_k = k / period, k >= 1.
- kicad2ems.pcbqs.conducted.margins(f, readings, lim)[source]¶
Per limit row and detector: the limit minus the reading at the worst frequency inside it (dB; negative: over the limit), that frequency, the reading and the limit there. readings: {detector: dBuV}.
- kicad2ems.pcbqs.conducted.needed_samples(period, fmax, existing=None)[source]¶
Samples a period for the reported run: the spectrum to fmax at 8 points a cycle of its top line, a power of two, at least what the model asks.
- kicad2ems.pcbqs.conducted.network_state(info, row, emc)[source]¶
The networks' and the common-mode capacitors' starting state (as engine.end_state gives a part's) from a run of the circuit alone (its case row and folder): the supply's average current through the series inductors (back through the return's), the capacitors at their DC voltages, each model node's its mean over the run's last period.
- kicad2ems.pcbqs.conducted.parse_caps(items)[source]¶
[(node, farads)] from NODE=VALUE items (15p, 2.2e-11).
- kicad2ems.pcbqs.conducted.plane_capacitance(board, nets, height_mm, dmax=2.0, max_triangles=6000, log=<built-in function print>)[source]¶
{net: its capacitance (F) to a plane height_mm below the board's lowest copper}, the nets' copper meshed (pcbqs.pdn.mesh) and solved together for their charges (constant on each triangle, pcbqs's 1/R moments) with the plane as their image; the board's dielectric left out (homogeneous air). Nets with no copper are left out. A mesh over max_triangles is made coarser.
- kicad2ems.pcbqs.conducted.read_limits(path)[source]¶
A limits file: lines of detector (peak, qp, avg), f1_Hz, f2_Hz, dBuV1[, dBuV2]; # comments and a header skipped. ValueError says what is wrong.
- kicad2ems.pcbqs.conducted.receive(f, a, period, fmin, fmax, oversample=8, qp_oversample=4, samples=2097152)[source]¶
The receiver's readings (V, as the RMS of a sine) over [fmin, fmax] of a periodic signal's lines a at f: (tuned frequencies, {detector: readings}, band names). Each band of BANDS in turn: tuned at every line, and every quarter RBW where lines are closer than 2 RBW. The envelope of a period is sampled at `oversample` times its lines in the filter for the peak and the average, `qp_oversample` times for the quasi-peak (its detector steps through it sample by sample); `samples` bounds a batch's envelopes.
- kicad2ems.pcbqs.conducted.run(model, out, standard='cispr32', klass='B', network=None, source=None, lines=('+', '-'), cm_caps=(), cm_board=True, height_mm=None, limits_file=None, fmin=None, fmax=None, copper=False, jobs=1, warm_start=True, log=<built-in function print>)[source]¶
The conducted emission of a circuit model (model.load's): the circuit with the networks run to its steady state (pcbqs.circuit; warm_start: from the circuit alone's, network_state), each case read and set against the limits. Returns <out>/conducted.json's dict.