Giter VIP home page Giter VIP logo

tauspice's Introduction

tauSPICE

A SPICE based circuit simulator made with Matlab.

Description

tauSPICE can perform both Steady state and transient analysis. Currently, the library has the following components:

  • Capacitor (C)
  • Current controlled current source (F)
  • Current controlled voltage source (H)
  • DC current source (IDC)
  • Sinusoidal current source (ISIN)
  • Inductor (L)
  • Resistor (R)
  • Short circuit (SC)
  • Switch (UTCLOSE)
  • Voltage controlled current source (G)
  • Voltage controlled voltage source (E)
  • DC voltage source (VDC)
  • Sinusoidal voltage source (VSIN)

The library can be extended to have more elements by adding more elements in the lib folder.

How to use

Netlist is a column vector of string rows. Each row of the vector specifies a element of the circuit. Netlist syntax is mostly like SPICE netlist with some modifications. Last row of netlist specifies the analysis type. .SSA for steady state analysis and .TRA for transient analysis.

Specify the netlist vector on query_handler.m and run the script for solving the circuit. For plotting transient response, run transient_response.m after solving the circuit.

Example Circuits

  • Circuit:

Textbook soltuion of Vo:

Netlist input:
["V1 1 0 DC 7";
"R1 1 2 3";
"L1 2 3 0.5";
"R2 3 0 1";
"L2 3 0 0.20";
".TRA 0 1.5 .01"]

Transient solution of tauSPICE:

* Circuit diagram:

Netlist:
["Vac 1 0 SIN 20 0.6366 0"; "R1 1 2 10"; "C1 4 0 0.1"; "Vd 2 4 DC 0"; "L1 2 3 1"; "F1 0 3 Vd 2"; "L1 0 3 0.5"; ".SSA"];

Steady state complex solution matrix from tauSPICE:
20.000000000000000 + 0.000000000000000i 17.998993607320070 + 6.001341622508473i -13.198069422787535 - 4.400586226749846i 17.998993607320070 + 6.001341622508473i -0.200100639267993 + 0.600134162250847i -2.400462092266265 + 7.199373835221737i

Index of nodes:
{[ 1]} {[ 2]} {[ 3]} {[ 4]} {[1 0]} {[2 4]}
So, first 4 entries of the solution matrix are the corresponding node voltages. Last two entries are current from node 1 to 0 and from node 2 to 4.

* Circuit diagram:

Netlist:
["I1 0 1 DC 3"; "Vd 1 4 DC 0"; "R1 4 2 2"; "R2 1 3 4"; "R3 2 0 4"; "R4 2 3 8"; "F1 3 0 Vd 2"; ".SSA"];

Steady state solution provided by TauSPICE:
Solution Matrix: 4.800000000000000 2.400000000000000 -2.400000000000000 4.800000000000000 1.200000000000000

Node Index:
{[ 1]} {[ 2]} {[ 3]} {[ 4]} {[1 4]}

So first 4 entries of the solution matrix are the corresponding node voltages and the last entry is the current from node 1 to 4.

More example netlists are available on the ex_netlist.m file.

tauspice's People

Contributors

touhid314 avatar

Watchers

 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.