Spice is a powerful tool for circuit analysis. But it often surprises users with
. holes in its abilities and strange definitions
. lack of industry-wide standards
. the need for the user to model the physics of their circuit, not just draw the schematic

I hope this blog will educate users and promote discussion in these areas.

Monte Carlo analysis Limitations

Some Spice programs offer Monte Carlo analysis
but is it useful with designs based on discrete components?

The idea is
1. the user assigns a tolerance to each circuit component's value
2. Spice varies the values of all components in a random fashion within the tolerance limits
3. run the simulation
4. repeat steps 2 and 3 a large number of times, recording the circuit's output from each simulation.
The designer can then review the saved circuit outputs to get a statistical idea of how the circuit's output will vary in production (due to component tolerances).

BUT
Op amps, voltage references, power MOSFETs and other complex analog devices are modeled in Spice using a subcircuit. The device manufacturer commonly supplies this model, which comes with the simulator software or is downloaded by the user. These subcircuits do not participate in the Monte Carlo analysis, or if they do, the subcircuit does not have identified components whose values correspond to the physical device parameters you would like to vary. If all subcircuit component values are varied, the model will produce behavior that does not correspond to the physical device.

Original Spice did not have Monte Carlo so there has been no Spice standard to guide model designers and Spice software developers in making Monte Carlo work with subcircuits.

If your simulator offers this analysis and you use subcircuits, proceed with caution!

Run Monte Carlo in your simulator using a Maxim or Linear Tech op amp subcircuit and 0% tolerance gain setting resistors. Does the DC offset voltage change? Does the AC gain's high frequency rolloff change? Add a comment here with your results. 

2 comments:

  1. What are your thoughts on sensitivity analysis versus Monte Carlo versus Design of Experiments (are there any DoE tools integrated within SPICEs)?

    ReplyDelete
  2. I am not familiar with Design of Experiments tools so no comment there.

    Spice Sensitivity suffers from the same problems as Monte Carlo when dealing with manufacturers' subcircuits.

    So we are usually analyzing only our main circuit, not its subcircuits.

    I feel I can learn more from Sensitivity analysis because it quickly identifies which component values affect the output the most. (5Spice helps, it provides a small bar graph of sensitivities with a log scale. Makes the most sensitive components easy to spot, without having to read all the numbers.)

    To use Monte Carlo I have to decide in advance what tolerances to give to all my components. (I can ignore those I believe won't have much effect, but in an unfamiliar circuit it's not so easy to guess). The analysis needs to do a large number of simulation runs to get a reasonable statistical distribution. Then if I don't like the results, does the program show me what component tolerances were used in the runs that have the highest deviation, so I can guess which ones might be a problem, or just the total deviation?

    In an ideal world, I would use Sensitivity to find which component values I am worried about, then assign tolerances to that limited set of values and run Monte Carlo. This would also make Monte Carlo, a slow analysis if many component values are to be varied, run much faster.

    Fortunately in the real world there are often just a few critical components (a design goal of experienced designers). You can multiply their sensitivities times the component tolerances to manually compute the change at circuit output, adding the changes together to get close to a worst case.

    ReplyDelete