circuitRF Reference Guide

Tuning

A slider on any value in the design, and every Data Display following it as you drag.

What tuning is for

The Tuning panel puts a slider on any value you pick: a component parameter, a VAR row, or a parameter of a sub-circuit instance. Press ▶ and every move of a slider re-simulates the schematic, with every open Data Display bound to its results redrawing. Nothing in the schematic changes until you Push.

The panel is tabbed behind Analyses, and the Optimizer is tabbed behind it (both are also under View ▸ Panels). Like the Analyses panel, it follows the focused schematic: focus a schematic and its tuned values appear; focus anything else and the panel says Focus a schematic to tune it. A Data Display taking focus while tuning is running keeps the panel, because that is where you are watching the results.

StabilityAndGain.csch Presets Rstab 2 Ohm 1 3 lin Rshunt 1000 Ohm 20 2000 log mag(Zs) 50 Ohm 10 200 log phase(Zs) 0 deg -80 80 lin StabilityAndGain.csch Presets Rstab 2 Ohm 1 3 lin Rshunt 1000 Ohm 20 2000 log mag(Zs) 50 Ohm 10 200 log phase(Zs) 0 deg -80 80 lin
The Tuning panel on the Optimization example's amplifier: the two stabilizing resistors and the magnitude and phase of the complex source impedance, each slider at the schematic's value with its range under it.

The Tuning and Optimization example (File ▸ New ▸ Examples) has three benches already set up for this.

Choosing what to tune

Three ways in, all of which add the same entry:

What can be tuned. A value that is a plain number, with or without a unit — 47, 47 pF, 1.2e-9 — and a complex number written with numbers only (below). A value that is an expression is not offered at all, not even greyed: W=Wvar*2 has no tune toggle. Tune the VAR it reads (Wvar) instead, and everything that reads it follows.

A row: the slider, the value and the range

Each row has a slider, a box holding the current value, the unit, and the range under the slider.

A vendor part's row (C1.Part) steps through real parts rather than values: the box holds the part number and the value is shown beside it. Under the slider are the bounds on the parts' stated value and how they are chosen, the same kind or a search, and below that the number of candidates and their value span. ⋮ chooses Same kind or Search the library…, or clears the bounds. See vendor part libraries.

One range per value, for both panels. The Optimizer's variables are the same entries: a range changed in either panel is changed in both.

Digits. The button at the right of the header sets how many significant digits a tuned value is written with — 3, 4, 5, 6 (the default) or all of them. The value is simulated and pushed exactly as shown. The choice is saved with the schematic and applies to the Optimizer panel too.

While a session runs, the canvas draws each value that differs from the schematic in the tuned colour.

The schematic's value wins when it changes. A Push from the Optimizer or the Yield panel, or a value typed into the schematic, moves that row's slider to the new value. Running the Optimizer on the same schematic stops the session without writing its result, because the run's result replaces what the display shows. The sliders keep their values, and ▶ starts tuning again from them.

Complex values: tuned by their parts

A value written as a complex number made of numbers only — 40+15j, 50-j10, complex(40,15) or polar(42.7,20.6), with or without a unit after it — is tuned by its parts, never whole. When you pick one, from +, the Properties toggle or the canvas menu, you choose which part:

Part Row key Moves
Real real(Zs) the real part, holding the imaginary part
Imaginary imag(Zs) the imaginary part, holding the real part
Magnitude mag(Zs) the magnitude, holding the phase
Phase phase(Zs) the phase in degrees, holding the magnitude

Add as many parts as you like. Real and imaginary together, or magnitude and phase, cover the whole number. Any other mix also works — real with magnitude, say — and each slider still moves only its own part, holding its partner in the same coordinate system. Every other row of that value then shows where the number has gone.

Every part's range always holds, together. A slider stops where it would take the number outside the range of any of that value's rows — including a row you are not tuning but have a range for. A range edit that would leave no complex number inside every one of that value's ranges (a typed bound, Re-centre, Reset, the first activation's guessed range) is refused, and the status line names the other ranges. A phase's default range is ±90° around its value and is always linear; a phase range wider than 360° is an error.

A complex value that reads a name, such as 4+j*X, is an expression and is not offered: tune X. A plain 50 is a real number and offers no imaginary part. To tune its imaginary part, write it 50+0j.

Push writes the value whole, in the form it was written. A value written polar(50,0) Ohm comes back as polar(42.4,21.3) Ohm, not as a rectangular number.

Start, Stop, and when the display is behind

Nothing is simulated until ▶. While tuning runs:

■ Stop ends the session and writes the last result shown as the schematic's results file, marked as coming from tuned values and which ones. Closing the schematic, Revert and Push also stop it.

Snapshot: before and after on one plot

Snapshot keeps what every display is currently showing for this schematic as faded copies of its traces. Keep tuning and the live traces move away from them. Clear snapshot removes them. Snapshots last for the session and are never saved. A table has no ghosts.

Tuning a schematic simulated by EM

When an analysis is simulated by EM of the schematic's layout, the sliders still drive the circuit models: a move costs milliseconds, not an EM solve.

Push and Revert

Push writes the tuned values into the schematic as one undo step per document: the tuned schematic for its own values and its instances' values, and each sub-cell's schematic for values that live in it. A sub-cell that is not open is opened as a tab without taking focus, so its unsaved change is visible and goes through the ordinary save prompt. Push skips a read-only cell and says so.

Revert returns every slider to the schematic's value. Until you Push, the schematic is unchanged.

Presets

A preset is a named set of values stored in the schematic.

Last tuned. Saving or closing the schematic while the sliders differ from it keeps their values as the preset Last tuned, at the top of the list. There is only ever one: it is overwritten each time. Closing then asks whether to save, as for any other change. Rename it to keep it, and the next save starts a new Last tuned.

What is stored, and where

The tuned values' rows, their ranges, the presets, the goals and the optimizer settings are stored in the schematic being tuned — the test bench's .csch, even for values that live in a sub-cell. A change to any of them marks the schematic changed and can be undone. Extracting a netlist carries them as tune and preset lines (circuitrf reference tuning lists every key). The tuned values themselves are not stored until you Lock in, Push, or save with Last tuned.

See also: Optimization · The Data Display · Simulations · Expressions.