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:
Credits:
- NetworkX is used for graph analysis
- The
focusandseekmethods are based on the implementation proposed by Christopher Smith @smichr in a sympy issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b383d57dd878b0b32c7ef3052b410d7c6cb55921f9ca06bca94c7392a96bc44
|
|
| MD5 |
d938a760b099b2b25f877f0d576343a6
|
|
| BLAKE2b-256 |
86bde5af138a6e168b9e20e96c8df15b398f53b839554babbfe015582d1dcf0b
|