Approach to Online Defect Monitoring in Fused Deposition Modeling Based on the Variation of the Temperature Field

According to the surface state of the product, a process quality monitoring technology based on a Qualitative Trend Analysis method is proposed. The construction of the product surface defect knowledge base provides a basis for online monitoring of the nozzle status of the fused deposition modeling (FDM) machine. Ten workpieces are designed in all, and each one conducts two prints which are normal and abnormal, respectively. An infrared thermal imager is used to obtain the temperature image of each layer of the workpiece surface; the feature values are extracted, and the difference between the feature values in the two kinds of printing is calculated. The Qualitative Trend Analysis method is used to analyze the difference in order to obtain the corresponding sensitive feature parameters corresponding to the starting points in different phases of the product printing. The change rules of the sensitive feature values are summarized, and the threshold of each starting point is solved. Base on that, the knowledge rules are defined and the defect knowledge base is constructed. Finally, a new experiment is designed to obtain the theoretical starting point of each state of the product surface in the building process. By comparing the theoretical starting point with the actual starting point, the feasibility of the knowledge rules in monitoring the nozzle working state is verified.


Introduction
As an achievement in the development of new technologies and materials, additive manufacturing (AM) has largely made up for the shortcomings of traditional manufacturing industry and promoted the development of modern manufacturing. Additive manufacturing is also called 3D printing. Fused deposition modeling (FDM) is the simplest additive manufacturing technology. Its appearance is a major breakthrough in the history of rapid manufacturing. It has not only reformed the traditional production methods but also simplified the manufacturing process and improved the production efficiency [1]. However, due to the limitations such as immaturity of the technology, there are still many problems to be resolved in the process of FDM in production. Many products built by FDM have the defects such as insufficient precision, warping, short filling [2][3][4], string shearing, or nozzle failure [5][6][7], which seriously restrict the application of FDM. For print failure often occurs in the building process, the improvement of the intelligent monitoring of the FDM building process is particularly important.
The complexity of machining processes results that online quality control procedures are expensive and difficult. In order to monitor the process quality, much research work has been done and many intelligent algorithms for quality control are researched. Hybrid incremental model with optimal parametrization is used to predict surface roughness in milling processes [8]. Fuzzy x and s control charts are used to monitor the surface roughness of optical lenses in the online manufacturing process [9]. A two-stage neural network-based scheme to enhance the accurate identification rate is used in statistical process control and engineering process control, and satisfactory result is got [10]. Profile monitoring method is used to detect the geometric error in the manufacturing process of FDM [11].
At present, the research on the quality of the FDM building process mainly focuses on two aspects. One is to study the working status of the machine in the building process, such as obtaining the diagnostic method of machine failure through the processing of the sound signal. In this kind of research work, the acoustic emission original waveform data are collected directly using signal processing methods such as wavelet analysis and empirical mode decomposition to extract the relevant eigenvalues according to the extracted eigenvalues of the process state identification in the FDM building process [12][13][14]. Another focus is to directly analyze the quality of the product in the building process. The product contour, temperature, and other parameters are studied by using CCD cameras or embedded optical sensors, and then, the quality of the product can be judged [15,16]. In this paper, these two aspects mentioned above are combined to research the type of nozzle blockage. Firstly, the quality of the surface of the workpieces under different working conditions of the nozzle is summarized and the knowledge base is constructed. Secondly, the process parameters of FDM are monitored and the work condition of the nozzle can be judged according to the rules in knowledge base.
In the process of FDM, the modeling material undergoes two major phase changes. In order to ensure that the material can be successfully deposited on the substrate, the interaction of materials, FDM machine, parameters, and other factors are needed to work together and any lose efficacy of the factors above can lead to nozzle clogging.
It is found that FDM machine nozzle plugging failure is mainly due to machine errors, impurities of modeling materials, unreasonable printing parameters' setting, and nonstandard operation.
In reality, the nozzle clogging phenomenon usually happens after working for a certain period of time rather than happens suddenly. In different periods, due to the clogging of the nozzles, the processed parts will show different states. Specifically, in the process of normal printing to blockage of the nozzle, the modeling surface of the products generally goes through five stages: normal printing, insufficient filling, warping, serious fault printing, and printing failed.

Construction of Product Surface Defect
Knowledge Base 2.1. Extraction of Temperature Field Feature Parameters. The properties such as viscosity, shrinkage, and other properties of the FDM material will be affected by temperature parameters, which are important factors affecting the surface quality of the products [13,17,18]. Through the analysis of the temperature field of the product surface, the corresponding relation between the temperature and the surface quality state can be found, which can provide a theoretical basis for improving the product quality. It is found that there is a distinct segmentation point between two adjacent states and the sensitivity of different feature parameters to each state is different [19]. In order to acquire the variation rules of the feature parameters in each phase, thermal images of every layer need to be collected. The thermal imaging system used in the experiment is VarioCAM® hr-HS. The temperature it can measure ranges from −40°C to 600°C. Through the actual building process analysis, it is found that the temperature value of the extruded string has three states: the initial value, the steadystate value, and the final value. The initial value refers to the temperature value of modeling material after going through the heated nozzle. The steady-state value refers to the temperature value at the end of the building of each layer, and the last value refers to the temperature value at the beginning of the building of the next layer. The surface of the product mainly goes through two major phases of cooling.
The distance between the nozzle and current layer is too close, so it is difficult to measure the temperature change in the first cooling stage. The condition of the first cooling stage will affect the second stage. So, in this paper, the changes in value are taken as the main parameters to be researched [20,21].
In order to get the value changes of temperature field feature parameters of every layer on a part's surface over a certain period of time, two workpieces are built at the same time and one of them is taken as the research object. In addition, two sets of experiments are needed for each workpiece: normal printing and nonnormal printing. The nozzle temperature for normal building is 220°C, while the nozzle temperature for nonnormal building is gradually reduced from 220°C to 180°C during the printing process.
In order to simplify the process of data processing, the feature parameters of the product surface temperature field need to be extracted, including the mean value, minimum value, maximum value, temperature difference, and variance. The reasons for selecting the five parameters above are that the mean value acts as a measure of the trend in the set of temperature data for the selected section, with the maximum and minimum values being the upper and lower limits, respectively, and the temperature difference expresses the full range of temperature fluctuations at each point in the section, while variance shows the degree of dispersion of the temperature. With the above five parameters, it is conducive to make a quantitative analysis of sample data trends between groups and data dispersion within the group.
The process to get the research parameters is listed as follows.
For the first step, the basic feature parameter values of the surface temperature of each layer are to be obtained. The theoretical formulas are as follows: (i) Mean T: (ii) Minimum value T min : T min = min T ij 2 (iii) Maximum value T max : (iv) Cross-sectional temperature difference T f : (v) Variance S 2 : In the above equations, m refers to the abscissa value of the starting point of the product in each layer's printing, g is the ordinate value of the starting point of the product in each layer's printing, n refers to the abscissa value of the end point of the product in each layer's printing, k is the ordinate value of the end point of the product in each layer's printing, and T ij represents the temperature value of the point at i, j . The image processing system with an infrared thermal imager can be used to get these parameters. The external outline of the product can be sketched out by using the measuring tools in the software, and the basic feature parameter on the surface of the product can be shown directly.
The second step is to calculate the change of the basic feature parameter value in a certain period of time as follows: (i) Mean value change T i : (ii) Minimum value change T i min : (iii) Maximum value change T i max : (iv) Section temperature change T i f : (v) Variance S i 2 : In the above equations, i refers to the number of layers, T i b indicates the temperature at which each layer is printed at the end of the printing process, that is, the time when the nozzle has just left the object of the study, and T i e refers to each point's temperature value acquired before the next layer starts printing.
The third step is to calculate the difference of the basic feature parameters in different building states, which is the main parameter value of the analysis, as follows: (i) Difference in mean value change T ic : (ii) The difference T i min c of the minimum value change: T i min c = T i min n − T i min un 12 (iii) The difference T i max c of the maximum value change: (iv) Cross-sectional temperature difference between the value of the difference T i f c : (v) Difference between variance value S ic 2 : In the above equations, T ic refers to the final parameters to be studied and T n and T un refer to the values of the feature parameters of the temperature field under normal printing and abnormal printing, respectively.
In order to simplify the expression in the following, the change trend of T ic with layers increasing is represented by T c . And the change trend of T i min c , T i max c ,T i f c , and S ic 2 with layers increasing is represented by T min c , T max c , T f c , and S c 2 , respectively.

Acquisition of Sensitive Feature Parameters.
In this paper, the main method of data processing is Qualitative Trend Analysis, which was first put forward in the 1990s and now becomes an important tool for process condition monitoring and early fault diagnosis. The main idea of Qualitative Trend Analysis is to extract valuable information from the process data and then use qualitative symbols to show the entire state [16]. It mainly includes four steps: trend extraction, trend identification, transformation into primitives, and merging fragments.

Experimental Product Design.
In order to get the sensitive feature parameters of different states, a total of 10 kinds of workpieces with different shapes and sizes are designed, as shown in Figure 1.

The Acquisition of Sensitive Feature Parameters for
Starting Points. As shown in the results of these 10 groups of experiment, the distinction between different stages of the product surface is conspicuous in the process of nozzle clogging. Different building stages begin from a certain layer or several adjacent layers, so different stages can be divided by the layers. Theoretical segmentation points are extracted based on the extremum points. Take the experimental group d16h20 as an example.
In the first step, the original time series is divided into several segments according to the point-based segment 3 Complexity detection technology. According to the difference of the mean value of the experimental group d16h20, the first point A and the last point B are connected. The farthest point C from line AB is found. Point C is the first segment point as Figure 2 shows.
With curves fitting each segment, the root mean square error (RMSE) can be calculated. The calculation formula of RMSE is listed as follows: where k is the total number of data, y i is the actual value, and y i is the fitting value. The second step is to linearize and segment. The RMSE of each segment is compared with the threshold set in advance ( Table 1 in detail). When RMSE < t h , the fitting effect is ideal. And the current fitting equation is the main factor for trend identification in this segment basis. For the subsequence of RMSE ≥ t h , it is needed to carry on the next processing.
The curve is divided into two segments (AC and BC). MATLAB is used for the linear fit of the two segments; fitting curves are as follows: yt17h20 c16h20 c20h20 c20h16 d14h20 d18h20 d18h20 d16h20 d24h20 k20h20 In the fourth step, the newly acquired subsequences are fitted linearly with the least square method. The RMSE is calculated and compared with the threshold. The third step will be repeated if RMSE ≥ t h until all subsequences meet the requirement of RMSE < t h . Here, the segmentation of the whole set of data is completed and a linear function of each subsequence is obtained and all subsequences have met the conditions. Thus, the segmentation points of d16h20 are completely extracted. They are the 16th, 23rd, 32nd, and 66th layer, respectively. Layers printed after 66th do not need to be studied for the process is failed.
The thickness of each layer in the building process is set to 0.25 mm. There are 10 groups of workpieces in total, 9 for 20 mm high and 1 for 16 mm. Five kinds of feature parameters for each layer are extracted, and the total of data number is 3920.
These 3920 sets of data are processed using the Qualitative Trend Analysis method to obtain the theoretical segmentation points, which then are compared with the actual segmentation points. At the same time, the fitting curve and the fitting values of the starting and ending points of each line segment can be obtained, which is conducive to the calculation of the control limit of the fitting value. The results are shown in Table 2. The actual segmentation points are mainly based on the experimental phenomenon to obtain.
As is shown in Table 1, the sensitivity of different feature parameters for different building stages is different. It can also be found through the results that the sensitivity order   6 Complexity for the initial layer of the insufficient filling stage is mean value, minimum value, variance, cross-sectional temperature difference, and maximum value. The sensitivity order for the initial layer of the warping stage is cross-sectional temperature difference, maximum value, variance, mean value, and minimum value. The sensitivity order for the initial layer of the serious fault stage is maximum value, crosssectional temperature difference, variance, mean value, and minimum value.

Constructing Knowledge Base of Product Surface Defect.
One-to-one correspondence between defect types and variables is required to construct the knowledge base of product surface defect, which can be used to solve practical problems. Knowledge needs to be expressed with established rules. In this paper, there are two main rules for judging product failure. One is the change trend of the curve segment, and the other one is the threshold at the starting point corresponding to the failure. Defect judgment flow is shown in Figure 3.

The Trend of Sensitive Feature Parameters in Different
Stages. When the nozzle becomes clogged, the performance  7 Complexity of the modeling material gradually changes. The cooling rate of string in the first phase increases, resulting in the difference between the ambient temperature and surface temperature becoming smaller. The heat transfer efficiency between them is reduced, and the temperature decrease rate of the workpiece surface in the second stage is also reduced. In the normal printing, the second phase of the cooling is more stable. The difference of each feature parameter in different printing statuses is rising.
The above theoretical analysis can be verified by summarizing the variation of the sensitive feature parameters at the corresponding stage. The temperature field feature parameters of the 10 groups of workpieces to be obtained are divided into four stages, including normal printing stage, insufficient filling stage, warping stage, and serious fault stage. Among them, normal printing refers to the state that there are no quality problems in the printing. Insufficient filling stage refers to the state that there is a small gap between two adjacent filaments because the nozzle is gradually clogged and the diameter of the string is slightly smaller than that in the normal state. Uneven shrinkage of the building part leads to uneven distribution of internal stress, which results in warping deformation of the product. This is the warping stage. When the string continues to deteriorate, more serious failures eventually emerge. This is the fourth stage, which is the serious fault stage. According to the different stages of division mentioned above, the variation rule of the sensitivity feature parameters is determined by the Qualitative Trend Analysis method. Judging from the data above, when the nozzle temperature is at the normal working condition, 220°C, or at the abnormal working condition, 180°C, and the quality of the workpieces under both cases is fine, the variation of the sensitive feature parameters is determined by the positive and negative of the initial value. When the initial value is positive, the sensitive feature parameters show a decreasing trend. When the initial value is negative, the sensitive feature parameters show a rising trend.

The Rules of Feature Parameters
Changing during the Insufficient Filling Stage. In order to study the variation rules of the products in the stage of insufficient filling, the changes of T c , T min c , and S c 2 need to be considered in the corresponding interval. The changes of three parameters are summarized in Figure 5. From the changes in the average under insufficient filling phase, it can be seen that T c shows a rising trend in 5 groups out of 10, while the other 5 groups show a decreasing trend. T min c in 6 groups shows a rising trend, and that in 4 groups shows a decreasing trend. S c 2 in 8 groups out of 10 shows a rising trend, and only 2 groups are in a decreasing trend.
Using the Qualitative Trend Analysis method to analyze 30 sets of data, it can be judged that the sensitive feature parameters show a rising trend in the insufficient filling stage, which is the same as the theoretical analysis. The difference of the sensitivity parameters between the nonnormal printing parts and the normal printing parts shows an increasing trend, which is coincident with the theoretical analysis.

Variation of Feature Parameters in the Serious Fault
Stage. The rule of the change of three parameters above is shown in Figure 7.
The experimental results show that the trend of T f c rises at this stage. Among them, 7 of 10 groups of samples show a rising trend and 3 of them show a decreasing trend. For T max c , a total of 9 groups show a rising trend and only 1 group shows a decreasing trend. There are 8 groups in 10 of S c 2 data showing a rising trend, and only 2 groups show a decreasing trend.
As a whole, the sensitive feature parameters obtained by experiments show a rising trend in the serious fault stage, which is the same as the theoretical analysis.

Determining the Threshold for Sensitive Features of the
Beginning of Each Phase. In order to guarantee the universality of the setting of threshold, a control chart is adopted as the main method to obtain the threshold of sensitive feature parameters at the starting point of the phases. According to the control theory, the design parameters of the mean x are listed as follows: In this study, only the upper limit of the minimum value of the most sensitive feature parameter in each phase is needed. For example, to determine the threshold of the insufficient filling phase, only the data T c of 800 groups should be calculated. The specific calculation process is listed as follows.
In the first step, according to the Qualitative Trend Analysis method, the starting point can be extracted and the fitted function of the fragment where the starting point locates can be constructed to obtain the difference of the changing value of the sensitive feature parameter corresponding to the starting point in different building states.
In the second step, the function values of the sensitive feature parameters corresponding to the starting points of the 10 kinds of workpieces are, respectively, obtained. The means and the ranges of the 10 sets of data are calculated.
In the third step, (16) is used to calculate the size of the threshold as the criterion for subsequent judgments.
2.7.1. The Threshold Setting of T c at the End of the Normal Printing Phase. In the normal printing state, the trend of the sensitive feature parameters is related to the positive and negative of the starting point. Therefore, the setting of the threshold value of T c parameter should also be calculated according to the starting point.
The corresponding difference of the surface temperature field T c of the 10 groups of workpieces can be obtained at the end of the normal phase, as shown in Table 3.
The initial values in 4 groups out of 10 are less than 0, and 6 groups' initial values are greater than 0. The mean and the extremum are calculated, respectively. The results are listed as follows:  Table 4.
When n = 10, related table shows that A 2 = 0.308. The results are taken into (1):  Table 5.
The results are taken into (1): (1) IF the sensitive feature parameter is mean AND initial value > 0 AND data trend is ascending AND value of the starting point of the phase < 2.03446 THEN this starting point is the start of the insufficient filling stage (2) IF the sensitive feature parameters are mean AND initial value < 0 AND data trend is ascending AND value of the starting point of the phase < 3.72798 THEN this starting point is the start of the insufficient filling stage (3) IF the sensitive feature parameter is the crosssectional temperature difference AND data trend is ascending AND value of the starting point of the phase < 9.3696 THEN the beginning of the interval is the start of the warping stage Table 3: T c of the 10 products at the end of the normal printing stage.
Product d20h20 d14h20 yt17h20 c16h20 c20h16 d24h20 k20h20 d16h20 d18h20 c20h20   The criterion for the normal printing stage mainly depends on the value of the end point of the normal printing stage, which is also the starting value of the insufficient filling stage.

Experimental Verification
To validate the rules, two groups of experimental samples are designed. Every group includes normal printing and abnormal printing. In the two statuses for every group, two workpieces are printed with identical shape and size but with different nozzle temperatures. In the normal printing, the nozzle temperature is maintained at 220°C throughout the building process, while the nozzle temperature of abnormal printing gradually decreases from 220°C to 180°C. Except for the nozzle temperature, the other print parameters for each group of experiments are the same. Parameter settings are shown in Table 6.
Although the fill rate is set at 90%, the actual filling rate of the product surface is 100% in the actual building process. The reason is that the string material has a certain width. If the filling rate is set to 100%, the adjacent squeeze between the filaments will result in uneven product surface, affecting the accuracy of experimental data acquisition. During the building process, the ambient temperature is maintained at 25°C and the filming frequency of the thermal infrared imager is one picture per second.
The shape and size of the product used for the experimental verification are shown in Figure 8.
When verifying the rules of knowledge, T c , T max c , and T f c are needed to be analyzed with Qualitative Trend Analysis.
3.1. Data Acquisition and Processing of T c . For the printing process, six segment points are extracted. The 64 groups of data are divided into seven segments, and the semiquantitative information for each subsequence is as follows: The original data and extracted trends of T c are shown in Figure 9.
The judgment criteria for the starting point of the insufficient filling stage are that the value of the point is less than the threshold, 3.72798, and the variation trend of the following points is rising. It can be found that except for the starting point, the points coinciding with the judgment criteria are point A and point B. Choosing point A as the starting point for the insufficient filling status, the corresponding layer is the 15th one. So, the normal stage is between the first layer and 14th layer.

Data Acquisition and
Processing of T f c . T f c can be divided into 5 subsequences by a Qualitative Trend Analysis    The original data of T f c and the extracted trends are shown in Figure 10.
According to the judgment criteria of the starting point of the warping stage, it can be found that, except for the starting point, the points that meet the rule of "the value corresponding to the subdivision point is less than the threshold value and in a rising trend in the following period of time" are point C and point D. So, point C is the starting point of the warping stage, which is corresponding to layer 35.

Data Acquisition and
Processing of T max c . T max c can be divided into three subsequences by a Qualitative Trend Analysis method, which are divided by two piecewise points. The semiquantitative information of each segment is listed as follows: The raw data of T max c and the extracted trends are shown in Figure 11.
According to the rules of knowledge for serious failure, except for the starting point, the eligible segment point is point E. So, the point E is the starting point of the serious fault stage. The corresponding layer number is 55.
The actual printing process shows that the insufficient filling stage begins when it is printed to 20%. The warping stage begins at 53%, and the serious fault stage begins at 88% of the printing process. The corresponding layer numbers are 13, 34, and 56, respectively.
The results of the experiment show that with the knowledge rules constructed based on the surface defects of products, the starting points of different phases can be calculated accurately.

Conclusion
With researching, experimenting, and analyzing, the following conclusions can be achieved.
Different temperature field feature parameters have different sensitivities to different building phases. By summarizing the variation rules of the sensitive feature parameters in the corresponding phase, it can be found that in the process of the nozzle from normal to jam, rising is the dominant trend for each sensitive feature parameter.
(1) The starting point of every phase can be accurately calculated according to the knowledge base built with the Qualitative Trend Analysis method.
(2) It should also be pointed out that the method and the thresholds in this paper are applicable to the kinds of workpieces referred in this paper, such as circles and rectangles. For other types of products, the applicability of the method and the thresholds in this article needs a further validation.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request. 12 Complexity