Showcase
Your LTspice file in the browser
An LTspice schematic opens in the browser as it was drawn, runs, and agrees with LTspice's own run of the same file.
1Overview
LTspice is where most power-electronics circuits already are. PWMSim opens an
LTspice schematic (.asc) in the browser: it reads the file as it was
drawn, places its parts where the file puts them, runs its own
.tran, and compares the result with LTspice's.
The file on this page is BUCK_PCM, a peak-current-mode buck converter from
5 V to 1 V at 1 A, switching at 1 MHz, its loop closed by a type-2 compensator built
around LTspice's own UniversalOpAmp2. It comes from the
LTspicePowerSim examples by kosokno (MIT license).
Nothing was changed in it.
2In LTspice

3In PWMSim
The import read 73 constructs of the file and its symbols:
71 exactly, 2 approximated, and none refused.
It needed nothing but the file's own repository: LTspice's standard parts, and the
UniversalOpAmp2 the compensator uses, are built into the import, and
the converter's blocks are symbols that sit beside the file.
- X13.XU1.D1: the model's 10V knee (epsilon) is solved where the circuit runs on the nonlinear route, an .ac among them.
- X13.XU1.D2: the model's 10V knee (epsilon) is solved where the circuit runs on the nonlinear route, an .ac among them.
Once it is open, Model trust lists every construct the same way.
4Run for run
The file asks for .tran 0 0.3m 0.29m: LTspice runs
300 µs and saves the last 10 µs. Fig. 3 lays PWMSim's run
over LTspice's across that span, the one the author's screenshot shows.
The app's Compare with LTspice reads LTspice's waveform file (the
.raw it writes) and checks every signal both runs have over the
cursors' span. Over the span LTspice saved:
| Signal | PWMSim mean | LTspice mean | PWMSim p-p | LTspice p-p | Difference |
|---|---|---|---|---|---|
| i(@1) | -3.47e-21 A | 7.84e-15 A | 1.73e-18 A | 3.33e-13 A | 0.78% |
| i(C1) | 37.7 µA | 20.5 µA | 80 mA | 80.4 mA | 0.02% |
| i(L1) | 1 A | 1 A | 80 mA | 80.5 mA | 0.00% |
| i(R1) | 1 A | 1 A | 473 µA | 472 µA | 0.00% |
| i(V1) | -201 mA | -201 mA | 1.04 A | 1.04 A | 0.00% |
| v(IL) | 1 V | 1 V | 80 mV | 80.6 mV | 0.01% |
| v(in) | 5 V | 5 V | 0 V | 0 V | 0.00% |
| v(out) | 1 V | 1 V | 473 µV | 472 µV | 0.00% |
| v(pwm) | 211 mV | 211 mV | 1 V | 1 V | 0.00% |
| v(r) | 0 V | 2.48 µV | 0 V | 1 V | 0.00% |
| v(sw) | 1 V | 1 V | 6.02 V | 4.99 V | 0.01% |
| v(vc) | 1.05 V | 1.05 V | 443 µV | 536 µV | 0.02% |
All 12 shared signals agree within 1%. The difference is the gap between the two means over LTspice's peak-to-peak, or over its level where the signal is flat.
Where the means agree but the peak-to-peak do not:
- v(r): LTspice's record pulses to 1 V 10 times, each for at most 3.87 ps; PWMSim's stays at 0 V.
- v(sw): PWMSim's record reaches -1.03 V, outside LTspice's -757 µV to 4.99 V, 10 times, each for at most 87.1 ps, at the instants its switches change state; LTspice's record stays inside it.
- v(vc): its ripple is 443 µV peak to peak against LTspice's 536 µV, about a mean of 1.05 V that agrees.
PWMSim marks its run with one warning: the step controller accepted an estimated error above the requested tolerance at some step. The app says so beside the result, and a smaller maximum step certifies the run.
5Try it yourself
- Open this file in PWMSim: Open BUCK_PCM.asc in PWMSim. The browser reads the file from its repository, imports it and runs it. No account is needed for a file a link brings.
- The file itself: BUCK_PCM.asc in the author's repository, at the commit this page was made from.
- Your own file: Files → Import LTspice or SPICE…
takes your
.asc, with its symbols and models, read in your browser and never uploaded. To compare, run it in LTspice, load the.rawLTspice writes with Compare with LTspice, and place the two cursors.
6What this does not show
- This page is one file. Of the 45 files of the same collection, 41 agree with LTspice within 1% (5 of them compared at a smaller maximum step than the file asks, where LTspice's own default is the coarser answer). Three frequency-response files do not yet (BUCK_VM_ASYNC, BUCK_VM_CCM_plant, BUCK_VM_DCM_plant), and one is a symbol library, not a circuit.
- LTspice's stock op-amps,
UniversalOpAmp2andopamp, are built in, measured against LTspice's own, so a file needs nothing more for them: 21 of the collection's 23 files with a TYPE2 or TYPE3 compensator import whole from a link. Any other part of LTspice's library needs that library, as the other two do for their MOSFET models: the import dialog asks for your LTspice library folder, and a link alone cannot bring it. - No speed is claimed here, against LTspice or otherwise.
- Agreement with LTspice is agreement with another simulator, not a hardware test.
The PWMSim drawing, waveforms and numbers above come from BUCK_PCM.asc as PWMSim imports it, run by PWMSim; LTspice's from LTspice's own run of the same file. The comparison is the app's Compare with LTspice.