Skip to main content

Symbolic electronic circuit analysis

Project description

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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

symcircuit-0.3.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file symcircuit-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: symcircuit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for symcircuit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b383d57dd878b0b32c7ef3052b410d7c6cb55921f9ca06bca94c7392a96bc44
MD5 d938a760b099b2b25f877f0d576343a6
BLAKE2b-256 86bde5af138a6e168b9e20e96c8df15b398f53b839554babbfe015582d1dcf0b

See more details on using hashes here.

Supported by

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