Cardoon is an electronic circuit simulator library/program written in Python. The initial design was inspired from several ideas in fREEDA (http://www.freeda.org/) and carrot (http://vision.lakeheadu.ca/research.html), plus some improvements that take advantage of the flexibility in Python.

One of the main goals of this project is to obtain a library to experiment new simulation algorithms/models in interactive mode or in other python applications. The possibilities for expansion are endless. Sample session (using ipyhton):

In [1]: import cardoon.simulator as cs

In [2]: cs.run_netlist('bias_npn.net')
             Operating point analysis

 # Test of a transistor device

Using dense matrices

Number of iterations =  17
Residual =  5.72923228467e-06

 Node      |  Value               | Unit
1          |        3.49950994522 | V
10         |        11.9158367321 | V

Following good software engineering practices, the program and the documentation are being developed at the same time. Thus all implemented features are documented. Complete documentation for this project is included with the source and can also be found at:

A secondary objective is to add features and make the program efficient enough to be useful for general use, if possible. The program has already enough functionality to be useful for some tasks. Currently basic DC/AC/Transient analyses have been implemented. DC and Transient can use sparse or dense matrices. It can currently simulate circuits with a few thousand nodes in reasonable times. As of June 2012, Cardoon is probably the fastest available Python-based circuit simulator. The program takes approximately 1.7 times the ngspice time to run a transient analysis of the soliton line circuit (3022 nodes), which is quite good considering it is running on an interpreter.

The device library includes basic components and several non-trivial nonlinear models such as Gummel-Poon model for BJTs, EKV 2.6 and BSIM3v3 for MOSFETs (there is also a memristor model). Most of the device models interface should be reasonably stable by now, but some changes may happen for frequency-defined devices as they become better supported by the analyses. The noise interface is not being used yet and may change significantly.

It is likely easier to implement a new device model in Cardoon than it is on most other simulators. Perhaps the main reason for this is due to the Python language: the code tends to be more compact and it is easier to debug and test modifications. As with other simulators, nonlinear models can use automatic differentiation for Jacobian calculation, thus there is no need to write code for the derivatives. In cardoon, the automatic differentiation library is also used to speed up the evaluation of nonlinear equations. Due to the dynamic nature of the Python language automatic differentiation could also be used to calculate sensitivities without any modification in the device model code. Another design feature is that electro-thermal models (i.e., with an additional thermal port) can be automatically generated from temperature-dependent electrical models.

Cardoon is being developed on Debian GNU/Linux, but it is known to work on MS Windows (using WinPython) and should also work on other operating systems / distributions.

Comments are welcome!

Carlos Christoffersen <c.christoffersen@ieee.org>


Cardoon is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 or later:

(See also LICENSE file included with the source)


Version 0.6.0

  • Converted into Python library. Now the simulator can be used from a Python session (as well as an application)
  • Added sensitivity functions using automatic differentiation (only DC for now)
  • Changed operating point interface get_OP()

Version 0.5.0

  • Added instructions to install on MS Windows
  • Added Memductor
  • Improved graph labels for internal terminals
  • Ground node (gnd) made global. Can not be included in subcircuit connection list anymore
  • Added extrinsic MOSFET model (as an add-on to intrinsic models)
  • Added BSIM3v3 model
  • Plots no longer block program execution
  • Added support for time delays in nonlinear device models (also included in updated documentation)
  • Added a memristor model, gyrator device and option for user-defined nonlinear VCCSs
  • Added Curtice cubic MESFET model
  • Default integration method in transient analysis is now trap

Version 0.4.2

  • Added automatic test suite
  • Added -x command line option
  • New, faster sparse-matrix-based nodal implementation using Scipy library (pysparse no longer needed)
  • Faster (sparse-matrix-based) transient analysis: saves one iteration per time step compared with previous implementation
  • Other minor improvements

Version 0.4.1

  • Much better homotopy routines
  • Internal terminal variables can now be plotted from the netlist
  • Improved documentation (Options and Constant tables, Device categories)

Version 0.4.0

  • Added sparse matrix support for OP, DC and Tran analyses.
  • Added NEWS file and examples directory
  • Other general improvements

Table Of Contents

Previous topic

Cardoon Electronic Circuit Simulator

Next topic


This Page