Closed liubenyuan closed 7 years ago
I got 4 examples to work: lowpass_filter.py
and npn.py
quad.py
quadosc,py
.
Downloaded ngspice.dll and related files from http://ngspice.sourceforge.net/shared.html
Modified ngspyce.py because of the path issue:
import os
os.chdir('C:/Users/ ... ng_start64_binaries/bin/')
spice = CDLL('ngspice.dll')
also had to install under a Python 3 environment in Anaconda because it uses things like list.clear() that are not in Python 2?
Found this http://stackoverflow.com/a/13277363/125507
and changed my code to this:
if os.name == 'nt': # Windows
curr_dir_before = os.getcwd()
os.chdir('C:/Users/.../ng_start64_binaries/bin/')
spice = CDLL('ngspice')
os.chdir(curr_dir_before)
else:
# Probably Linux?
spice = CDLL('libngspice.so')
ngspice-26plus-master-32.7z also has ngspice.dll but the folder structure is different?
BTW: when simulating quad.py, ngspice seems to be much slower than LTSpice.
Maybe related to this line of spinit?:
** set the number of threads in openmp
** default (if compiled with --enable-openmp) is: 2
set num_threads=4
Hi,
I compile a windows x64 based
ngspice.dll
for ngspyce and modify line 12 ofngspyce.py
as:I placed all
ngspice
binaries andngspice.dll
inD:/Tools/spice/bin
, and set up thePATH
environment of windows asD:\Tools\spice\bin
.ngspyce
can be loaded and it can find the dll!In order to find
spinit
file for ngspice, I setSPICE_SCRIPTS
of windows toD:\Tools\spice\share\ngspice\scripts
, and modifyspinit
asall the examples,
lowpass_filter.py
andnpn.py
work fine ! But it keeps complainingthe
quad.py
failed becausespice2poly.cm
can not be loaded.Can we solve it and enable
ngspyce
for windows ?BTW: when simulating
quad.py
, ngspice seems to be much slower thanLTSpice
.