Parts tolerance simulations in ltspice

I just recently found this tutorial (and various other places mentioning a similar technique) when trying to evaluate how one of my circuits behaves when using real world components with real world tolerances.

However normally I design it with ideal values, play around with .step directive etc. so to just do that evaluation I would have to change all the value statements to use the mentioned functions, and when I am not happy, change them back and to play with values again and so on. This seems like an awful lot amount of work. I could probably write a script that does it on the .asc files for me, but I was wondering if there really is no other way.

For most components you have a "Tolerance[%]" field, so I was wondering if this can be used in some global way? Just like some components seem to react on the .step temp variable. Unfortunately in the documentation I find the temp mentioned, but not the tolerance (which results in SpiceLine tol=xxx in the .asc file, if that helps anyone).

So, is there an easy way to have LTSpice (randomly) vary component tolerances over multiple runs, without having to put formulas at each and every one? (I am mostly interested in resistors and capacitors today, if that helps to find a 90% solution)

• Of the freebie sims, only Intersil's Isim:PE can do Monte Carlo relatively painlessly, as far as I know. See this for docs. Probably the free/demo version of SIMetrix/SIMPLIS can do it too (and it's a bit more up-to-date than the Intersil version) but I already had the former installed, and I didn't want to risk messing it with two versions installed.
– Fizz
Dec 7 '15 at 3:50

Monte Carlo analysis and worst-case is usually the way this is done, exactly as the linked article describes. For Monte-Carlo you don't have to change your components by hand, just run the Monte Carlo sims and the simulator will automatically change the components based on your Tolerance field. You have to run enough cases to get a statistically significant result, and you can calculate how many runs you need for a given confidence. Worst-case requires a little more work and knowledge of how the circuit works, but the linked article explains that as well.

• " just run the Monte Carlo sims" exactly that is the question. How to do that in ltspice without having to change the components to formulas, like the linked article suggests. Nov 10 '14 at 22:37
• For Monte Carlo, you just add the .mc directive. You can do that in the GUI by clicking on the little .op on the toolbar. The linked article shows this is done. Since you're not doing worst-case you don't need to worry about the functions. Just find the circuit diagram for the Monte-Carlo analysis in the linked article, add the directives shown in the schematic and you're good to go. Nov 10 '14 at 22:58
• Hm, looks like I am blind. I can't find any .mc directive, all I can find is "rather than define a resistor's value as, say, 10K, we define it as "{mc(10K,0.05)}", " Nov 10 '14 at 23:13
• I wasn't aware that asking for if there is a nicer way is considered complaining; especially given there is a tolerance, which then doesn't seem to be used for anything. So in the end, I either have to completely change my workflow and put formulas instead of values everywhere (which probably also means running custom modifications of transistors etc.) right at the beginning, or have to write a script that translates my current .asc file into one that uses mc() everywhere instead... Nov 10 '14 at 23:32
• It just seems like such a trivial feature to add. Unless of course their codebase is a giant mess... Nov 10 '14 at 23:42

I use the following for the value of components: Example for a resistor is {if(nom,R1,mc(R1,tolr))}. Then I define a parameter 'nom' such that if it is set to 1 then the resistor gets the nominal value (R1 parameter in this case, but could be a 'hard' value like '10k'), otherwise if it is 0 then it gets the Monte Carlo Value.

• That is not really what I understand as "without having to put formulas at each and every one" May 10 '18 at 19:16

This post is old... but as of March 2021 LTspice still does not support using the built in tolerance parameter on components. See page 102 of the recently published (Nov 2020) "Passive Circuit Analysis with LTspice®: An Interactive Approach". In reference to resistor tolerance fields it states: "This is accepted but, as we have already seen, not acted on. ... So tolerance and power rating really are there as reminders when specifying resistors for production."

The recently free Micro-Cap software may better support MC more intuitively.

• Yes, many tools may do some things better, but that was not quite the point of the question. I am probably not the only one who has quite a few things done already in ltpsice and wishes to work with that, and usually other programs are not even able to read the format, or don't have the parts being used. And unless I overlooked something in micro-cap you have to chose which graphs to draw before running a transient analysis, which can be extremely cumbersome and time consuming when debugging something. It seems to have a lot of other nice features for other applications though. Mar 2 at 10:10
• I hear you, I'm just as frustrated. I found your post after digging around and trying to find out how to use the 'tolerance' field in LTspice. It's frustrating that EE's get the short end of the stick with design software. Spice simulation and PCB EDA has always felt janky compared to mechanical 3D CAD or 2D art software. Mar 2 at 15:16
• my current pipeline is still ltspice but with a script added that runs it and changes the component values and then collects all the results... Mar 2 at 15:42
• All that in one script? Neat! Would you mind sharing it? Mar 2 at 17:18
• pretty specific to what I do, but I added a (mental) note to try making it open source and more general when possible. Might add it as an answer here then.... Mar 2 at 20:24