Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new

Every part on a power-supply board comes with a tolerance, and a design that only works with nominal values will fail on some fraction of the boards you build. Tolerance analysis tells you how large that fraction is. There are three common methods: extreme-value worst case, root-sum-square (RSS), and Monte Carlo. They answer slightly different questions. This article applies all three to the same output-voltage problem, then shows how many Monte Carlo runs you need before a yield number means something.

The example: output voltage set by a divider

A regulator holds its feedback pin at a reference VrefV_{ref}, and a divider sets the output:

Vout=Vref(1+R1R2)V_{out} = V_{ref}\left(1 + \frac{R_1}{R_2}\right)

Take Vref=0.8V_{ref} = 0.8 V ± 1 %, R2=10R_2 = 10 kΩ ± 1 % and R1=31.6R_1 = 31.6 kΩ ± 1 % (the nearest E96 value for 3.3 V). The nominal output is

Vout=0.8×(1+3.16)=3.328 VV_{out} = 0.8 \times (1 + 3.16) = 3.328\ \text{V}

The specification is 3.33.3 V ± 3 %, that is, 3.201 V to 3.399 V. The nominal is already 0.85 % above the centre, which is common when you round to standard resistor values.

Method 1: extreme-value worst case

Push every part to the end of its tolerance in the direction that moves the output most:

Vout,max=0.808×(1+31.9169.9)=3.413 VV_{out,max} = 0.808 \times \left(1 + \frac{31.916}{9.9}\right) = 3.413\ \text{V}
Vout,min=0.792×(1+31.28410.1)=3.245 VV_{out,min} = 0.792 \times \left(1 + \frac{31.284}{10.1}\right) = 3.245\ \text{V}

The upper extreme exceeds 3.399 V, so by this method the design fails. The method is simple and guaranteed: no combination of in-tolerance parts can do worse. But it assumes every part sits at its limit at once, in the worst direction, which is rare.

With more than a few parameters, trying every combination of extremes (2k2^k corners for kk parameters) becomes expensive, and for non-monotonic responses the worst point may not be a corner at all.

Method 2: sensitivities and RSS

Linearise the output around nominal. The relative sensitivity is

ΔVoutVout=ΔVrefVref+R1R1+R2(ΔR1R1−ΔR2R2)\frac{\Delta V_{out}}{V_{out}} = \frac{\Delta V_{ref}}{V_{ref}} + \frac{R_1}{R_1 + R_2}\left(\frac{\Delta R_1}{R_1} - \frac{\Delta R_2}{R_2}\right)

Here R1/(R1+R2)=31.6/41.6=0.760R_1/(R_1+R_2) = 31.6/41.6 = 0.760. Adding the magnitudes reproduces the worst case: 1+0.760×(1+1)=2.521 + 0.760 \times (1 + 1) = 2.52 %.

RSS treats the parameters as independent random variables and adds their variances:

σV=∑i(Si σi)2\sigma_{V} = \sqrt{\sum_i \left(S_i\, \sigma_i\right)^2}

The answer depends on what a tolerance means statistically.

  • Uniform within the tolerance tt: σ=t/3\sigma = t/\sqrt{3}. Then σV=(1/3)12+2×0.7602=0.577×1.468=0.847\sigma_V = (1/\sqrt{3})\sqrt{1^2 + 2 \times 0.760^2} = 0.577 \times 1.468 = 0.847 %.
  • Gaussian with the tolerance as 3σ3\sigma: σ=t/3\sigma = t/3. Then σV=1.468/3=0.489\sigma_V = 1.468/3 = 0.489 %, and the ±3σ\pm 3\sigma band is ±1.47 %, much tighter than the worst case's ±2.52 %.

Uniform is the cautious choice when you do not know the distribution, for example for parts that may have been sorted, where the best units were sold under a tighter tolerance. Gaussian fits processes that are centred and well controlled.

Estimating the yield

The upper limit is 3.399−3.328=0.0713.399 - 3.328 = 0.071 V away, which is 2.13 % of nominal. With the uniform model, that is 2.13/0.847=2.5 σ2.13/0.847 = 2.5\,\sigma. The sum of three uniform variables is already close to Gaussian, so the probability of exceeding it is about 0.6 %. The lower limit is 3.8 % away, beyond 4σ4\sigma, which is negligible. The expected yield is therefore about 99.4 %.

So the worst case says "fails" and the statistics say "about 6 boards in 1,000 fail". Both are correct. Which one you act on depends on the cost of a failure.

Method 3: Monte Carlo

Monte Carlo draws every parameter from its distribution, simulates, measures, and repeats. It needs no linearisation, so it handles non-linear behaviour, discontinuous conduction, saturation and limit cycling as long as the simulation captures them. It also measures things that have no closed form, such as the output ripple, the overshoot after a load step, or the loop's phase margin.

Three choices matter.

Distributions. Use what you know about each part. Electrolytic capacitors often have −20 % / +20 % or asymmetric tolerances and drift with age and temperature; ceramic capacitors lose capacitance with DC bias; inductors have ±20 % or ±30 %. Do not forget correlation: parts from the same reel tend to move together, which can make ratios such as R1/R2R_1/R_2 tighter than independent draws suggest.

Seeds. Seed the random generator and record the seed. The same seed gives the same draws, so a failing run can be reproduced, inspected and fixed, and two versions of a design can be compared on the same set of boards.

Number of runs. A yield measured from NN runs is itself uncertain. If kk of NN runs pass, the Wilson score interval gives a confidence interval that behaves well near 100 %:

p^+z22N±zp^(1−p^)N+z24N21+z2N,p^=kN\frac{\hat p + \frac{z^2}{2N} \pm z\sqrt{\frac{\hat p(1-\hat p)}{N} + \frac{z^2}{4N^2}}}{1 + \frac{z^2}{N}}, \qquad \hat p = \frac{k}{N}

With 199 passes out of 200 and z=1.96z = 1.96 (95 % confidence), p^=99.5\hat p = 99.5 % but the interval is 97.2 % to 99.9 %. To claim a failure rate below 1 % with 95 % confidence when no run fails, the "rule of three" says you need about N=3/0.01=300N = 3/0.01 = 300 runs. Rare failures need either many runs or a different tool, such as worst-case corners targeted at the parameters that matter.

Histogram of the output voltage over 200 Monte Carlo runs in Voltecx (Vref, R1 and R2 uniform within ±1 %, seed 1), with the nominal 3.328 V and the upper limit 3.399 V marked.

As a check, the regulator was simulated in Voltecx as an op amp that holds the feedback node at VrefV_{ref}, with VrefV_{ref}, R1R_1 and R2R_2 drawn uniformly within ±1 % in 200 seeded runs. The mean is 3.330 V and the standard deviation 0.886 % (the uniform RSS estimate above is 0.847 %). Every run stays inside the worst-case band, and 198 of 200 pass: a yield of 99.0 %, with a 95 % Wilson interval of 96.4 % to 99.7 %, consistent with the estimated 99.4 %.

A practical order of work

  1. Sensitivity first. Change each parameter a little and rank the effect on each output. Most outputs depend strongly on two or three parameters.
  2. Worst case on those few. It is cheap with few parameters and tells you whether a guaranteed design is possible.
  3. Monte Carlo for the yield. Use realistic distributions on all parameters, with enough runs for the confidence you need, and keep the seed.
  4. Fix the design, not the statistics. If the yield is too low, re-centre the nominal (here, a different resistor pair) or tighten the part that dominates the sensitivity.

The statistical background follows R. Spence and R. S. Soin, Tolerance Design of Electronic Circuits (1988), and E. B. Wilson's 1927 score interval.

Try it in Voltecx

  • analysis.monteCarlo draws random values within part tolerances, uniform by default or gauss with the tolerance as 3σ3\sigma, with a seed that makes the run repeatable. It reports the mean, standard deviation, minimum and maximum of the measurement, a histogram, percentiles and the worst run. With limitMin or limitMax it reports the yield with a Wilson score interval (95 % confidence by default), and a run that fails to simulate counts against the yield.
  • analysis.sensitivity ranks how much each variable moves each metric. analysis.worstCase tries every combination of extremes with "method": "corners" (up to 8 variables), or uses a linear estimate plus RSS with "method": "sensitivity".
  • In a spec, the monteCarlo object runs a yield test inside spec.verify and design.auto, with minYieldPct as the pass condition (at most 200 runs).

A simulated yield is only as good as the tolerances you give it. The worst-case stage of design.auto assumes a 20 % part tolerance, so for a yield you can defend, give analysis.monteCarlo or the spec's monteCarlo object the tolerances from your parts' data sheets.