Git Product home page Git Product logo

subcircuit's Introduction

alt text SubCircuit

A Python Based Circuit Simulator

alt text

Requires Python 2.7, Scipy Stack and wxPython.

Note: Many devices are not yet implemented. This is currently at a proof-of-concept phase. The devices and circuits shown in these examples are all currently supported and working.

I'm looking for someone with Python and EE experience to help develop the rest of the atomic SPICE elements.

##Graphical and Programmatic Netlist Creation and Simulation

PySpyce allows the creation of netlists through a schematic editor or directly with a Python script.

Graphical Example

On a Mac:

alt text

On Windows:

alt text

Plotting:

alt text

Programmatic Netlist Development

netlist = Netlist("Distributed Tline")

# define section subckt:
section = netlist.subckt('section', Subckt((1, 2)))
section.device('L', L((1, 2), 0.001))
section.device('C', C((2, 0), 0.0001))

# source:
netlist.device('V1', V((1, 0), Sin(0.0, 100.0, 60.0)))

# add 6 sections:
for i in range(1, 8):
    name = "X{0}".format(i)
    netlist.device(name, X((i, i+1), subckt='section'))

# load:
netlist.device('R1', R((8, 0), 5.0))

# transient simulation:
netlist.trans(0.0001, 0.1)

# plot all voltages:
voltages = []
for i in range(1, 9):
    voltages.append(Voltage(i))

netlist.plot(*voltages)

alt text

Or Build Netlists Just As You Would in SPICE

# SPICE Netlist:

""" 
Example Transformer
VIN 1 0 SIN(0 170 60 0 0)
L1 1 0 2000
L2 2 0 200
K1 L1 L2 0.99999
RL 2 0 500
.TRAN 0.2M 25M
.PLOT TRAN V(1)
.PLOT TRAN V(2)
.END
"""

# Equivalent Subcircuit Netlist:

netlist = Netlist("Example Transformer")
netlist.device("V1N", V((1, 0), Sin(0, 170, 60, 0, 0)))
netlist.device("L1", L((1, 0), 2000))
netlist.device("L2", L((2, 0), 200))
netlist.device("K1", K('L1', 'L2', 0.99999))
netlist.device("RL", R((2, 0), 500.0))
netlist.trans(0.00002, 0.025)
netlist.plot(Voltage(1), Voltage(2))

subcircuit's People

Contributors

joehood avatar

Stargazers

Ewan avatar David Lucas avatar Timo Nicolai avatar  avatar  avatar Alain Fischer avatar fumin avatar Tom avatar  avatar

Watchers

James Cloos avatar  avatar Juan Duarte avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.