Identification of a Workpiece Temperature Compensation Model for Automatic Correction of the Cutting Process

This article describes a system for measuring and compensating for errors resulting from the cutting process in order to improve the accuracy of the workpiece. Measurements were performed by means of an automatic measurement unit. The diameter of the workpiece was measured at two points, and at the same time, the temperature at the end face of the workpiece was measured. These measurements were used in Statistical Process Control (SPC). Based on the measured values, the process stability was checked and an error correction value was determined for the next item. Moreover, the value of the correction was influenced by the assumed value of tool wear, in accordance with the adopted model, and the possibility of achieving the assumed surface quality. The diameter of the workpiece for SPC purposes was measured under industrial conditions using an automatic measurement unit, which indicates that the temperature of the workpiece during the measurement was significantly higher than the reference temperature. The study focuses on the possibility of identifying a workpiece temperature compensation model in measurements of the workpiece diameter for the purpose of introducing an additional change in the correction value. It was found that a model with a constant correction value and a linear model poorly reflect the nature of the changes. On the other hand, the Autoregressive with Extra Input (ARX) model and the Nonlinear Autoregressive with Extra Input (NLARX) model, with a neural network, are able to map the inertia of the system and map the process with greater accuracy. In this way, measurements performed in industrial conditions can more accurately determine the possibility of achieving the assumed tolerance of the finished product. At the same time, the research shows that the temperature compensation model is nonlinear, and that the maximum possible machining accuracy of the workpiece can be achieved thanks to the repeatable measurement and compensation technique.


Introduction
Achieving high accuracy of the workpiece is one of the greatest challenges in industrial manufacturing [1][2][3][4][5]. In the case of production lines with high precision requirements, due to the narrow tolerances of each elementary process, high-specification and highprecision machines are required, resulting in high equipment costs [6]. The accuracy and precision of manufacturing systems can be achieved and improved by real-time measurement and error compensation in the manufacturing process [7,8]. This allows systems to compensate for errors and to improve accuracy and precision in machining. Therefore, the accuracy of machining is achieved thanks to the use of modern, superaccurate solutions to compensate for hardware and software errors. Compensation software for controlling the accuracy of machining is developing along with the availability of highaccuracy computers and sensors.
Technological quality is produced in a process whose impact is force and temperature [9][10][11]. This indicates that the workpiece measured immediately after machining is not • thermal phenomena related to heat emission in the cutting zone [10,14]; • rigidity of the cutting system, its deflections and vibrations [15,16]; • machining parameters, type of tool and machining method, quality of measuring systems and positional repeatability [17,18].
Analysis of the above factors, their identification and partial compensation are the basic elements in improving the accuracy of machining through software process correction [19,20]. The difficulty in developing a uniform compensation system for all machining errors is due to the fact that only some of them depend on the machining system [21][22][23]. The technological quality of the workpiece can be ensured under conditions of narrow error tolerance for the workpiece, for which:

1.
Geometric errors of the machining system are compensated by software, and their accuracy is periodically verified using high-accuracy sensors and measurement methods [8].

2.
Errors resulting from the mutual displacement of the tool and the workpiece are modeled and then compensated due to the elastic return of the material under the influence of the applied force [9]. 3.
Errors originating in tool wear are modeled and then compensated in the machining program [11]. Tool wear is the cause of some discrepancies in the modeled and actual characteristics of machining processes, due to nonlinearity. 4.
Errors resulting from thermal deformations in the machining process are modeled and compensated in the values of cutting parameters [10,24].
As can be seen from the above, precise error modeling is a critical part of the elimination of errors. The most cost-effective way to obtain high-quality, high-performance products is through the use of error compensation techniques. Sources of errors related to the machining system and methods of compensating for geometric and thermal errors of the machining system by means of software are recognized research topics [14,25,26].
The modeling of production processes is used to predict the result depending on the selected settings. Machine tool-process simulation is used in most published studies for the analysis of machining stability, as in [27], which reports on the influence of the tool nose radius on the stability of turning operations.
On the other hand, the compensation of errors resulting from the cutting process depends on physical phenomena that are nonlinear and often chaotic, the modeling of which takes place in the conditions of difficult-to-machine materials. For example, thermally induced errors can account for as large of an amount as 70% of the dimensional errors of a workpiece [28]. Therefore, compensation for errors resulting from the cutting process is carried out by monitoring and ongoing control of the production process [29]. The basis of process monitoring and control is the analysis of measurements [30]. Process correction as compensation for machining errors can be performed online, where the measuring system is part of the machining system. The cutting correction process is carried out in a very short time, in order that it can be treated as real-time programming. The measurement unit is sensitive to various physical disturbances (temperatures, forces, deflections, etc.) occurring in the measurement process [31]. On the other hand, offline methods are based on the analysis and modeling of various sources of errors that affect the accuracy of the workpiece. The resulting regression relationship between the driven independent variables and the error variable can provide a basis for calculating the process adjustment. After a process correction is made, the accuracy of the post-processing increases significantly.
The aim of this article is to define a methodology for introducing corrections in Statistical Process Control (SPC) in order to compensate for errors in thermal deformation of the workpiece. The basis of the calculated values is a model that describes the relationship between the measured values of the physical quantities of the workpiece immediately after the process (for high temperature of the workpiece and industrial measurement conditions) and under reference conditions. The Section 2 discusses the research methodology related to the general requirements of the production process; then the automatic measurement unit is defined and the implementation of corrections in the SPC system is presented. The Section 3 presents an example of SPC operation and the identification of a workpiece temperature compensation model. Four models were developed and validated: A model with bias, a model with linear dependence on temperature difference (linear model), the Autoregressive with Extra Input (ARX) model, and the Nonlinear Autoregressive with Extra Input (NLARX) model. The Section 4 summarizes the range of applicability of individual models in industrial practice.

Materials and Methods
The automatic process correction unit was developed under the assumptions listed below:

1.
For the cutting process, a process model has been developed, including a model of the wear of the tools used and the achievement of the assumed surface accuracy.

2.
An automatic measurement unit measuring the workpiece diameter in industrial conditions has been developed.

3.
A procedure for determining the stability of the process and ensuring the achievement of the assumed accuracy of the final product has been developed.

Technological Machining Process
The research was carried out in industrial conditions for an optimized production process. A roadmap for an optimized cutting process consists of a definition of the material and process and product requirements; next, the model of the process structure and behavior is developed; and finally the constraints and parameters of the process are specified [32].
When designing the cutting process, the most important requirement taken into account was the quality of the product. The workpiece has a complex shape with many measured physical quantities (measurands). In this study, quality was considered in terms of the dimensional accuracy of the workpiece diameter, which was measured at two points. The geometric accuracy is influenced by many features, which are presented in Figure 1. These features are related to each other. It follows that obtaining the assumed precision parameters requires, among other things, a suitably stabilized process. between the measured values of the physical quantities of the workpiece immediately af ter the process (for high temperature of the workpiece and industrial measurement con ditions) and under reference conditions. The Section 2 discusses the research methodol ogy related to the general requirements of the production process; then the automati measurement unit is defined and the implementation of corrections in the SPC system i presented. The Section 3 presents an example of SPC operation and the identification of workpiece temperature compensation model. Four models were developed and vali dated: A model with bias, a model with linear dependence on temperature difference (lin ear model), the Autoregressive with Extra Input (ARX) model, and the Nonlinear Auto regressive with Extra Input (NLARX) model. The Section 4 summarizes the range of ap plicability of individual models in industrial practice.

Materials and Methods
The automatic process correction unit was developed under the assumptions listed below: 1. For the cutting process, a process model has been developed, including a model o the wear of the tools used and the achievement of the assumed surface accuracy. 2. An automatic measurement unit measuring the workpiece diameter in industria conditions has been developed. 3. A procedure for determining the stability of the process and ensuring the achieve ment of the assumed accuracy of the final product has been developed.

Technological Machining Process
The research was carried out in industrial conditions for an optimized production pro cess. A roadmap for an optimized cutting process consists of a definition of the material and process and product requirements; next, the model of the process structure and behavior i developed; and finally the constraints and parameters of the process are specified [32].
When designing the cutting process, the most important requirement taken into ac count was the quality of the product. The workpiece has a complex shape with man measured physical quantities (measurands). In this study, quality was considered in term of the dimensional accuracy of the workpiece diameter, which was measured at tw points. The geometric accuracy is influenced by many features, which are presented i Figure 1. These features are related to each other. It follows that obtaining the assumed precision parameters requires, among other things, a suitably stabilized process. Therefore, the first step in achieving the desired quality of the product in certain pro duction situations is to specify the goal of production and then ensure the quality by con sidering all of the predefined requirements of the cutting system [2]. These requirement are important since the production environment changes dynamically, and control de pendencies between product and production parameters cannot be described analytically Therefore, the first step in achieving the desired quality of the product in certain production situations is to specify the goal of production and then ensure the quality by considering all of the predefined requirements of the cutting system [2]. These requirements are important since the production environment changes dynamically, and control dependencies between product and production parameters cannot be described analytically.
Product quality generally correlates with many process variables. Model-based selfoptimization requires sufficient data regarding these variables, in respect of both quality and distribution, to be able to describe the conditions at the operating point with adequate precision [33].
The basic variable in the process is the material and its parameters. For the cast iron used in the research, the chemical composition, microstructure, mechanical properties of casting, and physical properties were determined (Table 1). To maintain targets in product tolerance, the values of the process variables must also be kept within predefined limits. The main process variables are the behavior of the workpiece during cutting, the tool used, machine behavior, and the cutting speed and feed rate.
Cutting speed and feed rate can be read directly from the machine control. For the special tool designated as T0082, the rotational speed was selected in the amount of 1350 rev/min, for the nominal diameter it was 262 m/min. The feed was variable from 0.3 to 0.15 mm/rev. Nevertheless, this information is not sufficient for process optimization, which is why further sensors are used. The sensors need to measure additional process variables, and it is essential that they be integrated into the manufacturing system to enable self-optimization [1].
The general requirement of the cutting process is workpiece accuracy. This accuracy can be achieved; however, it is fundamentally influenced by all of the elements in the system. This indicates that all elements must be designed having in mind the achievement of the prescribed accuracy of the workpiece. Sustainable production causes the cutting process to be directed toward low tolerances, which requires sufficient rigidity of the machine tool and diagnostics for tool wear and the cutting process [11].
The interdependencies between product tolerances and the cutting mechanism are analyzed, and a control loop with adaptation of the control goal must be implemented. In the case of workpiece quality assurance, it is not sufficient to measure the diameter after the process. It is necessary to implement an online system. This will make it possible to intervene in the process and adjust individual values and tolerances in response to deviations in previous steps of the process. In this way, the achieved quality of the product can be made to the greatest extent possible in a certain production situation [21,22]. A model of system behavior refers to use cases of the product and the model of the cutting process, which embrace the whole life cycle of the product.
The sources of the final uncertainty of the workpiece are strictly correlated with the actual cyber-physical model of the cutting process, which is generally geometrically oriented. Geometry in manufacturing is prone to deviations, which imposes on designers the task of specifying suitable dimensions and tolerances for components, in order that the functionality of the product is ensured [34].
It can be clearly seen from the definition of requirements, structure, and the behavior of the model that constant parameters and constraints are not sufficient for implementation of the system. The system should be able to define feedback between system structure and behavior. This implies the need to optimize the model and its parameters.
To adopt a cyber-physical approach, the system must be equipped with data analysis, modeling, and optimization ( Figure 2). Once the model of the process is developed, it becomes possible to optimize parameters and generate the process. Parameters which can be used to produce a desired product are then applied in manufacturing. Due to possible disturbances during cutting (tool wear, vibrations), the monitoring system (sensors and signal processing) is applied. Its role is limited to the identification of disturbances and enforcement of process parameter correction [32]. If the changes in parameters are not acceptable in relation to the final product, the model for process optimization is liable to change.
Materials 2022, 15, x FOR PEER REVIEW 5 o intervene in the process and adjust individual values and tolerances in response to d ations in previous steps of the process. In this way, the achieved quality of the prod can be made to the greatest extent possible in a certain production situation [21,22]. A model of system behavior refers to use cases of the product and the model of cutting process, which embrace the whole life cycle of the product.
The sources of the final uncertainty of the workpiece are strictly correlated with actual cyber-physical model of the cutting process, which is generally geometrically ented. Geometry in manufacturing is prone to deviations, which imposes on designers task of specifying suitable dimensions and tolerances for components, in order that functionality of the product is ensured [34].
It can be clearly seen from the definition of requirements, structure, and the behav of the model that constant parameters and constraints are not sufficient for implemen tion of the system. The system should be able to define feedback between system struct and behavior. This implies the need to optimize the model and its parameters.
To adopt a cyber-physical approach, the system must be equipped with data analy modeling, and optimization ( Figure 2). Once the model of the process is developed, it becom possible to optimize parameters and generate the process. Parameters which can be used produce a desired product are then applied in manufacturing. Due to possible disturban during cutting (tool wear, vibrations), the monitoring system (sensors and signal process is applied. Its role is limited to the identification of disturbances and enforcement of pro parameter correction [32]. If the changes in parameters are not acceptable in relation to final product, the model for process optimization is liable to change. Model-based optimization of the process lays a foundation for generating optimized rameters for the manufacturing system. The parameters are calculated to ensure the qualit the product. Modeling can consider many factors, including those related to process chan Not all changes are sufficiently predictable to be subjected to modeling; however, the mo is optimal provided that the conditions for which it is developed are met. Changing exte or internal conditions in the process may lead to inadequacy of the model and its paramet Therefore, there appears to be a need for cognitive systems to deal with these situations.
To achieve the assumed quality of a product in the cutting process, it is necessar implement the desired autonomy in the production system [35]. This can be accomplis by means of digital automation of data processing, decision-making tasks, and optim tion. The system should be equipped with artificial sensors and actuators, which are in grated and embedded into physical systems and act in the physical world [5].
The main element of the system is cognitive control (behaving in accordance with lo term intentions) and the connection with other elements of the system featuring cogni capabilities (perception, reasoning, learning, and planning). The cyber-physical cogni Model-based optimization of the process lays a foundation for generating optimized parameters for the manufacturing system. The parameters are calculated to ensure the quality of the product. Modeling can consider many factors, including those related to process changes. Not all changes are sufficiently predictable to be subjected to modeling; however, the model is optimal provided that the conditions for which it is developed are met. Changing external or internal conditions in the process may lead to inadequacy of the model and its parameters. Therefore, there appears to be a need for cognitive systems to deal with these situations.
To achieve the assumed quality of a product in the cutting process, it is necessary to implement the desired autonomy in the production system [35]. This can be accomplished by means of digital automation of data processing, decision-making tasks, and optimization. The system should be equipped with artificial sensors and actuators, which are integrated and embedded into physical systems and act in the physical world [5].
The main element of the system is cognitive control (behaving in accordance with longterm intentions) and the connection with other elements of the system featuring cognitive capabilities (perception, reasoning, learning, and planning). The cyber-physical cognitive system can reason using substantial amounts of appropriately represented knowledge, learns from its experience, and is aware of its own capabilities.

Automatic Measurement Unit
In the case of the machining process, measurement during the actual machining process without interrupting that process is only possible if the measurements do not directly relate to the workpiece. The reason is that there are disturbances in the cutting operations (chips and coolant). For indirect measurements, the solution enables real-time measurement, and the information generated by in-process measurements is provided continuously. An example of indirect measurements may be the measurement of cutting resistance or vibrations.
A review of the existing measurement systems and their software enabling measurement on the production line did not reveal the existence of ready-made devices in the form of automatic measurement units. Therefore, this unit was developed. Its basic functionality relates to automatic operation that does not require the presence of an operator. It is a unit developed within the organization to carry out measurements on the production line in cooperation with an industrial robot. The measurement can be performed directly on the machine or off the machine, but is performed during the process cycle. The workpiece can be assessed during or after machining.
An automatic measurement unit made it possible to measure the diameter of the workpiece. In the case of diameter measurements, the measuring instrument was a doublecontact bore gauge. The diameter was measured at two points labeled A and B, and the temperature of the workpiece face was measured. Measurement point B was at the bottom of the bearing bore, and measurement point A was closer to the start of the bore. The temperature was measured at the face of the workpiece. Measurement of diameter and temperature using the automatic measurement unit was performed within 1 min of the completion of the cutting operation.
The reference measurement was carried out after the workpiece was stabilized to a temperature of 23 • C. Post-process measurement was performed on an independent machine after the workpiece was removed from the process. The advantage of this method is that post-process measurement covers the effects of all error sources that affect the workpiece in one set-up [30]. Compared with in-process measurement, post-process measurement is time-consuming and carries the risk of producing multiple defective items before the inspection results are known.

Implementation of Corrections in the SPC System
The research problem concerns the current correction of the cutting process in industrial conditions, for which the workpiece is characterized by a significantly higher temperature than in the case of a workpiece in a stabilized state. To obtain the maximum possible accuracy for the diameter of the workpiece, a system for measuring and compensating for repeated errors was developed. The procedure for handling the automatic process correction consisted of several stages.

1.
Before starting the analysis, all tools were replaced with new ones. Then, the automatic measurement unit was set up and its measuring ability was confirmed. The automatic measurement unit was incorporated into the production cycle. This indicates that all measurements were performed automatically, with full recording of the results. After a correction or a tool change, this information was saved in the database with indication of the correction value and the workpiece number (measurement point).
The diameter of the workpiece after the tool position correction was measured by the same method after stabilizing the temperature (reference measurement). The deviation between the expected and measured values was calculated and the nominal toolpath was modified appropriately before the next part was machined. The reference temperature at which the reference measurement was carried out was set at 23 • C.

2.
Conduct of a full experiment-all measurements were carried out by the automatic measurement unit. The automatic measurement unit measured the diameter of the hole closer to the face of the workpiece (measurement at point A on the workpiece) and inside the hole (measurement at point B on the workpiece). During the measurements, corrections were made in the process with regard to improvement of the process stability and the wear of the tools. The process correction program takes into account tool wear based on an experiment. Without tool life compensation, producing parts to a given tolerance would mean an increase in tool costs, and in the case of frequent tool changes, there would be no guarantee that the given tolerances would not be exceeded. Tool wear entails shortening of the tool, which causes a constant shift for the entire machined profile. When programming the change in cutting depth, the appropriate measurement error is used to quantify the parameters of the linear approximation. In order to meet the chip forming requirements and the necessary undeformed chip thickness, the process correction value was selected to obtain the minimum cutting layer thickness.

3.
Analysis of the measurement data, automatic measurement, and identification of the measurement error were performed in order to adjust the automatic process correction system. Using the process cycle measurement performed by the automatic measurement unit, the value of the physical quantity of the workpiece being machined (workpiece diameter) was measured immediately after cutting. One of the main advantages is the ability to use measurement data to derive corrective actions to improve the accuracy of the machining process ( Figure 2). As a result, the performed measurement is used not only to obtain the final assumed value of the physical quantity of the workpiece, but also to obtain up-to-date information about the cutting process [36]. Process control [37] provides control data for parts between cutting cycles, in order that detected machining errors can be used to predict errors for subsequent parts and to perform process corrections.

Results and Discussion
Manufacturing a product indicates the processing of raw materials and semi-finished products to obtain parts, and the assembly of these machined parts by adding manufactured items and purchased parts to complete the product. Each part must conform to specifications to fulfill its function. This can be tested by measuring and comparing the measurement result with specifications and tolerances. A good manufacturing system is a system that produces output as predicted. This indicates that knowing the model of the cutting process and its behavior over time, we can determine the probability of producing the assumed value of the physical quantity of the workpiece. This view of the manufacturing system is not very realistic, as manufacturing systems are complex and the process model is influenced by many factors. Therefore, implementation involves several stages. In the first stage, a basic model is created, often supported by an experiment, which determines the cutting parameters in a given operating situation. The model can be expanded using various techniques for examining changes in the manufacturing system, examining disruptions in the cutting process, and adjusting the cutting parameters to the changes that have occurred. In this second stage, the implementation of corrections may be very extensive. Nevertheless, the production system functions on the basis of keeping pace with the constantly appearing disturbances of the original model.
The situation in which quality is designed is completely different. The third stage breaks away from the previous ones and creates an inverse model of the alternatives to obtain the assumed quality with a certain probability. The implementation of corrections in the process is not a follow-up task, but takes place in accordance with the probability of obtaining satisfactory quality in terms of a measurand of the workpiece.

Stability of the Machining System and Corrections in the Process
The basic requirement for a machining system operating under a certain degree of autonomy is to ensure stable operation and self-optimization in order to achieve product production within the specification. The control chart tests are designed to investigate the variability that arises from the process itself. Control limits are developed based on process data [38]. Figure 3 shows examples of control charts with the emphasis on model situations requiring intervention in the process, along with examples from the actual production process. The diameter measurement at point A for successive workpieces varies between an upper control limit and a lower control limit. Figure 3a shows an example where the measured value exceeds a lower control limit. A single disturbance for item 71 (measurement point 71) resulted in a tool change for roughing and finishing. After replacement of the tools, the values of the measured diameters for the next workpieces are within the given limits.

Stability of the Machining System and Corrections in the Process
The basic requirement for a machining system operating under a certain degree of autonomy is to ensure stable operation and self-optimization in order to achieve product production within the specification. The control chart tests are designed to investigate the variability that arises from the process itself. Control limits are developed based on process data [38]. Figure 3 shows examples of control charts with the emphasis on model situations requiring intervention in the process, along with examples from the actual production process. The diameter measurement at point A for successive workpieces varies between an upper control limit and a lower control limit. Figure 3a shows an example where the measured value exceeds a lower control limit. A single disturbance for item 71 (measurement point 71) resulted in a tool change for roughing and finishing. After replacement of the tools, the values of the measured diameters for the next workpieces are within the given limits. Complete process analysis based on the diameter measurement data was concerned with recognizing systematic or nonrandom patterns in an average value control chart and identifying the source of this process variation. The example pattern in Figure 3b relates to six consecutive workpieces with increasing diameter values.
When the Statistical Process Control (SPC) detects a pattern, it reveals that the process may be unstable. The system's reaction depends on the detected pattern and the pro- Figure 3. Examples of control chart test for special case variation applied to diameter measurement data at point A on the workpiece: UCL-upper control limit, xcenter line, LCL-lower control limit. A-zone between lines calculated at 2σ and 3σ above the center line, B-zone between lines calculated at σ and 2σ above the center line, C-zone between the center line and the line calculated at σ above the center line.
Complete process analysis based on the diameter measurement data was concerned with recognizing systematic or nonrandom patterns in an average value control chart and identifying the source of this process variation. The example pattern in Figure 3b relates to six consecutive workpieces with increasing diameter values.
When the Statistical Process Control (SPC) detects a pattern, it reveals that the process may be unstable. The system's reaction depends on the detected pattern and the process itself. In the case of the pattern in Figure 3b, the machining program was modified.
For other patterns-for example, two of the three workpieces have a diameter in zone A (Figure 3c), or four of the five workpieces have a diameter in zone B or beyond (Figure 3d)-the correction was to modify the nominal depth of cut in the next pass. Since in practice the values of the machined parameters are entered to obtain the desired diameters in the workpiece program, the diameter values in the compensation program can be obtained by appropriately programming the corrections.
The cutting tests were performed for a stable thermal state of the machine tool, in order that it was possible to discount the changes in workpiece errors caused by thermal deformations of the machine tool. The process capability was assessed prior to the start of series production in accordance with the standards, as described, for example, in [39]. Measurement system capability indices were as follows: • R&R at a level of 29.48-an acceptable system, but requiring improvement; • SPC results-required level of Cp = 1.33, with corrections Cp = 1.46, Cpk = 1.26 (measurement at point A on the workpiece).
The main sources of diameter inaccuracies were machining process errors, such as tool wear, tool deflection, and workpiece deflection due to the cutting force. The workpiece diameter was measured; next, the machining errors for the workpiece diameter were calculated and the nominal diameters for the next workpiece were modified. The workpiece temperature was found to be variable and considerably higher than 23 • C. Therefore, different tolerance limits were assumed for workpieces immediately after machining.
Let us analyze the entire experiment by examining the capability of the process (Figure 4). We start by assigning five consecutive measurements between the pre-check limits. After this condition is met, samples are taken periodically and the stability of the process is checked.
Materials 2022, 15, x FOR PEER REVIEW stabilization. Figure 4 shows a situation where the measurement data show the u of a process correction applied to stabilize the process.

Identification of the Workpiece Temperature Compensation Model
Corrections in the process were carried out in accordance with a program the progressive wear of the tools and the possible loss of stability. The automat correction system read the measurement data from the automatic measuremen assessed the probability of achieving the desired quality of the workpiece. The ment used as a basis for estimating the probability came directly from the measu piece, while it was in a heated state. The influence of the temperature of the wor the diameter value results directly from the thermal expansion of the material fr the workpiece is made. Figure 5 shows the measurement results for a heated w and after stabilization. As can be seen, the results do not coincide. The first measurement performed after the cutting process showed a temperature of 63 • C, and the measured values of the diameter for points A and B were within the assumed tolerance limit. However, due to the fact that this value was significant, a correction of −0.01 mm was introduced.
The measurement for SPC is carried out immediately after machining, and despite the stabilization of the working temperature of the machining system, the temperature of the workpiece varies between 40 and 90 • C. Figure 4 shows the control chart (for point A) with marked process corrections for the first 50 measured parts after the process of stabilization. Figure 4 shows a situation where the measurement data show the usefulness of a process correction applied to stabilize the process.

Identification of the Workpiece Temperature Compensation Model
Corrections in the process were carried out in accordance with a program covering the progressive wear of the tools and the possible loss of stability. The automatic process correction system read the measurement data from the automatic measurement unit and assessed the probability of achieving the desired quality of the workpiece. The measurement used as a basis for estimating the probability came directly from the measured workpiece, while it was in a heated state. The influence of the temperature of the workpiece on the diameter value results directly from the thermal expansion of the material from which the workpiece is made. Figure 5 shows the measurement results for a heated workpiece and after stabilization. As can be seen, the results do not coincide.

Identification of the Workpiece Temperature Compensation Model
Corrections in the process were carried out in accordance with a program covering the progressive wear of the tools and the possible loss of stability. The automatic process correction system read the measurement data from the automatic measurement unit and assessed the probability of achieving the desired quality of the workpiece. The measurement used as a basis for estimating the probability came directly from the measured workpiece, while it was in a heated state. The influence of the temperature of the workpiece on the diameter value results directly from the thermal expansion of the material from which the workpiece is made. Figure 5 shows the measurement results for a heated workpiece and after stabilization. As can be seen, the results do not coincide. If the difference in the measured diameter between the heated workpiece and the stabilized workpiece were influenced only by temperature, the model in this case would be constant. Goodness-of-fit was determined using a normalized root-mean-squared error [40]: where ‖ indicates the 2-norm of a vector, fit is a row vector of length N, and i = 1, …, N, where N is the number of channels. A model with a bias was defined, and its parameters were  If the difference in the measured diameter between the heated workpiece and the stabilized workpiece were influenced only by temperature, the model in this case would be constant. Goodness-of-fit was determined using a normalized root-mean-squared error [40]: where indicates the 2-norm of a vector, fit is a row vector of length N, and i = 1, . . . , N, where N is the number of channels. A model with a bias was defined, and its parameters were identified ( Figure 6). The goodness-of-fit for measurement at point A on the workpiece was NRMSE = −13.41%, and for measurement at point B on the workpiece: NRMSE = −15.41%. In order to take full account of the influence of temperature, a linear relationship of temperature compensation was obtained. In this case, the goodness-of-fit for diameter measurement at point A on the workpiece was NRMSE = −5.24%, and for measurement at point B on the workpiece: NRMSE = −7.32%. Therefore, the linear model was a better match. In Figure 7, the results of the fit are shown.
The model with a constant bias value and the linear model were developed under the assumption that each of the measurements is independent. In the first model, with a constant bias, it was indicated that the difference in the measured diameter between heated and stabilized workpieces is a constant value, and for the automatic operation of the machining system, with no breakdowns and downtimes, the system is in constant thermal conditions. For this reason, it is reasonable to ignore the temperature, which should have a similar value for each workpiece, depending only on the thermal effect of the cutting tools. In order to take full account of the influence of temperature, a linear relationship of temperature compensation was obtained. In this case, the goodness-of-fit for diameter measurement at point A on the workpiece was NRMSE = −5.24%, and for measurement at point B on the workpiece: NRMSE = −7.32%. Therefore, the linear model was a better match. In Figure 7, the results of the fit are shown. The model with a constant bias value and the linear model were developed under the assumption that each of the measurements is independent. In the first model, with a constant bias, it was indicated that the difference in the measured diameter between heated and stabilized workpieces is a constant value, and for the automatic operation of the machining system, with no breakdowns and downtimes, the system is in constant thermal conditions. For this reason, it is reasonable to ignore the temperature, which should have a similar value for each workpiece, depending only on the thermal effect of the cutting tools.
On the other hand, the linear model refers to a situation in which the temperature of the workpiece changes within a defined range immediately after machining, and the temperature is continuously measured with each workpiece. Fluctuations are due to the Diameter, mm  In order to take full account of the influence of temperature, a linear relationship of temperature compensation was obtained. In this case, the goodness-of-fit for diameter measurement at point A on the workpiece was NRMSE = −5.24%, and for measurement at point B on the workpiece: NRMSE = −7.32%. Therefore, the linear model was a better match. In Figure 7, the results of the fit are shown. The model with a constant bias value and the linear model were developed under the assumption that each of the measurements is independent. In the first model, with a constant bias, it was indicated that the difference in the measured diameter between heated and stabilized workpieces is a constant value, and for the automatic operation of the machining system, with no breakdowns and downtimes, the system is in constant thermal conditions. For this reason, it is reasonable to ignore the temperature, which should have a similar value for each workpiece, depending only on the thermal effect of the cutting tools.
On the other hand, the linear model refers to a situation in which the temperature of the workpiece changes within a defined range immediately after machining, and the temperature is continuously measured with each workpiece. Fluctuations are due to the Diameter, mm On the other hand, the linear model refers to a situation in which the temperature of the workpiece changes within a defined range immediately after machining, and the temperature is continuously measured with each workpiece. Fluctuations are due to the replacement of cutting tools and other factors. Compared with the model with a fixed value, the linear model showed a better fit with the results of the experiment, but still deviated from the reference data.
When analyzing the cutting process and subsequent workpieces, attention was drawn to the fact that while the machining of each workpiece is performed independently, it is the result of the same process.
When obtaining the values of corrections, it was decided to test the assumption that the machining system has inertia that affects subsequent measurement results. Knowing the measurement data from previous items, it is possible to estimate the value of the current measurement and predict the behavior of the system for subsequent items. Therefore, the Autoregressive with Extra Input (ARX) model was proposed, since it contains information about the previous measured values, and the model tuning is performed on the basis of the data from the current measurement [41,42].
The ARX model structure (Figure 8) is given by the following equation: y(n) + a 1 y(n − 1) +...+ a na y(n − n a ) = b 1 u(n − n k ) +...+ b nb u(n − n b − n k + 1) + e(n) (2) rent measurement and predict the behavior of the system for subsequent items. Therefore, the Autoregressive with Extra Input (ARX) model was proposed, since it contains information about the previous measured values, and the model tuning is performed on the basis of the data from the current measurement [41,42]. The ARX model structure (Figure 8) is given by the following equation: y(n) + a1 y(n  1) +...+ ana y(n − na) = b1 u(n − nk) +...+ bnb u(n -nb -nk + 1) + e(n) (2) The results of using the ARX model showed a better fit than for the linear model and the model with a constant value ( Figure 9). In this case, the goodness-of-fit for measurement at point A on the workpiece was NRMSE = 14.74%, and for measurement at point B on the workpiece: NRMSE = 7.743%. Therefore, the hypothesis that the machining system has inertia was confirmed, and the value of the current measurement in undisturbed machining conditions can be estimated on the basis of measurements from previous workpieces and current information about the temperature and diameter of the heated workpiece. The results of using the ARX model showed a better fit than for the linear model and the model with a constant value (Figure 9). In this case, the goodness-of-fit for measurement at point A on the workpiece was NRMSE = 14.74%, and for measurement at point B on the workpiece: NRMSE = 7.743%. Therefore, the hypothesis that the machining system has inertia was confirmed, and the value of the current measurement in undisturbed machining conditions can be estimated on the basis of measurements from previous workpieces and current information about the temperature and diameter of the heated workpiece. The relationship between the measured diameter for a heated workpiece and a temperature-stabilized workpiece is nonlinear. The hypothesis of nonlinearity was tested, and the test showed the existence of nonlinearity of data in the tested relationship [43]. Therefore, a model combining the ARX model with a nonlinear function in the form of an artificial neural network was used-the Nonlinear Autoregressive with Extra Input (NLARX) model ( Figure 10). The structure of the estimator is described by the Wiener model, con- The relationship between the measured diameter for a heated workpiece and a temperature-stabilized workpiece is nonlinear. The hypothesis of nonlinearity was tested, and the test showed the existence of nonlinearity of data in the tested relationship [43]. Therefore, a model combining the ARX model with a nonlinear function in the form of an artificial neural network was used-the Nonlinear Autoregressive with Extra Input (NLARX) model ( Figure 10). The structure of the estimator is described by the Wiener model, consisting of a linear regressor in the form of an ARX model with the structure described in the previous stage of the research and a nonlinear function. Data from the ARX estimator are entered into the nonlinear function. As a nonlinear function, an artificial neural network was used, which is a universal nonlinear approximator. This type of network is widely used, and there are studies confirming their usefulness and effectiveness in modeling nonlinear relationships [44]. The neural network was designed with the structure of a unidirectional perceptron with four hidden layers, one neuron in each ( Figure 11). The transition functions are a log-sigmoid transfer function, a normalized radial basis transfer function, a normalized radial basis transfer function, and a linear transfer function. The relationship between the measured diameter for a heated workpiece and a perature-stabilized workpiece is nonlinear. The hypothesis of nonlinearity was tested the test showed the existence of nonlinearity of data in the tested relationship [43]. T fore, a model combining the ARX model with a nonlinear function in the form of an ficial neural network was used-the Nonlinear Autoregressive with Extra Input (NL model (Figure 10). The structure of the estimator is described by the Wiener model sisting of a linear regressor in the form of an ARX model with the structure describ the previous stage of the research and a nonlinear function. Data from the ARX estim are entered into the nonlinear function. As a nonlinear function, an artificial neura work was used, which is a universal nonlinear approximator. This type of netwo widely used, and there are studies confirming their usefulness and effectiveness in eling nonlinear relationships [44]. The neural network was designed with the structu a unidirectional perceptron with four hidden layers, one neuron in each ( Figure 11) transition functions are a log-sigmoid transfer function, a normalized radial basis tra function, a normalized radial basis transfer function, and a linear transfer function.  The results of using the nonlinear NLARX estimator confirmed its significantly b properties compared with the previously used estimators (Figure 12). Both for mea ment at point A and for measurement at point B, the goodness-of-fit was higher. In case, the goodness-of-fit for measurement at point A on the workpiece was NRM 23.64%, and for measurement at point B on the workpiece: NRMSE = 9.996%.  The relationship between the measured diameter for a heated workpiece and a temperature-stabilized workpiece is nonlinear. The hypothesis of nonlinearity was tested, and the test showed the existence of nonlinearity of data in the tested relationship [43]. Therefore, a model combining the ARX model with a nonlinear function in the form of an artificial neural network was used-the Nonlinear Autoregressive with Extra Input (NLARX) model ( Figure 10). The structure of the estimator is described by the Wiener model, consisting of a linear regressor in the form of an ARX model with the structure described in the previous stage of the research and a nonlinear function. Data from the ARX estimator are entered into the nonlinear function. As a nonlinear function, an artificial neural network was used, which is a universal nonlinear approximator. This type of network is widely used, and there are studies confirming their usefulness and effectiveness in modeling nonlinear relationships [44]. The neural network was designed with the structure of a unidirectional perceptron with four hidden layers, one neuron in each ( Figure 11). The transition functions are a log-sigmoid transfer function, a normalized radial basis transfer function, a normalized radial basis transfer function, and a linear transfer function.  The results of using the nonlinear NLARX estimator confirmed its significantly better properties compared with the previously used estimators (Figure 12). Both for measurement at point A and for measurement at point B, the goodness-of-fit was higher. In this case, the goodness-of-fit for measurement at point A on the workpiece was NRMSE = 23.64%, and for measurement at point B on the workpiece: NRMSE = 9.996%. The results of using the nonlinear NLARX estimator confirmed its significantly better properties compared with the previously used estimators (Figure 12). Both for measurement at point A and for measurement at point B, the goodness-of-fit was higher. In this case, the goodness-of-fit for measurement at point A on the workpiece was NRMSE = 23.64%, and for measurement at point B on the workpiece: NRMSE = 9.996%. The neural network was used to find the relationship between the measured diameter of the heated workpiece after the cutting process and the measured diameter of the stabilized workpiece. A neural network is used to fit nonlinear data. The number of layers and neurons was chosen to model the nonlinearity involved in the heating and cooling of the workpiece, observing regression plots and performance. A multi-layer back propagation algorithm was used to develop the model. The architecture of the neural network is shown in Figure 11.   The neural network was used to find the relationship between the measured diameter of the heated workpiece after the cutting process and the measured diameter of the stabi-lized workpiece. A neural network is used to fit nonlinear data. The number of layers and neurons was chosen to model the nonlinearity involved in the heating and cooling of the workpiece, observing regression plots and performance. A multi-layer back propagation algorithm was used to develop the model. The architecture of the neural network is shown in Figure 11.
Automatic process correction automatically measures the part diameter at point A and at point B on the workpiece and the temperature at the face of the part. On the basis of the measured temperature and the diameter at point A on the workpiece, the estimated value of the diameter at point A is determined for the workpiece after stabilization. Similarly, the value of the diameter at point B on the workpiece is estimated. The use of a neural network made it possible to fine-tune the model and to take account of nonlinearity. Table 2 summarizes the values of goodness-of-fit, and Figure 13 shows the results of identification of individual models for 100 measurements. The results of fitting different models to the experimental data indicate unambiguously that the NLARX model achieves the best fit.  Furthermore, analysis of the residuals from the developed models confirmed that the use of NLARX models provides the best reflection of the course of the process. The whiteness test for residuals is used to determine the covariance estimate: If  t is indeed a white-noise sequence, then would be asymptotically  M distributed. Therefore, independence between the residuals  t can be tested by checking whether ρ ,   M , the  level of the  M distribution [45].
The model selection criterion based on the whiteness test was dependent on checking how many of the residuals contained useful information [46]. The method was based on Furthermore, analysis of the residuals from the developed models confirmed that the use of NLARX models provides the best reflection of the course of the process. The whiteness test for residuals is used to determine the covariance estimate: If {ε(t)} is indeed a white-noise sequence, then