+
+
+
+
+
+
+
diff --git a/pyspice-discourse-backup/c/circuit-simulation/9.rss b/pyspice-discourse-backup/c/circuit-simulation/9.rss
new file mode 100644
index 00000000..fe0b753e
--- /dev/null
+++ b/pyspice-discourse-backup/c/circuit-simulation/9.rss
@@ -0,0 +1,515 @@
+
+
+
+ Circuit Simulation - PySpice
+ https://pyspice.discourse.group/c/circuit-simulation/9
+ Topics in the 'Circuit Simulation' category
+
+ Thu, 13 Jan 2022 03:55:35 +0000
+
+
+ Simulating a circuit with 16 MOSFETs: True gmin stepping error
+
+ Circuit Simulation
+ Hello,
+
I am trying to simulate a circuit using 16 MOSFETS.
+
The issue is that once the MOSFETS’s 15 and 16 are placed in the schematic, it results in an error: PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR
+
If the MOSFET’s 15 and 16 are commented out, then the code compiles.
+
I am using NGspice-34.dll and PySpice 1.5. Have also tested with Pyspice 1.4.3 and NGspice-32.dll.
+
Is NGSpice reaching some maximum nodes/complexity limit? OR is this an issue with mosfet model? OR it is a circuit netlist (floating node?) issue?
+
Any help or ideas would be greatly appreciated.
+
The code and error message are reproduced below.
+
Thanks
+
Kahless96
+
##***********************************************
+import math
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.widgets import Cursor
+from matplotlib.pyplot import semilogx
+from matplotlib import pyplot
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
Here is the error messages after which it fails to run:
+
2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: Starting true gmin stepping
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-03 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-04 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-05 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-06 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-07 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-08 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-09 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-10 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-11 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: True gmin stepping completed
+
I have seen this gmin stepping error in other forum posts but in those cases it was related to circuit netlist error. This does not seem to be the case here.
+
The mosfet models being used are provided with Pyspice.
+ ]]>
+ https://pyspice.discourse.group/t/simulating-a-circuit-with-16-mosfets-true-gmin-stepping-error/162
+ Thu, 13 Jan 2022 03:55:35 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-162
+
+
+
+ How to write .func in pyspice and use it in behavioral source?
+
+ Circuit Simulation
+ I want to write a .func that will help me designing a device model. I used **raw_spice=’ …’ ** but it is not working. I am new in pyspice.
+
+ ]]>
+ https://pyspice.discourse.group/t/how-to-write-func-in-pyspice-and-use-it-in-behavioral-source/148
+ Thu, 16 Sep 2021 00:26:03 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-148
+
+
+
+ Interrupted simulation multiple sources
+
+ Circuit Simulation
+ Hi everyone,
+
for a research project I’m working on control strategies for PFC circuits and therefore I need to simulate a passive circuit in conjunction with two half bridges.
+Problem is that I need the simulation to interact with a python script since I need to calculate the control signals of the two half bridges externally and thus the simualtion flow is as follows.
+
First, I need to initialize the simulation which basically means that I need to sample the amplitude and phase of a sinusodial source representing the grid voltage and the component values and initial conditions of the passive components. Next, I need to run the simulation in chunks where I first calculate the four control signals of the half bridges based on the current and voltage signals of the passive circuit followed by a chunk of transient simulation for a given time span (sample rate of the controller).
+
I tried to implement this flow but I unfortunately I struggle with the following issues.
+
a) Phase of the AC source:
+I tired SinusoidalVoltageSource() but I failed to specify a phase offset. Altough it’s base class SinusoidalMixin() offers a delay attribute, it seems that it just enables the source after a given time and thus this isn’t the desired behaviour for my purpose. Alternatively, I defined my own grid voltage using a NgSpiceShared object according …/examples/ngspice-shared/external-source.html.
+This essential does the trick for me but leaves with the next problem.
+
b) Multiple External Sources:
+Give the simulation flow above I need to run the simulation with at least four external sources, two for every half bridge, and five if I define the grid voltage also as external source. So I wonder how I define multiple shared objects.
+
c) Setting the initial conditions
+Since I run the simulation in chunks I wonder if I have to preload the nodes with the latest values and I need to run the simulation with start_time=0 and end_time=timespan according the controller’s sample rate or are the states kept internally and I need just to run the simulation with start_time=(k-1)timespan, end_time=ktimespan in order to run the kth simulation chunk.
for node in analysis.nodes.values():
+print(‘Node {}: {:4.1f} V’.format(str(node), float(node)))
+
When I run, it gives an error:
+
Traceback (most recent call last):
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 928, in getattr
+return self.getitem(attribute_name)
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 921, in getitem
+raise IndexError(attribute_name) # KeyError
+IndexError: E
+
During handling of the above exception, another exception occurred:
+
Traceback (most recent call last):
+File “C:/Users/Desktop/PySpice/node-voltage-method-example8.py”, line 22, in
+circuit.E(1, 4, 3, 2, 3, 3)
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 930, in getattr
+raise AttributeError(attribute_name)
+AttributeError: E
+
I am not sure where I am going wrong. I have been able to simulate a CCVS (part name H) but all other dependent sources seem to give an error.
+
Can anyone please point out what is wrong in the code above?
+ ]]>
+ https://pyspice.discourse.group/t/simulating-dependent-sources-ccvs-works-but-vcvs-does-not/105
+ Wed, 02 Dec 2020 01:58:43 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-105
+
+
+
+ Is there a way to manipulate parameter during the simulation
+
+ Circuit Simulation
+ Hello everyone,
+
ist it possible to ‘pause’ the simulation, get values of certain voltages or currents manipulate them and put them back into the simulation?
+
For example to implement a digital controller or something like that.
+ ]]>
+ https://pyspice.discourse.group/t/is-there-a-way-to-manipulate-parameter-during-the-simulation/72
+ Wed, 19 Aug 2020 09:46:34 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-72
+
+
+
+ Inputing data from python model into ngspice shared netlist
+
+ Circuit Simulation
+ Hello,
+
I’ve been trying to simulate a model of a neuron coupled to a microelectrode in ngspice. However, while the microelectrode is easy to simulate the neuronal model is quite difficult. As such, when I found pyspice I thought maybe I could use the netlist I already have for the microelectrode and create the neuron model in python and use the output voltage of the neuron model as an input in the microelectrode model.
+I’ve read through all the examples and some documentation and even used the ngspice shared interpreter example with my microelectrode netlist but I cannot even find a way of just plotting the circuits transient analysis (without the neuron model) as I did with ngspice.
+
To summarize, my questions are:
+
+
Can I use my already written netlist of the microelectrode with the ngspice shared option ?
+
To interface the neuron model that I will write in python as source voltage for the microelectrode does it mean that I have to re-write the netlist into pyspyce nomenclature ?
+ ]]>
+ https://pyspice.discourse.group/t/inputing-data-from-python-model-into-ngspice-shared-netlist/66
+ Mon, 03 Aug 2020 11:05:01 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-66
+
+
+
+ Transistor Example
+
+ Circuit Simulation
+ In the example 8.20.1 AC Coupled Amplifier, when I was trying to run the code in Jupyter Notebook
+
~/anaconda3/envs/Circuits/lib/python3.6/site-packages/cffi/api.py in _load_backend_lib(backend, name, flags)
+825 if first_error is not None:
+826 msg = “%s. Additionally, %s” % (first_error, msg)
+–> 827 raise OSError(msg)
+828 return backend.load_library(path, flags)
+829
+
OSError: cannot load library ‘libngspice.dylib’: dlopen(libngspice.dylib, 2): image not found. Additionally, ctypes.util.find_library() did not manage to locate a library called ‘libngspice.dylib’
+ ]]>
+ https://pyspice.discourse.group/t/transistor-example/63
+ Fri, 31 Jul 2020 05:27:09 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-63
+
+
+
+ XSPICE elements in PySpice
+
+ Circuit Simulation
+ Good afternoon!
+I’m trying to model a simple electrical circuit with XSPICE elements. For example, the electrical circuit from Chapter 27.1 (Ngspice user manual):
+
from PySpice.Spice.Netlist import Circuit
+
+test = """XSPICE
+Vin1 1 0 DC 0V AC 1.0 SIN(0V 1V 1000Hz)
+Ccouple 1 in 0.000001
+Rzin in 0 19.35k
+Aamp in aout gain_block
+.model gain_block gain (gain=-3.9 out_offset=7.003)
+Rzout aout coll 3.9k
+Rbig coll 0 1e12
+.control
+run
+display
+tran 0.00001 0.003
+plot i(Vin1)
+.endc
+.end
+"""
+circuit = Circuit(test)
+
+simulator = circuit.simulator(temperature=27, nominal_temperature=27)
+analysis = simulator.transient(step_time=0.00001, end_time=0.003)
+
+
When I try to run it I get an error:
+
File ".../.local/lib/python3.7/site-packages/PySpice/Spice/RawFile.py", line 223, in _read_header_line
+ raise NameError("Unexpected line: %s" % (line))
+NameError: Unexpected line: Reducing trtol to 1 for xspice 'A' devices
+
+
So there are two questions:
+
+
If I understand correctly, the error is caused by the ngspice message “Reducing trtol to 1 for xspice ‘A’ devices”. Is it possible to avoid this error? When adding a line “option trtol=1” after the line “.control” I get the following error:
+NameError: Expected label Title instead of No. of Data Rows
+
+
Is it possible to set the value of trtol and other Simulator Variables by using any pyspice command?
+
+
I am using Spyder 4, PySpice 1.4.3 and ngspice-30 (DEFAULT_SIMULATOR = ‘ngspice-subprocess’) in the Debian linux operating system.
+ ]]>
+ https://pyspice.discourse.group/t/xspice-elements-in-pyspice/61
+ Sat, 11 Jul 2020 16:18:54 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-61
+
+
+
+ AttributeError: type object 'NgSpiceShared' has no attribute 'new_instance'
+
+ Circuit Simulation
+ good afternoon community among my adventure to simulate an example of the pyspice module I ran into the following error:
+---------------------------------------------------------------------------
+
AttributeError Traceback (most recent call last)
+
+<ipython-input-12-475d4280ae1b> in <module>()
+----> 1 simulator = circuit.simulator(temperature=25, nominal_temperature=25)
+ 2 analysis = simulator.ac(start_frequency=1@u_Hz, stop_frequency=1@u_MHz, number_of_points=10, variation='dec')
+
+2 frames
+
+/usr/local/lib/python3.6/dist-packages/PySpice/Spice/NgSpice/Simulation.py in __init__(self, circuit, **kwargs)
+ 97 ngspice_shared = kwargs.get('ngspice_shared', None)
+ 98 if ngspice_shared is None:
+---> 99 self._ngspice_shared = NgSpiceShared.new_instance()
+ 100 else:
+ 101 self._ngspice_shared = ngspice_shared
+
+AttributeError: type object 'NgSpiceShared' has no attribute 'new_instance
+
+
the example link is as follows
+https://pyspice.fabrice-salvaire.fr/examples/filter/low-pass-rc-filter.html
+the characteristic of my environment are the following
+ubuntu 18.04, python 3.6.2, pyscpice 1.4.2
+To clarify I am a student of electrical engineering and I am just getting into this world of computer science, thank you very much for your help
+ ]]>
+ https://pyspice.discourse.group/t/attributeerror-type-object-ngspiceshared-has-no-attribute-new-instance/39
+ Tue, 26 May 2020 00:40:24 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-39
+
+
+
+ Example transistor
+
+ Circuit Simulation
+ good afternoon I communicate with the community because I am not very good at programming but I am trying to learn how to simulate circuits that I need for a job, however when I try to simulate the circuit of the example of transistors I get the following error
+
Traceback (most recent call last):
+ File "polos.py", line 50, in <module>
+ circuit.include(spice_library['2n2222a'])
+ File "/usr/local/lib/python3.6/dist-packages/PySpice/Spice/Library.py", line 107, in __getitem__
+ raise KeyError(name)
+KeyError: '2n2222a'
+ ]]>
+ https://pyspice.discourse.group/t/example-transistor/36
+ Fri, 22 May 2020 23:17:28 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-36
+
+
+
+ About the Circuit Simulation category
+
+ Circuit Simulation
+ (Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
+
+
+
+
+
+
+
diff --git a/pyspice-discourse-backup/c/data-analysis-using-python/8.rss b/pyspice-discourse-backup/c/data-analysis-using-python/8.rss
new file mode 100644
index 00000000..517a02b8
--- /dev/null
+++ b/pyspice-discourse-backup/c/data-analysis-using-python/8.rss
@@ -0,0 +1,61 @@
+
+
+
+ Data Analysis using Python - PySpice
+ https://pyspice.discourse.group/c/data-analysis-using-python/8
+ Topics in the 'Data Analysis using Python' category
+
+ Fri, 06 Nov 2020 15:07:46 +0000
+
+
+ Losing units when summing a Waveform
+
+ Data Analysis using Python
+ I multiplied two Waveform objects: one containing voltages and the other containing currents. Then I multiplied it by a PeriodValue. As expected, the resulting Wavform object contains numbers with the units of Joules. But when I applied the sum() method to this Waveform, I got a scalar value with no units.
+
Is there any way to do this without losing the units for the calculations that follow?
+ ]]>
+ https://pyspice.discourse.group/t/losing-units-when-summing-a-waveform/97
+ Fri, 06 Nov 2020 15:07:46 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-97
+
+
+
+ About the Data Analysis using Python category
+
+ Data Analysis using Python
+ (Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
+
+
+
+
+
+
+
diff --git a/pyspice-discourse-backup/c/help/5.rss b/pyspice-discourse-backup/c/help/5.rss
new file mode 100644
index 00000000..b1daf146
--- /dev/null
+++ b/pyspice-discourse-backup/c/help/5.rss
@@ -0,0 +1,388 @@
+
+
+
+ Help - PySpice
+ https://pyspice.discourse.group/c/help/5
+ Topics in the 'Help' category The right place to get help on PySpice
+
+ Tue, 18 May 2021 20:26:00 +0000
+
+
+ Whats PySpice's Advantages?
+
+ Help
+ Hi friends, why I have use pySpice instead of use direct spice program? Whats advantages of using pyspice? I must a homework like electronic circuits with pyspice but I didn’t find a topic. Can you help me find a topic. How can I do with pyspice?
+
+ ]]>
+ https://pyspice.discourse.group/t/whats-pyspices-advantages/135
+ Tue, 18 May 2021 20:26:00 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-135
+
+
+
+ Can SpiceParser parse subcircuits?
+
+ Help
+ We want to parse a sp file with a netlist that embeds a subcircuit definition. When we parse it with SpiceParser we noticed that the subcircuit definition is removed. Is there a way to include the subcircuit definition during the parsing process?
+
+ ]]>
+ https://pyspice.discourse.group/t/can-spiceparser-parse-subcircuits/133
+ Fri, 30 Apr 2021 03:23:54 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-133
+
+
+
+ Error in running examples
+
+ Help
+ I’ve just installed PySpice (on Fedora, using pip install PySpice). I’ve downloaded the examples with pyspice-post-installation --download-example and tried to run them. I get a number of errors, but the one that appears most often is:
+
pyspice-post-installation --download-example
+
I googled the problem but couldn’t fix it, grateful for suggestions.
+ ]]>
+ https://pyspice.discourse.group/t/error-in-running-examples/127
+ Tue, 09 Mar 2021 23:43:16 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-127
+
+
+
+ Google COLAB + PySpice
+
+ Help
+ I trying use PySpice on google Colab, but I fail…
+Some one can tell me if is possible, and how i can do?
+
Aparently… I should but i dont be able to install or reference there the “ngspice dll”
+ ]]>
+ https://pyspice.discourse.group/t/google-colab-pyspice/125
+ Sun, 07 Mar 2021 02:56:43 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-125
+
+
+
+ Read a NgSpice rawfile using PySpice
+
+ Help
+ Hello guys,
+
I am writing a python script that generates, runs and eventually will read the raw files. The command I use to run the netlist is the following: subprocess.run([path_to_ngspice_executable,'-r','rawfile.raw','-b','-i',my_netlist]) which generates my rawfile.
+
Could you please tell me what PySpice command to use so I can read the generated raw file and plot the distribution of my voltages?
+ ]]>
+ https://pyspice.discourse.group/t/read-a-ngspice-rawfile-using-pyspice/123
+ Wed, 03 Mar 2021 08:40:44 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-123
+
+
+
+ Trouble with Libraries
+
+ Help
+ Hello!
+
To better understand PySpice, I’m working through a very simple circuit involving a voltage source, a resistor, and a 1N4148 Diode. However, I am having trouble with Python recognizing the library I need to bring in the characteristics of the diode. Here is my code:
+
'import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.ticker as ticker
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
+ ]]>
+ https://pyspice.discourse.group/t/trouble-with-libraries/94
+ Sun, 25 Oct 2020 20:45:42 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-94
+
+
+
+ Getting started -- RLC example
+
+ Help
+ Hello everyone! I am new to pyspice and trying to run the example. The issue I’m running into is with rlc-filter.py, the bode plots aren’t working and don’t match what’s in the documentation. Here are screenshots of the plots and the output which hopefully points to the issue.
+
+ ]]>
+ https://pyspice.discourse.group/t/getting-started-rlc-example/77
+ Tue, 01 Sep 2020 16:51:09 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-77
+
+
+
+ Starting with Pyspice
+
+ Help
+ Hello everyone,
+
I’m very new to PySpice, but I want to learn it. The problem is that starting is complicated and I have not found any tutorials. Do you have any recommendations on how to get started with PySpice?
+ ]]>
+ https://pyspice.discourse.group/t/starting-with-pyspice/71
+ Sun, 16 Aug 2020 18:30:48 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-71
+
+
+
+ Transfer function on voltage source
+
+ Help
+ Hi,
+
I am new to Pyspice and I am moving our LTSpice simulations to PySpice. In that simulation we have some transfer functions defined as voltage sources with a transfer function like this:
+ ]]>
+ https://pyspice.discourse.group/t/transfer-function-on-voltage-source/69
+ Sat, 08 Aug 2020 15:49:16 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-69
+
+
+
+ Looking for two .mod files used in an example code
+
+ Help
+ Hello. How are you guys doing? I am looking for the model files of the 1N5822 and the irf150 from the buck convertor example in the link below. https://pyspice.fabrice-salvaire.fr/releases/v1.4/examples/switched-power-supplies/buck-converter.html . Thanks for any help that I get.
+
+ ]]>
+ https://pyspice.discourse.group/t/looking-for-two-mod-files-used-in-an-example-code/59
+ Fri, 10 Jul 2020 22:35:03 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-59
+
+
+
+ Sub-circuit in library issue
+
+ Help
+ Hi there !
+
I would like to use a spice circuit model (a sub-circuit in a .MOD file) in a circuit created from a spice netlist (a .net file) inside PySpice. Following is a simplistic example that shows the problem with a simple RC sub-circuit. I can’t figure out why the sub-circuit is not found although it is explicitly included with the circuit.include call as in the documentation examples…
+ ]]>
+ https://pyspice.discourse.group/t/sub-circuit-in-library-issue/56
+ Mon, 06 Jul 2020 13:20:14 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-56
+
+
+
+ .cir to Python classes
+
+ Help
+ I am completely new to electronics and any kind of circuit modelling. I have a .cir file that I need to turn into python classes so I can carry out precedures like chaining 2 or more subcircuits together and doing monte carlo simulation. The .cir was exported from PSpice. I was wondering, is this possible? To turn .cir to python classes? .cir has subcircuits defined.
+
+ ]]>
+ https://pyspice.discourse.group/t/cir-to-python-classes/54
+ Thu, 02 Jul 2020 13:52:17 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-54
+
+
+
+ .param command and formula evaluation
+
+ Help
+ Hello All,
+being familiar with spice, usually prefer to create netlists in the bootstrapping way like this:
+
from PySpice.Spice.Parser import SpiceParser
+
#######################################
+
+
+
import os
+os.linesep="\n"
+
source=’’’
+.title abc
+
V1 inx 0 DC 2V
+R1 inx out 1k
+R2 out 0 2k
+.end
+‘’’
for node in analysis.nodes.values():
+print(‘Node {}: {:5.2f} V’.format(str(node), float(node)))
+
######################################
+
However in Spice Macromodels global parameters should be possible like a netlist in this way:
+######################################
+…
+source=’’’
+.title abc
+.param res=1k
+V1 inx 0 DC 2V
+R1 inx out {res}
+R2 out 0 2k
+.end
+‘’’
+… and so on…
+
Anyway, the parser does not seem to recognize neither the “.param” nor the curled braces.
+ ]]>
+ https://pyspice.discourse.group/t/param-command-and-formula-evaluation/44
+ Fri, 29 May 2020 13:17:57 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-44
+
+
+
+ Electronic component libraries
+
+ Help
+ Good afternoon everyone, I am writing to the community to consult a page to find electronic components for pyspice something similar to the page of https://www.snapeda.com/, if anyone has information you are very much appreciated
+
+ ]]>
+ https://pyspice.discourse.group/t/electronic-component-libraries/42
+ Thu, 28 May 2020 17:28:43 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-42
+
+
+
+ About the Help category
+
+ Help
+ The right place to get help on PySpice
+
+
+
+
+
+
+
+
diff --git a/pyspice-discourse-backup/c/installation/10.rss b/pyspice-discourse-backup/c/installation/10.rss
new file mode 100644
index 00000000..39dc5fa3
--- /dev/null
+++ b/pyspice-discourse-backup/c/installation/10.rss
@@ -0,0 +1,601 @@
+
+
+
+ Installation - PySpice
+ https://pyspice.discourse.group/c/installation/10
+ Topics in the 'Installation' category
+
+ Thu, 11 Nov 2021 13:45:39 +0000
+
+
+ Problems with running simulator
+
+ Installation
+ Hi every one!
+I am new to PySpice. I was running 1.4.3 ver with ngspice 3.2 and everything was working well.
+My computer did a usual clean up and update.
+
Now the netlist part works fine. But when I call the simulator I get a long error message (I will paste below). I was doing good progress and I am glad to share a 3 phase diode rectifier model which was working well. Until this problem arose. When I did an update I see that the cur ver is 1.5 and installs ngspice 3.4
+
Any help is appreciated. Else will have to go back to LTspice
~\Anaconda3\lib\site-packages\PySpice\Spice\Netlist.py in simulator(self, *args, **kwargs)
+
~\Anaconda3\lib\site-packages\PySpice\Spice\Simulation.py in factory(cls, circuit, *args, **kwargs)
+1117 “”" This class implements a circuit simulator. Each analysis mode is performed by a method that
+1118 return the measured probes.
+ → 1119
+1120 For ac and transient analyses, the user must specify a list of nodes using the probes key
+1121 argument.
+
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Simulation.py in init(self, circuit, **kwargs)
+97 ngspice_shared = kwargs.get(‘ngspice_shared’, None)
+98 if ngspice_shared is None:
+—> 99 self._ngspice_shared = NgSpiceShared.new_instance()
+100 else:
+101 self._ngspice_shared = ngspice_shared
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Shared.py in _load_library(self, verbose)
+511 if ‘SPICE_LIB_DIR’ not in os.environ:
+512 _ = str(Path(self.NGSPICE_PATH).joinpath(‘share’, ‘ngspice’))
+ → 513 os.environ[‘SPICE_LIB_DIR’] = _
+514 # self._logger.warning(‘Set SPICE_LIB_DIR = %s’, _)
+515
+
~\Anaconda3\lib\pathlib.py in new(cls, *args, **kwargs)
+1036 if cls is Path:
+1037 cls = WindowsPath if os.name == ‘nt’ else PosixPath
+ → 1038 self = cls._from_parts(args, init=False)
+1039 if not self._flavour.is_supported:
+1040 raise NotImplementedError(“cannot instantiate %r on your system”
+
~\Anaconda3\lib\pathlib.py in _from_parts(cls, args, init)
+677 # right flavour.
+678 self = object.new(cls)
+ → 679 drv, root, parts = self._parse_args(args)
+680 self._drv = drv
+681 self._root = root
+
~\Anaconda3\lib\pathlib.py in _parse_args(cls, args)
+661 parts += a._parts
+662 else:
+ → 663 a = os.fspath(a)
+664 if isinstance(a, str):
+665 # Force-cast str subclasses to str (issue #21127)
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
+ ]]>
+ https://pyspice.discourse.group/t/getting-keyerror-while-running-example/119
+ Sat, 30 Jan 2021 13:14:32 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-119
+
+
+
+ Installation example scripts
+
+ Installation
+ Dear PySpice community, I would like to share some installation example files to illustrate the installation procedure of PySpice on Linux by using apt and pip only.
+
Those files are published as Dockerfile scripts since they allow full automatic machine instantiation with docker.
+They cover both Ubuntu and Debian, using a standard approach using only apt :
+ ]]>
+ https://pyspice.discourse.group/t/installation-example-scripts/117
+ Mon, 25 Jan 2021 22:35:44 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-117
+
+
+
+ Two installation experiences on Windows
+
+ Installation
+ Windows 10
+
First I tried to install in my base conda environment on Windows 10 64-bit. It could not be installed due to package conflicts and it tried many different things to resolve the conflicts, grinding away at the CPU for two hours, and eventually I killed it.
+
Then I created a new environment specifically for PySpice and installed it:
Now I’m doing the same procedure on a Windows 7 machine (I know, I know, it’s obsolete). The install command showed no errors on the command line, but I did get a pop up error:
+
+
python.exe - System Error
+
The program can’t start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
+
OK
+
+
I haven’t seen this error before, but the install command worked so I’m ignoring it.
+
Then I try
+
pyspice-post-installation --install-ngspice-dll
+
+
Ah, now I’m getting the same error:
+
+
python.exe - System Error
+
The program can’t start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
+
OK
+
+
and if I run the check:
+
pyspice-post-installation --check-install
+
+
I get the same error dialog:
+
+
python.exe - System Error
+
The program can’t start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
+
OK
+
+
Tried System File Checker:
+
λ sfc /scannow
+
+Beginning system scan. This process will take some time.
+
+Beginning verification phase of system scan.
+Verification 100% complete.
+
+Windows Resource Protection did not find any integrity violations.
+
+
Searching my machine, it does not have api-ms-win-core-path-l1-1-0.dll anywhere. Maybe this is a Windows 10 file only. (Nope, not present on Windows 10 machine, either.)
+
Trying to install jupyterlab also doesn’t work well. Does PySpice have some weird requirements/dependencies that prevent conda from installing it alongside other things?
+
Collecting package metadata (current_repodata.json): done
+Solving environment: failed with initial frozen solve. Retrying with flexible solve.
+Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
+Collecting package metadata (repodata.json): done
+Solving environment: failed with initial frozen solve. Retrying with flexible solve.
+
+
Oh if I do it as conda install jupyterlab voila instead of using conda-forge, it works fine
And is due to stderr = ‘Error: there aren’t any circuits loaded.’
+
By debugging further I could nail down that the def run() method of the Simulation class fails because the run command after the load_circuit command complains that the circuit wasn’t loaded.
So the load_circuit method seems to not load the circuit properly in the sim, any idea why? (although it does execute it and no error is raised within that method).
+
I tried also the listing() method to query the circuit description back and also doesn’t seem to provide anything back.
+
Actually the only communication with the simulator seems to be successful is the “version -f” command which returns the valuable infos from it.
+ ]]>
+ https://pyspice.discourse.group/t/load-circuit-failing-for-some-reasons/96
+ Mon, 02 Nov 2020 20:14:10 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-96
+
+
+
+ Install Pyspice on Raspberry Pi 4 ERROR
+
+ Installation
+ Hello Everyone!
+I’m running into a problem, i want to install PySpice on Raspberry Pi 4 which runs Raspbian OS. I have read the doumentation that wrote, it is supported on Linux, Windos 64 and MAC.
+I have followed the install instructions after i typed : pip3 install PySpice the following error message i got:
+
Defaulting to user installation because normal site-packages is not writeable
+Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
+Collecting PySpice
+Using cached PySpice-1.4.3-py2.py3-none-any.whl (144 kB)
+Collecting scipy>=1.4
+Downloading scipy-1.5.3.tar.gz (25.2 MB)
+|################################| 25.2 MB 28 kB/s
+Installing build dependencies … \Ledone
+Getting requirements to build wheel … done
+Preparing wheel metadata … error
+ERROR: Command errored out with exit status 1:
+command: /usr/bin/python /home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpv39ep59r
+cwd: /tmp/pip-install-_1dtpvzc/scipy
+Complete output (139 lines):
+lapack_opt_info:
+lapack_mkl_info:
+customize UnixCCompiler
+libraries mkl_rt not found in [’/usr/local/lib’, ‘/usr/lib’, ‘/usr/lib/arm-linux-gnueabihf’]
+NOT AVAILABLE
+
openblas_lapack_info:
+customize UnixCCompiler
+customize UnixCCompiler
+ libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+openblas_clapack_info:
+customize UnixCCompiler
+customize UnixCCompiler
+ libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+flame_info:
+customize UnixCCompiler
+ libraries flame not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+atlas_3_10_threads_info:
+Setting PTATLAS=ATLAS
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries tatlas,tatlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries tatlas,tatlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries tatlas,tatlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
+ NOT AVAILABLE
+
+atlas_3_10_info:
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries satlas,satlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries satlas,satlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries satlas,satlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_3_10_info'>
+ NOT AVAILABLE
+
+atlas_threads_info:
+Setting PTATLAS=ATLAS
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries ptf77blas,ptcblas,atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries ptf77blas,ptcblas,atlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_threads_info'>
+ NOT AVAILABLE
+
+atlas_info:
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries f77blas,cblas,atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries f77blas,cblas,atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries f77blas,cblas,atlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_info'>
+ NOT AVAILABLE
+
+accelerate_info:
+ NOT AVAILABLE
+
+lapack_info:
+customize UnixCCompiler
+ libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+lapack_src_info:
+ NOT AVAILABLE
+
+ NOT AVAILABLE
+
+setup.py:460: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-yx7fyy34'), proceeding with generating Cython sources and expanding templates
+ warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
+Running from SciPy source directory.
+/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:1712: UserWarning:
+ Lapack (http://www.netlib.org/lapack/) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [lapack]) or by setting
+ the LAPACK environment variable.
+ if getattr(self, '_calc_info_{}'.format(lapack))():
+/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:1712: UserWarning:
+ Lapack (http://www.netlib.org/lapack/) sources not found.
+ Directories to search for the sources can be specified in the
+ numpy/distutils/site.cfg file (section [lapack_src]) or by setting
+ the LAPACK_SRC environment variable.
+ if getattr(self, '_calc_info_{}'.format(lapack))():
+Traceback (most recent call last):
+ File "/home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
+ main()
+ File "/home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
+ json_out['return_val'] = hook(**hook_input['kwargs'])
+ File "/home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
+ return hook(metadata_directory, config_settings)
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 161, in prepare_metadata_for_build_wheel
+ self.run_setup()
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 253, in run_setup
+ super(_BuildMetaLegacyBackend,
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 145, in run_setup
+ exec(compile(code, __file__, 'exec'), locals())
+ File "setup.py", line 583, in <module>
+ setup_package()
+ File "setup.py", line 579, in setup_package
+ setup(**metadata)
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup
+ config = configuration()
+ File "setup.py", line 477, in configuration
+ raise NotFoundError(msg)
+numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
+----------------------------------------
+
+
ERROR: Command errored out with exit status 1: /usr/bin/python /home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpv39ep59r Check the logs for full command output.
+
Is it because i have ARM Cortex-A72 architecture and not x64? Or is it because Raspbian and not exactly Linux? But raspbian based on Linux…
+ ]]>
+ https://pyspice.discourse.group/t/install-pyspice-on-raspberry-pi-4-error/90
+ Mon, 19 Oct 2020 17:38:42 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-90
+
+
+
+ Linux installation of libngspice
+
+ Installation
+ Hi,
+
Im having trouble installing libngspice on ubuntu 19.04 with anaconda v4.8.2.
+I have ngpsice installed (sudo apt-get install ngspice).
+Then I’m following instructions on pyspice install
+
Im happy to use anaconda so I skipped to section 4.2.2
+However the following commands run for many hours without success
Collecting package metadata (current_repodata.json): done
+Solving environment: /
+The environment is inconsistent, please check the package plan carefully
+The following packages are causing the inconsistency:
+:::::
+
+
Trying the other command seems to work.
+
+
pip install PySpice
+
+
but this one doesn’t include libngspice.
+
Going back to step 4.2.1
+I downloaded a tar of the libngspice but it’s a tar’d directory not a shared object (.so).
+There’s no instructions in that directory on how to compile it… or where I should
+place it for pyspice?
+
I found a similar question on this pyspice forum and I tried
+
+
inv ngspice.install
+::::
+configure: error: Couldn’t find GNU readline headers.
+
+
I guess I need to do something like
+
+
sudo apt-get install lib64readline
+
+
But I’ve not been able to locate that package so far…
+Any ideas? I don’t think I’m going in the right direction?
+ ]]>
+ https://pyspice.discourse.group/t/linux-installation-of-libngspice/84
+ Fri, 25 Sep 2020 14:59:25 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-84
+
+
+
+ About the Installation category
+
+ Installation
+ (Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
+ ]]>
+ https://pyspice.discourse.group/t/library-import-corner-analysis/143
+ Mon, 09 Aug 2021 06:01:08 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-143
+
+
+
+ NgSpice Options Help
+
+ NgSpice
+ How do you use the simulation options in a simulation? For example how does one call up any of the options in chapter 15.1 of the NgSpice users guide.
+
Say I want to change the transient solver to METHOD=‘Gear’ how would I?
+ ]]>
+ https://pyspice.discourse.group/t/ngspice-options-help/131
+ Sun, 21 Mar 2021 01:18:42 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-131
+
+
+
+ How to measure voltage and current in pyspice
+
+ NgSpice
+ hi,everybody!
+
I’ve built a memristor model in Pspice,The model can run .I wanted it to run in pyspice, but there was an error.
+
In PSpice, the following statement is OK :
+Emem plus aux value={-I(Emem)V(x)(1000-10)}
+
But in pyspice,An error occurred.
+
NameError: name ‘V’ is not defined
+
The reason is that V (x) and I (EMEM) have problems.How can I solve this problem?
+ ]]>
+ https://pyspice.discourse.group/t/how-to-measure-voltage-and-current-in-pyspice/74
+ Mon, 24 Aug 2020 11:59:27 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-74
+
+
+
+ Relatively accurate component (and board) thermal simulations?
+
+ NgSpice
+ After playing around with SkiDL+NgSpice on SkiDL+NgSpice (via PySpice): simulating a simple parallel resistors circuit's power outputs, I wonder what’s the recommended/best/suitable way to go about simulating thermodynamics on a circuit. Talking with an expert colleague he recommended the following theoretical approach:
+
Essentially I would like to have a way to “heat map” a circuit pretty much like a FLIR camera does but via simulation/software… is it possible with NgSpice alone? Or would this require more ammo with FEA modelling or the like?
+
I would like to know if somebody has attempted this successfully and has good experience/code to share?
+ ]]>
+ https://pyspice.discourse.group/t/relatively-accurate-component-and-board-thermal-simulations/28
+ Thu, 30 Apr 2020 22:42:47 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-28
+
+
+
+ SkiDL+NgSpice (via PySpice): simulating a simple parallel resistors circuit's power outputs
+
+ NgSpice
+ Hi folks, this seems to be the first post over this forum, hopefully it’s not too soon to start asking questions?
+
I’m extending a bit one of the SKiDL simulation tutorials, as presented in this Jupyter notebook with a simple resistor (among other more complex examples):
+
+
+
My intention is to extend the single resistor example with a netlist of several resistors in parallel (a 19x19 matrix), something like this:
+
#!/usr/bin/env python
+
+from skidl.pyspice import R, V, gnd, u_V
+from skidl.pyspice import u_Ohm, u_kOhm
+from skidl.pyspice import generate_netlist, reset, lib_search_paths, node
+
+reset() # This will clear any previously defined circuitry.
+
+# Voltage Source
+vs = V(ref="VS", dc_value = 1 @ u_V)
+
+rnet = []
+
+# Create several resistors.
+rnet = 19*19*R(value = 1.7 @ u_kOhm)
+
+# Connect the nets and resistors.
+vs['p'] += [rnet[n][1] for n in range(0, 19*19)]
+gnd += [rnet[n][2] for n in range(0, 19*19)]
+gnd += vs['n']
+
+# Simulate the circuit.
+circ = generate_netlist() # Translate the SKiDL code into a PyCircuit Circuit object.
+sim = circ.simulator() # Create a simulator for the Circuit object.
+dc_vals = sim.dc(VS=slice(1, 24, 1)) # Run a DC simulation where the voltage ramps from 1 to 12V by 1V increments.
+
+# Get the voltage applied to the resistor and the current coming out of the voltage source.
+voltage = dc_vals[node(vs['p'])]
+current = -dc_vals['VS']
+
+# Print a table showing the current through the resistor for the various applied voltages.
+print('{:^7s}{:^7s}{:^7s}'.format('V', ' I (A)', "P (W)"))
+print('='*25)
+for v, i, p in zip(voltage.as_ndarray(), current.as_ndarray(), voltage.as_ndarray()*current.as_ndarray()):
+ print('{:6.2f} {:6.2f} {:6.2f}'.format(v, i, p))
+
+
Unfortunately the output looks something like this:
+
$ ./skidl_sim.py
+
+No errors or warnings found during netlist generation.
+
+warning, can't find model at
+Warning: r1: resistance to low, set to 1 mOhm
+Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Note: Starting dynamic gmin stepping
+Trying gmin = 1.0000E-03 Note: One successful gmin step
+Trying gmin = 1.0000E-04 Note: One successful gmin step
+Trying gmin = 1.0000E-05 Note: One successful gmin step
+Trying gmin = 1.0000E-06 Note: One successful gmin step
+Trying gmin = 1.0000E-07 Note: One successful gmin step
+Trying gmin = 1.0000E-08 Note: One successful gmin step
+Trying gmin = 1.0000E-09 Note: One successful gmin step
+Trying gmin = 1.0000E-10 Note: One successful gmin step
+Trying gmin = 1.0000E-11 Note: One successful gmin step
+Trying gmin = 1.0000E-12 Note: One successful gmin step
+Trying gmin = 1.0000E-12 Note: One successful gmin step
+Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Warning: Dynamic gmin stepping failed
+Note: Starting source stepping
+Supplies reduced to 0.0000% Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Trying gmin = 1.0000E-02 Note: One successful gmin step
+Trying gmin = 1.0000E-03 Note: One successful gmin step
+Trying gmin = 1.0000E-04 Note: One successful gmin step
+Trying gmin = 1.0000E-05 Note: One successful gmin step
+Trying gmin = 1.0000E-06 Note: One successful gmin step
+Trying gmin = 1.0000E-07 Note: One successful gmin step
+Trying gmin = 1.0000E-08 Note: One successful gmin step
+Trying gmin = 1.0000E-09 Note: One successful gmin step
+Trying gmin = 1.0000E-10 Note: One successful gmin step
+Trying gmin = 1.0000E-11 Note: One successful gmin step
+Trying gmin = 1.0000E-12 Note: One successful gmin step
+Note: One successful source step
+Supplies reduced to 0.1000% Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Supplies reduced to 0.0000% Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Warning: source stepping failed
+doAnalyses: iteration limit reached
+run simulation(s) aborted
+ V I (A) P (W)
+=========================
+
+
Can anybody let me know what’s going on? Which syntax should I be using to define that resistor “network” so that ngspice accepts it as well-defined?
+ ]]>
+ https://pyspice.discourse.group/t/skidl-ngspice-via-pyspice-simulating-a-simple-parallel-resistors-circuits-power-outputs/26
+ Thu, 30 Apr 2020 15:01:26 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-26
+
+
+
+ About the NgSpice category
+
+ NgSpice
+ (Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
+ ]]>
+ https://pyspice.discourse.group/t/howto-transient-analysis/150
+ Mon, 27 Sep 2021 20:08:15 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-150
+
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ Uncategorized
+ I am new with pyspice. I want to add a behavioral voltage source to my circuit. To write its expression we need voltage across two points x and y. For example v=2*Voltage(x,y)
+
Will anyone share the syntax in pyspice?
+Thank you.
+ ]]>
+ https://pyspice.discourse.group/t/how-to-get-voltage-acrros-two-points-to-write-behavioral-voltage-source-expression/147
+ Fri, 10 Sep 2021 13:08:01 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-147
+
+
+
+ Divide one AC-analysis waveform by another
+
+ Uncategorized
+ I have run an AC analysis in PySpice.
+I have found the waveform for input (source) voltage, and input (source) current.
+Now I would like to find the impedance waveform (voltage/current)
+How can I divide one waveform by another?
+
+ ]]>
+ https://pyspice.discourse.group/t/divide-one-ac-analysis-waveform-by-another/140
+ Fri, 28 May 2021 12:53:00 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-140
+
+
+
+ Extract array of complex numbers from waveform
+
+ Uncategorized
+ Hi
+
I am just getting started with PySpice.
+
I have run an AC analysis on a netlist using PySpice, and have extracted my waveforms, but would like to convert these into a numpy array of complex numbers - how do I do this?
+
I want to do further mathematical analysis on the PySpice Waveform output.
+ ]]>
+ https://pyspice.discourse.group/t/extract-array-of-complex-numbers-from-waveform/139
+ Fri, 28 May 2021 12:50:00 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-139
+
+
+
+ Extract float-type number from class 'PySpice.Unit.Unit.UnitValue'
+
+ Uncategorized
+ Hi
+
I am just getting started with using PySpice.
+
I have extracted voltage/current values from a PySpice analysis, and would like to analyze these using other Python functions.
+
But all of my values are now of type class ‘PySpice.Unit.Unit.UnitValue’.
+
How can I remove the units, so that these are just normal float numbers?
+ ]]>
+ https://pyspice.discourse.group/t/extract-float-type-number-from-class-pyspice-unit-unit-unitvalue/138
+ Fri, 28 May 2021 12:44:13 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-138
+
+
+
+ Access to Diode Parameters
+
+ Uncategorized
+ Hello,
+
when working with pyspice 1.3 it was possible for me to change device parameters in thie way described below. With 1.4 this does not seem to work any more. Is there a new or alternate syntax?
+
#############################
+import os
+os.linesep="\n"
I am however interested in replacing the voltage source with a current source and still get a bode plot that compares the output voltage to input current. Just replacing the voltage source with a current source as follows gives me an error.
+ ]]>
+ https://pyspice.discourse.group/t/bode-plot-with-sinusoidal-current-source/103
+ Tue, 24 Nov 2020 12:13:04 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-103
+
+
+
+ Is PySpice 1.4.2 compatible with Ngspice 33?
+
+ Uncategorized
+ Hello Community,
+
I have set up PySpice 1.4.2 through a virtual environment and brew installed Ngspice and libngspice on Mac 0S X. However, “pyspice-post-installation --check-install” tells me that Ngspice version 33 is not supported.
+ ]]>
+ https://pyspice.discourse.group/t/is-pyspice-1-4-2-compatible-with-ngspice-33/101
+ Mon, 23 Nov 2020 02:57:05 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-101
+
+
+
+ Using the Skywater PDK with SKiDL/PySpice
+
+ Uncategorized
+ I’ve published a Jupyter notebook of my explorations using SKiDL and PySpice with the open Skywater PDK.
+
+ ]]>
+ https://pyspice.discourse.group/t/using-the-skywater-pdk-with-skidl-pyspice/98
+ Mon, 16 Nov 2020 18:41:20 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-98
+
+
+
+ How to define multiple BJTs in the same circuit?
+
+ Uncategorized
+ If I try to define a pnp and an npn BJT in the same circuit:
+
circuit.BJT(1, 'in', 'in', 0, model='bjt')# Q is mapped to BJT !
+circuit.model('bjt', 'npn', bf=80, cjc=pico(5), rb=100)
+
+circuit.BJT(2, 2, 'in', 0, model='bjt')# Q is mapped to BJT !
+circuit.model('bjt', 'npn', bf=80, cjc=pico(5), rb=100)
+
+circuit.BJT(5, 'out', 2, 0, model='bjt')# Q is mapped to BJT !
+circuit.model('bjt', 'npn', bf=80, cjc=pico(5), rb=100)
+
+circuit.BJT(6, 4, 5, 'out', model='bjt')# Q is mapped to BJT !
+circuit.model('bjt', 'npn', bf=80, cjc=pico(5), rb=100)
+
+circuit.BJT(3, 'in', 4, 'in', model='bjt')# Q is mapped to BJT !
+circuit.model('bjt', 'pnp', bf=80, cjc=pico(5), rb=100)
+
+circuit.BJT(4, 2, 'in', 4, model='bjt') # Q is mapped to BJT !
+circuit.model('bjt', 'pnp', bf=80, cjc=pico(5), rb=100)
+
+
PySpice doesn’t allow me to call model() twice:
+
---------------------------------------------------------------------------
+NameError Traceback (most recent call last)
+<ipython-input-2-c7415312c779> in <module>
+ 15
+ 16 circuit.BJT(2, 2, 'in', 0, model='bjt')# Q is mapped to BJT !
+---> 17 circuit.model('bjt', 'npn', bf=80, cjc=pico(5), rb=100)
+ 18
+ 19 circuit.BJT(5, 'out', 2, 0, model='bjt')# Q is mapped to BJT !
+
+~/anaconda3/envs/Circuits/lib/python3.6/site-packages/PySpice/Spice/Netlist.py in model(self, name,
+modele_type, **parameters)
+ 1002 self._models[model.name] = model
+ 1003 else:
+-> 1004 raise NameError("Model name {} is already defined".format(name))
+ 1005
+ 1006 return model
+
+NameError: Model name bjt is already defined
+
+ ]]>
+ https://pyspice.discourse.group/t/how-to-define-multiple-bjts-in-the-same-circuit/86
+ Tue, 29 Sep 2020 13:52:47 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-86
+
+
+
+ Large archive of SPICE models/subcircuits
+
+ Uncategorized
+ I posted a message on the SKiDL forum about using SKiDL/PySpice with a large archive of SPICE models.
+
+ ]]>
+ https://pyspice.discourse.group/t/large-archive-of-spice-models-subcircuits/67
+ Fri, 07 Aug 2020 21:20:44 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-67
+
+
+
+ How to modify a BJT's parameters?
+
+ Uncategorized
+ I have checked the API documentation but didn’t find an answer or example.
+
+ ]]>
+ https://pyspice.discourse.group/t/how-to-modify-a-bjts-parameters/64
+ Sat, 01 Aug 2020 13:19:59 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-64
+
+
+
+ OSError: cannot load library 'libngspice.so':
+
+ Uncategorized
+ Good afternoon community, I am writing to you because I have encountered the following error trying to simulate the following filter that appears in the documentation.
+
The error is as follows.
+2020-05-23 00:45:37,954 - PySpice.Spice.NgSpice.Shared.NgSpiceShared.new_instance - INFO - New instance for id 0
+2020-05-23 00:45:37,955 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._load_library - WARNING - Set locale LC_NUMERIC to C
+
---------------------------------------------------------------------------
+
+OSError Traceback (most recent call last)
+
+<ipython-input-6-475d4280ae1b> in <module>()
+----> 1 simulator = circuit.simulator(temperature=25, nominal_temperature=25)
+ 2 analysis = simulator.ac(start_frequency=1@u_Hz, stop_frequency=1@u_MHz, number_of_points=10, variation='dec')
+
+8 frames
+
+/usr/local/lib/python3.6/dist-packages/cffi/api.py in _load_backend_lib(backend, name, flags)
+ 825 if first_error is not None:
+ 826 msg = "%s. Additionally, %s" % (first_error, msg)
+--> 827 raise OSError(msg)
+ 828 return backend.load_library(path, flags)
+ 829
+
+OSError: cannot load library 'libngspice.so': libngspice.so: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libngspice.so'
+
+
I have installed all the dependencies, although I have run out of ideas, I am starting in the world of programming, however, they asked me for a job to simulate filters in the university. I need your help, if possible, a lot of fat in advance
+ ]]>
+ https://pyspice.discourse.group/t/oserror-cannot-load-library-libngspice-so/37
+ Sat, 23 May 2020 00:47:20 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-37
+
+
+
+ Welcome to Discourse
+
+ Uncategorized
+ Welcome to the PySpice Forum !
+
This forum is the right place to chat about PySpice between users and to get help.
+
This forum is provided freely by https://www.discourse.org as a part of its program to support open source projects.
+
+
+
+
+
+
+
diff --git a/pyspice-discourse-backup/c/xyce/7.rss b/pyspice-discourse-backup/c/xyce/7.rss
new file mode 100644
index 00000000..f9ec1705
--- /dev/null
+++ b/pyspice-discourse-backup/c/xyce/7.rss
@@ -0,0 +1,67 @@
+
+
+
+ Xyce - PySpice
+ https://pyspice.discourse.group/c/xyce/7
+ Topics in the 'Xyce' category
+
+ Fri, 18 Sep 2020 23:01:18 +0000
+
+
+ Looking for a Xyce Example
+
+ Xyce
+ Hi, I have installed Xyce, NGSpice and PySpice and everything is almost working… except, when I run on iPython (actually Anaconda Spyder) then I stumbled into a cdef problem on duplidate definition of ngcomplex. I can see on github some discussion, but not clear to me how to move forward on it. No mater, I have Xyce. But then I was stumbling at the start [again]. The documentation says to set an attribute
+
But where do I type that? It seems to be an attribute of a class or something?? So then I try
+… = simulator(xyce_command=r"C:\Program Files\Xyce 7.1 OPENSOURCE\bin\Xyce.exe", simulator=‘xyce-serial’,…)
+
and that one dies with file not found, although it is the correct command to launch Xyce.
+
What finally worked (yeh!) was to edit by hand the PySpice source code and find where XyceCommand was defined and wow. I’m amazed. Works perfectly
+
But was there a cleaner way that I could have done this?
+
Thanks so much for putting this product together. I’m excited to check it out further.
+ ]]>
+ https://pyspice.discourse.group/t/looking-for-a-xyce-example/82
+ Fri, 18 Sep 2020 23:01:18 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-82
+
+
+
+ About the Xyce category
+
+ Xyce
+ (Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
Discussion about this site, its organization, how it works, and how we can improve it.
+
+
+
+
1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pyspice-discourse-backup/latest.rss b/pyspice-discourse-backup/latest.rss
new file mode 100644
index 00000000..1020eeae
--- /dev/null
+++ b/pyspice-discourse-backup/latest.rss
@@ -0,0 +1,1163 @@
+
+
+
+ PySpice - Latest topics
+ https://pyspice.discourse.group/latest
+ Latest topics
+
+ Mon, 31 Jan 2022 19:46:50 +0000
+
+
+ Error while using 3 terminal Resistors
+
+ Dev
+ I get an error when using 3 terminal resistors from Skywater 130nm PDK. When I looked at BasicElements.py, I noticed that all resistors are defined as DipoleElements. I have added a class for 3 terminal devices and now I am able to simulate the circuit. The same is true for 3-terminal capacitors too.
+
I would like to contribute PySpice to make it compatible with Skywater 130nm PDK devices. Kindly let me know what would be best way to contribute
+ ]]>
+ https://pyspice.discourse.group/t/error-while-using-3-terminal-resistors/164
+ Mon, 31 Jan 2022 19:46:50 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-164
+
+
+
+ Simulating a circuit with 16 MOSFETs: True gmin stepping error
+
+ Circuit Simulation
+ Hello,
+
I am trying to simulate a circuit using 16 MOSFETS.
+
The issue is that once the MOSFETS’s 15 and 16 are placed in the schematic, it results in an error: PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR
+
If the MOSFET’s 15 and 16 are commented out, then the code compiles.
+
I am using NGspice-34.dll and PySpice 1.5. Have also tested with Pyspice 1.4.3 and NGspice-32.dll.
+
Is NGSpice reaching some maximum nodes/complexity limit? OR is this an issue with mosfet model? OR it is a circuit netlist (floating node?) issue?
+
Any help or ideas would be greatly appreciated.
+
The code and error message are reproduced below.
+
Thanks
+
Kahless96
+
##***********************************************
+import math
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.widgets import Cursor
+from matplotlib.pyplot import semilogx
+from matplotlib import pyplot
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
Here is the error messages after which it fails to run:
+
2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: Starting true gmin stepping
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-03 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-04 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-05 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-06 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-07 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-08 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-09 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-10 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-11 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: True gmin stepping completed
+
I have seen this gmin stepping error in other forum posts but in those cases it was related to circuit netlist error. This does not seem to be the case here.
+
The mosfet models being used are provided with Pyspice.
+ ]]>
+ https://pyspice.discourse.group/t/simulating-a-circuit-with-16-mosfets-true-gmin-stepping-error/162
+ Thu, 13 Jan 2022 03:55:35 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-162
+
+
+
+ Problems with running simulator
+
+ Installation
+ Hi every one!
+I am new to PySpice. I was running 1.4.3 ver with ngspice 3.2 and everything was working well.
+My computer did a usual clean up and update.
+
Now the netlist part works fine. But when I call the simulator I get a long error message (I will paste below). I was doing good progress and I am glad to share a 3 phase diode rectifier model which was working well. Until this problem arose. When I did an update I see that the cur ver is 1.5 and installs ngspice 3.4
+
Any help is appreciated. Else will have to go back to LTspice
~\Anaconda3\lib\site-packages\PySpice\Spice\Netlist.py in simulator(self, *args, **kwargs)
+
~\Anaconda3\lib\site-packages\PySpice\Spice\Simulation.py in factory(cls, circuit, *args, **kwargs)
+1117 “”" This class implements a circuit simulator. Each analysis mode is performed by a method that
+1118 return the measured probes.
+ → 1119
+1120 For ac and transient analyses, the user must specify a list of nodes using the probes key
+1121 argument.
+
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Simulation.py in init(self, circuit, **kwargs)
+97 ngspice_shared = kwargs.get(‘ngspice_shared’, None)
+98 if ngspice_shared is None:
+—> 99 self._ngspice_shared = NgSpiceShared.new_instance()
+100 else:
+101 self._ngspice_shared = ngspice_shared
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Shared.py in _load_library(self, verbose)
+511 if ‘SPICE_LIB_DIR’ not in os.environ:
+512 _ = str(Path(self.NGSPICE_PATH).joinpath(‘share’, ‘ngspice’))
+ → 513 os.environ[‘SPICE_LIB_DIR’] = _
+514 # self._logger.warning(‘Set SPICE_LIB_DIR = %s’, _)
+515
+
~\Anaconda3\lib\pathlib.py in new(cls, *args, **kwargs)
+1036 if cls is Path:
+1037 cls = WindowsPath if os.name == ‘nt’ else PosixPath
+ → 1038 self = cls._from_parts(args, init=False)
+1039 if not self._flavour.is_supported:
+1040 raise NotImplementedError(“cannot instantiate %r on your system”
+
~\Anaconda3\lib\pathlib.py in _from_parts(cls, args, init)
+677 # right flavour.
+678 self = object.new(cls)
+ → 679 drv, root, parts = self._parse_args(args)
+680 self._drv = drv
+681 self._root = root
+
~\Anaconda3\lib\pathlib.py in _parse_args(cls, args)
+661 parts += a._parts
+662 else:
+ → 663 a = os.fspath(a)
+664 if isinstance(a, str):
+665 # Force-cast str subclasses to str (issue #21127)
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
+ ]]>
+ https://pyspice.discourse.group/t/problems-with-running-simulator/153
+ Thu, 11 Nov 2021 13:45:39 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-153
+
+
+
+ Howto: Transient analysis
+
+ Uncategorized
+ I want to do a transient analysis of a square wave.
+
+
How do I do a transient analysis and plot the output?
+
How do I implement a square wave?
+
+
I found nothing in the examples. Thanks for your help,
+Michael
+ ]]>
+ https://pyspice.discourse.group/t/howto-transient-analysis/150
+ Mon, 27 Sep 2021 20:08:15 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-150
+
+
+
+ How to write .func in pyspice and use it in behavioral source?
+
+ Circuit Simulation
+ I want to write a .func that will help me designing a device model. I used **raw_spice=’ …’ ** but it is not working. I am new in pyspice.
+
+ ]]>
+ https://pyspice.discourse.group/t/how-to-write-func-in-pyspice-and-use-it-in-behavioral-source/148
+ Thu, 16 Sep 2021 00:26:03 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-148
+
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ Uncategorized
+ I am new with pyspice. I want to add a behavioral voltage source to my circuit. To write its expression we need voltage across two points x and y. For example v=2*Voltage(x,y)
+
Will anyone share the syntax in pyspice?
+Thank you.
+ ]]>
+ https://pyspice.discourse.group/t/how-to-get-voltage-acrros-two-points-to-write-behavioral-voltage-source-expression/147
+ Fri, 10 Sep 2021 13:08:01 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-147
+
+
+
+ Interrupted simulation multiple sources
+
+ Circuit Simulation
+ Hi everyone,
+
for a research project I’m working on control strategies for PFC circuits and therefore I need to simulate a passive circuit in conjunction with two half bridges.
+Problem is that I need the simulation to interact with a python script since I need to calculate the control signals of the two half bridges externally and thus the simualtion flow is as follows.
+
First, I need to initialize the simulation which basically means that I need to sample the amplitude and phase of a sinusodial source representing the grid voltage and the component values and initial conditions of the passive components. Next, I need to run the simulation in chunks where I first calculate the four control signals of the half bridges based on the current and voltage signals of the passive circuit followed by a chunk of transient simulation for a given time span (sample rate of the controller).
+
I tried to implement this flow but I unfortunately I struggle with the following issues.
+
a) Phase of the AC source:
+I tired SinusoidalVoltageSource() but I failed to specify a phase offset. Altough it’s base class SinusoidalMixin() offers a delay attribute, it seems that it just enables the source after a given time and thus this isn’t the desired behaviour for my purpose. Alternatively, I defined my own grid voltage using a NgSpiceShared object according …/examples/ngspice-shared/external-source.html.
+This essential does the trick for me but leaves with the next problem.
+
b) Multiple External Sources:
+Give the simulation flow above I need to run the simulation with at least four external sources, two for every half bridge, and five if I define the grid voltage also as external source. So I wonder how I define multiple shared objects.
+
c) Setting the initial conditions
+Since I run the simulation in chunks I wonder if I have to preload the nodes with the latest values and I need to run the simulation with start_time=0 and end_time=timespan according the controller’s sample rate or are the states kept internally and I need just to run the simulation with start_time=(k-1)timespan, end_time=ktimespan in order to run the kth simulation chunk.
+ ]]>
+ https://pyspice.discourse.group/t/library-import-corner-analysis/143
+ Mon, 09 Aug 2021 06:01:08 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-143
+
+
+
+ Divide one AC-analysis waveform by another
+
+ Uncategorized
+ I have run an AC analysis in PySpice.
+I have found the waveform for input (source) voltage, and input (source) current.
+Now I would like to find the impedance waveform (voltage/current)
+How can I divide one waveform by another?
+
+ ]]>
+ https://pyspice.discourse.group/t/divide-one-ac-analysis-waveform-by-another/140
+ Fri, 28 May 2021 12:53:00 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-140
+
+
+
+ Extract array of complex numbers from waveform
+
+ Uncategorized
+ Hi
+
I am just getting started with PySpice.
+
I have run an AC analysis on a netlist using PySpice, and have extracted my waveforms, but would like to convert these into a numpy array of complex numbers - how do I do this?
+
I want to do further mathematical analysis on the PySpice Waveform output.
+ ]]>
+ https://pyspice.discourse.group/t/extract-array-of-complex-numbers-from-waveform/139
+ Fri, 28 May 2021 12:50:00 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-139
+
+
+
+ Extract float-type number from class 'PySpice.Unit.Unit.UnitValue'
+
+ Uncategorized
+ Hi
+
I am just getting started with using PySpice.
+
I have extracted voltage/current values from a PySpice analysis, and would like to analyze these using other Python functions.
+
But all of my values are now of type class ‘PySpice.Unit.Unit.UnitValue’.
+
How can I remove the units, so that these are just normal float numbers?
+ ]]>
+ https://pyspice.discourse.group/t/extract-float-type-number-from-class-pyspice-unit-unit-unitvalue/138
+ Fri, 28 May 2021 12:44:13 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-138
+
+
+
+ Whats PySpice's Advantages?
+
+ Help
+ Hi friends, why I have use pySpice instead of use direct spice program? Whats advantages of using pyspice? I must a homework like electronic circuits with pyspice but I didn’t find a topic. Can you help me find a topic. How can I do with pyspice?
+
+ ]]>
+ https://pyspice.discourse.group/t/whats-pyspices-advantages/135
+ Tue, 18 May 2021 20:26:00 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-135
+
+
+
+ Can SpiceParser parse subcircuits?
+
+ Help
+ We want to parse a sp file with a netlist that embeds a subcircuit definition. When we parse it with SpiceParser we noticed that the subcircuit definition is removed. Is there a way to include the subcircuit definition during the parsing process?
+
+ ]]>
+ https://pyspice.discourse.group/t/can-spiceparser-parse-subcircuits/133
+ Fri, 30 Apr 2021 03:23:54 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-133
+
+
+
+ NgSpice Options Help
+
+ NgSpice
+ How do you use the simulation options in a simulation? For example how does one call up any of the options in chapter 15.1 of the NgSpice users guide.
+
Say I want to change the transient solver to METHOD=‘Gear’ how would I?
+ ]]>
+ https://pyspice.discourse.group/t/ngspice-options-help/131
+ Sun, 21 Mar 2021 01:18:42 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-131
+
+
+
+ Error in running examples
+
+ Help
+ I’ve just installed PySpice (on Fedora, using pip install PySpice). I’ve downloaded the examples with pyspice-post-installation --download-example and tried to run them. I get a number of errors, but the one that appears most often is:
+
pyspice-post-installation --download-example
+
I googled the problem but couldn’t fix it, grateful for suggestions.
+ ]]>
+ https://pyspice.discourse.group/t/error-in-running-examples/127
+ Tue, 09 Mar 2021 23:43:16 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-127
+
+
+
+ Google COLAB + PySpice
+
+ Help
+ I trying use PySpice on google Colab, but I fail…
+Some one can tell me if is possible, and how i can do?
+
Aparently… I should but i dont be able to install or reference there the “ngspice dll”
+ ]]>
+ https://pyspice.discourse.group/t/google-colab-pyspice/125
+ Sun, 07 Mar 2021 02:56:43 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-125
+
+
+
+ Read a NgSpice rawfile using PySpice
+
+ Help
+ Hello guys,
+
I am writing a python script that generates, runs and eventually will read the raw files. The command I use to run the netlist is the following: subprocess.run([path_to_ngspice_executable,'-r','rawfile.raw','-b','-i',my_netlist]) which generates my rawfile.
+
Could you please tell me what PySpice command to use so I can read the generated raw file and plot the distribution of my voltages?
+ ]]>
+ https://pyspice.discourse.group/t/read-a-ngspice-rawfile-using-pyspice/123
+ Wed, 03 Mar 2021 08:40:44 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-123
+
+
+
+ More maintainers?
+
+ Dev
+ There are currently 113 open issues and 18 pull requests, including some very trivial ones from months ago, many unfinished pages in the documentation, and no changes to the repo for 7 months.
+
I know you work on this in your free time and development will be sporadic, would you be willing to add additional maintainers to help deal with the PRs, etc?
+ ]]>
+ https://pyspice.discourse.group/t/getting-keyerror-while-running-example/119
+ Sat, 30 Jan 2021 13:14:32 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-119
+
+
+
+ Installation example scripts
+
+ Installation
+ Dear PySpice community, I would like to share some installation example files to illustrate the installation procedure of PySpice on Linux by using apt and pip only.
+
Those files are published as Dockerfile scripts since they allow full automatic machine instantiation with docker.
+They cover both Ubuntu and Debian, using a standard approach using only apt :
+ ]]>
+ https://pyspice.discourse.group/t/installation-example-scripts/117
+ Mon, 25 Jan 2021 22:35:44 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-117
+
+
+
+ Access to Diode Parameters
+
+ Uncategorized
+ Hello,
+
when working with pyspice 1.3 it was possible for me to change device parameters in thie way described below. With 1.4 this does not seem to work any more. Is there a new or alternate syntax?
+
#############################
+import os
+os.linesep="\n"
+ ]]>
+ https://pyspice.discourse.group/t/access-to-diode-parameters/108
+ Sat, 19 Dec 2020 17:38:44 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-108
+
+
+
+ Two installation experiences on Windows
+
+ Installation
+ Windows 10
+
First I tried to install in my base conda environment on Windows 10 64-bit. It could not be installed due to package conflicts and it tried many different things to resolve the conflicts, grinding away at the CPU for two hours, and eventually I killed it.
+
Then I created a new environment specifically for PySpice and installed it:
Now I’m doing the same procedure on a Windows 7 machine (I know, I know, it’s obsolete). The install command showed no errors on the command line, but I did get a pop up error:
+
+
python.exe - System Error
+
The program can’t start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
+
OK
+
+
I haven’t seen this error before, but the install command worked so I’m ignoring it.
+
Then I try
+
pyspice-post-installation --install-ngspice-dll
+
+
Ah, now I’m getting the same error:
+
+
python.exe - System Error
+
The program can’t start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
+
OK
+
+
and if I run the check:
+
pyspice-post-installation --check-install
+
+
I get the same error dialog:
+
+
python.exe - System Error
+
The program can’t start because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
+
OK
+
+
Tried System File Checker:
+
λ sfc /scannow
+
+Beginning system scan. This process will take some time.
+
+Beginning verification phase of system scan.
+Verification 100% complete.
+
+Windows Resource Protection did not find any integrity violations.
+
+
Searching my machine, it does not have api-ms-win-core-path-l1-1-0.dll anywhere. Maybe this is a Windows 10 file only. (Nope, not present on Windows 10 machine, either.)
+
Trying to install jupyterlab also doesn’t work well. Does PySpice have some weird requirements/dependencies that prevent conda from installing it alongside other things?
+
Collecting package metadata (current_repodata.json): done
+Solving environment: failed with initial frozen solve. Retrying with flexible solve.
+Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
+Collecting package metadata (repodata.json): done
+Solving environment: failed with initial frozen solve. Retrying with flexible solve.
+
+
Oh if I do it as conda install jupyterlab voila instead of using conda-forge, it works fine
for node in analysis.nodes.values():
+print(‘Node {}: {:4.1f} V’.format(str(node), float(node)))
+
When I run, it gives an error:
+
Traceback (most recent call last):
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 928, in getattr
+return self.getitem(attribute_name)
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 921, in getitem
+raise IndexError(attribute_name) # KeyError
+IndexError: E
+
During handling of the above exception, another exception occurred:
+
Traceback (most recent call last):
+File “C:/Users/Desktop/PySpice/node-voltage-method-example8.py”, line 22, in
+circuit.E(1, 4, 3, 2, 3, 3)
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 930, in getattr
+raise AttributeError(attribute_name)
+AttributeError: E
+
I am not sure where I am going wrong. I have been able to simulate a CCVS (part name H) but all other dependent sources seem to give an error.
+
Can anyone please point out what is wrong in the code above?
I am however interested in replacing the voltage source with a current source and still get a bode plot that compares the output voltage to input current. Just replacing the voltage source with a current source as follows gives me an error.
+ ]]>
+ https://pyspice.discourse.group/t/bode-plot-with-sinusoidal-current-source/103
+ Tue, 24 Nov 2020 12:13:04 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-103
+
+
+
+ Is PySpice 1.4.2 compatible with Ngspice 33?
+
+ Uncategorized
+ Hello Community,
+
I have set up PySpice 1.4.2 through a virtual environment and brew installed Ngspice and libngspice on Mac 0S X. However, “pyspice-post-installation --check-install” tells me that Ngspice version 33 is not supported.
+ ]]>
+ https://pyspice.discourse.group/t/is-pyspice-1-4-2-compatible-with-ngspice-33/101
+ Mon, 23 Nov 2020 02:57:05 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-101
+
+
+
+ Using the Skywater PDK with SKiDL/PySpice
+
+ Uncategorized
+ I’ve published a Jupyter notebook of my explorations using SKiDL and PySpice with the open Skywater PDK.
+
+ ]]>
+ https://pyspice.discourse.group/t/using-the-skywater-pdk-with-skidl-pyspice/98
+ Mon, 16 Nov 2020 18:41:20 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-98
+
+
+
+ Losing units when summing a Waveform
+
+ Data Analysis using Python
+ I multiplied two Waveform objects: one containing voltages and the other containing currents. Then I multiplied it by a PeriodValue. As expected, the resulting Wavform object contains numbers with the units of Joules. But when I applied the sum() method to this Waveform, I got a scalar value with no units.
+
Is there any way to do this without losing the units for the calculations that follow?
And is due to stderr = ‘Error: there aren’t any circuits loaded.’
+
By debugging further I could nail down that the def run() method of the Simulation class fails because the run command after the load_circuit command complains that the circuit wasn’t loaded.
So the load_circuit method seems to not load the circuit properly in the sim, any idea why? (although it does execute it and no error is raised within that method).
+
I tried also the listing() method to query the circuit description back and also doesn’t seem to provide anything back.
+
Actually the only communication with the simulator seems to be successful is the “version -f” command which returns the valuable infos from it.
+ ]]>
+ https://pyspice.discourse.group/t/load-circuit-failing-for-some-reasons/96
+ Mon, 02 Nov 2020 20:14:10 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-96
+
+
+
+ Trouble with Libraries
+
+ Help
+ Hello!
+
To better understand PySpice, I’m working through a very simple circuit involving a voltage source, a resistor, and a 1N4148 Diode. However, I am having trouble with Python recognizing the library I need to bring in the characteristics of the diode. Here is my code:
+
'import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.ticker as ticker
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
+ ]]>
+ https://pyspice.discourse.group/t/trouble-with-libraries/94
+ Sun, 25 Oct 2020 20:45:42 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-94
+
+
+
+ Install Pyspice on Raspberry Pi 4 ERROR
+
+ Installation
+ Hello Everyone!
+I’m running into a problem, i want to install PySpice on Raspberry Pi 4 which runs Raspbian OS. I have read the doumentation that wrote, it is supported on Linux, Windos 64 and MAC.
+I have followed the install instructions after i typed : pip3 install PySpice the following error message i got:
+
Defaulting to user installation because normal site-packages is not writeable
+Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
+Collecting PySpice
+Using cached PySpice-1.4.3-py2.py3-none-any.whl (144 kB)
+Collecting scipy>=1.4
+Downloading scipy-1.5.3.tar.gz (25.2 MB)
+|################################| 25.2 MB 28 kB/s
+Installing build dependencies … \Ledone
+Getting requirements to build wheel … done
+Preparing wheel metadata … error
+ERROR: Command errored out with exit status 1:
+command: /usr/bin/python /home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpv39ep59r
+cwd: /tmp/pip-install-_1dtpvzc/scipy
+Complete output (139 lines):
+lapack_opt_info:
+lapack_mkl_info:
+customize UnixCCompiler
+libraries mkl_rt not found in [’/usr/local/lib’, ‘/usr/lib’, ‘/usr/lib/arm-linux-gnueabihf’]
+NOT AVAILABLE
+
openblas_lapack_info:
+customize UnixCCompiler
+customize UnixCCompiler
+ libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+openblas_clapack_info:
+customize UnixCCompiler
+customize UnixCCompiler
+ libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+flame_info:
+customize UnixCCompiler
+ libraries flame not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+atlas_3_10_threads_info:
+Setting PTATLAS=ATLAS
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries tatlas,tatlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries tatlas,tatlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries tatlas,tatlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
+ NOT AVAILABLE
+
+atlas_3_10_info:
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries satlas,satlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries satlas,satlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries satlas,satlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_3_10_info'>
+ NOT AVAILABLE
+
+atlas_threads_info:
+Setting PTATLAS=ATLAS
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries ptf77blas,ptcblas,atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries ptf77blas,ptcblas,atlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_threads_info'>
+ NOT AVAILABLE
+
+atlas_info:
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries f77blas,cblas,atlas not found in /usr/local/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries f77blas,cblas,atlas not found in /usr/lib
+customize UnixCCompiler
+ libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
+customize UnixCCompiler
+ libraries f77blas,cblas,atlas not found in /usr/lib/arm-linux-gnueabihf
+<class 'numpy.distutils.system_info.atlas_info'>
+ NOT AVAILABLE
+
+accelerate_info:
+ NOT AVAILABLE
+
+lapack_info:
+customize UnixCCompiler
+ libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
+ NOT AVAILABLE
+
+lapack_src_info:
+ NOT AVAILABLE
+
+ NOT AVAILABLE
+
+setup.py:460: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-yx7fyy34'), proceeding with generating Cython sources and expanding templates
+ warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
+Running from SciPy source directory.
+/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:1712: UserWarning:
+ Lapack (http://www.netlib.org/lapack/) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [lapack]) or by setting
+ the LAPACK environment variable.
+ if getattr(self, '_calc_info_{}'.format(lapack))():
+/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:1712: UserWarning:
+ Lapack (http://www.netlib.org/lapack/) sources not found.
+ Directories to search for the sources can be specified in the
+ numpy/distutils/site.cfg file (section [lapack_src]) or by setting
+ the LAPACK_SRC environment variable.
+ if getattr(self, '_calc_info_{}'.format(lapack))():
+Traceback (most recent call last):
+ File "/home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
+ main()
+ File "/home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
+ json_out['return_val'] = hook(**hook_input['kwargs'])
+ File "/home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
+ return hook(metadata_directory, config_settings)
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 161, in prepare_metadata_for_build_wheel
+ self.run_setup()
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 253, in run_setup
+ super(_BuildMetaLegacyBackend,
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 145, in run_setup
+ exec(compile(code, __file__, 'exec'), locals())
+ File "setup.py", line 583, in <module>
+ setup_package()
+ File "setup.py", line 579, in setup_package
+ setup(**metadata)
+ File "/tmp/pip-build-env-pdkw0rfi/overlay/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup
+ config = configuration()
+ File "setup.py", line 477, in configuration
+ raise NotFoundError(msg)
+numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
+----------------------------------------
+
+
ERROR: Command errored out with exit status 1: /usr/bin/python /home/pi/.local/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpv39ep59r Check the logs for full command output.
+
Is it because i have ARM Cortex-A72 architecture and not x64? Or is it because Raspbian and not exactly Linux? But raspbian based on Linux…
+ ]]>
+ https://pyspice.discourse.group/t/install-pyspice-on-raspberry-pi-4-error/90
+ Mon, 19 Oct 2020 17:38:42 +0000
+ No
+ No
+ No
+ pyspice.discourse.group-topic-90
+
+
+
+
diff --git a/pyspice-discourse-backup/opensearch.xml b/pyspice-discourse-backup/opensearch.xml
new file mode 100644
index 00000000..12d8b337
--- /dev/null
+++ b/pyspice-discourse-backup/opensearch.xml
@@ -0,0 +1,10 @@
+
+
+ PySpice Search
+ Search for posts on PySpice
+ discourse forum
+ https://aws1.discourse-cdn.com/free1/uploads/pyspice/optimized/1X/c8a5f9e5a96fcfbc05759ee1427b85cedcb4ce5a_2_32x32.png
+
+
+
+
diff --git a/pyspice-discourse-backup/posts.rss b/pyspice-discourse-backup/posts.rss
new file mode 100644
index 00000000..ee6e5cf8
--- /dev/null
+++ b/pyspice-discourse-backup/posts.rss
@@ -0,0 +1,584 @@
+
+
+
+ PySpice - Latest posts
+ https://pyspice.discourse.group
+ Latest posts
+
+ More maintainers?
+
+ A better idea may be to have a dedicated track in the NGspice user group for PySpice. ]]>
+ https://pyspice.discourse.group/t/more-maintainers/120#post_4
+ Thu, 03 Feb 2022 00:32:34 +0000
+ pyspice.discourse.group-post-274
+
+
+ Error while using 3 terminal Resistors
+
+ I get an error when using 3 terminal resistors from Skywater 130nm PDK. When I looked at BasicElements.py, I noticed that all resistors are defined as DipoleElements. I have added a class for 3 terminal devices and now I am able to simulate the circuit. The same is true for 3-terminal capacitors too.
+
I would like to contribute PySpice to make it compatible with Skywater 130nm PDK devices. Kindly let me know what would be best way to contribute
]]>
+ https://pyspice.discourse.group/t/error-while-using-3-terminal-resistors/164#post_1
+ Mon, 31 Jan 2022 19:46:50 +0000
+ pyspice.discourse.group-post-273
+
+
+ Simulating a circuit with 16 MOSFETs: True gmin stepping error
+
+ The issue was the MOSFET model. I managed to solve the problem. See: Simulation of Digital Logic Gates in PySpice (Python) - YouTube ]]>
+ https://pyspice.discourse.group/t/simulating-a-circuit-with-16-mosfets-true-gmin-stepping-error/162#post_2
+ Wed, 19 Jan 2022 04:02:18 +0000
+ pyspice.discourse.group-post-271
+
+
+ Simulating a circuit with 16 MOSFETs: True gmin stepping error
+
+ Hello,
+
I am trying to simulate a circuit using 16 MOSFETS.
+
The issue is that once the MOSFETS’s 15 and 16 are placed in the schematic, it results in an error: PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR
+
If the MOSFET’s 15 and 16 are commented out, then the code compiles.
+
I am using NGspice-34.dll and PySpice 1.5. Have also tested with Pyspice 1.4.3 and NGspice-32.dll.
+
Is NGSpice reaching some maximum nodes/complexity limit? OR is this an issue with mosfet model? OR it is a circuit netlist (floating node?) issue?
+
Any help or ideas would be greatly appreciated.
+
The code and error message are reproduced below.
+
Thanks
+
Kahless96
+
##***********************************************
+import math
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.widgets import Cursor
+from matplotlib.pyplot import semilogx
+from matplotlib import pyplot
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
Here is the error messages after which it fails to run:
+
2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: Starting true gmin stepping
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-03 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-04 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-05 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-06 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-07 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-08 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-09 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-10 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-11 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: True gmin stepping completed
+
I have seen this gmin stepping error in other forum posts but in those cases it was related to circuit netlist error. This does not seem to be the case here.
+
The mosfet models being used are provided with Pyspice.
]]>
+ https://pyspice.discourse.group/t/simulating-a-circuit-with-16-mosfets-true-gmin-stepping-error/162#post_1
+ Thu, 13 Jan 2022 03:55:35 +0000
+ pyspice.discourse.group-post-270
+
+
+ Simulating Dependent Sources (CCVS works but VCVS does not?!)
+
+ Re: dsalman,
+
Thanks for your suggestions. The problem has been addressed. Yes, it was an installation issue.
]]>
+ https://pyspice.discourse.group/t/simulating-dependent-sources-ccvs-works-but-vcvs-does-not/105#post_6
+ Sun, 28 Nov 2021 19:45:14 +0000
+ pyspice.discourse.group-post-264
+
+
+ Simulating Dependent Sources (CCVS works but VCVS does not?!)
+
+ It could be an installation issue. Please see here: Introduction to PySpice (Python) for DC Circuit Analysis with Dependent Sources - YouTube ]]>
+ https://pyspice.discourse.group/t/simulating-dependent-sources-ccvs-works-but-vcvs-does-not/105#post_5
+ Sun, 28 Nov 2021 09:05:45 +0000
+ pyspice.discourse.group-post-263
+
+
+ Simulating Dependent Sources (CCVS works but VCVS does not?!)
+
+ when I run the program:
+##############################################################
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
for node in analysis.nodes.values():
+print(‘Node {}: {:4.1f} V’.format(str(node), float(node)))
+
I see an error message:
+Traceback (most recent call last):
+File “C:\PySpice\ICs\programtest.py”, line 24, in
+simulator = circuit.simulator(temperature=25, nominal_temperature=25)
+
Any suggestions? Thanks in advance.
]]>
+ https://pyspice.discourse.group/t/simulating-dependent-sources-ccvs-works-but-vcvs-does-not/105#post_4
+ Sun, 28 Nov 2021 08:09:49 +0000
+ pyspice.discourse.group-post-262
+
+
+ XSPICE elements in PySpice
+
+ I always see a problem like this:
+Traceback (most recent call last):
+File “C:\PySpice\ICs\simulation.py”, line 23, in
+simulator = circuit.simulator(temperature=27, nominal_temperature=27)
+
My program execution shows a problem at “simulator = circuit.simulator(temperature=27, nominal_temperature=27)”. Any suggestions?
+
Thanks
]]>
+ https://pyspice.discourse.group/t/xspice-elements-in-pyspice/61#post_6
+ Sun, 28 Nov 2021 08:05:54 +0000
+ pyspice.discourse.group-post-261
+
+
+ Looking for a Xyce Example
+
+ I would also like Xyce examples too!
+
Following the comments above, I managed to make all work in Ubuntu 20.04 here is some code:
]]>
+ https://pyspice.discourse.group/t/looking-for-a-xyce-example/82#post_2
+ Fri, 26 Nov 2021 14:51:51 +0000
+ pyspice.discourse.group-post-258
+
+
+ Divide one AC-analysis waveform by another
+
+ Get result into np.array
+
V = np.array(analysis.nodes[‘none name’])
+I = np.array(analysis.branches[‘branch name’])
+Now you can try mathematical operation ion V and I as they are numpy arrays.
]]>
+ https://pyspice.discourse.group/t/divide-one-ac-analysis-waveform-by-another/140#post_2
+ Thu, 11 Nov 2021 13:52:23 +0000
+ pyspice.discourse.group-post-255
+
+
+ Extract array of complex numbers from waveform
+
+ If say you have
+analysis = simulator.AC(…)
+then try
+c = np.array(analysis.nodes[‘in’]) where "in’ is one of the nodes
+print(c)
+and check if it is complex ]]>
+ https://pyspice.discourse.group/t/extract-array-of-complex-numbers-from-waveform/139#post_2
+ Thu, 11 Nov 2021 13:49:39 +0000
+ pyspice.discourse.group-post-254
+
+
+ Problems with running simulator
+
+ Hi every one!
+I am new to PySpice. I was running 1.4.3 ver with ngspice 3.2 and everything was working well.
+My computer did a usual clean up and update.
+
Now the netlist part works fine. But when I call the simulator I get a long error message (I will paste below). I was doing good progress and I am glad to share a 3 phase diode rectifier model which was working well. Until this problem arose. When I did an update I see that the cur ver is 1.5 and installs ngspice 3.4
+
Any help is appreciated. Else will have to go back to LTspice
~\Anaconda3\lib\site-packages\PySpice\Spice\Netlist.py in simulator(self, *args, **kwargs)
+
~\Anaconda3\lib\site-packages\PySpice\Spice\Simulation.py in factory(cls, circuit, *args, **kwargs)
+1117 “”" This class implements a circuit simulator. Each analysis mode is performed by a method that
+1118 return the measured probes.
+ → 1119
+1120 For ac and transient analyses, the user must specify a list of nodes using the probes key
+1121 argument.
+
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Simulation.py in init(self, circuit, **kwargs)
+97 ngspice_shared = kwargs.get(‘ngspice_shared’, None)
+98 if ngspice_shared is None:
+—> 99 self._ngspice_shared = NgSpiceShared.new_instance()
+100 else:
+101 self._ngspice_shared = ngspice_shared
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Shared.py in _load_library(self, verbose)
+511 if ‘SPICE_LIB_DIR’ not in os.environ:
+512 _ = str(Path(self.NGSPICE_PATH).joinpath(‘share’, ‘ngspice’))
+ → 513 os.environ[‘SPICE_LIB_DIR’] = _
+514 # self._logger.warning(‘Set SPICE_LIB_DIR = %s’, _)
+515
+
~\Anaconda3\lib\pathlib.py in new(cls, *args, **kwargs)
+1036 if cls is Path:
+1037 cls = WindowsPath if os.name == ‘nt’ else PosixPath
+ → 1038 self = cls._from_parts(args, init=False)
+1039 if not self._flavour.is_supported:
+1040 raise NotImplementedError(“cannot instantiate %r on your system”
+
~\Anaconda3\lib\pathlib.py in _from_parts(cls, args, init)
+677 # right flavour.
+678 self = object.new(cls)
+ → 679 drv, root, parts = self._parse_args(args)
+680 self._drv = drv
+681 self._root = root
+
~\Anaconda3\lib\pathlib.py in _parse_args(cls, args)
+661 parts += a._parts
+662 else:
+ → 663 a = os.fspath(a)
+664 if isinstance(a, str):
+665 # Force-cast str subclasses to str (issue #21127)
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
]]>
+ https://pyspice.discourse.group/t/problems-with-running-simulator/153#post_1
+ Thu, 11 Nov 2021 13:45:39 +0000
+ pyspice.discourse.group-post-253
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ Thank you. Its puzzling but the syntax does not work in Windows… ]]>
+ https://pyspice.discourse.group/t/how-to-get-voltage-acrros-two-points-to-write-behavioral-voltage-source-expression/147#post_6
+ Mon, 04 Oct 2021 10:32:08 +0000
+ pyspice.discourse.group-post-251
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ I did it with ubuntu os ]]>
+ https://pyspice.discourse.group/t/how-to-get-voltage-acrros-two-points-to-write-behavioral-voltage-source-expression/147#post_5
+ Mon, 04 Oct 2021 04:18:36 +0000
+ pyspice.discourse.group-post-249
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ Thank you. Is this syntax with Linux or Windows operating system. ]]>
+ https://pyspice.discourse.group/t/how-to-get-voltage-acrros-two-points-to-write-behavioral-voltage-source-expression/147#post_4
+ Sun, 03 Oct 2021 09:30:44 +0000
+ pyspice.discourse.group-post-248
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ yes. Use the following .
+
]]>
+ https://pyspice.discourse.group/t/howto-transient-analysis/150#post_3
+ Wed, 29 Sep 2021 05:58:02 +0000
+ pyspice.discourse.group-post-246
+
+
+ Howto: Transient analysis
+
+ Okay, now I have the following code
+
+#r# This example shows the computation of the DC biases in a resistor bridge.
+
+####################################################################################################
+
+import matplotlib.pyplot as plt
+##
+import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
+
+####################################################################################################
+
+from PySpice.Spice.Netlist import Circuit
+from PySpice.Unit import *
+
+####################################################################################################
+
+#f# circuit_macros('resistor-bridge.m4')
+
+circuit = Circuit('Resistor Divider')
+#circuit.PulseMixin(0@u_V, 20@u_V, 5@u_us, 10@u_us, delay_time=0) #doesn't work
+circuit.V('i', 'inp', circuit.gnd, 10@u_V) #works
+circuit.R(1, 'inp', 'out', 5@u_kΩ)
+circuit.R(2, 'out', circuit.gnd, 5@u_kΩ)
+
+
+simulator = circuit.simulator(temperature=25, nominal_temperature=25)
+analysis = simulator.transient(step_time=1@u_us, end_time=500@u_us)
+
+####################################################################################################
+
+figure1, ax = plt.subplots(figsize=(20, 10))
+ax.set_title('Voltage Divider')
+ax.set_xlabel('Time [s]')
+ax.set_ylabel('Voltage [V]')
+ax.grid()
+ax.plot(analysis.inp)
+ax.plot(analysis.out)
+ax.legend(('input', 'output'), loc=(.05,.1))
+#ax.set_ylim(float(-amplitude*1.1), float(amplitude*1.1))
+
+#plt.tight_layout()
+plt.show()
+
+
Can somebody help me please with the pulsed source?
]]>
+ https://pyspice.discourse.group/t/howto-transient-analysis/150#post_2
+ Mon, 27 Sep 2021 20:26:57 +0000
+ pyspice.discourse.group-post-245
+
+
+ Howto: Transient analysis
+
+ I want to do a transient analysis of a square wave.
+
+
How do I do a transient analysis and plot the output?
+
How do I implement a square wave?
+
+
I found nothing in the examples. Thanks for your help,
+Michael
]]>
+ https://pyspice.discourse.group/t/howto-transient-analysis/150#post_1
+ Mon, 27 Sep 2021 20:08:15 +0000
+ pyspice.discourse.group-post-244
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ Trying to do the same. Not sure what syntax to use to access the node voltages in the circuit. @sant: Were you able to make any progress. If you can share what you tried maybe we can help each other to solve this issue. ]]>
+ https://pyspice.discourse.group/t/how-to-get-voltage-acrros-two-points-to-write-behavioral-voltage-source-expression/147#post_2
+ Fri, 24 Sep 2021 02:24:37 +0000
+ pyspice.discourse.group-post-242
+
+
+ How to write .func in pyspice and use it in behavioral source?
+
+ I want to write a .func that will help me designing a device model. I used **raw_spice=’ …’ ** but it is not working. I am new in pyspice.
+
Thank yuo
]]>
+ https://pyspice.discourse.group/t/how-to-write-func-in-pyspice-and-use-it-in-behavioral-source/148#post_1
+ Thu, 16 Sep 2021 00:26:03 +0000
+ pyspice.discourse.group-post-241
+
+
+ How to get voltage acrros two points to write behavioral voltage source expression?
+
+ I am new with pyspice. I want to add a behavioral voltage source to my circuit. To write its expression we need voltage across two points x and y. For example v=2*Voltage(x,y)
+
Will anyone share the syntax in pyspice?
+Thank you.
for a research project I’m working on control strategies for PFC circuits and therefore I need to simulate a passive circuit in conjunction with two half bridges.
+Problem is that I need the simulation to interact with a python script since I need to calculate the control signals of the two half bridges externally and thus the simualtion flow is as follows.
+
First, I need to initialize the simulation which basically means that I need to sample the amplitude and phase of a sinusodial source representing the grid voltage and the component values and initial conditions of the passive components. Next, I need to run the simulation in chunks where I first calculate the four control signals of the half bridges based on the current and voltage signals of the passive circuit followed by a chunk of transient simulation for a given time span (sample rate of the controller).
+
I tried to implement this flow but I unfortunately I struggle with the following issues.
+
a) Phase of the AC source:
+I tired SinusoidalVoltageSource() but I failed to specify a phase offset. Altough it’s base class SinusoidalMixin() offers a delay attribute, it seems that it just enables the source after a given time and thus this isn’t the desired behaviour for my purpose. Alternatively, I defined my own grid voltage using a NgSpiceShared object according …/examples/ngspice-shared/external-source.html.
+This essential does the trick for me but leaves with the next problem.
+
b) Multiple External Sources:
+Give the simulation flow above I need to run the simulation with at least four external sources, two for every half bridge, and five if I define the grid voltage also as external source. So I wonder how I define multiple shared objects.
+
c) Setting the initial conditions
+Since I run the simulation in chunks I wonder if I have to preload the nodes with the latest values and I need to run the simulation with start_time=0 and end_time=timespan according the controller’s sample rate or are the states kept internally and I need just to run the simulation with start_time=(k-1)timespan, end_time=ktimespan in order to run the kth simulation chunk.
I have no idea how I should solve this problem, please help me
]]>
+ https://pyspice.discourse.group/t/library-import-corner-analysis/143#post_1
+ Mon, 09 Aug 2021 06:01:08 +0000
+ pyspice.discourse.group-post-236
+
+
+ Divide one AC-analysis waveform by another
+
+ I have run an AC analysis in PySpice.
+I have found the waveform for input (source) voltage, and input (source) current.
+Now I would like to find the impedance waveform (voltage/current)
+How can I divide one waveform by another?
+
Thanks for your help!
]]>
+ https://pyspice.discourse.group/t/divide-one-ac-analysis-waveform-by-another/140#post_1
+ Fri, 28 May 2021 12:53:00 +0000
+ pyspice.discourse.group-post-233
+
+
+ Extract array of complex numbers from waveform
+
+ Hi
+
I am just getting started with PySpice.
+
I have run an AC analysis on a netlist using PySpice, and have extracted my waveforms, but would like to convert these into a numpy array of complex numbers - how do I do this?
+
I want to do further mathematical analysis on the PySpice Waveform output.
+
Thanks
]]>
+ https://pyspice.discourse.group/t/extract-array-of-complex-numbers-from-waveform/139#post_1
+ Fri, 28 May 2021 12:50:00 +0000
+ pyspice.discourse.group-post-232
+
+
+ Extract float-type number from class 'PySpice.Unit.Unit.UnitValue'
+
+ Hi
+
I am just getting started with using PySpice.
+
I have extracted voltage/current values from a PySpice analysis, and would like to analyze these using other Python functions.
+
But all of my values are now of type class ‘PySpice.Unit.Unit.UnitValue’.
+
How can I remove the units, so that these are just normal float numbers?
+
Thanks
]]>
+ https://pyspice.discourse.group/t/extract-float-type-number-from-class-pyspice-unit-unit-unitvalue/138#post_1
+ Fri, 28 May 2021 12:44:13 +0000
+ pyspice.discourse.group-post-231
+
+
+ Whats PySpice's Advantages?
+
+ Pyspice opens up the power of python for theoretical calculations, side by side with simulations. You cannot do this in any other simulator. See the videos in this playlist here which illustrate the flexibility and advantage of using Pyspice, compared to LTSPICE, PSPICE: Introduction to PySpice (Python) for DC Circuit Analysis with Dependent Sources - YouTube ]]>
+ https://pyspice.discourse.group/t/whats-pyspices-advantages/135#post_2
+ Sun, 23 May 2021 11:10:07 +0000
+ pyspice.discourse.group-post-229
+
+
+
diff --git a/pyspice-discourse-backup/privacy.html b/pyspice-discourse-backup/privacy.html
new file mode 100644
index 00000000..ab8750db
--- /dev/null
+++ b/pyspice-discourse-backup/privacy.html
@@ -0,0 +1,164 @@
+
+
+
+
+ Privacy - PySpice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
We collect information from you when you register on our site and gather data when you participate in the forum by reading, writing, and evaluating the content shared here.
+
When registering on our site, you may be asked to enter your name and e-mail address. You may, however, visit our site without registering. Your e-mail address will be verified by an email containing a unique link. If that link is visited, we know that you control the e-mail address.
+
When registered and posting, we record the IP address that the post originated from. We also may retain server logs which include the IP address of every request to our server.
Any of the information we collect from you may be used in one of the following ways:
+
+
To personalize your experience — your information helps us to better respond to your individual needs.
+
To improve our site — we continually strive to improve our site offerings based on the information and feedback we receive from you.
+
To improve customer service — your information helps us to more effectively respond to your customer service requests and support needs.
+
To send periodic emails — The email address you provide may be used to send you information, notifications that you request about changes to topics or in response to your user name, respond to inquiries, and/or other requests or questions.
We implement a variety of security measures to maintain the safety of your personal information when you enter, submit, or access your personal information.
Yes. Cookies are small files that a site or its service provider transfers to your computer’s hard drive through your Web browser (if you allow). These cookies enable the site to recognize your browser and, if you have a registered account, associate it with your registered account.
+
We use cookies to understand and save your preferences for future visits and compile aggregate data about site traffic and site interaction so that we can offer better site experiences and tools in the future. We may contract with third-party service providers to assist us in better understanding our site visitors. These service providers are not permitted to use the information collected on our behalf except to help us conduct and improve our business.
We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our site, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.
Occasionally, at our discretion, we may include or offer third party products or services on our site. These third party sites have separate and independent privacy policies. We therefore have no responsibility or liability for the content and activities of these linked sites. Nonetheless, we seek to protect the integrity of our site and welcome any feedback about these sites.
Our site, products and services are all directed to people who are at least 13 years old or older. If this server is in the USA, and you are under the age of 13, per the requirements of COPPA (Children’s Online Privacy Protection Act), do not use this site.
(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)
+
Use the following paragraphs for a longer description, or to establish category guidelines or rules:
+
+
+
Why should people use this category? What is it for?
+
+
+
How exactly is this different than the other categories we already have?
+
+
+
What should topics in this category generally contain?
+
+
+
Do we need this category? Can we merge with another category, or subcategory?
when working with pyspice 1.3 it was possible for me to change device parameters in thie way described below. With 1.4 this does not seem to work any more. Is there a new or alternate syntax?
+
#############################
+import os
+os.linesep="\n"
good afternoon community among my adventure to simulate an example of the pyspice module I ran into the following error:
+---------------------------------------------------------------------------
+
AttributeError Traceback (most recent call last)
+
+<ipython-input-12-475d4280ae1b> in <module>()
+----> 1 simulator = circuit.simulator(temperature=25, nominal_temperature=25)
+ 2 analysis = simulator.ac(start_frequency=1@u_Hz, stop_frequency=1@u_MHz, number_of_points=10, variation='dec')
+
+2 frames
+
+/usr/local/lib/python3.6/dist-packages/PySpice/Spice/NgSpice/Simulation.py in __init__(self, circuit, **kwargs)
+ 97 ngspice_shared = kwargs.get('ngspice_shared', None)
+ 98 if ngspice_shared is None:
+---> 99 self._ngspice_shared = NgSpiceShared.new_instance()
+ 100 else:
+ 101 self._ngspice_shared = ngspice_shared
+
+AttributeError: type object 'NgSpiceShared' has no attribute 'new_instance
+
+
the example link is as follows
+https://pyspice.fabrice-salvaire.fr/examples/filter/low-pass-rc-filter.html
+the characteristic of my environment are the following
+ubuntu 18.04, python 3.6.2, pyscpice 1.4.2
+To clarify I am a student of electrical engineering and I am just getting into this world of computer science, thank you very much for your help
I am however interested in replacing the voltage source with a current source and still get a bode plot that compares the output voltage to input current. Just replacing the voltage source with a current source as follows gives me an error.
We want to parse a sp file with a netlist that embeds a subcircuit definition. When we parse it with SpiceParser we noticed that the subcircuit definition is removed. Is there a way to include the subcircuit definition during the parsing process?
I am completely new to electronics and any kind of circuit modelling. I have a .cir file that I need to turn into python classes so I can carry out precedures like chaining 2 or more subcircuits together and doing monte carlo simulation. The .cir was exported from PSpice. I was wondering, is this possible? To turn .cir to python classes? .cir has subcircuits defined.
I found the .raw_spice feature helpful to convert “classical” spice Netlists to pyspice.
+It is quite easy to add Python Variables and link to external routines.
+
One of my examples:
+
from PySpice.Spice.Netlist import Circuit
+
circuit = Circuit(‘Test’)
+
circuit.raw_spice = ‘’’
+*.title rtest
+.param rdc= ‘’’+str(rdc)+’’’
+I1 1 r 0 AC 1
+R1 r 0 {rdc}
+‘’’
I have run an AC analysis in PySpice.
+I have found the waveform for input (source) voltage, and input (source) current.
+Now I would like to find the impedance waveform (voltage/current)
+How can I divide one waveform by another?
V = np.array(analysis.nodes[‘none name’])
+I = np.array(analysis.branches[‘branch name’])
+Now you can try mathematical operation ion V and I as they are numpy arrays.
Good afternoon everyone, I am writing to the community to consult a page to find electronic components for pyspice something similar to the page of https://www.snapeda.com/, if anyone has information you are very much appreciated
I’ve just installed PySpice (on Fedora, using pip install PySpice). I’ve downloaded the examples with pyspice-post-installation --download-example and tried to run them. I get a number of errors, but the one that appears most often is:
+
pyspice-post-installation --download-example
+
I googled the problem but couldn’t fix it, grateful for suggestions.
good afternoon I communicate with the community because I am not very good at programming but I am trying to learn how to simulate circuits that I need for a job, however when I try to simulate the circuit of the example of transistors I get the following error
+
Traceback (most recent call last):
+ File "polos.py", line 50, in <module>
+ circuit.include(spice_library['2n2222a'])
+ File "/usr/local/lib/python3.6/dist-packages/PySpice/Spice/Library.py", line 107, in __getitem__
+ raise KeyError(name)
+KeyError: '2n2222a'
It looks like you didn’t provide a spice model for the 2n2222a transistor. In general, spice models are mostly protected by copyrights so you shouldn’t expect to get models with PySpice or Ngspice (or really any other open source project for that matter). You can still find them online though. For instance, here’s a link to the model you want. That site contains tons of other useful models too. The other way I know to find them is to search the product vendor and spice. A bunch of MFGs provide spice models, but you have to download it from their site.
The 2n2222a is actually provided in the PySpice example directory (PySpice/examples/libraries/transistor/2N2222A.lib) for demonstration purpose.
+
The only “trick” is to provide the path of the library directory in your own python script.
+
The example “PySpice/examples/transistor/transistor.py” works because the library path is generated using the PySpice standard location and provided through the commands :
In your case, you should provide SpiceLibrary(...) with the path of your library directory.
+(Except if you exactly match the PySpice example directory architecture, you should always provide the path of your library directory. )
@huszaghmattcopyright issue is an important point to mention !
+
Does somebody know if we could implement a web downloader ??? What about Eagle ??? I have the feeling that on some points the electronic industry doesn’t help CAD design …
I’m intrigued by the idea of a spice model downloader. Finding spice models is a bit time-consuming and it’s a hurdle when you first get started with simulations.
+
One nice feature would be to store a cache of models and download urls so that someone using the downloader wouldn’t need to rescrape the sites or give the downloader hints about where to find the model. I imagine this would be permissible without violating copyright since we wouldn’t store the models. The cache does of course present some additional challenges. The repo would either need frequent PRs as the model locations change, or require supporting a server to perform the scrapes.
+
I also wonder if it’s worthwhile to do this as a separate project from PySpice, since other projects might be able to leverage this functionality without requiring the full-blown simulation capability of PySpice. Just a thought.
I have run an AC analysis on a netlist using PySpice, and have extracted my waveforms, but would like to convert these into a numpy array of complex numbers - how do I do this?
+
I want to do further mathematical analysis on the PySpice Waveform output.
If say you have
+analysis = simulator.AC(…)
+then try
+c = np.array(analysis.nodes[‘in’]) where "in’ is one of the nodes
+print(c)
+and check if it is complex
Thankyou for response sir,
+i’ve downloaded 1N4148.lib from the github examples library. As i m new to pyspice can you please tell me how to define path properly ? It ll be really helpful if you explain in detail how to define path properly .I ve watched your amazing tutorials on pyspice so far.
+
May be a youtube video on this topic may help many begineers who come across this error.
+Thankyou sir.
Hello everyone! I am new to pyspice and trying to run the example. The issue I’m running into is with rlc-filter.py, the bode plots aren’t working and don’t match what’s in the documentation. Here are screenshots of the plots and the output which hopefully points to the issue.
+
I am new with pyspice. I want to add a behavioral voltage source to my circuit. To write its expression we need voltage across two points x and y. For example v=2*Voltage(x,y)
+
Will anyone share the syntax in pyspice?
+Thank you.
Trying to do the same. Not sure what syntax to use to access the node voltages in the circuit. @sant: Were you able to make any progress. If you can share what you tried maybe we can help each other to solve this issue.
I’ve been trying to simulate a model of a neuron coupled to a microelectrode in ngspice. However, while the microelectrode is easy to simulate the neuronal model is quite difficult. As such, when I found pyspice I thought maybe I could use the netlist I already have for the microelectrode and create the neuron model in python and use the output voltage of the neuron model as an input in the microelectrode model.
+I’ve read through all the examples and some documentation and even used the ngspice shared interpreter example with my microelectrode netlist but I cannot even find a way of just plotting the circuits transient analysis (without the neuron model) as I did with ngspice.
+
To summarize, my questions are:
+
+
Can I use my already written netlist of the microelectrode with the ngspice shared option ?
+
To interface the neuron model that I will write in python as source voltage for the microelectrode does it mean that I have to re-write the netlist into pyspyce nomenclature ?
Dear PySpice community, I would like to share some installation example files to illustrate the installation procedure of PySpice on Linux by using apt and pip only.
+
Those files are published as Dockerfile scripts since they allow full automatic machine instantiation with docker.
+They cover both Ubuntu and Debian, using a standard approach using only apt :
for a research project I’m working on control strategies for PFC circuits and therefore I need to simulate a passive circuit in conjunction with two half bridges.
+Problem is that I need the simulation to interact with a python script since I need to calculate the control signals of the two half bridges externally and thus the simualtion flow is as follows.
+
First, I need to initialize the simulation which basically means that I need to sample the amplitude and phase of a sinusodial source representing the grid voltage and the component values and initial conditions of the passive components. Next, I need to run the simulation in chunks where I first calculate the four control signals of the half bridges based on the current and voltage signals of the passive circuit followed by a chunk of transient simulation for a given time span (sample rate of the controller).
+
I tried to implement this flow but I unfortunately I struggle with the following issues.
+
a) Phase of the AC source:
+I tired SinusoidalVoltageSource() but I failed to specify a phase offset. Altough it’s base class SinusoidalMixin() offers a delay attribute, it seems that it just enables the source after a given time and thus this isn’t the desired behaviour for my purpose. Alternatively, I defined my own grid voltage using a NgSpiceShared object according …/examples/ngspice-shared/external-source.html.
+This essential does the trick for me but leaves with the next problem.
+
b) Multiple External Sources:
+Give the simulation flow above I need to run the simulation with at least four external sources, two for every half bridge, and five if I define the grid voltage also as external source. So I wonder how I define multiple shared objects.
+
c) Setting the initial conditions
+Since I run the simulation in chunks I wonder if I have to preload the nodes with the latest values and I need to run the simulation with start_time=0 and end_time=timespan according the controller’s sample rate or are the states kept internally and I need just to run the simulation with start_time=(k-1)timespan, end_time=ktimespan in order to run the kth simulation chunk.
I have set up PySpice 1.4.2 through a virtual environment and brew installed Ngspice and libngspice on Mac 0S X. However, “pyspice-post-installation --check-install” tells me that Ngspice version 33 is not supported.
Hi, I have installed Xyce, NGSpice and PySpice and everything is almost working… except, when I run on iPython (actually Anaconda Spyder) then I stumbled into a cdef problem on duplidate definition of ngcomplex. I can see on github some discussion, but not clear to me how to move forward on it. No mater, I have Xyce. But then I was stumbling at the start [again]. The documentation says to set an attribute
But where do I type that? It seems to be an attribute of a class or something?? So then I try
+… = simulator(xyce_command=r"C:\Program Files\Xyce 7.1 OPENSOURCE\bin\Xyce.exe", simulator=‘xyce-serial’,…)
+
and that one dies with file not found, although it is the correct command to launch Xyce.
+
What finally worked (yeh!) was to edit by hand the PySpice source code and find where XyceCommand was defined and wow. I’m amazed. Works perfectly
+
But was there a cleaner way that I could have done this?
+
Thanks so much for putting this product together. I’m excited to check it out further.
I multiplied two Waveform objects: one containing voltages and the other containing currents. Then I multiplied it by a PeriodValue. As expected, the resulting Wavform object contains numbers with the units of Joules. But when I applied the sum() method to this Waveform, I got a scalar value with no units.
+
Is there any way to do this without losing the units for the calculations that follow?
Good afternoon community, I am writing to you because I have encountered the following error trying to simulate the following filter that appears in the documentation.
The error is as follows.
+2020-05-23 00:45:37,954 - PySpice.Spice.NgSpice.Shared.NgSpiceShared.new_instance - INFO - New instance for id 0
+2020-05-23 00:45:37,955 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._load_library - WARNING - Set locale LC_NUMERIC to C
+
---------------------------------------------------------------------------
+
+OSError Traceback (most recent call last)
+
+<ipython-input-6-475d4280ae1b> in <module>()
+----> 1 simulator = circuit.simulator(temperature=25, nominal_temperature=25)
+ 2 analysis = simulator.ac(start_frequency=1@u_Hz, stop_frequency=1@u_MHz, number_of_points=10, variation='dec')
+
+8 frames
+
+/usr/local/lib/python3.6/dist-packages/cffi/api.py in _load_backend_lib(backend, name, flags)
+ 825 if first_error is not None:
+ 826 msg = "%s. Additionally, %s" % (first_error, msg)
+--> 827 raise OSError(msg)
+ 828 return backend.load_library(path, flags)
+ 829
+
+OSError: cannot load library 'libngspice.so': libngspice.so: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libngspice.so'
+
+
I have installed all the dependencies, although I have run out of ideas, I am starting in the world of programming, however, they asked me for a job to simulate filters in the university. I need your help, if possible, a lot of fat in advance
compile the library by yourself (which I suspect, is beyond your knowledge) ;
+
download the package and its dependencies from packages.ubuntu.com, arrange the library and set the LD_LIBRARY_PATH (which may also be a not trivial operation for you)
+
create a virtual machine with an Ubuntu 19.10 guest (the easiest solution ; with all the drawbacks of virtual machines)
for node in analysis.nodes.values():
+print(‘Node {}: {:5.2f} V’.format(str(node), float(node)))
+
######################################
+
However in Spice Macromodels global parameters should be possible like a netlist in this way:
+######################################
+…
+source=’’’
+.title abc
+.param res=1k
+V1 inx 0 DC 2V
+R1 inx out {res}
+R2 out 0 2k
+.end
+‘’’
+… and so on…
+
Anyway, the parser does not seem to recognize neither the “.param” nor the curled braces.
Actually the parser is quite incomplete, there is some improvements in a PR to be merged. I think it will be hard to implement a full parser due to the lack of grammar. I am afraid we have to look in the NgSpice code to learn it.
+
However you can try the .raw feature to pass raw spice and just get outputs.
circuit = Circuit('Test')
+
+#r# Pass raw Spice definitions to a circuit, aka netlist, content is inserted at the beginning of
+#r# the netlist.
+circuit.raw_spice = '''
+Vinput in 0 10V
+R1 in out 9kOhm
+'''
+
+#r# Pass element parameters as raw Spice, content is concatenated with `R2 out 0`
+circuit.R(2, 'out', 0, raw_spice='1k')
+
+print(circuit)
Hi every one!
+I am new to PySpice. I was running 1.4.3 ver with ngspice 3.2 and everything was working well.
+My computer did a usual clean up and update.
+
Now the netlist part works fine. But when I call the simulator I get a long error message (I will paste below). I was doing good progress and I am glad to share a 3 phase diode rectifier model which was working well. Until this problem arose. When I did an update I see that the cur ver is 1.5 and installs ngspice 3.4
+
Any help is appreciated. Else will have to go back to LTspice
~\Anaconda3\lib\site-packages\PySpice\Spice\Netlist.py in simulator(self, *args, **kwargs)
+
~\Anaconda3\lib\site-packages\PySpice\Spice\Simulation.py in factory(cls, circuit, *args, **kwargs)
+1117 “”" This class implements a circuit simulator. Each analysis mode is performed by a method that
+1118 return the measured probes.
+ → 1119
+1120 For ac and transient analyses, the user must specify a list of nodes using the probes key
+1121 argument.
+
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Simulation.py in init(self, circuit, **kwargs)
+97 ngspice_shared = kwargs.get(‘ngspice_shared’, None)
+98 if ngspice_shared is None:
+—> 99 self._ngspice_shared = NgSpiceShared.new_instance()
+100 else:
+101 self._ngspice_shared = ngspice_shared
~\Anaconda3\lib\site-packages\PySpice\Spice\NgSpice\Shared.py in _load_library(self, verbose)
+511 if ‘SPICE_LIB_DIR’ not in os.environ:
+512 _ = str(Path(self.NGSPICE_PATH).joinpath(‘share’, ‘ngspice’))
+ → 513 os.environ[‘SPICE_LIB_DIR’] = _
+514 # self._logger.warning(‘Set SPICE_LIB_DIR = %s’, _)
+515
+
~\Anaconda3\lib\pathlib.py in new(cls, *args, **kwargs)
+1036 if cls is Path:
+1037 cls = WindowsPath if os.name == ‘nt’ else PosixPath
+ → 1038 self = cls._from_parts(args, init=False)
+1039 if not self._flavour.is_supported:
+1040 raise NotImplementedError(“cannot instantiate %r on your system”
+
~\Anaconda3\lib\pathlib.py in _from_parts(cls, args, init)
+677 # right flavour.
+678 self = object.new(cls)
+ → 679 drv, root, parts = self._parse_args(args)
+680 self._drv = drv
+681 self._root = root
+
~\Anaconda3\lib\pathlib.py in _parse_args(cls, args)
+661 parts += a._parts
+662 else:
+ → 663 a = os.fspath(a)
+664 if isinstance(a, str):
+665 # Force-cast str subclasses to str (issue #21127)
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
I am writing a python script that generates, runs and eventually will read the raw files. The command I use to run the netlist is the following: subprocess.run([path_to_ngspice_executable,'-r','rawfile.raw','-b','-i',my_netlist]) which generates my rawfile.
+
Could you please tell me what PySpice command to use so I can read the generated raw file and plot the distribution of my voltages?
Essentially I would like to have a way to “heat map” a circuit pretty much like a FLIR camera does but via simulation/software… is it possible with NgSpice alone? Or would this require more ammo with FEA modelling or the like?
+
I would like to know if somebody has attempted this successfully and has good experience/code to share?
I am trying to simulate a circuit using 16 MOSFETS.
+
The issue is that once the MOSFETS’s 15 and 16 are placed in the schematic, it results in an error: PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR
+
If the MOSFET’s 15 and 16 are commented out, then the code compiles.
+
I am using NGspice-34.dll and PySpice 1.5. Have also tested with Pyspice 1.4.3 and NGspice-32.dll.
+
Is NGSpice reaching some maximum nodes/complexity limit? OR is this an issue with mosfet model? OR it is a circuit netlist (floating node?) issue?
+
Any help or ideas would be greatly appreciated.
+
The code and error message are reproduced below.
+
Thanks
+
Kahless96
+
##***********************************************
+import math
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.widgets import Cursor
+from matplotlib.pyplot import semilogx
+from matplotlib import pyplot
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
Here is the error messages after which it fails to run:
+
2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: Starting true gmin stepping
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-03 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-04 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-05 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-06 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-07 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-08 Note: One successful gmin step
+2022-01-13 14:24:25,298 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-09 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-10 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-11 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Trying gmin = 1.0000E-12 Note: One successful gmin step
+2022-01-13 14:24:25,314 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.ERROR - Note: True gmin stepping completed
+
I have seen this gmin stepping error in other forum posts but in those cases it was related to circuit netlist error. This does not seem to be the case here.
+
The mosfet models being used are provided with Pyspice.
for node in analysis.nodes.values():
+print(‘Node {}: {:4.1f} V’.format(str(node), float(node)))
+
When I run, it gives an error:
+
Traceback (most recent call last):
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 928, in getattr
+return self.getitem(attribute_name)
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 921, in getitem
+raise IndexError(attribute_name) # KeyError
+IndexError: E
+
During handling of the above exception, another exception occurred:
+
Traceback (most recent call last):
+File “C:/Users/Desktop/PySpice/node-voltage-method-example8.py”, line 22, in
+circuit.E(1, 4, 3, 2, 3, 3)
+File “C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\PySpice\Spice\Netlist.py”, line 930, in getattr
+raise AttributeError(attribute_name)
+AttributeError: E
+
I am not sure where I am going wrong. I have been able to simulate a CCVS (part name H) but all other dependent sources seem to give an error.
+
Can anyone please point out what is wrong in the code above?
for node in analysis.nodes.values():
+print(‘Node {}: {:4.1f} V’.format(str(node), float(node)))
+
I see an error message:
+Traceback (most recent call last):
+File “C:\PySpice\ICs\programtest.py”, line 24, in
+simulator = circuit.simulator(temperature=25, nominal_temperature=25)
Hi folks, this seems to be the first post over this forum, hopefully it’s not too soon to start asking questions?
+
I’m extending a bit one of the SKiDL simulation tutorials, as presented in this Jupyter notebook with a simple resistor (among other more complex examples):
+
+
+
My intention is to extend the single resistor example with a netlist of several resistors in parallel (a 19x19 matrix), something like this:
+
#!/usr/bin/env python
+
+from skidl.pyspice import R, V, gnd, u_V
+from skidl.pyspice import u_Ohm, u_kOhm
+from skidl.pyspice import generate_netlist, reset, lib_search_paths, node
+
+reset() # This will clear any previously defined circuitry.
+
+# Voltage Source
+vs = V(ref="VS", dc_value = 1 @ u_V)
+
+rnet = []
+
+# Create several resistors.
+rnet = 19*19*R(value = 1.7 @ u_kOhm)
+
+# Connect the nets and resistors.
+vs['p'] += [rnet[n][1] for n in range(0, 19*19)]
+gnd += [rnet[n][2] for n in range(0, 19*19)]
+gnd += vs['n']
+
+# Simulate the circuit.
+circ = generate_netlist() # Translate the SKiDL code into a PyCircuit Circuit object.
+sim = circ.simulator() # Create a simulator for the Circuit object.
+dc_vals = sim.dc(VS=slice(1, 24, 1)) # Run a DC simulation where the voltage ramps from 1 to 12V by 1V increments.
+
+# Get the voltage applied to the resistor and the current coming out of the voltage source.
+voltage = dc_vals[node(vs['p'])]
+current = -dc_vals['VS']
+
+# Print a table showing the current through the resistor for the various applied voltages.
+print('{:^7s}{:^7s}{:^7s}'.format('V', ' I (A)', "P (W)"))
+print('='*25)
+for v, i, p in zip(voltage.as_ndarray(), current.as_ndarray(), voltage.as_ndarray()*current.as_ndarray()):
+ print('{:6.2f} {:6.2f} {:6.2f}'.format(v, i, p))
+
+
Unfortunately the output looks something like this:
+
$ ./skidl_sim.py
+
+No errors or warnings found during netlist generation.
+
+warning, can't find model at
+Warning: r1: resistance to low, set to 1 mOhm
+Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Note: Starting dynamic gmin stepping
+Trying gmin = 1.0000E-03 Note: One successful gmin step
+Trying gmin = 1.0000E-04 Note: One successful gmin step
+Trying gmin = 1.0000E-05 Note: One successful gmin step
+Trying gmin = 1.0000E-06 Note: One successful gmin step
+Trying gmin = 1.0000E-07 Note: One successful gmin step
+Trying gmin = 1.0000E-08 Note: One successful gmin step
+Trying gmin = 1.0000E-09 Note: One successful gmin step
+Trying gmin = 1.0000E-10 Note: One successful gmin step
+Trying gmin = 1.0000E-11 Note: One successful gmin step
+Trying gmin = 1.0000E-12 Note: One successful gmin step
+Trying gmin = 1.0000E-12 Note: One successful gmin step
+Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Warning: Dynamic gmin stepping failed
+Note: Starting source stepping
+Supplies reduced to 0.0000% Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Trying gmin = 1.0000E-02 Note: One successful gmin step
+Trying gmin = 1.0000E-03 Note: One successful gmin step
+Trying gmin = 1.0000E-04 Note: One successful gmin step
+Trying gmin = 1.0000E-05 Note: One successful gmin step
+Trying gmin = 1.0000E-06 Note: One successful gmin step
+Trying gmin = 1.0000E-07 Note: One successful gmin step
+Trying gmin = 1.0000E-08 Note: One successful gmin step
+Trying gmin = 1.0000E-09 Note: One successful gmin step
+Trying gmin = 1.0000E-10 Note: One successful gmin step
+Trying gmin = 1.0000E-11 Note: One successful gmin step
+Trying gmin = 1.0000E-12 Note: One successful gmin step
+Note: One successful source step
+Supplies reduced to 0.1000% Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Supplies reduced to 0.0000% Warning: singular matrix: check nodes <skidl.part.pinnumbersearch and <skidl.part.pinnumbersearch
+Warning: source stepping failed
+doAnalyses: iteration limit reached
+run simulation(s) aborted
+ V I (A) P (W)
+=========================
+
+
Can anybody let me know what’s going on? Which syntax should I be using to define that resistor “network” so that ngspice accepts it as well-defined?
I edited your code. You only had a single, tiny mistake: you created an actual resistor that was added to the netlist, and then you created an additional 19*19=361 resistors from that one. This gave you a total of 362 resistors, but you only connected 361 of them. That dangling resistor seems to cause the problem.
+
By making the first resistor a TEMPLATE, then it isn’t actually added to the netlist but it can serve as a template for making other resistors. Once I did that, everything worked as expected.
+
#!/usr/bin/env python
+
+from skidl import TEMPLATE
+from skidl.pyspice import R, V, gnd, u_V
+from skidl.pyspice import u_Ohm, u_kOhm
+from skidl.pyspice import generate_netlist, reset, lib_search_paths, node
+
+reset() # This will clear any previously defined circuitry.
+
+# Voltage Source
+vs = V(ref="VS", dc_value = 1 @ u_V)
+
+rnet = []
+
+# Create several resistors.
+# I changed it so the resistor was a template that is then replicated to create the actual resistors.
+rnet = 19*19*R(value = 1.7 @ u_kOhm, dest=TEMPLATE)
+
+# Connect the nets and resistors.
+vs['p'] += [rnet[n][1] for n in range(0, 19*19)]
+gnd += [rnet[n][2] for n in range(0, 19*19)]
+gnd += vs['n']
+
+# Simulate the circuit.
+circ = generate_netlist() # Translate the SKiDL code into a PyCircuit Circuit object.
+sim = circ.simulator() # Create a simulator for the Circuit object.
+dc_vals = sim.dc(VS=slice(1, 24, 1)) # Run a DC simulation where the voltage ramps from 1 to 12V by 1V increments.
+
+# Get the voltage applied to the resistor and the current coming out of the voltage source.
+voltage = dc_vals[node(vs['p'])]
+current = -dc_vals['VS']
+
+# Print a table showing the current through the resistor for the various applied voltages.
+print('{:^7s}{:^7s}{:^7s}'.format('V', ' I (A)', "P (W)"))
+print('='*25)
+for v, i, p in zip(voltage.as_ndarray(), current.as_ndarray(), voltage.as_ndarray()*current.as_ndarray()):
+ print('{:6.2f} {:6.2f} {:6.2f}'.format(v, i, p))
+
I’m very new to PySpice, but I want to learn it. The problem is that starting is complicated and I have not found any tutorials. Do you have any recommendations on how to get started with PySpice?
I would like to use a spice circuit model (a sub-circuit in a .MOD file) in a circuit created from a spice netlist (a .net file) inside PySpice. Following is a simplistic example that shows the problem with a simple RC sub-circuit. I can’t figure out why the sub-circuit is not found although it is explicitly included with the circuit.include call as in the documentation examples…
.title RC Circuit
+.include /Users/{my home directory}/simulations/pyspice_models/RC.MOD
+V1 VIN 0 AC
+X1 VIN 0 VOUT RC
+
+
The directory of the .include line is an absolute path computed by pyspice from the local directory specified in SpiceLibrary. Is it then possible that the fact that there are spaces inside the {my home directory} directory name, makes ngspice not able to find the RC.MOD file ?
+It seams strange to me that nothing is complaining about not finding the RC.MOD file…
2.6
+.INCLUDE
+General form:
+.INCLUDE filename
+Examples:
+.INCLUDE /users/spice/common/bsim3-param.mod
+Frequently, portions of circuit descriptions will be reused in several input files, particularly with
+common models and subcircuits. In any ngspice input file, the .INCLUDE line may be used to
+copy some other file as if that second file appeared in place of the .INCLUDE line in the original
+file.
+There is no restriction on the file name imposed by ngspice beyond those imposed by the local
+operating system.
I have the same issue with error. I have imported a library using circuit.include("foo.lib"). The import works fine, I think I connect the pins correctly, but it never works.
+Model I am importing is found here: https://www.ti.com/lit/zip/sbom310
I am new to Pyspice and I am moving our LTSpice simulations to PySpice. In that simulation we have some transfer functions defined as voltage sources with a transfer function like this:
~/anaconda3/envs/Circuits/lib/python3.6/site-packages/cffi/api.py in _load_backend_lib(backend, name, flags)
+825 if first_error is not None:
+826 msg = “%s. Additionally, %s” % (first_error, msg)
+–> 827 raise OSError(msg)
+828 return backend.load_library(path, flags)
+829
+
OSError: cannot load library ‘libngspice.dylib’: dlopen(libngspice.dylib, 2): image not found. Additionally, ctypes.util.find_library() did not manage to locate a library called ‘libngspice.dylib’
To better understand PySpice, I’m working through a very simple circuit involving a voltage source, a resistor, and a 1N4148 Diode. However, I am having trouble with Python recognizing the library I need to bring in the characteristics of the diode. Here is my code:
+
'import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.ticker as ticker
+
import PySpice.Logging.Logging as Logging
+logger = Logging.setup_logging()
Hi friends, why I have use pySpice instead of use direct spice program? Whats advantages of using pyspice? I must a homework like electronic circuits with pyspice but I didn’t find a topic. Can you help me find a topic. How can I do with pyspice?
Pyspice opens up the power of python for theoretical calculations, side by side with simulations. You cannot do this in any other simulator. See the videos in this playlist here which illustrate the flexibility and advantage of using Pyspice, compared to LTSPICE, PSPICE: Introduction to PySpice (Python) for DC Circuit Analysis with Dependent Sources - YouTube
Good afternoon!
+I’m trying to model a simple electrical circuit with XSPICE elements. For example, the electrical circuit from Chapter 27.1 (Ngspice user manual):
+
from PySpice.Spice.Netlist import Circuit
+
+test = """XSPICE
+Vin1 1 0 DC 0V AC 1.0 SIN(0V 1V 1000Hz)
+Ccouple 1 in 0.000001
+Rzin in 0 19.35k
+Aamp in aout gain_block
+.model gain_block gain (gain=-3.9 out_offset=7.003)
+Rzout aout coll 3.9k
+Rbig coll 0 1e12
+.control
+run
+display
+tran 0.00001 0.003
+plot i(Vin1)
+.endc
+.end
+"""
+circuit = Circuit(test)
+
+simulator = circuit.simulator(temperature=27, nominal_temperature=27)
+analysis = simulator.transient(step_time=0.00001, end_time=0.003)
+
+
When I try to run it I get an error:
+
File ".../.local/lib/python3.7/site-packages/PySpice/Spice/RawFile.py", line 223, in _read_header_line
+ raise NameError("Unexpected line: %s" % (line))
+NameError: Unexpected line: Reducing trtol to 1 for xspice 'A' devices
+
+
So there are two questions:
+
+
If I understand correctly, the error is caused by the ngspice message “Reducing trtol to 1 for xspice ‘A’ devices”. Is it possible to avoid this error? When adding a line “option trtol=1” after the line “.control” I get the following error:
+NameError: Expected label Title instead of No. of Data Rows
+
+
Is it possible to set the value of trtol and other Simulator Variables by using any pyspice command?
+
+
I am using Spyder 4, PySpice 1.4.3 and ngspice-30 (DEFAULT_SIMULATOR = ‘ngspice-subprocess’) in the Debian linux operating system.
Thanks for answering.
+I understood the reason for my mistake.
+When using raw SPICE commands, I excluded extra lines “.control … .endc” and left the line “.option trtol=1”.
+When using an element description of an electrical circuit, I used the following line to set the value of the trtol variable to 1:
+circuit.raw_spice = '.option trtol=1'
I always see a problem like this:
+Traceback (most recent call last):
+File “C:\PySpice\ICs\simulation.py”, line 23, in
+simulator = circuit.simulator(temperature=27, nominal_temperature=27)
+
My program execution shows a problem at “simulator = circuit.simulator(temperature=27, nominal_temperature=27)”. Any suggestions?
These terms govern use of the Internet forum at http://pyspice.discourse.group. To use the forum, you must agree to these terms with PySpice, the company that runs the forum.
+
The company may offer other products and services, under different terms. These terms apply only to use of the forum.
These terms include a number of important provisions that affect your rights and responsibilities, such as the disclaimers in Disclaimers, limits on the company’s liability to you in Limits on Liability, your agreement to cover the company for damages caused by your misuse of the forum in Responsibility for Your Use, and an agreement to arbitrate disputes in Disputes.
You may not use or try to use another’s account on the forum without their specific permission.
+
+
+
You may not buy, sell, or otherwise trade in user names or other unique identifiers on the forum.
+
+
+
You may not send advertisements, chain letters, or other solicitations through the forum, or use the forum to gather addresses or other personal data for commercial mailing lists or databases.
+
+
+
You may not automate access to the forum, or monitor the forum, such as with a web crawler, browser plug-in or add-on, or other computer program that is not a web browser. You may crawl the forum to index it for a publicly available search engine, if you run one.
+
+
+
You may not use the forum to send e-mail to distribution lists, newsgroups, or group mail aliases.
+
+
+
You may not falsely imply that you’re affiliated with or endorsed by the company.
+
+
+
You may not hyperlink to images or other non-hypertext content on the forum on other webpages.
+
+
+
You may not remove any marks showing proprietary ownership from materials you download from the forum.
+
+
+
You may not show any part of the forum on other websites with <iframe>.
+
+
+
You may not disable, avoid, or circumvent any security or access restrictions of the forum.
+
+
+
You may not strain infrastructure of the forum with an unreasonable volume of requests, or requests designed to impose an unreasonable load on information systems underlying the forum.
+
+
+
You may not impersonate others through the forum.
+
+
+
You may not encourage or help anyone in violation of these terms.
You may not submit content to the forum that is illegal, offensive, or otherwise harmful to others. This includes content that is harassing, inappropriate, or abusive.
+
+
+
You may not submit content to the forum that violates the law, infringes anyone’s intellectual property rights, violates anyone’s privacy, or breaches agreements you have with others.
+
+
+
You may not submit content to the forum containing malicious computer code, such as computer viruses or spyware.
+
+
+
You may not submit content to the forum as a mere placeholder, to hold a particular address, user name, or other unique identifier.
+
+
+
You may not use the forum to disclose information that you don’t have the right to disclose, like others’ confidential or personal information.
The company may investigate and prosecute violations of these terms to the fullest legal extent. The company may notify and cooperate with law enforcement authorities in prosecuting violations of the law and these terms.
+
The company reserves the right to change, redact, and delete content on the forum for any reason. If you believe someone has submitted content to the forum in violation of these terms, contact us immediately.
You must create and log into an account to use some features of the forum.
+
To create an account, you must provide some information about yourself. If you create an account, you agree to provide, at a minimum, a valid e-mail address, and to keep that address up-to-date. You may close your account at any time by e-mailing pyspice@fabrice-salvaire.fr.
+
You agree to be responsible for all action taken using your account, whether authorized by you or not, until you either close your account or notify the company that your account has been compromised. You agree to notify the company immediately if you suspect your account has been compromised. You agree to select a secure password for your account, and keep it secret.
+
The company may restrict, suspend, or close your account on the forum according to its policy for handling copyright-related takedown requests, or if the company reasonably believes that you’ve broken any rule in these terms.
Nothing in these terms gives the company any ownership rights in intellectual property that you share with the forum, such as your account information, posts, or other content you submit to the forum. Nothing in these terms gives you any ownership rights in the company’s intellectual property, either.
+
Between you and the company, you remain solely responsible for content you submit to the forum. You agree not to wrongly imply that content you submit to the forum is sponsored or approved by the company. These terms do not obligate the company to store, maintain, or provide copies of content you submit, and to change it, according to these terms.
+
Content you submit to the forum belongs to you, and you decide what permission to give others for it. But at a minimum, you license the company to provide content that you submit to the forum to other users of the forum. That special license allows the company to copy, publish, and analyze content you submit to the forum.
+
When content you submit is removed from the forum, whether by you or by the company, the company’s special license ends when the last copy disappears from the company’s backups, caches, and other systems. Other licenses you apply to content you submit, such as Creative Commons licenses, may continue after your content is removed. Those licenses may give others, or the company itself, the right to share your content through the forum again.
+
Others who receive content you submit to the forum may violate the terms on which you license your content. You agree that the company will not be liable to you for those violations or their consequences.
You agree to indemnify the company from legal claims by others related to your breach of these terms, or breach of these terms by others using your account on the forum. Both you and the company agree to notify the other side of any legal claims for which you might have to indemnify the company as soon as possible. If the company fails to notify you of a legal claim promptly, you won’t have to indemnify the company for damages that you could have defended against or mitigated with prompt notice. You agree to allow the company to control investigation, defense, and settlement of legal claims for which you would have to indemnify the company, and to cooperate with those efforts. The company agrees not to agree to any settlement that admits fault for you or imposes obligations on you without your prior agreement.
You accept all risk of using the forum and content on the forum. As far as the law allows, the company and its suppliers provide the forum as is, without any warranty whatsoever.
+
The forum may hyperlink to and integrate forums and services run by others. The company does not make any warranty about services run by others, or content they may provide. Use of services run by others may be governed by other terms between you and the one running service.
Neither the company nor its suppliers will be liable to you for breach-of-contract damages their personnel could not have reasonably foreseen when you agreed to these terms.
+
As far as the law allows, the total liability to you for claims of any kind that are related to the forum or content on the forum will be limited to $50.
The company welcomes your feedback and suggestions for the forum. See the Contact section below for ways to get in touch with us.
+
You agree that the company will be free to act on feedback and suggestions you provide, and that the company won’t have to notify you that your feedback was used, get your permission to use it, or pay you. You agree not to submit feedback or suggestions that you believe might be confidential or proprietary, to you or others.
Either you or the company may end the agreement written out in these terms at any time. When our agreement ends, your permission to use the forum also ends.
French will govern any dispute related to these terms or your use of the forum.
+
You and the company agree to seek injunctions related to these terms only in state or federal court in Paris. Neither you nor the company will object to jurisdiction, forum, or venue in those courts.
+
Other than to seek an injunction or for claims under the Computer Fraud and Abuse Act, you and the company will resolve any dispute by binding American Arbitration Association arbitration. Arbitration will follow the AAA’s Commercial Arbitration Rules and Supplementary Procedures for Consumer Related Disputes. Arbitration will happen in Paris. You will settle any dispute as an individual, and not as part of a class action or other representative proceeding, whether as the plaintiff or a class member. No arbitrator will consolidate any dispute with any other arbitration without the company’s permission.
+
Any arbitration award will include costs of the arbitration, reasonable attorneys’ fees, and reasonable costs for witnesses. You and the company may enter arbitration awards in any court with jurisdiction.
If a provision of these terms is unenforceable as written, but could be changed to make it enforceable, that provision should be modified to the minimum extent necessary to make it enforceable. Otherwise, that provision should be removed.
+
You may not assign your agreement with the company. The company may assign your agreement to any affiliate of the company, any other company that obtains control of the company, or any other company that buys assets of the company related to the forum. Any attempted assignment against these terms has no legal effect.
+
Neither the exercise of any right under this Agreement, nor waiver of any breach of this Agreement, waives any other breach of this Agreement.
+
These terms embody all the terms of agreement between you and the company about use of the forum. These terms entirely replace any other agreements about your use of the forum, written or not.
You may notify the company under these terms, and send questions to the company, at pyspice@fabrice-salvaire.fr.
+
The company may notify you under these terms using the e-mail address you provide for your account on the forum, or by posting a message to the homepage of the forum or your account page.
The company last updated these terms on July 12, 2018, and may update these terms again. The company will post all updates to the forum. For updates that contain substantial changes, the company agrees to e-mail you, if you’ve created an account and provided a valid e-mail address. The company may also announce updates with special messages or alerts on the forum.
+
Once you get notice of an update to these terms, you must agree to the new terms in order to keep using the forum.