OpenSPICE: A Portable Python Circuit Simulator

[Roman Parise] and [Georgios Is. Detorakis] have created OpenSPICE a fork of the PySpice project, adding a new simulation engine written entirely in Python. This enables the same PySpice simulations to be executed on any platform that runs python (which we reckon is quite a few!) whilst leveraging the full power of the python infrastructure. Since it is a fork — for supported platforms — you can also run your simulations upon Ngspice as well as Xyce, giving options for scaling up to larger systems when required, but importantly without having to recreate your circuit from scratch.

The OpenSPICE simulator first converts the parsed netlist into a set of data structures that represent the equations describing the various parts of the system. These are then in turn passed along the scipy library “optimize.root” function which solves the system, generating a list of branch currents and node voltages. The output of the simulation is a numpy array, which can be further processed and visualized with the mathplotlib library. All pretty standard stuff in python circles. Since this is based upon PySpice, it’s also possible to use KiCAD netlists, so you have a nice way to enter those schematics. We’ve not dug into this much yet, but support for the vast libraries of spice models out there in circulation would be high up on our wish list if it already can’t handle this. This scribe will most definitely be checking this out, as LTSpice whilst good, is a bit of a pain to use and does lack the power of a Python backend!

Continue reading “OpenSPICE: A Portable Python Circuit Simulator”

What Rhymes With Spice And Simulates Huge Circuits?

Most of us have computers on our desk that would have been considered supercomputers not long ago. We always wonder how many of them get any actual workout other than decoding video. If you want to simulate circuits you may very well start chewing up significant CPU time, so you might consider Xyce, an open source high-performance analog circuit simulator from Sandia National Labs. As you’d expect from a giant government lab it is able to support large scale parallel computing, but will also work on common desktop systems. On Linux, it will do what they call “small-scale parallelism.” In addition, it can deal with simulations of things as diverse as neural networks and power grids.

The code is open source, but oddly you do have to register to download it. Xyce has been around for a bit, but version 7.0 just arrived in April. Many of the changes are to improve compatibility with other Spice programs, notably HSpice.

Continue reading “What Rhymes With Spice And Simulates Huge Circuits?”