Skip to main content

respice

Flexible and easy to use non-linear transient electric circuit simulator.

Install

pip3 install respice

Usage

Create your circuit and simulate it!

from respice.analysis import Circuit
from respice.components import CurrentSourceDC, R, C

# Define components for our circuit.
R1 = R(100)
R2 = R(200)
C3 = C(10e-6)
R4 = R(200)
R5 = R(100)
Isrc = CurrentSourceDC(0.1)

# Construct the circuit. All circuits are just
# Digraphs allowing multiple edges. On each edge
# one component.
wheatstone_bridge = Circuit()
wheatstone_bridge.add(R1, 0, 1)
wheatstone_bridge.add(R2, 0, 2)
wheatstone_bridge.add(C3, 1, 2)
wheatstone_bridge.add(R4, 1, 3)
wheatstone_bridge.add(R5, 2, 3)
wheatstone_bridge.add(Isrc, 3, 0)

# Simulate! From t1 = 0ms to t2 = 5ms with 100 steps.
simulation = wheatstone_bridge.simulate(0, 0.005, 100)

The results are stored in the returned object and can be easily accessed via simulation.v(component), simulation.i(component) or simulation.p(component). Those contain the voltages, currents and powers respectively for each time step as a list. The time steps can be accessed with simulation.t().

All simulations are asynchronous. Accessing results early may only give partial results. Use simulation.wait() to wait until the result is ready.

Results can be immediately plotted. For plotting, plotly is required.

from respice.examples import RC

# Define an example RC circuit. The package respice.examples
# contains a few!
rc = RC(100, 100e-6, 10)  # 100Ohm, 100uF, 10V
simulation = rc.simulate(0, 0.1, 100)
simulation.plot()

The plot function will wait automatically until the result is finished. Live-plotting is not supported yet.

More simulations can be found on the snippets page.

Supports

  • MNA - Modified Nodal Analysis

    This is the algorithm employed by this software. So it’s easily possible to handle voltages as well as currents.

  • Transient non-linear steady-state analysis

    Find quickly periodic steady-state solutions of a circuit that appear when the circuit transients have settled.

  • Multi-terminal components

    Components with more than just two terminals can be handled easily. Whether each sub-branch of them is a current- or voltage-branch, or whether they are current- or voltage-driven.

  • Mutual coupling

    Usually required by multi-terminal components, mutual coupling is easily implementable. Each sub-branch in a component is automatically receiving the voltages and currents of all other branches comprising the component.

Documentation

More details and explanations are available in the documentation.

Documentation is generated via Sphinx. To build the documentation:

pip3 install -r requirements.txt -r docs-requirements.txt
make html

The index file can then be opened with your favorite browser at build/html/index.html.

Documentation is also available online.

Metadata

Release files for respice 0.3.10

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

Source distribution (sdist)

Source distribution for respice 0.3.10
File Size Uploaded Provenance Actions
respice-0.3.10.tar.gz 55.5 kB Without provenance Details for respice-0.3.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for respice 0.3.10
File Interpreter ABI Platform Actions
respice-0.3.10-py3-none-any.whl Python 3 none any Details for respice-0.3.10-py3-none-any.whl

Total release size: 138.9 kB

Release files / respice-0.3.10.tar.gz

Download URL respice-0.3.10.tar.gz
Size 55.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8ad94ae697baf5c4828224b18d47418826b07d84250cf3dc9d3cfabfd9ae7609
BLAKE2b-256 checksum
How to use checksums
b7387e07ef0187d881feaab94360d4510fbc3c708596345753242d47975f5148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / respice-0.3.10-py3-none-any.whl

Download URL respice-0.3.10-py3-none-any.whl
Size 83.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b2ddcb57a0cabebc74441f10ce809f1313c8fc4f8c0ae5512cf5b24e74da0ea
BLAKE2b-256 checksum
How to use checksums
142a4e35557b613ebc867a23375ae51fbad8e17d55107b798d6aece159c733a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for respice 0.3.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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