Skip to main content

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

Project description

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

Prerequisites

Install necessary packages via

pip3 install -r requirements.txt

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(3, 0, Isrc)

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

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

Circuits are graphs (like mentioned in the snippet). More precisely, a Digraph allowing multiple edges from and to the same nodes. Each edge represents a single two-terminal component (like a resistor). Those are connected to nodes, which are simple joints that can be arbitrarly named or identified (for example numbers like in the example above, but strings, or even other objects are possible if necessary).

Example Plotting

Results can be immediately plotted. For plotting, matplotlib or plotly are 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
result = rc.simulate(0, 0.1, 100)
result.plot()

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 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.

The Future

  • Incorporating interfaces for heat-dynamics

    Components are often depending on operation temperature. This can highly change behaviour of the whole circuit. Implementing new simulation variables like current component temperature could allow to simulate temperature influence. This is especially useful for safety analysis and estimating the maximum critical operation point.

    This might even serve as a general concept to introduce even more parameters besides heat that influence component performance and behaviour.

  • Enhancing components (maybe heat-dynamics coupled) to simulate breakage

    Components can break. Either due to age, or because currents where to high. Consecutively extending components to contain “breakage-states” (so state variables that tell you if the element is destroyed or not) could improve analysis for circuits operating near critical operation points.

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

respice-0.2.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

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

respice-0.2-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file respice-0.2.tar.gz.

File metadata

  • Download URL: respice-0.2.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.8

File hashes

Hashes for respice-0.2.tar.gz
Algorithm Hash digest
SHA256 a361e07eba447a0f1fcb0d0e9e8131fee440d1dce5746c539cf63dbe4988e31c
MD5 268f23af498c320dc18d73ed7f4752df
BLAKE2b-256 868000a37731f48416eebda6756d75a3c5cf24195964d2b4d4f9003c4a884b21

See more details on using hashes here.

File details

Details for the file respice-0.2-py3-none-any.whl.

File metadata

  • Download URL: respice-0.2-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.8

File hashes

Hashes for respice-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bb94e00df22fa9a9248cda4b4f3376e1d79b4ed80a09a5a6a93f560f99a61bc5
MD5 6b2d4e2aaec8a4596737751c8c6a468c
BLAKE2b-256 ed3fb66b766a26de9df57d831f248ca7ab2dc8a11c72bafbf975a96e5fc742fb

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