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!

OpenSPICE may well be a good starting point for learning about circuit simulations, without the steep learning curve of some simulation platforms and all the worry about installing and maintaining prerequisites. Why not give it a whirl?

We cover the important task of circuit simulation a fair bit, here’s an example of using LTSpice to simulate guitar peddles. Need to simulate huge systems and have an equally huge compute cluster to hand? You need Xyce. Finally, let’s not forget to mention that the excellent (commercial) MicroCap simulator was released for free, after the retirement of the maintainer. What a gift!

Header: Harland Quarrington/MOD, OGL v1.0.



OpenSPICE: A Portable Python Circuit Simulator
Source: Manila Flash Report

Post a Comment

0 Comments