New simulation examples are following here.
This time I am using KiCad 7.99. The new simulator interface is offering a lot of enhancements, which make it absolutely worthwile to have a look at this development. ngspice-41 is typically involved. Sometimes I am using ngspice-41+ from the ngspice development branch, as improvements are tested.
The previous examples (KiCad 6, ngspice-38) are visible at Simulation examples for KiCad/Eeschema/ngspice .
The examples provided should run out-of-the-box: Extract the *.7z file into a directory of your choice. Open the project (or directly open the *.kicad_sch in Eeschema 7.99) → Inspect → Simulator → Run (green triangle).
The circuits shown below are not optimized, but may serve as a good starting point.
The first example is a simple boost converter, powering up 2.5 V to about 6 to 7 V. The switch is a power MOS device, the load is switched from 120 to 60 Ohms.
Boost.7z (7.2 KB)
Regulated boost converter
The previous example has been a ‘free-running’ converter. Load-switching and variation in input voltage will require some regulation. The following example adds a reference voltage, an error amplifier and a PWM (pulse-width modulation) stage to the simple boost converter. Here ngspice-41+ is required, as it contains an improved PWM generator.
The output load is switched at 13ms from 60 to 20 Ohms. The two cursors clearly show that the output voltage regulation is working.
boost-complete.7z (12.8 KB)
Here is a version which does not need ngspice-41+, as it relies on a pwm generator made with the vernerable one-shot code model.
boost-regulated-os.7z (12.6 KB)
A simple buck converter with power NMOS
Buck.7z (7.1 KB)
The next one is a Royer converter, as described in https://www.mikrocontroller.net/articles/Royer_Converter (in German).
Royer.7z (10.6 KB)
The next one is a resonant LLC converter:
The look is a little ugly, as for the lack of a voltage controlled switch symbol I have used relay symbols. But there are ngspice switch models attached to these symbols!
LLC.7z (10.3 KB)
Digital PWM amplifier
This is the very basic prototype of a digital amplifier. You have a sine source, a PWM modulator with digital ouput, an anlog filter and the analog load.
The digital output consists of two inverse digital signals dn and dp:
The analog plot compares the sine input versus the differential output voltage on the load resistor R1:
pwm-audio.7z (6.9 KB)
Digital PWM amplifier update
This is an update to the basic class D amplifier: Use parameters for the PWM modulator, increase the output voltage to 200V: this yields in an output power of 2.7 kW. And nothing explodes (a benefit of the simulation)!
pwm-audio-2.7z (7.0 KB)
This one benefits again from the new PWM generator in ngspice-41+, as the old one shows some dimples in the output, due to missing pulses.
Another Class-D 2.5 kW audio amplifier
with half bridge MOS driver and a ‘home made’ audio driver circuit model (pwm, non-inverted and inverted outputs, dead-time, hi-side and low-side outputs).
The simple Class-D-s uses the one-shot PWM (already available in ngspice-41 and older), the slightly more complex Class-D uses the somewhat faster new upcoming PWM (could be changed though).
Class-D.7z (20.4 KB)
A circuit to demonstrate using a code model inside of a subcircuit.
The ouput is dressed in beautiful colors:
analog-multiplier.7z (5.0 KB)
Generic symbols with generic models
The next circuit uses symbols and models from the Simulation_Spice library (opamp and npn transistor). So for a quick analysis there is no need to search for specific device models. Transient and small signal ac is simulated.
intro4.7z (8.9 KB)
IBIS interface simulation
Some “finger execises” in the new IBIS module are shown next. IBIS allows to simulate drivers and receivers (the I/O of ICs and their connections) without resorting to the inner functions of the participating ICs. Typically a sequence “Driver – Interconnecting tracks – Receiver” is simulated. Still somewhat experimental.
ibis-test.7z (61.8 KB)