ITERATIVE SOLUTION OF LEAST-SQUARES PROBLEMS APPLIED TO FLATNESS AND GRID MEASUREMENTS HAN HAITJEMA Dimensional Metrology section, NMi Van Swinden Laboratory, PO Box 654 2600 AR Delft, The Netherlands fax +31 15 26 12 971, e-mail
[email protected] Published in: Advanced tools in Metrology II, P.Ciarlini, M.G.Cox, F. Pavese & D. Richter © 1996 World Scientific Publishing Company
ABSTRACT This paper describes an iterative method which can be applied to geometrical problems in which a large number of measurements are available out of which a large number of parameters are to be calculated. The method is based on the fact that a minimum sum of squared differences between an assumed value of a parameter and a number of independent measurements, is achieved when the parameter has the average value. This principle is applied to the problem of flatness measurement with a gradient measuring device such as an electronic level (typically 180 measurements, 100 parameters for a 10 x 10 grid) and to the measurement of a grid using distance measurements along the axes and along the diagonals (e.g. 342 measurements, 200 parameters for a 10 x 10 grid). The type A uncertainty of the result is estimated from simulated measurements in which simulated random measurements are superimposed on exact measurements derived from the known solution. This enables the derivation of uncertainties in coordinates relative to a defined orientation; e.g. the minimum zone plane in flatness measurements. It is shown that in both problems an uncertainty in the results can be achieved which is about equal to the uncertainty of the single measurements. Methods are proposed to combine these uncertainties with type B uncertainties such as an uncertainty in the temperature gradient in flatness measurements or the temperature uncertainty in grid measurements.
1. Introduction Many problems in the area of geometrical measurements can be regarded as least-squares problems with a limited amount of parameters. Examples are the calculation of planes, spheres, cylinders etc out of coordinate measurements. Some problems, however, request the calculation of a large number of parameters which can be of the order of the number of measurements. Moreover a problem can appear as a non-linear least squares problem in which case a standard solution method is not available.
In this paper an easy applicable method is proposed by which at least the problem of flatness measurement using electronic levels, and the problem of measuring a 2-D grid using 1-D measurements along the axis and the diagonals, can be solved. In general, the covariance matrix which is part of the least squares method provides estimates for the typeA uncertainties in the calculated parameters. In our cases, where this matrix is not available, uncertainties are estimated using a Monte-Carlo method. Parts of this paper have already been published in separate papers with applications and measurement examples in flatness1,2 and grid (ball-plate)3 measurements. 2. Measurement Methods The measurements for which the evaluation has been developed are rather different but as will be shown the evaluation method is very similar. 2.1 Surface plate measurement It is assumed that a surface plate is measured using electronic levels. One level has a constant position and corrects for vibration and movement of the surface plate, the other measures the height differences between two points on a rectangular grid. This level and its positioning on the grid are illustrated in figure 1.
Fig.1.
Positioning of a level to measure a surface plate
In this example, the measured value mx(1,2) can be expressed as: mx(1,2) = z(2,2) - z(1,2) The measurement in x- and y direction of all height differences gives 24 measurements from which 16 height coordinates are to be derived. 2.2 Grid measurement In this type of measurements, the mutual distances between points on a grid are measured in the x-direction, the y direction and along two diagonal directions. Figure 2 gives the layout for measurements on a 6 x 4 grid. In this example, 68 measurements are taken from which 48 coordinates are to be derived. The method in which this calculation is carried out is given in section 3.
Fig 2. Example of a measured grid. The arrows indicate the measurement directions
3. Evaluation method The appropriate method to derive parameters (height coordinates and coordinates respectively) from the measurements is the least squares method. With this method, the sum of squares of differences between measurements and the derived values is minimized. Assuming a standard deviation of unity in the measurements, the ’squared sum’ Q2 for the case of flatness measurements is: 2 2 2 Q = ∑(z(i+1, j) - z(i, j) - mx(i, j)) + (z(i, j+1) - z(i, j) - my(i, j)) (1) i, j
The minimum value of Q2 is called 2 (chi-square). The minimization using matrix algebra has been carried out by Birch4. The iterative solution method is as follows: A point is considered at a position (i,j) in the grid. Assuming that the neighbouring points have fixed height values, there are four measurements z1..z4 which determine z(i,j): z1 = z(i-1,j) + mx(i-1,j) z2 = z(i+1,j) - mx(i,j) z3 = z(i,j-1) + my(i,j-1) z4 = z(i,j+1) - my(i,j) The terms of the sum Q2 in (1) which contain z(i,j) are: Q2 = (z(i,j)-z1)2 + (z(i,j)-z2)2 + z(i,j)-z3)2 + (z(i,j)-z4)2
(2)
The minimization of Q2 consists of putting ∂Q2/∂z(i,j) equal to zero for each i and j. This gives: z(i,j) = (z1 + z2 + z3 + z4)/4 (3) This is an elaborate way to prove that the best estimate for z(i,j) is the average of the 4 estimates which are obtained relative to its neighbours. Points at the corners and the edges are treated analogously taking account of 2 and 3 neighbouring points respectively. So Q2 reaches its minimum 2 when equation (3) is valid for all grid points. This implies that Q2 can be minimized by iteration: all grid points are adjusted using equation (3) until this equation holds for all height coordinates z(i,j) and the function Q2 approaches its minimum. Analogously, the problem of solving the coordinates from the distance measurements in the grid measurement can be formulated. Assuming a standard deviation of unity in the measurements, the ’squared sum’ Q2 can be written as:
k
2 2 2 Q = ∑[ x a - x b) + ( ya - y b) - m i ] 2
(4)
i=1
where mi is the measured distance nº i between the points with coordinates (xa,ya) and (xb,yb), where a and b change with i, and k is the total number of measurements. Putting the derivative of Q2 to xa (or any other coordinate) equal to zero does not lead to a set of linear equations. Therefore, the rigorous method for linear least squares problems cannot be used here and also compared to the flatness measurements the problem is more complicated. To come to an iterative procedure which minimizes equation (4), one point is considered which is surrounded by 8 neighbouring points. 8 measurements are available giving the distance between the point and its neighbours. This is illustrated in figure 3.
Fig.3. Distance measurements mi of point (x,y) to its neighbouring points
Assuming that all neighbouring points are fixed, equation (4) reduces to: 8
2 2 2 Q = ∑[ ( x i - x ) + ( y i - y ) - m i ] 2
(5)
i=1
The problem can be further reduced considering the two measurements in the x-direction: m1 and m5. In this case, a small variation of x has a much larger influence on Q2 than a small variation of y. Neglecting the terms (y1-y)2 and (y5-y)2 in Q2 and putting ∂Q2/∂x equal to zero leads directly to the solution: ( - ) ( + ) x = x 1 m1 + x 5 m 5 (6) 2 2 This means that the optimum position of the solution is in-between the points which are predicted from the right and the left. So it is the average of the positions determined by m1 and m5. The same applies for the y-direction considering measurements m3 and m7. Also, this applies for the diagonal directions when the coordinate system is rotated 45°. Like in the flatness problem, the edge- and corner points are treated analogously. This consideration leads to the following definition of the new position (x,y) which is similar to the flatness problem: The best estimate of the coordinates x and y are the averages of the 8x2 coordinates which are determined taking each measurement into account and the coordinates of the surrounding point to which the distance has been measured. The iteration procedure consists of adjusting all the positions (x,y) and repeating this for the complete grid until all the positions satisfy the above condition. Then, also the squared sum Q from equation (4) reaches a minimum. When these procedures are implemented, the following points are to be noted: 1. All parameters (coordinates) are given nominal values as starting points. 2. The points at the edges and the corners of the grid are treated in an analogous way.
3. After each iteration in which all parameters are adjusted, the orientation is recovered; in the flatness problem by taking the least squares plane; in the grid problem by transforming the coordinates such that the lower-left point is (0,0) and the y-coordinate of the lower-right point is 0. 4. The iteration is repeated until the relative change in Q2 is less than 10-4 between successive iterations. This assures that the ’real’ minimum is closely approached: typically to less than 1% for Q2 and that further iteration will not lead to significant changes in the derived coordinates. 5. Some under-relaxation is used to prevent the solution from oscillating. The minimum value of Q2, 2, is used in uncertainty estimations as this value can be compared with simulated measurements with a known measurement uncertainty. 4. Uncertainty estimation 4.1 Estimation method The influence of a known uncertainty of the measurements on the final results is estimated by a Monte Carlo method. This is carried out as follows. First, nominal values of all coordinates are assumed. From these assumed coordinates simulated measurements are derived which can be regarded as exact measurements as they will result in the same nominal values when they are used as input measurements to the least-squares iteration procedure. Then these measurements are randomized by adding a Gaussian distributed random number r with zero mean and a unit standard deviation multiplied by the input uncertainty si. For the flatness measurement, with known height coordinates z(i,j), this means: mx(i,j) = z(i+1,j) - z(i,j) + r⋅si
(7)
For the grid measurement, with known coordinates (xa,ya) and coordinates of a neighbouring point (xb,yb) this means: 2 2 mi = ( x a - x b ) +( y a - y b ) + r_ s i
(8)
In practice, this method is somewhat modified to give a closer correspondence with the measuring process. The measuring process is such that measurements along one line are taken and that each measurement consists of measuring the distance to a hypothetical zerovalue which is the same for each line. 4.2 Uncertainty in flatness coordinates relative to the least-squares plane The uncertainty in coordinates relative to the least-squares plane can be presented in a generally valid way for each grid size. This is because the change of the positioning of the least-squares plane due to measurement uncertainty is not dependent on the real height coordinates. Therefore, the nominal z-coordinates can all be taken equal to zero and the results of the simulated measurements for a given grid size hold for all grids of this size. As an example, figure 4 gives the uncertainty for each z-coordinate on a 15 x 10 grid when the measurement uncertainty is unity. The figure shows that the uncertainty is highest in the corners (0,95) and lowest near the centre (0,62).
Fig.4. Uncertainty of height coordinates relative to the least-squares plane
As a final estimate for the uncertainty in each point in this configuration we take the root mean square (RMS) value of the standard deviation in all points. Similar simulations have been carried out by Meijer5 for a somewhat different calculation method. 4.3 Uncertainty in grid coordinates The standard deviations in the coordinates for a 5x5 equidistant grid are shown graphically in figure 5. In this figure, the scale for the coordinates can be considered as mm or cm. The standard deviations (the error bars in the figure) are in m assuming that si is 1 m.
The RMS (Root-Mean-Square) standard deviation in each x- or y coordinate is 1,16 times the input uncertainty si. The figure shows that the largest standard deviation is in the xcoordinate at position (0,16). This is due to the fact that the y-coordinate of point (16,0) is put equal to zero. The choice of a more stable reference point and reference orientation would diminish the uncertainty somewhat. A choice could be: define the centre of all coordinates as (0,0) and take the average slope of the least-square lines in the x-direction as the reference direction. In this case, however, all coordinates differ from zero which gives less insight in their positions. A measure of the uncertainty which is independent of the orientation of the grid is the standard deviation in the distance between two points. In the above-mentioned example this standard deviation proves to be nearly equal to the standard deviation of the input measurements si. This also applies for the results for different grid sizes. 5. Combining simulations with type-B uncertainties In both measurement problems the main type-B uncertainties are related to temperature. In the case of flatness measurements an uncertainty source is the uncertainty in the temperature gradient over the surface plate. An uncertainty in the temperature gradient can be taken into account in the simulations. This is carried out by correcting the measurements for a temperature gradient ∆T of: ∆T = ∆T + r.u( ∆T ) (9) with r being a random number with zero mean and unit standard deviation and u( ∆T ) being the uncertainty in the temperature gradient. This correction is to be applied for each complete simulation with the random number varying between each complete grid calculation. A drift in the level readings results in a torsion of the measured surface. However, in terms of uncertainty it has a similar effect as an uncertainty in the temperature gradient. The same method applies for the grid measurements: the grid can be given different temperatures for each simulation. However in this case a temperature uncertainty can be easily expressed as relative length uncertainty which can be (quadratically) added to the type-A uncertainty which results from the simulations. Inclusion of these uncertainties in the simulations is especially useful if it is not clear how the uncertainties combine for certain parameters; e.g. for the total flatness deviation of a surface plate.
6. Further applications and conclusion The method outlined in this paper can be applied to other geometric measurement problems such as patterns which are not square, 3-D ball structures etc. In the two examples in this paper it has been shown that the uncertainty in the finally calculated parameters is about the same as the uncertainty in a single measurement. The Monte-Carlo simulation technique enables the use of the redundancy in the measurements to obtain an estimate of the uncertainty in each calculated parameter.
7. References 1.
H.Haitjema, Uncertainty propagation in surface plate measurements, Proceedings of the 4 International Symposium on Dimensional Metrology (IMEKO, Tampere, 1992) p. 304. H. Haitjema, Calibration of a 2-D grid using 1-D length measurements, Proceedings of the XIII IMEKO world congress(IMEKO, Torino,1994) p. 1652. H. Haitjema and J. Meijer, European Journal Mech. Eng. 38 (1993) 165. K.G.Birch & M.G.Cox, Calculation of the flatness of surfaces: a least-squares approach, (National Physical Laboratory MOM report No. 5, Teddington, 1973). J.Meijer, From Straightness to Flatness, (Thesis Twente University, 1989). th
2.
3. 4. 5.