Ngspice-28 for KiCad


#1

ngspice-28 is available. Inportant new features are:
A generic VDMOS model for power MOS devices has been added. Simulating devices as provided by http://ltwiki.org/index.php?title=Standard.mos is now possible.

Ngspice-28 reads PSPICE device libs. These are often provided by the semiconductor device manufacturers for design support. Internally ngspice translates the PSPICE syntax to ngspice before simulating. No more manual tweaking of the library description is required (hopefully).

How to make use of ngspice-28 in KiCad (instead of ngspice-27 delivered with the nightly)?

If you are on MS Windows, do the following:
Install a KiCad nightly from http://downloads.kicad-pcb.org/windows/nightly/
Download the ngspice dll in ngspice-28_dll_64.zip from https://sourceforge.net/projects/ngspice/files/ng-spice-rework/28/ .
Copy msys-ngspice-0.dll from folder Spice64_dll\dll-mingw\ of the zip file into Programs\KiCad\bin. Within the bin folder remane libngspice-0.dll to libngspice-0-orig.dll. Now rename msys-ngspice-0.dll to libngspice-0.dll.
Put a text file named .spiceinit into your user directory (C:\users<your name>). Add the three lines

* user provided init file
set ngbehavior=ps

to .spiceinit. And that’s it.

If you are using LINUX, you may need to download ngspice-28.tar.gz and compile the shared library with

./configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --disable-debug CFLAGS="-m64 -O2" LDFLAGS="-m64 -s"
make -j8
make install

Put a text file named .spiceinit into your home/username directory. In admin mode, it may be the root directory. Add the three lines as noted above to the file. I am not on Linux, so I have to guess that now everyting is o.k. . If not, it might be necessary to add a different installation path to the configure command. Please let me know!


About the Simulation (Ngspice) category
#2

Great news… This version is a huge improvement over the previous.

A suggestion on any *NIX station to avoid messing root or creating any other account is to use the environ as provided by SPICE itself

# the most basic ones
export SPICE_LIB_DIR=/usr/share/ngspice
export SPICE_EXEC_DIR=/usr/local/bin

# export SPICE_HOST		## default: none
# export SPICE_BUGADDR		## ngspice URI
# export SPICE_EDITOR		## dafault vi - spinit initialize this
# export SPICE_ASCIIRAWFILE	## default 0 - Format of the rawfile. 0 for binary, and 1 for ascii
# export SPICE_MFBCAP		## default $SPICE_LIB_DIR/mfbcap
# export SPICE_HELP_DIR		## default $SPICE_LIB_DIR/helpdir
# export SPICE_SCRIPTS		## default $SPICE_LIB_DIR/scripts - spinit file location

# some very interesting ones
export SPICE_PATH=$SPICE_LIB_DIR		## default $SPICE_EXEC_DIR/ngspice
export SPICE_NO_DATASEG_CHECK=true		## show proc status
export NGSPICE_MEAS_PRECISION=5			## default: 5 precision digits in measure commands
export NGSPICE_INPUT_DIR=$SPICE_LIB_DIR/models

Should work fine including a GLOBAL spinit file on the specified path

Working fine in my station

Paul


#3

Can you please tell the procedure on how to merge ngspice-28 with kicad 5


#4

Download a proper libngspice to your system
(or compile it yourself from sources)

Put that library into a PATH available to KiCAD v5
It will be loaded as a shared library upon initialization.

The stand alone ngspice command line is also very helpful

Paul