Skip to main content

SymCircuit

Provides classes to do electronic circuit analysys using symbolic equations. For example, it is possible to automatically find equations using Kirchhoff's laws and solve them for specific properties.

As a bonus, the equation solving part can be used independently of the rest.

Installation

Minimal install using pip (just the equation solver):

pip install SymCircuit

Full install using pip:

pip install SymCircuit[EE]

Usage

For more detailed examples, see the files in directory examples/.

Example of using a netlist for a random arrangement of elements:

from io import StringIO

import plotkit.plotkit as pk

from symcircuit.bode import plot_system
from symcircuit.spice import Circuit
from symcircuit.system import SymbolicSystem

circ = Circuit()
circ.parse_spice_netlist(StringIO(r"""
* examples\network1.asc
R1 N001 0 1k
R2 N002 0 3k
C1 N002 0 50µ
L1 N001 N002 120µ
V1 N001 0 AC 1
.ac dec 30 10 10000
.backanno
.end
"""))

# translate to equation system
s = SymbolicSystem(circ.to_system_description())

# Add "measurement" characteristics
s.extend(SymbolicSystem("""
Zsys == V1 / i_V1
"""))
print(s.info())

# find transfer function
impedance = s.focus("Zsys")["Zsys"]
print("System Impedance = ", impedance)
# System Impedance =  -R1*(C1*L1*R2*s**2 + L1*s + R2)/(C1*L1*R2*s**2 + L1*s + R1*(C1*R2*s + 1) + R2)

# plot parameterised transfer function
v = dict(
    R1=1e3,
    R2=3e3,
    C1=50e-6,
    L1=120e-6,
)
fig = plot_system(impedance, 10, 50000, values=v, amplitude_linear=True, return_fig=True)
pk.finalize(fig)

Result: Example Output

Credits:

  • NetworkX is used for graph analysis
  • The focus and seek methods are based on the implementation proposed by Christopher Smith @smichr in a sympy issue.

Metadata

Release files for SymCircuit 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for SymCircuit 0.3.0
File Interpreter ABI Platform
symcircuit-0.3.0-py3-none-any.whl Python 3 none any Details

Release files / symcircuit-0.3.0-py3-none-any.whl

Download URL symcircuit-0.3.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b383d57dd878b0b32c7ef3052b410d7c6cb55921f9ca06bca94c7392a96bc44
BLAKE2b-256 checksum
How to use checksums
86bde5af138a6e168b9e20e96c8df15b398f53b839554babbfe015582d1dcf0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.0

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page