PySpice icon indicating copy to clipboard operation
PySpice copied to clipboard

Cannot run ngspice example "ngspice.dll cannot recover and awaits"

Open weishi0079 opened this issue 3 years ago • 0 comments

Environment (OS, Python version, PySpice version, simulator)

OSX, python 3.6, pyspice 1.4.3, ngspice

Expected Behaviour

python ngspice-interpreter.py

It's expected to print the results, but the error message is the following:

Actual Behaviour


** ngspice-32 : Circuit level simulation program ** The U. C. Berkeley CAD Group ** Copyright 1985-1994, Regents of the University of California. ** Copyright 2001-2020, The ngspice team. ** Please get your ngspice manual from http://ngspice.sourceforge.net/docs.html ** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html ** ** CIDER 1.b1 (CODECS simulator) included ** XSPICE extensions included ** Relevant compilation options (refer to user's manual): ** OpenMP multithreading for BSIM3, BSIM4 enabled ** X11 interface not compiled into ngspice **


false = 0.000000e+00 true = 1.000000e+00 boltz = 1.380649e-23 c = 2.997925e+08 e = 2.718282e+00 echarge = 1.602177e-19 i = 0.000000e+00,1.000000e+00 kelvin = -2.73150e+02 no = 0.000000e+00 pi = 3.141593e+00 planck = 6.626070e-34 yes = 1.000000e+00 Devices available in the simulator URC : Uniform R.C. line ASRC : Arbitrary Source BJT : Bipolar Junction Transistor BSIM1 : Berkeley Short Channel IGFET Model BSIM2 : Berkeley Short Channel IGFET Model BSIM3 : Berkeley Short Channel IGFET Model Version-3 BSIM3v0 : Berkeley Short Channel IGFET Model Version-3 (3.0) BSIM3v1 : Berkeley Short Channel IGFET Model Version-3 (3.1) BSIM3v32 : Berkeley Short Channel IGFET Model Version-3 B4SOI : Berkeley SOI MOSFET model version 4.4.0 BSIM4 : Berkeley Short Channel IGFET Model-4 BSIM4v5 : Berkeley Short Channel IGFET Model-4 BSIM4v6 : Berkeley Short Channel IGFET Model-4 BSIM4v7 : Berkeley Short Channel IGFET Model-4 B3SOIPD : Berkeley SOI (PD) MOSFET model version 2.2.3 B3SOIFD : Berkeley SOI MOSFET (FD) model version 2.1 B3SOIDD : Berkeley SOI MOSFET (DD) model version 2.1 Capacitor : Fixed capacitor CCCS : Current controlled current source CCVS : Linear current controlled current source CplLines : Simple Coupled Multiconductor Lines CSwitch : Current controlled ideal switch Diode : Junction Diode model HFET1 : HFET1 Model HFET2 : HFET2 Model HiSIM2 : Hiroshima University STARC IGFET Model 2.8.0 HiSIMHV1 : Hiroshima University STARC IGFET Model - HiSIM_HV v.1 HiSIMHV2 : Hiroshima University STARC IGFET Model - HiSIM_HV v.2 Inductor : Fixed inductor mutual : Mutual inductors Isource : Independent current source JFET : Junction Field effect transistor JFET2 : Short channel field effect transistor LTRA : Lossy transmission line MES : GaAs MESFET model MESA : GaAs MESFET model Mos1 : Level 1 MOSfet model with Meyer capacitance model Mos2 : Level 2 MOSfet model with Meyer capacitance model Mos3 : Level 3 MOSfet model with Meyer capacitance model Mos6 : Level 6 MOSfet model with Meyer capacitance model Mos9 : Modified Level 3 MOSfet model Resistor : Simple linear resistor SOI3 : Basic Thick Film SOI3 model v2.7 Switch : Ideal voltage controlled switch Tranline : Lossless transmission line TransLine : Simple Lossy Transmission Line VBIC : Vertical Bipolar Inter-Company Model VCCS : Voltage controlled current source VCVS : Voltage controlled voltage source Vsource : Independent voltage source VDMOS : DMOS model based on Level 1 MOSFET model NBJT : 1D Numerical Bipolar Junction Transistor model NBJT2 : 2D Numerical Bipolar Junction Transistor model NUMD : 1D Numerical Junction Diode model NUMD2 : 2D Numerical Junction Diode model NUMOS : 2D Numerical MOS Field Effect Transistor model spice2poly : 2G6 compatible polynomial controlled source climit : controlled limiter block divide : divider block d_dt : differentiator block gain : A simple gain block hyst : hysteresis block ilimit : current limiter block int : integrator block limit : limit block mult : multiplier block multi_input_pwl : multi_input_pwl block oneshot : one-shot pwl : piecwise linear controlled source sine : controlled sine wave oscillator slew : a simple slew rate follower block square : controlled square wave oscillator summer : summer block s_xfer : s-domain transfer function block triangle : controlled triangle wave oscillator filesource : File Source adc_bridge : analog-to-digital converter node bridge dac_bridge : digital-to-analog converter node bridge d_and : digital n-input and gate d_buffer : digital one-bit-wide buffer d_dff : digital d-type flip flop d_dlatch : digital d-type latch d_fdiv : digital frequency divider d_genlut : digital n-input x m-output look-up table gate d_inverter : digital one-bit-wide inverter d_jkff : digital jk-type flip flop d_lut : digital n-input look-up table gate d_nand : digital n-input nand gate d_nor : digital n-input nor gate d_open_c : digital one-bit-wide open-collector buffer d_open_e : digital one-bit-wide open-emitter buffer d_or : digital n-input or gate d_osc : controlled digital oscillator d_pulldown : digital pulldown resistor d_pullup : digital pullup resistor d_ram : digital random-access memory d_source : digital signal source d_srff : digital set-reset flip flop d_srlatch : digital sr-type latch d_state : digital state machine d_tff : digital toggle flip flop d_tristate : digital one-bit-wide tristate buffer d_xnor : digital n-input xnor gate d_xor : digital n-input xor gate aswitch : analog switch capacitor : Capacitor with voltage initial condition cmeter : ATESSE 1 compatible capacitance meter core : magnetic core inductor : Inductor with current initial condition lcouple : inductive coupling (for use with 'core' model) lmeter : ATESSE 1 compatible inductance meter potentiometer : potentiometer zener : zener diode memristor : Memristor interface sidiode : simple diode d_to_real : Node bridge from digital to real with enable real_delay : A Z ** -1 block working on real data real_gain : A gain block for event-driven real data real_to_v : Node bridge from real to analog voltage table2d : 2D table model table3d : 3D table model Resistor - Simple linear resistor Model Parameters id# Name Dir Description 103 rsh inout Sheet resistance 106 narrow inout Narrowing of resistor 106 dw inout Narrowing of resistor 109 short inout Shortening of resistor 109 dlr inout Shortening of resistor 101 tc1 inout First order temp. coefficient 101 tc1r inout First order temp. coefficient 102 tc2 inout Second order temp. coefficient 102 tc2r inout Second order temp. coefficient 116 tce inout exponential temp. coefficient 104 defw inout Default device width 104 w inout Default device width 105 l inout Default device length 110 kf inout Flicker noise coefficient 111 af inout Flicker noise exponent 108 tnom inout Parameter measurement temperature 107 r inout Resistor model default value 107 res inout n.a. 112 bv_max inout maximum voltage over resistor 113 lf inout noise area length exponent 114 wf inout noise area width exponent 115 ef inout noise frequency exponent Instance Parameters id# Name Dir Description 1 resistance inout Resistance 1 r inout Resistance 10 ac inout AC resistance value 8 temp inout Instance operating temperature 14 dtemp inout Instance temperature difference with the rest of the circuit 3 l inout Length 2 w inout Width 12 m inout Multiplication factor 16 tc inout First order temp. coefficient 16 tc1 inout First order temp. coefficient 17 tc2 inout Second order temp. coefficient 19 tce inout exponential temp. coefficient 18 bv_max inout maximum voltage over resistor 13 scale inout Scale factor 15 noisy inout Resistor generate noise 15 noise inout n.a. 5 sens_resist in flag to request sensitivity WRT resistance 6 i out Current 7 p out Power 206 sens_dc out dc sensitivity 201 sens_real out dc sensitivity and real part of ac sensitivity 202 sens_imag out dc sensitivity and imag part of ac sensitivity 203 sens_mag out ac sensitivity of magnitude 204 sens_ph out ac sensitivity of phase 205 sens_cplx out ac sensitivity From cffi callback <function NgSpiceShared._send_char at 0x7f7c84d4d598>: Traceback (most recent call last): File "/Users/wshi/opt/anaconda3/envs/test_pyspice/lib/python3.6/site-packages/PySpice/Spice/NgSpice/Shared.py", line 617, in _send_char prefix, _, content = message.partition(' ') TypeError: a bytes-like object is required, not 'str' 2022-01-31 18:33:04,126 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Error: ngspice.dll cannot recover and awaits to be detached Traceback (most recent call last): File "ngspice-interpreter.py", line 71, in ngspice.load_circuit(circuit) File "/Users/wshi/opt/anaconda3/envs/test_pyspice/lib/python3.6/site-packages/PySpice/Spice/NgSpice/Shared.py", line 1140, in load_circuit raise NameError("ngSpice_Circ returned {}".format(rc)) NameError: ngSpice_Circ returned 1

Steps to reproduce the behaviour

I followed OSX installation instructions:

  1. create a python 3.6 environment.
  2. conda install -c conda-forge ngspice-lib
  3. conda install -c conda-forge pyspice

Then run the ngspice-interpreter example: python ngspice-interpreter.py

weishi0079 avatar Feb 01 '22 00:02 weishi0079