Skip to main content

A package to convert spice netlist into space state representation

Project description

Netlist to space state

This program converts a spice like netlist into a state-space representation of the system. You can choose the input variables, linearize unlinear systems, calculate the dc operating point, and choose the output variables. The states are column vector taken as the voltage in the capacitors and the current in the inductos, respecting the same order in which they are included in the netlist from top to bottom.

More details and examples can be found below:

Files

test: folder containing all the tests for the code. Type ./test/run_all.sh to run them.

examples: sample netlists

/netlist2ss/netlist2ss.py: calculate the space space-state representation

/netlist2ss/sisotf.py: instantiate the netlist2ss package in order to compute the transfer function for a single input and single output system (the sisotf command is added when you install this package using the setup-tools)

/netlist2ss/__init__.py: init file

Simple Example

  1. Open python3 in a terminal

  2. Calculate the space state matrices of 'cap_filt.sp' circuit by typing the following lines in the python interpreter

    from netlist2ss import netlist2ss 
    handle  = open('./examples/cap_filt.sp', 'r')
    netlist = handle.read()
    handle.close()
    A,B,C,D,OP = netlist2ss(netlist,['IN'],['VnOUT'])
* ['IN'] is the list of the input variables. Input variables can be any variable used as value of a device in the netlist.
* ['VnOUT'] list of output measurements. Use Vn<node> to mesaure the voltage in a specific node, Vd<dev> to measure de voltage across a device, and Id<dev> for the current across a device. Vc<dev> and Ic<dev> returns the voltage and the current between the control pins of controlled sources, respectively.
  1. The transfer function can be calculated by running:
    import sympy as si
    s = si.symbols('s')
    H = si.simplify(C*((s*(si.eye(A.shape[0]))-A).inv())*B + D)[0,0]

Netlist

As shown in the example, the netlist is composed of a list of devices. The interconections between the devices (the nets) can written as any valid spice net name. The keywords gnd (in any combination of up and lower case letters) and 0 means the reference potential node and they must be present at least once.

The value of the device can be any variable name or constant. Don't use any reserved word of sympy!

The device type is identified by its first letter. You can find a list of the supported devices below:

type Description
V Independent voltage source
I Independent current source
E Voltage controlled voltage source
F Current controlled current source
G Voltage controlled current source
H Current controlled voltage source
L Inductor
C Capacitor
R Resistor
T Ideal transformer

Limitations

* capacitors can't be connected in parallel with voltage sources or in parallel with other capacitors.
* inductors can't be connected in series with current sources or in series with other inductors.

Install

If you with to install the package in your computer, type:

    pip3 install netlist2ss

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

netlist2ss-0.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

netlist2ss-0.2-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: netlist2ss-0.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for netlist2ss-0.2.tar.gz
Algorithm Hash digest
SHA256 7236bab161b11baf10380187d0e7fc5c2c6cb35c2c4f137961b0e49a9bffde6a
MD5 d5fccf1806b30b0cb448c47d406c8380
BLAKE2b-256 7b7bddfcaff1a4f8b05394cb5301fb348cdc03a999c901bb43824fc40c336c56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: netlist2ss-0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for netlist2ss-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1222a116c84f784d0d2d478d25d97cf5945e34fc3227d56d5f08b33fba722ba4
MD5 4cfca217a440cf358abd688652ad15cf
BLAKE2b-256 50b6041df324286d0fafbd8695c984f69b6db659103e1f1f08b56a352a6be59b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page