Simulate and measure
11.1Watch a circuit run, slow it down or pause it
See a fast signal move at a speed you can follow.
- Press Ctrl+R to run or pause the live simulation.
- Choose a speed: 1 1 ms/s, 2 10 ms/s, 3 100 ms/s, 4 real time. Or type a timebase in the toolbar, such as
20u.You should seeThe scope always shows the last 6 real seconds, so at 1 ms/s it spans 6 ms of circuit time. - Paused, press . to advance one timestep.
- Press Ctrl+Shift+Backspace to restart at t = 0, from the circuit’s start state (a new circuit: capacitors empty).
ResultA 1 kHz signal at 1 ms/s draws one period per second. Use 1 for switching converters, 2 for mains and audio, 3 for RC charging, 4 for thermal and battery circuits.
See alsoTimebase and speed.
11.2Start a circuit from rest or from the operating point
Choose whether the live simulation shows the start-up, a capacitor charging from empty, or begins already settled.
Before you startAn open circuit with a capacitor or an inductor in it.
- Open the menu and look at Start at rest (power-on).You should seeA tick means the circuit starts at rest: 0 V everywhere, capacitors empty. A circuit made with File → New is ticked. Examples and older files aren't.
- Choose it to change the tick.You should seeThe simulation restarts at t = 0. At rest, a first RC charges on the scope. Unticked, the same circuit sits at its DC operating point from the first instant. A message says which one you got.
- To start one part somewhere else, select the capacitor or inductor and click All N parameters. Type a value in Initial voltage (capacitor) or Initial current (inductor).You should seeThe circuit starts with that value instead.
- Press Ctrl+Shift+Backspace any time to start again the same way.
ResultThe choice is saved in the circuit file. It changes the live simulation only. Simulate (F5) starts from the operating point unless the circuit asks for initial conditions.
| If you see | Do this |
|---|---|
| A capacitor shows 0 in Initial voltage but starts charged | Without an initial value a part starts from the operating point when the circuit doesn't start at rest. The field shows 0 until you set one. |
| After setting one initial value every other capacitor also starts at 0 | Setting any initial value, even 0, makes the whole start use initial conditions, as uic does in SPICE. |
See alsoStart at rest or from the operating point, Settings saved in the circuit, How a run starts.
11.3Probe a signal and read it on the scope
Plot a voltage or a current live, and keep it for every analysis and the report.
- Press P (probe tool).
- Click a wire for the net voltage (not the label itself), near a pin for that pin's voltage, or the body of a two-pin part for its current.You should seeA trace named like
V OUTorI R1appears on the scope, with its latest value in the header. - Press Esc to stop probing.
- Hold the pointer over the plot to read every trace at that instant.
ResultProbes are saved in the circuit. Simulate and the analyses plot them, and the report includes them. On an isolated side the probe is against that side’s own ground and says so, V OUT (ISO2). Shift+click reads against GND, V OUT (vs GND).
| If you see | Do this |
|---|---|
A probe named after a pin, like V C1 pin 1 | The net has no name. Label it (N) and probe the label. |
| "… already shows this net" and nothing new on the scope | That net or current is already probed. Its probe is selected and flashes on the canvas. |
See alsoAdding probes, The scope menu.
11.4Measure time, amplitude and frequency with cursors and stats
Read a time difference, a level or a frequency off a plot.
- Click Cursors in the dock header, or in the Analysis view's toolbar.You should seeLines A (solid) and B (dashed), with a readout.
- Drag A and B to the two points.You should seeThe readout gives the time at each, Δ, 1/Δ in hertz, and each trace's value at A and B.
- For levels, right-click the scope and choose Show stats.You should seeMax, Min, Avg, RMS, P-P, Freq and Duty for each trace over the visible window.
- For a steady picture of a periodic signal, choose Rising edge under Trigger in the same menu.
ResultThe same cursors work in the scope, the Bode and FFT tabs and the Analysis view.
11.5Run a transient with Simulate
Get a result you can measure, from t = 0 to a stop time, with vendor models where the circuit has them.
Before you startProbes on the signals you want (P).
- In the toolbar, set Simulate for (the stop time), for example
5m. - Set max step, for example
1u. Use a tenth of the fastest edge you care about. - Press F5.You should seeThe view splits: the schematic on top, the Analysis view below. The Simulate button shows the percentage and Cancel while it runs.
- Hold Alt and click a net or a two-pin part on the schematic to add its trace. A plain click only selects.
ResultSignals against time, ready for cursors, Export CSV and PNG. BetterSPICE chose the engine: the progress line says when it used ngspice or PSpice.
| If you see | Do this |
|---|---|
| A red banner Simulation failed: | Read the reason and press Dismiss. Models and the library lists the usual ones. |
| Edges look rounded | Lower max step and run again. |
See alsoSimulate (F5) and its engines, Transient.
11.6Find the frequency response and the phase margin
Plot gain and phase against frequency and read the −3 dB point and the margins.
- Press F7.You should seeThe first time, Simulation setup opens on the AC sweep tab. Once the circuit has an AC setup, F7 runs it at once and F6 opens the setup.
- Check Input source: the source that gets the 1 V small-signal stimulus. Its pick button lets you click the source on the schematic instead.
- Set the range, for example
1Hz to1MegHz, and Points per decade. - Click Run AC sweep, which also saves the setup.You should seeA Bode plot of every probe. The strip above it gives the −3 dB frequencies and, for a loop, the gain crossover, the phase margin, the phase crossover and the gain margin.
ResultA phase margin under 45° and a gain margin under 6 dB show in amber. The Bode tab in the dock keeps the last sweep.
| If you see | Do this |
|---|---|
| No margins in the strip | Margins need a loop gain that crosses 0 dB. Probe the loop, not the closed-loop output. |
| Unknown source | Choose one of the circuit's sources. The message lists them. |
See alsoAC sweep, Tutorial 2: Measure it exactly.
11.7Sweep a part value and compare the curves
Run the same analysis for several values of one parameter, overlaid.
- Press Shift+F7. The first time it opens the setup on the Parameter step tab. Later it runs the saved step.
- In Parameter, type the part and key, for example
R1.rorC1.c. The keys are in the device tables. - In Values, type up to 12 values separated by commas, for example
500, 1k, 2k, 4k. - Choose the analysis in Analysis to repeat: Transient, AC sweep or DC sweep.
- Click Run parameter step.You should seeOne curve per value, named like
V OUT · R1.r = 2k.
ResultEach run uses the setup on its own tab. In the browser the values run in parallel.
| If you see | Do this |
|---|---|
| "X has no value "key", its values: …" | Use one of the keys the message lists. |
See alsoParameter step.
11.8Plot a transfer curve with a DC sweep
Sweep one source slowly and plot the steady result at each value.
- Press F8. The first time it opens the setup on the DC sweep tab. Later it runs the saved sweep.
- Choose the Swept source: a DC voltage or current source.
- Set Start value, Stop value and Increment, for example
0,2,5m. The defaults are 0 to twice the source’s value in about 500 steps. - Click Run DC sweep.You should seeThe probes against the source value.
ResultFor a diode in series with 100 Ω the current stays near zero until about 0.6 V, then rises steeply.
| If you see | Do this |
|---|---|
| A battery can't be swept | Use a DC voltage or current source. |
See alsoDC sweep.
11.9Find the DC operating point of every net
Get a table of every net voltage and every part current at DC.
- Press F9.You should seeA table: probes first, then
V(net)for every net, thenI(part)and, for runs in the BetterSPICE engine,P(part). - Type in the filter box to find a row.
- Click Export CSV to keep it.
ResultNets are named after their labels, so label them. A value that's only solver residue, such as a femtovolt on a net that's really at 0 V, reads 0. Hold the pointer over it for the exact value. Copy as table keeps the raw numbers.
| If you see | Do this |
|---|---|
W_GMIN_SHUNT | Some net has no real DC path. Give it one. |
W_DC_CYCLE | The circuit oscillates and has no DC point. Use a transient. |
See alsoOperating point.
11.10See the spectrum and distortion of a signal
Turn a waveform into a spectrum and compare the harmonics with the fundamental.
Before you startA probe on the signal, and a Transient stop time long enough for many periods.
- Press Shift+F8. The first time it opens the setup on the FFT tab. Later it runs the saved FFT.
- Choose the Signal (a probe) and a Window: Blackman for distortion, Rectangular (none) for signals periodic in the window.
- Set Use data from past the start-up, for example
10m. - Click Run FFT.You should seeThe spectrum in dB. The harmonics sit below the fundamental by the distortion.
ResultFor a quick look while it runs, choose FFT on a trace in the scope menu: the FFT tab shows it live.
| If you see | Do this |
|---|---|
| Asks for a longer stop time | Fewer than 16 samples were left. Lengthen the Transient stop time. |
11.11Check a power supply: start-up, load step and ripple
Measure how a supply starts, how it answers a load change and how much ripple it leaves.
Before you startA supply circuit. The examples in Linear regulators and Switching converters are ready to use. LDO load-transient response already has a load step.
- Probe the output and the input (P).
- For a load step, place a current source (I) from the output to ground. In the inspector, change its Source type to a pulse and set the two load currents.
- Set Simulate for past the start-up and the step, and max step to a tenth of the switching period, for example
50nfor 1 MHz. - Press F5.You should seeThe output rising with its soft start, then the dip and recovery at the load step.
- Zoom to the end of the run, turn on Cursors, and read the ripple peak to peak.
ResultStart-up time, the dip and its recovery, and the steady ripple, from one run. The report (Ctrl+Shift+G) also lists the ripple over the last 20 % of each probe.
| If you see | Do this |
|---|---|
| Ripple far smaller than expected | Lower max step: a large step smooths the switching edges. |
| The run is very slow | Shorten Simulate for, or set Start saving at to skip the start-up. |
See alsoTutorial 3: A regulator with a vendor model, Transient, Generate report.
11.12Check a circuit across component tolerances
See how far a result moves when the parts are off their nominal values, and how many builds would still meet the specification.
Before you startA circuit with a measurement that has limits, for example the -3 dB frequency of a filter between 1.5 kHz and 1.7 kHz (Set a pass or fail limit on a result). A resistor counts as 1 %, a capacitor as 10 % and an inductor as 20 % until you set a tolerance.
- Select a part and set Tolerance in the inspector, for example 5 for a capacitor. Under All parameters choose Tolerance distribution: Gauss, or Uniform.
- Press Shift+F9. The first time it opens the setup on the Tolerance tab.
- Choose the Analysis to repeat, for example AC sweep. Choose Monte Carlo and Runs 200, or Worst case.
- Click Run tolerance.You should seeAll runs drawn over each other with the nominal run on top, then a histogram of each measurement, the yield and a bar per part.
- Type the lowest and highest allowed value under the histogram.You should seeThe share of runs inside shows at once as the yield.
- Read Which parts matter. Tighten the part with the longest bar first.
ResultThe spread of the result with its mean, sigma, minimum and maximum, and the yield. The same seed gives the same runs, here and in bspice. Export CSV writes one row per run.
| If you see | Do this |
|---|---|
| No yield is shown | Measurements without limits cannot fail. Type the limits under the histogram, or set them in the measurement. |
| The yield is lower than expected | A run the engine could not solve counts as a failure. Open the table to see how many. |
| Worst case gives a mean and sigma that look odd | Worst case runs corners, not a random sample. Read its minimum and maximum. |
See alsoTolerance, Measurements, Parameter step for one part at a time.
11.13Set a pass or fail limit on a result
Name a result of a run, such as a rise time or a -3 dB frequency, and have the app judge it against limits.
Before you startA circuit with a result on screen, for example an AC sweep of a filter.
- Run the analysis. Under the plot, the Measurements panel opens.
- Click Add measurement.
- Choose what to measure, for example the -3 dB frequency, and the signal, for example
V out. - Type the lowest and highest allowed value, for example
1.5kand1.7k, and click Add.You should seeA row with the value and PASS or FAIL.
ResultThe measurement is saved in the circuit and evaluated after every run. In a parameter step it is shown for every value. In a tolerance analysis it is judged in every run, which gives the yield.
| If you see | Do this |
|---|---|
| FAIL and a reason | A limit on a value that cannot be measured counts as a FAIL and the row says why. For a rise time, start the window before the edge and end it after the output has settled. |
| The measurement is not listed after another analysis | The panel lists the measurements that fit the analysis on screen. Run the kind of analysis the measurement reads. |
See alsoMeasurements.
11.14Compare a run with an earlier one
Keep results on screen and see how a change moves the next one.
- Run a transient, DC sweep or AC sweep.
- Click Keep as reference in the Analysis toolbar.
- Change the circuit, for example a capacitor value, and run the same analysis again.You should seeThe kept traces are drawn dashed behind the new ones.
- Hold the pointer over the plot.You should seeThe readout shows the difference of each trace to the reference.
- Keep more runs the same way (up to five, each in its own colour). Click a run’s chip to hide or show it.
- Click the × on a chip to delete that run when you are done.
ResultThe kept runs are not saved with the circuit. Only runs of the same kind are drawn against them.
See alsoKeep as reference.
11.15See where the power goes in a circuit
Watch the power move through the circuit and read the input, the output and the losses.
Before you startA running circuit with a load. A resistor named RL, RLOAD or LOAD, an LED, a lamp or a motor counts as the load.
- Press Alt+E, or click the lightning bolt in the toolbar.You should seeBands lie on the wires that carry power. Parts that give power have an orange outline. Parts that make heat get an orange wash.
- Read the ledger in the corner: Input, Output, Losses, Efficiency and Energy held.
- Click a row of the ledger to select that part.
- Switch between Average and Instant to see the ripple.
ResultThe Residual is zero when every pin current is accounted for. The panel says Does not balance in red when it is not.
| If you see | Do this |
|---|---|
| Not measurable at this timebase | A switching circuit has edges faster than the engine's steps. Use a slower timebase or Instant. |
| No efficiency | The circuit has no part the app takes as the load. Click Load on the resistor's row. |
See alsoEnergy view.
11.16Fix a run that will not converge
Get a run past a Newton or time step failure and keep the fix.
- Run the circuit. The engine retries by itself and keeps the first setting that works.You should seeA
W_CONVERGENCE_AIDSrow in Diagnostics (Alt+6) says which setting worked and names the part at fault where it can. - Read the sentence in the row. It often names the cause: a switch that flips in no voltage range, a source edge of zero time, an ideal source on a gate.
- To run that way from the start, click Fix convergence in the row.You should seeThe setup now holds the method, maximum step or gmin. Ctrl+Z takes it back.
- Better, fix the cause the row names.
ResultA run that converges the first time is never touched. If the doctor finds nothing that works, the run stops with the error and the part with the largest update.
| If you see | Do this |
|---|---|
| The row has no button | The setting cannot be saved in the setup. Follow the sentence in the row. |
See alsoConvergence doctor, Red Halted, a red badge, or a diagnostic code.
11.17Measure voltage and current at one point
Read the voltage and the current of one place, on the scope and in a tag on the schematic.
- Press P and click a pin of a two-pin part, or the wire between two part pins.
- Select the probe. In the inspector, set Measures to Both.You should seeThe scope gets two traces: volts on the left axis, amps on the right.
- Set Tag to show the voltage and the current on the canvas, for example
OUT 4.98 V 1.21 A.
ResultThe Analysis view plots the same two quantities. The current is the current into the part's first pin.
| If you see | Do this |
|---|---|
| Current is not offered | On a net where several pins meet there is no single current path, so only voltage is offered. Probe a pin of a two-pin part instead. |
See alsoA probe for voltage, current or both.
11.18Zoom a paused trace to fit the screen
Look at a small detail of a paused run with the vertical axis fitted to it.
- Press Ctrl+R to pause.
- Zoom the time axis on the scope with the wheel or by dragging a box.You should seeThe vertical axis fits the traces in view, as in the Analysis view.
- To keep the axis of the whole record instead, click Fit Y in the dock header, or turn off Scale, Fit Y to the zoomed view when paused in the scope menu.
ResultThe choice is remembered. While the run is going the scale works as before.
See alsoThe scope.
11.19Look at digital signals on the logic analyzer
See gates, counters and buses as high and low lines with their values.
- Press Alt+4.You should seeThe Logic tab lists the digital outputs of gates, flip-flops, counters and control blocks.
- To add an analog net, right-click its wire and choose Add to logic analyzer…. Give the threshold in volts (1.65 for 3.3 V CMOS).
- Set Trigger to Normal, choose the signal and Rising edge. Single waits for the next edge after you arm it, then pauses with the window held on that edge.
- Click one edge and Shift-click another.You should seeΔt and 1/Δt at the top right.
ResultThe picture locks on each trigger. Double-click the plot to follow the live time again.
See alsoLogic analyzer, Digital logic.
11.20Go back in time in a paused run
Pause the live simulation and look at any instant since the start of the run.
- Press Ctrl+R to pause.You should seeA Go to bar appears under the scopes. Paused, the scopes hold the whole run.
- Type a time in the box, for example
65.5m, and press Enter, or drag the slider.You should seeAn orange playhead on every scope, with the value of each trace at that time. - Zoom one scope with the wheel: linked scopes follow and centre on the playhead.
- Press Ctrl+R to run again. The playhead goes away.
ResultA very long run keeps all of it at a coarser spacing, so a short early spike can look thinner than it did live.
See alsoScrubbing a paused run.