Simulation examples for KiCad/Eeschema/ngspice

This is a bug in V7 of KiCad. I will provide a bug report. The automatic transfer from V6 to V7 is buggy.

I needed to change 2 things in V7:
On the Eeschama canvas: Change the text window, sim command into the first row, .include path as absolute path. For me it is:

.TRAN 0.02m 'ttime'
.param ttime = 1200m
.param varia=100
.include D:/Spice_general/KiCad-700/examples/MC3/script5.txt

Edit the models for V1, V2 (the trrandom voltage sources): Double click onto the symbol of V1, → Simulation Model… → Built-in Spice model: type Random normal, mean 0, stddev 0.05, dt ‘ttime/varia’, td 0 → OK → OK. Do the same with V2.

Then the simulation will run, internally, but also with external ngspice.

1 Like

I have added another switch power supply, a hybrid switched capacitor converter, multiplying 28 V to 700 V. It uses a modern GaN transitor and SiC Schottky diodes. Its idea stems from Design and Evaluation of Hybrid Switched Capacitor Converters for High Voltage High Power Density Applications. (Conference) | OSTI.GOV.

The circuit is still made with KiCad 6.0.11.

2 Likes

Added a Schmitt trigger relaxation oscillator with 40106.
The circuit is made with KiCad 6.0.11.

Potentiometer / potmeter example made by Holger.
This simulation has the setpoints in it, and that is a new feature of KiCad V7.99.
Recently, on Friday the 13th of October 2023, Holger stated a new thread for simulations in the new KiCad version.

https://forum.kicad.info/uploads/short-url/g4LdFEdtGQYqCCe0uziOp1CZBNO.7z

https://forum.kicad.info/uploads/short-url/jEl4zfMijZdNZp3UtngBw3o4h3n.7z

First posted in this topic:

Any reason CMOS555_3.7z doesn’t work the same as shown with KiCAD 7 or the netlist into DuSpice using ngspice 42plus?

What is the error message of the failing simulation?

The simulation plot doesn’t match yours above. The first 555 isn’t outputting a delayed pulse. Also the netlist outputted by KiCAD 7.0 looks and simulates differently than the one supplied in the example.

I detailed what I found over at the ngspice forum.

I have made a circuit update for 7.99 at More simulation examples for KiCad/Eeschema/ngspice - #4 by holger.

This is an oscillator circuit with all its quirks, especially the start-up of the oscillator depends on tiny details of the simulation setup. I have added a start-up pulse to allow early starting of the oscillation. And due to its using CMOS it is inevitable to not set ngbehavior to ps.

Ever since updating to KiCAD 8, F5/F6/Q17/mosamp2/Dual-NMOS… don’t work. I deleted KiCAD 7 so cannot verify…

Typical error:

These are Eeschema error messages. The automatic translation to KiCad 8 does not do correctly, as the simulator interface has changed a lot. I have started doing the translation manually for a few examples, as listed here More simulation examples for KiCad/Eeschema/ngspice - #4 by holger. I will add to this list as time allows. You are welcome to support me with this task.

I am available to do testing. I will look at the changes you made but I already “updated” the examples with the ones you recently posted but some like the “new” Q17 don’t work with KiCad 8 either. I upgraded to KiCad 8 because I couldn’t open these files with KiCad 7.0.10. Now I have lot’s of files that don’t work in 8 and won’t open with 7.0.10. I’m looking for a newer version of “7” that works with your newer files but I downloaded [kicad-7.0-testing_7.0.10.171] and Q17 still won’t load.

Bit of a Catch 22…

The files in this thread are made with KiCad6 and all are tested with KiCad 6.0.2 or 6.0.10.

They may or may not run with KiCad 7 (not tested!) and several will not run with KiCad8, as there have been a lot of changes.

The examples shown in More simulation examples for KiCad/Eeschema/ngspice will not open in KiCad6 or KiCad7, as they are made with KiCad 7.99 or recent KiCad8RC2. They will open only in the latest nightly, which is moving towards KiCad8.

EDIT: Indeed Q17 does not run with the current nighly. I have uploaded a new version of this project.

I found three “versions” of Dual-NMOS-Amp-VDMOS. Only the one I attached opens and works with KiCad 7.

To get it to partially to work with KiCad 8 I have to delete the “thermal” parameter from M1/M2. Of course then the thermal model doesn’t work.

Can you explain why Sim pins for M1/M2 has duplicate entries?
1=D 1=D 2=G 2=G 3=S 3=S 4=TJ 4=TJ 5=TCASE 5=TCASE

Is it possible to “fool” KiCad to open newer version files by altering the header in the sch file? I do this for other SW. I did notice version 8 sch files have a lot of differences from version 6/7.

Dual-NMOS-Amp-VDMOS.7z (45.8 KB)

When you see this error, you have to re-attach the device model. Then its o.k.

However, not accepting the thermal flag seems to be a bug in Eeschema of KiCad8. I will do a bug report.

I am not interested in KiCad7, as KiCad8 has to be brought up and running.

I don’t know what “re-attach the device model” means.

I’ve tried updating the symbol as shown below.

Also tried deleting and placing a new one. When placing a new one, all parameters are lost and the device is renamed “Q”…

I have pposted a bug report at https://gitlab.com/kicad/code/kicad/-/issues/16900 .

For the PassLabsF5, KiCad 7.99 and 8 give these errors. Added are the thermistors and potentiometers.

For the PassLabsF5, KiCad 7.0.10 gives these errors. Since the file doesn’t run, unsure if the thermal flag for the Mosfets is working.

2024-02-07_094202

I have already published a modifies F5 to the KiCad8 example page.

You have to modify the model subcircuits. The .param lines from within the subcircuit have to be shifted to the top, to the .subckt line itself. In ngspice both syntaxes are eqivalent, new Escheema wants them to be on the .subckt line.

Thermal is not o.k.

With today’s nightly the ‘thermal’ bug has been fixed.

1 Like

I’d love to see instructive style S-Parameter Analysis examples for KiCad8 RC2 (and above) SPICE simulation. I pulled down the S-Parameter example above and spent ½ day trying to run it under Windows11 KiCad8 with NGSPICE42. I know next to nothing about S-Parameter analysis except a very high level description. I’m building digital circuits which run at 2+GHz and I am wondering what “new to KiCad” tools are available to ensure, it will work (IBIS modeling?), Signal integrity (IBIS or S-Parameters?), or how much radiation I might be generating (S-parameters?).

I’m excited that I finally got my old tried and true 555-Timer CAE evaluation circuit simulating. It took KiCad8 for me to finally see that my schematic pins weren’t matching my simulation pins, which is what finally make it work.

In KiCad8 I’d love to see parameter verification for things like BJT model parameters. It took me a while to realize the errors I was seeing were from parameters Gummel-Poon and VBIC simulation models don’t support. It would be nice to have a more concise message saying “xtb=1.5” not supported (it is, but just an example), so I can remove it and find some other workaround to get my simulation running.

Anyway, amazing work by both the KiCad and NgSpice teams, and yes, I find this exciting!

1 Like