Skip to main content

A python package for symbolic electronic circuit analysis

Project description

SymCirc

pypi version Downloads Downloads Powered by SymPy

A lightweight python library for symbolic circuit analysis.

Documentation

Documentation is available on GitHub Pages.

What can it do?

SymCirc currently offers symbolic and semisymbolic DC, AC and transient small frequency circuit analysis. It supports the following ideal circuit elements: resistors, inductors, capacitors, independent sources, controlled sources, ideal operational amplifiers and coupled inductors. Transient simulation allows for initial conditions of capacitors and standard/coupled inductors.

Install

SymCirc runs on SymPy, which should get automatically installed with SymCirc. Use this command to install via pip

pip install symcirc

Build

Or you can build with this command:

python setup.py sdist bdist_wheel

Simulation example

from symcirc import *

# Insert your netlist
netlist = """
CIRCUIT NAME - First line is always the circuit name
# This is a comment
R1 1 0 2k
R2 3 0 (1/G)
V1 2 1 dc 1 ac 1
R3 3 4 6k
C1 3 4 1n
R4 4 0 10k
V2 4 0 dc 5
I1 3 2 dc 1m ac 0
"""

# Execute netlist simulation
analysis_type = "DC"  # or "AC", "TF", "tran"
method = "tableau"  # Default is "two_graph_node", which is faster, but currently lacks coupled inductors.
symbolic = True  # If set to False, only elements which have no numeric value are left as symbolic. In this case only R2 stays symbolic.

circuit = AnalyseCircuit(netlist, analysis_type, symbolic=True, method=method)

all_values = circuit.component_values("all")
latex_formatted_values = to_latex(all_values)

print(all_values)

Netlist syntax

There are many example netlists available in the netlists folder. This folder contains a database of netlists which are used to automatically test every new version of SymCirc.

Elements

  • Resistor: RXXX N+ N- RESISTANCE
  • Capacitor: CXXX N+ N- CAPACITY IC=<INIT_VOLTAGE>
  • Inductor: LXXX N+ N- INDUCTANCE IC=<INIT_CURRENT>
  • Coupling: KXXX LYYY LZZZ K
  • Voltage source: VXXX N+ N- dc VOLTAGE ac AMPLITUDE
  • Current source: IXXX N+ N- dc CURRENT ac AMPLITUDE
  • IOAMP: AXXX Nout1 Nout2 Nin+ Nin-
  • VCVS: EXXX N1 N2 Ncontrol+ Ncontrol- GAIN
  • CCCS: FXXX N1 N2 VSENSE GAIN
  • VCCS: GXXX N1 N2 Ncontrol+ Ncontrol- GAIN
  • CCVS: HXXX N1 N2 VSENSE GAIN

Units

  • terra: T
  • giga: G
  • mega: meg
  • kilo: k
  • mili: m
  • micro: u
  • nano: n
  • pico: p
  • femto: f

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

symcirc-0.0.15.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

symcirc-0.0.15-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file symcirc-0.0.15.tar.gz.

File metadata

  • Download URL: symcirc-0.0.15.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for symcirc-0.0.15.tar.gz
Algorithm Hash digest
SHA256 66856866e78e63d8166b202197aca63d14367296bdc26f7c2638b75c9fdbd09a
MD5 0793b3746b71263319d1c28f9d16526e
BLAKE2b-256 92e063ded182ac012c7507a8ac24fa4d45323d030445aaad3df8ee6305298a92

See more details on using hashes here.

File details

Details for the file symcirc-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: symcirc-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for symcirc-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 074c4d6cfccfa2e71be332628df8a202b1a50223ff445a9bc0c40d747c079523
MD5 39eb76199212eb1062a6c8eb2da64839
BLAKE2b-256 95fc78850bf5e1af76dfd0b8d4aed1539a476de4dcc64cbb2c66bcbe20ad5ee5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page