Electronic – Does the LT Spice monte carlo simulation definitely output the max and min voltage for any number of simulation runs

ltspicemonte carloresistorssimulationtolerance

I have the following circuit, in which i need to calculate max and min voltages possible (considering resistor tolerance).
enter image description here
Does running a monte carlo simulation consider the absolute max and min values of voltage output that can be obtained at every point in the circuit, or is it purely based on number of iterations in the step command? Basically, if I do only two rounds of simulation, I must get the absolute max and min voltages at every point in the circuit. Is this method the right one for my needs? If not, please provide a step-by-step solution for my case.

Best Answer

A brute force solution can be implemented using the following number system.
This described method will cover the minimum and maximum result.
For example, using a decimal number system, you can specify the tolerance by 10 values.
The number of digits is the number of components you want to vary.

ABCD
0000  all components have their minimum value
0001  
0002
....
0009 components A,B and C have their minimum value and component D its maximum value
....
9999 all components have their maximum value

Now, using the LSpice directive .step param run 0 9999 1 you can use the run parameter to define the value of each component.

Using floor() you can select the component, e.g. component C is selected by floor(run/10)-floor(run/100)*10.
(Note that the divisors are powers of 10, because a decimal number system is used. For other number systems, corresponding divisors must be used).

In the decimal number system, we have 10 tolerance values. Spreading them evenly, the digit has to be subtracted and then divided by (10-1)/2. So, digit value "0" gives -1, digit value "9" gives +1.

With these notes, if the value for component B is e.g. 680Ω 1% the LTspice resistor value becomes R={ 680 * (1 + 0.01*( floor(run/10)- floor(run/100)*10 -4.5)/4.5 )}

Below is a comparative result. I didn't have the diode, so I left it out. The first waveform is the total result, the second waveform zoomed in at the maximum values, the third waveform zoomed in at the minimum values, the last waveform is showing the values of the resistors.

enter image description here