KiCad 5 to 6 Simulation Problem

I have a KiCAD 5.1 project that simulates fine. I’ve downloaded KiCAD 6.0.7, opened the project and when I try to simulate it I get a load of model errors.

Looking at one of the problem lines in the generated spice netlist I see:

Q552 Net-_C550-Pad1_ Net-_Q552-Pad2_ Net-_D501-Pad1_ 

If I go back to KiCAD 5.1 and look at the netlist there I see:

Q552 Net-_C550-Pad1_ Net-_Q552-Pad2_ Net-_D501-Pad1_ AUY21

so KiCAD 6 has stripped the model off of some of my parts. The schematic is large so this is not so easily fixed manually. The question is, what is happening? I have AUY21 defined in a text block on the schematic:

.model AUY21 PNP(Bf=75 Is=36u Re=0.04456 Vaf=48 Ise=480n Tf=530n Tr=10u)

and if I go to Q552 in KiCAD 6 and look at the properties then go to Spice Model it shows the model as ‘AUY21’ and ‘BJT’

How can I fix this? The UI settings look OK to me.

Thanks!

You have chosen an ‘uncommon’ way to add the .model via text on the schematic. This may have worked on KiCad 5, may or may not work on translating KiCad 5 to Kicad 6 or directly on KiCad 6.

Without any test project published here it is impossible to analyze anything.

You may need to attach the model in the usual way (via loading from a file) to each instance in KiCad 6.

That is… unfortunate because there are maybe 100 transistors and diodes that all need models and giving them all a .lib is not as user-friendly as just putting the models into a text block like I can do with v5. Seems like a step backwards.

If I export the spice netlist from v6 I see the entire text block contents are included and the diodes and other transistors all have their models assigned which are defined in the text block, so it seems to be partially working. Just that one transistor definition is not being applied based on the name.

This ‘fixes’ it:

  1. Move pointer over transistor and press ‘e’
  2. Click on Spice Model
  3. Change the model from AUY21 to AUY2
  4. Change the model from AUY2 to AUY21
  5. Click on OK

now the Spice_Model field is added and the netlist output is correct. So it seems this is a bug in conversion from V5 to V6, either not picking the model up automatically from the name or removing the model, but only for the one transistor model, not any of the others.

Uhhh… after fixing the missing model problems the simulation gives a completely wrong waveform on the output. Works fine with KiCAD 5. I tried the pspice compatibility mode - same.

Running external ngspice-36 from KiCAD 6 produces the same mangled waveform, so it’s not a spice issue, it is something to do wtih generating the netlist.

What changes were made to the simulation between KiCAD 5.1.12 (Windows) and KiCAD 6.0.7 (Windows)?

Here are the netlists from V5 and V6. Looks like most of the lines are now output in a different order making any changes very difficult to spot.

Seems to be something to do with ground. Probing my ground net gives 13V. I have the pspice ground symbol connected to a global “0” label which is connected to a regular ground symbol. pspice compatibility mode is on.

V5Output.cir (20.0 KB)
V6Output.cir (20.6 KB)
Screenshot 2022-08-02 124713

I’ve never had this issue myself, but the whole spice model thing is tedious in itself.
The most efficient way I’ve found is to make one perfect transistor or diode with spice model and all the works, and then use the “duplicate” function for placement. You’ll still need to assign all the part designators (Q1, Q2…) by hand again, though.

1 Like

Probing my global label E11-GND, which is connected to pspice “0”, on the last sheet of my schematic gives an error:

vector V(0) not found!

but then probing E11-GND on the root sheet of my schematic gives 13V!

So the spice netlist does not connect the same global label across sheets like it does in KiCAD V5?

I had to add a second pspice “0” on the root sheet. Now I have a ground.

Something is still not right. Every voltage is 4V too low. If I probe the output of a DC voltage source set to 22V it shows as 18V. So it must still be a ground issue somewhere.

Strange how it works fine with KiCAD 5.1.12.

Best is to analyze the netlist sent to ngspice.
Eeschema–> File–> Export → Netlist → Export Netlist
You will see the naming conventions of the nodes on top sheet and sub sheets.

Maybe adding a
.global gnd
in the text box on the main sheet will help.

So what is the difference between the two netlists?

I have no idea because as I wrote KiCAD5 and KICAD6 output the lines in different orders so it is impossible to use Winmerge or something like that to compare. I attached them to a previous post - they are large. Did you see?

There appears to be a fundamental difference between how KiCAD5 and KiCAD6 expect the schematic when simulation is being used, but it is a struggle of trial and error to work it out.