What all does SPICE do?

Discussion in 'General Electronics Chat' started by hp1729, Dec 16, 2015.

  1. hp1729

    Thread Starter Well-Known Member

    Nov 23, 2015
    1,957
    219
    I've been building small circuits for decades but never used SPICE. What all does it do? How good are the models in the library? I am familiar with ORCAD. But have my doubts about SPICE.
    Referring to the guy who built the 12 V SLA battery charger using a TL072 running at 5 V, he said the simulation was good but he was applying a 12 V input to an op amp running off of 5 V. Does SPICE check such things? Does it just check that you don't have two outputs connected together that shouldn't and that all inputs are tied to something?
    How does it model things like transistor gain? This isn't a precise value. LEDs do not have a precise voltage drop across them.
    How does it deal with op amp offset voltage? Again this isn't a precise and predictable value.
    thanks, just wondering if I should bother to learn PSPICE. Most of my stuff is pretty simple. Yes, I make mistakes but usually catch them the second or third time through. :)

    I can see the long term value of simulations over breadboarding as parts get more surface mount and difficult to breadboard. Yes I can put the SMD parts on adapters but the adapters cost more than the chips.
     
  2. dl324

    Distinguished Member

    Mar 30, 2015
    3,249
    626
    From Wikipedia: SPICE (Simulation Program with Integrated Circuit Emphasis) is a general-purpose, open source analog electronic circuit simulator.
    Spice doesn't comprehend all of the dumb things Users can do.

    I cringe when I see novices simulating everything. I think it's better to have a firm grasp of the basics and use simulators when it's beyond your ability to analyze.
     
    Sinus23 and #12 like this.
  3. hp1729

    Thread Starter Well-Known Member

    Nov 23, 2015
    1,957
    219
    Thanks for the reply. I know the text book description of SPICE. My curiosity is about effectiveness. I know orcad is more than a drawing program. Chips are modeled specifying what pins are inputs, outputs, open collector, tri-state, passive, and so on so analysis can be done to assure two TTL outputs are not connected together that should not be. Is this all SPICE does?
    On SPICE models for LEDs does it know what voltage should be across it depending on the current through it or does it just assume a "20 mA" condition?
    Transistor gain. How does it know the characteristics of the actual transistor I use? Not all 2N3904s have exactly the same gain at a given collector current.
    < :) > My concern is that I would be your worse nightmare for a number of years before I got reliable with SPICE. </ :) >
     
  4. #12

    Expert

    Nov 30, 2010
    16,321
    6,818
    I don't Simulate.
    That said, SPICE is a program. Garbage in = garbage out. You will be amazed at the mistakes SPICE won't catch, and the number of demands for perfection in your setup that will require a book to explain.

    You better know 90% of what you're expecting your circuit to do or you will get so mired in the details of learning SPICE!
    Start learning SPICE with really simple circuits.
     
  5. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    LED are usually modelled the same way other diodes are, so there is logarithmic dependance between voltage and current. Same goes for transistors and other things, all the basic components are modelled quite accurately. Trouble comes with other parts like general ICs, those are modeled using those primitive devices and can often be quite far from reality, or can cause extremely slow or not at all working simulations, but that is a problem in the model and not the simlator.

    Look at what parameters can be definded for a simple NPN transistor for example here http://www.ece.uci.edu/docs/hspice/hspice_2001_2-102.html
    Lots of components don´t have all the parameters entered, so the simulator just assumes some default. Opamps usually have fixed offset an input currents, but you should be able to modify those and try different values, also there are different classes of models of for example opamps, which differ in realism and computation complexity, some will even run happily without any power supply connected.
     
  6. wayneh

    Expert

    Sep 9, 2010
    12,145
    3,055
    LTspice is a simulator and like all simulators depends on the component models. Those in turn depend on the human that created them. Shinola in, shinola out. That's why you'll sometimes see multiple models available for a single component. A simple model may be fine for most applications, while a detailed elaborate model might be required for another.

    I would never assume that a simulation will catch any errors. They'll let you put 100mA into that 20mA LED and not make a peep.

    I've done a little programming in an unrelated area and I can tell you that error trapping user input is usually the last and most difficult thing to add. My dad used to say, "If you think it's foolproof, you just haven't met the right fool yet".
     
    absf and #12 like this.
  7. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    yes...but it a simulation it won't cause a pffffffftttt!!! :D
     
  8. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    I never build anything without simulating it first. Habit started when I was designing VLSI chips. A simple design error can cost $100K, so it better be right the first time.

    Used Berkley Spice, HSpice, PSpice, LTSpice, and about a dozen more variants...
     
  9. dl324

    Distinguished Member

    Mar 30, 2015
    3,249
    626
    I Google it for you.
    http://www.ece.tufts.edu/~srout01/ee12-2008/pspice/Q2N3904.lib
    That model used 416.4; which seems a bit high to me...
     
  10. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    No tool is an appropriate substitute for good judgement. I remember when making 512 x 8 Mask ROMS were a $3000.00 mask charge and a six week lead time for first silicon. There was a premium on solid debugging.
     
  11. KL7AJ

    AAC Fanatic!

    Nov 4, 2008
    2,040
    287
    I learned the real value of spice while designing a 100 Kilowatt matching network for an inductively coupled plasma device at UCLA. I was already a seasoned R.F. guy by that time, but the impedance of this device was nearly impossible to calculate. So, using the method of iteration and spice, we actually came up with a really great network. I would NOT recommend Spice as a substitute for actually building stuff, though. :)
     
  12. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Spice doesn't teach you how to design a circuit so that it works if the Hfe ranges from 50 to 500, but it lets you see the effect upon the operation of the circuit as a function of Hfe...
     
  13. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    Anybody who designs a circuit that depends on a specific value of any parameter has a fool for a client.
     
  14. KL7AJ

    AAC Fanatic!

    Nov 4, 2008
    2,040
    287
    I believe Spice's biggest value is in modeling PASSIVE networks like complex filters and such. Most of the literature and texts out there, however, concentrate only on the active parameters.
     
  15. WBahn

    Moderator

    Mar 31, 2012
    17,757
    4,800
    Huh?

    But OrCAD uses PSpice as its simulation engine. That's why they bought MicroSim. (unless things have changed in the last decade or so).

    You are actually talking about a couple of different things. Connecting two outputs together that shouldn't comes under the heading of Electrical Design Rule Check (DRC). This requires information that the SPICE engine simply doesn't have access to. So these kinds of checks are primarily the purview of the schematic capture software and how you set up its DRC rules deck.

    As for the quality of the simulation itself, that depends on the quality of the model and the quality of the simulation setup. The models historically have been all over the place. One time I used a TI model for an opamp (TL074, I think) and the simulation matched my actual circuit performance quite nicely. Then I started looking at total current draw and it showed the opamp was drawing a bit over a thousand amps! After playing around I called TI and they told me that their model developers only cared about the I/O pin characteristics and the power supply current was what ever the various dependent sources in the model happened to use. Remember that SPICE was originally developed for designing integrated circuits -- ICE stands for Integrated Circuit Emphasis -- so everything was at a pretty basic level as far as components went. As people wanted to simulate circuit boards that had ICs on them, device manufacturers started making simple models available and, at first, they focused on the signal processing chain and not anything else. Since then IC models have gotten a LOT better -- because people are demanding better sim results that cover more and more items of interest.

    As design rules for transistors got into the deep-submicron, the transistor and other basic component models had to get better and better to give reasonable simulation results. Given that a mask set today can cost millions of dollars, you want a simulation that is nuts on. So companies were willing to pay fab houses to develop models that were nuts on (well, actually they just refused to use fab houses that didn't supply models that were nuts on -- i.e., they were willing to pay significantly higher fab costs compared to fabs that didn't provide high quality models.)

    When I was working with the IBM 130 nm process (a decade or so back) I looked at their model for their basic NFET. It consisted of a subcircuit that had over three hundred components! For ONE transistor. But it pays off. Even back in the mid 90's when I started doing IC design, when I would get the chips back from fab and I would measure the bias voltages that where generated on-chip they seldom different from the sim results by more than a few millivolts.

    Most of the models have statistical parameters that describe the distribution of various other parameters, such as gain and voltage drop and temperature coefficients and you name it. You can set up the simulation to do what is called a Monte Carlo simulation where individual device parameters are randomized according to that distribution. You then run many (ranging from half a dozen to thousands) of simulations and collate the results. This can take a lot of time, so your first step is usually to do what are known as "corner simulations" in which you put the key parameters, usually including temperature, at their extreme values. You then get it working as best you can over those variations before running a full Monte Carlo set.

    When spinning a circuit costs a couple hours and some bread boarding or even a couple weeks and a few hundred bucks, this can be a perfectly reasonable approach. When spinning a circuit costs six months and a hundred thousand bucks, that's a very different thing.
     
  16. #12

    Expert

    Nov 30, 2010
    16,321
    6,818
    The pffffffftttt only happens when you believe the Simulator and build the circuit. :D
     
  17. crutschow

    Expert

    Mar 14, 2008
    13,028
    3,237
    As noted, there is absolutely no rule checking in Spice. It will allow 10k amps through a 1mA part without a whimper. So all checks have to be done by looking at the simulation results and deciding if the voltages and currents are reasonable for the circuit design.
    LTspice has an option (and other versions may also) that displays the power dissipated in a device to verify that it's not operating outside it's limits (or how large a heat sink it might require for power devices). That's especially useful for devices like power transistors in switch-mode circuits where it's rather difficult to calculate the power dissipation due to the switching losses.

    Spice generally uses nominal values for the various parameters so if you want a worst-case test you will need to go into the models and change the value. One technique is to copy the model and generate your worst-case model with a slightly different name (such as adding "_WC" as an extension).

    I think learning to use Spice is worth the effort. Not only does it often catch errors in your design but it allows you to easily modify the circuit to optimize the design or try alternate design approaches.
    As MikeML noted I also never build a design without first simulating it.
     
    Last edited: Dec 16, 2015
  18. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    :D

    Heh....mhmm...well....it is a simulation..;)
     
  19. hp1729

    Thread Starter Well-Known Member

    Nov 23, 2015
    1,957
    219
    Thanks for the advice.
     
  20. hp1729

    Thread Starter Well-Known Member

    Nov 23, 2015
    1,957
    219
     
Loading...