WAAM part surface roughness prediction method based on improved k-nearest neighbor algorithm

By improving the K nearest neighbor algorithm and optimizing the distance formula with the particle swarm algorithm, the problems of data imbalance and multi-factor prediction in the surface roughness prediction of WAAM parts are solved, and high-precision and high-efficiency prediction effects are achieved.

CN119578193APending Publication Date: 2025-03-07GUILIN UNIV OF ELECTRONIC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311141153.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-06
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing WAAM parts surface roughness prediction model cannot effectively handle data imbalance and multi-factor prediction needs, resulting in low prediction accuracy and complex model and difficult to adjust parameters.

Method used

The improved K nearest neighbor algorithm is adopted to design a WAAM printer to print samples with different parameters, establish the original data set, and use the particle swarm algorithm to optimize the distance formula in the K nearest neighbor algorithm, generate weights, adjust distance calculations, and improve prediction accuracy.

Benefits of technology

It realizes accurate prediction of the surface roughness of WAAM parts, improves prediction accuracy and operating efficiency, has good robustness, and is suitable for practical engineering applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure SMS_1
    Figure SMS_1
  • Figure SMS_2
    Figure SMS_2
Patent Text Reader

Abstract

The invention discloses a WAAM part surface roughness prediction method based on an improved k-nearest neighbor algorithm, and the method comprises the two steps: firstly, printing samples with different parameters through designing a WAAM printer, and measuring the surface roughness of the samples, establishing an original data set and training an improved k-nearest neighbor prediction model; secondly, inputting the input parameters into a pre-trained improved k-nearest neighbor surface roughness prediction model; and finally, outputting prediction data of the surface roughness of the WAAM part. And a referable surface roughness value is provided for actual engineering production, the production efficiency is improved, and material waste is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of additive manufacturing, in particular to a method for predicting the surface roughness of parts based on an improved k-nearest neighbor algorithm WAAM. Background Art

[0002] At present, additive manufacturing (AM) technology is increasingly being used in various fields, including aerospace, medical, industrial manufacturing, construction, art, education, etc. Compared with laser and electron beam-based AM, wire arc additive manufacturing (WAAM) has the advantages of low equipment cost and high deposition efficiency. Different from traditional "subtractive" and "isotropic" manufacturing, additive manufacturing can directly manufacture parts by adding materials based on data models. Compared with traditional manufacturing methods, additive manufacturing technology is more efficient and can manufacture difficult-to-process complex parts at low cost. It can also be used to manufacture products with heterogeneous materials, multiple colors and customized features.

[0003] In recent years, studies have found that WAAM printing parameters have a great influence on the surface roughness of printed parts. In modern manufacturing, using machine learning algorithms to analyze large amounts of data and integrating machine learning with computer-aided production has become a trend in recent years. The current prediction method mainly establishes a mapping relationship model between part printing parameters and part surface roughness, with printing parameters as input and prediction parameters as output. Studying different mapping relationship models to improve prediction accuracy is an important way to predict the surface roughness of WAAM printed parts.

[0004] However, the existing model has the following shortcomings: First, it does not take into account the imbalance of the original data, and the prediction accuracy is very low for categories with a small number of individuals. Second, it cannot meet the needs of multi-factor prediction of surface roughness. Factor expansion will reduce the prediction accuracy. In addition, the model is complex and difficult to adjust and understand, and is not suitable for actual engineering applications. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a WAAM part surface roughness prediction method based on an improved k-nearest neighbor algorithm, which can effectively predict the surface roughness of a to-be-printed part according to the printing parameters of a WAAM printer.

[0006] The present invention is implemented by the following scheme: a method for predicting the surface roughness of parts based on the improved k-nearest neighbor algorithm WAAM, comprising the following steps: Step S1: By designing a WAAM printer to print samples with different parameters and measure the surface roughness of the samples, the main parameters include welding speed, overlap ratio, and wire feed speed, establish an original data set and train an improved k-nearest neighbor prediction model; The present invention adopts K nearest neighbor algorithm prediction, because it is simple and easy to understand, strong in robustness and interpretability, and is applicable to data multi-classification problems, nonlinear problems and unbalanced data problems. The basic principle of K nearest neighbor algorithm is to take the k labels closest to the target for classification, and distance calculation is the main influencing factor of classification accuracy. However, the weight occupied by each input variable is different, which will inevitably cause deviation in distance calculation and lead to classification error. The particle swarm algorithm is introduced into the distance formula of K nearest neighbor algorithm to generate weights for each input variable factor, and the deviation of distance formula calculation is adjusted to improve classification accuracy.

[0007] Step S2: inputting the input parameters into the pre-trained improved k-nearest neighbor surface roughness prediction model; Step S3: Output the predicted data of the surface roughness of the WAAM part.

[0008] Furthermore, the step S1 specifically includes the following steps: Step S11: by designing a WAAM printer to print samples with different parameters, using a laser confocal microscope to measure the surface roughness value (Ra) of the sample, establishing an original data set, and taking 80% of the original data as a training set and 20% as a test set; Step S12: Data standardization: Standardization of data sets can reduce the differences between certain attributes and reduce the error in the classification accuracy of data sets; Step S13: Initialize the particle swarm; take the weight value w of each eigenvalue in the KNN distance formula as the optimization variable, and randomly initialize the position and speed of each particle in the swarm; Step S14: Calculate the distance between each label and the predicted label vector using the distance formula, and calculate the fitness value; Step S15: Evaluate the fitness of each particle and store the particle position and fitness value in the particle's individual extreme value p best In the best The individual position and fitness value of the best fitness value in are saved to the global extreme value g best middle; Step S16: updating the speed and position of each particle according to the update formula in the particle swarm optimization algorithm (PSO), and evaluating the fitness of each particle; Step S17: Compare the fitness value of each particle with the best position of the particle. If they are close, the current value is used as the best position of the particle. best and g best , update g best ; Step S18: When the number of iterations is reached, stop searching and output the results; otherwise, return to step 5 to continue searching.

[0009] Furthermore, the KNN distance formula in step S13 is:

[0010] Assuming that all labels are in m-dimensional space, any set x can be represented as a feature vector x=(x1,x2,x3,···,x m ), then x i to x j The distance is defined as d(x i ,x j ).

[0011] Furthermore, the fitness calculation formula in step S14 is:

[0012] Among them: NC represents the number of correct classifications, and NT represents the total number of classification labels.

[0013] Furthermore, in step S16, the PSO updates the velocity and position formula of each particle as follows:

[0014] Among them, v i,j (t+1) is the particle velocity at the next moment, v i,j (t) is the particle velocity at the current moment, x i,j (t+1) is the particle position at the next moment, x i,j (t) is the particle position at the current moment, c1 is the self-acceleration learning factor, c2 is the global acceleration learning factor, r1 and r2 represent probability parameters, p i,j represents the optimal position of an individual, p g,j It represents the optimal position of the group.

[0015] Compared with the prior art, the present invention has the following beneficial effects: the present invention can effectively predict the surface roughness of the printed part according to the printing parameters of the WAAM printer. At the same time, the present invention integrates machine learning and intelligent algorithms into the surface roughness prediction of the WAAM printed part, which has the advantages of high accuracy, high operating efficiency and good robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a schematic diagram of the principle framework of the present invention. DETAILED DESCRIPTION

[0017] In order to better understand the technical content of the present invention, the following embodiments are given as examples.

[0018] Firstly, a WAAM printer was designed to print samples with different parameters and the surface roughness of the samples was measured. The experimental design was based on Taguchi L27 The surface finish value (Ra) of the sample was measured using a laser confocal microscope, where the main parameters included welding speed, overlap ratio, and wire feed speed. The original data set was established as shown in Table 1, and three sets of data were taken as prediction data as shown in Table 2. Then, 80% of the original data was taken as the training set and 20% as the test set to train the improved k nearest neighbor prediction model, and the optimal weight w was taken, where the nearest neighbor number k value was 1 as the regression prediction.

[0019]

[0020] Finally, the input parameters are input into the trained improved k-nearest neighbor surface roughness prediction model, and the prediction data of the surface roughness of the WAAM parts are output, as shown in the following Table 2. The present invention can well complete the work of predicting the surface roughness of WAAM parts.

[0021]

[0022] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A method for predicting surface roughness of parts based on improved k-nearest neighbor algorithm WAAM, characterized in that: The following steps are involved: Step S1: By designing a WAAM printer to print samples with different parameters and measure the surface roughness of the samples, the main parameters include welding speed, overlap ratio, and wire feed speed, establish an original data set and train an improved k-nearest neighbor prediction model; Step S2: inputting the input parameters into the pre-trained improved k-nearest neighbor surface roughness prediction model; Step S3: Output the predicted data of the surface roughness of the WAAM part.

2. The method for predicting part surface roughness based on improved k-nearest neighbor algorithm WAAM according to claim 1 is characterized in that: The step S1 specifically includes the following steps: Step S11: by designing a WAAM printer to print samples with different parameters, using a laser confocal microscope to measure the surface roughness value (Ra) of the sample, establishing an original data set, and taking 80% of the original data as a training set and 20% as a test set; Step S12: Data standardization: Standardization of data sets can reduce the differences between certain attributes and reduce the error in the classification accuracy of data sets; Step S13: Initialize the particle swarm; take the weight value w of each eigenvalue in the KNN distance formula as the optimization variable, and randomly initialize the position and speed of each particle in the swarm; Step S14: Calculate the distance between each label and the predicted label vector using the distance formula, and calculate the fitness value; Step S15: Evaluate the fitness of each particle and store the particle position and fitness value in the particle's individual extreme value p best In the best The individual position and fitness value of the best fitness value in are saved to the global extreme value g best middle; Step S16: updating the speed and position of each particle according to the update formula in the particle swarm optimization algorithm (PSO), and evaluating the fitness of each particle; Step S17: Compare the fitness value of each particle with the best position of the particle. If they are close, the current value is used as the best position of the particle. best and g best , update g best ; Step S18: When the number of iterations is reached, stop searching and output the results; otherwise, return to step 5 to continue searching.

3. The method for predicting part surface roughness based on improved k-nearest neighbor algorithm WAAM according to claim 1 is characterized in that: The KNN distance formula in step S13 is:

4. Among them: Assuming that all labels are in m-dimensional space, any set x can be represented as a feature vector x=(x1,x2,x3,···,x m ), then x i to x j The distance is defined as d(x i ,x j ).

5. The method for predicting part surface roughness based on improved k-nearest neighbor algorithm WAAM according to claim 1 is characterized in that: The fitness calculation formula in step S14 is:

6. Among them: NC represents the number of correct classifications, and NT represents the total number of classification labels.

7. The method for predicting part surface roughness based on improved k-nearest neighbor algorithm WAAM according to claim 1 is characterized in that: In step S16, the PSO updates the speed and position of each particle using the formula:

8. Among them, v i,j (t+1) is the particle velocity at the next moment, v i,j (t) is the particle velocity at the current moment, x i,j (t+1) is the particle position at the next moment, x i,j (t) is the particle position at the current moment, c1 is the self-acceleration learning factor, c2 is the global acceleration learning factor, r1 and r2 represent probability parameters, p i,j represents the optimal position of an individual, p g,j It represents the optimal position of the group.