# 2. Your first circuit

This chapter gets a buck converter on screen three ways. Start with the first one, which takes a minute. The other two show how to make your own circuit.

## When the app starts

While Voltecx loads, a launch screen shows the version and a progress bar. Its status lines are the real start-up steps and what each one read: the circuits restored from your last session, the parts in the device library, the cores and materials of the magnetics catalogue, the example circuits and the lessons. It closes by itself as soon as loading is done (it stays at least 0.6 s so it does not flash), and any key or click closes it at once. It is not shown when you open a file by double-clicking it, with `--no-session`, in a new window or when the app is driven over its control channel. **Edit > Preferences > Show launch screen** turns it off, and **Reduce motion** (or the system's own Reduce motion setting) keeps its artwork still.

With no circuit open, the editor shows the **Start page** across the whole window beside the activity bar, whose **Start** item marks it. The side bars and the dock stay out of its way until a circuit opens, or until you open one from the activity bar while the page shows:

![The Start page, marked 1 to 5](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/start-page/01-start.png)

1. **The button row.** **Open and run an example** opens Help > Examples. **New circuit**, **Open file** and **Import PSIM, PLECS or SPICE** are the same as the menu items; hover one for its shortcut, or for the file kinds Import reads.
2. **Examples** shows four example circuits as cards, each with its schematic, its title and a line of specs (kind, input to output, switching frequency); click one to open and run it. **All N examples** opens Help > Examples.
3. **Design a converter from a spec**, marked **CLOUD**: **Design from spec** opens Auto Design (chapter 16), which runs on Voltecx Cloud and opens the designed circuit here. Beside it, the **Ask the assistant** card takes a request in a sentence (click an example request under the box, then **Design it** or Enter); the agent (chapter 12) asks what is missing and runs automatic design. Without an API key the card says what the agent needs, with **Add an AI key** (it opens Preferences at the AI Assistant section).
4. **Recent** lists your recent files across the page, each with its folder and how long ago it changed (**2 h ago**, **Yesterday**, then the date). The file of your last run shows the time of the run; hover it for one signal's mean and peak-to-peak over the end of the run. Click a row to open the file.
5. The footer has **Tutorials**, **Keyboard Shortcuts** and **What's new** (the release notes), and **Show at launch**, which turns the page off (also in Preferences); the editor then shows an empty canvas with one line: **File > New Circuit** and its key start a circuit.

On a first launch, once you accept the terms, a five-step **tour** points at what to do first: open an example, move around and edit the canvas, run it, read the results, and design a converter with Auto Design. The keys a card names are the ones your keymap binds, Classic or Default, and follow any key you changed. Each card has **Back**, **Next** and **Skip tour** (or **Esc**). A step you already did is marked done and skipped: running before step 3 jumps to step 4. The tour waits while a dialog is open, and it never starts in a window a script or an agent opened. **Help > Tour** replays it.

For more than the tour, click **Guided Lessons** in the activity bar. A lesson lists its steps with a progress bar on top. The open step says in one sentence what it does and shows the values it uses as chips (12 V in · 3.3 V out · 5 A). Its button does the step for you, with those values: it places the parts, sets the stop time, runs the simulation, or opens Auto Design with the spec filled in. **Show me** outlines the toolbar button or panel the step uses, if you would rather do it yourself. The lesson watches for the result: the step reads "Waiting for: …" until it happens, then shows a green check, and only then is **Next** enabled. **Skip this step** moves on anyway, and **‹ Lessons** goes back to the list.

After an upgrade, a note under the heading says what version you have, with **What's new** and **Dismiss**. In a narrow window the example cards go two to a row and the Cloud and assistant cards stack. Over an open circuit, **View > Start Page** or the **Start** item shows the page, and the same item takes you back to the circuit.

## The window

| Area | What it is |
|---|---|
| Top | Menu bar, and under it the toolbar: New, Open, Save, Undo, Redo, Run and Stop, and the zoom. Hover a button for its name and keys. **View > Toolbar** hides it; the menu bar then shows its own **Run** button. |
| Above the schematic | One tab per open circuit: its name, the file it came from (marked *imported* when that is not a `.voltecx` file), a dot while it has unsaved changes, and a number when two tabs would read the same. Click a tab to switch. |
| Left | The part library, sorted by kind. Click a part to place it. The search box filters the list. Hover a part for its **Guide** button, or press **F1** over it, to open its component guide. |
| Centre | The schematic. **View > Tool Dock** floats the tool dock at its foot (off by default; every tool also has a key): the tools (Select or Pan, Wire, Probe, Net Label, Text; the one in use is filled with the accent colour); chapter 3. Under the schematic, the optional parts bar: the most used parts as symbol icons, one click each. It is off by default; **View > Parts Bar** shows it. |
| Right | The secondary side bar, with two tabs: **PROPERTIES**, the parameters of the selected part, and **ASSISTANT**, the agent (Cmd+L, chapter 12). Selecting a part opens it on Properties. Each parameter has a small **?**: hover it for one sentence about the parameter, click it to open that parameter in the component guide. Hide or show the bar with Cmd+Alt+B or its ×. |
| Bottom | The dock: the scope (results and measurements), the Problems list and the Design panel, one tab each. |
| Very bottom | The status bar, with the latest message, the simulation state and the zoom. |

![The window, marked 1 to 8](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/first-circuit/01-window.png)

1. Menu bar.
2. Run.
3. The circuit tab.
4. The part library.
5. The schematic.
6. Properties.
7. The dock with the scope.
8. The status bar.

## The component guide

Every part has a guide: **Help > Component Guide**, **F1** (over a library row, or with a part selected), the **Guide** button of a library row, or the **?** beside a parameter. On the left is an index of every part with a search box. On the right is the part's page:

- **The symbol with its named pins**, a one-line summary, and two buttons: **Place** puts the part in the circuit, and **Open example** opens a small circuit that shows it at work.
- **Use for** and **Not for.** Each "Not for" entry links to the part to use instead. For example, the capacitor's page points bulk energy storage to the supercapacitor.
- **Parameters**, as Symbol, Meaning, Default and Unit. The symbol is the name scripts and agents use. A default in red is required: the run stops until you set it. Hover a row for the whole description and the typical range. The rest are under **More parameters**.
- **Formulas**: the key equations for the part, each with the textbook or standard it comes from.
- **Quick check**: a small calculator for those formulas. Its fields start at the values of the part you selected, or at a typical example. Change any field and the results update at once. Values take engineering notation (`470u`, `2.2k`).
- **Model logic**: what the simulator actually does with the part, such as what it stamps, how it starts, and what "off" or an unset value means.
- **How it works**, **More parameters** and **Tips** start closed.

Formulas, the quick check and the model logic cover the 40 most used parts so far: the passives, sources, switches and diodes, magnetics, the PI, PID, transfer-function, PWM and other basic control blocks, and the meters. The other parts have the rest of the page. Agents read the same data: `component.describe` returns the formulas, the quick check and the model logic, and `component.quickCheck {"component": "C1"}` computes the quick check from a placed part's values.

## Way 1: open a built-in example

1. Choose File > Open Example > DC-DC > Buck converter (the example `buck`). The example is a 48 V to 12 V converter at 100 kHz.
2. Press **F5** (or the **Run** button). The status bar shows `simulating...`, then the scope fills with waveforms.
3. The scope's **Measurements** row shows mean, RMS, min, max and peak-to-peak for the signals it shows.

After the start-up transient, `v(out)` averages close to 12 V (that is D times Vin). If you see that, the whole chain works: the model, the solver and the scope.

The other examples are `rc`, `rl`, `rlc`, `rectifier`, `buckClosedLoop`, `boost`, `halfBridge`, `inverter3`, `flyback`, `buckThermal` and `inverter3Thermal`, and the motor drives `imVf`, `imIfoc`, `pmsmFoc`, `pmsmSmo` and `dcMotor` (chapter 10). Open them the same way.

## Way 2: ask for a converter by specification

The command `circuit.template` builds a new, laid-out circuit from a few numbers. It sizes the inductor and capacitor from textbook equations and tells you which formulas it used.

1. Press **Cmd+K** to open Quick Open. Type `template` and choose **Circuit From Template**.

   ![Quick Open with Circuit From Template, marked 1](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/first-circuit/02-palette.png)

   1. **Circuit From Template**.

2. A form opens. Pick the topology, type the numbers (input voltage, output voltage, output current, switching frequency) and press **Run**. The other fields have defaults. The parameters it builds are the same as this JSON:

   ```json
   {"topology": "buck", "vin": 48, "vout": 12, "iout": 5, "fsw": 100000}
   ```

3. A new circuit opens. Press **Cmd+0** to fit it to the window, then **F5** to simulate.

Topologies: `buck`, `boost`, `buckBoost`, `halfBridge`, `fullBridge`, `inverter3`, `flyback`, `rcLowPass`, `rlc`. Optional keys: `ripplePct` (inductor current ripple, default 20 %), `vripplePct` (output voltage ripple, default 1 %), `fout` (inverter output frequency), `name`.

The values in the new circuit are circuit variables (`Vin`, `D`, `fsw`, `Lf`, `Cf`, `Rload`). You can change one place and sweep it later (chapter 6).

## Way 3: draw it yourself

This small example is an RC low-pass filter: a 10 V source, a 1 kohm resistor and a 1 uF capacitor. The same steps build any circuit.

1. **File > New Circuit** (Cmd+N) makes an empty circuit.
2. Place the parts. Move the pointer over the schematic and press a part key, or click the part in the library (**Cmd+B** shows it):
   `V` places a DC voltage source, `R` a resistor, `C` a capacitor, `G` a ground. These are the keys of the Classic keymap, which a new installation uses; in the Default keymap they are `Shift+V`, `Shift+R`, `C` and `Shift+G` (chapter 3).
   A key or a click in the library puts the part on the pointer: click on the schematic to put it down there, or press **Esc** to drop it.
3. Drag the parts to arrange them (or select one, press **Shift+M**, move the pointer and click). They snap to the grid.
   Press **Cmd+R** to rotate the selected part a quarter turn, **X** to mirror it. Right-click a part to see these actions and their keys.
4. Wire them (chapter 3 has the details): press **W**, click one pin, then click the pin it should join.
   Join `V1.p` to `R1.p`, `R1.n` to `C1.p`, and `V1.n` and `C1.n` to the ground. The ground is net `0`, and every circuit needs one.
5. Set the values. Click a part, then use the Properties panel on the right (double-click a part to open it).
   Type `10` for the source voltage, `1k` for the resistor and `1u` for the capacitor. Press Enter or click away to commit a field.
6. Choose **Simulation > Settings**. Set **Stop time** to `5m` and **Max time step** to `1u`, and press **Apply and run**.

   ![Simulation Settings, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/img/en/first-circuit/03-settings.png)

   1. Stop time.
   2. Max time step.
   3. Apply and run.

7. Press **F5**. The scope picks its first traces itself (chapter 5): the voltage of the node between R1 and C1 is among them, next to the currents. Signals are named after nets, so the wire tool's automatic name appears as `v(n1)` or similar. To show a signal yourself, press **Shift+P** and click the wire between R1 and C1, or tick it in the scope's **Signals** list. You should see the capacitor charge toward 10 V with a time constant of 1 ms.

Every step is undoable (**Cmd+Z**). Save with **Cmd+S**. Voltecx saves a `.voltecx` file, which is plain JSON text. A `.pcraft` file from an older version opens the same way. If the app closes before you save, it offers to restore your unsaved work at the next start (chapter 14).

## The same thing from the terminal

```sh
powercraft-cli run \
    --cmd file.openExample --params '{"name":"buck"}' \
    --cmd simulation.run   --params '{"solver":"fast"}' \
    --cmd scope.measure    --params '{"signals":["v(out)","i(L1)"],"t0":"3m"}' \
    --out buck.voltecx
```

Each command prints one line of JSON. `scope.measure` returns min, max, mean, RMS, peak-to-peak and last value for every signal. The file `buck.voltecx` opens in the app (`powercraft buck.voltecx`).

## If something goes wrong

- **The scope is empty.** You have not run the simulation yet (press F5), or no signal is ticked: press **Shift+P** and click a wire, or tick one in the **Signals** list.
- **An error appears in red in the status bar.** It is one plain sentence; hover it for the full text, or click **Details** to open Problems (or the Console, which prints the full message). It goes away after your next successful edit or after about 8 seconds. Chapter 8 explains the common ones (a floating pin, no ground, a singular matrix).
- **The scope says "Results out of date · Re-run (F5)".** The circuit changed after this run. Hover the pill to see what changed (for example `R1.r 1k→2k`), and click it, the **Out of date · Re-run** item at the left of the status bar, or press F5 to run again.
- **The run is slow.** Lower `tEnd`, raise `maxStep`, or switch to variable step (chapter 4).
