Sim_vs_real_circuit

Discussion in 'General Electronics Chat' started by JStitzlein, Jun 3, 2013.

  1. JStitzlein

    Thread Starter Member

    Dec 6, 2010
    53
    0
    I'm curious to know in what cases a simulation can provide a misrepresentation of how a circuit will work.

    Despite part variances, what are other sources for error in a sim?
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,435
    3,360
    A simulation is just that, a simulation. It can't get everything right. Sometimes it gets it completely wrong. I don't use circuit simulators.
     
  3. JStitzlein

    Thread Starter Member

    Dec 6, 2010
    53
    0
    Can you give me some examples of when it is not right
     
  4. bountyhunter

    Well-Known Member

    Sep 7, 2009
    2,498
    507
    All the time. The accuracy is limited by the quality of the "models" of the components which make up the sim. In any case where there is high speed switching or bandwidth and stability criteria, sims were NOTORIOUSLY inaccurate. The designers who used sims to the exclusion of actual bench data were and are fools..... who generated a lot of work for me and others who had to clean up their mess. Sims are useful for specific purposes but many people incorrectly believe they can replace actual bench testing of a prototype and they go directly to production with disastrous results.
     
    absf and JStitzlein like this.
  5. bountyhunter

    Well-Known Member

    Sep 7, 2009
    2,498
    507
    Any higher frequency performance

    switching circuitry

    circuitry operating at lower voltages near their minimum operating range
     
    JStitzlein likes this.
  6. JStitzlein

    Thread Starter Member

    Dec 6, 2010
    53
    0
    On the subject of circuit operating at lower voltges,

    I know that this is not good for the component as you may damage it and it might now operate the way it was intended to. What other things happen with low power margins?

     
  7. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    Simulators are sometimes given a bad rap due to some who misuse them and others who just prefer the old way (using a slide rule I suppose). I find simulators very useful in developing the initial design of a circuit and avoiding design errors that may not be otherwise obvious. Often I've designed a circuit on paper which I thought would work as planned, but simulation showed there was a subtle error in my reasoning. Simulators are also very useful for easily trying different design approaches and testing the effect of part's tolerance limits circuit operation. I never design a circuit without simulating it, even very simple circuits.

    Once you have the design optimized with a simulator you still need to build it in a breadboard, of course, to verify that the circuit actually works as planned and to determine if any circuit parasitics adversely affect its operation.
     
    absf likes this.
  8. MrChips

    Moderator

    Oct 2, 2009
    12,435
    3,360
    Simulations can miss the effects of noise, stray capacitance, inductance, ground loops, feedback, crosstalk, power supply coupling.

    Get a simulator to simulate a three terminal linear voltage regulator. Has a simulator ever reported one that oscillates? They do in real life if not properly decoupled.

    Here is a quick example. Can a simulator take into account the start up time of a crystal oscillator, including the stray capacitances present in the real circuit layout? How would the simulator know how the PCB is layed out?
     
    absf likes this.
  9. MrChips

    Moderator

    Oct 2, 2009
    12,435
    3,360
    Put a monostable multivibrator on the same board with an NE555 timer. You will see the monostable mistiming especially if the power supply is not properly decoupled. You would not see this reported on the simulator.
     
  10. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    Sounds rather like a homework question.

    The matter of who likes simulators and who doesn't is an old chestnut on AAC. Nothing ever gets resolved as to whether they are useful or not. Those who like them go on using them and those who don't refuse to use them & probably never will.

    It's a bit like religion - a matter of faith. Oops - hope I don't get banned.
     
  11. bountyhunter

    Well-Known Member

    Sep 7, 2009
    2,498
    507
    that's one of things they are good for. In IC design they are useful for seeing effects of varying process parameters in a qualitative way, not quantitative.

    They are HORRIBLE in predicting phase margin or stability because they could not accurately reflect the effects of even minor externals like bond wire inductance.

    Exactly as I always explained to my boss. You get your choice of two design procedures:

    1) Design circuit
    2) simulate it
    3) build up and make it work as intended

    OR

    1) Design curcuit
    2) Build up and make it work as intended

    For building system level circuits, I never found any use for the sim step.
     
  12. MrChips

    Moderator

    Oct 2, 2009
    12,435
    3,360
    Simulators are not entirely useless. They are handy when you quickly want to determine the DC bias condition or get a handle on the gain. It gives you a starting point for a circuit design.

    In the end, final testing of the real circuit is proof in the pudding.
     
  13. tindel

    Active Member

    Sep 16, 2012
    568
    193
    Simulators let you quickly see if your circuit works, and they let you see the effects of changing parameters so that you get an intuitive feel for how your circuit works. That is the service that simulator designers are trying to provide.

    Do you still need to breadboard your circuit to verify it works? I'd bet my career on it.

    However, spice models are only as good as you make them! System level parasitics are not modeled inherently in any simulator I've ever seen, though you can put them in and get an accurate model. Op-amp models are modeled poorly and don't work in corner cases. They usually just consist of the open loop gain and a couple poles. FET models can be way off. I've seen some spice based diode curves be off as much as an order of magnitude!

    I guess what I'm trying to say is that simulators are extremely valuable if you know how and why you're using them and their weaknesses. I won't ever go to the lab and breadboard something until I've simulated it, so that I have an intuitive understanding of how and why the circuit will work. This way when I get into the lab and start testing, I know which parameters to tweak to get the circuit to work. You can waste alot of time and money in the lab trying to get something to work when you could have seen in the model that some part was dissipating 100W when you weren't expecting it and that the design needed scraped and reworked. You can figure all of that out in 20 minutes with a simulator.
     
    absf likes this.
  14. vk6zgo

    Active Member

    Jul 21, 2012
    677
    85
    Pencil & paper,& a brain,can do all that!:D
     
  15. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    It is often very hard to do simulations properly then inductors and transformers are involved. Switchmode power supply as one example. I use a spice a lot. But it can not replace proper prototyping. As many circuit related problems do not show up in a simulation
     
  16. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Try that when designing an IC and see how long it takes.:rolleyes:

    Even when designing a hobbyist-level circuit, the simulator can take the place of pencil & paper, & a brain. The simulator can do calculations that are far too complex and tedious for a human to do, and millions of times faster.
    A breadboard is still essential before going to production or PC board.
     
    absf likes this.
  17. ramancini8

    Member

    Jul 18, 2012
    442
    118
    Simulators have their place, but only as a calculation tool. If you can't put a working circuit down on paper without a simulator try another field. All IC designers use simulators because they are very powerful calculators that can simulate strays etc. Using simulators in IC design shortens the design time significantly. But, simulators will lead people without a very good circuit understanding astray. I made a fortune fixing circuits, yes even IC circuits, that were simulator designed. I don't care how high your stack of simulation results is, or what the results are, because if the circuit you are analyzing can't solve the problem, more analysis is just paralysis. A top circuit designer can determine a circuit's capability in an hour with a few sheets of paper and a calculator.
     
  18. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    If you are working at frequencies where the bond wire inductance affects the circuit, than I understand the simulator can be limited in its predictions. ;) But that's more a fault of inaccurate estimates (or no estimates) that are put in for the various parasitics than a fault of the simulator.

    I've worked mostly in DC to video frequency designs as well as switching regulators and small digital circuits, and I've found simulation very useful for those types of circuits.

    For example, the simulated phase and gain margin of my switching regulator was very close to the breadboard circuit value I measured. The simulator allowed me to optimize these margins before I built the circuit, which would have been very tedious to do in the actual circuit. And the compensation values I ended up with from the simulation were significantly different than the initial hand calculated values I started with.
     
  19. bountyhunter

    Well-Known Member

    Sep 7, 2009
    2,498
    507
    No sir. All ICs today, even linear regs and garbage grade op amps, have bandwidths that go to at least 100kHz, and many have bandwidths to 5 MHz or more. I guarantee you that simulators don't do a decent job of predicting stability and phase margin. It is not the fault of inaccurate predictions, it is the reality that no models are perfect no matter what people want to believe and that is a fact learned from history.

    Sims have a very specific range of applicability, and the problem really is simple: to know what the sim's limits are, you have to be smarter than the sim. About 99.999% of the people using sims are NOT smarter, they are using them because they don't understand the circuitry and they don't want to learn about it, they want a brain dead skip tool to bypass understanding the actual design. I saw it literally every day where customers were demanding system level spice models they could plug into a sim to avoid having to build a prototype and disaster resulted.

    Much of the blame for this starts in school with lazy teachers who want to assign homework to run a simulation so there are no papers to grade. Minimizes everybody's work, teaches nothing.

    Part of the blame falls on the industry because our idiots in marketing saw sims and models as a selling tool for products by telling the customer:

    Don't worry! You can design our part in without ever knowing anything.... no need to hire analog designers or engineers, our software is idiot proof.

    But believe me, nothing is idiot proof because the world keeps building bigger and dumber idiots. And they all had my phone number.

    I don't know if in the overall scheme sims do more harm or good, all I saw was the harm. But I have seen literally hundreds of postings in the homework section of this forum attesting to the fact they are graduating a generation of engineers who don't seem to be able to think...... because they never had to.
     
    absf and t06afre like this.
  20. bountyhunter

    Well-Known Member

    Sep 7, 2009
    2,498
    507
    EDIT TO ADD:

    A good example of what I was saying was the LM2731/3 products. Every released product at our company had to have a spice model, even though this type of part is a "universal" boost switcher that can be configured millions of ways for different input/output voltages. It can also be run in both constant voltage or constant current mode.

    The simple switcher product line (LM2575/LM2577) which is a similar concept, has a software tool that literally took about five years and hundreds of hours of bench work to "fine tune" into something that was accurate enough to release.

    The LM2731 spice model was a train wreck. It was being done by a subcontractor. The model data never matched the bench data for any but a small range because they were just putting in "fudge factors" to try to get the numbers to match even though the model could not actually predict behavior of the circuit.

    The part operates down to 2.7V input, but performance in the range of about 2.7 - 4.5V was very different than above that because all of the circuitry was "collapsing" in a non linear way. It would be impossible to get a model to reflect this and we gave up trying very quickly.

    In a nutshell: we basically locked in on a range of applications which were reasonably consistent and the model is close to that. Of course, backing it all up was a mountain of bench data I took with actual phase margins and performance data. When customers called wanting to know if there design was going to be stable (and what components to select), I could tell them because I had real data. The sim? Any resemblance to reality was pretty much blind luck.

    I hope people understand this. Most sim tools that support a product are accurate only in a specific range of values. What range? Who knows, the guy who took the data might know. If there actually was a guy who took data.
     
    absf likes this.