Issue with SPICE Netlisting a Labeled Unconnected Net


I’m attempting to generate a SPICE netlist for the below schematic.


The issue I’m having is that, although I label the net connected to the potentiometer wiper in the schematic, it is netlisting as NC_01. Is there a workaround where I can name the net even though it isn’t connected?

Generated Netlist:
.title KiCad schematic
.include “libs/res.lib”
XRV1 test_net NC_01 GND pot rval=50k k=0.25
V1 test_net GND dc(1)
print vout


I don’t know much about ngSpice in KiCad, and probably better answers will follow…

I do know that it has some trouble with simulating a potentiometer. If I remember well, it has to be simulated by two resistors, and a formula to represent the wiper position.

That’s right, Paul. Below is the subcircuit I created to represent the pot in just the fashion you mentioned. My goal is to create an open source library of netlistable components targeting the ngspice simulator.

.subckt pot 1 2 3 rval=50k k=0.5
r1 1 2 {rval*(1-k)}
r2 2 3 {rval*k}
.ends pot

It looks like you’re doing this in 5.1. I am not a kicad/spice expert, but I got the same results as you when I tried in 5.1 with my own potentiometer model (effectively the same as yours).

It looks like single-pin nets are not passed to ngspice. There may be a way to get this to work in 5.1 but I don’t know it, other than adding a large resistor to ground off of that net.

I also tried it in 5.99 (nightly), where I have more spice experience, and it works as drawn with no issues. In general you will find that it’s a lot more pleasant to run simulations in 5.99, although it is still somewhat limited compared to some other tools.

There are some caveats with using 5.99 though: Is it a good idea to use a nightly build version?

1 Like

Having a small but solid library of spice models that can be distributed as a KiCad library would be a great addition for beginners (such as me) with simulation.

I have managed to simulate the default sallen-key example after some tweaking, and after hours of searching I even managed to find a spice model of an NE555 that works with ngSpice.

Even such small things as having to remap some opamp pins of an (otherwise working) spice model easily confuses beginners, as they have no way of knowing where to start to solve it.

Even having a small library with old yelly bean opamps such as LM358 and TL071 and other parts that work directly without tweaking would be swell.

Distribution with Kicad is a problem though. As I understand, the opamp models (as example) do not only have to work with ngSpice (a lot of them don’t due to various issues) it has to have a verifiable licence and be “legally compatible” with KiCad.

On top of that, I think there is a bit of a lack of librarians for KiCad at the moment.

Kudos to you, gkeeth! Your resistor suggestion was great and I am confident it leads to a workaround for 5.1.

Here are the steps of the workaround:

  1. Add a resistor from the noconnect to any other node and annotate (the value of the resistor won’t matter; you’ll see)
  2. Open the properties of the resistor and add a field “Spice_Netlist_Enabled” with value “N”
  3. Netlist the schematic
  4. ???
  5. Profit

I can’t wait until the version 6 release. I think the nightlies suggestion is great and I will consider it seriously if there is any delay with version 6 (Not here by January).

1 Like


Feel free to reach out if you’d like any updates on this work. I believe my email is linked to this account.

I am very interested in the behavioral modeling of devices which is what motivates me to do this.

I will be attempting to create KiCad models using ngspice’s behavioral modeling capabilities in the future. A 555 would be the perfect IC to model in the beginning.

Thank you for the warning on KiCad licensing. I will take a look at what constraints they have in terms of getting something into the main branch. I want to keep these as technology/process independent as possible. So I won’t have any LM358s or branded devices.


Ah, the spice_netlist_enabled suggestion is great, I hadn’t even considered that. I was just picturing a 1G resistor.

This picture:

Looks pretty plausible with the 100k and 100n values which result in a 10ms time constant. (1e5 * 1e-7 = 1e-2).

And here is the project: (4.8 KB)

I had a look at the NE555.lib file, but it does not have any licensing information. It looks like somebody built it out of 32 transistors (defined in the file) and 12 resistors.

About a year ago I had a burst and found several thousands of models on the 'net and spend hours finding something that worked without too much twiddling. This example is about as far as I’ve ever got in spice. After that I mostly got distracted and have not simulated anyting in KiCad / ngSpice untill I dug up this example from back then.

Maybe you can do more with it.

It seems like the ne555 lib was posted earlier on this forum, in:Simulation of 555 timer circuit in KiCad

Indeed this is no longer true. With recent ngspice-35 (and appropriate settings) nearly all OpAmp models are o.k… With ngspice-36 (to be available in November) even the new TLV6002/TLV9001 will do. If you are aware of a model that does not run with ngspice-35, please let me know. I will take care.

What is “appropriate settings”? In KiCad 5.99 you may set PSPICE and KiCad compatibility in the simulator window. With KiCad 5.1 you may follow the advice given in .

For ngspice models, please see Where do i find models for ngspice? .

For an intro how to set pins etc. please see .