#### Abstract

The roughness and uncertainty are important parameters of surface morphology. The least square middle line method is often used to estimate the roughness and its uncertainty. However, the roughness and its uncertainty obtained by the least square middle line method are inaccurate. This paper proposes a method to calculate exactly the roughness and its uncertainty by piecewise fitting the smooth B-spline filter assessment middle lines. A B-spline smoothing filter is selected to determine the assessment middle line of roughness. The B-spline filter can not only give the accurate roughness, but also obtain the smooth assessment middle line. The model of roughness uncertainty is proposed by piecewise fitting B-spline filter middle lines as the quadratic curves. The S-shaped test part is used to verify the model of roughness uncertainty.

#### 1. Introduction

Surface topography affects measurement accuracy, wear resistance, fatigue strength, and stability of fit, etc. It is an important factor to evaluate surface quality. The surface morphology is composed of the shape profile, waviness profile, and roughness profile. The roughness and its uncertainty are studied in this paper. The International Organization for Standardization (ISO) issued the corresponding surface roughness standard ISO 468-1982 in 1982 [1]. This standard stipulates some evaluation parameters of surface roughness, such as , and it also gives the selection criteria of evaluation length and sampling length. The roughness is often extracted from the surface morphology. More and more measuring instruments are used to get the surface morphology, such as the contact surface profiler [2], laser interferometric profiler [3], and noncontact digital optical profiler [4]. The contact surface profiler is the most commonly used instrument. It is used to measure the surface profile. Because it is connected with the computer, the surface profile information can display on the computer [2]. When the surface morphology is obtained, the method of extracting the roughness needs to be considered. However, the existing commercial software cannot accurately extract the roughness and calculate the uncertainty of roughness at the same time. The Gaussian filter which is included in the existing commercial software is the most common method to extract roughness at present. In ISO 11562, the Gaussian filter was adopted as a standard to calculate the roughness [5]. The development of the Gaussian filter is relatively mature. In order to decrease the amplitude deviation of the Gaussian filter, the cascaded first-order Butterworth filters and the cascaded moving average filters were used to extract the roughness. The combination of the two filters can decrease the amplitude deviation greatly [6].

However, the Gaussian filter has the edge effect and large fluctuation, which is not suitable for fitting the roughness assessment middle line [7]. Due to the large fluctuation of the middle line obtained by the general filter, the B-spline smoothing filter is proposed to obtain the middle line for the roughness evaluation. In ISO/TS 16610-22, the B-spline filter middle line was also adopted as a standard to evaluate the roughness [8]. The middle line obtained by the B-spline smoothing filter is relatively smooth, which is convenient for fitting the middle line subsequently. Generalized B-spline signal processing was proposed to process the band limited signals. The principle of the B-spline filter was given in detail [9]. Considering the smoothness of the B-spline filter middle line, it is convenient for us to fit the middle line.

When we know the expression of the fitted middle line, the uncertainty of roughness needs to be calculated. For the uncertainty of roughness, it usually refers to the indirect measurement of uncertainty, which is the A-type uncertainty [10]. Generally, the Guide to the Expression of Uncertainty in Measurement (GUM) method is used to calculate the uncertainty of indirect measurement. The GUM method is the standard to calculate the uncertainty [11].

Arencibia adopted the GUM method in combination with the coordinate measuring machine to calculate the uncertainty of roundness or cylindricity errors. Considering the correlation of variables, the uncertainty of the measurand was calculated by the GUM method [12]. The use of calibrated parts in ISO/TC 15530-3 is also a method to calculate the uncertainty. In 2017, paper [13] compared the GUM method and the ISO/TC 15530-3 method of evaluating flatness error uncertainty about an optical flat side. The ISO/TC 15530-3 method needs the calibrated parts and long-term experiments and the result of the GUM method differs greatly with the ISO/TC 15530-3 method, which makes the ISO/TC 15530-3 method inappropriate to verify the GUM method. In addition to the GUM method and the ISO/TC 15530-3 method, the Monte Carlo method (MCM) is also used to calculate the uncertainty [14]. Combining the Monte Carlo method with the theory of error ellipse, the Monte Carlo method is proposed to estimate the measurement uncertainty of circular characteristics [15]. The MCM and Bayesian estimation were combined to calculate the uncertainty, and the Bayesian principle was used to analyze the prior distribution information related to the MCM [16]. The Monte Carlo method relies on the choice of the number of experiments, while the adaptive Monte Carlo method (AMCM) can increase the number of experiments until the results are stable. Fang et al. evaluated the uncertainty in the linear model and nonlinear model by the AMCM [17]. However, both the MCM and AMCM have strict requirements on the distributions of measure parameters. When the distributions of measure parameters are uncertain, the uncertainty obtained by the MCM and AMCM will be inaccurate. However, the MCM and AMCM can still be used to verify the GUM method. Wen et al. chose the GUM method to calculate the uncertainty of cylinder error and used the adaptive Monte Carlo method to verify the results of the GUM method [18]. Cao et al. adopted two verification ways of the MCM to verify the GUM method: the interval comparison and the probability comparison, both of which are appropriate verification ways [19]. First, they calculated the uncertainty of roughness in the GUM method. Then the result of the GUM method was verified in the AMCM by the interval comparison.

From what have been discussed above, because the middle line obtained by the Gaussian filter is uneven, it is not convenient to fit the curves. This paper adopts the B-spline smoothing filter, which can obtain the smooth middle line. In this situation, the effect of fitting the B-spline middle line is better. All current articles fit the entire middle line, which makes the residual sum of squares of curves fitting rather big. This paper piecewise fits the B-spline smoothing filter middle lines to reduce the residual sum of squares of curves fitting. Furthermore, the middle line is often fitted as the straight line, which also increases the residual sum of squares. This paper adopts the quadratic curve to fit the middle line so that the fitted curves more clearly reflect the trend of the middle lines. The model of roughness is established based on the two quadratic fitting curves of the middle line. When we obtain the roughness model, the formulas of the uncertainty in GUM can be obtained considering the correlation between variables in the model. Then we can get the value of the uncertainty by calculating the formulas of the uncertainty. Finally, the AMCM verifies the proposed GUM method. The main works of this paper are given as follows:(1)We adopt the B-spline smoothing filter to obtain the smooth middle line.(2)We propose a piecewise fitting method of the B-spline smoothing filter middle line.(3)Substituting the straight line, we use the quadratic curve to fit the middle line.(4)We apply our method to the S-shaped test part and employ the AMCM to verify the proposed GUM method.

The structure of this paper is as follows: In Section 2, the roughness middle line is extracted by B-spline filtering, the roughness middle line is fitted, and the mathematical model of roughness is established. In Section 3, the formula of the GUM method is obtained. In Section 4, an experiment on S-shaped test part roughness is presented, and the results by the GUM method and the AMCM are analyzed and discussed. Section 5 draws a conclusion that the GUM method to calculate the uncertainty by fitting B-spline filter assessment middle lines is valid.

#### 2. The Roughness Model under the B-Spline Filter

##### 2.1. The Principle of the B-Spline Filter

The roughness middle line obtained by the B-spline filter is smooth and the B-spline filter can remove the influence of noise. Therefore, comparing with the Gaussian filter, it is more convenient to extract the roughness middle line. Then the middle lines are piecewise fitted. The principle of the B-spline filter [20] is the combination of the IIR digital filter and the B-spline function, namely, the series of IIR digital filter and weighted average filter, as shown in Figure 1. The amplitude deviation between the roughness middle lines extracted by the Gaussian filter and the two-stage cascade smooth B-spline filter is less than 1%, so the smooth B-spline filter with the two-stage cascade is selected to calculate the middle lines of roughness [21]. The transfer function formula of is shown as follows [17]:where the subscript 2 of represents the two-stage cascade and is actually the IIR digital filter function obtained based on . is obtained by the z-transform of the smooth B-spline coefficient . is the indirect B-spline transformation. The calculations of these variables are shown in Figure 1.

Assuming the horizontal coordinates of the sampling points are , the vertical coordinates are . is the number of the sampling points. According to the variational principles, the smooth processing of the B-spline filter is to determine the middle lines by calculating the minimum value of the following equation:where , , , is a positive parameter which is chosen according to the compromise processing between the data approximation and the filtering middle lines smoothing processing, and is the correction coefficient. By introducing the correction coefficient, the amplitude difference between the B-spline smoothing filter and Gaussian filter is decreased. is the interpolation function formed by the linear combination of B-spline basis functions. The interpolation function formula is defined as follows:where is the smoothing coefficient and is the B-spline function, which is defined aswhere is defined as follows:

The derivative formula of the interpolation function is given as follows:where is the first-order difference operator.

The second-order partial derivative formula can be obtained according to the same principle:where is the second-order difference operator.

Putting (6) and (7) into the right of (2), then we have

and then substituting (8) and (9) into (2), there is

Then we can convert (10) into the form of an inner product. In order to minimize , we should take the derivative of and let it be equal to 0. Next converting into a z-domain expression, there is

and then the expression of is obtained. The expression of is shown as follows:

and in (1) is transformed as follows:

Because the formula iswhere is the polynomial of and , the result of is given as follows:

Put (15) into (13) and as we all knowwhere is the angular velocity and is the number of sampling points.

The frequency response is shown as follows:

Johannes P. F. [22] demonstrated that when , the result of the smooth B-spline filter is similar to the Gaussian filter. Therefore, let and put it into (17). It is generally stipulated that the frequency response of the filter should be 50%. The calculation relation of is shown as follows:

and then the B-spline filter with the two-stage cascade is shown as follows:

##### 2.2. The Algorithm of the B-Spline Filter

is equivalent to the transfer function of the IIR digital filter. According to the principle of the IIR digital filter, is written as follows:

According to reference literature [23], can be decomposed into the product of two complementary factors:where is the amplitude of the two least conjugate complex roots of the characteristic polynomial of (20) and is the phase angle of the two least conjugate complex roots of the characteristic polynomial of (20).

Let be as follows:

Because is the IIR digital filter, the intermediate sequence of the IIR digital filter is set as . Equation (21) is transformed into the difference equation. Finally, the middle lines can be obtained through the indirect B-spline change. The process of obtaining the middle lines is shown as follows:

Because the B-spline filter is the two-stage cascade calculation, we need to run (23) again. In this way, the smooth B-spline filter middle lines can be obtained.

##### 2.3. The Roughness Model

The calculation formula of is shown as follows:where is the value of roughness, is the value of the peak of wave, and is the value of the trough of wave.

Suppose is the point of the peak of wave and is the point of the trough of wave. The middle lines are fitted according to the results of the B-spline filter. Because the trend of surface morphology is arbitrary and the trend of the middle line is also arbitrary, the residual sum of squares about curves fitting is rather big if we fit the whole B-spline filter middle line. Only the middle line near the segments of the peak of wave and the trough of wave has a big significance in later calculations. So we can only fit the middle lines near the segments of the peak of wave and the trough of wave. The residual sum of squares is relatively small in this method, which makes the fitted middle lines more representative. In this paper, a polynomial fitting method is used to obtain the middle lines expression near the peak and trough of wave. The higher the number of polynomials is, the more time will be consumed. Some useful information will be lost. For a normal surface, it is sufficient to use a quadratic curve to fit the expressions near the parts of the peak and trough of wave. In fact, we only need to fit the expressions of the two curves near the points of and . Suppose , is correct; then the fitted curves are

According to (25), the formula of roughness can be obtained as follows:

#### 3. Uncertain Calculation Formula

The formula of the GUM method is as follows [24]:where .

According to formula (26), there are 10 variables: , and these variables are related to each other. Therefore, putting formula (26) into formula (27), we can obtain the calculation formula of roughness uncertainty shown as follows:

The uncertainty of roughness is as follows:

The calculation formulas of the above partial derivatives are

The uncertainty of roughness can be obtained by putting partial derivative formulas (40) into the above equations ((28)-(39)).

#### 4. Experiment of the S-Shaped Test Part

The S-shaped test part is the latest test part. The S-shaped test part can improve the defects of some samples with low processing precision. In recent years, the S-shaped test part [25, 26] has been studied by more and more researchers. The roughness data of the S-shaped test part is obtained by contact surface profiler 2300A-RC. The least resolution of the profiler is 0.6 nm in the vertical direction and 1 *μ* in the horizontal direction. The measuring range of the profiler is 2000 . The temperature is controlled at °. The humidity is 65% RH. The B-spline filter was selected to process the original profile of the S-shaped test part, and at the same time we can obtain the roughness assessment middle line. When the contact surface profiler measures the roughness, it can obtain that the approximate is about 4 *μ*. The value is not accurate. It merely provides a basis for the choice of sample length and evaluating length. Because is about , we choose the sample length to be and the evaluating length to be . We select 5 groups of original contour data from the same position in Figure 2 to calculate the uncertainty of roughness.

By B-spline filtering, we can get 5 groups of roughness and their corresponding peaks and troughs of wave, as shown in Table 1.

The mean value of roughness calculated by B-spline filtering is . Then, the quadratic curve fitting is carried out at the positions of the peaks and troughs of wave. The coefficients of curve expressions are shown in Table 2.

In Table 2, is the quadratic term coefficient of the curve near the peaks of wave, is the first term coefficient of the curve near the peaks of wave, is the constant term coefficient of the curve near the peaks of wave, is the quadratic term coefficient of the curve near the troughs of wave, is the first term coefficient of the curve near the troughs of wave, and is the constant term coefficient of the curve near the troughs of wave. The roughness calculated by the curve fitting is shown in Table 3. By comparing the roughness calculated by the curve fitting with the roughness calculated by the B-spline filter, the results are shown in Table 3.

It can be seen from Table 3 that the roughness calculated by the fitted curve is almost the same as the roughness calculated by the B-spline filter, indicating that the fitting curve effect is good. The roughness in Table 3 is approximately . It can be obtained by combining the values of 10 variables in Tables 1 and 2, and then the covariance matrix of these 10 variables can be calculated as shown in Table 4.

It can be seen from Table 4 that the variables are correlated, the correlations of these variables should be taken into account when calculating the uncertainty. Then, the above data is put into the uncertain calculation formula, and the result of uncertainty is . Subsequently, the GUM calculation results are verified by the AMCM. The results are shown in Table 5. The figure of uncertainty in the AMCM is shown in Figure 3.

In Figure 3, the two red dotted lines refer to the confidence lower limit of 2.5% and the confidence upper limit of 97.5%, respectively.

In Table 5, is the average roughness, is the uncertainty of roughness, and and are calculated according to the following formula:where is the left endpoint of the 95% confidence interval calculated by GUM, is the left endpoint of the 95% confidence interval calculated by the AMCM, is the right endpoint of the 95% confidence interval calculated by GUM, and is the right endpoint of the 95% confidence interval calculated by the AMCM.

Because and are less than the tolerance 0.05, it indicates that under the smooth B-spline filter the uncertainty obtained by the GUM method is validated. The uncertainty calculated by the GUM method is accurate and can be used in the industrial field.

#### 5. Conclusions

In this paper, the roughness evaluation middle line is obtained by the B-spline filter. The roughness evaluation middle line expression is obtained by fitting the positions of the peaks and troughs of wave, respectively. The roughness calculated by the fitted roughness middle line is roughly the same as that obtained by the B-spline filter, which indicates that the roughness middle line expression is accurate. According to the expression of the roughness evaluation middle line, the uncertainty calculation formula of the GUM method is proposed. Finally, by the verification of the AMCM, it can be concluded that the GUM method under the B-spline filter model could be used to calculate the uncertainty of roughness.

By piecewise fitting quadratic curves of the B-spline filter assessment middle lines, the uncertainty of roughness is obtained. The tertiary or higher curves can be considered to fit the assessment middle lines in the future. In addition, the uncertainty of surface waviness can be carried out by extending this method.

#### Data Availability

The data of the roughness is obtained by profile surface morphology measuring instrument 2300A-RC. By measuring 5-group surface morphology of the S-shaped test part, we can extract the roughness from the 5-group surface morphology using the B-spline filter. Because we only need a 4 mm evaluating length according to ISO 468-1982, we select 4000 points of the data to calculate the roughness. The 4000 is calculated by the 4 mm evaluating length and the time interval of selecting one point. The time interval of selecting one point is 0.001 s. When we have obtained the roughness mathematical model, the uncertainty of roughness in the GUM method can be calculated.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

The authors gratefully acknowledge the support of the open fund of the Tianjin Key Laboratory of Equipment Design and Manufacturing Technology (Tianjin University). This work was supported by the National Natural Science Foundation of China (No. 51675378) and the National Science and Technology Major Project of China (No. 2015ZX04005001).