{'fraction_non_alphanumeric': 0.0332070529909733, 'fraction_numerical': 0.015574575557738179, 'mean_word_length': 4.661106698437914, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Procedure for Determining the Uncertainties in the Modeling of Surface Roughness in the Turning of NiTi Alloys Using the Monte Carlo Method

The paper presents a procedure for the determination of uncertainties in the modeling of surface roughness in the turning of NiTi alloys. The presented procedure is applicable both to the analysis of the measurement values of the two main roughness factors, as well as to research related to the prediction and optimization of the machining process. Type A and B, total, and expanded uncertainties were considered herein, and the obtained uncertainty values were assessed. A procedure for optimizing machining by applying the Monte Carlo (MC) method is also presented. The solutions presented in this paper are important from the point of view of practical solutions related to the prediction and optimization of the machining process. The considered procedure for determining and assessing uncertainty can be useful for the optimal selection of both machining parameters and measuring tools.


Introduction
The dynamic development of science in the modern world is strongly correlated with the demand for more and more new construction materials with properties adapted to new technologies [1][2][3][4][5]. However, it should be remembered that the practical use of these materials is inextricably corresponded to the methods of their production and treatment. In order to manufacture new products from difficult-to-machine materials, such as shape memory alloys, titanium alloys, nickel alloys, and special ceramics, there is a need to search for more and more effective treatment methods that exceed technological barriers [6][7][8][9].
Modern machining processes, especially of difficult-to-cut materials, which are widely used in industry, should ensure the best possible quality, efficiency, economy, reliability, and environmental friendliness of products [1,3,10].
Shape memory TiNi alloys are materials with unique functional properties, but at the same time have very favorable parameters in terms of mechanical strength, fatigue strength, specific weight, resistance to corrosion and aggressive environments, etc. For this reason, there is a great interest in these materials in the industry of modern instruments or mechanical systems used in technology and medicine [11][12][13][14][15]. However, in order to maintain their high position as construction materials, the costs of their treatment should be reduced. The problems associated with the machining of these alloys do not allow for higher cutting parameters to be achieved, and thus impede an increase in the machining efficiency while maintaining the appropriate quality of the surface layer. The main problems in the machining of TiNi alloys are related to high cutting temperatures and rapid tool wear, poor surface quality and cutting process efficiency, burr formation, and continuous chip, which is difficult to control [8,13,[15][16][17][18][19][20][21][22][23].
Thus far, the priority in the industry has been to obtain the high-quality parameters of products made of NiTi alloys. The second in the hierarchy is the cost of their production. It can be expected that, in the future, due to the need to reduce and optimize production costs, research efforts will be directed toward the processes of shaping NiTi alloy elements using methods that ensure maximum efficiency while maintaining a good quality of the machined surface [6,[11][12][13].
Due to the high requirements for elements made of NiTi alloys and the simultaneous need for effective machining of materials, the need to optimize the processes of such machining is evident. Despite the great advancement of research in the field of forecasting and optimization of the various machinability indices (surface roughness, tool wear, etc.) in relation to the processing of various construction materials, the literature lacks or highlights difficulties in finding items for which a detailed assessment of the issues related to prediction and optimization of surface roughness in the process of turning shape memory alloys has been carried out [7].
The guidelines for NiTi alloy machining presented in the scientific literature, which are based on the results of fragmentary experimental studies, are usually insufficient. In industry, cutting parameters are very often selected based on the experience of machine operators and programmers and on the recommendations of tool manufacturers in order to obtain an appropriate quality of the machined surface.
The machining process is characterized by a large number of parameters that affect it, which means that achieving optimal process efficiency while maintaining the required product quality is impossible, even for a highly qualified employee. The most unfavorable effects of this approach are the deterioration of product quality, an increase in operating costs and treatment time, a decrease in productivity, etc. [1][2][3]6,24].
Surface roughness is a measure of the technological quality of a product and a factor that has a large impact on the cost of production. Achieving the desired roughness value is a repetitive and empirical process that can be very time consuming. The mechanism of surface roughness formation is also very complicated and process-dependent; therefore, it is very difficult to calculate its value by using an analytical formula. The various theoretical models proposed in the relevant literature are not sufficiently accurate and are only applicable to a limited range of processes and cutting conditions, or must be used in connection with complicated diagrams or statistical tables. Therefore, an appropriate procedure is needed that can allow the surface roughness value to be assessed prior to the machining of the material, while being easy to use in industry and helping to minimize the time and cost of treatment. Moreover, such a procedure could be used to determine the appropriate cutting conditions to obtain the specific surface roughness [3,[24][25][26][27][28][29][30][31].
Analyzing the relevant literature regarding the prediction and optimization of machining processes, it can be easily noticed that the current trend is the use of ANNs, GAs, RSM, and the Taguchi procedure for these purposes. The authors of this study note that despite the many application possibilities of the MC method [46][47][48][49][50][51][52], its application for solving the problems related to the prediction and optimization of machining has not been given much attention in the literature. This comment also applies to the analysis and assessment of the uncertainties [63] related to the above-mentioned prediction and optimization procedures. The developed model of surface roughness prediction together with the uncertainty determination procedure can significantly reduce the cost of machining of shape memory alloys while maintaining the optimal quality of the machined surface.
Taking into account the above literature review, this paper presents a procedure for determining the uncertainties, together with their analysis, in the modeling of surface roughness in the turning of NiTi alloys by employing the MC method. For the purposes of applying the MC method, the pseudorandom number generator with a uniform distribution was used [64]. The procedure presented here makes it possible to easily evaluate the suitability of the obtained results in the field of machining and, therefore, to choose other solutions in the event of obtaining unsatisfactory uncertainty values.

General Assumptions
Experimental tests for the purpose of determining a mathematical model were carried out for the operation of precision turning of a 6.38 mm shaft, made of the shape memory alloy β-NiTi (nitinol) with the following chemical composition: 52.85 at.% Ni and 47.15 at.% Ti. Machining was carried out dry in an air atmosphere. A CCMT 060202 polycrystalline diamond (PCD) plate (Iscar, Tel Aviv-Yafo, Israel) was used for the treatment. The research plan to determine the impact of three independent factors, namely, feed ( f (mm/rev)), depth of cut (a p (mm)), and cutting speed (v c (m/min)), on the values of the selected factors Sa and Sz (i.e., 3D areal surface texture parameters) of the surface roughness was developed according to the Taguchi experiment design guidelines (DOE) [6]. The factors Sa (i.e., the arithmetical mean height of the surface) and Sz (i.e., the maximum height of the surface-sum of the maximum peak height value and the maximum pit height value within a definition area) were defined in accordance with the standard ISO25178 [62].
Generally, Sa is represented by the equation [27]: where η(x, y) is the deviation of the surface irregularities from the base plane, and L and B are the length and the width of the given section of surface corresponding to the baseline for the given type of surface irregularities, respectively. The research plan is represented in the form of the so-called orthogonal table L9, which describes the individual research trials for the three factors with three different values, which are called the levels. The parameter values for the machining were selected on the basis of the generally available NiTi alloy tests. These values are: f = 0.038, 0.058, 0.077 mm/rev; a p = 0.03, 0.08, 0.13 mm; v c = 30, 40, 50 m/min [6]. The 3D roughness measurements of the NiTi-treated surface were performed by using the Taylor Hobson measurement system. To perform the surface roughness measurements, a measuring tip with a rounding radius of 2 µm was used, and the measurements were repeated ten times. The periodic nature of the surface was included for analysis, and as a result, the calculation of the selected parameters of topography was obtained. The cut-off value λ c of the filter was selected based on the values recommended for periodic profiles. The value λ c = 0.8 mm was selected [6] based on the obtained ranges of surface roughness.
The mathematical relationships between the input data ( f , a p , and v c ) and the output factors (Sa and Sz) for the Taguchi experiment were obtained here. The experimental basis for these relationships can be found in previous work [6], while the model for determining the factors Sa and Sz was appointed using RSM.
The analysis with the Taguchi method mentioned above is only for the main factors Sa and Sz without any consideration of the correlation between them. Therefore, herein, RSM-based regression was used for the analysis of the correlation between such factors, which revealed that the contour plots of Sa were represented by corresponding curves. Therefore, the mathematical model used for predicting the suitable value was the quadratics model: , and x 4 are model parameters (i.e., input parameters).
Model (1) can be obtained by considering the full quadratics model represented by the mathematical models: and where v c = πdn 1000 (5) while d and n are the diameter of the machined surface and the number of rotations, respectively. The factors Sa mod and Sz mod represent the arithmetical mean height and the maximum height of the surface (sum of the maximum peak height value and the maximum pit height value within a definition area), respectively. These factors describe the height or height distribution of the surface irregularities.

Results of the Measurements and Associated Uncertainties Obtained Experimentally
The predetermined values of parameters f , a p and n, for which the factors Sa and Sz were determined with a constant value of diameter d equal to 6.380 mm, are tabulated in Table 1 (rows 1, 2, . . . , 9).  Table 2 (columns M s = 1, 2, . . . , 9) summarizes the series of measurements of the factors Sa and Sz, which were determined for particular rows from Table 1. Each series contains N = 10 measurements, while the rows described by Sa and Sz are the mean values of Sa and Sz determined on the basis of a particular n measurement. The mean Sa and Sz were adopted below as the value of the factors Sa and Sz.
The uncertainty of type A associated with the measurement of factors Sa and Sz is presented by the equation: corresponds to the mean Sa and Sz [47,63]. The uncertainty of type B associated with the measurement of factors Sa and Sz is: where ∆ = 0.001 µm is the reading resolution of the above parameters. The total and expanded uncertainties are determined based on the following formulas: and respectively, where k p is the coverage factor and for a distribution with a confidence level of 0.95 equal to 2 [47,63]. The combined uncertainties associated with the factors Sa mod i Sz mod , which are determined based on Equations (3) and (4), are defined by the formulas: and where u B ( f ) and u B a p are the uncertainties of type B associated with the parameters f and a p , while u c (v c ) is the combined uncertainty associated with the parameter v c and is determined based of the following formula: where u B (d) and u B (n) [63] are the uncertainties of type B related to determination of the diameter d and the number of rotations n, respectively. The uncertainties u B ( f ), u B a p , u B (d), and u B (n) are equal to 0.001 mm/rev, 0.01 mm, 0.01 mm, and 1 rev, respectively. These uncertainties result from the resolution of the measurement devices used. The expanded uncertainties are determined based on the following formula: where y corresponds to the values Sa and Sz, while k p = 2.
The mean values Sa and Sz of the measured factors Sa and Sz as well as the uncertainty determined on the basis of the Equation (10) are tabulated in Table 3. The uncertainties: u A Sa and u Sa are omitted in this Table because they are equal to each other and are exactly half of the value of the uncertainty U Sa for all rows. The situation is analogical in the case of uncertainties u A Sz and u Sz .
Hence, only the uncertainty U Sz is included in Table 3. The values of each row from Table 3 correspond to the parameters from the particular rows (i.e., the different combinations of the parameters f , a p , and n) of Table 1.
The uncertainties related to the parameters Sa and Sz refer only to their last significant numbers (zeros at the beginning are not taking into account as significant numbers; hence, only the last number greater than zero is included as a significant one), while the uncertainties related to the factor Sa mod refer to one or two of the last significant number/s. The uncertainties related to the factor Sz mod refer to the last two or three significant number. For each case under consideration, the uncertainties associated with the factors obtained on the basis of the mathematical models are from several to several times higher than the uncertainties determined for the values of the parameters obtained on the basis of the measurement data. In order to reduce the uncertainty value associated with the mathematical models, it is necessary to increase the resolution value of the measuring devices applied and to use a more precise method for determining these models.

Modeling of Surface Roughness
Below, the modeling procedure of surface roughness based on the mathematical models given by Equations (3) and (4)

Calculations Based on the Mathematical Models
The values of the functions Sa mod and Sz mod determined based on Equations (3) and (4), as well as the associated uncertainties determined on the basis of the Equations (11)- (14) are tabulated in Table 4.  Table 4 shows that for rows 1, 5, and 9, the values of the factors Sa mod and Sz mod obtained on the basis of mathematical models (3) and (4) have lower values than the values of Sa and Sz obtained from the measurements. These differences are equal to a maximum of 20% and are related to the inaccuracy of determining models (3) and (4).

Modeling Based on the Monte Carlo Method
The applied MC method uses a pseudo-random number generator with the uniform distribution U(0, 1) according to the Wichmann-Hill algorithm with a period equal to 2 121 . The pseudo-random number generation procedure is performed using the following six main steps [47,49, where P = 247,483,123.

2.
Set the four-element initial vector W from the range of 0 to 2 31 − 1.

3.
Calculate: where A i , B i , C i , and W i denote the particular elements of the vectors A, B, C, and W, while the functions mod(x) and f loor(x) denote the modulo from x and the largest integer digit no greater than x, respectively.
6. Finally, return: For 64-bit computers, Equation (16) can be replaced by the following simple formula: where , , , and denote the particular elements of the vectors , , , and W, while the functions ( ) and ( ) denote the modulo from and the largest integer digit no greater than , respectively. 4. If < 0, replace with + .

Calculate:
= ∑ / (17) 6. Finally, return: For 64-bit computers, Equation (16) can be replaced by the following simple formula: Figure 1 shows a block diagram of the applied MC method for determining the optimal (minimum) values of the factors (functions) and .  Uncertainties associated with the parameters Sa and Sz are determined based on the formula [49]: and z corresponds to the parameters Sa and Sz. Table 5 summarizes the results of the calculations of the minimum values (rows 2 and 9) of the functions described by Equations (3) and (4)   In comparison with Tables 3 and 4, Table 5 includes the following parameters: f , a p and n for which the lowest (optimal) values of the parameters Sa and Sz are obtained. Tables 3 and 4 includes the values Sa, Sz, Sa mod and Sz mod as well as the associated extended uncertainties: U Sa , U Sz , U Sa mod and U Sz mod which are determined based on the measurement data and mathematical models (index: mod) for nine cases of parameters: f , a p , and n which are included in Table 1. The parameters, a p and n were selected based on the Taguchi procedure. However, the results obtained for them are not optimal parameters for machining process. Only the parameters f , a p and n, determined on the basis of the MC method and summarized in Table 5, provide the minimum (optimal) values of the parameters Sa and Sz. By extending the uncertainty u Sa MC from Table 5 according to Equation (10) and for MC equal to 10 5 or 10 6 Table 4. This means that for the parameter Sz, higher uncertainties are obtained than for those listed in Table 4. On the other hand, the values of the parameters: f, a p and n which are related to these uncertainties are the optimal solution for prediction of the machining process. Figure 2a,b show the values of factors Sa MC and Sz MC for the particular Monte Carlo trials m and for the total MC draw equal to 10 3 and 10 4 , respectively. There are no figures for the number of MC draws equal to 10 5 and 10 6 due to their lack of legibility (i.e., their high concentration of random points).  Table 4. This means that for the parameter , higher uncertainties are obtained than for those listed in Table 4. On the other hand, the values of the parameters: , and which are related to these uncertainties are the optimal solution for prediction of the machining process. Figure 2a,b show the values of factors and for the particular Monte Carlo trials and for the total MC draw equal to 10 and 10 , respectively. There are no figures for the number of MC draws equal to 10 and 10 due to their lack of legibility (i.e., their high concentration of random points)  The above figures show a higher concentration of random points corresponding to the values of the functions Sa MC and Sz MC toward their minimum values. An analogous distribution of points was obtained for MC draws equal to 10 5 and 10 6 . The reason is the syntax of the functions Sa MC and Sz MC , which, for a generator with a uniform distribution, provides values for these points that are close to the minimum.

Conclusions
The procedure for determining the uncertainties related to the roughness parameters presented in this paper allow for easy and quick evaluation of the obtained results related to prediction and optimization (by using the MC method) in the machining process. The results show that the uncertainties, in comparison to the measured values, have values a dozen times higher for models (3) and (4) that were determined in previous works. The reason for this is the fact that the accuracy (uncertainties) of these models was not tested in these works.
Increasing the accuracy of such models can be achieved by using RSM based on, e.g., the radial basis functions (RBFs) determined by using an ANN. In a simpler case, it is possible to use approximation polynomials with an appropriately selected order, controlled by the determination of the associated uncertainty of such modeling. For such accurate models, it is possible to use the MC method for the optimization and prediction of the machining process, as shown in this paper.
The results obtained in this paper highlight the need for a more precise determination of the factors Sa and Sz in future works. Thanks to such precise models, the value of type A uncertainty and the corresponding value of expanded uncertainty can be reduced in the optimization and prediction process of machining. An additional reduction of the expanded uncertainty is possible by reducing the value of the type B uncertainty, which can be fulfilled by increasing the resolution of the tools dedicated to machining or the resolution of the measurement devices used.