An Interval Timer
(Designing a Printed Circuit Board)

Intro to Eng. II - Module 2
(Electrical Engineering)

Developed by
Robert J. Dirkman
Department of Electrical Engineering

Web Development by
Drew Pommet
Department of Electrical Engineering


Student's Guide - Part 2


Part 2. Component Variations Effects

Nominal Values and Tolerance

Nothing made is exact. If we try to produce something that is supposed to have some exact value or dimension, we would fail. We must specify, in addition to the values or dimensions we are trying to achieve, what variations we can allow in these things.

For example, consider a process to manufacture 470 ohm resistors. If we were to measure the resistors made by the process, none of them would be exactly 470 ohms. We would probably find some with values larger than 470 ohms and some with values less than 470 ohms. If the process is designed to make 10% resistors, we would find the resistance values may be as large as 470+47 ohms (517 ohms) and as small as 470-47 ohms (423 ohms). If the process is making 1% resistors, then we would expect the values to be between 465.3 and 474.7 ohms.

The exact value that a component, such as a resistor, is intended to have is called its nominal value, and variations about that nominal value are called its tolerance. The resistors mentioned above have tolerances of 10% and 1%. Resistors are often made with 5% tolerances, and even 0.1% tolerance resistors are available.

Generally the smaller the tolerance allowed in a component, the more expensive it is to make. Consequently, if cost is an issue in what we are making, it behooves us not to select components with unreasonably small tolerances if they are not really necessary.

Suppose we are designing a product made with a number of components. Our product undoubtedly has certain requirements or specifications which it must meet. Clearly the tolerances in the components going into our product will affect its behavior. It is usually not an easy task to determine what tolerances can be allowed in the components of our product so that the specifications can be met.

In this project we are concerned with how the components in the interval timer affect the timer's performance. To understand how component tolerances affect the overall behavior of the circuit, it is necessary to understand probability density functions.

What a Probability Density Function Is

Suppose we have a large number of balls in a container as shown in Figure 18. Each of the balls has a value between 0 and 1 printed on it. For example, the value on one of the balls may be 0.2368; another may have the value 0.9824. The values seem to be random.

To understand more about the nature of the values on the balls, we separate the balls into 10 bins as shown, each bin corresponding to a range of values. Bin 1 corresponds to the range between 0 and 0.1; bin 2 to the range between 0.1 and 0.2, and so forth. The ball with the value 0.2368 will be placed in bin number 3 for example, and the ball with the value 0.9824 will be placed in bin number 10. (Of course we will have to decide in which bin to place a ball if its number is exactly 0.0000, 0.1000, 0.2000, etc.)


Figure 18. Sorting the Balls into Bins

Figure 19(a) shows a typical result after we have sorted all of the balls. In this example, there are more balls with values between 0.4 and 0.5, than between 0.8 and 0.9 for instance; generally there are more balls in the bins in the middle ranges than in the end ranges.

(a) The Bins after All Values are Sorted (b) Corresponding Probability Density Function


Figure 19. Development of the Probability Density Function

The height of the sorted balls in the bins has a particular shape. We could represent this shape approximately by a continuous function as shown in Figure 19(b). This curve, properly normalized, is called the "probability density function". It can be used to determine what the probability is that the value on a randomly selected ball is within a particular range of values. This probability is related to the area under the probability density function as shown in Figure 20. The probability that the value on a ball is between 0 and 1 is 1. (It is certain.) Hence the total area under the curve is 1 as shown in Figure 20(a). The probability that the value is between 0.3 and 0.5 is the area under the curve between 0.3 and 0.5 as shown in Figure 20(b). It is more probable that the value on a selected ball will be between 0.3 and 0.5 than between 0.1 to 0.3.

(a) (b)

Figure 20. Interpretation of Area Under the Probability Density Function

Determining the Probability Density Function from Samples

Now suppose we have a huge number of balls in the container. (So many that it is not possible to sort them all.) We could get an estimate of the shape we obtained above by selecting enough balls at random. (That means that any ball in the container can be selected with equal likelihood.) We read the value of each ball and put a marker in the particular bin corresponding to the value as shown in Figure 21. Each ball is placed back in the container before another ball is selected at random. We repeat this process until we have enough markers to properly indicate the shape of the probability density function.

Figure 21. Bins Filled by Sampling Ball Values

This process, called "sampling", is how the probability description of a manufactured item would be determined. You can see that it is important to use enough samples, and the samples must be randomly selected.

The Uniform Distribution

The uniform distribution is an important probability density function. For this, any value is equally likely over a range of values as shown in Figure 22. Each bin would be filled to approximately the same height as shown in Figure 22(a). The continuous probability density function is shown in Figure 22(b).

Figure 22. A Uniform Distribution

The Probability Density Function for the Sum of 2 Uniformly Distributed Samples

Suppose we have 2 large sets of balls, each of which has a uniform distribution between 0 and 1. (Call 1 set of balls 'x', and the other set 'y' as shown in Figure 23.) We randomly select a ball from 'x' and a ball from 'y', add their values, and return the balls to their respective sets. We place a marker in the bin that corresponds to their sum. Note that the sum is necessarily between 0 and 2. We have chosen each bin to have a range of 0.1 units.

We continue selecting 2 samples and marking the sum until we have enough samples to define the shape of the function.


Figure 23. Bins for the Sum of 2 Random Values

The shape of the probability density function of the sum of two uniformly distributed values can be determined simply as follows:

Suppose, rather than continuous uniform distributions, the distribution of the values of the balls in the bins have only 10 possible values, namely, 0.05, 0.15, 0.25, ..., 0.95 as shown in Figure 24. We would say that this probability density function is "discrete". You can see that this discrete distribution is an approximation of the continuous distribution.

Figure 24. Discrete Approximation to a Uniform Distribution

Using the discrete distribution, we can determine a discrete distribution for the sum. The trick is to do this is as follows:

Select a particular value for the sum. (It can only be either 1, 2, 3, ..., 19.)

For the particular value for the sum, determine the number of ways this can be obtained by using the discrete values of the values to be added. The probability of this sum being produced is proportional to the number of ways it can be obtained.

This is represented in Figure 25 where the first three components of the distribution are shown with indications of how many ways they can be obtained.

Figure 25. Calculating the Distribution of the Sum of 2 Discrete Random Values

The results of calculating all of the possible sums is shown in Figure 26. Since there are 100 possible sets, [2(1+2+3+4+5+6+7+8+9)+10 = 100], then the actual probabilities for each outcome is found by dividing the number of possible ways to achieve a sum by. Hence the probability that the sum obtained by adding the values on a random 'x' and 'y' ball is 0.3 is 3/100 = 0.03.

Figure 26. Possible Sums and the Number of Ways They can be Obtained

Figure 27. Probability Distribution of the Sum

It is easy to see that for the continuous case, the probability distribution function would be as shown in Figure 28. (Why is the maximum value 1?)


Figure 28. Continuous Probability Distribution Function for the Sum

A More General Case

The probability distribution functions above all had random values distributed between 0 and 1. What would be the probability distribution if this were not so? Suppose that the 'x' values were uniformly distributed between 6 and 9, and the 'y' values were uniformly distributed between 3 and 5 for example. Clearly the sum has to be between 9 (6+3) and 14 (9+5), but what does the probability distribution function really look like. Using a technique equivalent to enumerating all of the possible ways a particular sum can be obtained, the distribution shown in Figure 29 would result.

Figure 29. The Distribution Function for the Sum of Two Random Values of Different Ranges

A Computer Technique for Determining Probability Density Functions: The Monte Carlo Method

It is possible to obtain probability density functions in the manner described above (by selecting balls from a container) but by using a computer to do the selecting. The general technique, termed the "Monte Carlo method", is conceptually very simple.

Basically the computer must be able to calculate outputs of concern for a given set of input parameters. It is the effect of variations, or tolerances, in these input parameters that are of concern. The program sets realistic values of these parameters by generating random numbers using the nominal values and tolerances or the parameters and makes a single run. The outputs, generated in this single run, are saved. Another set of parameter values are set using new random numbers and another run is made. The outputs again are saved. Enough runs are made so that the probability characteristics of the saved outputs can be determined.

The computer is fast enough so that it can run run enough cases in a reasonable amount of time to obtain the desired information.

Monte Carlo method requires that a routine for generating random numbers be available. Most programming languages have such a function built in, and that is true about FORTRAN.

APPENDIX B illustrates computer programs for determining probability density functions using the Monte Carlo method.

Part 2 Exercise: Probability Density Functions

The objective of these exercises is for you to get an appreciation of random numbers and the probability density function so that it can be applied to the interval timer behavior.

  1. Random Numbers and the Monte Carlo Method (Running the Programs in Appendix B)

    Logon to the VAX

    Copy the three files RAND1.FOR, RAND2.FOR and RAND3.FOR to your account using the following VMS command:

    $ COPY FACULTY$DISK:[DIRKMANR.FRESHMAN.PROJ]RAND*.FOR *.*

    Compile, link and run them using the following sequence of commands:

    $ FOR RAND1
    $ LINK RAND1
    $ RUN RAND1

    (Do the 20 numbers produced by RAND1 look like they are uniformly distributed between 0 and 1?)

    $ FOR RAND2
    $ LINK RAND2
    $ RUN RAND2

    (In RAND2, 10000 uniformly distributed random numbers with a range from 0 to 1 are sorted into 10 bins. Do the bins contain roughly the same values? They should. See Figure 22.)

    $ FOR RAND3
    $ LINK RAND3,FACULTY$DISK:[DIRKMANR.GRAPHER]CH_GRAPHDATA,CH_GRAPHLIB/LIB
    $ RUN RAND3

    (RAND3 generates a character plot, so it is necessary to link plot routines with RAND3.OBJ. This is what the LINK statement above does. Does the plot look like Figure 28? It should.)

  2. Modifying the Programs a Little

    a) Change RAND1.FOR (using the EDIT command) so that it uses a different value for the seed.

    Are the numbers it produces different from the original ones?

    b) Change RAND2.FOR so that the number of BINS used is 20 rather than 10.

    Are the values in the BIN array about half of the original values?


  3. Probability Density Function for the Sum of 3 Uniformly Distributed Random Numbers

    Modify RAND3.FOR so that it generates a plot of the probability function for the sum of 3 random numbers rather than 2.

    Use the approach suggested in Figure 19 to determine the probability density function on paper.

    To do this find the number of ways the discrete values of the following 2 probability density functions can be added to produce a particular sum of three numbers (The sum must be between 0 and 3).

    IMPORTANT: Don't do this by listing all the possible sums. Try to find a pattern.




  4. EXTRA: Sum of Values of 2 Uniformly Distributed Random Numbers with Different Ranges

    Modify RAND3.FOR so that it generates the probability density function for the sum of 2 random numbers. The first number is uniformly distributed between 3 and 5, the second number between 6 and 9. The resulting plot should look like Figure 29.

    Use 70 BINs between the value 8 and 15 (so each bin has a width of 0.1).

  5. Analysis of Effect of Component Variations on Time Interval

    When the tabular results of the measured time interval, resistance value, and capacitance value for the set of students are available (in the form of a spreadsheet), develop a probability density function as described below.

    Add the average and standard deviation to your "bins" plot.

    Notice that the ratio of the measured time to the calculated time is nearly constant with a value of about 1.06. This systematic error indicates a deficiency in the model used to derive the time interval equation.









    Go To Student Guide ToC || Part 3 || Timer Main Page || EASNE Page
    Last Updated: 8/15/96