Unable to run netlist inside standalone Ngspice

Hello all,

I am attempting to print out my circuit netlist from KiCAD to test if there is a difference between ngspice27 and ngspice34 in terms of models (I get something different with KiCAD than Qucs-S which uses ngspice27). The problem is standalone ngspice does not recognize the node labels I put into KiCAD (using global labels) so they all show up as “zero length vectors”; these node labels are used for .FUNC, .IC, and .NODESET commands in the netlist. When I remove these extra node labels I get ngspice34 to run, but instead of returning the expected vectors it returns:
"yes FALSE TRUE boltz c e echarge i i kelvin no pi planck yes"

as the list of vectors, which appears closer to the output from just a diode model. I use the following to create the data output:

.control
set wr_singlescale
set wr_vecnames
option numdgt =7
wrdata location all
.endc

Is there some way to get the node labels to work properly with external ngspice?

When using internal ngspice within Eeschema, Eeschema prepares the netlist, submits it to ngspice, and then sends the command ‘bg_run’ to start the simulation in a second thread.

When you load this netlist into external ngspice, it parses the data and then waits for the command to start the simulation. In your .control section, there is no command to do this. ‘bg_run’ is not available in standard ngspice, but ‘run’. So add ‘run’ to your control section before trying to read the result vectors, which are prepared, but not yet filled with data. The vector returnd in your example is an internal vector which contains base data which might be used in more complex control sections. Please see http://ngspice.sourceforge.net/ngspice-eeschema.html#external and following for more information.

When posting such a question, please always provide a simple example (netlist or Eeschema file) that shows this behavior and which is complete to run elsewhere.

1 Like