Properties of the Surface Layer After Trochoidal Milling and Brushing: Experimental Study and Artiﬁcial Neural Network Simulation

: The aim of this study was to investigate the e ﬀ ect of milling and brushing cutting data settings on the surface geometry and energy parameters of two Mg alloy substrates: AZ91D and AZ31. In milling, the cutting speed and the trochoidal step were modiﬁed (v c = 400–1200 m / min and s tr = 5–30%) to investigate how they a ﬀ ect selected 2D (Rz, Rku, Rsk, RSm, Ra) and 3D (Sa, Sz, Sku, Ssk) roughness parameters. The brushing treatment was carried out at constant parameters: n = 5000 rev / min, v f = 300 mm / min, a p = 0.5 mm. The surface roughness of specimens was assessed with the Ra, Rz, and RSm parameters. The e ﬀ ects of the two treatments on the workpiece surface were analyzed comparatively. It was found that the roughness properties of the machined surface may be improved by the application of a carbide milling cutter and ceramic brush. The use of di ﬀ erent machining data was also shown to impact the surface free energy and its polar component of Mg alloy specimens. Complementary to the results from the experimental part of the study, the investigated machining processes were modelled by means of statistical artiﬁcial neural networks (the radial basis function and multi-layered perceptron). The artiﬁcial neural networks (ANNs) were shown to perform well as a tool for the prediction of Mg alloy surface roughness parameters and the maximum height of the proﬁle (Rz) after milling and brushing.


Introduction: State of the Art
Magnesium alloys are typically shaped in milling-the process that can produce a high-quality surface finish and is thus an ideal solution for both roughing and finishing operations. The analyzed metal exhibits very good specific strength, which is why it is widely used in the aerospace industry. Machining of low-rigidity components is problematic for several reasons; however, it is the occurrence of chatter that typically constitutes the biggest challenge. Vibrations tend to decrease the quality of the finish and the dimensional and shape accuracy of the workpiece. In order to counter the negative effects of machining, workpieces are subjected to finishing operations with the use of appropriate tools, strategies, and carefully adjusted machining parameters. One of the typical finishing operations is deburring, which can be performed with the use of dedicated ceramic brushes. These tools are applicable in fully automated machining centers and are known to generate minor force values during machining [1,2]. surface was imparted with a high corrosion resistance, about four to seven times greater compared to the untreated one.
In a different study [25], the question of improving the corrosion resistance of the reinforcing wire by means of the brushing treatment was undertaken. The wire moved between two opposite brushes-rotating at a speed of 8000 rpm with a feed speed of 300 mm/min-to intensify the process, which was additionally performed in two transitions. After the first pass, the reinforcing wire was rotated around its axis by 90 • to obtain a uniform surface on the entire circumference of the specimen. Scale removal during brushing was shown to further contribute to enhancing the corrosion resistance. In addition, brushing is used to create a specific direction of the grain in the geometric surface structure, for a decorative effect, to enhance bonding in the adhesive joining process, or to impart specific properties of the surface layer [26][27][28].

Surfaces Roughness Modelling and Prediction
Various experimental studies aimed at deepening the knowledge on the phenomena and relationships occurring during machining processes are increasingly supported by mathematical modelling and computer simulation. This includes the analysis of the surface layer quality of workpieces.
Different models may be employed for the prediction of surface roughness data after machining. Equipped with the dependable results from these simulations, engineers may set the parameters of machining processes with a higher certainty of obtaining the desired surface texture. Mathematical modelling was, e.g., employed by Zhou et al. [29] to produce 3D area topography after helical milling. The model accounted for such factors as the tool eccentricity, the secondary cutting, and the effect of size. Urbikain [30], on the other hand, developed a geometrical model for the prediction of the surface topography in flank-milling with the use of circle-segment end mills. The analysis considered the tool geometry, the feed rate, the radial immersion, and the tool run-out. Miko and Nowakowski's model [31] served to determine the Ra of the surface following milling, thus aiding the correct specification of machining parameters as per the desired properties of surface roughness. The model of the Polish scholars is also similar to other models by sharing the key problem, the inaccuracy of predictions, resulting from the included simplifying assumptions. The result is the discrepancy between the modelled and actual surface roughness parameters, which may produce a 1.5 to 5 times lower prediction. The machining process is highly complex, involving numerous random factors, and therefore it is difficult to obtain fully accurate simulation results.
Given the inaccuracies, new artificial network-based models of machining processes began to emerge. They implemented the experimental models, thus providing superior precision of predictions and representation of the characteristics of machining processes. ANN prediction models are employed in numerous works, e.g., by Sangwan et al. [32], who determined optimum machining parameters from the perspective of minimizing the surface roughness. The genetic algorithm (GA) was also used in the study. Neural networks' performance is further confirmed in predicting surface quality and optimization of process parameters [33], machining performance [34], or the cutting force and vibration [19].
The use of ANNs is by no means restricted to the cases listed in the preceding paragraph, as they are used, e.g., to model the surface roughness in turning. Several examples of such applications can be given, e.g., the model for predicting the surface roughness of AISI316 stainless steel following low-speed turning based on multiple linear regression and ANN by Acayab and Escalon [35]; empirical models for tool life, surface roughness, and cutting force determination in turning [36]; or the implementation of Edgeworth-Pareto optimization of ANN in the prediction of the surface roughness (Ra) of a component subjected to CNC turning over a minimal machining time and at the prime machining cost [37].
Based on the analyzed literature, it appears that extending the scope of investigations to include a greater number of surface roughness parameters allows a deeper insight into the condition or utilitarian features of surfaces, including, e.g., its fatigue strength characteristics. Therefore, the study reported in this paper employed 2D roughness parameters (Rz, Rku, Rsk, RSm, Ra) and 3D area roughness parameters (Sa, Sz, Sku, Ssk) to describe in detail the surface of AZ91D and AZ31 magnesium alloy substrates after trochoidal milling and brushing. The choice of the workpiece material followed the preliminary search of the literature, which revealed few studies on the machinability of Mg alloys using the trochoidal path and brushing. The influence of v c and s tr on selected indicators of the surface geometry was assessed based on the results of the surface roughness parameter measurements on the end face and the lateral face of substrates, their surface free energy, and by means of the artificial neural network simulation and statistical tests. The primary purpose of ANN modelling is to forecast the effects of non-linear technological processes, such as trochoidal milling or brushing. Developed further, the methodology may give rise to a decision-making support system to be implemented in manufacturing enterprises.

Materials and Methods
This work set out to analyze the effect of the variable machining parameters of milling and brushing on selected indicators of the surface geometry and energy. These analyses concerned the machinability of two types of magnesium alloys: AZ31 (for sheet and plate uses) and AZ91D (a die casting alloy).
The milling was carried out using the vertical milling center AVIA VMC800HS (Warsaw, Poland) with the Heidenhain iTNC 530 control system. The model and the machining procedure were implemented by means of NX 10.0 -SIEMENS (Munich, Germany) software. The cutting tool in the tests was a VHM end mill from Fenes (Siedlce, Poland). It was a TiAlN-coated double-edge carbide milling cutter of a diameter, d = 16 mm. The milling cutter was mounted in a SECO shrink-fit holder (Fagersta, Sweden) HSK 63A SFD 16 × 120 mm. A CIMAT RT 610 balancer (Bydgoszcz, Poland) was used to balance the tool and holder in a grade "G2.5", in accordance with the International Standard, ISO 21940-11: 2016. The residual unbalance value was 0.77 gmm. Based on former research and a review of the literature, the following ranges of milling parameters were used: The cutting speed v c = 400-1200 m/min, the trochoidal step s tr = 5-30% of the tool diameter, f z = 0.15 mm/tooth, and a p = 6 mm.
The tests were specifically designed to determine the impact of the trochoidal step, s tr , and the cutting speed, v c , on selected 2D and 3D roughness parameters. The 2D surface roughness parameters were measured in two variants, at the end face and the lateral face, while the 3D area roughness was measured solely at the end face. In the case of the 2D roughness parameters' analysis, the following measurements were made:
At the lateral face of the specimen: Rz, RSm, Rku, Rsk.
The 3D roughness parameters measurements were based on the following parameters: Sa, Sz, Sku, and Ssk. 2D roughness measurements were carried in five repetitions on each surface, with the use of a Hommel Tester T1000 contact profilometer (Jena, Germany). The following measurement parameters were used for 2D roughness measurements: Traverse length lt = 15 mm and sampling length lr = 2.5 mm, scan rate v t = 0.5 mm/s, and measuring ranges/resolution M = ±320 µm/0.04 µm). T8000 RC120-400 combined roughness and contour measurement system by Hommel-Etamic Jenooptik (Jena, Germany) was the tool for the 3D area roughness profile measurements. The 3D area roughness measurement specifications were the following: lt = 4.8 mm, lr = 0.8 mm, and v t = 0.5 mm/s. The 4.8 × 4.8 mm surface area was scanned in approximately 200 scanning steps. Figure 1 shows an example of a 2D surface profile obtained from the extracted profile analysis, according to the International Standards ISO: ISO 11562, ISO 135651, and ISO 4287.      Milling was followed by brushing, which was carried out at constant parameters with a ceramic brush from Xebec (Tokyo, Japan), with a shank diameter of 6 mm. The brush fibers offer different grinding power properties, represented by the pink, red, white, and blue colors. In our tests, red fibers, dedicated for light alloys, were employed. The brushing parameters were constant: n = 5000 rev/min, vf = 300 mm/min, and the distance between the fibers and the work surface, ap = 0.5 mm. Having completed the machining stage, the condition of the surface was evaluated (parameters Ra, Rz, RSm) in order to compare the effects of milling and brushing. Figure 3 shows the brushing treatment in the process. The surface free energy of the Mg alloys was obtained indirectly by contact angle measurement. Two standard liquids were used, distilled water and diiodomethane. The standard liquids with a constant volume of approximately 4 μL were automatically applied to the test surface with a PGX goniometer (Paul N. Gardner Company, Pompano Beach, FL, USA). The contact angle measurements with distilled water and diiodomethane were carried out in 10 repetitions at minimum for each Mg alloy surface [38]. The measurements were taken at the temperature range of 20 to 22 °C and the relative humidity of 40% to 45%.
The experimental data were fed into the ANN to simulate the maximum height of the profile (Rz). The milling and brushing processes were approached as the control object and the modelled surface roughness parameter, Rz, became the output parameter. This allowed us to compensate for any inaccuracy issues resulting from the nonlinear character of the simulated processes. The variable parameters of machining were the cutting speed, vc, and the trochoidal step, str (2 neurons in the hidden layer). The ANN schematics in Figure 4 show the analyzed process parameters, the variable input, vc and str, and the output parameters, the surface roughness Rz (one neuron in the output layer). Four different neural networks were prepared to represent the process, including: One machining parameter; two types of machining, milling and brushing; and two workpiece materials, AZ31 and AZ91D. The black box model of ANNs was selected for the performance considerations. This model is suitable whenever mathematical equations fail to accurately describe the process under analysis, as in the studied case. Milling was followed by brushing, which was carried out at constant parameters with a ceramic brush from Xebec (Tokyo, Japan), with a shank diameter of 6 mm. The brush fibers offer different grinding power properties, represented by the pink, red, white, and blue colors. In our tests, red fibers, dedicated for light alloys, were employed. The brushing parameters were constant: n = 5000 rev/min, v f = 300 mm/min, and the distance between the fibers and the work surface, a p = 0.5 mm. Having completed the machining stage, the condition of the surface was evaluated (parameters Ra, Rz, RSm) in order to compare the effects of milling and brushing. Figure 3 shows the brushing treatment in the process. Milling was followed by brushing, which was carried out at constant parameters with a ceramic brush from Xebec (Tokyo, Japan), with a shank diameter of 6 mm. The brush fibers offer different grinding power properties, represented by the pink, red, white, and blue colors. In our tests, red fibers, dedicated for light alloys, were employed. The brushing parameters were constant: n = 5000 rev/min, vf = 300 mm/min, and the distance between the fibers and the work surface, ap = 0.5 mm. Having completed the machining stage, the condition of the surface was evaluated (parameters Ra, Rz, RSm) in order to compare the effects of milling and brushing. Figure 3 shows the brushing treatment in the process. The surface free energy of the Mg alloys was obtained indirectly by contact angle measurement. Two standard liquids were used, distilled water and diiodomethane. The standard liquids with a constant volume of approximately 4 μL were automatically applied to the test surface with a PGX goniometer (Paul N. Gardner Company, Pompano Beach, FL, USA). The contact angle measurements with distilled water and diiodomethane were carried out in 10 repetitions at minimum for each Mg alloy surface [38]. The measurements were taken at the temperature range of 20 to 22 °C and the relative humidity of 40% to 45%.
The experimental data were fed into the ANN to simulate the maximum height of the profile (Rz). The milling and brushing processes were approached as the control object and the modelled surface roughness parameter, Rz, became the output parameter. This allowed us to compensate for any inaccuracy issues resulting from the nonlinear character of the simulated processes. The variable parameters of machining were the cutting speed, vc, and the trochoidal step, str (2 neurons in the hidden layer). The ANN schematics in Figure 4 show the analyzed process parameters, the variable input, vc and str, and the output parameters, the surface roughness Rz (one neuron in the output layer). Four different neural networks were prepared to represent the process, including: One machining parameter; two types of machining, milling and brushing; and two workpiece materials, AZ31 and AZ91D. The black box model of ANNs was selected for the performance considerations. This model is suitable whenever mathematical equations fail to accurately describe the process under analysis, as in the studied case. The surface free energy of the Mg alloys was obtained indirectly by contact angle measurement. Two standard liquids were used, distilled water and diiodomethane. The standard liquids with a constant volume of approximately 4 µL were automatically applied to the test surface with a PGX goniometer (Paul N. Gardner Company, Pompano Beach, FL, USA). The contact angle measurements with distilled water and diiodomethane were carried out in 10 repetitions at minimum for each Mg alloy surface [38]. The measurements were taken at the temperature range of 20 to 22 • C and the relative humidity of 40% to 45%.
The experimental data were fed into the ANN to simulate the maximum height of the profile (Rz). The milling and brushing processes were approached as the control object and the modelled surface roughness parameter, Rz, became the output parameter. This allowed us to compensate for any inaccuracy issues resulting from the nonlinear character of the simulated processes. The variable parameters of machining were the cutting speed, v c , and the trochoidal step, s tr (2 neurons in the hidden layer). The ANN schematics in Figure 4 show the analyzed process parameters, the variable input, v c and s tr , and the output parameters, the surface roughness Rz (one neuron in the output layer). Four different neural networks were prepared to represent the process, including: One machining parameter; two types of machining, milling and brushing; and two workpiece materials, AZ31 and AZ91D. The black box model of ANNs was selected for the performance considerations. This model is suitable whenever mathematical equations fail to accurately describe the process under analysis, as in the studied case.  Figure 4. The schematic representation of the artificial neural network (ANN) for the analysis of process parameters.
The simulation works were carried out with the application of the specialist statistical software, Statistica Neural Networks, and employed two ANN types, MLP (multi-layered perceptron) and RBF (radial basis function). The former model used linear, exponential, logistic, tanh, and sinus activation functions, while for the BFGS gradient (Broyden-Fletcher-Goldfarb-Shanno), the conjugate gradient and the steepest descent training algorithm were used to train the network. The latter network's activation functions were for hidden neurons, the Gaussian distribution, and for output neurons, the linear function, and it was trained with the RBFT algorithm. The number of neurons in the hidden layer (2-9) and training epochs (150-300) were determined experimentally. The advantages of the selected ANNs are optimal training, validation quality, and error characteristics. The least-squares method was used to identify the network errors. The training data set involved 75% of the experimental data while the remaining 25% were used for validation. Given the insufficient amount of data from milling, it was resolved that the test data set would not be included [19].

Results
The results from the experiments and measurements are presented in the form of bar charts, with the standard deviation marked as a measure of the scatter of the measurement results. 2D roughness parameters, including their mean values after milling, are given in Figures 5-12, while after brushing is shown in Figures 13-14. For the sake of 3D roughness parameter analysis ( Figures  15-16), surface roughness maps were created, one for each machining parameter, hence these charts do not contain a standard deviation.

The Effect of Trochoidal
Step, str a) The End Face of the Specimen Figure 5 shows the values of the Rku (kurtosis) and Rsk (skewness) parameters. The presented data indicate that considering Rku at str = 5% and 15%, surfaces with more rounded peaks were obtained (Rku <3 increases the friction coefficient), str = 10%, Rku > 3 (is characteristic of surfaces with a large number of sharp peaks, which in the case of mating surfaces may reduce the coefficient of friction), str = 20%-30%, values oscillating in the vicinity of Rku = 3 were obtained, which determines that the distribution is close to normal. In contrast, the Rsk is largely negative, which may compromise the substrate's corrosion resistance and reduce the coefficient of friction. Rsk AZ31 Rsk AZ91D The simulation works were carried out with the application of the specialist statistical software, Statistica Neural Networks, and employed two ANN types, MLP (multi-layered perceptron) and RBF (radial basis function). The former model used linear, exponential, logistic, tanh, and sinus activation functions, while for the BFGS gradient (Broyden-Fletcher-Goldfarb-Shanno), the conjugate gradient and the steepest descent training algorithm were used to train the network. The latter network's activation functions were for hidden neurons, the Gaussian distribution, and for output neurons, the linear function, and it was trained with the RBFT algorithm. The number of neurons in the hidden layer (2-9) and training epochs (150-300) were determined experimentally. The advantages of the selected ANNs are optimal training, validation quality, and error characteristics. The least-squares method was used to identify the network errors. The training data set involved 75% of the experimental data while the remaining 25% were used for validation. Given the insufficient amount of data from milling, it was resolved that the test data set would not be included [19].

Results
The results from the experiments and measurements are presented in the form of bar charts, with the standard deviation marked as a measure of the scatter of the measurement results. 2D roughness parameters, including their mean values after milling, are given in Figures 5-12, while after brushing is shown in Figures 13 and 14. For the sake of 3D roughness parameter analysis (Figures 15 and 16), surface roughness maps were created, one for each machining parameter, hence these charts do not contain a standard deviation.  Figure 5 shows the values of the Rku (kurtosis) and Rsk (skewness) parameters. The presented data indicate that considering Rku at s tr = 5% and 15%, surfaces with more rounded peaks were obtained (Rku <3 increases the friction coefficient), s tr = 10%, Rku > 3 (is characteristic of surfaces with a large number of sharp peaks, which in the case of mating surfaces may reduce the coefficient of friction), s tr = 20%-30%, values oscillating in the vicinity of Rku = 3 were obtained, which determines that the distribution is close to normal. In contrast, the Rsk is largely negative, which may compromise the substrate's corrosion resistance and reduce the coefficient of friction. Figure 5 shows the values of the Rku (kurtosis) and Rsk (skewness) parameters. The presented data indicate that considering Rku at str = 5% and 15%, surfaces with more rounded peaks were obtained (Rku <3 increases the friction coefficient), str = 10%, Rku > 3 (is characteristic of surfaces with a large number of sharp peaks, which in the case of mating surfaces may reduce the coefficient of friction), str = 20%-30%, values oscillating in the vicinity of Rku = 3 were obtained, which determines that the distribution is close to normal. In contrast, the Rsk is largely negative, which may compromise the substrate's corrosion resistance and reduce the coefficient of friction.  Figure 6a reports the results for RSm, i.e., the mean width of the profile elements. In this case, the increase in the trochoidal step, s tr , affects the value of RSm. The highest values of this roughness parameter were observed for s tr = 10% (for AZ31 0.27 mm and AZ91D 0.41 mm, respectively). The results obtained at s tr 5%, 20%, and 25% were the lowest and thus may be considered as the most favorable from the analyzed viewpoint. Figure 6b shows the results for Ra, which oscillated at approximately 1.5 to 2.0 µm. From the data presented in Figure 6b, it can be seen that increasing the trochoidal step leads to the emergence of different relations depending on the type of workpiece material. In the case of the AZ91D alloy, the surface roughness increases (comparing s tr = 5% and s tr = 30%, Rz: from 7.1 to 11.6 µm), whereas in AZ31 alloy, the roughness parameters change only to a slight extent.  Figure 6a reports the results for RSm, i.e., the mean width of the profile elements. In this case, the increase in the trochoidal step, str, affects the value of RSm. The highest values of this roughness parameter were observed for str = 10% (for AZ31 0.27 mm and AZ91D 0.41 mm, respectively). The results obtained at str 5%, 20%, and 25% were the lowest and thus may be considered as the most favorable from the analyzed viewpoint. Figure 6b shows the results for Ra, which oscillated at approximately 1.5 to 2.0 µm. From the data presented in Figure 6b, it can be seen that increasing the trochoidal step leads to the emergence of different relations depending on the type of workpiece material. In the case of the AZ91D alloy, the surface roughness increases (comparing str = 5% and str = 30%, Rz: from 7.1 to 11.6 µm), whereas in AZ31 alloy, the roughness parameters change only to a slight extent. As the trochoidal step, str, increases, the values of the Rz and RSm parameters change. The lowest values of both parameters were observed for str = 5%. In the case of the Rz parameter, the least favorable str is 15% while for RSm, the str ranges from 20 to 30%. The least favorable conditions of machining, the 15% trochoidal step, indicate an unstable machining area. Similar relationships are often found for other indicators, e.g., for the radial depth of cut ae, the stable areas were determined for ae > 75% d and ae < 25% d (d is the tool diameter). Therefore, with respect to Rz, the stable

RSm [mm] s tr [%]
RSm AZ31 RSm AZ91D  Figure 6a reports the results for RSm, i.e., the mean width of the profile elements. In this case, the increase in the trochoidal step, str, affects the value of RSm. The highest values of this roughness parameter were observed for str = 10% (for AZ31 0.27 mm and AZ91D 0.41 mm, respectively). The results obtained at str 5%, 20%, and 25% were the lowest and thus may be considered as the most favorable from the analyzed viewpoint. Figure 6b shows the results for Ra, which oscillated at approximately 1.5 to 2.0 µm. From the data presented in Figure 6b, it can be seen that increasing the trochoidal step leads to the emergence of different relations depending on the type of workpiece material. In the case of the AZ91D alloy, the surface roughness increases (comparing str = 5% and str = 30%, Rz: from 7.1 to 11.6 µm), whereas in AZ31 alloy, the roughness parameters change only to a slight extent. As the trochoidal step, str, increases, the values of the Rz and RSm parameters change. The lowest values of both parameters were observed for str = 5%. In the case of the Rz parameter, the least favorable str is 15% while for RSm, the str ranges from 20 to 30%. The least favorable conditions of machining, the 15% trochoidal step, indicate an unstable machining area. Similar relationships are often found for other indicators, e.g., for the radial depth of cut ae, the stable areas were determined for ae > 75% d and ae < 25% d (d is the tool diameter). Therefore, with respect to Rz, the stable As the trochoidal step, s tr , increases, the values of the Rz and RSm parameters change. The lowest values of both parameters were observed for s tr = 5%. In the case of the Rz parameter, the least favorable s tr is 15% while for RSm, the s tr ranges from 20 to 30%. The least favorable conditions of machining, the 15% trochoidal step, indicate an unstable machining area. Similar relationships are often found for other indicators, e.g., for the radial depth of cut a e , the stable areas were determined for a e > 75% d and a e < 25% d (d is the tool diameter). Therefore, with respect to Rz, the stable machining area is s tr = 5% and s tr = 20-30%. In addition, increasing the s tr results in an increase in the amount of workpiece material subtracted per one trochoidal step (increase in the diameter of the area of the cut). The higher extraction rate leads to the rise in the values of the horizontal surface roughness parameter, Rsm (mean width of the profile elements). Figure 8 shows the values of Rku and Rsk. In both cases, for most changes in the range of s tr , the parameters, Rku and Rsk, assume positive values (the exception being the Rsk parameter for alloy AZ31 at s tr = 5% and alloy AZ91D at s tr = 30%). Positive values of both parameters may indicate more rounded peaks of micro-irregularities, an increased friction coefficient, and higher corrosion resistance.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 10 of 25 of the cut). The higher extraction rate leads to the rise in the values of the horizontal surface roughness parameter, Rsm (mean width of the profile elements). Figure 8 shows the values of Rku and Rsk. In both cases, for most changes in the range of str, the parameters, Rku and Rsk, assume positive values (the exception being the Rsk parameter for alloy AZ31 at str = 5% and alloy AZ91D at str = 30%). Positive values of both parameters may indicate more rounded peaks of micro-irregularities, an increased friction coefficient, and higher corrosion resistance.  Figure 9 presents the results of the kurtosis and skewness measurements. It shows that the slope factor of the profile is positive, which indicates the increase in the friction coefficient (due to more rounded surface irregularities). In contrast, the profile asymmetry factor in the majority of cases takes negative values. Therefore, it can be concluded that the peaks and valleys are non-symmetrical in distribution, and the corrosion resistance is lower.   Figure 9 presents the results of the kurtosis and skewness measurements. It shows that the slope factor of the profile is positive, which indicates the increase in the friction coefficient (due to more rounded surface irregularities). In contrast, the profile asymmetry factor in the majority of cases takes negative values. Therefore, it can be concluded that the peaks and valleys are non-symmetrical in distribution, and the corrosion resistance is lower.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 10 of 25 of the cut). The higher extraction rate leads to the rise in the values of the horizontal surface roughness parameter, Rsm (mean width of the profile elements). Figure 8 shows the values of Rku and Rsk. In both cases, for most changes in the range of str, the parameters, Rku and Rsk, assume positive values (the exception being the Rsk parameter for alloy AZ31 at str = 5% and alloy AZ91D at str = 30%). Positive values of both parameters may indicate more rounded peaks of micro-irregularities, an increased friction coefficient, and higher corrosion resistance.  Figure 9 presents the results of the kurtosis and skewness measurements. It shows that the slope factor of the profile is positive, which indicates the increase in the friction coefficient (due to more rounded surface irregularities). In contrast, the profile asymmetry factor in the majority of cases takes negative values. Therefore, it can be concluded that the peaks and valleys are non-symmetrical in distribution, and the corrosion resistance is lower.   b) The Lateral Face of the Specimen Figure 11 reports the values of the Rz and RSm parameter at the changing cutting speed, vc, measured at the end face of the specimens. From Figure 11, it can be seen that with the increase in vc, the values of the Rz and RSm parameters change. An increase in these parameters causes an increase in the analyzed machinability indices. The lowest values of both parameters were observed for vc = 400 m/min. In the case of the Rz parameter, the least favorable machining scenario is vc = 800 m/min, and in the case of the RSm, it is the entire 800 to 1200 m/min range of vc. From the observations, it can be seen that the lowest values of the surface roughness parameters (Rz and Rsm) on the lateral face of the specimen are obtained when the process is executed at lower speeds and following the trochoidal tool path. b) The Lateral Face of the Specimen Figure 11 reports the values of the Rz and RSm parameter at the changing cutting speed, vc, measured at the end face of the specimens. From Figure 11, it can be seen that with the increase in vc, the values of the Rz and RSm parameters change. An increase in these parameters causes an increase in the analyzed machinability indices. The lowest values of both parameters were observed for vc = 400 m/min. In the case of the Rz parameter, the least favorable machining scenario is vc = 800 m/min, and in the case of the RSm, it is the entire 800 to 1200 m/min range of vc. From the observations, it can be seen that the lowest values of the surface roughness parameters (Rz and Rsm) on the lateral face of the specimen are obtained when the process is executed at lower speeds and following the trochoidal tool path.   Figure 12 presents the values of Rku and Rsk. In both cases, the parameters, Rku and Rsk, take positive values, which may indicate more rounded peaks of micro-irregularities, thus a higher coefficient of friction, as well as higher corrosion resistance.

Effect of the Trochoidal
Step on the Surface Roughness Figure 13 shows the effect of the trochoidal step on the roughness of the Mg alloys' surfaces upon brushing (Ra, Rz, and RSm, respectively). Considering Ra and Rz, the AZ91D alloy appears to have exhibited higher values of roughness parameters.  Figure 12 presents the values of Rku and Rsk. In both cases, the parameters, Rku and Rsk, take positive values, which may indicate more rounded peaks of micro-irregularities, thus a higher coefficient of friction, as well as higher corrosion resistance.

Effect of the Trochoidal
Step on the Surface Roughness Figure 13 shows the effect of the trochoidal step on the roughness of the Mg alloys' surfaces upon brushing (Ra, Rz, and RSm, respectively). Considering Ra and Rz, the AZ91D alloy appears to have exhibited higher values of roughness parameters. Modifying the trochoidal step has a notable impact on changes in the roughness parameters of the AZ91D alloy. In the trochoidal step range of 5% to 20%, an increase in the roughness parameters occurs along with the increase in the trochoidal step. Comparing the surface roughness parameters from milling (the results in Section 3.1), it can be seen that brushing caused a significant reduction in the roughness. In the case of brushing, the values of the Ra parameter changed accordingly: For the AZ31 alloy in the range from Ra = 0.26 µm to Ra = 0.35 µm (after milling from Ra = 1.49 µm to Ra = 1.91 µm), and for the AZ91D alloy in the range from Ra = 0.22 µm to Ra = 0.53 µm (after milling from Ra = 1.39 µm to Ra = 2.16 µm). On average, over the entire range of the trochoidal steps investigated, the brushing treatment caused a 5.6-fold decrease in the value of the Ra parameter in relation to milling for the AZ31 alloy and about 3.9-fold drop for the AZ91D alloy. A similar trend was observed for Rz. Modifying the trochoidal step has a notable impact on changes in the roughness parameters of the AZ91D alloy. In the trochoidal step range of 5% to 20%, an increase in the roughness parameters occurs along with the increase in the trochoidal step. Comparing the surface roughness parameters from milling (the results in Section 3.1), it can be seen that brushing caused a significant reduction in the roughness. In the case of brushing, the values of the Ra parameter changed accordingly: For the AZ31 alloy in the range from Ra = 0.26 µm to Ra = 0.35 µm (after milling from Ra = 1.49 µm to Ra = 1.91 µm), and for the AZ91D alloy in the range from Ra = 0.22 µm to Ra = 0.53 µm (after milling from Ra = 1.39 µm to Ra = 2.16 µm). On average, over the entire range of the trochoidal steps investigated, the brushing treatment caused a 5.6-fold decrease in the value of the Ra parameter in relation to milling for the AZ31 alloy and about 3.9-fold drop for the AZ91D alloy. A similar trend was observed for Rz. Figure 14 shows the effect of the cutting speed, v c , change during milling on the roughness of the workpiece surface measured after brushing. Compared to the values of the roughness parameters obtained in milling, it can be stated that brushing is capable of reducing the surface roughness by several times.

The Effect of the Cutting Speed
Appl. Sci. 2019, 9, x FOR PEER REVIEW 13 of 25 Figure 14 shows the effect of the cutting speed, vc, change during milling on the roughness of the workpiece surface measured after brushing. Compared to the values of the roughness parameters obtained in milling, it can be stated that brushing is capable of reducing the surface roughness by several times. The lowest values of the roughness parameter, Ra = 0.23 µm, were obtained for the AZ31 alloy machined at the speed of vc = 800 m/min. A marked decrease in the surface roughness in the 400-800 m/min vc range may indicate machining in the HSM range, which typically involves the decrease in the surface roughness at an increased cutting speed.

3D Area Roughness
In Tables 1 and 2, the surface topographies are collected along with the bearing area curves obtained from the milling process. The isometric images and the Abbott-Firestone curves present the conditions at the end face of the workpiece. In the isometric views of surface topographies, visibly marked machining traces produced at subsequent passes of the cutting tool are visible. An extended analysis of 3D roughness parameters is given below, when the Sa, Sz, Sku, and Ssk 3D roughness parameters are detailed.
The bearing area curve (the Abbott-Firestone curve) provides relevant information from the point of view of surface functionality. This curve takes different shapes: Degressive, progressive, progressive-degressive, and degressive-progressive. The most favorable in terms of utilitarian features are surfaces whose curves represent a progressive or progressive-degressive trend. The progressive material bearing area curve denotes a surface of "rounded" peaks of micro-irregularities, which is more resistant to wear than surfaces with the degressive curve shape [15]. Based on the The lowest values of the roughness parameter, Ra = 0.23 µm, were obtained for the AZ31 alloy machined at the speed of v c = 800 m/min. A marked decrease in the surface roughness in the 400-800 m/min v c range may indicate machining in the HSM range, which typically involves the decrease in the surface roughness at an increased cutting speed.

3D Area Roughness
In Tables 1 and 2, the surface topographies are collected along with the bearing area curves obtained from the milling process. The isometric images and the Abbott-Firestone curves present the conditions at the end face of the workpiece. In the isometric views of surface topographies, visibly marked machining traces produced at subsequent passes of the cutting tool are visible. An extended analysis of 3D roughness parameters is given below, when the Sa, Sz, Sku, and Ssk 3D roughness parameters are detailed.
The bearing area curve (the Abbott-Firestone curve) provides relevant information from the point of view of surface functionality. This curve takes different shapes: Degressive, progressive, progressive-degressive, and degressive-progressive. The most favorable in terms of utilitarian features are surfaces whose curves represent a progressive or progressive-degressive trend. The progressive material bearing area curve denotes a surface of "rounded" peaks of micro-irregularities, which is more resistant to wear than surfaces with the degressive curve shape [15]. Based on the results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive. results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive. results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive. results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive. results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive. results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive. results from the tests presented in Table 2, it can be concluded that the resulting surfaces are in most cases degressive-progressive.    From the graphs in Figures 15 and 16, and the results from the performed tests, it can be concluded that changes in the roughness parameters occur in response to the increase in vc/str. The lowest values of the Sa and Sz parameters were measured in the range of vc = 1000-1200 m/min. Although slightly, the Sa and Sz roughness parameters change their values in response to the change in str.
The Rku parameter was shown to take positive values in both cases (the change in vc and str), which leads to the conclusion that these surfaces are characterized by more rounded peaks of microirregularities and a higher coefficient of friction. In contrast, the Sku parameter in most cases takes negative values, which may indicate a lower corrosion resistance. Figure 17 shows the energy state of the surface layer of the AZ31 and AZ91D Mg alloys. From the graphs in Figures 15 and 16, and the results from the performed tests, it can be concluded that changes in the roughness parameters occur in response to the increase in v c /s tr . The lowest values of the Sa and Sz parameters were measured in the range of v c = 1000-1200 m/min. Although slightly, the Sa and Sz roughness parameters change their values in response to the change in s tr .

Surface Free Energy (SFE) after Milling
The Rku parameter was shown to take positive values in both cases (the change in v c and s tr ), which leads to the conclusion that these surfaces are characterized by more rounded peaks of micro-irregularities and a higher coefficient of friction. In contrast, the Sku parameter in most cases takes negative values, which may indicate a lower corrosion resistance. From the graphs in Figures 15 and 16, and the results from the performed tests, it can be concluded that changes in the roughness parameters occur in response to the increase in vc/str. The lowest values of the Sa and Sz parameters were measured in the range of vc = 1000-1200 m/min. Although slightly, the Sa and Sz roughness parameters change their values in response to the change in str.

Surface Free Energy (SFE) after Milling
The Rku parameter was shown to take positive values in both cases (the change in vc and str), which leads to the conclusion that these surfaces are characterized by more rounded peaks of microirregularities and a higher coefficient of friction. In contrast, the Sku parameter in most cases takes negative values, which may indicate a lower corrosion resistance. Figure 17 shows the energy state of the surface layer of the AZ31 and AZ91D Mg alloys. The results from the experiments indicate that the machining parameters affect the surface free energy and its polar component. The largest increase in the value of the SFE was observed for the AZ91D alloy at the str parameter modification. The said increase amounted to 16% when machining with str = 30%, compared to the specimens machined at str = 5%. The maximum increase in the polar component of the SFE was a 96% increase observed in the AZ91D alloy. The cutting speed was similarly found to impact the SFE of the analyzed Mg alloys.

Numerical Modelling of Rz Surface Roughness Parameters with Artificial Neural Networks after Trochoidal Milling and Brushing
The experimental data from the measurements of Rz, the maximum height of the profile, after milling and brushing of the tested Mg alloys, AZ31 and AZ91D, served as input for the simulation of Rz with the use of ANNs. The simulations were performed by means of the Statistica Neural Networks software and with the use of MLP and RBF networks.
There are several network quality indicators, including learning quality, validation quality, learning error, and validation error, derived from the least-squares method. In the study, 500 networks were developed for each modelled scenario; subsequently, the quality of networks was evaluated with the aforementioned indicators to select the most suitable network type-MLP or RBF. The obtained network parameters for AZ31 and AZ91D alloys and Rz surface roughness after milling are given in Table 3. Analyzing the networks obtained from the simulation of the surface roughness following milling and brushing for AZ31 alloy, it was found that network 3, MLP 2-8-1, is the most suitable. The said ANN contains 8 hidden neurons and was obtained after 150 iterations. The activation function of the neuron in the hidden layer into the output signal is logistic, and in the output layer it is linear. In the case of the AZ91D alloy, the best results were also obtained for the MPL network with eight hidden neurons (MLP 2-8-1), whose activation function in the hidden layer is tanh, and in the output layer, it was logistic. The network was produced after 168 iterations. Table 3. Characteristics of multi-layered perceptron (MLP) and radial basis function (RBF) networks for AZ31 and AZ91D alloy for surface roughness parameters, Rz, after milling.

Network
No.  The results from the experiments indicate that the machining parameters affect the surface free energy and its polar component. The largest increase in the value of the SFE was observed for the AZ91D alloy at the s tr parameter modification. The said increase amounted to 16% when machining with s tr = 30%, compared to the specimens machined at s tr = 5%. The maximum increase in the polar component of the SFE was a 96% increase observed in the AZ91D alloy. The cutting speed was similarly found to impact the SFE of the analyzed Mg alloys.

Numerical Modelling of Rz Surface Roughness Parameters with Artificial Neural Networks after Trochoidal Milling and Brushing
The experimental data from the measurements of Rz, the maximum height of the profile, after milling and brushing of the tested Mg alloys, AZ31 and AZ91D, served as input for the simulation of Rz with the use of ANNs. The simulations were performed by means of the Statistica Neural Networks software and with the use of MLP and RBF networks.
There are several network quality indicators, including learning quality, validation quality, learning error, and validation error, derived from the least-squares method. In the study, 500 networks were developed for each modelled scenario; subsequently, the quality of networks was evaluated with the aforementioned indicators to select the most suitable network type-MLP or RBF. The obtained network parameters for AZ31 and AZ91D alloys and Rz surface roughness after milling are given in Table 3. Analyzing the networks obtained from the simulation of the surface roughness following milling and brushing for AZ31 alloy, it was found that network 3, MLP 2-8-1, is the most suitable. The said ANN contains 8 hidden neurons and was obtained after 150 iterations. The activation function of the neuron in the hidden layer into the output signal is logistic, and in the output layer it is linear. In the case of the AZ91D alloy, the best results were also obtained for the MPL network with eight hidden neurons (MLP 2-8-1), whose activation function in the hidden layer is tanh, and in the output layer, it was logistic. The network was produced after 168 iterations.
The results of the surface roughness parameters, Rz, for the AZ31 and AZ91D alloys after brushing are presented in Table 4. The comparative analysis of the neural network models leads to the conclusion that for the AZ31 alloy, it was the RBF 2-8-1 network with eight neurons that provided better results. In the case of brushing treatment, the results of the simulated surface roughness parameters, Rz, for the AZ31 and AZ91D alloy are presented in Table 4. Table 3. Characteristics of multi-layered perceptron (MLP) and radial basis function (RBF) networks for AZ31 and AZ91D alloy for surface roughness parameters, Rz, after milling.

Network
No. The comparative analysis of the neural network models shows the superiority of the RBF 2-8-1 network with eight neurons, as it provides better fitting results for the AZ31 alloy. It was, moreover, only in this case that the RBF network performed better in determining the surface roughness parameter, Rz, both after milling and brushing. This network has one hidden layer containing radial neurons, each modelling the Gaussian response surface, whereas, in the output layer, it contains linear neurons with a linear activation function. In the modelling of the surface roughness parameter, Rz, after the milling and brushing of the AZ91D alloy, comparable results were obtained for networks 4 (MLP 2-5-1) and 6 (MLP 2-4-1). However, analyzing the detailed error results and differences for individual cases and taking into account its practical purpose, it would be more reasonable to use network 6. This network was the product of 200 iterations and the activation function in both the hidden and output layers is logistic.

Network
The numerical results from the total simulation of the surface roughness parameter, Rz, for AZ31 and AZ91D alloy after milling are shown in Figure 18 while those after milling and brushing are shown in Figure 19. Once v c and s tr were fed into Statistica, the surface roughness parameters, Rz, for both alloys were obtained. network 6. This network was the product of 200 iterations and the activation function in both the hidden and output layers is logistic.
The numerical results from the total simulation of the surface roughness parameter, Rz, for AZ31 and AZ91D alloy after milling are shown in Figure 18 while those after milling and brushing are shown in Figure 19. Once vc and str were fed into Statistica, the surface roughness parameters, Rz, for both alloys were obtained.   The accuracy of the modelled networks (Figures 20 and 21) enables the comparison of the surface roughness parameter, Rz, measured for the milling and brushing of the AZ31 alloy ( Figure 20) and the AZ91D alloy ( Figure 21) material, with the numerical values reflecting the changes in the cutting speed, v c , at a fixed trochoidal step of s tr = 15. From their comparison, it can be seen that the relative error between the real values of the simulated parameters did not exceed 10% for milling, and 15% for after milling and brushing.
The accuracy of the modelled networks (Figures 20 and 21) enables the comparison of the surface roughness parameter, Rz, measured for the milling and brushing of the AZ31 alloy ( Figure 20) and the AZ91D alloy ( Figure 21) material, with the numerical values reflecting the changes in the cutting speed, vc, at a fixed trochoidal step of str = 15. From their comparison, it can be seen that the relative error between the real values of the simulated parameters did not exceed 10% for milling, and 15% for after milling and brushing. Figure 20. Comparison of the experimental and numerical results of the surface roughness parameters, Rz, depending on the cutting speed, vc, for the trochoidal step, str = 15%, for AZ31 alloy after milling and brushing. The accuracy of the modelled networks (Figures 20 and 21) enables the comparison of the surface roughness parameter, Rz, measured for the milling and brushing of the AZ31 alloy ( Figure 20) and the AZ91D alloy ( Figure 21) material, with the numerical values reflecting the changes in the cutting speed, vc, at a fixed trochoidal step of str = 15. From their comparison, it can be seen that the relative error between the real values of the simulated parameters did not exceed 10% for milling, and 15% for after milling and brushing. Figure 20. Comparison of the experimental and numerical results of the surface roughness parameters, Rz, depending on the cutting speed, vc, for the trochoidal step, str = 15%, for AZ31 alloy after milling and brushing. The results from the simulations show a permissible level of error, lower than 15%. This indicates that ANNs are fully capable of simulating parameters of milling or brushing. The obtained data may give grounds for the development of effective numerical models. This property of artificial neural networks earmarks them as a perfect machining process simulation tool.

Statistical Analysis
To validate the findings, the Ra and Rz parameters obtained during milling and brushing were subjected to statistical analysis. First, the said parameters were tested for normality with the Shapiro-Wilk test, and subsequently, the equality of variances and mean values were verified at the standard level of significance of α = 0.05.
The results of the statistical analysis performed for the Ra and Rz parameters obtained on the end face surfaces of the sample during milling with a trochoid step of str = 5% and str = 30% are presented in Table 5  The results from the simulations show a permissible level of error, lower than 15%. This indicates that ANNs are fully capable of simulating parameters of milling or brushing. The obtained data may give grounds for the development of effective numerical models. This property of artificial neural networks earmarks them as a perfect machining process simulation tool.

Statistical Analysis
To validate the findings, the Ra and Rz parameters obtained during milling and brushing were subjected to statistical analysis. First, the said parameters were tested for normality with the Shapiro-Wilk test, and subsequently, the equality of variances and mean values were verified at the standard level of significance of α = 0.05.
The results of the statistical analysis performed for the Ra and Rz parameters obtained on the end face surfaces of the sample during milling with a trochoid step of str = 5% and str = 30% are presented in Table 5 Figure 22. Results from Shapiro-Wilk test of normality conducted for the distribution of the Ra parameter results after trochoidal milling: Ra, AZ31 str = 30%.  At the standard level of significance, the change in s tr was shown not to exert a significant effect on the observed variance of results. However, in the case of mean values, no effect was demonstrated only for the Rz parameter measured on the lateral face of AZ31 Mg alloy workpieces. In the case of Ra results, the disparity in mean values was observed; however, it appears to favor employing larger trochoidal step values.
Results from the statistical analysis of the Ra and Rz parameters measured on the end face surface of specimens after milling with a trochoidal step of s tr = 5% and s tr = 30% and after brushing are presented in Table 6  At the standard level of significance, the change in str was shown not to exert a significant effect on the observed variance of results. However, in the case of mean values, no effect was demonstrated only for the Rz parameter measured on the lateral face of AZ31 Mg alloy workpieces. In the case of Ra results, the disparity in mean values was observed; however, it appears to favor employing larger trochoidal step values.
Results from the statistical analysis of the Ra and Rz parameters measured on the end face surface of specimens after milling with a trochoidal step of str = 5% and str = 30% and after brushing are presented in Table 6 Figure 24. Results from the Shapiro-Wilk test of normality conducted for the distribution of the Ra parameter results after trochoidal milling and brushing: Ra, AZ31 str = 30%.  From the statistical analysis presented above, it can be seen that the hypothesis of equality of variances was confirmed in all cases. The obtained mean values of Ra after milling and brushing reveal that in surfaces machined at a higher trochoidal step, Ra shows a statistically significant From the statistical analysis presented above, it can be seen that the hypothesis of equality of variances was confirmed in all cases. The obtained mean values of Ra after milling and brushing reveal that in surfaces machined at a higher trochoidal step, Ra shows a statistically significant increase along with the increase in s tr . No differences were found for the Rz parameter measured on the end face of the AZ31 workpieces.

Conclusions
The experimental and mathematical data obtained in the study reported in this work enabled the following conclusions.

1.
Lower values of roughness parameters after milling were obtained at the end face of the specimen (e.g., for AZ31 and s tr = 30%: end face Rz = 9.22 µm, lateral face Rz = 14 µm).

2.
The changes in the analyzed roughness parameters were different in response to v c and s tr .

3.
For both alloys, similar values of the analyzed roughness parameters were achieved (e.g., for v c = 400 m/min, Rz: AZ31 was 8.66 µm and AZ91D was 9.15 µm). The discrepancies could only be considered at the statistical level; however, they are technologically irrelevant.

4.
Although the change in the tested milling input parameters (v c /s tr ) induced a change in the investigated surface roughness parameters, it is, however, difficult to observe a distinctive trend. 5.
In relation to milling, brushing treatment reduces the roughness parameters of the tested Mg alloy specimens by several times. Following brushing, an approximately 5.6-fold decrease in the roughness (Ra parameter) was observed for the AZ31 alloy and about 3.9-fold for the AZ91D alloy, compared to the initial machining, i.e., milling with a variable trochoidal step. 6.
The largest increase in the value of the surface free energy (16%) was observed for the AZ91D alloy during the change of the s tr parameter. The increase in the SFE directly impacts the increase in the polar component of the SFE, which for the AZ91D alloy was 96%.

7.
Considering the simulation results of the roughness parameters and their correlation with the actual cutting data, the error was shown not to exceed the acceptable level of 15% (10% for milling and 15% for milling and brushing). ANNs exhibit good potential for the simulation of accurate data for the preliminary determination of milling parameters. 8.
The ANNs succeeded in representing the non-linear dependence between machining and roughness parameters. This may prove their fitness for the analysis of milling without the need for implementing time-, labor-, and cost-consuming machining. 9.
ANN simulation may be the cornerstone of modelling tools for the analysis of phenomena in machining. If effectively implemented, it can aid the decision-making process by producing precise cutting data that ensures the required surface roughness. A set of parameters (v c and s tr ) fed into the system as input for computation is transformed into surface roughness parameter values (Rz) for the tested machining parameters (milling, brushing) of the tested Mg alloys, AZ31 and AZ91D. 10. The statistical analysis of Ra confirms that in the milling and brushing variant, the change in s tr is reflected in the statistically significant change in the values of Ra. The observed variance of means, however, appears to indicate a favorable effect of a higher trochoidal step on the surface finish (for s tr = 5% was 1.91 µm and s tr = 30% was 1.63 µm). A reverse effect was shown in the milling and brushing of AZ31 alloy.

Conflicts of Interest:
The authors declare no conflicts of interest.