When any electronic device is designed, we can use several deterministic methods for calculating its main parameters. So, we can get the parameters that we measure physically in any device or system. These preliminary calculations allow the development and their results are usually agreed with the prediction. However, we know that everything we manufacture is always subject to tolerances. And these tolerances cause variations in the results that often can not be analyzed easily, without a powerful calculation application. In 1944, Newmann and Ulam developed a non-deterministic, statistical method called Monte Carlo. In the following blog post. we are going to analyze the use of this powerful method for predicting possible tolerances in circuits, especially when they are manufactured industrially.
In any process, the output result is a function of the input variables. These variables generate a response which can be determined, both if the system is linear and if it is not linear. The relationship between the response and the input variables is called transfer function, and its knowledge allows us to get any result concerning the input excitation.
However, it must be taken in account that the input variables are random variables, with their own distribution function, and are subject to stochastic processes, although their behavior is predictable through the Theory of Probability. For example, when we make any measure, we get its average value and the error in which can be measured that magnitude. This allows to limit the environment in which it is correct and decide when the magnitude behaves incorrectly.
For many years, I have learned to successfully transform the results obtained by simulations in real physical results, with predictable behavior and I got valid conclusions, and I have noticed that in most cases the use of the simulation is reduced to get the desired result without studying the dependence of the variables in that result. However, most simulators have very useful statistical algorithms that, properly used, allow to get a series of data that the designer can use in the future, predicting any system behavior, or at least analyzing what it can happen.
However, these methods are not usually used. Either for knowledge lack of statistical patterns, or for ignorance of how these patterns can be used. Therefore, in these posts we shall analyze the Monte Carlo method on circuit simulations and we shall discover an important tool which is unknown to many simulator users.
DEVICES LIKE RANDOM VARIABLES
Electronic circuits are made by simple electronic devices, but they have a statistical behavior due to manufacturing. Device manufacturers usually show their nominal values and tolerances. Thus, a resistance manufacturer not only publishes its rating values and its dimensions. Tolerances, stress, temperature dependance, etc., are also published. These parameters provide important information, and propertly analyzed with a powerful calculation tool (such as a simulator), we can predict the behavior of any complex circuit.
In this post, we are going to analyze exclusively the error environment around the nominal value, in one resistor. In any resistor, the manufacturer defines its nominal value and its tolerance. We asume these values 1kΩ for the nominal value and ± 5% for its tolerance. It means the resistance value can be found between 950Ω and 1,05kΩ. In the case of a bipolar transistor, the current gain β could take a value between 100 and 600 (i.e. NXP BC817), which may be an important and uncontrollable variation of current collector. Therefore, knowing these data, we can analyze the statistical behavior of an electronic circuit through the Monte Carlo method.
First, let us look resistance: we have said that the resistance has a ± 5% tolerance. Then, we will analyze the resistor behavior with the Monte Carlo method, using a circuit simulator. A priori, we do not know the probability function, although most common is a Gaussian function, whose expression is well known
being μ the mean and σ² the variance. Analyzing by the simulator, through Monte Carlo method and with 2000 samples, we can get a histogram of resistance value, like it is shown in the next figure
Monte Carlo algorithm introduces a variable whose value corresponds to a Gaussian distribution, but the values it takes are random. If these 2000 samples were taken in five different processes with 400 samples each one, we would still find a Gaussian tendency, but their distribution would be different
Therefore, working properly with the random variables, we can get a complete study of the feasibility of any design and the sensitivity that each variable shows. In the next example, we are going to analyze the bias point of a bipolar transistor, whose β variation is between 100 and 600, being the average value 350 (β is considered a Gaussian distribution), feeding it with resistors with a nominal tolerance of ± 5% and studying the collector current variation using 100 samples.
STATISTICAL ANALYSIS OF A BJT BEHAVIOR IN DC
Now, we are going to study the behavior of a bias circuit, with a bipolar transistor, like the next figure
where the resistors have a ±5% tolerance and the transistor has a β variation between 100 and 600, with a nominal value of 350. Its bias point is Ic=1,8mA, Vce=3,2V. Making a Monte Carlo analysis, with 100 samples, we can get the next result
Seeing the graph form, we can check that the result converges to a Gaussian distribution, being the average value Ic=1,8mA and its tolerance, ±28%. Suppose now that we do the same sweep before processing, in several batches of 100 samples each one. The obtained result is
where we can see that in each batch we get a graph which converges to a Gaussian distribution. In this case, the Gaussian distribution has an average value μ=1,8mA and a variance σ²=7%. Thus, we have been able to analyze each process not only like a global statistical analysis but also like a batch. Suppose now that β is a random variable with an uniform distribution function, between 100 and 600. By analyzing only 100 samples, the next graphic is got
and it can be seen that the current converges to an uniform distribution, increasing the current tolerance range and the probability at the ends. Therefore, we can also study the circuit behaviour when it shows different distribution functions for each variable.
Seeing that, with the Monte Carlo method, we are able to analyze any complex circuit behavior in terms of tolerances, in the same way it will help us to study how we could correct those results. Therefore, in the next posts we shall analyzed deeply this method, increasing the study of its potential and what we can be achieved with it.
CORRECTING THE TOLERANCES
In the simulated circuit, when we have characterized the transistor β like an uniform random variable, we have increased the probability into unwanted current values (at the ends). This is one of the most problematic features, not only on bipolar transistors but also on field effect transistor: the variations of their current ratios. This simple example let see what happens when we use a typical correction circuit for the β variation, like the classic polarization by emitter resistance.
Using this circuit and analyzing by Monte Carlo, we can compare its results with the analysis obtained in the previous case, but using 1000 samples. The result is
where we can check that the probability values have increased around 2mA, reducing the probability density at the low values of current and narrowing the distribution function. Therefore, the Monte Carlo method is a method that not only enables us to analyze the behavior of a circuit when subjected to a statistical, but also allow us to optimize our circuit and adjust it to the desired limit values. Used properly, it is a powerful calculation tool that will improve the knowledge of our circuits.
In this first post, we wish to begin a serie dedicated to Monte Carlo method. In it, we wanted to show the method and its usefulness. As we have seen in the examples, the use of Monte Carlo method provides very useful data, especially with the limitations and variations of the circuit we are analyzing if we know how they are characterized. On the other hand, it allows us to improve it using statistical studies, in addition to setting the standards for the verification of in any production process.
In the next posts we shall go more in depth on the method, by performing a more comprehensive method through the study of a specific circuit of one of my most recent projects, analyzing what the expected results and the different simulations that can be performed using the method of Monte Carlo, like the worst case, the sensitivity, and the post-production optimization.
- Castillo Ron, Enrique, “Introducción a la Estadística Aplicada”, Santander, NORAY, 1978, ISBN 84-300-0021-6.
- Peña Sánchez de Rivera, Daniel, “Fundamentos de Estadística”, Madrid, Alianza Editorial, 2001, ISBN 84-206-8696-4.
- Kroese, Dirk P., y otros, “Why the Monte Carlo method is so important today”, 2014, WIREs Comp Stat, Vol. 6, págs. 386-392, DOI: 10.1002/.