Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

10. Models: motor drives, ICs, non-ideal parts and digital control

Voltecx has four families of models beyond the basic parts. This chapter says what each one is, how to start with it, and what it cannot do. In every case the models are textbook models with illustrative default values. Replace the defaults with your own data before you trust a result.

Motor drives

Voltecx has a rotational mechanical domain and electric machine models, so you can simulate an inverter and the motor it drives in one circuit.

What is in the box

Part Details
Mechanical elements inertia, friction, torque (constant load), fan (T = k w abs(w)), constantPower, speed (ideal speed source), gear, speedSensor, positionSensor, torqueSensor
Machines induction (squirrel cage), inductionWound (wound rotor or doubly fed), spmsm and ipmsm (permanent-magnet synchronous), dc (separately excited), dcPm (permanent-magnet dc)
Control blocks clarke, invClarke, park, invPark, abc2dq, dq2abc, svpwm and angle, for field-oriented control. The three-phase pwm3 block makes the gate signals. The smo block estimates the rotor angle and speed without a sensor (below)
Beta machines bldc, syncWound, srm (switched reluctance), stepper, inductionSat (saturating induction), with encoder, resolver and hall sensors (beta)
Beta examples imVf (open-loop V/f), imIfoc (indirect field-oriented control), imDtc (direct torque control), pmsmFoc, dcMotor (beta), and pmsmSmo (sensorless PMSM)

An ipmsm can also run from a flux map instead of Ld, Lq and ψf: mapId and mapIq list the d- and q-axis currents of a grid (rising, at least two each), and mapPsiD and mapPsiQ the flux linkages at each grid point, rows by d-axis current. The machine then saturates and cross-saturates as the map says, bilinear between the points and carried on linearly past the edges. magnetics.machineEquivalent with fluxMap, component and apply writes such a map from the field solver.

Machine ports are named: a b c for the stator, n for the neutral, shaft for the mechanical side. The mechanical side is a net of its own. Its "voltage" is the speed in rad/s, and the "current" is the torque in N m. Wire a load (inertia, fan, torque) to the shaft net.

Start from a part description

component.describe tells you a part's ports and parameters, with units and defaults:

{"kind": "machine", "model": "induction"}

The properties panel shows the same list, with the unit beside each value and the description on hover.

Results

Signal Meaning
Te(M1) Electromagnetic torque of machine M1, N m
wm(M1) Mechanical speed, rad/s
theta(M1) Electrical angle, rad
i(M1.a) Winding current. A dc machine has i(M1.a) (armature) and i(M1.f) (field)
w(net) Speed of a mechanical net, rad/s

A typical drive

An inverter-fed induction motor with V/f control chains: a ramp, a V/f table, angle (integrates the frequency), dq2abc, svpwm (in duty mode), pwm3, the six-switch bridge, the induction machine, and an inertia and a fan on the shaft. With field-oriented control you add the abc2dq transform on the measured currents, a pair of current PIs and a speed PI. The design.currentLoop and design.speedLoop tasks (chapter 7) size those PIs. For a PM synchronous machine, design.mtpa {imax, vdc} gives the d- and q-axis current references for the most torque per ampere, the base speed, and the torque-speed envelope with field weakening above it. It reads Rs, Ld, Lq, ψf and the poles from the spmsm or ipmsm and changes nothing.

Design › Design Steps › PMSM Efficiency Map (design.motorMap) maps a three-phase PMSM's steady-state efficiency over speed and torque without a circuit. Give rs, ld, lq (at least ld), psif, poles, the peak phase current imax, the peak phase voltage vmax and the top speed rpmMax; speedPoints and torquePoints set the grid (10 each by default). Each cell takes the least-current point of its torque inside both the current circle and the voltage ellipse (flux weakening above the base speed) and gives id, iq, the voltage, the copper loss and the efficiency, or says it is not reachable; the result also has the torque-speed envelope and the per-unit values (Kirtley, MIT 6.685 class notes 7, 2005). By default the voltage limit leaves out the drop on the phase resistance. With resistiveDrop: true it includes it (Vd = Rs·Id − ω·Lq·Iq, Vq = Rs·Iq + ω·(Ld·Id + λf), class notes 9, eqs. 51–52), at the Rs you give, with no temperature rise and no inverter or cable drop: the base speed comes out lower, and 0 when Rs·imax reaches vmax. ironLoss adds the iron loss of M-19 or M-36 steel, or of your own fit, over up to 8 regions such as teeth and back iron; without it the efficiency counts copper loss only and is an upper bound. braking: true also maps the braking quadrant with the power returned to the supply. With resistiveDrop, braking is no longer the mirror of motoring: at a high speed a small braking torque can be out of reach while a larger one is reachable. Magnet, friction and windage loss are left out unless you give windage {radius, length, gap (below the radius), density, viscosity (dynamic) and an optional multiplier factor, 1 for a smooth cylinder}: each cell then also counts the windage loss Pw = k·π·Cd·ρ·R⁴·Ω³·L of a cylindrical rotor in turbulent flow at its speed, with the skin friction coefficient Cd from the Reynolds number R·t·Ω·ρ/μ (Vrancik, NASA TN D-4849, 1968, eqs. 5 and 6), and windage.speeds lists Re, Cd and Pw per grid speed. The gas and the factor are yours: none is built in. Bearing friction stays out unless you give bearings with either one total frictional moment of all bearings (N·m) or a table moments of {rpm, moment} points (speeds strictly rising, interpolated in a straight line and held at the ends), for example from the bearing maker's calculator: each cell then also counts Pb = M·Ω at its speed (SKF, Rolling bearings, 2018, p. 132), and bearings.speeds lists M and Pb per grid speed. No bearing model is built in. Magnet loss stays out unless you give magnetLoss {volume (m³, all magnets), resistivity (Ω·m), thickness (m, across which the eddy currents close, one segment's for segmented magnets), ripple (T, the peak of the alternating flux density in the magnets), order (its frequency as a multiple of the electrical frequency) and permeability (relative, at least 1)}, all six required: each cell then also counts the resistance-limited thin-sheet eddy-current loss Pm = V·π²·B̂²·d²·f²/(6·ρ) at f = order·p·rpm/60, and magnetLoss.speeds lists f, the skin depth δ = √(2ρ/(ω·μ0·μr)) and Pm per grid speed. Where the thickness is not below the skin depth the speed is flagged quasiStatic: false and a note says the loss there is above its true value; it is not corrected. The ripple and its order are yours (one ripple at every load): none is derived from slots, windings or switching. Without all of these losses the efficiency is still an upper bound. The map changes nothing in the circuit.

A drive has fast current dynamics and slow mechanics, so try variable step (chapter 4) if a fixed step is too slow.

Sensorless control with the smo block

A position sensor costs money and can fail. The smo block (sliding-mode observer) estimates the rotor angle and the electrical speed of a permanent-magnet synchronous machine from its stator voltage and current.

Pin Meaning
valpha, vbeta The stator voltage the inverter is commanded to apply, in the alpha-beta frame (for example from invPark)
ialpha, ibeta The measured stator current in the alpha-beta frame (for example from clarke)
theta Estimated rotor electrical angle, 0 to 2 pi, in radians
w Estimated electrical speed in rad/s. It is negative when the machine turns backwards

The parameters are rs and ls (the machine's stator resistance and inductance; the observer assumes a surface machine, so Ld = Lq), k (the sliding gain), phi (the boundary layer, default 1 A), fc (the low-pass on the back-EMF estimate, default 300 Hz) and fpll (the bandwidth of the phase-locked loop, default 100 Hz). Set k to about 1.5 times the highest back-EMF, which is the flux linkage times the highest electrical speed. If k is lower, the estimate saturates and the angle is wrong. The block uses a boundary layer instead of a sign function, so it does not chatter, and its angle is compensated for the lag of its own filters.

Two things to remember. First, the observer needs back-EMF, so it cannot start a machine from standstill. Start open loop and hand over once the estimated speed is high enough. Second, give it the voltage the machine really gets, not a duty cycle. The smo block has no direct feedthrough, so it can sit inside the loop it feeds.

The example pmsmSmo (File › Open Example › Motor drives › PM synchronous motor, sensorless) is pmsmFoc without the position and speed sensors. It starts with an open-loop I/f ramp: a rotating current vector with id* of 5 A. When the observer's speed and the ramp both pass 250 rad/s (electrical), a latch hands the angle over to the observer, id* goes to 0 and the speed loop takes over. The speed loop works in electrical rad/s. Plot wm(M1), wh (the estimate), Te(M1), idm, iqm and sel (0 before the hand-over, 1 after). As with every example, the parameters are illustrative, not from a datasheet.

Limits

The machine models are textbook models (Krause, Analysis of Electric Machinery), and the example parameters are illustrative, not from a datasheet. The equations, parameters, numerical method and the list of what is not modelled yet are in docs/motor-drive.md.

Transistors: BJT and level-1 MOSFET

Besides the gate-driven switches (mosfet, igbt), Voltecx has transistors whose control pin is an electrical node, as in SPICE.

Part Pins Model
npn, pnp c b e Piecewise-linear Ebers-Moll. The base-emitter junction is a diode with drop vbeOn and resistance ron. The base-collector junction is a diode with drop vbeOn minus vceSat. A current of bf times the base-emitter current minus br times the base-collector current flows from collector to emitter. rb, rc and re add series resistance
nmos, pmos d g s Level 1 (Shichman-Hodges, square law with lambda), solved by Newton iteration at each step. At level: 3, the SPICE level-3 short-channel model (threshold, mobility, velocity saturation, channel-length modulation, subthreshold; Meyer and overlap capacitances; the bulk-drain junction) that vendor subcircuits use. At level: 2, the SPICE level-2 Grove–Frohman model (bulk charge, mobility degradation ucrit/uexp, velocity saturation vmax/neff, channel-length modulation from lambda or nsub, subthreshold), with the same capacitances and junction. At level: vdmos, the VDMOS power MOSFET of vendor SPICE models: the channel with subthreshold, mtriode and theta, series rd, rs, rg, a constant cgs, the non-linear gate-drain capacitance (cgdmax, cgdmin, a) and the body diode with its junction capacitance and stored charge (is, n, rb, cjo, vj, m, fc, tt) and its reverse breakdown, which clamps the drain in avalanche (bv, ibv, nbv)

i(Q1) is the collector current. Use a BJT for base-driven switches, level shifters, current sources and small linear stages. Use mosfet or igbt for power switching.

Limits to know:

  • The BJT is piecewise linear: cutoff, active, saturation and reverse. There is no exponential law, no charge storage and no Early effect. A BJT amplifier can report "switch states did not settle" because the junction states keep flipping.
  • The level-1 MOSFET has no charge storage and no body effect (the vdmos level has its capacitances and body diode, but no quasi-saturation, breakdown or self-heating, and it is evaluated at tnom). A circuit with one skips the factorisation cache, so it runs slower than a switch-only circuit. Linear AC analysis uses the operating point it held at the end of the run and warns about it.
  • These parts are not written to a SPICE netlist or an LTspice file: exporting a circuit that holds one gives a warning. They are read, though (chapter 9).

The component guide (F1, component.reference) lists every parameter. demo:npn, demo:pnp, demo:nmos and demo:pmos open a small circuit for each.

GaN transistors (tech gan: EPC2045, EPC2218, EPC2302, TP65H050G4WS, GS66508T) are drawn without a body diode, and conduct in reverse through the third-quadrant drop of their data sheet. rdsDyn is the factor on ron after the device has blocked a high voltage (the data sheet's dynamic RDS(on); 1 is off). The EPC parts carry the transfer curve and the capacitance curves that the dynamic switching level reads. The buckGan example (chapter 15) uses them.

Data sheets of catalogue parts

Every catalogue part cites its data sheet: the vendor's own link, the document, its revision, and the table, figure or page each value was read from. Voltecx does not ship the PDFs, which belong to their vendors. The Data sheet button opens the vendor's link: on a library row (hover the row), in the Component Guide, and next to the catalogue part in Properties. Under the part, Properties lists its cited values. Hover one to see where it was read (RDS(on) 66 mΩ: Wolfspeed C3M0065090D data sheet, Rev. 08, Fig. 5); click it to open the data sheet, at that page when the citation names one.

To read a data sheet offline, right-click Data sheet and pick Save offline…. Voltecx shows the size and the source first and downloads nothing until you click Download. The copy stays in your cache folder on this computer, and it opens from there next time. The same commands are part.datasheet {part, value?} and part.datasheetCache {part, consent?}, so an agent can quote a citation and open the page too.

A part that is not in the catalogue can be modelled from the graphs of its own data sheet. In Library › Your Parts, Fit a data-sheet graph takes the points you read off one graph, one x, y pair per line in SI units (5m and 2n work): on-resistance against junction temperature, forward voltage, turn-on or turn-off energy against current, reverse-recovery charge against di/dt, or output capacitance against voltage. Fit the points fits the curve's usual form (or the model you pick) and shows the formula, its parameters, the RMS and worst relative error, and every point with its fitted value and error, the worst one marked. A fit worse than the error you allow (10 % by default) is refused. A forward-voltage fit can be kept as your own diode: name the data sheet and figure, and give its voltage and current ratings. The points you entered are kept, not the fitted values, in the open circuit (so they are saved with its file), with the source user, from graph: …, never in the cited catalogue. A loss or charge curve is fitted and shown but not kept as a new part, since a switch also needs its conduction table. A turn-on or turn-off energy graph, or a forward-voltage graph, can instead be added to a part of your own that you already have (library.fitCurve with attachTo, the part id, and for an energy graph the blocking voltage v of the figure): it becomes that part's energy curve at that voltage and temperature, or the conduction curve of a diode or of a switch's body diode. Catalogue parts are not changed. The command is library.fitCurve.

Vendor SPICE models

A vendor's model file (.lib, .mod or .sub for a MOSFET or a diode) can go straight into your circuit. Voltecx reads the file from your disk and keeps only the part it builds from it, in your circuit file. It never copies or ships the vendor's file.

powercraft-cli run --cmd file.openExample --params '{"name": "buck"}' \
  --cmd spice.listModels --params '{"path": "models/vendor.lib"}' \
  --cmd spice.placeModel --params '{"path": "models/vendor.lib", "name": "MYFET", "instance": "Q2"}'

spice.listModels lists the file's subcircuits (.subckt) and its .model cards of type D, NMOS, PMOS, VDMOS, NPN and PNP, with their pins. spice.placeModel builds one of them as a subsystem and places it with its pins unconnected, named as the model names them. Wire them with circuit.connect. A bare .model card gets the pins SPICE gives its element: a k for a diode, d g s for a MOSFET (body tied to the source; a VDMOS has no body pin), c b e for a bipolar transistor. One undo removes the placement.

Each element is read as file.import reads a SPICE netlist (chapter 9): diodes become piecewise-linear ones unless the card gives stored charge (CJO or TT, as vendor diode models do), which makes them the exponential diode with that junction capacitance and recovery charge, NMOS/PMOS cards are read as level 1 or, with LEVEL=2 or LEVEL=3, as that level (other levels, BSIM among them, are read as level 1 with a warning), and VDMOS cards (most vendor power-MOSFET models) become an nmos or pmos at level: vdmos, with the capacitances and body diode that set the switching waveform (see the limits above). Its double-pulse waveform is checked against ngspice (docs/accuracy.md). Whatever is not mapped exactly is listed in warnings, so read them. To see it before you place the part, run spice.importReport with the same path and name: it lists each element and each .model parameter as mapped, approximated, dropped or unused (noise and information fields, which do nothing in SPICE either), with its line in the file and the reason, and ends with one line of fidelity such as MYFET: kept as written 5 of 6 elements and 30 of 34 model parameters; dropped: J1 TV.RTHJC. spice.placeModel returns the same line as fidelity. Encrypted models are refused: ask the vendor for an open model, or build the part from its data sheet. Controller and driver IC macro-models are not supported yet. Use the behavioural ICs below for those.

Example: a VDMOS, a diode and a level-3 MOSFET card

Save these three cards as models/demo.lib in the project folder. They were written for this manual and are no vendor's part; the first is the card Voltecx checks against ngspice.

.model VTEST VDMOS(Rg=1.5 Vto=3.5 Rd=40m Rs=5m Rb=10m Kp=25 Lambda=2m Theta=0.05 Mtriode=0.8 Ksubthres=0.12
+ Cgdmax=1.2n Cgdmin=150p A=0.4 Cgs=1.8n Cjo=1.5n Vj=0.6 M=0.45 Is=5e-11 N=1.2 TT=40n)
.model DFW D(Is=1e-12 N=1.5 Rs=5m Cjo=500p Vj=0.7 M=0.4 TT=30n BV=650)
.model M3 NMOS(LEVEL=3 VTO=3 KP=20u UO=600 TOX=100n NSUB=1e15 NFS=1e11 VMAX=1e5 THETA=0.1 KAPPA=0.2 NSS=1e10)
powercraft-cli run --root . --cmd file.new --params '{}' \
  --cmd spice.listModels --params '{"path": "models/demo.lib"}' \
  --cmd spice.placeModel --params '{"path": "models/demo.lib", "name": "VTEST", "instance": "Q1"}' \
  --cmd spice.placeModel --params '{"path": "models/demo.lib", "name": "DFW", "instance": "D1"}' \
  --cmd spice.placeModel --params '{"path": "models/demo.lib", "name": "M3", "instance": "Q2"}'

spice.listModels lists VTEST (kind vdmos, pins d g s), DFW (kind d, pins a k) and M3 (kind nmos, pins d g s). VTEST places with no warning. DFW becomes the exponential diode with its junction capacitance and transit time, and warns that the reverse breakdown (BV=650) is not modelled. M3 becomes a level-3 MOSFET and warns that the threshold from process parameters (NSS=1e10) is not modelled. In a 400 V, 20 A double pulse, VTEST follows ngspice-42 within 2.2e-3 in the drain voltage, with the same 202 µJ turn-off energy and 1.10 mJ against 1.02 mJ at turn-on (docs/accuracy.md).

Limits of the vendor models

  • VDMOS: quasi-saturation (RQ, VQ), the subthreshold shift SUBSHIFT and the body-diode breakdown are modelled, and a part at another temperature than the card's TNOM is moved there. Every temperature coefficient the card gives (TEXP1 and TKSUBTHRES1/2 among them) moves the part; self-heating is not modelled. The warnings name each one a card gives.
  • Diodes: breakdown, IKF, ISR/NR, temperature dependence and the area factor are not modelled. A diode with both qrr/trr and cjo/tt is an error.
  • Levels 2 and 3: sheet resistance (RSH) and the body effect of a body off the source are not modelled. The instance's AD, PD and AS size the body junction from CJ, CJSW and JS, as in SPICE. BSIM cards are read as level 1, with a warning.
  • Encrypted models are refused.

Whole vendor libraries

Vendors publish their models as libraries of hundreds of parts. Voltecx does not ship them (the vendors' terms do not allow it), so download a library yourself and point Voltecx at its folder. library.vendorSources (and Where to Get Vendor Models in the library panel's More Actions menu, at the right of its title) links the official pages of Infineon, Wolfspeed, TI, onsemi, Navitas, EPC, ROHM and ST.

Choose Library › Import Vendor SPICE Models (or the import icon at the right of the library panel's title). The Import vendor SPICE model window reads one model file (Choose file…) or a whole library folder (Choose folder…) and lists its models before anything is added: each model, what it reads as (a VDMOS MOSFET, a diode, a subcircuit), its pins and its status (Ready, a number of warnings, Needs pin map, Mapped, Skipped or Failed). The warnings and the reasons a model or file is skipped (an encrypted file, a .model type Voltecx does not map) are listed under the table. Under them is the Import report of one model (the first one Voltecx can use; click another model's name to see its own), as spice.importReport gives it: the line of fidelity, how many elements and parameters are mapped, approximated, dropped or unused, and each one that is not mapped as written, with its line in the file, its kind, the result and the reason (hover over a cut reason to read it whole). A model with nothing lost says Every element and parameter is mapped as written. A model whose pins are numbered gets a Pin map table: pick its symbol, then the role each pin connects to; the map is saved with your library. Add N models to library indexes the file or folder; Cancel (or Esc) leaves the library as it was.

From the CLI:

powercraft-cli run --root ~/models \
  --cmd library.importVendor --params '{"folder": "infineon"}' \
  --cmd library.vendorModels --params '{"filter": "MYFET", "status": "ok"}' \
  --cmd file.new --params '{"name": "dpt"}' \
  --cmd library.placeVendor --params '{"name": "MYFET65", "instance": "Q1"}'

Every .model and .subckt of the folder's .lib, .mod, .sub and .cir files is indexed with its pins, vendor and file, and mapped the way spice.placeModel maps it: ok (warnings name what is not modelled exactly), unsupported (with the reason, such as a .model type Voltecx does not map) or failed. Encrypted files are listed as skipped. Pins named like D G S, C G E or A K (with a Kelvin source or Tj/Tcase thermal pins) are matched to the MOSFET, IGBT or diode symbol; numbered or unknown pins put the model on the needs pin map list: it still places, and you wire its pins by name. The models show in the panel with a user library badge; click one to place it. The index is yours (library/vendor-models.json in the settings folder), never in a circuit or shared; the vendor files stay where you put them. library.removeVendor forgets a folder. Details: docs/vendor-libraries.md.

Behavioural B sources

Vendor macro-models often build a part's channel, a clamp or a controller stage from SPICE B elements: a voltage or current source whose value is a formula of node voltages, element currents and time. There is no command of its own: file.import reads B lines in a netlist (and LTspice bv/bi symbols), and spice.placeModel reads them inside a vendor .subckt. Each becomes a controlled source named after the B element, driven by meters and an expr block whose signals are recorded too (B1_v1, B1_ctl).

You write It reads
Bname n+ n- V=expr or I=expr A voltage source, or a current from n+ to n- through the source
V(a), V(a,b) A node voltage, or the difference of two
I(X) The current in X, for a resistor, inductor, capacitor, DC, sine or pulse voltage source, DC current source, ideal switch, controlled source or diode
time, pi, .param names The simulation time, π and the netlist's parameters
+ - * / % **, < <= > >= == !=, ! & | Arithmetic, power (**), comparisons (1 or 0) and logic (true above 0.5)
sin … atan2, sinh, cosh, tanh, exp, ln, log (natural, as in LTspice), log10, sqrt, abs, min, max, pow, pwr, pwrs, sgn, u, uramp, int, floor, ceil, round The LTspice functions of the same names
if(c, a, b), limit(x, lo, hi), table(x, x1, y1, x2, y2, …) A choice, a clamp, and a piecewise-linear table held flat beyond its ends

Example. Save this netlist as bdemo.cir:

b source demo
V1 in 0 SIN(0 5 1k)
B1 out 0 V=limit(2*V(in), -4, 4)
R1 out 0 1k
B2 sq 0 V=if(V(in) > 0, 1, 0) + table(time, 0, 0, 1m, 2)
R2 sq 0 1k
B3 ib 0 I=I(R1)*2
R3 ib 0 1k
B4 d 0 V=ddt(V(in))
R4 d 0 1k
.tran 1u 1m
.end
powercraft-cli run --root . --cmd file.import --params '{"path": "bdemo.cir"}' \
  --cmd simulation.run --params '{}' \
  --cmd scope.measure --params '{"signals": ["v(out)", "v(sq)", "i(B3)", "i(R1)"]}'

The import warns that B4 is skipped (ddt is not supported) and that one source reads an element current and so follows one step late. v(out) is the doubled sine clamped at ±4 V, v(sq) steps between the two branches of the if on a ramp that ends at 2 V, and i(B3) peaks at 8 mA, twice the 4 mA in R1, one 1 µs step after it (67 µs against 66 µs).

How it is solved, and its accuracy. A source that reads only node voltages and time is solved with the rest of the circuit in each Newton iteration, in both solvers and in the AC analysis, as SPICE does. A source that reads an element current I(X) is evaluated from the last solution, one step late; inside a tight feedback loop it can need a smaller maximum step. On a 400 V, 20 A double pulse of a MOSFET macro-model whose channel is a B source (written for the tests, not a vendor model), both solvers follow ngspice-42 within 0.4 % in the turn-on and turn-off energy, and the drain current at the end of the first pulse is 20.30 A in all three (docs/accuracy.md).

Limits.

  • ddt(x), idt(x[, ic[, reset]]) and delay(x, td) are solved with the circuit: the derivative, the integral from ic (held at ic while reset is true) and x as it was td ago.
  • white, rand, ngspice's pwl, mod and any function not in the table skip the source with a warning, as do the options laplace= and delay=. Other options (Rpar=1k) are ignored with a warning.
  • ^ is refused (it is exclusive-or in LTspice and a power in ngspice: write **), and so is ? : (write if(c, a, b)).
  • At most 8 different voltages and currents in one source; an I(X) of another kind of element, or of a part that is missing, skips the source.
  • I(X) sources lag one step, as above.
  • Digital XSPICE A devices import as logic blocks (gates, flip-flops, latches, bridges, d_osc, the d_source pattern source, the d_state state machine, whose files are read next to the netlist, and the d_ram memory). The unknown state is not modelled, so some controller and driver IC macro-models still do not import whole: use the behavioural ICs below.
  • The B source has been checked against a macro-model written for the tests, not against a vendor's file.

spice.placeModel {"text": "<the VTEST card>", "instance": "Q2"} on the buck example (text takes the file's text in place of path):

The VTEST card placed as Q2 in the buck example, marked 1 to 2

  1. Q2: the VDMOS built from the card, a subsystem with the pins d, g and s.
  2. Problems: its pins are still open. Wire them with circuit.connect.

Thyristors: TRIAC, DIAC, GTO and IGCT

Besides the thyristor (SCR), the library has four more thyristors, each with defaults from a named data sheet.

Part Default from Behaviour Pins
triac ST BTA16-600B (DS2114 Rev 11) Fires either way when the gate current exceeds igt (50 mA) in one of its quadrants (1234, or 123 for a three-quadrant part); stays on until the current falls below ih (50 mA) mt2 mt1 gate
diac ST DB3 (DS2125 Rev 3) Breaks over at vbo (32 V) either way, then conducts at vf until its current falls below ih a1 a2
gto ABB 5SGA 30J4502 A positive gate (above 0.5) fires it, a negative gate (below −0.5) turns it off; holding current 50 A a k gate
igct ABB 5SHY 35L4520 Conducts forward while its gate unit's command is above 0.5 a k gate

The TRIAC's gate is read as a current in amperes, so a logic 1 fires it too. The examples triacDimmer (an R-C network and a DIAC fire a TRIAC about 98 degrees into each half cycle of 230 V) and triacHeater (zero-cross drive, 3 of every 5 cycles) show them at work:

powercraft-cli run --cmd file.openExample --params '{"name": "triacDimmer"}' --cmd simulation.run

What the models leave out: a TRIAC's commutating and static dV/dt limits are not checked, so a real part may fire falsely or fail to turn off where the model does not; a GTO turns off any current, so check it against its largest controllable current (3000 A for the default part) yourself; an IGCT blocks any reverse voltage, though the real asymmetric part blocks only 17 V, so put a diode across it in a bridge; and gate-unit minimum on and off times are not enforced. Layout hints, soft-switching checks and the KiCad and SPICE exports do not know these four kinds yet.

Oscillators, the 555 and phase-locked loops

Measure an oscillation. scope.measure takes "oscillation": true (or {"threshold": 2.5} to choose the level). For each signal it returns frequency, period, duty, riseTime (10 to 90 %), fallTime and cycles. A signal that does not oscillate returns null values and a reason. The other keys of scope.measure do not change.

{"signals": ["v(out)"], "t0": "5m", "oscillation": true}

Blocks. Four control blocks are new:

Block Pins What it does
vco v in; out, theta out Frequency f0 + kv v, in hertz, clamped to fmin and fmax. The output is a sine, square, triangle or sawtooth with an amplitude and an offset; a square is high for duty of each period (default 0.5), and the wave starts at phase degrees (default 0). It has no direct feedthrough, so a loop can close through it
phaseDetector a, b in; out, up, down out A multiplier, an XOR gate or a phase-frequency detector (pfd)
pll in in; f, theta, locked out Locks to a single-phase signal with a quadrature generator and a PI loop. With kp and ki unset, the natural frequency is 0.3 times f0 and the damping is 0.707. locked is 1 when the error stays below lockTol for two periods
srfPll a, b, c in; theta, w out The same loop in the synchronous frame of a three-phase set, for grid synchronisation

kv is in hertz per unit of input, not radians per second. The solver ends a step on each edge of a square or sawtooth output, so an edge is not up to a step late; keep the step well below the period if the edges drive switches. demo:vco, demo:phaseDetector, demo:pll and demo:srfPll open working examples.

Grid-forming control. droop (pins p, q in; theta, w, e out) makes an inverter a voltage source that shares a load with others: its frequency is f0·(1 − kp·(P − pset)/prated) and its amplitude e0·(1 − kq·(Q − qset)/qrated), with the measured powers filtered at fc. kp and kq are per-unit droops, and only f0 has a default. Inverters with the same per-unit droop share active power by their ratings. Feed p and q from clarke and pq on the inverter's own voltage and current, and theta and e to dq2abc (d = e, q = 0). demo:droop and the droopLoadSharing example open working circuits.

vsm (same pins) is a virtual synchronous machine: its speed follows the swing equation 2H·d(ω/ω0)/dt = (pset − P)/prated − (ω/ω0 − 1)/kp, so right after a power step ΔP the frequency moves at f0·ΔP/(2H·prated) and then settles on the same droop line with the time constant 2H·kp. h is the inertia constant in seconds on the base prated; the damping 1/kp is the frequency droop, so a vsm shares a load exactly like a droop with the same kp. The amplitude follows the Q–V droop with q filtered at fc. Only f0 has a default. demo:vsm and the vsmLoadSharing example open working circuits.

The 555. timer555 is a behavioural 555 (pins VCC GND TRIG THR CTRL DIS OUT RESET). The divider is three real 5 k resistors, so a voltage on CTRL (or a bypass capacitor) moves both thresholds. The defaults are typical NE555 values. circuit.applicationCircuit builds the astable and the monostable with their design formulas. Give it a target instead of parts: freq and duty size RA and RB, width sizes the monostable R, each rounded to E96. The PWM controller's boost takes fsw and sizes RT = 1.72/(fsw·CT), rounded to E96; the shunt monitor takes iFullScale and vFullScale and sizes the shunt Vfs/(G·Ifs), rounded down to E12 so the output stays within full scale. The comparator's schmittTrigger takes vRise and vFall and sizes the external hysteresis: R1 from the input to INP, R2 (rFb) from OUT to INP, INN at Vref, with R1 = R2·(ΔV − 2h)/(VOH − VOL + 2h) rounded to E96 and Vref set from the rounded R1. The IC's own hysteresis 2h and offset are taken out, and the output levels include the pull-up loaded by R2. The gate driver's halfBridgeLeg takes tBlank and sizes the DESAT blanking capacitor C_blk = ICHG·t/VDESAT, rounded to E12. values.designed lists each sized part with its equation and the value before rounding.

The crystal. crystal (pins p, n; designator Y) is the Butterworth-Van Dyke circuit: a series rm, lm, cm branch with c0 across it. Give either fs and q (with cm) or lm, cm and rm. A mixed or incomplete set is refused with an error that names the part. A crystal needs about Q cycles to build up its oscillation, so simulate a high-Q crystal only with a step and a time that allow that.

Examples. relaxationOscillator, timer555Astable, wienBridge and colpitts are in the Examples menu under Basics (or open them with file.openExample). The Colpitts example uses an op-amp, because the piecewise-linear BJT would switch its junction every cycle. There is no Pierce example.

The frequency tests of these examples allow 3 %. Replace the textbook defaults with your own parts before you trust a number.

Behavioural ICs (beta)

You have a datasheet for a gate driver, an op-amp, a comparator, a PWM controller or a current-sense amplifier, and you want the part and its typical application circuit in the simulator.

A Voltecx IC is a behavioural model: a subsystem with named pins, built from voltmeters, controlled sources, ideal switches and control blocks, and driven by numbers from the datasheet (thresholds, delays, resistances, gain-bandwidth). It is not the manufacturer's transistor-level SPICE model. It is much faster, and it shows the behaviour that matters for a power stage: propagation delay, undervoltage lockout, desaturation protection, slew rate, hysteresis.

Template (name) What it models Pins
gateDriverIso Isolated gate driver with UVLO, propagation delay, source and sink resistance, DESAT protection, soft turn-off and latched fault IN FLT VDD VEE OUT COM DESAT
halfBridgeDriver Half-bridge gate driver of the UCC27211 type: built-in bootstrap diode, VDD and HB UVLO, propagation delay, source and sink resistance on both outputs; HI and LI take the controller's 0/1 gate signals HI LI VDD VSS HB HO HS LO
lowSideDriver Single-channel low-side gate driver of the UCC27517 type: VDD UVLO, propagation delay, source and sink resistance on the output; IN takes the controller's 0/1 gate signal IN VDD GND OUT
opAmp One-pole op-amp: DC gain, GBW, slew rate, output limited by its supply, input offset; optional second pole from a phase margin pm, CMRR (cmrr, dB) and input bias current (ib), all off by default; presets TL072, OPA2171 and TLV9062 (ic.place with preset) INP INN OUT VCC VEE
comparatorHyst Comparator with hysteresis, rising and falling delay, open-drain or push-pull output INP INN OUT VCC GND
pwmController Peak-current-mode PWM controller of the UC384x type: oscillator, error amplifier, current-sense comparator with the 1 V clamp, maximum duty, UVLO. Slope compensation and the CS filter are external parts, as on the part (TI SLUS223H Figure 7-11); design.auto's controllerIc boost and flyback place them VFB COMP CS OUT VCC GND
syncBuckController Voltage-mode synchronous buck controller of the LM5145 type: feed-forward ramp, error amplifier, soft start, EN/UVLO, valley current limit with hiccup, PGOOD, two gate drivers VIN EN SS FB COMP PGOOD ILIM BST HO SW LO VCC GND
syncBoostController Peak-current-mode synchronous boost controller of the LM5122 type: current-sense amplifier, slope compensation from RSLOPE, error amplifier, soft start, UVLO, cycle-by-cycle current limit with the RES hiccup timer, two gate drivers VIN UVLO SS FB COMP SLOPE RES CSP CSN BST HO SW LO VCC GND
ccmPfcController CCM boost PFC controller of the UCC28180 type, average current mode without line sensing: FREQ-resistor oscillator, current amplifier with the M1 gain, leading-edge PWM with the M2 ramp, transconductance voltage amplifier with soft start and enhanced dynamic response, UVLO, OLP, ISENSE open-pin protection, two-level OVP, soft overcurrent, peak current limit, gate driver with its 15.2 V clamp GND ICOMP ISENSE FREQ VCOMP VSENSE VCC GATE
multiplierPfcController Boost PFC controller of the UC3854 type, average current mode with line sensing: analog multiplier IMO = k·IAC·(VAOUT − 1 V)/VRMS² limited to 2·IAC and 3.75 V/RSET, voltage and current operational amplifiers (gain, gain-bandwidth, swing, emitter-follower output with 8 kΩ), RSET/CT oscillator with 95 % maximum duty, PKLMT peak current limit, soft start, ENA and VCC UVLO, 7.5 V reference, gate driver with its 14.5 V clamp. circuit.applicationCircuit topology multiplierPfc builds the data sheet's 250 W preregulator (Figure 9) GND PKLMT CAOUT ISENSE MULTOUT IAC VAOUT VRMS VREF ENA VSENSE RSET SS CT VCC GTDRV
crmPfcController Transition-mode (critical-conduction) boost PFC controller of the UCC38050 type: self-oscillating PWM turned on by the zero-current detector on an inductor winding (armed above 1.7 V, fires 350 mV lower) or the 400 µs restart timer, and off when CS, through the internal 40 kΩ / 5 pF filter, passes the multiplier 0.65·(MULTIN + 75 mV)·(COMP − 2.5 V) (at most 1.7 V); 90 µS transconductance amplifier with ±10 µA linear output and the slew-rate enhancement (1.3 mA source below 0.88·VREF, 1 mA sink above 1.05·VREF down to 2.4 V), zero-power stop below COMP = 2.3 V, OVP, enable on VO_SNS, VCC UVLO, gate driver from VCC. Preset UCC38051 for the 12.5 V UVLO part. circuit.applicationCircuit topology transitionModePfc builds the data sheet's universal-line 100 W preregulator (Figure 19) VO_SNS COMP MULTIN CS ZCD GND DRV VCC
llcController Half-bridge LLC controller of the UCC25640x type with hybrid hysteretic control: optocoupler feedback to a control effort, VCR comparators with the frequency-compensation ramp, dead time, BLK start and stop, LL/SS soft start, OCP1 and bias winding OVP with the 1 s pause, RVCC and both gate drivers. Burst mode, the capacitive-region protection and OCP2/OCP3 are not modelled GND VCC RVCC BLK FB ISNS VCR BW LLSS HB HO HS LO
psfbController Phase-shifted full-bridge controller of the UCC28950 type: oscillator from RT, error amplifier into a duty cycle and a phase shift, programmed delays between the outputs of each leg, synchronous rectifier drives, closed-loop soft start and the CS current limit. Peak current mode (CS, the RSUM slope ramp and the 0.85 V offset against COMP) or voltage mode (pcm); burst mode and the adaptive delays are not modelled GND VDD VREF EAP EAN COMP SS CS OUTA OUTB OUTC OUTD OUTE OUTF
currentSenseAmp Gain, one-pole bandwidth, offset, output clamp INP INN OUT VS GND
hallCurrentSensor Hall-effect sensor of the ACS712-05B type: 185 mV/A, 2.5 V at zero current, 80 kHz, saturation near the rails IPP IPN VIOUT GND
shuntAmplifier Shunt amplifier of the INA240A1 type: gain 20, 400 kHz, 2.5 V reference, output swing limits IPP IPN OUT GND
isolatedAmplifier Isolated amplifier of the AMC1301 type: gain 8.2, 210 kHz after a 1.1 µs signal delay (1.6 µs to 50 %), differential output on 1.44 V, clips at 2.49 V; a run with more than vIowm (1500 V) from IPN to GND2 is an isolation.workingVoltageExceeded error naming the part IPP IPN OUTP OUTN GND2
isolatedAmplifierAmc1302 Isolated amplifier of the AMC1302 type: ±50 mV linear input, gain 41, 280 kHz after a 1.2 µs signal delay (1.6 µs to 50 %), a lower gain from 50 to 64 mV, clips at 2.49 V IPP IPN OUTP OUTN GND2
shuntRegulator Adjustable shunt regulator of the TL431 type: 2.495 V reference, REF current, transconductance with one pole, 0 to 100 mA, lowest cathode voltage K A REF
optocoupler Optocoupler of the TCET1100 type: LED, current transfer ratio against LED current and temperature, phototransistor pole, saturation AN CAT C E
digitalIsolator Digital isolator of the ISO7710 type: thresholds that follow VCC1, 11 ns delay, push-pull output, UVLO, default output, CMTI 100 V/ns IN VCC1 GND1 OUT VCC2 GND2
highSpeedOpto High-speed logic-output optocoupler, 10 MBd class (typical values, user must set): LED threshold current, tPHL and tPLH (pulse-width distortion), open-collector or totem-pole output, output capacitance, supply range, CMTI AN CAT VCC OUT GND
fiberTx Fiber-optic transmitter, 650 nm plastic-fiber class (typical values, user must set): input thresholds, delay, launched optical power on its OPT signal IN VCC GND OPT
fiberRx Fiber-optic receiver with its fiber (typical values, user must set): attenuation per metre and connector loss, sensitivity, delay, time of flight, seeded jitter, minimum pulse width, push-pull output OPT VCC OUT GND
pvDriver Photovoltaic MOSFET driver, the driver of a solid-state relay (typical values, user must set): LED, short-circuit current proportional to the LED current, open-circuit voltage clamp, turn-off circuit AN CAT VOP VON
ldo LDO of the LP5907 3.3 V type: dropout, supply rejection with a zero and a pole, current limit, enable, start-up ramp IN OUT GND EN
voltageReference Series reference of the REF3025 type: 2.5 V, supply rejection, output impedance that rises with frequency, current limit IN OUT GND
currentTransformer Current transformer of the Coilcraft CS4100V-01L type: a one-turn primary, 1:100, magnetising inductance with saturation, secondary resistance and burden IPP IPN OUT GND
rogowskiCoil Rogowski coil with its integrator, of the PEM CWT Ultra-mini type: sensitivity, low and high cut-off, output limit IPP IPN OUT GND
closedLoopHall Closed-loop Hall current transducer of the LEM LA 55-P type: secondary current = primary / 1000 from DC, bandwidth, offset, largest secondary current IPP IPN M GND
isolatedVoltageSensor Resistive divider into an isolated amplifier of the AMC1311 type: gain 1, signal delay and bandwidth, clipping, differential output; preset AMC3330 (gain 2, ±1 V, 375 kHz, 1.6 µs) HVP HVN OUTP OUTN GND2
ganPowerStage 600 V GaN FET with integrated driver of the LMG3422R030 type: input hysteresis and delays, VDD UVLO, on resistance at tj, third-quadrant drop, cycle-by-cycle overcurrent (70 A) and latched short-circuit (95 A) protection, overtemperature ideal-diode mode, FAULT and OC outputs DRAIN SOURCE IN VDD FAULT OC

The default parameters come from public datasheets (cited per parameter). A default marked assumption is the model's guess, not a datasheet number. Read it with ic.describe.

Command What it does
ic.list Lists the built-in ICs and the subsystems in the circuit
ic.describe Pins, parameters (unit, default, range, datasheet source), what the model does and does not do. A part with a shipped application example also gets example; run its open (file.openExample) to open it
ic.place Puts the IC into the circuit, with its pins unconnected. Wire them with circuit.wire
ic.fromSpec Builds a new IC from a JSON spec: {"template": "gateDriverIso", "params": {"tPd": "75n"}, "source": "datasheet, Table 6.5"}
circuit.applicationCircuit Opens a new circuit with the IC's typical application, already laid out

Fast isolation and CMTI

SiC and GaN switch nodes move at 50 to 200 V/ns. Every part that crosses an isolation barrier (optocoupler, highSpeedOpto, digitalIsolator, gateDriverIso) measures the slope of the voltage across its barrier during the run, over a 1 ns window: GND2 against GND1, E or GND against the LED cathode, COM against the circuit ground. When the slope passes the part's cmti rating, the output glitches for tGlitch (it inverts, or the phototransistor turns on), and after the run circuit.problems lists a warning such as CMTI exceeded: 150 V/ns > 100 V/ns rating on U1``, with the part selected. A cmti of 0 means the rating is not set: the slope is measured, nothing glitches and nothing is reported.

The ratings come from data sheets: the digitalIsolator default is the ISO7710's 100 V/ns (typical), and the UCC21750 preset of gateDriverIso sets 150 V/ns (minimum, SLUSD78C Table 6.8). The TCET1100 and UCC21756-Q1 defaults have no CMTI in Voltecx yet, so their cmti is 0 until you enter your part's value. The glitch width is an assumption (20 ns): data sheets give CMTI as a pass/fail limit, not the shape of the failure.

highSpeedOpto is the logic-output optocoupler used for PWM and fault signals. Its defaults are a generic 10 MBd set, labelled "typical, user must set" in every row: no data sheet of this class has been read into Voltecx yet. Set iFth, tPhl, tPlh, rOnLo, cOut, vccMin, vccMax, maxRate and cmti from your part. The output pulse comes out longer by tPlh − tPhl (the pulse-width distortion), and an open collector rises through your pull-up and cOut. Its optoLink application circuit (circuit.applicationCircuit {ic: "highSpeedOpto", topology: "optoLink"}) drives the LED with a square wave across a 100 V ground offset.

Medium-voltage converters and modular multilevel converters carry their gate signals on fiber: there is no galvanic path at all, so no CMTI limit. fiberTx turns a logic input into light and fiberRx turns it back; the net between their OPT pins is the fiber, and it carries the optical power as a signal in watts. The receiver holds the fiber's numbers: length, alpha (dB/m at the link's wavelength) and lossConn (connectors and coupling, dB). An edge arrives tTx + length · nGroup / c + tRx after it was sent, plus up to jitter (uniform, seeded by seed, the same in both solvers). A pulse shorter than tPwMin is dropped, so check the shortest PWM pulse against it. Below the sensitivity pSens the receiver stops following.

fiber.linkBudget checks the link: received power = pTx − alpha·length − lossConn, its margin over pSens against 3 dB (or your margin), and the overload pMax. With no params it reads every transmitter–receiver pair of the open circuit; with pTx and pSens it checks the numbers you give. circuit.problems warns (fiber.linkBudget) when a link of the circuit has less than 3 dB of margin. The schematic draws the link as an isolation barrier: on an isolated circuit (secondary ground sgnd), Layout puts the transmitter on the primary, the receiver on the secondary and the barrier line between them, across the fiber; elsewhere it draws a barrier half way between the two ends.

Both templates' defaults are a generic set labelled "typical, user must set": no transmitter or receiver data sheet of this class has been read into Voltecx yet. Set them from your parts and fiber before you trust a delay or a budget. circuit.applicationCircuit {ic: "fiberTx", topology: "fiberLink"} builds a link to start from.

Photovoltaic MOSFET drivers

pvDriver is the photovoltaic-output optocoupler of a solid-state relay, a battery disconnect or a precharge switch: an LED lights a photodiode stack that charges the MOSFET gate on the far side of the barrier with no supply there at all. The stack gives iscRef · IF / iFref (micro-amperes) up to the open-circuit voltage vocRef, and a turn-off circuit discharges the gate through rDis when the LED goes dark. The turn-on time into a gate capacitance C is about C · Vth / Isc (hundreds of microseconds for a nanofarad) and the turn-off time about rDis · C · ln(V0 / Vth), so it switches seldom: never use it for PWM. Its solidStateRelay application circuit switches a 24 V load with two MOSFETs back to back. The defaults are a generic set labelled "typical, user must set": no data sheet of this class has been read into Voltecx yet.

Feedback and isolation

An isolated supply regulates on its secondary and crosses the barrier with an optocoupler. shuntRegulator is the TL431 error amplifier, and optocoupler carries its current to the primary. The shunt regulator is solved with the circuit, so a type II network from the cathode to REF needs no small step. The optocoupler's current transfer ratio is a curve read off the data sheet, scaled by ctrScale (another bin, or end of life) and by tAmb. The curve and its temperature factor are parameters too (ctr0m2 … ctr100m, kTm25 … kT75; the defaults are the TCET1100's). crates/engine-core/ics/presets/ holds them for the PC817 (Sharp), LTV-817 (Lite-On) and SFH617A (Vishay), each value cited to its figure or table: pass a file's spec to ic.fromSpec. The LTV-817 and SFH617A sheets give only a normalized curve, so ctrScale there is the CTR at the normalizing current; the file's notes give each rank.

The model keeps regulating down to zero cathode current, but a real TL431 needs about 1 mA (TI SLVS543S, Section 6.4). circuit.problems with run: true reports shunt.lowCurrent (a warning) when a shuntRegulator carries less than 1 mA for more than 20 % of the second half of the run. A resistor across the optocoupler LED (Rbias in the flybackTl431 example) fixes it.

file.openExample with flybackTl431 opens a 12 V flyback whose loop closes through both. The module notes in crates/engine-core/src/ic/flyback_tl431.rs give the design: a zero a factor of five below the crossover and the optocoupler pole above it. The output holds 12.06 V at full and half load in both solvers.

The data sheet gives the optocoupler's pole with a 100 Ω load only. A pull-up of several kΩ makes the real pole much lower, so enter the pole you measured, or set it with a capacitor across the pull-up as the example does.

Architecture blocks for power-IC design

Before a power-management IC is drawn at transistor level, its architect chooses the control scheme and sizes its numbers with the real power stage. The blocks below serve that stage. They are generic: every default is a design value labelled "typical, user must set", not a part's data sheet, and each block cites the public paper or application note its equations come from (ic.describe gives the source). Logic pins (EN, GATE, RUN, OK, FAULT, FLT, OVP, and the driver's IN, HO, LO) are signals, 0 or 1; analog pins are voltages to GND. Voltecx does not do transistor-level IC design (no PDKs, BSIM sign-off, layout or DRC/LVS); see the scope boundary in docs/roadmap.md.

Template (name) What it models Pins Source
pcmModulator Fixed-frequency peak current mode: clock, slope-compensation ramp se, blanking tBlank, maximum duty, cycle-by-cycle clamp vcMax. valley = 1 gives valley current mode: the clock turns the switch off, it turns on when ISNS minus the ramp falls to VC, tBlank is the minimum off-time; without a ramp it oscillates below D = 0.5, and it is stable when se > (sE − sD)/2, half the sensed up-slope minus the down-slope VC ISNS EN GATE GND Ridley, IEEE TPEL 1991; Erickson & Maksimovic ch. 12; Unitrode U-97; valley mode: Tiwary & Rincon-Mora, Electronics 15(8) 1609, 2026, section 5.1
cotModulator Constant on-time tOn started when FB falls below REF, minimum off-time; or the adaptive on-time kOn·V(VOUT)/V(VIN) + tOnAdd (adaptive 1) or kOn/V(VIN) + tOnAdd (adaptive 2) FB REF EN GATE GND VIN VOUT Redl & Sun, IEEE TPEL 2009; Li & Lee, IEEE TCAS-I 2010
hystModulator Window REF ± vHyst/2, delay tDelay on both edges FB REF EN GATE GND Redl & Sun, IEEE TPEL 2009
softStartRef iSs charges the SS capacitor, REF is the lower of SS and vRef, RUN = EN and not FLT, SS discharges when not running EN FLT SS REF RUN GND LM5145 SNVSAI4B §7.3 (scheme)
uvloComparator Rising and falling thresholds, hysteresis current iHys into the divider SENSE OK GND LM5145 SNVSAI4B §7.3 (scheme)
ocpHiccup Over-current held for tFilter raises FAULT for tHiccup ISNS FAULT GND LM5145 SNVSAI4B §7.3 (scheme)
ovpComparator FB above kOv·REF (or kOv·vRef) for tFilter raises OVP until FB is below (kOv − kHys)·REF; latch = 1 latches off FB REF OVP GND Feedback-pin OVP scheme of TI TPS54360, SLVSBB4G §7.3.12 (tFilter and latch are not from that sheet)
ldoArch LDO loop: error amplifier gmEa·roEa with its pole (cEa), gate pole rGate·cGate, pass device gmPass, roPass, dropout rDo, current limit iLim; the output capacitor and its ESR stay in the circuit, so analysis.loopGain {signal:"U1.x_err"} shows the ESR window IN OUT FB GND TI SLVA115A (Section 1, Equation 1): loop and ESR-window rule
hbDriverArch Half-bridge driver from one PWM command: propagation delay tPd, fixed dead time tDead or adaptive dead time (adaptive 1: the low side waits for SW to fall, the high side for the low-side gate, tAdapt after the edge), gate charge through rSource/rSink into cGate IN SW HO LO GND TI SLUA618 (Balogh); TI SLVAF84

Wire them as a controller: UVLO OK → soft start EN, OCP FAULT → soft start FLT, soft start RUN → modulator EN, soft start REF → the error amplifier or the modulator's REF, and the modulator's GATE → the switches (through a deadtime block for a synchronous stage). The OVP's OVP goes through a not block and a min with RUN into the modulator's EN, so the switch stops while the output is over-voltage; compare it with a steady reference (vRef), because the output leads a soft-started REF at start-up.

Three examples close a synchronous buck through them (File › Open Example › Control, or file.openExample), and circuit.applicationCircuit opens the same circuits with your input, load and block parameters (pcmBuck, cotBuck, hystBuck):

  • pcmBuckArch: 12 V to 5 V at 2 A, 500 kHz peak current mode with half the sensed down-slope as ramp, a type II error amplifier (opAmp), soft start, UVLO and hiccup OCP. The load halves at 1 ms. circuit.applicationCircuit {ic:"ovpComparator", topology:"pcmBuck", params:{loadRelease:1}} adds the OVP and drops the load to 1 % at 1 ms: FB overshoots about 1.5 %, so kOv 1.01 stops the switch within one period and lets it resume below the falling threshold, and kOv 1.03 never trips.
  • cotBuckArch: 12 V to 3.3 V at 2 A, 550 ns on-time, FB ripple from a 10 mΩ ESR. With cotBuck, kOn above 0 gives the adaptive on-time (the buck then switches at 1/kOn from 8 V to 24 V), and rippleInjection 1 adds an RC network across the inductor into FB, which keeps the loop steady on ceramic capacitors (esr 0.0005). The switches are driven by hbDriverArch with a fixed 20 ns dead time, so the switch node is high for tOn − tDead; give it adaptive 1 (in icParams of circuit.applicationCircuit with ic hbDriverArch) and the body diodes conduct for about 2·tAdapt per period instead of 2·tDead.
  • hystBuckArch: 12 V to 3.3 V at 2 A, a 10 mV window at FB and a 50 mΩ ESR.

The tests check each loop against its equation (crates/engine-core/src/ic/arch/tests.rs):

Check Equation Result
PCM control voltage at full and half load Vc = Ri·IL + Se·D·Ts + Sn·D·Ts/2 (averaged modulator) within 2 %
PCM current loop at D = 0.65 unstable below mc·D' = 0.5, mc = 1 + Se/Sn (Ridley) valleys alternate by more than 20 % of the ripple at 0 and 0.5 times the critical ramp, less than 2 % at twice it
Valley-mode current loop at D = 0.3 sub-harmonic gain A_SH = (se − sE)/(se + sD), stable when se > (sE − sD)/2 (Tiwary & Rincon-Mora 2026, Eqs. 21–22) the currents at the clock alternate by more than 20 % of the ripple at 0 and 0.5 times the boundary, less than 2 % at twice it
COT frequency at 12 V and 20 V in fsw = Vout/(Vin·(tOn − tDead)) within 2 %; FB valley within 2 mV of REF
COT stability ESR·C > tOn/2 (Li & Lee) steady at 10 mΩ (1 µs), irregular at 0.5 mΩ (50 ns)
Hysteretic frequency ESR·Vout·(Vin − Vout)/(Vin·L·window) within 10 %; a 100 ns delay lowers it
Soft start tSs = Css·vRef/iSs REF at 0.5 V after 235 µs, within 3 %
UVLO thresholds vRise·(R1+R2)/R2, vFall·(R1+R2)/R2 − iHys·R1 within 0.5 %
OCP hiccup into a short peak held by vcMax, off for tHiccup peak below 5.2 A, no switching for 200 µs, then a new soft start

Not yet in this library (each is an issue under #1397): sweeping and Monte Carlo of the block parameters, an averaged model of the IC-driven stage, loop gain broken inside a block, and a handoff export (block spec plus target waveforms).

Current sensors

The three sensor ICs show what a real current sensor does to a measurement. Each is a series resistance, a current meter and a controlled source, with the datasheet section and page named in each parameter's source. The primary pins IPP and IPN go in series with the branch you measure. A current that flows in at IPP and out of IPN reads positive. For shuntAmplifier and isolatedAmplifier, rSense is the shunt resistor you choose. It is a parameter of the IC, not a datasheet value.

Each IC has a currentStep application circuit, which is also its demo: open it with circuit.applicationCircuit or with file.openExample and demo:hallCurrentSensor (or demo:shuntAmplifier, demo:isolatedAmplifier). Place one in your own circuit with ic.place. The library panel lists the IC templates.

isolatedAmplifier also has currentLoopBuck: a hysteretic current-mode buck (48 V in, 6 A) whose comparator reads the inductor current only through the AMC1301 on its shunt. The controller is the module XCTL on the control ground, and the power stage sits on sgnd behind the isolation tie. The amplifier's delay is in the loop: the switch turns off expect.loopDelay (tDelay plus the 210 kHz pole's time constant, about 1.83 µs; a step reaches 50 % after the data sheet's 1.6 µs) after the current passes the band, so the current overshoots to expect.iPeak.

Four more sensors measure what a shunt cannot. currentTransformer is a real magnetic circuit, so it passes AC only, droops on a long pulse and saturates past its volt-time product (298 V·µs). rogowskiCoil reads AC from its low cut-off up; its coil's own inductance is not modelled separately. closedLoopHall reads from DC and puts out a current, so it needs a measuring resistor from M to a supply return. isolatedVoltageSensor reads a high voltage through its divider across the barrier. Each cites its data sheet per parameter (Coilcraft Document 132; PEM CWT Ultra-mini Rev. 10/25; LEM LA 55-P version 19; TI SBAS786C), and its demo opens with demo:<name>:

powercraft-cli run --cmd file.openExample --params '{"name": "demo:closedLoopHall"}' --cmd simulation.run

ntcSensor (in the library under meters) is a 10 kΩ NTC of the Vishay NTCLE100E3103 type that reads the temperature of a thermal net as a resistance. law is steinhartHart (the data sheet's coefficients a1 to d1, the default) or beta (b = 3977 K). Set thermal to the net of the part it watches; without it, it reads only its own body at ta. It heats itself by delta = 7 mW/K, so keep the divider current small.

Some defaults are assumptions, and the parameter says so: the Hall sensor's saturation levels (0.1 V and 4.9 V) are not in the datasheet. noise is 0 by default. Set it to a few millivolts rms to see noise. The noise is the same on every run for one seed, and another seed gives another noise.

The same effects are available on a plain ammeter or voltmeter. All of them are optional, and a meter that sets none of them behaves exactly as before:

Parameter Meaning
sensitivity, vref Output = vref + sensitivity * gain * x + offset. For a current sensor, sensitivity is in V/A and vref is the zero-current level (1.65 V or 2.5 V for a bidirectional part)
outMin, outMax The lowest and highest output the sensor can drive (saturation). One of them alone is an open-ended limit
noise, seed RMS output noise in volts (white to about 1 MHz) and a whole-number seed. The same seed repeats the same noise

The chain runs in this order: gain and offset, low-pass (bandwidth), delay, noise, limit. Both solvers build it from the same blocks, so they agree.

circuit.problems reports sensor.saturated (a warning) when a meter or a sensor IC sits at its outMin or outMax for more than 0.5 % of the run. A sensor with a lower sensitivity, such as the 20 A or 30 A variants of the Hall sensor, fixes it.

ic.fromSpec is the path from a datasheet to a model. You, or an assistant that reads the PDF, fill in the spec, and the source field records where each number came from. See docs/workflows/ic-models.md for the full guide.

Multi-winding transformer

multiTransformer puts one primary (p1, n1) and up to three secondaries (p2–n2, p3–n3, p4–n4) on one core, for a multi-output flyback or forward supply. Each secondary has its own turns ratio (n2, n3, n4, primary turns over that winding's turns), leakage (llk2…llk4) and wire resistance (rw2…rw4); the primary has llk1 and rw1, and lm (with im0) magnetizes the core, seen from the primary. Winding 2 is always on; windings 3 and 4 are on only when n3 or n4 is set, and their pins must stay open otherwise. Before the run it becomes one ideal transformer per secondary, all across one core voltage, so both solvers run it as they run transformer; with only winding 2 on it gives the same waveforms as transformer. rcore across the core models core loss, and isat with lmsat saturates the magnetizing inductance, as on transformer. With three windings on you may instead give the leakages as you measure them on the bench: lk12 at the primary with winding 2 shorted, lk13 at the primary with winding 3 shorted, and lk23 at winding 2 with winding 3 shorted, the third winding open each time. The part then solves llk1, llk2 and llk3 (taking lm into account) so that the same three short-circuit tests on it give your values back; a set that one leakage per winding cannot hold (one value above the sum of the other two, seen from the primary) is refused with the winding named, and the keys cannot be mixed with llk1–llk4. With winding 4 on as well, add lk14, measured at the primary with winding 4 shorted and the others open: it sets llk4, and the four tests give your four values back. The star has one leakage per winding, so the other two pairs follow from those four. When your bench values for them differ, add lk24 and/or lk34, measured at winding 2 or 3 with winding 4 shorted and the others open: each sets the coupling between that winding and winding 4 (a coupled inductor in series with both, built from their leakages), and all six tests give your values back while the first four stay as they were. A set that no passive part can have (the windings would couple with k ≥ 1) is refused with the keys named. An Ideal run leaves out the leakages (also lk12, lk13, lk23, lk14, lk24, lk34), the wire resistances, rcore, isat and lmsat, and keeps the ratios, lm and im0. demo:multiTransformer opens a two-output example.

EMI parts: common-mode choke, ferrite bead and LISN

Three parts for conducted-EMI work. Their defaults come from named data sheets and from CISPR 16-1-2.

Part What it is Main parameters (defaults) Pins
cmChoke Two equal coupled windings that block common-mode noise and pass the load current (TDK B82724A2202N001) l 6.8 mH per winding, lstray 80 µH, rdc 0.17 Ω, irated 2 A p1 n1 p2 n2
ferriteBead A resistor at noise frequencies and a small inductor at low frequencies (Murata BLM18PG221SZ1) z 220 Ω at ftest 100 MHz, zpeak 280 Ω at fpeak 300 MHz, rdc 0.1 Ω, irated 1.4 A, optional isat and ksat for DC bias p n
lisn One line of the 50 µH network between the supply and the equipment l 50 µH, csup 1 µF, cm 0.1 µF, rd 1 kΩ, rm 50 Ω line eut meas gnd

Put the choke's dots on the same side, or the load current no longer cancels. Read the LISN's receiver port as v(meas) against gnd; tie gnd to the circuit's ground or chassis. The example emiInputFilter has two LISNs reading the line noise of a switching load behind a common-mode choke:

powercraft-cli run --cmd file.openExample --params '{"name": "emiInputFilter"}' --cmd simulation.run

emi.conducted (chapter 16) puts its own LISN on a copy of the circuit; these parts are for building the bench yourself. A bead's capacitance is far below a picofarad, so a transient run needs a step near a nanosecond to see its peak; use the AC analysis for its impedance.

Measurement blocks inside the circuit

Nine control blocks measure while the circuit runs, so a controller can act on the value. Use the scope's measurements (chapter 5) when you only need the number after the run.

Block Outputs Main parameters
rms RMS of in over a sliding window f (50 Hz), cycles (1)
mean Mean (DC value) of in over a sliding window f (no default: the ripple's frequency), cycles
thd thd as a ratio, and amp, the fundamental's peak f, cycles
harmonic amp and phase of one harmonic f, order (1), cycles
powerFactor pf, dpf, p and s from a voltage and a current f, cycles
powerMeter pin, pout and eff of a converter from four signals f (no default: the switching or line frequency), cycles
power1 p, fundamental q (positive while the current lags), s and pf of a single-phase port from v and i (IEEE Std 1459-2010) f, cycles
power3 p, fundamental q (positive while the currents lag), arithmetic s and pf of a three-phase port from va, vb, vc, ia, ib, ic (IEEE Std 1459-2010) f, cycles
fft amp and phase of one bin, once a period f, samples (64), order

Every block except fft takes an optional freq input, such as a PLL's output, which replaces f while the frequency drifts. The window must be a whole number of periods, or the result ripples; the output lags a change by up to one window, so a loop that regulates an RMS value must be slower than that. thd counts every harmonic, where the scope's measurement stops at order 50, so they can differ by a few tenths of a percent. Each block has a demo:

powercraft-cli run --cmd file.openExample --params '{"name": "demo:powerFactor"}' --cmd simulation.run

Non-ideal parts (beta)

Every part is ideal until you give it a parasitic parameter. With no parameter set, the circuit is identical to before, bit for bit.

Part Parameters
Capacitor esr, esl, rleak
Inductor dcr, rcore, isat with lsat (two-segment saturation)
Voltage sources rs (source resistance)
Switches and diodes ls, coss, cj, tdon, tdoff, qrr with trr (reverse recovery)
Meters bandwidth, delay, gain, offset, and for sensors sensitivity, vref, outMin, outMax, noise, seed (see "Current sensors" above)
adc block (new) bits, range, min, fs

Two things in the window matter here. The Models: Ideal | Real switch in the toolbar decides whether the parasitics count in a run: Real runs every part with the parasitics as entered, Ideal runs with all of them back at their defaults and leaves your values in the circuit. Ideal is not lossless: a parameter's default still counts, so a switch or diode keeps its default on-resistance (1 mΩ for an ideal switch and a diode, 10 mΩ for a MOSFET or an IGBT). A part's parasitics are in the Advanced fold of its Properties.

The toolbar switch and a part&#39;s Properties, marked 1 to 4

  1. Ideal.
  2. Real.
  3. The inductance of L1.
  4. Advanced, where the parasitics are.

Seeing what Real changes

Clicking Real in the toolbar also turns on the switches' device models: a MOSFET whose device or parameters carry the gate data (ciss, crss and two of vth, gfs, vplateau) runs at its dynamic level, so its switching losses come from simulated edges, and a diode with is and n runs at its exponential level. A part that names its own level keeps it. A file that never chose keeps its levels as entered (simulation.settings {"deviceModels": true} turns them on from a script). Ideal always runs every switch ideal. Neither edits the circuit.

When Real is on and some parts still run ideal, an amber chip sits next to the switch: 1 part without losses. Its tooltip also counts the switches that stay on their ideal model. Click it and the Losses picker opens under it: These parts simulate the same in Ideal and Real. Only parts that carry power-stage current are listed: a compensator or soft-start capacitor, or a sense filter, sits in the control and sense network (found by its nets, never by name) and is left out, so an auto-designed PCM buck no longer asks for a compensator capacitor's ESR. The output capacitor and the snubbers still are listed. Each row names the part, its kind and what it is missing (for a MOSFET: Ron, Eon, Eoff, Coss), with two buttons:

  • Pick part opens the catalogue picker of that part in Properties, to choose a real part with a data sheet.
  • Typical sets the values of the part's class (circuit.fillTypical): a switch or diode takes the values of one named part of the lowest voltage class that blocks the circuit's highest DC voltage, an inductor the typical DCR and a capacitor the ESR of the catalogue part of its value. Each value is shown with its source (data sheet, revision and table), in the picker and under the value in Properties. A quantity no data sheet gives (a Schottky diode's Qrr, a switching energy the data sheet leaves out, an inductor of a value the catalogue does not hold) reads no cited value, left off and is not filled: nothing is made up.

Typical for all does every row in one undo step; Done closes the picker. In Problems, a capacitor or inductor whose part is a catalogue part number also gets Fill from catalogue, which sets the ESR or DCR from that part's data sheet in one undo step (a parallel set of capacitors divides the ESR, a series set of inductors adds the DCR).

The buck example comes with real losses: S1 is a MOSFET with the RDS(on) of the Infineon BSC070N10NS5 data sheet, D1 a Schottky diode with the forward drop of the Nexperia PMEG100V080ELPD, and C1 the ESR of a Panasonic EEHZC1V101P. Only L1 has no loss, since no catalogue inductor of 100 µH cites one.

Before: Real is on, and the hint counts the parts with no losses set, marked 1 to 2

  1. Real.
  2. The hint: click it to list the parts in Problems.

Run once in Ideal and once in Real. The second run lays the first over the plots by itself, and the run card adds a table of the two runs side by side with the difference: the output voltage's average and ripple, the efficiency, the total loss and the three largest part losses.

After: an Ideal run and a Real run of the catalogue buck, compared in the run card, marked 1 to 2

  1. Total loss, Ideal against Real.
  2. Compare with Run 1, on by itself: the Ideal run is the dashed trace.

The same numbers come from runs.compareFigures, and the list from circuit.fidelityCheck.

Compare Ideal vs Real

Compare Ideal vs Real on the run card (simulation.compareFidelity) runs the circuit twice from the same start, Ideal and Real, without changing the circuit or its runs, and opens a window with:

  • four cards: Efficiency, Vout ripple, Peak Vds of the main switch and Total loss, each with the Real value, its difference from Ideal (red or amber when Real is worse) and the Ideal value under it;
  • one switching edge of the switch node from both runs, Ideal dashed grey and Real in colour, with Real's overshoot marked when there is one;
  • Where the loss goes (Real): a bar per part and mechanism (conduction, switching, ESR, DCR);
  • the line under it, such as Ideal: 123 mW total, from the default Ron only (S1 10 mΩ, D1 1 mΩ): what Ideal's own loss comes from.

Keep Real switches the circuit to Real. Add to report puts the comparison into Scope › Export › Results Report (scope.resultsReport {"comparison": …}).

Two commands save typing:

  • circuit.makeRealistic fills in typical values for the parts you name ({"components": ["L1", "C1"], "level": ...}), or for the whole circuit. Qrr comes from the datasheet's switching energy, Coss from the current rating, and the rest are documented generic values. The result is one undo step.
  • circuit.makeIdeal removes them again.

component.describe returns a typical range for each parameter.

Values over temperature

Some of these values change a lot with temperature. A temperature table scales the part's own value, which is its value at the datasheet's reference temperature. Write it as temperature (°C) and factor pairs, read from the datasheet's normalised curve, for example -40 8 25 1 105 0.6. Between the points the factor follows straight lines; past the ends it stays at the end value.

Part Table Read at
Capacitor esrTemp (on esr), cTemp (on c, for class-II ceramics) temp, 25 °C when unset
Inductor isatTemp (on isat) coreTemp, 25 °C when unset
Switches and diodes qrrTemp (on qrr) the junction temperature, every step: the thermal node of thermal, or tj

A part without a table is the same as before. A temp without a table changes nothing and gives a warning. An inductor on a catalogue core ignores isatTemp, because the core's material already gives the saturation at coreTemp. A device's switching energies and on-state voltage come from its tables at the junction temperature, as before. Not done yet: a capacitor or inductor that follows a thermal node during the run, the threshold voltage over temperature for the dynamic level, and the tables for the catalogue devices.

Non-ideal parts ring. A small series inductance with a small capacitance is a fast resonance, so use a small step or the variable step (chapter 4). The details, with where each value comes from in a datasheet, are in docs/workflows/non-ideal.md.

Not done yet: a value label for parasitics on the canvas, and AC-analysis support for the adc, gain, low-pass and delay meter blocks.

Digital control (beta)

The control library has long had continuous blocks (pi, integrator, limiter, comparator, deadtime, pwm) and sampled ones (sampleHold, delay). The beta adds four families.

Family Blocks
Analog (s domain) tf (numerator and denominator in descending powers of s, optional lo/hi output limits with anti-windup), pid (with a derivative filter and anti-windup), lowpass2, bandpass, notch
Digital (z domain) zoh, zDelay, ztf, dpi, dpid, dIntegrator (method: forward, backward or tustin), fir, iir (biquad sections)
Logic and, or, xor, nand, nor, srff, dff, counter, monostable
MCU timing mcu: when the interrupt runs (valley or peak of the carrier), the computation delay, when the duty register updates, and the duty resolution
Linear, other forms zpk (zeros, poles in rad/s, a+bj for a conjugate pair, gain k), stateSpace (single-input single-output a, b, c, d; rows of a separated by ;), derivative (k·ωc·s/(s + ωc), corner fc); each becomes a transfer function when the circuit is built and runs like tf
Nonlinear and tables lookup2d (bilinear over xs × ys, zs one row per xs value), rateLimiter (rise, fall per second), transportDelay (td), memory (one solver step of delay: the input at the previous accepted step, x0 before the first; a PLECS Memory), hysteresis (relay: on, off, yon, yoff), expr (Fcn: a formula of in1 … in8, time and the circuit variables)
Bus timing commLink: a message between two controllers (PMBus, CAN, UART) with a rate (0 sends on change), a latency, a seeded jitter and loss, and 1 to 4 values; outputs the held values, a fresh pulse and a lost count
Random source random: a seeded uniform (offset ± amp) or Gaussian (standard deviation amp) value, a new one every 1/fs, held in between; the same seed gives the same sequence in every run and both solvers, and each new value is a step the solver lands on

Every digital block has a sample time ts and an optional offset. It updates only at offset + k * ts, and the solver lands exactly on those instants, in fixed and variable step.

Why this matters for a loop: a digital controller adds delay. Sampling plus the computation delay costs about 1.5 sample periods of phase lag, which you must include in your phase margin. The mcu block lets you model it: chain zoh, abc2dq, dpi, dq2abc, svpwm (duty mode), mcu, pwm3. The design.currentLoop task has a delayTs field for this (use 1.5 for a digital loop). The block's delay counts from its own interrupt instant: with the ADC sample at that instant, delay 1 and update period give the usual one-period latency; if the ADC is triggered after the interrupt instant (a zoh offset past the valley), the block already reads the previous sample's duty, so use delay 0, or the latency becomes two periods.

A digital PWM places each edge on its timer, so the duty has a finite resolution. Give pwm or pwm3 the timer counts of one period as counts (TBPRD on a TI C2000, ARR on an STM32) and the duty rounds to a multiple of 1/counts. A high-resolution PWM moves the edge in much finer steps: set hrpwm to the step in seconds, or to f28379d (150 ps, the typical MEP step of TI SPRS880P section 6.11.4.1.2) or stm32g474 (184 ps, ST RM0440 Rev 9 Table 231), and the duty rounds to a multiple of step × freq. Without either, the duty is not rounded. When the DPWM is coarser than the ADC, the loop limit-cycles: the output hunts by about one DPWM step. design.digitalize checks this (dpwmBits, dpwmCounts or hrpwm, with adcBits and vFullScale; chapter 16).

A pwm block compares its input with a carrier that runs from 0 to 1 by default, so the input is the duty. When the controller's output is a voltage, give the carrier its span in those units instead: offset is the carrier's lowest value and vpp its peak-to-peak value, and the duty is (in − offset)/vpp. A 0.5 V to 3 V carrier fed by an error amplifier is offset 0.5 and vpp 2.5; a modulation index from −1 to 1 is offset −1 and vpp 2. An input at or below offset keeps the switch off, and one at or above offset + vpp keeps it on. The rounding of counts and hrpwm applies to the duty after this mapping. Generated code maps the duty the same way before it writes the compare register (chapter 13). The averaged view (design.voltageLoop and the other loop designs) reads the PWM's input as the duty and refuses a block that sets offset or vpp: put the scaling in a gain and a sum ahead of a default pwm there.

A supervisor that talks to a converter over a bus adds its own delay. Put a commLink between them: a set point sent at t reaches the loop between t + latency and t + latency + jitter, in order, and a lost message never arrives. The same seed gives the same jitter and losses in every run and in both solvers. It models only the timing, not a protocol stack. Code generation leaves it out as a simulation-only block, because on the target the bus driver carries the message. The component guide lists typical numbers for PMBus, CAN and a UART, worked out from the bit rates; they are not from a standard.

A slow interrupt changes this. Give the block the ISR's execution time in place of delay: tIsr in seconds, or cycles and the CPU clock fclk (the line cargo xtask armgcc prints for the generated STM32G474 code ends with these two values). With update set to end (the same as immediate), the new duty takes effect when the ISR ends. With period, it takes effect at the next update event, as before. The block has two more outputs: load above it and overrun (ovr) below it, so the pins already wired do not move. load is tIsr times fs, and overrun is 1 when the ISR takes the whole period or more. An ISR that comes while the previous one still runs waits for it. One that cannot start before the next interrupt is lost, and its duty is never written. Without tIsr or cycles the block works as before, and both outputs read 0. design.digitalize takes the same tIsr, cycles, fclk and update and reads the phase margin with that delay (chapter 16).

The guide, with the equivalent transfer functions of each discretisation, is docs/workflows/digital-control.md.

When the loop works in simulation, Tools > Code Generation turns its sampled blocks into portable C99 for a microcontroller (chapter 13).

Linear forms, tables, rate limits, delays and relays

The blocks of the last two rows of the table above (zpk, stateSpace, derivative, lookup2d, rateLimiter, transportDelay, hysteresis, expr) are in Insert > Control, and each has a reference page and a demo (file.openExample with demo:rateLimiter and so on).

Example: a reference step through a rate limiter. The example buckClosedLoop regulates 12 V. This chain feeds its error amplifier from an expr block that steps the reference to 15 V at 5 ms, first directly, then through a rateLimiter of 2 V/ms:

powercraft-cli run --cmd file.openExample --params '{"name":"buckClosedLoop"}' \
  --cmd circuit.addComponent --params '{"name":"Step","kind":"control","block":"expr","params":{"f":"if(time > 5m, 15, 12)"}}' \
  --cmd circuit.connect --params '{"component":"Step","port":"out","net":"vstep"}' \
  --cmd circuit.addComponent --params '{"name":"Soft","kind":"control","block":"rateLimiter","params":{"rise":"2k"}}' \
  --cmd circuit.connect --params '{"component":"Soft","port":"in","net":"vstep"}' \
  --cmd circuit.connect --params '{"component":"Soft","port":"out","net":"vsoft"}' \
  --cmd circuit.connect --params '{"component":"Err","port":"in1","net":"vsoft"}' \
  --cmd simulation.run --params '{}' \
  --cmd scope.measure --params '{"signals":["v(out)","i(L1)"],"t0":"5m","step":true}'

With the step fed directly (connect Err.in1 to vstep and leave out Soft), the inductor current peaks at 7.24 A after the step and v(out) rises in 1.19 ms. Through the rate limiter the reference ramps for 1.5 ms, the inductor current peaks at 6.76 A (the 15 V load alone takes 6.25 A) and v(out) rises in 1.90 ms; both settle at 15.0 V with an overshoot below 0.3 %.

Limits.

  • Code generation writes lookup2d, and rateLimiter at the code's sample time when it feeds a PWM's duty cycle (chapter 13); it leaves out transportDelay and expr, each with a reason. zpk, stateSpace and derivative are treated like tf: written as their discrete equivalent when they feed a PWM, otherwise left out as s-domain blocks. hysteresis is generated with its held level in the state struct.
  • stateSpace has one input and one output, an order of at most 16 and a zero initial state; states the input cannot reach or the output cannot see are dropped. zpk must have no more zeros than poles, also up to order 16.
  • lookup2d holds each input at the edge of its grid, without a warning, and takes at most 65536 values.
  • transportDelay keeps at most about one million points of history; a longer delay against a small step stops the run.
  • rateLimiter, transportDelay, expr and hysteresis act once per accepted solver step, so the step size sets how exactly they follow their input. A source driven by expr follows one step late.

State machines

A start-up, precharge, takeover or fault sequence is one stateMachine block instead of a tangle of gates, latches, counters and one-shots. Its definition lists the inputs, the outputs, the states with the value of each output, the initial state and the transitions {from, to, guard, priority}. Guards are expressions over the inputs (by name or as in1, in2 …), t_in_state (the time spent in the active state) and the circuit variables. Set it with circuit.setStateMachine {component, definition, fs}; it checks the definition (unknown or unreachable states, no initial state, a guard that does not parse or reads an unknown name) and moves the pins to in1 …, out1 … and state, keeping the nets of wired pins. The Properties panel lists the states and transitions and any problem. View › Overlays › State Graph (or a double click on the block, or State Graph in Properties) draws the states as boxes and the transitions as arrows labelled priority: guard, with the initial state's entry arrow; after a run it highlights the state active at the end, and during the animation the one active at the playback time (wire the state pin for this).

The state graph of a state machine block after a run, marked 1 to 2

  1. State Graph in Properties opens the graph (also View › Overlays › State Graph).
  2. The state active at the end of the run, highlighted in the graph.

At every sample (every 1/fs from t = 0, or every solver step when fs is 0) the transitions out of the active state are tried, the smallest priority first and, at equal priorities, in list order. The first true guard (above 0.5) fires and restarts t_in_state; at most one transition fires per sample. The outputs then take the new state's values and hold until the next sample, and state gives the index of the active state, counted from 0. A precharge sequence looks like this:

{"inputs": ["en", "vbat", "vpack"], "outputs": ["k1", "pre", "qb", "k2"], "initial": "Idle",
 "states": [{"name": "Idle"}, {"name": "CloseK1", "outputs": {"k1": 1}},
            {"name": "Precharge", "outputs": {"k1": 1, "pre": 1}},
            {"name": "Bypass", "outputs": {"k1": 1, "pre": 1, "qb": 1}},
            {"name": "Run", "outputs": {"k1": 1, "k2": 1}}],
 "transitions": [{"from": "Idle", "to": "CloseK1", "guard": "en > 0.5"},
                 {"from": "CloseK1", "to": "Precharge", "guard": "t_in_state > 19.5m"},
                 {"from": "Precharge", "to": "Bypass", "guard": "vpack > 0.95*vbat"},
                 {"from": "Bypass", "to": "Run", "guard": "t_in_state > 9.5m"},
                 {"from": "Run", "to": "Idle", "guard": "en < 0.5", "priority": 0}]}

With fs set, the sample instants are solver events, and code generation writes the machine as a C switch on its state (floating point only). Write a timed guard half a sample early (t_in_state > 9.5m at 1 kHz for 10 ms), so rounding never moves it a whole sample.

Power-supply control blocks and the three-phase source

These blocks and options cover the control of switch-mode supplies and grid converters. Every option is off by default, so a circuit made before them runs as it did.

Block What it adds
deadtime A second output outn: the complement of in, its rising edge delayed by td too. One block drives both gates of a half bridge.
comparator hys: out turns 1 above in2 + hys, 0 below in2 - hys, and holds in between.
srff priority = set makes the latch set-dominant (reset is ignored while set is high), as peak-current-mode control needs.
clarke, abc2dq A third output zero = (a + b + c)/3.
invClarke, dq2abc An optional zero input, added back to every phase.
sampleHold, zoh, dpi, dpid An optional clk input: while it is wired, the block samples on its rising edges instead of every period.
monostable An optional ton input: its value at each trigger is the pulse width.
pwm, carrier Optional phase (degrees) and freq (Hz) inputs replace the parameters while wired: a phase-shifted full bridge or a dual active bridge shifts one leg against the other.
mux Up to eight inputs; sel (counted from 0, rounded, limited) picks one.
ramp gate mode: se*(t - t_rise) while in is high (slope compensation). saw mode: from 0 at each rising edge of clk, reaching vh after 1/f.
compensator Type II or Type III: H(s) = g*(wz1/s)*(1 + s/wz1)/(1 + s/wp1), Type III times (1 + s/wz2)/(1 + s/wp2), on ref - fb, with a finite DC gain avol, limits vl, vh and anti-windup. An AC sweep uses its transfer function.
atan2 The angle of the alpha-beta vector, wrapped to 0 ... 2*pi.
pq Instantaneous power: p = k*(ea*ia + eb*ib), q = k*(eb*ia - ea*ib), k = 1.5.

sine3VoltageSource is a balanced three-phase source with pins a, b, c and the star point n. vac is an RMS value: the phase voltage with mode = phase, the line-to-line voltage with mode = line (a 400 V grid is vac = 400, mode = line).

Code generation (chapter 13) writes mux, atan2, pq, the zero-sequence pins and a comparator with hysteresis. It leaves out ramp (a function of simulation time), compensator (s domain; discretise it with ztf) and any block clocked by its clk input (call the generated step from the clock's interrupt instead).

The example GaN synchronous buck converter (buckGan) drives both gates of its half bridge from one dead-time block:

The GaN buck&#39;s dead-time block, marked 1 to 3

  1. DT: one deadtime block. out is the PWM signal with its rising edge delayed by td (20 ns), outn its complement, delayed too.
  2. Q1: the high side, driven by out (g1).
  3. Q2: the low side, driven by outn (g2).

Sources from a list of points (PWL)

A DC voltage source or a DC current source follows a list of points when you fill in pwl. Write time and value pairs, "t1 v1 t2 v2 ...", with SI prefixes or variables, separated by spaces or commas. The source joins the points with straight lines and replaces its fixed value. There are at most 100 000 points. The times must not decrease, and two points at the same time make a step. Set repeat to 1 to run the pattern again and again; the period is the last time. An odd count of numbers, times that go down and a bad number are refused with a message. The fast solver lands on every corner. SPICE and LTspice PWL(...) sources import as this part (chapter 9).

Loads: constant power, load profiles and the rectifier load

The electrical constant-power load (powerLoad, pins p n and an optional pref input) draws i = P/v above vmin and is the resistor vmin²/P below it, so it stays defined at 0 V. It stands for the input of a regulated converter, so its incremental resistance is negative: an LC filter in front of it rings up unless the filter is damped. Set von and voff to the UVLO thresholds of the converter it stands for: the load starts off, turns on once its voltage reaches von and drops out below voff. Without a lockout, a load on a supply that ramps from 0 V latches near 0 V, as a real one would.

The power it draws is the pref signal when that pin is connected, else its profile, else p. A profile is the power as a function of time:

Profile Meaning
pwl(t1 p1 t2 p2 ...) or the bare list straight lines between the points, as a PWL source
steps(p0 t1 p1 t2 p2 ...) p0 from the start, then each level from its time on
pulse(p1 p2 delay rise fall width period) a pulsed load, as the pulse source; period 0 runs it once
workload(pidle ppeak period duty edge [pexc texc]) an AI-training cycle, repeated every period: the compute phase at ppeak for duty·period, then the communication phase at pidle, each edge taking edge; with pexc texc, each compute phase opens with texc at pexc (above TDP)
vrstep(p0 p1 delay slew [width period]) a load step from p0 to p1 at delay, at slew per µs; with width period it steps back after width and repeats

Numbers take SI prefixes and variables. Set repeat to 1 to run a pwl or steps pattern again and again; a workload always repeats. None of the numbers has a default: take them from your own measurement or a cited source. The aiRackWorkload example takes its workload from Choukse et al., "Power Stabilization for AI Training Datacenters", arXiv:2508.14318v2 (2025): a 1 s cycle between 65 % of TDP and TDP with 50 ms at 1.1 × TDP, on an OCP Open Rack V3 48 V shelf whose BBU rides through a mains failure. Both solvers follow the profile, and the fast solver lands a step on each of its corners. Example: cplInputFilter.

The DC current source takes the same profile (in amperes), ahead of its pwl and i: vrstep(i0 i1 delay slew) is a voltage-regulator load step with the slew in A/µs, as VR transient specs give it. spec.verify uses it for loadStep.slew, and loadStep.loadLine (Ω) checks that the output settles on the load line.

circuit.importLoadTrace (File › Import › Load Trace) replays a measured trace: it reads a logger, PMBus or scope CSV (time and power in W, or current in A), moves it to start at 0 s and writes it as the profile of a power load or a current source in one undoable step. A trace longer than maxPoints (2000, at most 20000) is averaged over that many equal bins, which keeps its energy; the reply gives the energy of the trace and of the profile.

The nonlinear rectifier load (rectifierLoad, pins l n) is a single-phase diode bridge with its smoothing capacitor c and load resistor r, behind an optional line resistance rs and inductance ls. It draws its current in short peaks near each crest of the line, the classic source of odd harmonics. c and r have no default; they are the load you stand for. For a load named NL1, the DC voltage is v(NL1:p) − v(NL1:m) and, with rs set, the line current is i(NL1.rs). Example: rectifierHarmonics.

Batteries, solar modules, supercapacitors and the three-phase grid

These parts have their own component guides (F1), with every parameter.

  • Battery (battery): an open-circuit voltage that follows the state of charge, a series resistance r0 and up to two RC branches. ah is the capacity, soc0 the starting charge, ns the cells in series, and socs with ocvs is the voltage table of one cell. The default table is only an example curve, so take your own from the cell data. The state of charge is the signal <name>:soc and the pin soc. It is held between 0 and 1, with a warning. Its thermal param names a thermal net: the heat of r0 and the RC branches' resistors goes into it, so a thermal network (the cells' cth, an rth to an ambient) gives the cells' temperature T(<net>) from the run's losses. With ea set, the resistances follow the net: after each step they take the Arrhenius factor at T(<net>) in place of temp, which then only sets their value at the start (warm cells lose less, cold cells more). With ea 0 they are fixed. The rest-voltage shift dOcvDt still follows temp.
  • Solar module (pv): the single-diode model, fitted so that the curve passes through isc, voc, imp and vmp. temp, alphaIsc and betaVoc set the temperature, irr or the pin g sets the sunlight, and nser with npar make an array. Values that cannot be fitted (for example imp above isc) are refused before the run.
  • Supercapacitor (supercap): the capacitance c with esr, rleak and an optional slow branch r2 with c2.
  • Water electrolyzer (electrolyzer): a load, the stack of a hydrogen electrolyzer. Each of the ns cells needs the reversible voltage erev plus an ohmic overvoltage (r1 + r2·T)·j and an activation overvoltage s·log10((t1 + t2/T + t3/T²)·j + 1), where j is the current density (the current over the cell area area) and T the stack temperature temp in °C: the empirical law of Ulleberg (Int. J. Hydrogen Energy 28(1), 2003). The defaults of r1 to t3 are Table I of Cantisani, Dovits and Jørgensen (arXiv:2311.09882v2, 2024); area and temp have none, so set them for your stack. i(<name>) is the current into p. Tests check the stack voltage against the law on both solvers.
  • Three-phase grid (grid3): a three-phase source with a neutral. vll is the line-to-line rms voltage. ka, kb and kc unbalance the phases, harmonics adds harmonic pairs such as 5 4 7 3 (order, percent), sagDepth with sagStart and sagEnd makes a sag, fDev with fStart, fEnd and fRate moves the frequency (a step, or a ramp at fRate Hz/s, held to fEnd and ramped back), and rs with ls is the grid impedance. Connect the neutral n.
  • Three-phase parts built from simpler ones: rlc3 (a series R-L-C in each phase), transformer3 (vector groups such as Dy11, Yy0 and Yd1, with leakage and magnetizing inductance), breaker (opens at a set time or on overcurrent after a delay, and may close again), fault (a short circuit between chosen lines, or to ground, in a time window), sixSwitch (three legs of switches with a diode across each) and diodeBridge3.
  • MMC arm (mmcArm): one arm of a modular multilevel converter, n half- or full-bridge submodules inserted by the signal m. level switched (up to 8 submodules) builds every submodule and picks them with an mmcBalance block, at the nearest level or with phase-shifted PWM at fc, sorting by capacitor voltage (sorting 0 switches the sorting off: the submodules go in by index and the capacitors drift apart). level averaged is the arm-averaged model for any n. Plot <arm>:v1 … for the capacitor voltages and <arm>:vsum for their sum. The mmcInverter example adds a circulating-current controller. Tests check that the switched and averaged arms give the same fundamental (after the nearest-level staircase gain) and that the sorting keeps the capacitors together.
  • Pi-section line (piLine, and piLine3 for three phases): a transmission line from its per-metre r, l, c (and optional g) and its length, cut into sections pi sections, each a series R-L with half its shunt C at each end. The three-phase line is one uncoupled line per phase with the positive-sequence values, so it does not model the zero sequence. Plot <line>:1 … for the inner nodes. Tests check that the input impedance of an open or shorted line matches the distributed line, Z0·coth(γℓ) and Z0·tanh(γℓ), and that the open end of a 300 km line rises by 1/cosh(γℓ).
  • Transmission line (tline): a distributed lossless line from its characteristic impedance z0 and one-way delay td, with an optional total series resistance r lumped half at each end. It has two ends, p1–n1 and p2–n2, like SPICE's T element, and imports from and exports to it. A transient solves it by the method of characteristics (Bergeron's method, after H. W. Dommel, IEEE Trans. PAS-88, 1969): a wave leaving one end arrives at the other exactly td later and reflects as the impedance it meets demands, which is what makes the overvoltage at the terminals of a motor fed through a long cable. Max step must not exceed td, or the run stops with an error naming the line. An AC sweep and the DC operating point use its exact chain matrix (quarter-wave resonances in a sweep, the resistance r at DC). The currents into both ends are i(<line>.1) and i(<line>.2). Tests check a step into a line mismatched at both ends against the bounce diagram, the input impedance of an open and a shorted line (−j·Z0·cot(ωτ) and j·Z0·tan(ωτ)), a 200-section pi chain of the same line, the fast solver at a fixed and a variable step, and ngspice's T on the same netlist (within 4e-8 relative RMS). The loss does not spread along the line or grow with frequency (no skin effect).

These parts were checked with tests on both solvers (a battery step, a solar module near its maximum power point, the 120 degree spacing and the depth of a sag, and the time constant of a supercapacitor). No part was compared with a measurement.

Your own blocks

For a control block that is not in the library, you can write a WebAssembly block and load it. It runs in a sandbox. See docs/plugins.md.

Searching for parts

Library › Search Parts (parts.search) looks through every part source at once: the shipped catalogue of capacitors, inductors and semiconductors, and the other sources as they are added. Type a part number or a piece of one, pick a category, and narrow it with that category's specs: voltage and current for any part, Rds(on) ≤ for a MOSFET, capacitance and ESR ≤ for a capacitor, inductance and Isat ≥ for an inductor. A value takes SI prefixes (600, 10u, 20m). Leave out end-of-life parts drops the parts recorded NRND, EOL or obsolete. Each part is one line: part number, key specs, package, price, stock and where the data came from; the pointer over the source says when each source was fetched (the shipped catalogue has no fetch date, its values come from the data sheets). Place (parts.place) puts the part on the schematic as the matching component with its values filled: a capacitor's C and ESR, an inductor's L, DCR and Isat, a MOSFET's, IGBT's or diode's device model. It is one undo step. The search works offline.

Your parts library

When no catalogue part fits a line of the bill of materials, Library › Your Parts adds a part of your own, read off its data sheet: kind, part number, manufacturer, the data sheet you read it from (required, so anyone can check the numbers), package, ratings and an optional Category such as approved. The check beside each field flags missing values and unit slips. bom.export (and so the Parts page and design.auto) uses your part for a line no catalogue part fits.

The list under the editor manages the library:

  • Search filters by part number, manufacturer, package, category or source, and the category menu shows one category (parts.list {"query":"GRM","category":"approved"}).
  • Edit fills the editor with a part; Save changes changes it in place (parts.update {"mpn","set":{...}}), through the same check. The next bill of materials picks with the new values.
  • Export CSV copies the parts shown to the clipboard as CSV, one column per field (parts.export {"format":"csv"|"json"}); paste it into a spreadsheet to keep a team's approved-parts list.
  • Import reads pasted CSV or JSON (parts.import {"text"}): every row goes through the check, the good rows are added, and each row left out is named with its row number and the reason.

Add from a data sheet reads a part's values off its data sheet into a review card instead of typing them. Pick the kind, fill in the part number, manufacturer, package and Data sheet source, then Read the file (a PDF Voltecx can read, or the sheet's text with a page break per page, in a folder you granted) or Read the pasted text (parts.fromDatasheet). Each row shows the value with where it was read, such as p. 2, Table 2 (hover for the line), and the sheet's other readings of the same field (another temperature, a figure) as links that take their place. A field the sheet does not give stays empty and says Not in the data sheet: nothing is filled in. Edit any value, then Save to your library (parts.saveDraft), which runs the same check and keeps every citation and the date the sheet was read with the part; Discard drops the draft. The assistant can read an attached data-sheet PDF the same way: its values land in the same card, each with its page, and you save.

The library stays on your computer (user-parts.json in the settings folder); nothing is uploaded.

Import a part you only have files for

part.import {mpn, kind, source, footprint, symbol, model, fields} adds a part to your catalogue from what you supply: a KiCad footprint (footprint, its text or {"path":...}), a KiCad symbol library (symbol, with name to pick one symbol), a STEP or VRML 3D model (model {"path":...}), and the values you read off the data sheet in fields. Every field carries its source (a data sheet title, revision and address, with page and quote when you have them); a value with no source of its own and no part-level source is an error, because Voltecx never invents a value. kind (mosfet, sic, gan, igbt, diode, capacitor, inductor, resistor, ic, connector or other) decides which fields are expected, and the ones nobody gave are listed in missing, never filled in.

The reply checks the part and lists each finding in English and Traditional Chinese under checks: pins without pads and pads without pins, the exposed pad and the pin it joins, power pins that are hidden or typed wrongly, Kelvin pins, a missing footprint, symbol or model, and a footprint that does not match the symbol. Give pinMap {pad: pin} for pads whose number is not the symbol's pin number (null for a mounting pad) and roles {pin: role} when a pin's name does not say it is power, ground or Kelvin. "ok": false means a check is an error. With "add": true (and no error) the footprint, symbol and 3D model are kept in your model cache under the part number, so file.exportKicad uses them. The command changes no circuit and uploads nothing.

Your own symbols

Library › Editors › Symbol Editor draws a part symbol of your own: an IEC resistor box, a vendor's IC outline, a block for a subsystem.

  1. Type a name and click New, or select one part on the schematic and click New from selected part. The second way starts from that part's box, with a pin for each of its ports, already bound to it.
  2. Pick a tool and click the grid. Polyline adds a point per click; click Finish line when it is done. Polygon works the same way and closes itself (Finish polygon). Box takes two corners, Arc and Circle a centre and a point on the circle, and Text and Pin one click each. Type the text or the pin name first. With Box, Circle or Polygon, tick Fill to draw the shape solid (a filled polygon must be convex). Shapes snap to half a grid unit. Pins end on whole grid points, where wires meet them. Each shape and pin is one step that Cmd+Z takes back.
  3. To change what is drawn, pick Select and click a shape (near its first point, corner or centre) or a pin (at its tip): it is ringed. Click anywhere else on the grid to move it there. A picked shape can be filled or unfilled, or erased; a picked pin shows its name, number and side to edit, then Apply. Parts drawn with the symbol redraw at once and stay bound. A pin's name is the model port it stands for, so renaming is refused while the symbol is bound or a part is drawn with it.
  4. Bind ties the symbol to a model: a subsystem's name (an IC placed from the library is a subsystem too) or a part kind such as resistor. The pins must be exactly the model's ports, or Bind says which are missing and which are extra.
  5. Place adds a part drawn with the symbol. On a part that already exists, the symbol.apply command switches its drawing. Save to library keeps the symbol for your other projects, in library/symbols.json in the settings folder. Export copies it as a symbol file to share.

The Symbol Editor with a hand-drawn IEC resistor, and R1 drawn with it, marked 1 to 5

  1. New starts a symbol (step 1).
  2. The drawing tools, Polyline first (step 2).
  3. Bind ties the symbol to a model (step 4).
  4. Place adds a part drawn with it (step 5).
  5. R1, drawn with the IEC symbol.

A symbol only changes the drawing. The part simulates exactly as with its standard symbol, and a part whose symbol no longer fits its ports goes back to the standard one. The lesson Draw your own symbol walks through it.

Your own footprints

Library › Editors › Footprint Editor draws a board footprint of your own, saved as footprints/<name>.vxfp beside the project.

  1. Type a name and click New, or pick a footprint of the project's library from the list (or type a .vxfp path). To start from a data sheet instead, open Generate IPC-7351 Footprint under the name: pick the package (a two-terminal chip, a dual-row part such as a SOIC, or a quad no-lead part such as a QFN), name the data sheet, page and revision the dimensions come from, and type each dimension's min and max in mm as the data sheet's table gives them, with the pitch and the number of lands. Pick the density (Most, Nominal or Least, the IPC-7351 presets for chips and dual-row parts) or Own goals (toe, heel and side, with the courtyard excess; a quad part always takes its own), then type the board fabrication tolerance F and the placement tolerance P. Generate stays grey and says what is missing until everything is typed, since Voltecx never guesses a dimension. It writes the land pattern (lands numbered from pin 1 and the courtyard) to the library and opens it here; an existing footprint of that name is kept unless Replace an existing file is ticked. This is the footprint.ipc7351 command. Some parts also have the maker's own recommended land pattern, copied from its drawing and cited in the footprint's source as maker recommended, never as IPC-7351B: Vishay's 0402 and 0201 chip resistors, TI's 3 × 3 mm 16-pin VQFN (RGT0016C) and 10-pin VSSOP (DGS0010A), and the D2PAK (TO-263) as three makers draw it. The D2PAK makers disagree (their tab pads are 9.017, 8.00 and 7.01 mm tall), so each has its own preset named after it: Vishay AN826 (3-lead, minimum pads), Vishay document 96683 (2-lead) and Diodes TO263AB. Pick the one from your part's maker; pads 1 and 2 are the lead pads and pad 3 the tab. Pick Maker Recommended as the package, then the part's drawing (its maker document and page show under the buttons), and type the courtyard excess, since the makers give none (zero is allowed); the data sheet, dimensions, density and tolerances do not apply. The command takes them as "package": "maker" with the preset id and the courtyard excess. TO-247, BGA and the 7-lead D2PAK have no preset: their drawings leave the holes or ball positions open, or give no land pattern, so draw those by hand from the maker's drawing.
  2. SMD Pad and Through Pad place a pad at each click on the grid, numbered on from the highest number. Pick the shape (rectangle, round rect, oval or circle) and type its size in mm, and for a through pad its drill; the tool waits until you do, since Voltecx never guesses a pad size. Clicks snap to Grid (mm). Segment and Box draw on the silkscreen, the fabrication drawing or the courtyard, two clicks each, at the line width you type; Circle takes the centre, then a point on the circle. Arc takes three clicks: its start, a point on it and its end. The Drawings list below the drawing area names each drawing by layer and shape; its × deletes that one drawing, as one undo step. With the shape Custom Polygon, a pad tool draws the pad's copper outline instead: click its corners on the grid and click the first corner again to close it. The pad is anchored at the middle of the outline's bounding box, where a through pad's drill goes. An outline with all its corners in line and an arc whose three points are in line are refused and say why; the clicks so far stay. Add Pads takes the other shapes only. With a pad tool on, Add Pads places a whole row of those pads at once: type where the first one goes (Row start x and y), the Pad count and the pitch in x or y. The pads are numbered on from First pad number (empty: from the highest number); tick Same number (thermal vias) to give them all one number, as for the vias in an exposed pad. The row is one undo step.
  3. Select picks a pad: edit its number, place and size and click Apply, or Delete pad. Mask margin and Paste margin set the pad's solder mask and paste openings with the same Apply: a margin in mm grows the copper (negative shrinks it), No opening leaves that layer closed (as for the paste on an exposed pad with vias), and an empty margin opens the copper itself. Drag a pad to move it: it lands on the nearest grid point, as one undo step. Drag anywhere off the pads to pan and scroll to zoom; Zoom to Fit frames the pads and body. The layer switches show or hide the copper, paste, mask, fabrication, courtyard and silkscreen.
  4. Set Courtyard draws the courtyard around the pads and the body, grown by the excess you type (IPC-7351 calls it the courtyard excess). Check Footprint places the footprint alone on a board with the project board's stack-up and rules and runs the DRC; it lists each violation, and a missing courtyard or pads outside it, and rings each violation on the drawing where the DRC found it.
  5. 3D Model and Properties places the 3D model (a STEP or VRML file, with its offset in mm and its rotation in degrees; an empty offset or rotation is 0) with Place Model, or takes it off with Remove Model. Set Properties saves the description and the source of the dimensions. Set Height saves the body's height above the board, the data sheet's maximum seated height, with the document it comes from; it stays grey until that source is named, and an empty height removes it. Set Fitting saves how the part is fitted, off its data sheet: its Mount (surface mount, through-hole by hand, wave or selective solder, press-fit), whether it is Plugged in (stays soldered, socketed, plugged by the user), whether it is Removed in service, and whether it is Keyed. Anything the data sheet does not say stays Unknown, and the button stays grey until the Fitting source is named. Remove Fitting takes it off. Every part placed with this footprint then carries the fitting into the fitting plan, the assembly and layout reviews, the coating keep-outs and the BOM's Fitting column. The fields follow the footprint, so Undo shows what it had before.

Every change is one step of the footprint's own history: Undo and Redo in the window take it back and do it again. The same edits are the footprint.* commands, from footprint.new and footprint.addPads to footprint.check, and board.placePart {"footprint": "<name>.vxfp"} puts the footprint on the board.