5
\$\begingroup\$

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)

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Fizz Dec 7 '15 at 3:50
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ " 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. \$\endgroup\$ – PlasmaHH Nov 10 '14 at 22:37
  • \$\begingroup\$ 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. \$\endgroup\$ – John D Nov 10 '14 at 22:58
  • \$\begingroup\$ 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)}", " \$\endgroup\$ – PlasmaHH Nov 10 '14 at 23:13
  • 1
    \$\begingroup\$ 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... \$\endgroup\$ – PlasmaHH Nov 10 '14 at 23:32
  • 1
    \$\begingroup\$ It just seems like such a trivial feature to add. Unless of course their codebase is a giant mess... \$\endgroup\$ – PlasmaHH Nov 10 '14 at 23:42
1
\$\begingroup\$

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.