Open krillin666 opened 3 years ago
This appears to be an ngspice issue. I fixed the bug on SourceForge and made a merge request:
https://sourceforge.net/p/ngspice/ngspice/merge-requests/13/
Try this fix. Let me know if you need any help compiling libngspice.so from source.
Issue: cannot run this example in windows 10 : https://pyspice.fabrice-salvaire.fr/releases/v1.5/examples/ngspice-shared/external-source.html?highlight=external#
###################### environment (windows10, anaconda) #######################
>python --version
Python 3.9.16
>conda list | grep spice
packages in environment at Anaconda3\envs\spice:
ngspice 38 h57928b3_0 conda-forge
ngspice-exe 38 h295a5eb_0 conda-forge
ngspice-lib 38 h295a5eb_0 conda-forge
pyspice 1.5 py39hcbf5309_1 conda-forge
###############################To reproduce #####################################
2023-02-06 12:03:37,546 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.WARNING - Unsupported Ngspice version 38
logger.setLevel('DEBUG')
and run the code in pycharm. The output is:
Anaconda3\envs\spice\python.exe x:/bbb/main.py
2023-02-06 12:15:14,798 - PySpice.Spice.Netlist - Netlist.DEBUG - Element don't define a PINS attribute
2023-02-06 12:15:14,798 - PySpice.Spice.Netlist - Netlist.DEBUG - FixedPinElement don't define a PINS attribute
2023-02-06 12:15:14,799 - PySpice.Spice.Netlist - Netlist.DEBUG - SubCircuitElement don't define a PINS attribute
2023-02-06 12:15:14,799 - PySpice.Spice.Netlist - Netlist.DEBUG - Resistor don't define a PINS attribute
2023-02-06 12:15:14,802 - PySpice.Spice.Netlist - Netlist.DEBUG - SemiconductorResistor don't define a PINS attribute
2023-02-06 12:15:14,802 - PySpice.Spice.Netlist - Netlist.DEBUG - BehavioralResistor don't define a PINS attribute
2023-02-06 12:15:14,803 - PySpice.Spice.Netlist - Netlist.DEBUG - Capacitor don't define a PINS attribute
2023-02-06 12:15:14,803 - PySpice.Spice.Netlist - Netlist.DEBUG - SemiconductorCapacitor don't define a PINS attribute
2023-02-06 12:15:14,803 - PySpice.Spice.Netlist - Netlist.DEBUG - BehavioralCapacitor don't define a PINS attribute
2023-02-06 12:15:14,803 - PySpice.Spice.Netlist - Netlist.DEBUG - Inductor don't define a PINS attribute
2023-02-06 12:15:14,803 - PySpice.Spice.Netlist - Netlist.DEBUG - BehavioralInductor don't define a PINS attribute
2023-02-06 12:15:14,805 - PySpice.Spice.Netlist - Netlist.DEBUG - CoupledInductor don't define a PINS attribute
2023-02-06 12:15:14,805 - PySpice.Spice.Netlist - Netlist.DEBUG - VoltageControlledSwitch don't define a PINS attribute
2023-02-06 12:15:14,805 - PySpice.Spice.Netlist - Netlist.DEBUG - CurrentControlledSwitch don't define a PINS attribute
2023-02-06 12:15:14,805 - PySpice.Spice.Netlist - Netlist.DEBUG - VoltageSource don't define a PINS attribute
2023-02-06 12:15:14,806 - PySpice.Spice.Netlist - Netlist.DEBUG - CurrentSource don't define a PINS attribute
2023-02-06 12:15:14,806 - PySpice.Spice.Netlist - Netlist.DEBUG - VoltageControlledCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,806 - PySpice.Spice.Netlist - Netlist.DEBUG - VoltageControlledVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,806 - PySpice.Spice.Netlist - Netlist.DEBUG - CurrentControlledCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,806 - PySpice.Spice.Netlist - Netlist.DEBUG - CurrentControlledVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,807 - PySpice.Spice.Netlist - Netlist.DEBUG - BehavioralSource don't define a PINS attribute
2023-02-06 12:15:14,807 - PySpice.Spice.Netlist - Netlist.DEBUG - NonLinearVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,807 - PySpice.Spice.Netlist - Netlist.DEBUG - NonLinearCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,807 - PySpice.Spice.Netlist - Netlist.DEBUG - JunctionFieldEffectTransistor don't define a PINS attribute
2023-02-06 12:15:14,808 - PySpice.Spice.Netlist - Netlist.DEBUG - Mesfet don't define a PINS attribute
2023-02-06 12:15:14,808 - PySpice.Spice.Netlist - Netlist.DEBUG - LosslessTransmissionLine don't define a PINS attribute
2023-02-06 12:15:14,808 - PySpice.Spice.Netlist - Netlist.DEBUG - LossyTransmission don't define a PINS attribute
2023-02-06 12:15:14,809 - PySpice.Spice.Netlist - Netlist.DEBUG - CoupledMulticonductorLine don't define a PINS attribute
2023-02-06 12:15:14,810 - PySpice.Spice.Netlist - Netlist.DEBUG - SingleLossyTransmissionLine don't define a PINS attribute
2023-02-06 12:15:14,810 - PySpice.Spice.Netlist - Netlist.DEBUG - XSpiceElement don't define a PINS attribute
2023-02-06 12:15:14,810 - PySpice.Spice.Netlist - Netlist.DEBUG - GSSElement don't define a PINS attribute
2023-02-06 12:15:14,827 - PySpice.Spice.Netlist - Netlist.DEBUG - SinusoidalVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,827 - PySpice.Spice.Netlist - Netlist.DEBUG - SinusoidalCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,827 - PySpice.Spice.Netlist - Netlist.DEBUG - AcLine don't define a PINS attribute
2023-02-06 12:15:14,827 - PySpice.Spice.Netlist - Netlist.DEBUG - PulseVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,827 - PySpice.Spice.Netlist - Netlist.DEBUG - PulseCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,827 - PySpice.Spice.Netlist - Netlist.DEBUG - ExponentialVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,828 - PySpice.Spice.Netlist - Netlist.DEBUG - ExponentialCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,828 - PySpice.Spice.Netlist - Netlist.DEBUG - PieceWiseLinearVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,828 - PySpice.Spice.Netlist - Netlist.DEBUG - PieceWiseLinearCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,828 - PySpice.Spice.Netlist - Netlist.DEBUG - SingleFrequencyFMVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,828 - PySpice.Spice.Netlist - Netlist.DEBUG - SingleFrequencyFMCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,829 - PySpice.Spice.Netlist - Netlist.DEBUG - AmplitudeModulatedVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,829 - PySpice.Spice.Netlist - Netlist.DEBUG - AmplitudeModulatedCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,829 - PySpice.Spice.Netlist - Netlist.DEBUG - RandomVoltageSource don't define a PINS attribute
2023-02-06 12:15:14,829 - PySpice.Spice.Netlist - Netlist.DEBUG - RandomCurrentSource don't define a PINS attribute
2023-02-06 12:15:14,936 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - locale LC_NUMERIC is not forced to C
2023-02-06 12:15:15,006 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - Load library C:\Users\justin.cui\Anaconda3\envs\spice\lib\site-packages\PySpice\Spice\NgSpice\Spice64_dll\dll-vs\ngspice.dll
2023-02-06 12:15:15,104 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ******'
2023-02-06 12:15:15,105 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** ngspice-38 shared library'
2023-02-06 12:15:15,105 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** Creation Date: Nov 1 2022 12:49:46'
2023-02-06 12:15:15,105 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ******'
2023-02-06 12:15:15,111 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - Execute command: version -f
2023-02-06 12:15:15,111 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ******'
2023-02-06 12:15:15,111 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** ngspice-38 : Circuit level simulation program'
2023-02-06 12:15:15,111 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** The U. C. Berkeley CAD Group'
2023-02-06 12:15:15,111 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** Copyright 1985-1994, Regents of the University of California.'
2023-02-06 12:15:15,111 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** Copyright 2001-2022, The ngspice team.'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** Please get your ngspice manual from http://ngspice.sourceforge.net/docs.html'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** Creation Date: Nov 1 2022 12:49:46'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout **'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** CIDER 1.b1 (CODECS simulator) included'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** XSPICE extensions included'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b"stdout ** Relevant compilation options (refer to user's manual):"
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** OpenMP multithreading for BSIM3, BSIM4 enabled'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** X11 interface not compiled into ngspice'
2023-02-06 12:15:15,112 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout **'
2023-02-06 12:15:15,113 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ** ngspice shared library.'
2023-02-06 12:15:15,113 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout ******'
2023-02-06 12:15:15,113 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - Ngspice version 38 with extensions: CIDER, XSPICE
2023-02-06 12:15:15,113 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.WARNING - Unsupported Ngspice version 38
2023-02-06 12:15:15,113 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - Execute command: set nomoremode
2023-02-06 12:15:15,140 - PySpice.Spice.NgSpice.Simulation.NgSpiceSharedCircuitSimulator - Simulation.DEBUG - desk
.title Voltage Divider
Vinput input 0 dc 0 external
R1 input output 10kOhm
R2 output 0 1kOhm
.options TEMP = 25C
.options TNOM = 25C
.tran 0.0001s 0.04s 0s
.end
2023-02-06 12:15:15,140 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - Execute command: destroy all 2023-02-06 12:15:15,140 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - ngSpice_Circ .title Voltage Divider Vinput input 0 dc 0 external R1 input output 10kOhm R2 output 0 1kOhm .options TEMP = 25C .options TNOM = 25C .tran 0.0001s 0.04s 0s .end
2023-02-06 12:15:15,152 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout Note: No compatibility mode selected!' 2023-02-06 12:15:15,153 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout Circuit: Voltage Divider' 2023-02-06 12:15:15,153 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.DEBUG - Execute command: run 2023-02-06 12:15:15,154 - PySpice.Spice.NgSpice.Shared - Shared.DEBUG - b'stdout Doing analysis at TEMP = 25.000000 and TNOM = 25.000000'
Process finished with exit code -1073741819 (0xC0000005)
Hello, I am trying to plug an external current source into a circuit I made with Pyspice. I first wanted to test the one in this example. I modified the code such that the plug source was a current one and not a voltage. However I haven't had any success because every attempt I make to solve I get the error "parameter value out of range or the wrong type".
I thought that maybe the current values were not being generated properly and as such were causing the given error. However, when I added print statements to the MyNgSpiceShared class I noticed (see output bellow) that the get_isrc_data function is not even called.
Output
The code I am using is bellow:
Thank you for your time.