Simulating simple electric circuits

Stef Mientki S.Mientki-nospam at mailbox.kun.nl
Mon May 7 17:01:20 EDT 2007


hi Bjoern,

Bjoern Schliessmann wrote:
> Hello all,
> 
> I'm trying to simulate simple electric logic (asynchronous)
> circuits. By "simple" I mean that I only want to know if I
> have "current" or "no current" (it's quite digital) and the only
> elements need to be (with some level of abstraction to my specific
> problem)
> 
> - sources (here begin currents)
> - ground (here end currents)
that doesn't bring you anywhere ;-)
Current doesn't start or end at some location,
current flows through a closed circuit.

And that's the first law you need: Kirchoff's current law:
the total current in every node is ZERO !!

The second formula you need: Kirchoff's voltage law,
the sum of all voltages following any closed loop is ZERO.

That's all you need,
it gives you a set of linear equations,
enough to let them solve by SciPy / NumPy.

And let's forget about capacitors, inductors and semi-conductors for this moment !

Here is a simulation package, although designed for MatLab,
it might give you a good idea of what your need.
   http://www.swarthmore.edu/NatSci/echeeve1/Ref/mna/MNA6.html


There are few simulation related packages,
but not directly suited for electronics
http://www.mcs.vuw.ac.nz/cgi-bin/wiki/SimPy
http://www.linuxjournal.com/article/7542
http://pyastra.sourceforge.net/
http://www.nelsim.com/scriptsim/python_man.html

As an little test I wrote a PIC simulator (only core) in Python,
it's very rough code (generated in a few evenings),
if you're interested I could look it up.

cheers,
Stef Mientki




More information about the Python-list mailing list