# 16. Automatic design

Automatic design turns a specification into a converter that has been checked. You write the spec: the input range, the output, the load, and any limits you care about. Voltecx chooses a topology, draws it, sizes the parts, closes the voltage loop, checks every corner of the spec by simulation, tunes what it can, and writes a report. The command is `design.auto`.

This chapter is about the whole pipeline. It also describes each tool the pipeline is built from, because you can run each one alone. Read "What is an estimate" before you trust any number outside the simulator.

> **Needs sign-in to Voltecx Cloud.** `design.auto` runs on Voltecx Cloud, not on your computer. Sign in first under **Help > Licence** (chapter 1, "Voltecx Cloud account"). Only the spec and the options you give are sent; the open circuit stays on your computer, and the design comes back into it. `analysis.pareto`, the design report (`report.export`, `report.designSummary`) and PSIM import run there too. The menu items say so when you hover over them, and their forms say so above the fields, with your sign-in state: signed in, waiting for approval in the browser, or not signed in. The command-line tool has no link to Voltecx Cloud of its own: run these commands through a signed-in desktop app (`powercraft-cli app`); otherwise they answer that they run on Voltecx Cloud.

## What to expect

- `design.auto` makes a starting design and checks it against your spec. It does not promise a pass. When the design does not pass, the report names the stage that stopped it and the rows that failed, with a next step for each.
- Every number in the report comes from a simulation or from a textbook equation that the report prints beside it. Nothing in the run is random except the Monte Carlo yield, which uses a seed you can set. The same spec and seed give the same circuit and the same report.
- The run has hard limits on the number of simulations and the number of solver steps. A run that reaches a limit stops and says so.
- `design.auto` replaces the content of the open circuit. When no circuit is open, it makes a new one. Save your work, or open **File > New Circuit** first. A run from the Auto Design window asks you first: see "Review before it replaces the circuit" below.

## Write a spec

A spec is a JSON object. Three fields are required: `vin`, `vout` and `iout`. Everything else is optional. A limit you leave out is not checked, and the report lists it as not checked. The same spec is used by `design.auto`, `spec.verify`, `design.robustLoop` and `analysis.pareto`.

Values are numbers in base units: volts, amperes, seconds, hertz, percent and degrees. A value may also be a string with an SI suffix, such as `"4m"` or `"500k"`. A name that is not a spec field is an error, and the message gives the path (`spec.vin.maxx`). A missing required field is an error that lists every missing field at once.

| Field | What it means |
|---|---|
| `vin` | The input voltage range as `min`, `nom` and `max`, in volts. The three must be in that order |
| `vout` | The output as `nom`, in volts, and `tolPct`, the allowed error in percent. A negative `nom` asks for an inverting converter |
| `iout` | The load current range as `min` and `max`, in amperes. `max` must be above 0 |
| `ripple` | `maxPp`: the largest peak-to-peak output ripple, in volts |
| `loadStep` | The load jumps from `from` to `to` amperes, ramping at `slew` A/µs when given, and goes back to `from` after the output settles (`release`, true by default). `maxDroopPct` is the largest dip or rise of the output in percent, after either edge. `maxSettle` is the longest time to recover, in seconds, and is optional. A spec with a DC output and no `loadStep` is held to a default one: from half to full load and back at 1 A/µs, within 10 %. It is marked `"assumed": true` in the reply's spec and rows and named in its notes, and `design.auto` then also designs a buck's loop for it, keeping the crossover at or above a fiftieth of the switching frequency it starts from. On other converters (a boost's right-half-plane zero, a SEPIC, a flyback, a resonant converter) `design.auto` reads and shows the default step without designing for it (`"gate": false`), and a miss is an open item. Write `"loadStep": false` to leave it out. Each edge is reported in volts and millivolts (`undershootV`, `overshootV`), with its settling time to the tolerance band (`settleS`, `settleBandV`) |
| `lineStep` | The input jumps from `from` to `to` volts, at the load `iout` (optional). `maxDeviationPct` is the largest output deviation in percent. `maxSettle` is optional |
| `startup` | `maxTime`: the longest time to reach the output, in seconds. `maxOvershootPct` is the largest overshoot in percent, and is optional |
| `efficiency` | A list of points. Each has `iout`, an optional `vin`, and `minPct`, the lowest efficiency in percent at that point. At most 16 points |
| `tjMax` | The highest junction temperature of any switch or diode, in degrees Celsius |
| `ambient` | The ambient range as `min` and `max`, in degrees Celsius. It adds temperature corners |
| `pmMinDeg` | The lowest phase margin of the loop, in degrees |
| `gmMinDb` | The lowest gain margin of the loop, in decibels |
| `corners` | A list of operating points, each with `vin`, `iout` and an optional `ambient`. When you leave it out, Voltecx uses every combination of the minimum, nominal and maximum input, the minimum and maximum load, and the two ambient limits. At most 64 corners |
| `loop` | How the loop gain is measured. `signal` is the signal to break the loop at (the default is the input of the PI block). `fStart` and `fStop` are the sweep limits in hertz (the defaults are the switching frequency divided by 500 and by 20). `points` is the number of frequencies, from 3 to 40, default 8. `amplitude` is the size of the injected signal. `at` is `vinCorners` (the default) or `nominal` |
| `monteCarlo` | A yield test with random part values. `tolerances` maps a part parameter such as `C1.c`, or a circuit variable, to a tolerance from 0 to 1. `runs` is 20 by default and at most 200. `seed` is 1 by default. `distribution` is `uniform` or `gauss`. `minYieldPct` is the share of builds that must pass |
| `bind` | Names for a circuit that Voltecx does not recognise as a converter: `source`, `load`, `outNet` and `fsw`. You do not need it for a design that `design.auto` drew |
| `tEnd` | The shortest start-up run, in seconds, at most 10. The default is the circuit's own end time. A run also lasts at least eight closed-loop time constants of the loop's crossover, and it goes on while the output is still settling, up to eight times its first length. A row read while the output was still settling says so in its note |
| `referenceCheck` | `true` by default. The nominal corner is run again on the reference solver, and a row where the two solvers disagree is flagged. Set it to `false` to save time |

`design.auto` reads these fields to design the circuit: `vin`, `vout`, `iout`, `ripple`, `tjMax`, `ambient.max` and `pmMinDeg`. All the other fields are handed to `spec.verify`, which uses them to check the result.

### Options for the run

Eight more objects sit in the spec next to the requirements. `design.auto` reads them and takes them out before the spec goes to `spec.verify`.

| Field | What it does |
|---|---|
| `auto.mode` | `direct` (the default) sizes from the ranking and the textbook equations. `pareto` adds a stage that searches with `analysis.pareto` and takes the switching frequency and the ripple from the knee of the front. It works for a buck, a synchronous buck, a boost, a synchronous boost and a buck-boost |
| `auto.bestEffort` | `true`, `false` (the default) or a list of gate names. A gate in the list may fail without stopping the run, and the failure stays in the report. The gate names are `feasibility`, `pareto`, `magnetics`, `robustLoop`, `verify`, `gateDrive`, `senseNetwork`, `isolatedFeedback`, `protection`, `analogControl`, `digitalize`, `codegen`, `emi`, `auxRails`, `layout`, `bom`, `life`, `cost`, `protectionCases` and `kicad` |
| `auto.outputDir` | A folder for the files the run writes: the firmware and the software-in-the-loop files, `bom.csv` and the KiCad project. Without it those stages run but write no files, and say so. It needs a folder the program may write to |
| `auto.debugAids` | `true` adds the debug aids of `design.debugAids` (0 Ω links, isolation links in the IC supplies, the inductor's current loop, the loop-injection resistor with its test points, DNP snubbers and gate-resistor footprints, test points, DNP bulk footprints) after the emi stage, so the layout, the bill of materials and the KiCad project include them, and the report gets a Bring-up section. The default is `false` |
| `auto.blocks` | `true` hands the circuit back grouped into one block per design step (`circuit.groupBlocks`): POWER_STAGE, EMI_FILTER, PROTECTION, SENSING, CONTROLLER and GATE_DRIVE, laid out in power-flow order with the control row joined by net labels, each block with its key values over it. The parts the gate drive, sense, feedback, protection and EMI stages added go into their step's block. It runs after the KiCad stage, so the layout, the bill of materials and the KiCad project see the flat circuit; the netlist is the same. The default is `false` |
| `auto.model` | `averaged` (the default) runs the verifications' corners below full load, their load and line steps and their loop gain on the circuit-averaged model of a buck, boost, buck-boost, SEPIC or flyback (the switch and diode replaced by their averages over a period, in continuous and discontinuous conduction), and the worst case's output mean over the tolerance box; the full-load corners (the worst ripple and stress), the efficiency, the junction temperatures and the worst case's ripple stay on the switching circuit, and each full-load corner runs on both models so the report shows how well they agree (within 1 % of the output). After each verification the averaged model runs to steady state at the circuit's operating point and its capacitor voltages, inductor currents and loop duty become the circuit's starting values, so the switching runs after it (efficiency, temperatures, stress, parts, emission, bill of materials) and the worst case's ripple runs, each started at its own input's steady state, last about four loop time constants instead of the slowest corner's settle time; the ripple runs are still continued while their output settles. The run then takes under half the solver steps. `switching` runs everything on the switching circuit. An LLC or phase-shifted full bridge always runs switching |
| `emi.class` | `A` or `B`. The default is `B` (CISPR 32) |
| `emi.marginDb` | How far below the limit the spectrum must stay, from 0 to 40 dB. The default is 0 |
| `emi.filter` | `auto` (the default), `none`, `oneStage` or `twoStage` |
| `emi.apply` | `true` puts the sized input filter into the circuit whenever one is sized. The default is `false`: the filter goes in only when the circuit misses `emi.marginDb` without it and the converter has an input capacitor (the filter is sized for one that holds the switching ripple; without it the run says so in the open items). Either way, the filtered circuit is verified again at every corner (regulation, ripple and loop margins; the transients, losses and tolerances the filter does not change are left out to stay inside the step budget) |
| `digital.format` | The number format of the firmware, as `design.digitalize` names it. The default is `q31` |
| `cost` | A cost target: `max` is the most one board may cost in US dollars, `qty` the boards built at once (1 by default; each part is priced at the quantity break of its pieces times `qty`) and `prices` the prices as `bom.export` takes them. With `max` the bill of materials picks the cheapest of the best candidates, and the `cost` gate fails when one board costs more ("not feasible at this cost") or when a line has no price, which it names. Voltecx ships no prices it has not read on a cited page, so give `prices` or set `NEXAR_TOKEN` |
| `life` | A life target: `years`, the shortest capacitor wear-out life asked, and `ambient` in °C (default the spec's `ambient.max`, else 40). Before the bill of materials each electrolytic, polymer or hybrid capacitor that wears out sooner is swapped for the first `bom.export` alternate that lasts (`design.reliability`'s formula). The `life` gate judges the parts bought, and the report's Cost and life chapter lists the swaps and the `design.tradeoff` table. With `missionProfile` (the parameters of `design.lifetime`: `profile` or `csv`, `model` and the rest) the `life` gate also checks the power semiconductors' thermal-cycling life under that profile, and the chapter shows it |
| `control.implementation` | How the loop is built. `digital` (the default) turns the compensator into firmware. `analogOpAmp` builds it as a Type II or III network around an LM358B op-amp with a TL431 reference; `controllerIc` around the error amplifier and modulator of a PWM controller IC: the LM5145 for a buck, the UCx843 for a boost, SEPIC or flyback. On a boost or a non-isolated flyback the UCx843 runs in peak-current mode, in the circuit: the IC drives the switch, its current-sense comparator reads `Rcs` with the 1 V clamp, and slope compensation from its oscillator ramp keeps a duty above 50 % stable (see analogControl below). On a SEPIC it is still modelled as its error amplifier and reference with a voltage-mode modulator (a ramp of `vcsMax` on its current-sense pin); there its peak-current-mode behaviour is not simulated, so that is not a full simulation of the IC. Both use E96 resistors and E12 capacitors and need a buck, boost, SEPIC or flyback with a positive output. An isolated flyback (`isolated: true`) keeps the UC3843, TL431 and optocoupler loop of the closeLoop stage: that is its analog implementation, and the report names it, with no op-amp part. The AI assistant asks which one when the spec names none |
| `control.mode` | `voltage` (the default) or `peakCurrent`; `"control": "peakCurrent"` is short for `{"mode": "peakCurrent"}`. Peak current mode on a non-isolated buck or boost builds the loop in the circuit in the pcmLoop stage below, with an op-amp error amplifier (`implementation` analogOpAmp, the default here; digital is refused). A digital voltage-mode run whose load step needs a crossover above what its loop can use offers peak current mode in `explain.tryInstead`. With neither `control` nor `digital` in the spec, a non-isolated boost or synchronous boost whose robust voltage-mode loop passes but crosses below a five-thousandth of fsw (a high-ratio boost's light-load resonance holds it near 10 Hz, too slow to verify within the solver steps) is moved to peak current mode by the run itself: the pcmLoop note and `control.chosenBecause` give the reason, and `options.control` shows the loop built. Name `control` to keep voltage mode |
| `feedback` | Only for an isolated flyback: the optocoupler of the TL431 feedback. `optocoupler` names one bin of the TCET1100 family, or `ctrMin` and `ctrMax` (at the LED current `ctrAtIf`, 5 mA by default) give a range of your own; not both. `ageing` is the share of the CTR left at end of life, 0.5 by default. Without it every bin is tried in turn |
| `auxRails` | Auxiliary rails and a post-regulator, each an LDO: `rails` is a list of `{name, vout, iout, from}` (`from` is `vin`, the default, or `vout`), with `rippleMaxPp` (1 % of `vout` by default), `sourceRipplePp` (the feed's ripple) and `part` (an LDO from the catalogue) optional; `postRegulator` `{vout}` is a rail from the output carrying the whole load (`iout` defaults to `iout.max`). See "Auxiliary rails" below |

### Shorthand

You can write the five main fields as plain numbers. Voltecx writes them out in full before it reads the spec, and the reply of `spec.verify` and `design.auto` shows the full spec in `spec`, so you can see what was assumed.

| Shorthand | Means |
|---|---|
| `"vin": 12` | `min`, `nom` and `max` are all 12 V |
| `"vin": [10.8, 13.2]` | `min` is 10.8 V, `max` is 13.2 V, and `nom` is the midpoint, 12 V |
| `"vout": 3.3` | `nom` is 3.3 V and `tolPct` is 2, a 2 percent tolerance |
| `"iout": 5` | `max` is 5 A and `min` is 10 percent of it, 0.5 A |
| `"ripple": 0.05` | `maxPp` is 0.05 V |
| `"efficiency": 85` | One point: at least 85 percent at `iout.max` |

So `{"vin": 12, "vout": 3.3, "iout": 5}` is a complete spec. The full form still works, and you can mix the two. A shorthand number must be above 0, except `vout`, which may be negative but not 0. The two values of `[min, max]` must be in that order. A shorthand that breaks a rule is an error that names the field, such as `spec.vin`.

### An example: 12 V to 3.3 V, 5 A

This spec asks for a buck converter from a 12 V input that may vary by 10 percent, with 3 percent output accuracy, up to 5 A, and 50 mV of ripple. It also sets limits for a load step, start-up, efficiency, temperature and loop margins. The limits are an example. Choose your own.

```json
{
  "vin": { "min": 10.8, "nom": 12, "max": 13.2 },
  "vout": { "nom": 3.3, "tolPct": 3 },
  "iout": { "min": 1, "max": 5 },
  "ripple": { "maxPp": 0.05 },
  "loadStep": { "from": 1, "to": 5, "maxDroopPct": 5, "maxSettle": "1m" },
  "startup": { "maxTime": "3m", "maxOvershootPct": 5 },
  "efficiency": [{ "iout": 5, "minPct": 85 }],
  "tjMax": 125,
  "ambient": { "min": 0, "max": 50 },
  "pmMinDeg": 45,
  "gmMinDb": 6
}
```

### Answer the requirements interview first

You rarely know every field of a spec at the start. `spec.questions` asks for what is missing before anything runs. Give it what you know, and it returns the open questions in three groups:

| Group | Questions |
|---|---|
| Must | Application (server PSU, EV or battery charger, LED driver, battery backup unit, solar, motor drive, consumer adapter or other), input voltage, output voltage, load current, galvanic isolation |
| Important | Output ripple, efficiency at full load, load-step droop (from half to full load), ambient temperature, cooling, size or cost priority, protections, magnetics from the catalogue or custom-wound, discrete or coupled magnetics |
| Optional | EMI class (CISPR 32 A or B), standards, control implementation (digital, analog op-amp or a PWM controller IC), auxiliary rails, service life; for an isolated design also the transformer core shape (PQ, RM, EFD, ETD or planar) and winding constraints |

The application comes first, because the suggested efficiency, EMI class, standards and service life follow from it. Each question has a suggested default and one line on why it matters. The input, output and load have no default: you must give them. To take the defaults of a group, call it again with `accept` set to `must`, `important`, `optional` or `all`, or to a list of question ids. A question for a field you already gave is never asked again.

```text
spec.questions {"spec": {"vin": [10.8, 13.2], "vout": 3.3, "iout": 5}, "accept": "all"}
```

When `round` is `confirm`, the reply holds a `summary` table (each answer and whether you gave it or took the default) and `designAuto`, the parameters for `design.auto`. Check the table, then run `design.auto` with those parameters. The application, cooling, magnetics, protections, standards, service life, control implementation and auxiliary rails are kept in `preferences`: `design.auto` does not read them yet, so keep them with the design notes.

In the desktop app, **Design > Automate > Requirements Interview** shows the same questions as a short form. The default is the hint in each field, and hovering over a label shows why it matters. **Use the defaults** takes a group's defaults. When every must question is answered, the window shows the spec summary, and **Confirm and Run Auto Design** starts the run. The agent panel asks the same questions in rounds, must first, and runs `design.auto` only after you confirm the summary. A script that already has the full spec calls `design.auto` directly and skips the interview.

![The Requirements Interview window, marked 1 to 2](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/automatic-design/04-interview.png)

1. The input voltage, typed as min, max.
2. **Use the defaults** for the must group.

### The spec is saved with the circuit

`design.auto` keeps its spec with the circuit, in its own undo step, and the spec is saved in the `.voltecx` file. After you open the file again, in the app or with `--in`, the Test Bench lists its cases, `spec.verify` verifies, `emi.conducted` takes its limit and `design.thermal` takes `tjMax` and the hottest ambient without the spec typed in again. Each reply says where the spec came from: `specFrom: "circuit"`, `fromSpec`, or an input with `source: "spec"`. A value you give in the call still wins.

A circuit that `design.auto` did not make, such as an example or an imported file, gets a spec with `spec.set {"spec": {...}}`, and `spec.set {"spec": null}` removes it. Each is one undo step. Besides the fields above, a stored spec may hold `holdUp {time, vMin}` for the Test Bench and `emi {limit, class, marginDb, targetMarginDb}` for `emi.conducted`, such as `"emi": {"limit": "cispr25Class3"}` for a 12 V automotive supply.

With **View > Studio Layout (Preview)** on, the **Spec** document shows the stored spec: one row per requirement with its target, its status (**Pass**, **Fail**, **Low margin**, or **Defined** before a verification checks it), **Proven by** and **Set by**. **Low margin** is a pass within a tenth of its limit (10 K for a temperature); hover over it to see how much is left and at which corner, and that closest row gives the **Result** and **Proven by**. **Verify all** (F7 while the Spec page is in front; elsewhere F7 stays Continue / Pause) runs `spec.verify`. After it, **Proven by** names the run that decided each row and its corner, such as "Load step run at corner 43 V, 2.5 to 5 A". A failing row names the run and corner that failed it. Click the link to open that verification's report, which lists every corner's run. A row decided by a start-up, corner or load-step run also has **Show the run**: it runs that corner again in the Test Bench, on a copy of the circuit, and opens the Test Bench on that case's scope with the row's limit drawn on the waveform. The loop gain, efficiency and thermal rows have no such run, so they show no link. **Set by** reads **CLI** for a spec that `powercraft-cli` set while linked to the window, and the version history names that step "Set Design Spec (by CLI)".

```sh
powercraft-cli run --in work/pol.voltecx --cmd testbench.list --params '{}'
```

## Run it

Whatever door you use, the call has the same shape. `spec` is required. The other parameters are listed below.

| Parameter | What it does |
|---|---|
| `spec` | The spec, as an object or as its JSON text |
| `isolated` | `true` asks for an isolated topology and draws it isolated: the secondary returns to its own ground, and the loop crosses the barrier through parts made for it. See "An isolated design" below. The default is `false` |
| `priority` | `balanced` (the default), `efficiency` or `size`. It changes how the topology ranking weighs losses against size |
| `topology` | `buck`, `syncBuck`, `boost`, `syncBoost`, `buckBoost`, `sepic`, `fourSwitchBuckBoost`, `flyback`, `llc` or `psfb`. It skips the ranking and draws this one |
| `fsw` | The switching frequency in hertz. The default is the frequency the ranking used to estimate the losses, which is 100 kHz for a DC-DC converter |
| `seed` | A whole number, 1 by default. It seeds the Monte Carlo yield when the spec names no seed |
| `limits` | The caps of the run. See "The caps" below |
| `reportPath` | A path without an extension. The report is also written as `.json`, `.md`, `.html` and `.svg` files. It needs a folder the program may write to |
| `lang` | `en` (the default) or `zh-Hant`. The language of the Markdown and HTML report |

### In the desktop app

Choose **Design > Auto Design**. The window is a form. Its **Spec** section holds the spec, and you can save the spec as a JSON file and load it again. The items of **Design > Automate** open a form or run one of the tools described below: **Requirements Interview**, **Verify Against Spec**, **Suggest Topology**, **Compare Topologies and Control**, **Design Magnetics**, **Compare Magnetics** (`magnetics.compare`: buy or wind, the custom designs against the catalogue's inductors), **Robust Loop**, **Pareto Front**, **Digitalize Compensator**, **Conducted EMI**, **Radiated EMI**, **Layout Hints**, **Verify Generated Code**, **Diagnose Waveforms** and **Debug Aids**. **Export BOM**, **Export KiCad Project** and **Manufacturing Outputs** are in **Design > Manufacturing**; the first two are also **File > Export > Bill of materials** and **File > Export > KiCad project**, where Altium and KiCad users look for them. **Design > Design Steps > Protection** opens the form of `design.protection`.

![The Automate submenu, marked 1 to 5](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/automatic-design/01-menu.png)

1. Automate.
2. Auto Design.
3. Verify Against Spec.
4. Suggest Topology.
5. Design Magnetics.

The form, filled in with the first values of the 12 V to 3.3 V, 5 A example above:

![The Auto Design window, marked 1 to 5](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/automatic-design/02-form.png)

1. The nominal input voltage.
2. The output voltage.
3. Save spec.
4. Optimise for: Balanced, Efficiency or Size, one click each.
5. Design converter. After a first run, a note beside it says about how long a run takes ("About 40 s"), from how long the last one took; a wider spec takes longer.

The rows show what state they are in. An empty row shows a typical value as a hint in grey italics, such as *e.g. 12*. The hint is never sent. A value you type, or one read from the circuit (marked "from circuit"), is drawn in the normal text colour. The required rows carry a red `*`. A required row left empty is drawn with a red border and the note **Required.** once you leave it or press **Design converter**. It then names every empty required row below the form and puts the cursor in the first one. **Use typical values** copies each hint into its empty row in one click; the rows then hold those numbers like typed ones, and **Undo typical values** empties them again.

The form also checks each number against the range the design takes before it sends the spec, so a spec that cannot be designed never goes to Voltecx Cloud. A voltage, frequency or time must be above 0, the smallest load must not be negative, a percentage is above 0 and at most 100 %, a temperature is from −60 °C to 250 °C, and the phase margin from 0° to 180°. Rows that bound one another must be in order: the minimum input not above the nominal or the maximum, the smallest load not above the largest, the coldest ambient not above the hottest, and a load step must step. A row that breaks a rule gets a red border and, under its group, a line that names it, such as *Input voltage, minimum must not be above Input voltage, nominal (48 V)*. The line shows once you leave the row or press **Design converter**, which then opens the row's group and puts the cursor in it.

A run from the window does not touch the open circuit until you say so.

### Review before it replaces the circuit

When the run ends, the result window shows the design at its top as a card, the same card the agent panel uses: what it adds, what it removes, and each changed value as `L1 inductance 100 µH → 47 µH`, with **Accept** and **Reject**. The open circuit is unchanged while the card waits. **Accept** puts the designed circuit in its place as one undo step named Auto Design, so one Cmd+Z (or the card's **Undo**) gives your circuit back. **Reject**, or closing the window, leaves the circuit as it was. If you edit the circuit before you decide, the card says it is out of date and Accept is refused rather than overwrite your edits: undo them, or run the design again.

Automation gets the same step with `job.start {"command": "design.auto", "params": {..., "review": true}}`: the reply's `proposal` holds the card's id and summary, `proposal.list` lists it with `replaces: true`, and `proposal.accept` or `proposal.reject` decides it. Without `review` a job, and a direct call, replace the circuit as before.

The run goes to the background. The status bar shows its progress and a Cancel button, and Esc in the console stops it. When it ends, a window shows the summary of the report, with an **Open report** button. The verification table is drawn as a table.

You can also type the command in the console (View > Console, or ⌘⇧Y, or Ctrl+Shift+Y on Windows and Linux), with the spec as JSON on one line:

```text
design.auto {"spec": {"vin": {"min": 10.8, "nom": 12, "max": 13.2}, "vout": {"nom": 3.3, "tolPct": 3}, "iout": {"min": 1, "max": 5}, "ripple": {"maxPp": 0.05}}}
```

For a report file, add `reportPath` and start the app with `--automation-write-root DIR` (chapter 11).

The agent panel can ask for a design. It runs `design.auto` on a scratch copy and shows the result as a new-circuit card that you accept or reject. It can also run `spec.verify`, which changes nothing (chapter 12).

A background run works on a copy of the circuit and merges its result back when it ends. The checkpoints and undo steps the run makes stay with that copy, and the report says so in its open items. The stage hashes in the report still identify each state.

### On the command line

Write the call in a file, for example `design-call.json`:

```json
{
  "spec": {
    "vin": { "min": 10.8, "nom": 12, "max": 13.2 },
    "vout": { "nom": 3.3, "tolPct": 3 },
    "iout": { "min": 1, "max": 5 },
    "ripple": { "maxPp": 0.05 }
  },
  "reportPath": "pol-report"
}
```

Then run it. `--root work` is the folder the report may be written to, and it must exist. `--out` saves the designed circuit.

```sh
mkdir -p work
powercraft-cli run --new '{"name":"pol"}' --root work \
  --cmd design.auto --params "$(cat design-call.json)" --out work/pol.voltecx
```

The command prints one line of JSON, which holds the whole report. The files `work/pol-report.json`, `.md`, `.html` and `.svg` hold the same report in readable form. `powercraft-cli run` exits with code 0 when the command ran, even when the design did not pass. Read the `pass` field of the reply, or open the Markdown file. A call with a bad parameter exits with code 1 and prints the reason. Nothing is changed in that case.

A design is not finished until it holds up in a plain simulation. `powercraft-cli sim` runs the saved circuit and checks numbers against limits, and its exit code says whether they hold (chapter 13):

```sh
powercraft-cli sim work/pol.voltecx --tend 5m \
  --expect 'mean(v(out), 4m, 5m) in 3.2..3.4' \
  --expect 'pp(v(out), 4m, 5m) < 0.05'
```

The window from 4 ms to 5 ms is an example. Choose a window after the start-up of your design. The exit code is 0 when both limits hold and 3 when one does not.

### From the assistant

Ask the built-in assistant (the agent panel, or `powercraft-cli chat`, chapter 11) to design from your spec: it runs `design.auto` with the params above as a job, shows the progress and can stop it. For `reportPath`, start `chat` with `--automation-write-root DIR`.

## What each stage does

The run is a fixed list of stages. Each stage is an existing command. A stage that ends leaves a checkpoint, so you can find any state again.

| Stage | Command it runs | What it does |
|---|---|---|
| feasibility | `spec.feasibility` | Before anything is sized, checks that the spec is within reach: the efficiency against the semiconductors' losses alone, the ripple against the best catalogue capacitor bank, the junction temperature on the best catalogue heatsink. An efficiency, ripple or topology out of reach fails this gate and stops the run, with the smallest relaxation of each kind in `explain.tryInstead`. `spec.auto.bestEffort` with `feasibility` designs anyway. A junction too hot even there is an open item, as the run's other temperature findings are |
| suggest | `topology.suggest` | Ranks the topologies for your spec and picks the best one that `design.auto` can design. A topology that ranked higher but cannot be designed yet is listed in the open items |
| pareto | `analysis.pareto` | Only with `auto.mode` set to `pareto`. Searches the design space and keeps the switching frequency and ripple of the knee |
| template | `circuit.template` | Draws the topology (`buck`, `syncBuck`, `boost`, `syncBoost`, `buckBoost`, `sepic`, `fourSwitchBuckBoost`, `flyback`, `llc`, `psfb` or `multiphaseBuck`, with the phase count the ranking chose) and sizes its parts from textbook equations. The drawing replaces the content of the open circuit, in one undo step, and keeps its name |
| converter | `design.converter` | Sizes the inductor and the output capacitor for a ripple of 70 percent of your ripple limit (1 percent of the output when the spec has none), then simulates to check. For a SEPIC it sizes both inductors and the coupling capacitor. It is skipped for a flyback and a phase-shifted full bridge, which keep the values `circuit.template` sized from your spec (nominal input, output, full-load current and ripple; the full bridge's turns ratio from the lowest input). For an LLC, `design.llc` sizes the tank for your whole input range instead and checks it by simulation at the nominal input |
| magnetics | `magnetics.design` | Designs each inductor or transformer (core, material, gap, turns and wire) from its simulated current and writes the best design into the circuit. A coupled part is checked on its magnetising current. When the first design moves the part's own ripple past 5 percent, the stage designs it once more. A coupled part that cannot be designed is an open item |
| inductorPart | none | Chooses the catalogue inductor for every inductor that `magnetics.design` designed, and writes it into the circuit. It rates the part as the bom stage does: at the ends of the input range too, and with the current the load draws once the loop holds the output at the spec's voltage (the open-loop output can stand below it). The part's own inductance, DCR and saturation current go into the circuit, and the loop's corners use its data sheet's tolerance |
| closeLoop | none | The fixed duty block gives way to a voltage sensor, a reference, an error sum and a PI block that drives the PWM, for a buck, a synchronous buck, a boost, a synchronous boost, an inverting buck-boost, a SEPIC and a flyback. For the inverting buck-boost the sensor is inverted and the reference is the output magnitude. The SEPIC's PI is designed on its fourth-order averaged model, behind a second-order low-pass, with the crossover below a fifth of the right-half-plane zero and a tenth of fsw. It is checked at the lowest, nominal and highest input at full load and at the lightest load wherever that still conducts continuously, where the output resonance rings hardest. A resistor and capacitor across the coupling capacitor damp its resonance. After tuning moves a part, the SEPIC's and the flyback's loops are designed again. The flyback's PI is designed from its small-signal model over the corners of the input and load range, behind a second-order low-pass. With `isolated` the flyback gets no PI: a UC3843-class controller, a TL431 and an optocoupler close its loop in the circuit, and an LLC's controller reads the output through an isolated amplifier (see "An isolated design"). The phase-shifted full bridge's template already holds a PI on the phase shift, which is kept, and so are the multiphase buck's voltage PID and its current-sharing PI per phase. The four-switch buck-boost gets the controller of the closed-loop example: the ratio Vout/Vin fed forward from the measured input, two tables that split it into the buck and boost legs' duties (buck region up to 0.85, boost region from 1/0.85, both legs in between), and a PI behind a second-order low-pass that trims the reference ahead of 1/Vin, so the loop gain is the same at every input. That PI is designed on the two-leg averaged model at the lowest, nominal and highest input at full and light load, with the crossover below a fifth of the lowest right-half-plane zero and a tenth of fsw. Its template draws an input capacitor sized for the input current of its region. The LLC keeps an open loop (its frequency loop is not done yet), and the open items say so. When the call names a topology whose loop stays open and the input is a range, its output follows the input, so this stage's gate fails and the run stops before the verification; `explain.tryInstead` names the best ranked topology design.auto designs end to end |
| robustLoop or voltageLoop | `design.robustLoop` or `design.voltageLoop` | When the spec has a load step, or the converter has a right-half-plane zero, the loop is designed over every corner of the input and load range, including the 1.5 sampling periods of firmware delay and the discontinuous conduction at light load. Otherwise `design.voltageLoop` designs it at the nominal point. For a buck, that design is then read at the highest input and the lightest load, where the output filter is least damped; when it loses its gain or phase margin there, or crosses 0 dB more than once, the loop is designed at that corner instead, so a large output capacitor does not leave it ringing at light load. Neither command models a SEPIC: with a load step, this stage reads the step's dip on the SEPIC's averaged model, closed by its PI, its low-pass and the firmware delay, at the lowest, nominal and highest input, and holds it 20 percent deeper against your limit (the model reads the dip shallower than the switching circuit). The SEPIC's crossover cannot rise past its resonances, so when the dip is too deep the stage raises the output capacitor to the smallest E12 value, up to 10 times what the ripple needs, at which the PI designed again keeps it, and runs again. A larger capacitor lowers the crossover, so the runs after it are longer and may need a larger `limits.maxSimSteps`. The phase margin it aims for is 10 degrees above your `pmMinDeg`, kept between 60 and 85 degrees. When a catalogue inductor is in the circuit and neither a compensator nor a part change keeps every corner, the run picks the catalogue inductor again for a lower inductance, or rewinds the custom design when the catalogue has none, and designs the loop again. A catalogue part is never rewound |
| pcmLoop | `design.voltageLoop {"mode": "peakCurrent"}` | Only with `control.mode` peakCurrent on a non-isolated buck or boost, in place of robustLoop or voltageLoop (and analogControl later). The PWM and the ideal loop blocks give way to a `pcmModulator` `UPCM` driving the gate net the PWM drove, a current meter `Isns` in series with the inductor and the sense source `Esns`, an LM358B error amplifier `UEA` with its TL431 reference `Vea` and 5 V supply `Vaux`, the E96 divider `Rtop`/`Rbot` and a Type II network `Rz`, `Cz`, `Cp` from COMP to FB. The sense gain Ri puts the modulator's clamp `vcMax` (its cycle-by-cycle limit) 1.5 times above the highest control voltage the corners need; the ramp is the recommended one, Qp = 1 at fsw/2 at the corner of highest duty and lowest inductance (Ridley 1991; TI SLUS223H Eq. 39 and 41). With a load step, the output capacitor is raised (E12, at most 10 times) until the dip ΔI/(2π·fc·C) fits at the crossover the current loop reaches. design.voltageLoop then reads the loop back from the circuit, writes the network and checks every corner. Its gate: Qp at most 2 and a positive one at every corner, 45° of phase margin and 6 dB of gain margin at each, one crossing, and the dip. `control` reports the modulator, the slope, the corner check, the capacitor change and the dip |
| remedy | none | When the robust loop names one part change that fixes it (a larger output capacitor, a lower switching frequency, a smaller inductor), the run makes it in this stage and runs the loop design again, at most `limits.maxIterations` times. Candidates are E12 capacitors up to ten times the ripple-sized value and switching frequencies up to 500 kHz |
| verify | `spec.verify` | Runs every corner of your spec and returns one row for each requirement. Each start-up run lasts at least eight closed-loop time constants and goes on while the output is still settling |
| tune | `analysis.tuneToSpec` | Runs only while the verification fails. It changes a part value for the failing rows that a part value can fix: the output ripple (by the output capacitor, up to ten times its value) and, for an open loop, the output voltage (by the duty). Other failing rows are left with the next step that `spec.verify` names. After a tuning round that applied something, the verification runs again |
| parts | `design.parts` | Assigns a library device to every switch and diode: the lowest-loss part that can be bought and that carries both ends of the input range at full load. An illustrative device is used only when no vendor part qualifies. When it changed a device, the verification runs once more |
| deadTime | `design.gateDrive` | A synchronous buck or boost only, after the parts stage. The template's dead time is four solver steps; this stage sets it to what the chosen driver's delay matching and the switches' turn-off edge need, plus 25 percent, in whole nanoseconds, so the body diodes do not carry the load current longer than the board would. With an open loop the duty moves by the change of td·fsw. The verification after it runs on that dead time, and the report's Values table shows it. No simulation |
| efficiency | `design.efficiency` | The efficiency at four loads from 25 to 100 percent, and the loss of each device at full load |
| thermal | `design.thermal` | The junction temperature of each device at full load, at your hottest ambient and with your `tjMax`. Each device's temperature, margin and verdict are read with the cooling the stage picked (a heatsink and pad, or the board copper of an SMD part); the static value through `rthCase` stays as `staticTjC`. A device the cooling catalogue has no data for, or cannot cool, is not rated (no Tj, margin or pass from the assumed heatsink) and is an open item with its loss and the thermal resistance its cooling needs |
| operatingTemperature | none | When a junction ended far from the temperature its device was modelled at, the conduction model is read again at that temperature, and efficiency and thermal run again. It runs no simulation of its own |
| stress | `analysis.stress` | The voltage, current and power of each part over the second half of a new run, against the rating |
| worstCase | `analysis.worstCase` | The output over the tolerance box of the input, the inductor and the capacitor. The mean is read over the second half of each run, the ripple over its last switching periods (the window of the verification's ripple row). A ripple above the spec's becomes an open item |
| safety | `design.safety` | Only with `isolated`. Finds the two sides of the barrier and lists the clearance and creepage each pair of nets across it needs, or the IEC 62368-1 table cells it lacks, which become an open item. For an isolated LLC or phase-shifted full bridge it also lists, as open items, the gate drive and the protection that `design.auto` does not design for them. No gate |
| gateDrive | `design.gateDrive` | Picks a gate driver for every switch the parts stage chose and sizes the gate resistors and the bootstrap, with each Qg scaled to its drive voltage. No simulation. Its gate is the command's checks: the bootstrap recharge, the dead time and the VGS ratings. The driver, resistors and bootstrap parts become lines of the bill of materials. When the gate passes with a half-bridge or a low-side driver, the run puts that gate drive into the circuit just before the bill of materials (`design.gateDrive {apply: true}`) and verifies the circuit with it at the corners again (`gateDrive.appliedVerify`), so the circuit, the bill of materials and the KiCad schematic hold the same parts. Isolated drivers stay on the bill of materials only |
| senseNetwork | `design.senseNetwork` | The divider and anti-alias filter from the output (and a current-sense amplifier) into the STM32G474 ADC, written into the circuit as `R1_vout`, `R2_vout` and `Caa_vout`, so the bill of materials and the KiCad schematic hold them too. No simulation |
| isolatedFeedback | none | For a flyback: the feedback across the isolation barrier, a TL431C and an optocoupler of the TCET1100 family driving the COMP pin of a UC3843-class peak-current-mode controller (TI SLUS223H), with a type II network, checked at the highest CTR, the lowest CTR and the lowest after ageing of the bin. With `isolated` these parts are in the circuit (the closeLoop stage put them there) and the stage reports them; without, the simulated circuit keeps its PI and the parts only go on the bill of materials. For an isolated LLC or phase-shifted full bridge it reports the isolated amplifier the controller reads the output through. See "An isolated design" below |
| protection | `design.protection` | Sizes the current-sense shunt, the peak-current trip, the blanking, the over-voltage and under-voltage thresholds and the soft start from the verified spec and the switch the parts stage chose. It runs no simulation. Its gate: the trip is above the highest normal peak, the blanking is shorter than the shortest on-time, and the soft start is within `startup.maxTime`. An LLC, a phase-shifted full bridge, a SEPIC, a four-switch buck-boost or a PFC is skipped with a note. A buck output below the INA180's 2.7 V supply minimum powers the amplifier from the controller's 3.3 V rail (`senseSupply`), and the stage says so |
| startup | `analysis.stress` | A flyback only: a copy of the circuit is switched on from rest at the highest input and full load. Every capacitor starts empty except the input ones, and the controller starts at its drawn duty, where the generated firmware starts it. When the protection stage sized a soft start, the reference ramps over it. Each switch and diode is rated over the whole run. A part beyond its derated rating is an open item with its peak voltage and current, and the start from zero duty is simulated as well, so the item says whether that start keeps every part within. No gate |
| analogControl | none | Only with `control.implementation` analogOpAmp or controllerIc, in place of senseNetwork, digitalize and codegen. An isolated flyback is skipped with a note: its loop is the UC3843, TL431 and optocoupler of closeLoop, and `control` names them without an amplifier. For the others, the loop's compensator (its PI, Type II or III network, and a flyback's low-pass) becomes the error amplifier's network: the output divider, the reference, the Type II or III network (a PI gets a pole a decade above the crossover, a flyback's low-pass a pole and an RC on the amplifier's output) and the PWM comparator, grouped as the subsystem `XCOMP` in place of the ideal blocks. Its gate: the network changes the compensator by at most 2 dB and 10° at the crossover, the amplifier keeps 20 dB of gain over the noise gain there, slews half the ramp at the crossover, and its output swing covers the largest duty. With controllerIc on a boost or a non-isolated flyback the loop is the UCx843 in peak-current mode instead (TI SLUS223H): the ideal loop blocks and the PWM block give way to the IC `U1` (timing RT = 1.72/(fsw·1 nF), a 12 V bias `Vcc`, OUT driving the switch through `GateCmp`), the sense resistor `Rcs` in the switch's source, sized so the 0.9 V lowest threshold carries 1.2 times the highest full-load peak, and its filter `Rcsf`/`Ccsf` (100 pF, less when that is slower than a tenth of the shortest on-time; the UCx84x has no leading-edge blanking of its own). Above a duty of about 0.18 the slope compensation `Cramp` (10 nF) and `Rramp` (the data sheet example's ratio to RT) adds a share of the 1.7 V RT/CT ramp to CS, sized for QP = 1 at the highest duty (Eq. 39 to 44, with the sensed current divided by the same resistors); the model has no RT/CT pin, so the ramp is the source `Vosc` driven by a sawtooth `Osc` in step with the clock. The IC's own error amplifier carries a Type II network (`Rtop`, `Rbot`, `Rz`, `Cz`, `Cp`) designed on the current-mode plant (the data sheet's Eq. 25 to 37 for the flyback, the same power-balance model for the boost) at every corner, crossing at a tenth of fsw or a fifth of the lowest right-half-plane zero. Its gate: the phase and gain margins at every corner, 1/QP = π·(Mc·(1 − D) − 0.5) above zero at every continuous-conduction corner (no subharmonic oscillation), 20 dB of amplifier gain over the noise gain, COMP within 5 V, the 0.9 V limit above the highest peak and the filter's time constant. `control.mode` is `peakCurrent`; `control.sense`, `control.currentLimitA` (the limit at the 1 V threshold) and `control.corners` report it, and gateDrive is skipped because the IC drives the switch. The circuit is then verified again, on the switching circuit whatever `auto.model` says (the averaged view's step of a fifth of a period cannot resolve the error amplifier), so the verification's gate is judged on the analog loop. The report's Control section and `control` list the amplifier, the parts and the checks |
| digitalize | `design.digitalize` | Turns the loop design into firmware in the number format of `digital.format` |
| codegen | `codegen.verify` | Compiles the generated C of the control blocks and compares it with the model |
| emi | `emi.conducted` | Estimates the conducted emission against your class and margin. When the circuit misses the margin without a filter (or with `emi.apply`), it puts the sized input filter in the circuit, so the bill of materials, the KiCad project and the layout include it, and verifies the filtered circuit at low line and full load (`emi.filteredVerify`). The gate also holds the filter to Middlebrook's condition at `Vin_min^2 / P` (low line, full load). When the margin needs the filter but it could not go in (the converter has no input capacitor), the gate fails: it never passes on a filter that is not in the circuit. This failure does not stop the run (the LLC and the phase-shifted full bridge draw no input capacitor): the later stages still design the rest, and the verdict names emi as failed |
| debugAids | `design.debugAids` | Only with `auto.debugAids`. Adds the debug aids to the circuit in one history step; DNP parts stay out of the simulation. The report's Bring-up section gives the order: the stages one at a time through the 0 Ω links, the gate waveforms at the test points, then the loop gain at the injection resistor |
| controlModules | none | Only for an isolated LLC or phase-shifted full bridge. Wraps the control blocks of each side of the barrier into a module, `Ctrl` on the primary and `SrCtrl` (a synchronous rectifier's gate logic) on the secondary, so only named pins show at the top level. The netlist stays the same |
| auxRails | none | Only with `spec.auxRails`. Picks an LDO for each rail from the cited catalogue, checks it on paper and draws the rails into the circuit as one subsystem; its parts go on the bill of materials. See "Auxiliary rails" below |
| layout | `layout.hints` | The hot loops, their inductance budgets and a checklist |
| bom | `bom.export` | The bill of materials at offline prices. A magnetic part that the run designed is a custom wound line. The catalogue inductor in the circuit is kept (`keep`) whenever it carries the stress; its gate fails when the bill of materials still buys another inductor than the one simulated. A designed capacitor bought at another value, or a capacitor the capacitorPart stage named and the bill of materials replaced, is said in the stage's note |
| protectionCases | `testbench.list`, `testbench.run` | The Test Bench's protection cases on the circuit as the run leaves it, input filter and gate drive in: the current trip (the peak inductor current at full load), the over-voltage trip (the start-up peak at the highest input and lightest load), the under-voltage start (the input the converter sees at the lowest input and full load) and the inrush at switch-on, each with the limits `design.testPlan` gives. Its gate fails when a case fails or cannot be measured; the failing cases are its requirements, each with its fix (the soft start against the over-voltage trip, the under-voltage start against the input after the source's and the filter's drop). The runs stay in the circuit's Test Bench, so `testbench.results` shows them and `testbench.run` reads the same numbers. A design whose test plan has none of these limits skips the stage with a note |
| kicad | `file.exportKicad` | Writes the KiCad project into `auto.outputDir` |
| blocks | `circuit.groupBlocks` | Only with `auto.blocks`. Groups the circuit into one subsystem per design step in one history step; one undo gives the flat circuit back. No gate |

Verify and tune repeat for at most `limits.maxIterations` rounds. The loop ends when the verification passes, when a tuning round changes nothing, or when the rounds are used.

Most stages have a gate: a pass or fail with the reason and the next fix. A failing gate stops the run, unless `auto.bestEffort` lists it. Then the run goes on and the failure stays in the report.

### The caps

The `limits` object holds the caps. Every cap has a default and a largest value.

| Cap | Default | Largest | What it limits |
|---|---|---|---|
| `maxIterations` | 2 | 5 | The verify and tune rounds after the first verification. 0 means verify once |
| `maxSims` | 300 | 2000 | The simulations of the whole run. No stage starts once they are spent |
| `maxSimSteps` | 30,000,000 | 500,000,000 | The solver steps of the whole run. Every simulation is held to what is left |
| `tuneSims` | 40 | 200 | The simulations of one tuning round |

When a cap stops the run, `stoppedBy` says which one (`maxSims` or `maxSimSteps`), the verdict starts with NOT DONE, and the stage that could not start is marked capped. A run that you cancel reports `cancelled`. A failure of the suggest or the template stage stops the run, and `stoppedBy` is `failed`.

## Read the report

The reply of `design.auto` is the report. With `reportPath` the same content is written as files. The fields you read first:

| Field | What it tells you |
|---|---|
| `pass` | `true` only when the last verification passed and the run did not stop early |
| `verdict` | One line in English and Traditional Chinese, such as `PASS: all 12 checked rows pass; 5 items unchecked.` A pass counts the items it did not check, and names the design stages (gateDrive, senseNetwork, protection) that were skipped for the topology, which it does not cover |
| `failingGate` | `null` on a pass. Otherwise the stage that stopped the run or the verification, with the failing requirements and the reason |
| `explain` | `null` on a pass. Otherwise `why`, one or two plain sentences with the run's numbers, and `tryInstead`: the changes to try, each with its `change` (a JSON merge patch on the call), `label`, expected `effect` and `params` (the whole call with the change made, ready to run again). The assistant's design card shows them with a Try button each |
| `stoppedBy` | `null`, or the cap or the failure that ended the run early |
| `verify.rows` | The verification table. See below |
| `openItems` | What is left to do: a failing row with its next step, an under-rated part, a thermal check that fails, a loop that was left open, and a verification of an older circuit |
| `notChecked` | What nobody checked. See below |
| `stages` | One entry per stage, with `status`, `round`, a note, the `checkpoint` and the `circuitHash` after it |
| `values` and `finalValues` | The sized values with the formula for each, and every part value of the circuit as it ends |
| `loop` | The compensator and the Bode data of the loop design, and the loop gain measured by `spec.verify` |
| `efficiency`, `losses`, `thermal`, `stress`, `worstCase` | The results of those stages |
| `protection` | The protection `design.protection` sized: its headline numbers, values, formulas, notes and checks, or `skipped` with a note |
| `used` | The rounds, the simulations and the solver steps the run spent |
| `historySteps` | How many undo steps the run made on the circuit |
| `markdown`, `html`, `files` | The report as text, and the files written |

A stage has one of these statuses: `done`, `failed`, `skipped` (it did not apply, with the reason in its note), or `capped` (a cap stopped it).

Each row of `verify.rows` has a `requirement`, a `label`, the `measured` value at the worst corner, the `limit`, the `unit`, the `margin`, and a `status` of `pass`, `fail`, `skipped` or `info`. A failing row has a `nextFix` in plain words. `corner` says which operating point was the worst. `solversAgree` is `false` when the reference solver gave a different result for that row. The requirement names are `regulation`, `ripple`, `startupTime`, `startupOvershoot`, `droop`, `loadSettle`, `lineDeviation`, `lineSettle`, `efficiency`, `tj`, `stress`, `phaseMargin`, `gainMargin` and `yield`. A row exists only when your spec asks for it. A verification passes when no row fails and at least one row passes.

### The not-checked list

A pass is only as wide as what was checked. The `notChecked` list is the honest part of the report. It holds what `spec.verify` left out and what `design.auto` itself does not do:

- `emi`: conducted and radiated emissions are not simulated by the verification. Use `emi.conducted` for an estimate.
- `protection`: over-current, short-circuit and over-voltage protection are not exercised.
- `magnetics`: core saturation and core loss are not checked. Use `magnetics.design`.
- `ambient`: your spec gave no ambient range, so there are no temperature corners.
- `stress`: no part has a library device assigned, so there is no rating to compare with.
- `referenceCheck`: you turned the reference solver off.
- A requirement your spec leaves out, with the reason `The spec does not ask for it.`
- A requirement that could not be measured at some corner, with the reason.
- `magneticsDesign`, `robustLoop` and `bom`: the stage did not finish, or the robust loop did not apply (the spec has no load step), with the reason.
- `radiatedEmi`: radiated emission is not estimated by the run. `emi.conducted` covers the conducted band only. Run `emi.radiated` yourself for a pre-compliance estimate.
- `firmwareInLoop` and `firmwareSil`: the fixed-point compensator is checked on the loop model only, and the generated C is checked only when the codegen stage ran.
- `layout`: layout parasitics and the gate drive are not simulated. `layout.hints` gives budgets and a checklist.
- `partTolerances`: the worst case uses 20 percent on the inductor and the capacitor. That is an assumption, not a data sheet value.

`emi` and `magnetics` leave this list when the run's own stage for them finished.

### Hand the report over in one step

The design report needs sign-in to Voltecx Cloud, like the Auto Design run it reports on.

`report.designSummary {dir, lang}` (Export Design Summary Folder in Quick Open) writes the report of the latest `design.auto` run on the active circuit as a folder to hand over, and makes the folder when it is not there. `index.html` is one self-contained page. `report.md` shows `schematic.png` and each plot as `plot-<n>.svg` beside it: the schematic as built (`schematic.svg` has the designators and values), the Bode plot and the key waveforms of the latest simulation. `lang` is `en` or `zh-Hant`. Without an Auto Design run you get the schematic and the waveforms alone. The folder also has `loss-chart.svg`, the loss chart of chapter 6, in a "Where the losses go" section; `"lossChart": false` leaves it out, and `lossChartSkipped` in the reply says why it is missing when `design.efficiency` cannot budget the circuit. The reply lists the files written.

### Go back

In a direct call, such as `powercraft-cli run`, every stage leaves a checkpoint and every edit is one undo step. Press Cmd+Z `historySteps` times, or call `checkpoint.list` and `checkpoint.restore` with the checkpoint id of the stage you want. In a background run, see the note in the desktop app section.

## What is an estimate

Voltecx simulates. A simulation is as good as its models and its data. These are the places where the numbers are estimates, and where the data comes from.

- The sizing equations are textbook equations for an ideal converter in continuous conduction (R. W. Erickson and D. Maksimovic, Fundamentals of Power Electronics, 3rd ed.). The printed formulas show what was used. The loop design follows the same book.
- Device data. The built-in vendor library has 22 parts, digitised from the manufacturers' data sheets. Ten are Wolfspeed, Infineon and ROHM IGBTs, SiC MOSFETs and diodes rated from 600 V to 1200 V. Twelve are low- and mid-voltage parts: silicon MOSFETs from Texas Instruments, Infineon and Nexperia rated from 30 V to 150 V, three Infineon silicon MOSFETs rated 250 V and 300 V for flyback switches, and Nexperia Schottky and ultrafast diodes rated from 45 V to 200 V. Each part carries its data sheet, revision and the figures it was read from in its `source` field. The data sheets of the low-voltage MOSFETs give gate charge and switching times but no switching energy, so these parts add no switching loss; their notes list the charges and times for a hand estimate. The data sheets of the three small diodes give no junction-to-case transient curve, so they have no thermal chain, and the thermal check uses its default resistance for them. The generic devices in the library are illustrative: they are not parts that anyone sells, and `bom.export` marks a line that uses one as `illustrative`. For a low-voltage design, look at which device each switch received before you read the efficiency and the temperature.
- Passive parts. The catalogue behind `bom.export` has capacitors (Murata, KEMET, WIMA and Panasonic, with 500 V and 630 V parts for snubbers), chip resistors and wirewound power resistors (Vishay Dale) and inductors (Coilcraft XAL, and the 220, 330 and 470 uH Coilcraft AGP4233 through-hole parts for large input inductors), all read from the manufacturers' data sheets. A transformer or inductor that `magnetics.design` designed is listed as a custom wound part with its core, turns, wire, gap and losses. A value that a data sheet does not give is left out. The DC bias curves of ceramic capacitors were read from figures and are coarse.
- Magnetics. `magnetics.design` searches the OpenMagnetics MAS starter set (Apache License 2.0; the files and their licence are in `crates/magnetics/data`) and ferrite sets of the ETD, PQ, RM, EFD, planar E and planar ER families read from the Ferroxcube and TDK data sheets (21 shapes in 3C95, N87 and N97; each record names its sheet, revision and table, and the shapes use the sheet's Ae, le, Ve and Amin). It is a subset of the cores, materials and wires. The windings of the round-post and planar sets are fitted into a straight-sided window, an approximation. A set with a coil former in the Ferroxcube data handbook is wound on it (the former's winding width, area and average turn; `best.bobbin`); `bobbin: false` uses the bare core window. `magnetics.femmExport` draws only E pairs, planar E sets, ETD sets and ring cores, and none of the core shapes has a KiCad library footprint: the bill of materials names the shape, and the board needs the bobbin maker's footprint. The temperature rise is an estimate for natural convection, and the simulator models saturation as two straight slopes. Confirm a chosen core, gap and wire against the manufacturer's data sheet.
- Prices. The offline price list is empty on purpose, because data sheets have no prices. A price comes from the `prices` parameter, or from Nexar when the `NEXAR_TOKEN` environment variable is set. That lookup is the only part of this chapter that uses the network. A part without a price is left unpriced, and the total covers the priced lines only.
- EMI. `emi.conducted` is a pre-compliance estimate. A model of a LISN goes on a copy of your circuit, the spectrum comes from the simulated input current, and it is held to a CISPR 32 class limit band by band. It is not a compliance measurement. The result depends on the parasitics your circuit has, and a schematic has few.
- Layout. `layout.hints` finds the hot loops of the circuit and gives each an inductance budget. It is guidance from the circuit, not a board design. `file.exportKicad` writes a schematic, a project file and design rules. It does not write a board.
- Optimisation. `analysis.pareto` searches an analytic model and re-simulates a few points. The report says how far the two differ.
- Part tolerances in the worst case are an assumption of 20 percent.

## The tools, one by one

You can run every tool on its own, on any circuit. In the console, a line is `command {JSON}`. On the command line, use `powercraft-cli run --in FILE --cmd ID --params 'JSON'`. A tool that says it changes nothing never edits your circuit.

### spec.verify

It checks the circuit in memory against a spec and returns the table of rows and the not-checked list. It runs every corner on copies of the circuit, so it never edits it. It recognises a buck, a boost, a buck-boost, a SEPIC, a flyback and a forward by their structure, and finds the source, output and load of a dual active bridge (DAB), a phase-shifted full bridge and an LLC. A DAB whose output is a DC source (a battery or a bus, as the `dab` example draws it) is checked with that source replaced by a resistor drawing each corner's current, on the copy only. For a different circuit, name the parts in `bind`; the error lists the circuit's DC sources and resistors to ground to pick from.

```sh
powercraft-cli run --in work/pol.voltecx --cmd spec.verify --params '{"spec": {
  "vin": {"min": 10.8, "nom": 12, "max": 13.2}, "vout": {"nom": 3.3, "tolPct": 3},
  "iout": {"min": 1, "max": 5}, "ripple": {"maxPp": 0.05}}}'
```

It is the stop condition of every automatic loop.

### topology.suggest

It ranks topologies for a spec from a fixed rule table. Hard limits remove what cannot work, such as a step ratio outside the duty range, then a first-order loss estimate with the device library ranks the rest. It never names a topology outside its table. It changes nothing and needs no circuit.

```json
{ "vin": 12, "vinMin": 10.8, "vinMax": 13.2, "vout": 3.3, "iout": 5, "priority": "efficiency" }
```

Give `pout` or `iout`. Other parameters are `isolated`, `bidirectional`, `input` (`dc` or `ac`), `output` (`dc`, `ac` or `ac3`) and `fsw`. The reply has `best`, a `candidates` list with the rank, the score, the expected efficiency (semiconductor losses only), the template and whether it is ready, and a `dropped` list that gives the reason for each topology that was removed. The score weights are Voltecx's own choices. The reasons name the textbook behind each rule.

### design.exploreTopologies

Where `topology.suggest` ranks a fixed table, this one searches. It builds candidate power stages from building blocks: every wiring of one switching cell (a complementary switch pair) with one or two inductors and an inner capacitor between the input, the output and ground; three-level flying-capacitor cells in place of a two-level cell; two interleaved phases; tapped inductors at a few turns ratios; two inductors on one core; 2:1 and 1:2 resonant switched-capacitor cells; two converters with their inputs in parallel and outputs in series; and two in cascade. Of the hundred thousand or so it looks at, it keeps only the circuits that obey the rules of a working converter, in every switching state: no loop of the input, capacitors and closed switches (a short or a hard-charged capacitor), a path for every inductor's current when a switch opens, volt-second and charge balance with a unique solution, every switch both carrying current and blocking voltage, and every inductor and capacitor taking part. `explored.rejectedByRule` counts what each rule threw away.

The survivors are fitted to your spec: the duty at the nominal and extreme inputs, each switch's blocking voltage and currents (and whether a diode could replace it, whether it must block both ways, whether its gate driver floats), a device from the library for each switch, and a rough sizing. The best ones are simulated to their steady state, first with ideal parts (they must deliver your output) and then with the library's MOSFETs and ceramic capacitors (which gives the efficiency). Each candidate comes back with its gain formula and curve, its stresses, the runs, a score, its trade-offs, and an `open` call.

It never says a candidate is new. A candidate is either "known topology" with the book or paper that describes it, or "not in our catalogue — may be novel; check the literature". The catalogue is small, so the second label often means a circuit that is in the literature but not in Voltecx.

```json
{ "spec": { "vin": 400, "vout": 100, "iout": 2 }, "n": 5, "constraints": { "maxSwitchVoltage": 250 } }
```

With the switches limited to 250 V, the two-level buck is out and the three-level flying-capacitor buck ranks first. `constraints` also takes `families`, `maxSwitches`, `maxMagnetics`, `minDuty`, `maxDuty` and `commonGround`. To put a candidate on the canvas, run its `open` call, `design.topologyCandidate`: it opens in a new tab, laid out, with the library's devices and open loop at the ideal duty. In the agent panel, ask "invent a topology for …" or "what else could do this?": the assistant runs the search, explains the trade-offs and shows the one you pick as a card to accept.

### spec.feasibility

It says whether a DC-output spec can be met at all, before anything is sized. Each bound errs on the side of the spec, so an item it calls infeasible is out of reach of any design, and one it calls feasible may still fail later. It changes nothing and needs no circuit.

```json
{ "spec": { "vin": 48, "vout": 12, "iout": 10, "efficiency": 99, "ripple": 0.01 }, "targets": { "costUsd": 5 } }
```

Other parameters are `isolated`, `topology`, `fsw`, `prices` (as `bom.export` takes them) and `airflow`. The reply has `feasible`, a `verdict`, and one item per check: `efficiency` (the topology's semiconductor loss estimate at each efficiency point), `ripple` (at most 32 catalogue capacitors in parallel at the template's 20 % inductor ripple), `thermal` (the hottest device on the best catalogue heatsink and pad at the hottest ambient), `size` (the smallest catalogue inductor, judged against `targets.magneticsAreaMm2`) and `cost` (the cheapest priced parts, judged against `targets.costUsd`). An infeasible item lists `relaxations`: the smallest change of each kind, as a JSON merge patch on the call, such as a lower efficiency or a lower `fsw`. Without a target or prices, size and cost report their floor and stay unchecked; the shipped catalogue has no prices.

### design.compare

It answers "why this topology, and which control method?" with numbers. It runs `topology.suggest` with the same spec parameters, then fills a table for the first `top` candidates (5 by default):

| Column | Where it comes from |
|---|---|
| Efficiency | The ranking's semiconductor losses plus each inductor's core and copper loss from `magnetics.design` (smallest catalogue core first) |
| Device stress | Highest blocking voltage and switched current from the ranking, and the inductor peak |
| Part count | Semiconductors (with parallel devices) and magnetic parts |
| Magnetics volume | The wound volume of each designed inductor |
| Cost | Each device by its part number, from the price list you imported (Add prices under the Compare Topologies table, or `parts.importPriceList`), then the catalogue price list; devices without a price are listed as unpriced. The result window leaves out a column no row has a value for (often Cost, since the offline price list is empty) and names it under the table |
| Control difficulty | Level 1 to 3 with the reason and its source (right-half-plane zero, plant order, isolated feedback, frequency or phase-shift control), and the highest usable crossover |

Each row gets pros and cons from where it is best or worst in a column, and the chosen topology (the one `design.auto` would draw, or the one you name with `topology`) gets a sentence on why it won and what it gives up.

On the chosen buck, boost or inverting buck-boost it then designs four control methods for the same phase margin (`pm`, 60° by default): voltage mode with a Type III network, peak current mode with a Type II network (Ridley's model, ramp for Qp = 1), average current mode with two PIs, and a digital PI with 1.5 periods of delay. For each it reports the crossover, the phase and gain margin, a load step from half to full load simulated on the averaged model (dip, overshoot, settling time) and the effort (loops, sensors, compensator parts, firmware). A PI crosses below the output filter's resonance with its zero above it, and its crossover is the highest that keeps the resonance peak at least 6 dB under 0 dB (the default `gmMinDb` of `design.robustLoop`), so on an undamped high-Q filter it is slow rather than refused.

```json
{ "vin": 12, "vout": 3.3, "iout": 3, "top": 4 }
```

Other parameters: `rippleRatio` (inductor ripple, 0.3), `vripplePct` (output ripple for the capacitor, 1 %), `ambient` (40 °C) and `control` (false leaves the control comparison out). Isolated, resonant, PFC and inverter topologies have no magnetics sizing or control comparison here yet; the reply says so instead of guessing. In the app it is **Design › Automate › Compare Topologies and Control**, a task of the Design page: its spec is the input, output voltage and load current, read from the circuit, and the result shows beside it, the topologies first, then the control methods of the chosen one. The assistant uses it to answer "why this one?".

![Compare Topologies on the Design page for 12 V to 3.3 V at 3 A, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/automatic-design/03-compare.png)

1. **Why the synchronous buck converter**: why the chosen topology won.
2. **Side by side**: the topology table, the chosen one first.
3. The chosen topology. **Control, for the synchronous buck converter** follows further down with the control methods.

### magnetics.design

It designs an inductor or a two-winding transformer from the magnetics catalogue. It tries every E shape and every ETD, PQ, RM, EFD and planar set in every ferrite with the gap ground to the inductance, and every ring core, with each number of turns and each wire. A candidate fails when its peak flux is above the share of saturation you allow (`bsatMargin`, 0.8), when it runs hotter than `tMax` (100 degrees Celsius), when its copper does not fit the window (`fillMax`, 0.4), or, for a transformer or coupled inductor, when whole turns miss the turns ratio by more than 2 percent. The others are ranked by the size of the core, the smallest first, then by total loss: the smallest core that does the job, wound for the least loss. `rank: loss` ranks by total loss first instead; `design.auto` uses it, because the spec's efficiency is a budget the search cannot see.

The currents come from the circuit, or from the call. For the circuit, name the part and run a simulation first:

```sh
powercraft-cli run --in work/pol.voltecx --cmd simulation.run \
  --cmd magnetics.design --params '{"component": "L1", "top": 3}'
```

For the call, give the inductance, the frequency and two of `idc`, `ripple`, `ipk` and `irms`. This needs no circuit:

```json
{ "l": 2.2e-6, "fsw": 100000, "idc": 5, "ripple": 1.5 }
```

With `apply: true` and a part in the circuit, the best design is written into the part (`l`, `dcr`, `isat`, `lsat` and `rcore`) in one undo step, and `verify` simulates the circuit with it and compares the ripple and the peak current. The reply lists the formulas it used, the winning designs with the loss of the core and the copper, and why the others were rejected.

#### Winding layers, interleaving and leakage

The best design also carries its winding arrangement (`best.winding`): every layer from the core outward with its turns, its position, the magnetomotive force (MMF) on its two faces, Dowell's AC resistance factor at the switching frequency and its loss. Each layer's factor comes from the MMF on its faces (P. L. Dowell, Proc. IEE 1966, in the per-layer form of Erickson and Maksimović, chapter 13): the outer layers of a winding, which sit in a stronger field, lose more. Foil uses its thickness; litz is treated as layers of strands (Bartoli, Noferi, Reatti and Kazimierczuk, IEEE PESC 1996). The leakage inductance comes from the energy of the field in the window, layer by layer; for one primary block and one secondary block it is McLyman's formula (chapter 17).

For a transformer, `arrangement` sets the order of the winding sections from the core outward: `"P/S"` (the default), `"P/S/P"`, `"S/P/S"` and so on, up to eight. Splitting the primary around the secondary halves the layers from zero MMF to the peak, so the AC loss falls and the leakage drops to about a quarter; it also adds capacitance between the windings and a second set of insulation. `layerInsulation` is the tape between two layers of one section, in metres. The reply puts the other usual arrangement (`alternative`, P/S/P beside P/S) next to the chosen one with its loss and leakage, and `design.auto` notes when it would cut the winding loss by a tenth or more.

The result window draws the arrangement as a cross-section: the core side on the left, each layer coloured by its winding, the insulation as gaps and the MMF across the window as a line over them. Hover a layer to see its turns, factor and loss.

Where the core's data sheet gives core loss, `best.dataSheetLoss` lists those points (frequency, flux, temperature, the maker's maximum and the document) beside the model's value at the same point. Cores whose sheets give no loss get no such list: no loss value is made up.

### magnetics.buildSheet

It turns a design from `magnetics.design` into the build sheet a winding vendor needs. Pass the reply as `design`:

```json
{ "design": { "best": { "core": "...", "turns": 24 }, "inputs": [] }, "markdownPath": "T1.md", "csvPath": "T1.csv" }
```

The sheet lists the core and bobbin part numbers, the gap and the AL value, the turns, wire or litz, conductors in hand, layers and resistance at 20 degrees Celsius of each winding, the layer order and interleaving, the insulation and tape, the pin-out and the test limits: the inductance at the switching frequency, the leakage with the secondary shorted, the resistance of each winding, the turns ratio and the hipot voltage. The L, leakage and resistance limits are the design value plus or minus `tolerance` (0.1). Every field is filled or marked unknown or not applicable, with the reason. The bobbin part number is the coil former `magnetics.design` wound on (`best.bobbin`, from the Ferroxcube data handbook, with its winding width, area and average turn), or the one you give as `bobbin`; ring cores, planar sets and the shapes the handbook has no former for leave it unknown. The pin numbers stay unknown until you agree them with the vendor. The margin tape, the creepage, the clearance and the hipot voltage are meant to come from `design.safety`, but the build sheet does not read it yet and that command's distance tables are empty (#374); until then pass them in `insulation` (`betweenMm`, `marginMm`, `tapeLayers`, `creepageMm`, `clearanceMm`, `hipotV`). The reply has the sheet as JSON, `markdown` and `csv`; `lang: "zh-Hant"` writes them in Traditional Chinese. It changes nothing.

### magnetics.femmExport and magnetics.femmImport

Voltecx has no field solver of its own. These two commands link a `magnetics.design` result to FEMM 4.2, a free 2D finite-element program, and read its answer back.

`magnetics.femmExport` takes the design (the reply or its `best`) and writes a FEMM model: the planar cross-section of an E pair, a planar E set or an ETD set (its round post and outer legs drawn at their true sections over the depth) with the gap ground into the centre leg, or the top view of a ring core, with each winding (round wire, litz or foil, conductors in hand, layers) in the window. The core is a relative permeability (`muR`, by default the catalogue's initial permeability at the design temperature) or a B-H table (`bh`, pairs of A/m and T, up to 200 points), and the copper is at 20 degrees Celsius. `frequency` defaults to the design's switching frequency; 0 solves magnetostatics. `clearanceMm` (0.1) is the space between drawn regions. It returns the `.fem` text and a Lua script; with `femPath`, `luaPath` and `resultsPath` it writes them through the host's file service.

```sh
powercraft-cli run --in work/pol.voltecx --root work --cmd simulation.run \
  --cmd magnetics.design --params '{"component": "L1"}'
# pass the reply of magnetics.design as "design":
powercraft-cli run --root work --cmd magnetics.femmExport \
  --params '{"design": {...}, "femPath": "L1.fem", "luaPath": "L1.lua"}'
```

Run the script in FEMM (File › Open Lua Script). It drives 1 A in each winding in turn and writes the self and mutual inductances and the winding resistance at the frequency. `magnetics.femmImport` reads that file (`path`, or its text as `results`), or values from another field solver such as Ansys Maxwell or COMSOL (`values`: `source`, `frequency`, `l1`, and optionally `l2`, `m`, `r1`, `r2`, `turns1`, `turns2`, `gapMm`); give exactly one of the three. It reports L, M, the coupling k, the magnetising inductance and the leakages. With `component` and `apply: true` it writes them into the part in one undo step named after the source: `l` of an inductor, `l1`, `l2` and `k` of a coupled inductor, or `lm`, `llk1` and `llk2` of a transformer (`ratio` sets the split; by default the turns).

Limits: the model is a planar slice, so the end turns outside the core are left out. Rectangular wire is refused, because FEMM has no type for it. Voltecx does not run FEMM; you do, on Windows or under Wine.

#### In the app

Run **Design › Automate › Design Magnetics**. In its result window each design row (the best one first, then the other candidates) has icon buttons; hover one for its name:

- **Export FEMM Model** asks where to save the `.fem` file and writes the Lua script beside it, with the same name.
- **Import FEMM Results** asks for the results file the script wrote and writes the values into the selected inductor, coupled inductor or transformer (or, with none selected, the part the design was for) in one undo step. The result window shows L, M, k and the changes.
- **Field Solve** runs `magnetics.fieldSolve`, Voltecx's own 2D solver (Preview, magnetostatic, linear core), on that design as a job with progress, and opens the field window: L, M and k above a map of |B| or |H| with its flux lines. L is extracted with each winding alone at 1 A, but the window draws the map at the **Operating point**: the peak current Design Magnetics sized the part for (or a current you type). That row shows the peak |B| in the core at that current (the value below which 99 % of the core's area lies, so a corner singularity does not stand for the core), its share of the material's hot Bsat, and the design's core and winding loss at its peak current. **Design current** goes back to the design's current; turn **At the operating point** off to see each winding at 1 A. It is greyed out while **Edit › Preferences › Simulation › Preview features (field solver)** is off; hover it to see where to turn it on.

  A 3D solve (`magnetics.fieldSolve` with `dimension: 3` and `field: true`) opens the 3D field window instead: the same values above a view of |B| in each element that you turn by dragging, pan with a right-drag and zoom with the wheel. **Section plane** (None, x, y or z, and a slider for where it cuts) shows the field inside the core, the gap and the air. **Smooth shading** blends the element values at the nodes for display; the probe and the legend still read element values. **Flux tubes** draws 24 flux lines that each carry the same share of the flux through the section (or, with no section, through the middle plane the most flux crosses), so where they crowd the flux density is high; where a tube runs behind an opaque surface it is drawn faint, so it does not cover the colours. A section that next to no flux crosses (under a tenth of the flux through that middle plane, such as the mid-plane across an extruded core's depth) seeds no tubes, and the window says so. **Bodies** sets each region's opacity: the window opens with the magnetic parts shown and the air and windings hidden (a section still shows them), so the air can be shown again or the core made see-through. As in the 2D view, the colour scale spans the magnetic parts up to their 99th percentile by volume, so a few singular corner elements do not turn the core dark; the legend then reads ≥ at its top, and the report's 3D |B| pictures use the same scale and say so in their captions. **Colour range** scales the colours over one body instead: in a thermal map, pick the core to see its own few kelvin of gradient beside a much hotter winding; the other bodies take the end colours, and the legend reads ≤ and ≥.

**Design › Field Solver** holds the same work in one submenu:

- **Field Solve**: as above.
- **Core Loss from Last Run**: runs `magnetics.fieldCoreLoss` with the part's current over one switching period of the last run (a new run when there is none, or when the circuit changed since). The field window shows the total core loss, the peak |B| and where it is, the core's mean B(t) over the period, and the core-loss density map under the flux lines of the instant of the peak. On the |B| and |H| tabs, **At the peak \|B\|** draws every winding at its current at the instant of the peak, and **At an instant of the period** draws the field at the winding currents of one instant: drag the time, or press **Peak \|B\|** for the instant of the peak; the time is marked on the B(t) plot. While the scope's cursors are on and cursor 1 stands in the period, the time follows cursor 1, and moving the time moves cursor 1. A transformer is driven by its magnetising current.
  Under DC bias (a buck or boost inductor) the core loss of N87 and 3C90 is corrected with a Steinmetz Premagnetization Graph fitted from the Princeton MagNet measurements, and the reply gives the plain iGSE total beside it (`totalLossIgseW`); **Design Magnetics** applies the same correction. A *DC bias not covered* warning means the material has no DC-bias data, or the part runs outside the measured range (bias field, 50 to about 500 kHz, flux amplitude, 25 to 90 °C): the loss may read low there.
- **FEMM Export** and **FEMM Import**: as the row buttons above.
- **New Field Drawing** (Preview): asks whether the section is planar (with its depth in metres) or axisymmetric, runs `geometry.new` and opens the Field Drawing window, where you draw the outlines, label each region air, magnetic or coil, and set dimensions. It needs no part. Undo and Redo follow the drawing while its window has focus.

The items act on the selected inductor, coupled inductor or transformer, else on the part of the last Design Magnetics run, else on the circuit's only magnetic part. A part with no design yet is designed first (Design Magnetics, with its defaults), and the item runs on the best design when it arrives. Field Solve and Core Loss from Last Run are Preview features: while Preview is off they stay in the menu, greyed out, and say where to turn it on.

### design.robustLoop

It designs a voltage loop that keeps its margins at every tolerance corner. It reads the same spec, takes the lowest crossover that your load step allows, and reads the loop gain at every corner of the input, the load, the inductor, the capacitor, the ESR and the modulator delay. While a corner fails, it raises the phase margin it aims for, or lowers the crossover, and tries again. It stops when every corner passes, and it says why when none can.

```json
{ "spec": { "vin": {"min": 10.8, "nom": 12, "max": 13.2}, "vout": {"nom": 3.3},
            "iout": {"min": 1, "max": 5},
            "loadStep": {"from": 1, "to": 5, "maxDroopPct": 5},
            "pmMinDeg": 45, "gmMinDb": 6 },
  "tolerances": { "l": 0.2, "c": 0.2, "esr": 0.5, "delay": 0.5 },
  "simulate": "worst" }
```

The tolerances are fractions from 0 to 0.9, and the values above are the defaults. `simulate` is `none`, `worst` or `all`: it measures the loop gain on a copy of the circuit with the design in place, at the corner with the least margin or at every corner. `apply: true` writes the design in one undo step, and only when every corner passes.

### analysis.pareto

Needs sign-in to Voltecx Cloud: the search runs there, and only its params are sent.

It finds the trade-off between objectives for a DC-DC converter. A seeded search (NSGA-II, Deb and others, 2002) varies the switching frequency, the ripple ratio, the switch, the diode, the core and the heatsink, with an analytic model. The reply has the front, its knee, the hypervolume, and a few points that were simulated again with the difference to the estimate. The same call and seed give the same front. It changes nothing.

```json
{ "spec": { "vin": {"min": 10.8, "nom": 12, "max": 13.2}, "vout": {"nom": 3.3},
            "iout": {"min": 1, "max": 5}, "tjMax": 125, "ambient": {"min": 0, "max": 50} },
  "objectives": ["loss", "volume"],
  "fsw": { "min": 100000, "max": 1000000, "steps": 12 },
  "seed": 1 }
```

The objectives are `loss`, `efficiency`, `volume`, `cost` and `tj`; use one to four. The cost objective needs `prices`. The default grid is 20 kHz to 500 kHz. The model and the search are described in the reply under `notes` and `references`.

### design.digitalize, fixed point and software-in-the-loop

When the controller is firmware, `design.digitalize` turns a compensator into a difference equation and shows what the firmware will really do. You give it a loop design (the reply of `design.voltageLoop` or `design.robustLoop`), or ask it to run one with `run`, or give a compensator by hand. It converts with Tustin's rule, prewarped at the crossover, or with matched poles and zeros. It writes the equation in the 2p2z or 3p3z form, and rounds the coefficients to `float32`, `q15`, `q31` or a format such as `q7.24`. Then it reads the loop gain again with the rounded coefficients, the computation delay and the PWM delay, so you see the phase margin the firmware will have.

```json
{ "run": "voltageLoop", "fs": 100000, "format": "q31", "method": "tustin",
  "computeDelay": 1, "pwmDelay": 0.5, "maxPmDrop": 10,
  "adcBits": 12, "vFullScale": 4.0, "prefix": "pol_comp" }
```

The computation delay can come from the ISR instead of `computeDelay`: give `tIsr`, or `cycles` and `fclk`, and `update`. With `update` set to `end` the delay is tIsr times fs samples; with `period` (the default) it is the next whole sample after the ISR ends, so an ISR that fits in the period gives the usual one sample. The extra delay ΔT costs 360° times fc times ΔT of phase margin at the crossover fc. The reply shows the ISR under `loop.delay.isr` (its load and whether it overruns), and the check `isrFits` fails when the ISR takes the whole period or more.

```json
{ "run": "voltageLoop", "fs": 100000, "cycles": 1437, "fclk": 170e6, "update": "end" }
```

The result passes only when the coefficients fit the format, the integrator is kept, the loop still crosses 0 dB, and the phase margin falls less than `maxPmDrop` degrees below the analog design. With `adcBits` it also checks that the format resolves the ADC, and with `dpwmBits` it checks the condition against limit cycles in the digital PWM (Peterchev and Sanders, IEEE Transactions on Power Electronics, 2003): one DPWM step must move the output less than one ADC step, and the integral gain must not be zero. Instead of `dpwmBits` you can give the timer counts of one period (`dpwmCounts`, such as TBPRD) or a high-resolution PWM (`hrpwm`: a step in seconds, or `f28379d` for 150 ps or `stm32g474` for 184 ps). The reply's `limitCycle` gives the DPWM bits, the ADC bits, the margin in bits, the risk and the bits needed. The reply has the header `pol_comp_coef.h`, the C99 code of the compensator, and a table of every format. Without `apply` it never edits the circuit.

**One firmware path.** With `"apply": true` and a passing design, the compensator goes into the circuit: the `pi` or `tf` block that drives the PWM becomes a `ztf` block at `1/fs` with the stored coefficients, the same connections, the `pi`'s output limits as `lo` and `hi`, and its `y0`. The `ztf` feeds back its limited output, as TI's 2p2z and 3p3z controllers store their saturated output, so the integrator does not wind up. It is one undo step. From then on `simulation.run`, `spec.verify`, `file.exportCode`, `codegen.verify` and `codegen.pil` all run the firmware's compensator, not the analog one. In `q15` or `q31` the coefficients are stored in the format the whole controller's code computes in: the word with the fewest integer bits that holds every constant of that code, the reference included. On the 12 V to 3.3 V buck the compensator alone fits `q1.30`, but the 3.3 V reference needs two integer bits, so the coefficients are stored as `q2.29` and `file.exportCode {"precision": "q31"}` writes exactly those integers. The reply's `applied` says what was written; a design that fails a check, or that uses `vFullScale` or pole pairs, is not written and `applied.reason` says why. Run the design for the digital delay first (`"designParams": {"delayTs": 1.5}`): an analog design that did not plan for it usually fails the phase-margin check.

```json
{ "run": "voltageLoop", "designParams": { "controller": "pi", "delayTs": 1.5 }, "format": "q31", "apply": true }
```

With `reportPath`, automatic design writes the files it lists under `digital.files` into a `firmware` folder next to the report (below `auto.outputDir` when that is given), and `digital.written` lists them.

For the code of the whole controller, `tools.codeGeneration` and `file.exportCode` (chapter 13) take `precision`: `float`, `double`, `q15`, `q31` or a format such as `q7.24`. `q15` and `q31` are a 16- or 32-bit word whose integer bits are chosen to hold every constant of the code, the rule `design.digitalize` stores its coefficients by; the reply's `format` names the one chosen (such as `q2.29`). A fixed-point result uses saturating arithmetic.

`codegen.verify` is the software-in-the-loop test. It simulates the circuit, records the signals that enter the generated code, runs the model's own blocks on them, compiles the C with the C compiler of your computer (`-std=c99 -Wall -Wextra -Werror`), replays the same inputs through the code, and compares the outputs sample by sample. In fixed point the harness writes each input as the format's integer and reads each output back in the model's units. The reply gives the largest error and the first sample where the code left the tolerance. Without a C compiler, and in the browser, it answers `skipped` with the reason and still returns the test vectors. `path` also writes the files for a test on the target.

```sh
powercraft-cli run --in work/pol.voltecx --cmd codegen.verify \
  --params '{"precision": "q31", "prefix": "pol_ctl", "maxSamples": 500}'
```

`codegen.closedLoop` closes the loop with the code. On a copy of the circuit it switches off the blocks the generator writes and puts one C block in their place, holding the generated C with a small wrapper that fills the inputs struct from the block's pins, calls the step function and writes the outputs back, at the code's sample time. It simulates both circuits and compares the code's inputs and outputs (and any `signals`, such as `v(out)`) by relative RMS error; `tolerance` is 0.5 % by default. It needs no compiler, so it also runs in the browser. On the closed-loop buck example the PI written by Tustin's rule at 100 kHz follows the continuous one within 0.5 % over the 10 ms run; the largest difference is in the first quarter millisecond of the start-up. With `"apply": true` the C block stays in the circuit as one undo step, with the replaced blocks still drawn and switched off. Edit the firmware with `circuit.setCode` and simulate it; run `codegen.closedLoop` again and it compares the edited code with the replaced blocks, so an edit that breaks the controller fails. The first line of the code names those blocks: keep it.


### emi.conducted

It estimates the conducted emission on the DC input and sizes a damped LC input filter. A LISN (50 microhenries, 0.1 microfarad, 50 ohms) goes on a copy of the circuit. The input current is read for a whole number of switching periods and analysed through a model of a 9 kHz receiver, with peak, quasi-peak and average detectors, against the CISPR 32 class A or class B limit, band by band. When the margin is below `targetMarginDb`, it sizes a one-stage or two-stage filter and measures again.

```json
{ "limit": "cispr32B", "filter": "auto", "targetMarginDb": 6 }
```

The circuit needs a DC input source (name it with `source` when there are several). The reply says `preCompliance: true` and the labels say it is an estimate. The circuit changes only with `apply: true`, which inserts the filter in one undo step.

The filter's damping is sized for Middlebrook's condition (R. D. Middlebrook, 1976; Erickson and Maksimovic, *Fundamentals of Power Electronics*, ch. 10): the peak output impedance of the converter-side stage must stay 3 times (9.5 dB) below the converter's input impedance. `zinOhm` gives that impedance, such as `Vin_min^2 / P` at full load; without it the measured `V / I` is used. An undamped LC has no loss and always fails, so the damping branch (`Rf` in series with `Cb = n * C`) gets the smallest `n` whose optimal peak meets the margin (section 10.4). `C` here is the converter's own input capacitance, or the filter's `C` when the converter has none. The peak is read from the whole filter as drawn, with every stage; when a two-stage filter still peaks too high, the converter-side damping is sized again until it fits. The reply's `filter.middlebrook` gives the impedance, the peak, the margin in dB and whether it passes.

With `"parasitics": true` the measured copies get the parts' parasitic elements, and the circuit stays as it is: capacitor ESR and ESL, inductor winding capacitance and switch Coss. A value the circuit already sets (`esr`, `esl`, `coss`, a `cossTable` or the dynamic level) is simulated as it is. Otherwise `parasiticValues` gives data-sheet values by part name: `{"Cin": {"esl": "2n", "esr": "5m"}, "L1": {"srf": "30Meg"}, "S1": {"coss": "200p"}}`. For a capacitor, `mpn` names a part of the capacitor catalogue and takes its data sheet's ESR (with the frequency it was read at). For an inductor, `cw` is the winding capacitance, or `srf` the self-resonant frequency, giving Cw = 1/((2π·SRF)²·L). A switch with an assigned device takes the device's Coss table at the input voltage (at the crest, √2·Vrms, for an AC mains input). The catalogue has no ESL and no inductor SRF, and illustrative devices give no Coss, so those values come only from you: a value nothing gives is never assumed, and the reply lists it under `parasitics.skipped` with what to give. The same window also runs with ideal parts: `parasitics.marginDb`, `idealMarginDb` and `changeDb` compare the two, and a note says it. When a filter with a common-mode stage is sized, its measurement takes each Y capacitor's ESR from the safety-capacitor catalogue, ESR = DF/(2π·f·C) from the data sheet's dissipation factor; the choke's data-sheet stray inductance and DC resistance are already in its model, and its winding capacitance comes only from `cw` (across each winding) once the choke is in your circuit. `parasitics.filter` lists what the filter's own parts had. With parasitics off, the reply says `"parasitics": {"on": false}`.

### emi.radiated

It estimates the radiated emission from 30 MHz to 1 GHz, at every harmonic of the switching frequency, against the CISPR 32 class A or class B limit at 3 m or 10 m. Two sources are added: the switch node's trapezoid driving its capacitance to the chassis and the input or output cable as a common-mode antenna (150 ohms), and the hot loop's current as a small loop (Paul's common-mode and differential-mode formulas). It also tries three layout changes (halve the loop area, halve the switch node's capacitance, double the edge time) and says which one raises the worst margin most.

```sh
powercraft-cli run --in work/pol.voltecx --cmd simulation.run \
  --cmd emi.radiated --params '{"limit": "cispr32B", "distanceM": 3, "edgeTime": 5e-9, "loopArea": 2e-4}'
```

The swing `vSw` and the loop current `iLoop` default to the first hot loop of `layout.hints`, else to the input source. `fsw` defaults to the PWM, `duty` to 0.5 and `edgeTime` to 10 ns; a data sheet value is better. `cSw` defaults to the capacitors drawn from the hot loop's switch node to ground when the input's return is not ground (ground is then the chassis). After you route the board, give it as `path` (or its text as `text`): `loopArea` is then the area of the board's worst power loop from `layout.extract` (the vector area of its copper path, so a return on an inner layer counts), `loopAreaSource` is `board` and `loopAreaLoop` names the loop. When the board has a chassis or heat-sink fill under or over the switch node (a net named `PE` or starting with `CHASSIS`, `EARTH`, `HEATSINK` or `SHIELD`, or the net you give as `chassisNet`), `cSw` is the parallel-plate capacitance of the switch node's copper to it, `cSwSource` is `board` and `cSwNet` names the fill; fringing is left out, so the real value is somewhat higher. A ground fill that is the input's return does not count. A given `cSw` still wins. Otherwise `loopArea` (1 cm², in m²), `cSw` (10 pF) and `cableLength` (1 m) are typical values when nothing gives them, and the reply lists every key that took one in `assumed`; `inputs` says where each value came from (`loopAreaSource`, `cSwSource`, `cableLengthSource`). In the app it is **Design › Automate › Radiated EMI**, whose result window puts the assumed values in a box with fields and **Run Again**. `maxPoints` (120) caps the spectrum rows. It changes nothing.

This is a pre-compliance estimate, not a measurement: the reply says `preCompliance: true` and the labels say so. It knows only the numbers you give or it assumes, not the real board, enclosure or cable routing. Use it to compare layout choices and to see how far you are from the limit, then measure in a chamber.

### layout.hints

It reads the circuit, and the last simulation when there is one, and says where the layout matters. It finds the commutation loops with the parts in each, and gives each loop an inductance budget: the largest loop inductance whose voltage spike still fits the voltage margin of the switches. It gives the ring frequency of the loop with the switch capacitances. It also lists the gate loops, the Kelvin source pairs, the switching nodes to keep small, and the thermal resistance the copper under each device must stay below. It changes nothing.

```json
{ "edgeTime": 1e-8, "loopInductance": 5e-9, "ambient": 40 }
```

`edgeTime` is the current fall time used for the current slope. A value from the data sheet is better than the default. `didt` replaces it with a slope you know. The reply names its sources, and `checklist` is a short list of things to check on the board.

### layout.extract

After you route the board in KiCad, it reads the `.kicad_pcb` (KiCad 6 to 10: footprints, pads and nets, tracks, arcs, vias, zone fills and the stack-up) and finds each power loop of the circuit on it by reference designator: the input capacitor, the high-side switch and the low-side switch or diode, and each switch's gate loop through its driver. It follows the shortest copper of every net in the loop and sums the partial inductances of the pieces, vias included (Ruehli 1972; C. R. Paul, *Inductance: Loop and Partial*, 2010, ch. 5). It also gives each switching node's capacitance to the planes it overlaps, from the stack-up's permittivity, and the ring frequency and overshoot this predicts. When a solid, uninterrupted zone fill lies on the copper layer right above or below a loop's own copper, it gives the loop's high-frequency (ring-band) inductance too: the DC value (`inductanceH`) less the mutual inductance with the loop's own mirror image at twice the dielectric's thickness (H. Johnson, M. Graham, *High-Speed Digital Design: A Handbook of Black Magic*, 1993, ch. 5, "Ground Planes and Layer Stacking"). `inductanceHfH` holds it, `imagePlane` says which layer and gap it used (or why not: no plane close enough, or a gap or slot under the loop), and `appliedInductanceH` is whichever `apply` inserts (the HF value when the check passes, else the DC one).

```sh
powercraft-cli run --in work/pol.voltecx --root work --cmd simulation.run \
  --cmd layout.extract --params '{"path": "pol/pol.kicad_pcb", "apply": true}'
```

`path` names the board (or give its text as `text`). A board drawn in Voltecx works the same way: with no `path`, `text` or `board` it reads the open project's board, a `path` ending in `.vxpcb` is read as one, and `board` takes a `.vxpcb`'s text; `board.format` in the reply says which was read. Its zones are filled as **Fill Board Zones** (`board.fillZones`) fills them, and every dielectric between copper layers needs a thickness in the stack-up, or the command names the layer to set. A board saved before you changed the circuit is read as saved, and a warning says so. `layout.ringing` takes the same `board`. `ipk` (the peak current the loop commutates, by default the switches' peak in the last simulation) and `coss` (added to the node capacitance) feed the overshoot estimate. With `apply: true` it inserts the parasitics in one undo step: a series inductor `Lpcb<n>` per power loop next to its capacitor, and a capacitor `Cpcb_<node>_<plane>` from each switching node to each plane; a second run updates them. `rerun` (the same as `apply` by default) then runs `simulation.run`, `analysis.stress`, `emi.conducted` (unless `emi: false`) and `spec.verify` (with `spec`) again, so you see the overshoot and the margins with the board's own parasitics. `worstLoop` names the loop with the largest overshoot and says whether it came from the simulation or the estimate.

`peecHz` (a list of frequencies, 0 for DC) also solves each complete loop's copper path with the PEEC solver of `field.peec` (chapter 21): every track a strip as wide as the track and as thick as its layer's copper, every via a rod of its drill, each split for the skin depth at the highest frequency. Each loop then gets `peec.frequencies` with R and L at each frequency. `peecTemperatureC` sets the copper temperature (20 °C by default, IEC 60028). `peecViaPlating` (`thicknessUm` and whether the board's drill is the finished or the drilled hole, both from your fabricator, since the board file gives neither) makes each via a plated tube; without it a via is a solid rod and its resistance a lower bound. `peecPlane` (`cellMm`, `marginMm`) meshes the zone fill under each loop into the solve as a floating plane, its slots and clearances cut out, so the plane's eddy current lowers L and adds its loss to R at high frequency. With `apply`, `peecApplyHz` (one of `peecHz`, such as a frequency near the predicted ring) writes each loop's PEEC resistance at that frequency into its `Lpcb<n>`'s series resistance, which damps the ring in the simulation. `peec.quasiStatic.limitHz` is where the loop reaches a tenth of a wavelength in the stack-up's highest permittivity; rows above it carry an `aboveQuasiStaticLimit` warning and are outside the model. A loop may have up to 5000 filaments with its plane: up to 2000 it is solved by the dense LU, past that by GMRES (the reply's `solver` is `denseLu` or `gmres`; the two agree on the port impedance to about 1e-11). A loop that needs more gets an error asking for fewer or lower frequencies, never a coarser solve.

Limits: the image-plane correction only looks at the layer right above or below the loop's own copper, and only when that layer's zone fill is solid under the whole loop; a plane further away, reached only through vias, or with a gap or slot under the loop, is not modelled, and `inductanceH` (DC) stays the upper bound. Package inductance and fringing are left out. A part whose footprint is missing on the board, or a net that is not routed, makes its loop incomplete, and the reply lists it. Without `apply` it changes nothing.

### layout.ringing

It shows the ring a routed board's power loop puts on the switching node. It takes the loop inductance and the node's board capacitance from `layout.extract` (or `lH` and `cF` that you give), adds the off switch's output capacitance `coss` (from its data sheet at the bus voltage; by default the switches' `coss` in the circuit), and simulates the series RLC tank of a hard commutation on a scratch bench: the loop inductance carrying `ipk` into the node charged to the bus (`vBus`, by default the DC source across the input capacitor), damped by `rLoop` (by default the lowest switch on-resistance). The bench runs at 200 steps per ring period, so a ring of tens or hundreds of MHz shows even when the circuit's own step is far longer.

```sh
powercraft-cli run --in work/pol.voltecx --root work \
  --cmd layout.ringing --params '{"path": "pol/pol.kicad_pcb", "coss": 4.7e-10, "ipk": 10}'
```

`hand` is the hand calculation of the same tank: ring frequency 1/(2π√(LC)), damping ζ = R/2·√(C/L), characteristic impedance √(L/C) and the first overshoot (I·√(L/C) without damping). `simulated` is what the bench shows, `agreement` the ratio of the two, and `waveform` the switching-node voltage to plot. The open circuit is not changed. The ideal step and the stiff bus make the overshoot an upper bound, the output capacitance is one value though it falls with voltage, and package inductance is not on the board.

### bom.export

It makes a bill of materials. For every part it picks a catalogue part that meets the stress of the last simulation, with the same derating as `analysis.stress`. It needs a simulation result. Capacitors, resistors and inductors come from the passive catalogue. Switches and diodes come from the vendor device library, or are the device already assigned. A line has the status `matched`, `assigned`, `illustrative` or `unmatched`. A ceramic capacitor count allows for the capacitance lost at the DC voltage, and inductors may be a series set.

```sh
powercraft-cli run --in work/pol.voltecx --root work --cmd simulation.run \
  --cmd bom.export --params '{"priceSource": "offline", "csvPath": "pol-bom.csv"}'
```

`prefer` is `size` (the default) or `cost`. `prices` maps a part number to a price in US dollars. `priceSource` is `auto` or `offline`: `auto` asks Nexar only when `NEXAR_TOKEN` is set. The CSV has the KiCad BOM columns first. The totals say whether the list is complete.

Supply chain. `grade` is `any` (the default) or `automotive`: only parts whose manufacturer states automotive grade. `lifecycle` is `any` (the default), `avoid` or `active`: `avoid` leaves out parts recorded NRND, EOL or obsolete, and `active` keeps only parts recorded active. These facts come from `parts/supply.json`, each with its source and the date it was checked. A part with no record has an unknown status: `automotive` and `active` leave it out, and `avoid` keeps it. A line lists the candidates the requirement left out in `leftOut`, with the reason in English and Traditional Chinese. The requirement does not apply to heatsinks and pads, and an assigned device stays the part, with a warning. Each part carries its `supply` record: lifecycle, grade, AEC-Q standard and grade, temperature range and second sources. The CSV has Lifecycle, Qualification and Second Sources columns. No lifecycle status has been read from a manufacturer yet, so `active` leaves every line but the heatsinks and pads without a part for now. The grades on record are those the catalogue's data sheets state: KEMET C0G parts are commercial grade and the Murata GCM32ER71E106KA57 is automotive grade.

`atLeast` names ratings measured elsewhere, per component, in the units of the `required` rows of `analysis.stress` (`voltageV`, `currentA`, `peakCurrentA`, `powerW`). The part must carry the larger of each. `design.auto` uses it for the buck, boost, inverting buck-boost and SEPIC: it measures the stress at the lowest and the highest input at full load and passes it in. The switch and the diode of the buck, the buck-boost and the SEPIC block the most at the highest input. The input inductor of the boost, the buck-boost and the SEPIC carries the most at the lowest.

`keep` names, per component, a catalogue inductor part number the line takes when it meets the requirement, in the fewest in series; the usual pick is then an alternate. When it does not meet the requirement, the line takes the usual pick with a warning saying so. `design.auto` passes the inductor its inductorPart stage wrote into the circuit, so the part simulated is the part bought.

### file.exportKicad

It writes the circuit as a KiCad 8 project: a schematic with a symbol for each part and the fields Reference, Value, Footprint, Datasheet, MPN, Manufacturer and Source, net labels on every pin, a project file with net classes, and a rules file. A net whose peak voltage reaches `hvThreshold` (50 V by default) gets a clearance rule. The track width of a power net comes from its current, `tempRise` and `copperOz`. Control blocks and meters are not drawn. An IC placed with `ic.place` is one symbol with its own pin names, and its Datasheet and Source fields come from its model. Its MPN stays empty, because the model stands for a class of parts (such as the INA180A3 class) and the package is not known; the warnings name it so you choose the part number. Footprint holds a KiCad library id only. A part whose data sheet names a package instead keeps it in a Package field, and the warnings list it, so you assign the footprint in KiCad. The load and any other part that `bom.export` leaves out stay in the schematic, but off the bill of materials and the board. Discrete packages map to footprints of the KiCad 8 standard library, and the schematic pins are numbered by the pads of the footprint. Voltecx places the footprints without Python or a script: run Update PCB from Schematic in KiCad, save the board, close it, and export again with the board as `board` (for example `"board": "pol.kicad_pcb"`). Voltecx then places the footprints in the board file itself, sets its solder mask web, and writes it back with nothing else changed. It places the hot loop side by side in loop order, the gate parts above their switch, and the control parts away from the switching node. Each IC's bypass capacitors go right after the IC, as `schematic.autoLayout` draws them beside it. Every part gets one rotation, so polarized parts of one kind face one way. The reply lists the placement rows, the polarized parts, the solder mask web, the parts placed, the references the board has no footprint for, and the SMT parts on the bottom side. Earlier versions also wrote a `<name>_place.py` script for the pcbnew scripting console; it is no longer written.

```sh
powercraft-cli run --in work/pol.voltecx --root work --cmd simulation.run \
  --cmd file.exportKicad --params '{"path": "pol.kicad_sch"}'
```

The fields for the parts come from `bom.export`, which needs a simulation result. Without `path` the file texts are returned. Voltecx writes no board file, so the layout is yours to draw.

### file.manufacturingOutputs

After you route the board in KiCad, it makes the files an assembly house needs, with kicad-cli: the design rules check (with the rules in the board and in the project's `.kicad_dru`, zones refilled, and the schematic parity), Gerbers of the fabrication layers, Excellon drill files with a PDF map, the position file, the bill of materials in the assembler's format and an assembly drawing PDF. The reply lists what still stands between the board and an order: unrouted nets, DRC errors, differences from the schematic, parts without an MPN, a step kicad-cli could not do, or kicad-cli itself. `ready` is true when that list is empty. It is in **Design > Manufacturing > Manufacturing Outputs**.

```sh
powercraft-cli run --root work --cmd file.manufacturingOutputs \
  --params '{"project": "pol/pol.kicad_pro", "dir": "pol/fab", "assembler": "jlcpcb"}'
```

`assembler` is `generic` (KiCad's position file, and a BOM with Designator, Qty, Value, Footprint, MPN and Manufacturer) or `jlcpcb` (a BOM with Comment, Designator, Footprint and LCSC Part #, taken from each symbol's LCSC field, and a CPL with Designator, Mid X, Mid Y, Layer and Rotation in millimetres). kicad-cli is found on the PATH or in KiCad's standard install folder. Without it (or in the browser build) Voltecx writes the Gerber X2 layers, the Excellon drill files, the position file, the bill of materials and the assembly drawing itself from the `.kicad_pcb` (the reply's `writer` is `voltecx`), and checks the board with its own design rules check into `<name>-drc.json`: unrouted nets and errors are listed as with kicad-cli, with the rules in the `.kicad_pcb` and in the `.kicad_pro` beside it (the board minimums for clearance, track width, drill, annular ring, hole-to-hole gap and board edge, and each net class's clearance, with the nets its patterns and assignments give it), and the `.kicad_dru` rules that hold on every layer and whose condition is empty or names net classes or nets (`A.NetClass == 'HV'`, `A.NetName == 'sw'`): on the whole board the minimum clearance, track width, edge clearance, hole size, annular ring and hole-to-hole gap and the largest hole, for a class or a net its clearance, narrowest and widest track and edge clearance (a net's rule goes into the net's own copy of its class, named `<class> [<net>]`, so it holds for that net only). A rule only tightens a value. A rule on some layers or items only (a fab's `(layer outer)` rules, or a condition such as `A.Type == 'Via'`) and a router target (`opt`) leave nothing to check when the board-wide minimums already hold them. A stricter one is checked on its items when Voltecx can tell which they are: a track width (minimum or maximum) on `outer`, `inner` or one named copper layer, with no condition or `A.Type == 'Track'`, and a hole size (minimum or maximum, an oval hole's narrow width against the minimum and its length against the maximum) or annular ring (minimum or maximum), on every copper layer or on the `outer`, `inner` or one named copper layer of its `layer` clause, on every via and drilled pad, or on the ones the condition picks: `A.Type == 'Via'`, `A.Type == 'Pad'`, or `A.Pad_Type` `'Through-hole'` (plated) or `'NPTH, mechanical'` (unplated). A ring is measured on vias and plated pads only, as kicad-cli does (its annular-ring check passes over every pad that is not plated through-hole), so a ring rule on the `'NPTH, mechanical'` pads is read and finds nothing. On some layers a hole rule holds for the holes that reach them (a drilled pad reaches every copper layer, a via the layers of its span), and a ring rule measures the ring on those layers only (a pad's inner copper on the inner layers); the finding names the layer of the ring it reports. A clearance between two sides whose condition names a class, a net or a kind of item (`A.Type` `'Track'`, `'Via'`, `'Pad'` or `'Zone'`) of A and one of B (`A.NetClass == 'HV' && B.NetClass == 'LV'`, `A.NetName == 'sw' && B.hasNetclass('Signal')`, `A.Type == 'Pad' && B.Type == 'Via'`), on every copper layer or on the `outer`, `inner` or one named copper layer of its `layer` clause, is checked between the copper of those two sides only, either way round. Any other stricter rule (another condition) is left out. It also compares the board with the `.kicad_sch` of the same name beside it, as kicad-cli's schematic parity does: every symbol meant for the board needs one footprint of its reference and every footprint a symbol, with the same Value and the footprint the symbol names, and each pad must sit on a net that joins the same pins as in the schematic (a labelled net keeps its name). A schematic with hierarchical sheets is compared with the sheet files its boxes name, beside it or in a folder below it: a sheet drawn twice is compared once per drawing with the references KiCad keeps for each, and a local label `x` on sheet `A` must be the board's net `/A/x`. Each difference is listed in `drc.violations` and counted as a schematic difference. Without a `.kicad_sch` the reply says the parity could not be checked. The report's `rules` and the reply's `notes` say which rules were read and which were left out. Its assembly drawing is the one **Board Picture** draws with `assembly` on: the top face on the first page and the bottom on the second, each with the pads, silkscreen, fabrication and courtyard drawings, the board edge and a parts table. Only `.kicad_dru` rules it leaves out and a sheet file it cannot read still need kicad-cli: then the reply lists kicad-cli as missing and `ready` stays false. Otherwise `ready` can be true without KiCad installed. The flags are those of KiCad 10. KiCad 8 and 9 name some options differently, so a step may fail there, and the reply notes the version. The details are in `docs/workflows/manufacturing-outputs.md`.

### design.protection

It sizes the protection of a buck, a boost, a buck-boost or a flyback. It is in **Design > Design Steps > Protection**. Give it a spec (the one `spec.verify` takes) or the reply of a verification run, with the circuit open. It works out:

- the worst peak current over the corners of the spec, and the peak-current trip: the highest peak at full load with the inductor 20 percent low, plus the charging current of the output capacitor during soft start. The peak takes the converter's losses into account when you give its efficiency in `efficiencyPct` (`design.auto` passes the efficiency it measured); without it, the peak is that of a lossless converter, which is lower than the real one;
- the current-sense shunt, from the sense amplifier or the controller that is already in the circuit (otherwise it assumes an INA180A3, or the 1 V input of a UCx843);
- the leading-edge blanking time, from the gate charge of the switch;
- the over-voltage and under-voltage thresholds, with their hysteresis. The over-voltage trip sits above the output's tolerance band plus an overshoot: `overshootPct`, else the spec's `startup.maxOvershootPct`, else 10 percent. When you pass a verification run, the highest start-up overshoot it measured is used if it is larger;
- the soft-start time that keeps the start-up current under the trip.

Every formula in the reply names its source: a TI application note, the textbook or a data sheet. A number that the catalogue cannot give is not guessed. The reply lists it in `notes`. An independent calculation checks the result, and the command does not change the circuit. `design.auto` does not run it, so run it yourself after the design.

### design.gateDrive

It designs the gate drive of every switch in the circuit. It is in **Design > Design Steps > Gate Drive**. A switch whose reference terminal is off ground is high side and pairs with the switch below it. Each group gets a driver from the gate-driver catalogue (TI UCC27211, UCC27517 and UCC21520, Infineon 1EDN7511B and 1EDN8511B, every number from the cited data sheet): a low-side driver for a lone low-side switch, a half-bridge driver with a bootstrap for a high-side switch, and an isolated one with `isolate: true`. It sizes the turn-on and turn-off gate resistors for the driver's peak current or for an edge time `tEdge` (TI SLUP169), the bootstrap capacitor and the VDD bypass (TI SLUA887A), the drive power and the dead-time margin.

```sh
powercraft-cli run --in work/pol.voltecx --cmd design.gateDrive --params '{"vdd": 10, "switchDevice": "texas-instruments/csd17573q5b"}'
```

The other parameters are `spec`, `fsw`, `devices` (switch name to library device id), `droop`, `dMax`, `deadTime`, `driver` (force one catalogue part number), `bootDiodeVf` (for a driver without its own bootstrap diode), and `dvdt` and `minPulse` (for the isolation choice below). `vdd` defaults to the switch's on-voltage, else 10 V.

The gate charge a data sheet gives is measured at one gate voltage. The command scales each switch's Qg to the voltage that really drives it (VDD, less the bootstrap diode's drop on the high side), from the second point of the data sheet's gate-charge curve or the end of the plateau, and uses it for the bootstrap capacitor and the drive power; the reply shows it as `<switch>.qg`. For example, a CSD17573Q5B driven at 10 V needs 111 nC, not the 49 nC its data sheet gives at 4.5 V. When a part's curve cannot be scaled, the data sheet's Qg is kept and a note names the part and its test voltage. It also checks VDD against each device's VGS(max), and a negative off-voltage against its VGS(min); a failure fails `verify` and names the next step. A device without a VGS rating gets a note. `design.auto` runs it as the gateDrive stage. Without `apply` it changes nothing.

With `apply: true` the gate drive of each half-bridge group goes into the circuit, in one history step, under the names the bill of materials gives its lines: the driver IC `U_<high switch>` (the `halfBridgeDriver` model with the catalogue entry's delay, UVLO, output resistance and bootstrap diode), the turn-on resistor `RgOn_<switch>` from the driver output to the gate net `g_<switch>`, the turn-off resistor `RgOff_<switch>` with its diode `Dgoff_<switch>` in parallel, the bootstrap capacitor `Cboot_<high switch>`, the VDD bypass `Cvdd_<high switch>`, an external bootstrap diode `Dboot_<high switch>` for a driver without its own, and the driver supply `Vdrv`. The driver's inputs read the switches' own gate signals, so the switches switch exactly as before; the gate nets show what the driver does. A lone low-side switch (a boost's or a flyback's) gets the driver IC `U_<switch>` (the `lowSideDriver` model with the catalogue entry's delay, UVLO and output resistance), its IN on the switch's gate signal and its GND on the switch's source, with the same gate resistors and turn-off diode; its sizing has no VDD bypass, so none goes in. Applying again replaces those parts in place. Isolated drivers have no simulation model yet: they stay on the bill of materials, and `notApplied` says so for each group.

**The isolation of the gate signals.** When the gate signals must cross a barrier (`isolate: true`, a high-side switch on a bus above every bootstrap half-bridge driver of the catalogue, whose highest is the 2ED2304S06F's 650 V, or a phototransistor optocoupler on a gate signal), the reply's `isolation` weighs the library's isolation elements and picks the first that passes three checks:

- **Speed**: the shortest pulse the part passes is at most the shortest gate pulse, `minPulse` (5 % of the period unless given).
- **CMTI**: the rating is at least the switch node's slope, `dvdt`, else the bus over `tEdge` or the designed edge.
- **Isolation voltage**: the bus is within the highest bus rating of the catalogue's isolated drivers (the UCC21530B's 1850 V).

In order of preference, the elements are the UCC21750 isolated gate driver (150 V/ns), the ISO7710 digital isolator (100 V/ns), the high-speed logic optocoupler, a fiber-optic link (no galvanic path, so no CMTI or voltage limit) and the phototransistor optocoupler. A part whose CMTI Voltecx does not hold is not verified. `why` explains the choice in English and Traditional Chinese, and names each element passed over and the reason. `flags` names a phototransistor optocoupler that carries a gate signal: it is too slow for PWM. With `isolate: true` the check `isolation` fails when nothing passes. The design.auto report quotes the choice in its gateDrive gate. On the `sicHalfBridgeFiber` example, an 800 V bus with `tEdge: 5e-9` is 160 V/ns: above the UCC21750's 150 V/ns, so the choice is the fiber link. With `tEdge: 8e-9` it is 100 V/ns, and the isolated driver qualifies.

### design.inputProtection

It sizes the input protection of a converter from the spec and the circuit, every part from a cited data sheet. It is in **Design > Design Steps > Input Protection**.

- **Fuse** (Littelfuse 215 time-lag, 451 fast-acting): the smallest rating that carries the input current at 75 percent, and its pulse withstand for `pulses` switch-ons (100,000 by default).
- **Hold-up**: the bulk capacitance that keeps the converter running for `holdUp.time` after the input is lost.
- **Inrush**: an NTC (TDK S237 and S364), an active limit, or none (`inrush`: `ntc` by default for AC, `none` for DC), with the peak current, I²t and energy, held to `inrushMax`.
- **Surge**: with `surge: {"level": 1..4}` a TVS (ST SM6T, SM15T) for the IEC 61000-4-5 test, checked against the switch's voltage rating with the input clamped. Without `surge` there is no TVS.
- **Reverse polarity**: an N-MOSFET in the ground return or a series diode (`reverse`: `fet` by default for DC, `none` for AC), with its loss.

```sh
powercraft-cli run --cmd file.openExample --params '{"name": "buck"}' \
  --cmd design.inputProtection --params '{"spec": {"vin": {"min": 40, "max": 56}, "vout": {"nom": 12}, "iout": {"max": 5}}, "surge": {"level": 2}}'
```

For a mains input give `vinAc` (V rms) and `fline` (50 Hz). `efficiency` (1 by default, a lower bound on the input current), `cBulk`, `rSource`, `fuse`, `ntc`, `tvs`, `reverseDevice`, `switchDevice`, `switchRating` and `n` (a flyback's turns ratio) override what it reads from the circuit. The input current of an AC input is the unity-power-factor current, a lower bound. Without `apply` it changes nothing. The example `inputProtection` shows the parts in a circuit.

With `apply: true` on a mains input (a PFC, say) it draws the inrush limit into the circuit in one undo step: `RT1`, the chosen TDK NTC, in series with the line behind the sine source; `K1`, the bypass relay's contact across it (an ideal switch, since the catalogue has no relay), closed by a timer in the controller `Trelay` after power-on (five charging time constants R·C, at least two line cycles); and a soft start `Ss` that brings the voltage reference up with the time constant `Tss`. In a grouped circuit the timer and the soft start go into the controller's block, which gets a `relay` pin. With the relay carrying the steady current, the NTC is chosen without its Imax bound. The Test Bench's `acInrush` case then runs the cold switch-on through them (chapter 18).

### design.safety

It finds every isolation barrier in the circuit (the windings of a transformer or coupled inductor, and the parts you list in `barrier`: an optocoupler, an isolated driver, a Y capacitor; an optocoupler, isolated amplifier or digital isolator placed with `ic.place` joins each of its sides only without being listed, and the simulation's tie `Rtie` between an isolated design's grounds joins nothing) and gives each pair of nets across it, and from each side to protective earth (`earth`), its working voltage: peak and RMS from the last simulation, else from the spec. Then it applies the method of IEC 62368-1:2018 for clearance and creepage, basic and reinforced: procedure 1 at the peak, procedure 2 with the mains transient on the input side, the altitude factor above 2000 m, and creepage from the RMS voltage, pollution degree and material group. It is in **Design > Design Steps > Safety**.

```sh
powercraft-cli run --cmd file.openExample --params '{"name": "flyback"}' --cmd simulation.run \
  --cmd design.safety --params '{"pollutionDegree": 2, "materialGroup": "IIIb", "overvoltageCategory": "II"}'
```

The other parameters are `spec`, `t0` and `t1` (the window of the result), `altitude` (2000 m) and `mainsV`.

**The distance tables are empty.** Voltecx has no licensed copy of IEC 62368-1, so every clearance and creepage in the reply is `null`, `missing` lists each table cell the result needs, and `verify` fails until the tables are filled (#374). What you get today is the barrier, its sides, the working voltages and the list of lookups to make in your own copy of the standard. The reply also lists what the transformer construction needs (triple-insulated wire, tape, margins). `file.exportKicad` adds a note per barrier to the schematic. It changes nothing, and it is not a safety approval.

### design.reliability

It needs a simulation result. It gives three things. It is in **Design > Design Steps > Reliability**.

- **Capacitor life.** Each electrolytic, polymer or hybrid capacitor of the catalogue (Panasonic EEU-FR, EEH-ZC and SVPF) has its ripple current compared with the rated ripple current of its data sheet. None of the three sheets prints the core temperature rise of the rated ripple, so a part within its rating is taken at the ambient temperature, and a part over it gets no life (`overRipple`). Then its series' own life formula from the Panasonic data sheet gives the life, capped at 15 years. The part with the shortest life is reported. `lifeTarget` (hours) makes it a check.
- **Derating.** One row per part: the measured voltage, current, power and temperature against the rating of the part `bom.export` picks, times the factor of the rule set. `rules` is `nasa` (NASA EEE-INST-002, the default), `stress` (the factors of `analysis.stress`, common practice, not a standard) or your own `{name, voltage, current, power, tjMax}`.
- **MTBF**, only when you give the failure rates. Voltecx ships none of the numbers of IEC 61709 or SN 29500, so `mtbf: {"handbook": "IEC 61709", "rates": {...}}` takes the FIT and stress factors per part from your copy; without them the MTBF is `null` and the missing parts are listed.

```sh
powercraft-cli run --in work/pol.voltecx --cmd simulation.run \
  --cmd design.reliability --params '{"ambient": 50, "lifeTarget": 50000, "rules": "nasa"}'
```

`ambient` is 40 degrees Celsius by default. `parts` names the catalogue part of a capacitor, `bom` passes options to `bom.export`, and `t0` and `t1` set the window. Only those three capacitor series have a wear-out formula; another capacitor is listed with no life. It changes nothing.

### design.lifetime

It is in **Design > Design Steps > Lifetime**. It answers "how many years do the power semiconductors last under this mission profile?" for thermal cycling: bond-wire lift-off and solder fatigue from junction temperature swings.

1. **Mission profile.** `profile` is a table of rows `{t, loadPct, ambient}` (seconds, % of the rated load, °C), or `csv` the same as CSV text with columns `t`, `loadPct` and `ambient`. Values between rows are interpolated, and the profile repeats back to back (`perYear` sets how many passes a year instead).
2. **Junction temperature, fast.** There is no switching simulation per point. Each device's loss is looked up from `design.efficiency` run at a few loads spanning the profile, or from your `losses` table `{loadPct, devices}`; 0 % load counts as off. The loss is convolved with the device's junction-to-case Foster stages from its data sheet, the interface (`rthCase`) and the shared heatsink (`rthHeatsink`, `tauHeatsink`). Ripple within a switching or line period is not in Tj, and the Foster stages are added in series with the heatsink, an approximation the reply states.
3. **Rainflow counting** of each device's Tj over one pass, as ASTM E1049-85 (R2017) section 5.4.4 defines it, starting from the highest point so a repeating profile closes its largest swing.
4. **Cycles to failure** from a published power-cycling model (`model`):
   - `lesit` (default): Held et al., PEDS 1997, with the coefficients Brunko et al. (EPE'19 ECCE Europe, eq. 1) quote: A = 302500, α = −5.039, Ea = 9.89e-20 J.
   - `an21001-baseplate`, `an21001-nobaseplate`, `an21001-sintered`: Semikron Danfoss AN 21-001 Rev. 02 (2024-07-23), Tables 1 to 3, with `chip` the section 2.5 thickness class (`igbt`, `igbt1700`, `cal`, `rectifier`, `sic`). Cycles outside the note's tested range (ΔTj 30 to 120 K, Tjm 333 to 400 K, ton 0.04 to 60 s) are flagged.
   - `cips2008`: Bayerer et al., CIPS 2008. The paper's coefficients were not read from an accessible copy, so Voltecx ships none: give `cips {k, beta1…beta6, current, voltage, diameter, source}`.
   - `curve`: a power-cycling curve from the module's data sheet, `curve {points: [[ΔTj, Nf], …], source}`, interpolated on log-log axes.
5. **Miner's rule**: one pass consumes D = Σ n/Nf, and the life is 1/(D·passes a year) years. The device with the shortest life is `limiting`; `lifeYears` makes it a check.

```sh
powercraft-cli run --in work/inverter.pcraft \
  --cmd design.lifetime --params '{"profile": [{"t": 0, "loadPct": 100, "ambient": 40}, {"t": 600, "loadPct": 100, "ambient": 40}, {"t": 601, "loadPct": 20, "ambient": 25}, {"t": 1800, "loadPct": 20, "ambient": 25}], "model": "an21001-baseplate", "chip": "igbt", "rthHeatsink": 0.3, "tauHeatsink": 120, "lifeYears": 15}'
```

The reply lists each device's Tj range, largest swing, cycles and damage per pass, a histogram of swings, and the share of damage from cycles outside the model's range. A device whose data sheet has no Foster stages uses `rthJc` (default 1 K/W) with no thermal mass, which a note names. In `design.auto`, `spec.life.missionProfile` takes these same parameters and the `life` gate also checks this life against `spec.life.years`. It changes nothing.

### design.tradeoff

It needs a simulation result. It is in **Design > Design Steps > Trade-offs**. It answers "what does a longer life cost?" for the capacitors of the bill of materials. The first row is the design as `bom.export` picks it. Each further row swaps one electrolytic, polymer or hybrid capacitor for one of its alternates. Every row gives:

- the **efficiency**: the simulated full-load efficiency of `design.efficiency`, with the ripple heat I²·R of the swapped capacitor added to the input power;
- the **size**: the board area of the parts' bodies from `bom.export` (the catalogue has no volume for every part, so this is area, not volume);
- the **cost** of one board when `boards` boards are built, at each part's quantity break;
- the **life**: the shortest capacitor life of `design.reliability` at `ambient`.

`vsBaseline` and `gain` say what the row changes, such as "+12 % cost for +4.0 years of life", and `paretoOptimal` marks rows no other row beats on all four. `lifeYears` adds a life target to the check.

```sh
powercraft-cli run --in work/flyback.pcraft --cmd simulation.run \
  --cmd design.tradeoff --params '{"ambient": 85, "boards": 1000, "lifeYears": 10, "bom": {"exclude": ["R1"]}}'
```

A part without a price stays unpriced and the row's cost is marked incomplete; give `prices` (as `bom.export` takes them) to compare costs. It changes nothing. `bom.export` itself now takes `boards` (the build quantity the prices are read at) and `use` (a capacitor's catalogue part, as the life search pins it).

### design.fmea

It builds a failure-mode table by fault injection. For each component (by default every resistor, capacitor, inductor, diode and switch) and each mode (`open`, `short` and `drift`, by `drift` = 1.2; diodes and switches take open and short), it runs a brief simulation with the fault and records the effect on the output voltage and the current, and whether the protection would have caught it. It is in **Design > Design Steps > FMEA** and runs as a long job.

```sh
powercraft-cli run --in work/pol.voltecx --cmd design.fmea \
  --params '{"components": ["C1", "L1", "Q1"], "modes": ["open", "short"], "spec": {"vout": {"nom": 3.3, "tolPct": 3}}}'
```

`output` (by default `v(out)`) and `current` (the first inductor's) name the signals. `tEnd`, `t0`, `maxSteps` and `solver` set each run. The output band comes from `spec`, or from `limits` (`vMax`, `vMin`, `iMax`). `trips` gives the protection thresholds (`iTrip`, `ovp`), or a `design.protection` reply. The reply has one row per fault (the measured extremes, the effect, and whether a trip would detect it) and the table as CSV and Markdown. The FMEDA columns (`fit`, `modeSharePct`, `severity`, `safeOrDangerous`, `diagnosticCoveragePct`) are left empty for you to fill in: the failure-rate and mode-distribution handbooks are not shipped. It never claims compliance with ISO 26262, IEC 61508 or any other standard, and the reply's `disclaimer` says so. `verify` (on by default) fails when a planned fault did not run (a cancelled job) or a fault beyond the limits is not detected. It changes nothing: `apply: true` is refused.

### design.testPlan

It writes the production test procedure of the design, each limit with its source. It is in **Design > Design Steps > Test Plan**.

- Power-on steps from the spec: the output inside its tolerance at every corner of input and load, the ripple, each efficiency point, start-up time and overshoot, and hold-up.
- Trip steps from `design.protection`: the over-current trip, the over-voltage trip and release, and the under-voltage start and stop, each with its tolerance.
- Input steps from `design.inputProtection`: the peak inrush, a reverse-polarity check, and each fitted fuse, NTC and TVS by part number.
- A hipot step per isolation barrier from `design.safety`, with the working voltage. The test voltage is `null`, because the table of IEC 62368-1 it comes from is not shipped.
- The equipment, with the range each must reach.

```sh
powercraft-cli run --in work/pol.voltecx --cmd design.testPlan --params '{"spec": {
  "vin": {"min": 10.8, "nom": 12, "max": 13.2}, "vout": {"nom": 3.3, "tolPct": 3},
  "iout": {"min": 1, "max": 5}, "ripple": {"maxPp": 0.05}}}'
```

It runs `design.protection`, `design.inputProtection` and `design.safety` itself, unless you pass their replies as `protection`, `inputProtection` and `safety`, or `false` to leave their steps out. `verifyRun` (an earlier `spec.verify` reply) adds the simulated values beside the limits. The reply holds the steps, the equipment and the fixtures, as text and CSV in English and Traditional Chinese. It changes nothing.

### design.compliance

It writes a compliance summary for one market: one row per requirement, each `pass`, `fail` or `notChecked`, with the regulation and clause cited and what was simulated. It is in **Design > Design Steps > Compliance**. It reads the results you give it; only the EU harmonic row runs a simulation (`simulate: false` turns it off). Without `spec` and `autoRun` it reads this session's latest `design.auto` run on the circuit, else the spec stored with the circuit, so after `design.auto` the call `{"market": "eu"}` is enough.

- **Efficiency** (with `eps: true`, for an external power supply on the mains): the average efficiency at 25, 50, 75 and 100 percent load against US DoE Level VI or EU Regulation 2019/1782. The no-load limit is shown but not checked, because no-load power is not simulated.
- **Harmonics** (EU, a mains spec whose line range includes 230 V): the circuit runs at the standard's reference supply, 230 V and 50 Hz (IEC 61000-3-2:2018, clause 1 and Annex A.2), at full load until its DC link settles, then over one window of IEC 61000-4-7:2002+A1:2008: 10 line cycles, 200 ms (4.4.1). Each order 2 to 40 is its harmonic group (5.5.1). The row holds a table of every order with its measured current and its limit in amperes: Table 1 for Class A (the class assumed when the spec names none, clause 5.1), or Table 3 for Class D (milliamperes per watt of input power, capped by Table 1; above 600 W Class A holds). It also gives the partial odd harmonic current (POHC, the odd orders 21 to 39) and, for Class A, takes the 50 % allowance of clause 7 for those orders while the POHC stays within the POHC of the limits. At 75 W or below (clause 7.1) and above 16 A per phase (IEC 61000-3-12) it is not checked. The circuit has no EMI filter, so the switching ripple is in the current. The report text lists the table. With `verifyRun` (an AC `spec.verify` reply whose spec names `harmonics`), or `simulate: false` and a `design.auto` report as `autoRun`, the row reads that verification instead of simulating: it judges the most loaded corner at the 230 V test voltage, gives the order nearest its limit in percent of it, and lists every order (`orders`: measured A, limit A, percent, pass) with a per-order table under the summary. That current is read over the verification's window of whole line cycles, not the 10-cycle windows of IEC 61000-4-7. Without a 230 V corner or without `spec.harmonics`, the row is not checked and says what to run.
- **Conducted EMC**: the verdict of `emi.conducted` (or of `design.auto`'s emi section) against CISPR 32 class `emcClass`; for the US, 47 CFR 15.107 has the same limits.
- **Radiated EMC**: `emi.radiated`'s verdict for the EU. The US row is not checked.
- **Safety**: `design.safety`'s IEC 62368-1 distances, not checked while its tables are empty (#374).

```sh
powercraft-cli run --in work/pol.voltecx --cmd design.compliance \
  --params '{"market": "eu", "emcClass": "B", "spec": {"vinAc": 230, "vout": {"nom": 12}, "iout": {"max": 2}}, "eps": true}'
```

Pass the earlier replies as `autoRun` (a `design.auto` report), `efficiencyRun`, `verifyRun`, `conducted`, `radiated` and `safety`. A result you do not give is `notChecked`, never `pass`. The summary is a list of what was simulated and what is left. It is not a certification, a declaration of conformity or a test report.

### design.review

It runs the eight checks a hardware engineer does before trusting a power design, on any open circuit (not only one `design.auto` made), and returns one table: check, worst value, limit, margin, `pass`/`warn`/`fail`/`notChecked`, and how to fix it. It is in **Design > Design Steps > Review**; the form takes the data each check may need, and every field is optional. Each row runs the command that already does that check, on the circuit as it is (it simulates first when the result is missing or stale), and changes nothing.

| Row | Check | From |
|---|---|---|
| R1 | Magnetics saturation: each inductor's simulated peak current, ripple included, as B = L·Ipk/(N·Ae) on its linked core against the material's Bsat, or against its `isat` scaled by `isatTemp`, at 25 °C and hot (`hotC`: 100 °C, or the spec's highest ambient plus `coreRiseK`) | `analysis.stress`, the magnetics catalogue |
| R2 | Thermal: each junction against Tj max; each magnetic part's hotspot (`magneticsHotspotC`) against the hot temperature of R1 | `design.thermal` |
| R3 | Device stress: peak voltage, the same plus the loop overshoot L·di/dt, RMS or average current and dv/dt, against the library device's derated ratings (NASA EEE-INST-002 S1 Table 4: switch 0.75 of the voltage and current, diode 0.70 and 0.50 of the average current; `derating`) | `analysis.stress`, `layout.hints` |
| R4 | Parasitics and layout: each commutation loop's inductance (a routed board via `path`, else your `loopInductance`) against its budget, its ring, and the layout and sensor-placement hints | `layout.extract`, `layout.hints` |
| R5 | Sensing: each sensed signal's worst-case error against the output tolerance (`currentTolPct` for a current), with the filter's bandwidth and delay | `design.senseNetwork` |
| R6 | Protection: the trip and OVP checks, the trip against the switch rating, the trip's response against the fault's rise to that rating (a circuit with no hardware trip is firmware-only: two switching periods), `otpC` against Tj max, `desatResponse` against `tsc` for an IGBT or a switch rated 600 V or more | `design.protection` |
| R7 | Tolerance: every corner of L ± `lTolPct`, C ± `cTolPct` (20 % each) and the spec's input range; the output's widest excursion against its tolerance, the ripple against `ripple.maxPp` | `analysis.worstCase` |
| R8 | EMI and noise: the conducted level without a filter against the class limit; dv/dt pickup into the ADC through `couplingCap` against one LSB; gate-signal dv/dt against the isolation's CMTI | `emi.conducted`, `design.gateDrive` |

A check without the data it needs is `notChecked`, and the row says what it needs (a data sheet's `tsc`, a board, a threshold). Nothing is guessed. A row is `warn` when its margin is under `warnPct` (10 %), `warnK` (10 K) or the EMI target margin, or when only part of it could be checked. With no spec given or stored with the circuit, the review reads the converter's own operating point with a 2 % output tolerance.

```sh
powercraft-cli run --cmd file.openExample --params '{"name": "buck"}' \
  --cmd design.review --params '{"loopInductance": "10n", "senseSupply": 5}'
```

The latest review is kept with the circuit: `report.export` adds it as a **Design review** chapter. The agent panel runs it through `analysis_run`.

### Small tools for assistants

Three read-only commands save an assistant from reading thousands of samples or doing arithmetic by hand. `analysis.diagnoseWaveforms` runs rule-based detectors over the last result (`mode.crossing`, `inductor.saturation`, `oscillation.subharmonic`, `ringing.step`, `gate.overlap`, `diode.recovery`, `startup.inrush` and `device.overstress`) and lists each finding with its evidence, a likely cause and, where the fix is clear, edits you can apply with `circuit.apply`. It also reads a measurement: pass a scope export as `csv` (or `path` under the read root) and a `map` from the signal names the rules read (`i(L1)`, `v(sw)`, a gate signal; or the roles `inductorCurrent` and `outputVoltage`) to its columns, and `fsw` when the circuit has no switching source. The open circuit gives the context (inductance, ratings, the parts a proposal edits). A rule whose signals the capture lacks is skipped and listed under `skipped`, and the thresholds widen with the noise and the 8-bit step measured in each column, so a clean capture raises no finding. `device.overstress` also checks clamps against their own parameters, with no device file: a Zener's current against `izm`, a TVS's against `ipp` and the energy a varistor absorbs against `wmax`, over the whole run; those findings carry a Traditional Chinese `messageZh` too. `waveform.features` gives the mean, ripple, overshoot, settling time and frequency of a signal in one call. `calc.eval` evaluates an expression such as `Vin*D/(fsw*Lf)` exactly.

## After design.auto

The run now covers the magnetics, the robust loop, the firmware, the EMI estimate, the layout hints, the bill of materials and the KiCad project. What is left for you:

1. Read the report, above all `openItems` and `notChecked`.
2. Read the `protection` section for the current sense, the trip point, the blanking, the over-voltage and under-voltage thresholds and the soft-start time. When it was skipped, run `design.protection` yourself where it applies.
3. Look at which device each switch received, before you trust the efficiency and the temperatures.
4. Open the KiCad project, assign any footprint the warnings list, and draw the board.
5. Run `powercraft-cli sim` on the saved circuit with limits of your own (chapter 13).

## A multiphase buck and an LLC with synchronous rectification

For a high-current, low-voltage output, `topology.suggest` ranks the multiphase buck: N synchronous phases, 2 to 8, with their carriers 1/N of a period apart, so the phase ripples cancel in the output (TI SLYT449). The phase count starts at one phase per 25 A, and the ranking adds a phase while it raises the estimated efficiency by at least 0.2 points. The template holds a voltage PID with a duty feed-forward and a current-sharing PI per phase, which pulls each phase to the average current. Each phase current is sampled once a period at its own carrier's start, as a PWM-synchronized ADC reads it, and the average is the mean of those samples, so every phase is compared at the same point of its ripple: sampled at one instant instead, each phase's error carried a fixed part of its ripple, and the six-phase 12 V to 1.2 V, 60 A design split its current from 9.07 A to 10.93 A per phase where each should carry 10 A. The PID's derivative damps the output filter's resonance (Kd = 2ζ/(Vin·ω0), ζ = 0.5, ω0 = 1/√(L/N·C)), which the load alone damps only near full load, so the output holds at light load too: the four-phase 12 V to 1 V, 60 A design swung 0.39 V peak to peak at a 1 A load with the PI alone. The phases still draw pulsed current from the input, so the template draws `Cin`, a ceramic bank from the input to ground, sized for the input ripple (1 % of Vin) from the charge it supplies, Iout·(D − m/N)·((m + 1)/N − D)/fsw with m = ⌊N·D⌋, plus its ESR times the step of one phase current; it carries Iout·√((D − m/N)·((m + 1)/N − D)) RMS.

```sh
powercraft-cli run --cmd circuit.template --params '{"topology": "multiphaseBuck", "vin": 12, "vout": 1, "iout": 60, "fsw": 300000, "phases": 4}' \
  --cmd simulation.run
```

`design.auto` draws it with the ranked phase count when it ranks first (12 V to 1 V at 60 A does), keeps the template's loops (`design.voltageLoop` does not model the multiphase loops), and varies the first phase's inductor and the output capacitor in the worst case.

With a load step (`stepAmps` and `maxDroopPct` in `circuit.template`; `design.auto` passes the spec's `loadStep`), the output capacitor is the largest of what the ripple needs, `ΔI/(ωc·ΔV·2·sin(PM/2))` for a loop crossing at ωc = 2π·fsw/20 (the closed-loop output impedance, Erickson and Maksimovic ch. 9), the inductor slew bound `(L/N)·ΔI²/(2·ΔV·(Vin·Dmax − Vout))`, and the capacitance that puts the LC resonance at or below the controller's zero. The voltage controller is then a PID with its double zero at ωc/4 and its derivative pole at 4·ωc (48° of phase margin), crossing above the resonance: a PI below the resonance cannot hold a VRM-sized step. The bank this asks for at a low switching frequency is large (12 V to 1.2 V, a 30 A step with 3 % dip at 100 kHz needs 32.7 mF), so a higher switching frequency is the lever that shrinks it. The phase-shifted full bridge does the same with a load step: its output inductor `Lf` stands for `L/N`, the slew headroom is `Vin,min/n·(Dmax − ΔD) − Vout` (the bridge cannot raise the effective duty past 0.95 less the duty-cycle loss), and the PID is designed on `(Vin/n)/(1 + s·(Lf/R + Rd·C) + s²·Lf·C)`, where the duty-cycle loss acts as a resistance `Rd = 4·Lr·fsw/n²` (Vlatković et al., IEEE Trans. Power Electronics, 1992). Without a load step it keeps its PI below the resonance.

An LLC rectifies with diodes by default. `rectifier: "sync"`, in `circuit.template` with `llc` and in `design.auto`, draws four MOSFETs SR1 to SR4 instead. A pair turns on when the secondary voltage exceeds the output by `VsrOn` and off when the secondary current falls below `IsrOff`, before it reverses; a pair whose current runs backwards by more than `IsrOff` turns off at once, even inside its minimum on-time `TsrMin`. `design.parts` picks low-voltage MOSFETs for them.

```sh
powercraft-cli run --new '{"name":"llc"}' --cmd design.auto --params '{"spec": {"vin": {"min": 380, "nom": 400, "max": 410}, "vout": 12, "iout": 25}, "topology": "llc", "rectifier": "sync"}'
```

On 380 to 410 V to 12 V at 25 A the full-load efficiency rises from 91.0 percent with diodes to 98.3 percent, with an ideal transformer and no core loss in Lr, so the real gain is smaller. Known limits: the template draws no input capacitor, so the EMI gate fails with diodes and with synchronous rectifiers alike: the sized input filter would meet class B (by 0.2 dB at 151 kHz with synchronous rectifiers), but it cannot go into the circuit, and the gate's next fix says to add an input capacitor or set `spec.emi.apply`. Below about 3 percent load the rectifier may hunt.

## An isolated design

With `isolated: true` the flyback, the LLC and the phase-shifted full bridge are drawn isolated (`circuit.template` with `isolated`). The primary returns to ground `0`. The secondary returns to its own ground `sgnd`, which the schematic draws with its own symbol, an open triangle with the name under it. The two grounds meet only through the transformer, the parts made to cross a barrier, and one documented resistor, `Rtie`. `Rtie` is the simulation's tie: it gives the solver a DC path to the secondary, carries no current because nothing else joins the two sides, and is not fitted on the board (the bill of materials leaves it out). It is 10 kΩ. A bleed resistor's 10 MΩ does not work here: with a floating secondary the solver cannot factor its matrix at 1 MΩ and above, and below that the residual currents of the solution move `sgnd` by the tie's resistance times them (2 mV at 100 kΩ, 0.4 mV at 10 kΩ). The layout puts the primary left of the barrier and the secondary right of it, the crossing parts on it, and draws the barrier as a dashed line from the top of the drawing to its bottom.

**Flyback.** The loop is closed the way an off-line supply closes it, all in the circuit as IC modules (`ic.place`): a UC3843-class peak-current-mode controller `U1` (the `pwmController` IC with the UCx843's numbers, TI SLUS223H) on the primary with the current-sense resistor `Rcs` in the switch's source, a TL431C `U2` and an optocoupler `U3` of the TCET1100 family on the secondary. The controller's FB is grounded, so its error amplifier sources its 0.8 mA limit into COMP, and the phototransistor pulls COMP down against that and the pull-up `Rpull` from the 5 V reference. The TL431's divider `Rup`/`Rlow` sets the output, and its type II network `Rz`/`Cz`, the LED resistor `Rled` (behind the filter `Rfl`/`Cled` when the fast lane alone cannot close the loop) and the bias `Rbias` are the ones the network design chose. It tries each CTR bin of the family in turn, unless `spec.feedback` names one, and takes the first that keeps 45 degrees and 6 dB at every operating corner, at the bin's highest CTR, its lowest CTR and its lowest after ageing (50 percent by default). `Rcs` puts the data sheet's lowest current-sense threshold (0.9 V) at 1.2 times the full-load peak at the lowest input; when no bin closes the loop there, 1.15, 1.1 and 1.05 are tried in turn, since a larger shunt lowers the plant's gain. `design.protection` reads that `Rcs` from the circuit and checks the trip it sets. The bias supply of the controller (`Vcc`, 12 V) and its 5 V reference (`Vvref`) are sources, since the bias winding is not modelled; `GateCmp` turns the switch on while the controller's OUT is high.

The simulation runs the optocoupler at the middle of its bin (the geometric mean of the CTR range, a new part at 25 °C). Each corner of the verification starts at its own operating point: the COMP capacitor at the voltage the controller needs there, and the TL431's capacitors at what the LED current then leaves on them. There is no firmware, so digitalize, codegen and senseNetwork are skipped, and so is gateDrive: the UC3843's own output stage drives the switch. When no bin closes the loop, the closeLoop gate fails with each bin's reason and the run stops. The report's isolatedFeedback section is the network, with its parts named as in the circuit.

**LLC and phase-shifted full bridge.** The controller sits on the primary with the bridge it drives, so its gate signals cross nothing. It reads the output across the barrier through an isolated amplifier, `Uiso` (the `isolatedVoltageSensor` IC, the TI AMC1311 of SBAS786C): a divider of E96 resistors puts 1.2 V of its 2 V linear input on it at the nominal output, the voltmeter `VMiso` reads its differential output on the primary, and the gain `Kiso` scales it back to volts. A synchronous rectifier's gate logic sits on the secondary with its MOSFETs and their current meter. The controlModules stage wraps each side's control into one module, `Ctrl` and `SrCtrl`. The isolatedFeedback stage reports the amplifier, and its divider becomes lines of the bill of materials. Not done: the bridge's gate drive (the high-side switches need a bootstrap or an isolated driver) and the protection; both are open items.

**The report.** The Isolation section names the two grounds, the tie, the parts that cross the barrier and how the control crosses it. The safety stage runs `design.safety`, and the section lists each pair of nets across the barrier with its working voltage and the clearance and creepage, which stay open until the IEC 62368-1 tables are filled in (the cells it needs are listed and are an open item).

Not done: slope compensation for the peak-current controller is in the model the network is designed on (QP = 1), but not in the simulated controller, which a duty cycle below 0.5 does not need. Without `isolated` a flyback keeps its common ground and its PI, and the isolatedFeedback stage designs the TL431 network for the bill of materials only. `file.openExample` with `flybackTl431` opens a hand-designed flyback that closes through both parts in simulation (chapter 10).

## A power-factor corrector from the mains

A spec with `vinAc` instead of `vin` is an AC-input spec, for example
`{"vinAc":{"min":90,"nom":230,"max":264},"fline":50,"vout":400,"pout":500,"pf":0.98,"thd":10}`. The run draws the boost
PFC, sizes the inductor, the bulk capacitor and both loops for the whole line range, and verifies the power factor, the
THD, the ripple at twice the line frequency and the hold-up time at the low, nominal and high line, at light and full
load. The power factor and THD limits hold from half load up (`pqFromLoadPct`); lighter corners are reported for
information. The hold-up default is 10 ms with the DC link above 0.75 of its voltage (300 V for 400 V). The bulk
capacitor meets the ripple and the hold-up at the low end of its 20 percent tolerance: the larger need divided by 0.8,
rounded up to E12 (270 µF for the example).

In the Auto Design window, set Input type to AC mains input. The window then asks for the line voltage (minimum, nominal
and maximum, rms), the line frequency, the output voltage, the output power and, if you want them checked, the power
factor and the input current THD. It builds the same spec, so a spec file with `vinAc` loads into those rows.

The worst case moves the choke L1 and the bulk capacitor C1 by 20 percent each, every corner, at the lowest and at the
highest line. It reports the mean and the ripple of the DC link, the input current (rms) and the input power, each
named with its line voltage (`outRipple@90V`). It is not a gate: compare the ripple with your spec yourself.

The current loop is designed for the firmware that runs it: one switching period from the sample to the new duty and
half a period of PWM, 1.5 periods in all. At a tenth of fsw that delay costs 54° and no PI keeps 45°, so the loop
crosses at a twentieth (46° for the example). The digitalize stage runs `design.digitalize` on both loops, sampled at
fsw in the format of `spec.digital.format`. Its gate is that neither loses more than 10° of phase margin, and it writes
`pc_pfc_current` and `pc_pfc_voltage` C files. The report's `digital` is the current loop, with the voltage loop under
`voltageLoop`. The codegen stage runs `codegen.verify` on the circuit. The continuous blocks (the voltage loop's
integrator and pole, the feedforward filters, the multiplier and the sense pole) are not generated, and its note names
them. The gateDrive stage runs `design.gateDrive` on the switch S1 as a boost from the rectified line's peaks
(√2 times the lowest and the highest line) to the DC link at fsw, turning off the current of the low-line peak
(√2·Pin divided by the lowest line voltage): a low-side driver, its gate
resistors and the VDD bypass, which become lines of the bill of materials. The EMI stage is skipped: there is no input
filter model yet.

**The totem-pole PFC.** Name it in the call, `"topology":"totemPolePfc"` (the default is `pfcBoost`). The run sizes the
same inductor, bulk capacitor and loops, then draws the bridgeless totem-pole instead of the diode bridge: a fast leg
S1 over S2 switching at fsw and a slow leg S3 over S4 at the line frequency. A comparator on the line voltage gives the
polarity: in the positive half cycle S4 ties the mains return to the DC negative rail and the PWM drives S2, in the
negative half cycle S3 ties it to the DC link and the PWM drives S1; the other fast-leg switch rectifies through its
body diode. The duty and the plants are the boost PFC's, so the loops are too. The design values drop the bridge's and
add `Vleg` (every switch blocks the DC link), `IfastRms` and `IslowRms` (Ipk/2 each). In continuous conduction the
fast leg needs GaN or SiC switches without body-diode recovery; the design notes say so.

**Harmonic limits.** `"harmonics":"classA"` or `"classD"` checks each harmonic of the input current, 2 to 40, against
IEC 61000-3-2:2018 (Table 1 for Class A in amperes; Table 3 for Class D in milliamperes per watt of input power, capped
by Class A). The verification adds a `harmonics` row: the harmonic nearest its limit, in percent of the limit (100 is
the limit), at the corners the power factor and THD limits hold at; each corner names that harmonic
(`harmonicOrder`) and lists every limited order (`harmonics.orders`: `currentA`, `limitA`, `pctOfLimit`). Class D covers 75 W to 600 W of input power, and the row's note says when the design is outside
it. The limits are written for the rated 230 V, 50 Hz input; equipment above 16 A per phase falls under
IEC 61000-3-12. For a three-phase input of 16 to 75 A per phase, `"harmonics":"iec61000-3-12"` (written out as
`{"standard":"iec61000-3-12","rsce":33}`; name a larger `rsce` for a stiffer supply) holds each phase to
IEC 61000-3-12:2011 Table 3, the limits for balanced three-phase equipment: I5, I7, I11, I13, THC and PWHC, and 16/h %
for each even order up to 12, in percent of the reference current (here the phase's rms input current at the corner).
An Rsce between two rows of the table is interpolated linearly, as its note allows; Rsce 33 is the smallest row.
Each corner lists every quantity on the phase nearest its limit (`harmonics.terms`: `term`, `phase`, `pctOfIref`,
`limitPctOfIref`, `pctOfLimit`). Table 2 (single-phase equipment), Tables 4 and 5 (balanced three-phase equipment
under specified conditions) and Table 6 (hybrid equipment) are not checked.

**The schematic.** A PFC run hands the circuit over grouped into blocks (the `blocks` stage, `circuit.groupBlocks`):
the power stage and the controller are separate subsystems joined by net labels. `"auto":{"blocks":false}` keeps it
flat.

## A dual active bridge

Name it in the call: `"topology":"dab"` with a DC spec, for example
`{"spec":{"vin":[360,440],"vout":200,"iout":20,"ripple":2},"topology":"dab","fsw":"50k"}`. The ranking does not pick
it on its own. The template draws two full bridges around the series inductance Lk and an ideal transformer with
n = Vin/Vout at the nominal input. Lk gives the full power at a phase shift of 30 degrees from the lowest input
(P = n·V1·V2·φ·(π − φ)/(2π²·fsw·L), De Doncker, Divan and Kheraluwala 1991), so the higher inputs need less. A PI on
the output sets the single phase shift, added to the nominal shift as a feed-forward: the secondary current does not
depend on the output voltage, so the plant is Gφ·R/(1 + s·R·C) with Gφ = n·Vin·(π − 2φ)/(2π²·fsw·L) (Kheraluwala et
al. 1992), and the loop crosses at a twentieth of fsw with the PI's zero at a quarter of that. The loop reads the output once a switching period: read continuously, the output ripple moved the phase shift within each period and left a DC current in Lk that grew until the output collapsed. The PI may take the
shift to ±90 degrees; a negative shift moves power back to the input. The spec's load is a resistor, so the
verification checks the forward direction. The reverse stage then runs copies of the finished circuit backwards, at the
lowest and the highest input: the load becomes a current source feeding the full-load current into the output, as a
battery discharging into the bus. Its note gives each copy's output, phase shift and the power back to the input; the
200 V, 20 A example holds 199.9 V at −37° (360 V) and −29° (440 V), and about 98 % of the power reaches the input.
A copy that misses the output tolerance is an open item, not a failed gate, since the spec asks for no reverse power;
the reply's `reverse` has the numbers. The closeLoop and voltageLoop stages keep the template's PI (as for the phase-shifted
full bridge); the magnetics stage designs Lk and the transformer, and the worst case moves Lk and the output
capacitor by their tolerance.

## A non-isolated bidirectional converter

Give `"bidirectional":true` beside the spec, for example
`{"spec":{"vin":[36,60],"vout":12,"iout":10},"bidirectional":true}`. The ranking then drops every topology whose power
flows one way only, so a step-down spec gets the synchronous buck and a step-up one the synchronous boost: their
second switch is a MOSFET, so the inductor current may reverse and the same half bridge boosts from the output back to
the input (TI SLVA390). The run designs and verifies the forward direction as usual. After the worst case the reverse
stage runs copies of the finished circuit backwards as it does a dual active bridge: at the lowest and the highest
input, a current source feeds the full-load current into the output. Each copy starts at the forward operating point,
so its loop takes a step of twice the full-load current, and the copy runs 16 times the verification's length for the
output to settle. The 36–60 V to 12 V, 10 A example holds 12.0 V at both inputs (within 0.13 %) with 94.7 % (36 V)
and 95.8 % (60 V) of the power reaching the input. When the output lies inside the input range, the ranking keeps the
four-switch buck-boost: both of its legs are synchronous half bridges (LTC3780 data sheet), so it gets the same
reverse copies. The 9–16 V to 12 V, 2 A spec holds 12.0 V at both inputs with 95.9 % (9 V) and 97.9 % (16 V) of the
power reaching the input. At a current one phase cannot carry, the ranking keeps the interleaved buck, drawn as the
multiphase buck: each phase is a synchronous half bridge with its own high- and low-side gate (TI SLYT449), so it gets
the reverse copy too. Its template's voltage loop is a PID whose derivative damps the output filter, which the load
alone does only near full load, so the copy holds the output with the full-load current fed in: the 12 V to 1.2 V,
60 A spec holds 1.200 V (0.001 %) with 91.0 % of the power reaching the input. A copy that misses the output tolerance is an open item; the reply's `reverse` has the numbers, without
a phase shift.

## A three-phase inverter

A spec with `vdc` instead of `vin` is an inverter spec: `grid {vll|vln, f}` for a grid-tie inverter or
`acOut {vll|vln, f, tolPct}` for a standalone AC output, with `pout`, `pf {min, capability}` (grid only), `thd` (a
standard: `ieee1547`, the grid's default, is 5 % total rated-current distortion of IEEE Std 1547-2018 Table 26;
`iec61727` is 5 % current THD at rated output of IEC 61727:2004 Table 1; `ieee519`, an AC output's default, is 8 %
voltage THD of IEEE Std 519-2014 Table 1; or `{maxPct}`), `fswRange`, `ripple`, `filter` (`lcl` or `l` for the grid,
`lc` for an output) and `rideThrough {residualPu, duration, maxCurrentPu}`, every value of it from the standard you
cite. For example `{"vdc":[750,850],"grid":{"vll":400,"f":50},"pout":10000}`.

The run draws a two-level bridge. The bridge inductor L1 = Vdc,max/(6·fsw·ΔI) with ΔI 20 % of the peak current; the
LCL filter follows Liserre (2005) and Reznik (2014): the filter capacitor is 5 % of the base capacitance, the
grid-side inductor gives the attenuation of the switching ripple, and the damping resistor is a third of the
capacitor's impedance at the resonance. The control is a dq current PI with an SRF-PLL on the grid (a dq voltage
loop for an AC output), its crossover searched for the margins over the damped plant, and it is wrapped in the
subsystem `controller` (instance `Ctrl`), joined to the power stage by labels. Then magnetics, the verification,
parts, efficiency, thermal, stress, the worst case, the gate drive, protection, layout, BOM and KiCad.

`spec.verify` and the Test Bench take the same spec on the circuit the run drew (they need its variables `Vdc`,
`Pref` and `Qref`). The corners are the link min and max by the power min and max at unity power factor, plus the
capability corner; the rows are `thd` as the standard measures it, `powerFactor` (grid) or `regulation` (output),
`ripple`, `efficiency` and, with `rideThrough`, the peak bridge current through the sag (chapter 18 lists the Test
Bench cases). Like the rest of `design.auto` it runs on Voltecx Cloud.

## Auxiliary rails

Real boards need more than the converter's output: 3.3 V for the MCU, a 15 V gate-drive bias, a quiet rail after the
switcher. With `spec.auxRails`, `design.auto` adds them with linear regulators, after the EMI stage and before the
layout:

```json
"auxRails": {
  "rails": [{ "name": "V3P3", "vout": 3.3, "iout": 0.1, "from": "vin", "sourceRipplePp": 0.2 }],
  "postRegulator": { "vout": 3.3, "iout": 0.2 }
}
```

- **The part.** Each rail takes the first LDO of the catalogue that passes every check, fixed outputs before
  adjustable ones: TI LP5907, TI TPS709, Microchip MCP1754S, TI TPS7A16, TI TLV767, TI uA78L05 and uA78L15. Every
  value (dropout, PSRR points, quiescent current, RθJA, the junction limit, the input and output capacitors) cites the
  data sheet's document number, revision, table and page. PSRR points read off a typical curve say so.
- **The checks.** The lowest feed less the rail must cover the data sheet's dropout at the rail's load. The feed must
  stay within the recommended input range. The switching ripple on the feed, through the PSRR at the switching
  frequency, must stay within the rail's ripple limit; the PSRR is interpolated between the data sheet's points and
  never extrapolated, so a switching frequency past the last point, or a vin feed with no `sourceRipplePp`, is
  reported as information. The junction must stay within the recommended range at the highest feed, full load and
  the spec's hottest ambient (40 °C when the spec names none). Rails fed from the output add their load to the
  converter's, so `iout.max` must cover them.
- **Refused early.** A rail at or above the lowest voltage it is fed from is refused before the run, with the rail
  named: no linear regulator can step up.
- **Schematic first.** The LDOs go in as the `ldo` IC with the picked part's values, with their input and output
  capacitors and EN tied to IN, all in one subsystem `AUX_RAILS` (instance `XAUX`) below the power stage. Each rail is
  drawn as a net label at the subsystem's pin. Enter the subsystem to see the regulators.
- **Bill of materials and report.** `U_<rail>` is the LDO with its data sheet, and `Cin_<rail>` and `Cout_<rail>`
  are catalogue capacitors that hold the data sheet's value at their DC bias. The report's "Auxiliary rails" section
  lists each rail with its part, dissipation, junction temperature and PSRR, every check, and the notes.
- **What it does not do.** The rails are checked on paper; the converter's simulations do not include them. An
  adjustable part's feedback divider is not designed: its data sheet gives it.

## Limits

- `design.auto` draws and designs a buck, a synchronous buck, a boost, a synchronous boost, a buck-boost, a SEPIC, a flyback, an LLC (with diodes or synchronous rectifiers), a phase-shifted full bridge, a dual active bridge (named in the call) and a multiphase buck, and a four-switch buck-boost (named in the call). It closes the loop of every one of them except the LLC; the phase-shifted full bridge and the dual active bridge bring their own loops. From an AC-input spec it designs a boost or totem-pole power-factor corrector, and from an inverter spec a three-phase inverter (the sections above). For anything else, the design is the template's starting point, and the open items say so.
- The vendor device library is small. A passing design with generic devices shows that the structure works, not that a given part will.
- A pass is a pass of the checks in your spec. It is not a safety or compliance result. Read the not-checked list every time.
