Basic simulation problem

Hi all, is there a specific forum for kicad/simulation questions? If not here goes…

I am trying to do the simplest of circuits. I’ve looked through the faqs, and a few videos. they are, so far, unhelpful…

Here is what I get from the simulation. what in blazes am I doing wrong?! Thanks in advance!:

Compatibility modes selected: ps lt
Circuit: KiCad schematic
Background thread stopped with timeout = 0
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Note: Starting true gmin stepping
Trying gmin =   1.0000E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   5.6234E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   8.6596E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   9.6466E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   9.9105E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   9.9775E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   9.9944E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   9.9986E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Further gmin increment
Trying gmin =   9.9996E-03 Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Last gmin step failed
Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: True gmin stepping failed
Note: Starting dynamic gmin stepping
Trying gmin =   1.0000E-03 Note: One successful gmin step
Trying gmin =   1.0000E-04 Note: One successful gmin step
Trying gmin =   1.0000E-05 Note: One successful gmin step
Trying gmin =   1.0000E-06 Note: One successful gmin step
Trying gmin =   1.0000E-07 Note: One successful gmin step
Trying gmin =   1.0000E-08 Note: One successful gmin step
Trying gmin =   1.0000E-09 Note: One successful gmin step
Trying gmin =   1.0000E-10 Note: One successful gmin step
Trying gmin =   1.0000E-11 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: Dynamic gmin stepping failed
Note: Starting source stepping
Supplies reduced to   0.0000% Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Trying gmin =   1.0000E-02 Note: One successful gmin step
Trying gmin =   1.0000E-03 Note: One successful gmin step
Trying gmin =   1.0000E-04 Note: One successful gmin step
Trying gmin =   1.0000E-05 Note: One successful gmin step
Trying gmin =   1.0000E-06 Note: One successful gmin step
Trying gmin =   1.0000E-07 Note: One successful gmin step
Trying gmin =   1.0000E-08 Note: One successful gmin step
Trying gmin =   1.0000E-09 Note: One successful gmin step
Trying gmin =   1.0000E-10 Note: One successful gmin step
Trying gmin =   1.0000E-11 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Note: One successful source step
Supplies reduced to   0.1000% Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Supplies reduced to   0.0000% Warning: singular matrix:  check nodes net-_r1-pad2_ and net-_r1-pad2_
Warning: source stepping failed
Transient solution failed -
Last Node Voltages
------------------
Node                                   Last Voltage        Previous Iter
----                                   ------------        -------------
net-_r1-pad1_                                     0                    0
net-_r1-pad2_                                     0                    0
v1#branch                                         0                    0
No. of Data Rows : 0
doAnalyses: iteration limit reached
run simulation(s) aborted
Background thread stopped with timeout = 0
Reset re-loads circuit KiCad schematic
Circuit: KiCad schematic

Spice (including ngspice) always needs a connection to ground.

So add a ground (GND or 0, e.g. from PSPICE lib) symbol to the lower node of your circuit.

I will check if it might be possible to obtain a better error message like “Missing ground connection”. For a simple circuit as shown above that’s easy, but for a complex circuit with thousands of devices and nodes the fault detection might be a little tedious.

Dear Holger! Thank you very much. Such a simple circuit, I knew it had to be a simple problem. Of course such a simple problem it is surprising there would be so many messages in the simulation, yet none really point to the problem haha. So here’s my next question (thank you)…

Now, for a circuit slightly more complex…

I’ve filled out values and attached a spice model file for the 1N4148. I remembered to place a ground in the circuit! But now the ERC is complaining about this ground (I have not yet tried to simulate).

What is wrong with this pspice ground that it would fail the ERC?
Again MANY thanks. I am really starting to enjoy KiCAD and would love to get some of this basic
learning curve behind me
73 Eugene W2HX

Please see

Can it scan through the netlist and make sure at least one node-0 (or its aliases) is present?

Thanks again Holger. I looked up the article it says:
“This is the a common problem caused by a missing PWR_FLAG on the GND net.
You have used a PWR_FLAG on the input of U2. The GND net also needs a PWR Flag.”

Now to figure out how to add a “PWR_FLAG on the GND net” and to search for what this means. I have no idea. Looking at the GND symbol there was nothing obvious like a field for “Flags” I’ll eventually figure it out I guess…

Another oddity.

If I remove either cap C1 or C2 everything simulates correctly. However, adding this second polarized cap produces the following. Nothing else changed. Any idea why?:

Compatibility modes selected: ps lt
Circuit: KiCad schematic
Background thread stopped with timeout = 0
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: v1: no DC value, transient time 0 value used
Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Note: Starting true gmin stepping
Trying gmin =   1.0000E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   5.6234E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   8.6596E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   9.6466E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   9.9105E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   9.9775E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   9.9944E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   9.9986E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Further gmin increment
Trying gmin =   9.9996E-03 Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Last gmin step failed
Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: True gmin stepping failed
Note: Starting dynamic gmin stepping
Trying gmin =   1.0000E-03 Note: One successful gmin step
Trying gmin =   1.0000E-04 Note: One successful gmin step
Trying gmin =   1.0000E-05 Note: One successful gmin step
Trying gmin =   1.0000E-06 Note: One successful gmin step
Trying gmin =   1.0000E-07 Note: One successful gmin step
Trying gmin =   1.0000E-08 Note: One successful gmin step
Trying gmin =   1.0000E-09 Note: One successful gmin step
Trying gmin =   1.0000E-10 Note: One successful gmin step
Trying gmin =   1.0000E-11 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: Dynamic gmin stepping failed
Note: Starting source stepping
Supplies reduced to   0.0000% Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Trying gmin =   1.0000E-02 Note: One successful gmin step
Trying gmin =   1.0000E-03 Note: One successful gmin step
Trying gmin =   1.0000E-04 Note: One successful gmin step
Trying gmin =   1.0000E-05 Note: One successful gmin step
Trying gmin =   1.0000E-06 Note: One successful gmin step
Trying gmin =   1.0000E-07 Note: One successful gmin step
Trying gmin =   1.0000E-08 Note: One successful gmin step
Trying gmin =   1.0000E-09 Note: One successful gmin step
Trying gmin =   1.0000E-10 Note: One successful gmin step
Trying gmin =   1.0000E-11 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Note: One successful source step
Supplies reduced to   0.1000% Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Supplies reduced to   0.0000% Warning: singular matrix:  check nodes net-_c1-pad1_ and net-_c1-pad1_
Warning: source stepping failed
Transient solution failed -
Last Node Voltages
------------------
Node                                   Last Voltage        Previous Iter
----                                   ------------        -------------
net-_r1-pad1_                                     0                    0
rts-in                                  2.86115e-52            1.461e-57
net-_d2-pad1_                          -5.42637e-51                    0
rts-out                                -4.76858e-51         -1.29277e-57
net-_c1-pad1_                                     0                    0
v1#branch                               9.53716e-55                    0
No. of Data Rows : 0
doAnalyses: iteration limit reached
run simulation(s) aborted

Press P (add power symbol), and search for PWR_FLAG. Add this symbol somwhere on the GND net. See ErrType(3): Pin connected to some others pins but no pin to drive it - #3

Similar issue as with missing ground connection:
Two capacitors in series without a dc connection in the middle node. How shall the simulator know what potential it should assume for this node? It could be anything, so the simulator decides to bail out.

Don’t put capacitors in series without a dc connection of the inner node. You may parallel a 1G resistor to one of the capacitors, or between inner node and ground.

Yes, That’s the brute-force idea.

There is alraedy some syntax check, which may be extended. The challenge is to decide what is node and what is anything else. Well, can be done, but we need to avoid false positives which would be very annoying to the experienced user.

Ok thank you for the explanation.

I dont know the answer, but I do know LTSpice handles this exact issue without so much as a complaint. Maybe it can be determined how they do it.

But thanks for the explanation here.

LTspice “cheats”. When you place a capacitor the model includes a parallel resistor, similar as Holger mentioned. Select the capacitor in the LTspice schematic and you as a user can add a specific resistor value (equivalent parallel resistance). That value is inital empty, the simulator substitutes one for you in secret when solving the circuit. The same happens with inductors.

For ngspice/KiCad you could model your capacitors as subcircuits, that is including that parallel resisisor. You schematic then only shows a capacitor.

Yea, agreed. Wasn’t trying to imply it was trivial. That’s just what popped in my head.


You can add the following text block to your schematic to alleviate the issue for KiCad/ngspice.

.options rshunt = 1t

LTspice has a “topology checker” to determine floating nodes and other similar issues, which is non-trivial to duplicate. So at the moment you need to resolve these corner-case conditions yourself. The ngspice manual section 15.1.2.1 highlights a few and gives you the tools to handle them.

Ok great info. Great community. Thank you all

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.