Skip to main content

Library for analysing and calculating electric networks.

Project description

CircuitCalculator

CircuitCalculator is a Python library for symbolic and numeric analysis of electrical circuits. It supports DC and AC analysis, nodal analysis, state-space modeling, and works with both numeric and symbolic component values. The library is designed for engineers, students, and researchers who want to analyze, simulate, or teach circuit theory using Python.

Features

  • Symbolic and numeric circuit analysis
  • Support for resistors, capacitors, inductors, voltage sources, and current sources
  • Nodal analysis and state-space modeling
  • Easy-to-use API for building and solving circuits
  • Integration with Jupyter/IPython notebooks for interactive exploration

Installation

You can install CircuitCalculator and its dependencies using pip (e.g. in a virtual environment):

python -m venv ./venv
source ./venv/bin activate
pip install CircuitCalculator

Usage

The most convenient interface is the Circuit class, which allows you to define a circuit as a list of components and then solve it. Below is a minimal example for DC analysis:

Example

from CircuitCalculator.Circuit.circuit import Circuit
import CircuitCalculator.Circuit.Components.components as ccp
from CircuitCalculator.Circuit.solution import DCSolution

# Define the circuit
circuit = Circuit([
    ccp.dc_voltage_source(V=1, id='Vs', nodes=('1', '0')),
    ccp.resistor(R=1, id='R', nodes=('1', '0'))
])

# Solve the circuit
solution = DCSolution(circuit)
print(f'I(R)={solution.get_current("R"):2.2f}A')
print(f'V(R)={solution.get_voltage("R"):2.2f}V')

Output:

I(R)=1.00A
V(R)=1.00V

Examples

Several Jupyter/IPython notebook examples can be found in the examples directory.

Contribution

This project is open-source and contributions are welcome. If you would like to contribute, please fork the repository and make a pull request.

License

This project is licensed under the MIT License.

Contact

If you have any questions or issues, please open an issue on the GitHub repository.

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

circuitcalculator-0.4.19.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

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

circuitcalculator-0.4.19-py3-none-any.whl (65.6 kB view details)

Uploaded Python 3

File details

Details for the file circuitcalculator-0.4.19.tar.gz.

File metadata

  • Download URL: circuitcalculator-0.4.19.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for circuitcalculator-0.4.19.tar.gz
Algorithm Hash digest
SHA256 e28266aa53da3268641e65ccec7af626b938f6010da4e5253da98a257da3f0c7
MD5 83023bfe9cfbd1fc5e32e92687e9708b
BLAKE2b-256 bdf052ab76b3b9b246b2755affa97e64b8fc7fcfd0d3e265ff32ccfd2ecedac8

See more details on using hashes here.

File details

Details for the file circuitcalculator-0.4.19-py3-none-any.whl.

File metadata

File hashes

Hashes for circuitcalculator-0.4.19-py3-none-any.whl
Algorithm Hash digest
SHA256 23ad0c02b34684fe94105d27be2f5eb22fad32b2545b1e091087596f9f085b95
MD5 f0a7719a753377d8108b3262b54c4993
BLAKE2b-256 dd2c7b4e5386dd255a183e0774ddc6cfba938b2e9231a40e77b4722689d6fd6f

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