Efficient Language - Simulation Program with Integrated Circuit Emphasis
Project description
EL-SPICE
Efficient Language - Simulation Program with Integrated Circuit Emphasis
pip install elspice
EL-Spice is efficient-language based analog electronic circuit simulator. The simulated circuit is created from an expression, then required mathematical operations are applied. Overall, simulation is done. The lingual expression is a geometric code, describes an edge connected to points, which component lies in the edge and what is SI unit magnitude associated with the component. For example:
(0,0) (0,1) R 5M;
This means that a 5 MΩ resistor is connected between points (0,0) and (0,1). Points are not necessarily 2D, it can be in any dimension. Each identifier follows each other by a space. Each component follows the other by a semicolon(;)
(0,0) (0,1) I 2m;(0,1) (1,1) R 1K;(1,1) (0,0) R 2K;
This time, a current source of 2mA is connected with two resistors; one them is 1KΩ, other is 2KΩ. Wires don't have any parameter.
(0,0) (0,1) -;
In summary, all components and usage scheme is listed below:
(0,0) (0,1) -;
(0,0) (0,1) V 5;
(0,0) (0,1) I 2.3m;
(0,0) (0,1) R 3.3M;
(0,0) (0,1) C 4.7p;
(0,0) (0,1) L 3.4u;
RLC Circuit(ω=107)
(1,0) (1,1) V 5;(1,1) (0,1) C 2n;
(0,1) (0,0) L 5u;(1,0) (0,0) R 5;
Usage
- Firstly define your circuit with
circ = elspice.Circuit(D)
where D is number of dimensions. - Create a string of circuit expression with the efficient language and AC frequency. If the circuit is DC, then just write 0 or nothing, it is default to 0.
circ.decode(string_of_circuit, frequency)
- Get node voltages by calling
circ.nodes()
- You can export each node voltage
circ.node_voltages()
. It returns an array and a dictionary describes that which index of array is which node.
Overall
import elspice
circ=circ = elspice.Circuit(D)
string_of_circuit="""(1,0) (1,1) V 5;(1,1) (0,1) C 2n;
(0,1) (0,0) L 5u;(1,0) (0,0) R 5;"""
circ.decode(string_of_circuit, 1591549.430)
circ.nodes()
Output
Node Voltages:
(1, 0): 0V 0°
(1, 1): 5.0 V -1.3232932312128532e-46 °
(0, 1): 50.24937807687795 V 84.28940752087149 °
(0, 0): 4.999999999999999 V 6.616466159068361e-07 °
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 Distribution
Built Distribution
File details
Details for the file elspice-0.0.1.tar.gz
.
File metadata
- Download URL: elspice-0.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a725ad877c1b5b787501650c1038932a55036cf9eeb1c6db4771556bffdb085 |
|
MD5 | 0c8eaa51b3d3205d840d272e84e8143c |
|
BLAKE2b-256 | 632b528e25f0f92a13b407ffdd1ea87b1af9502340d85836c83dedd00dea0a3c |
File details
Details for the file elspice-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: elspice-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4642a936d2c7e3092b4650e3d756c0bad0ca1c070693e18ac8b07d00c0712ee2 |
|
MD5 | e9503b60a85d3c09438de56cd381b60b |
|
BLAKE2b-256 | a1d291a3f8470d3753e617da3592d7df8388890f9c80d497c8c7db6632097052 |