Skip to content

vovkd/ahkab

 
 

Repository files navigation

ahkab

a SPICE-like electronic circuit simulator written in Python

The code should be easy to read and modify, the main language is Python 2.x and it is platform-independent.

News!

  • The project moved to GitHub.
  • ahkab can now be run stand-alone with a netlist file or within Python scripts as a library. This will likely become the preferred way in the future.

See this butterworth filter simulation for an example/tentative tutorial.

Supported simulations:

  • Numeric:
    • Operating point, with guess computation to speed up the solution. See example: Downscaling current mirror
    • DC sweep
    • Transient analysis, available differentiation formulas: implicit Euler, trapezoidal, gear orders from 2 to 5. See for example the [simulation of a Colpitts Oscillator.
    • AC analysis
    • Periodic steady state analysis of non-autonomous circuits, time domain shooting and brute-force algorithms.
  • Symbolic:

The results are saved to disk, plotted or printed to stdout and can be read/processed by the most common tools (eg. Octave, gnuplot, Matlab, gwave and others)

###Download and install###

There are no packages for the time being (this program is at an early development stage). Go to ahkab on github and follow the instructions to check out the code. You can find the list of the dependencies in the Install notes.

###Run standalone###

$ python ahkab -o graph.dat <netlist file>`

See ahkab --help for command line switches.

###Documentation###

The simulator can either be run from the command line with a netlist file or included in a python script. Both possibilities will be maintained for the foreseeable future.

Refer to the netlist syntax page for how to write the netlist files that describe the circuit. Experience with running SPICE or other commercial simulators can be useful.

The latter option is shown briefly in the Simulating the Python way wiki page. The code comes with docstrings associated with most functions, type help(ahkab.function_name).

Contributors

Giuseppe Venturini (@ggventurini on GH) Ian Daniher (@itdaniher, also on GH)

Bugs and patches

Note that I often add new functionality at the expense of breaking stuff. Most likely I will introduce a new feature even if that means breaking a couple of others. It should get fixed soon, but if you have a bit of time to spare, you can send me a pull request or a patch. :)

Does it work? Bugs? Do you have patches? Did you run some noteworthy simulation? Let me know! Feedback is very welcome, my email address is available after a captcha.

About

a SPICE-like electronic circuit simulator written in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published