Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

SPICE internals

  1. Sep 21, 2006 #1
    Are there any good sources anywhere for detailed info on how SPICE simulators work internally? I'm interested in learning more about how spice actually goes about its calculations, thanks.
  2. jcsd
  3. Sep 21, 2006 #2
    Are you interesting in how it models a transistor or how sets up and solves a system of equations? Pretty much any answer will be specific to a particular version of spice but for the transistor:
    In general this model is used:
    If you can specify more parameters then often this one is used:

    This link seems effective but to be honest I only glanced through it:
  4. Sep 21, 2006 #3
    Oh ya, I supose that answer is only good for bipolar transistors. Not sure sure if there is a generic FET model. I kinda doubt it. The version I use is hspice.
    There is a chapter that describe the various FET models in excruciating detail if you are really interested. I have never been that interested myself and only use it for reference when necessary. :)
  5. Sep 21, 2006 #4
    It uses modified nodal analysis to set up a system of equations, and then uses Newton's method combined with the trapezoidal rule to step through time.
  6. Sep 22, 2006 #5
    I'm fairly familiar with spice input, that is, the measured parameters which define the electrical behavior of the transistor or other devices.

    What I want to know is more about the details of how it actually goes about using those parameters. Like, I know it uses the modified nodal analysis, but it's surely more complex than that internally, right?
  7. Sep 22, 2006 #6
    It's really not that complicated. It reads each element off the input file, and then stamps a constitutive relation into a matrix connecting the nodes that the device is connected to.
    http://ocw.mit.edu/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-336JFall2003/DDF74FDE-003D-42C6-AE1F-09E39CC48A0C/0/lec2.pdf" [Broken]
    Have a look at slides 19-32 specifically and it shows you how to turn a resistor network with sources into a linear system. If you have capacitors or inductors, it does the same thing by adding a C and an L matrix and time derivatives to get a dynamical linear system. It gets a little bit trickier when you include nonlinear elements because then it needs to know the Jacobian (change in current with respect to change in voltage at each node it's connected to) of each element and it stamps those into a linearized system.

    Once it has the system assembled, it uses your standard numerical technique to solve for all of the node voltages. If the system is linear, it just solves it with LU decomposition or an iterative scheme. If the system is dynamical, it uses the trapezoidal rule (I think) to itegrate through time. If the system is nonlinear, it just uses Newton's method to create a bunch of linearized versions of the system and solves those.
    Last edited by a moderator: May 2, 2017
  8. Sep 22, 2006 #7
    hmm, I see. I guess it's conceptually pretty simple then, but it makes me wonder why I had trouble finding info on the web about the exact details. thanks.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook