Calculation method of approximation error in three-axis CNC machining of curved surface with ball-end tool
By optimizing the search interval, inertial weight and learning factor strategy of the particle swarm algorithm, the problem of low approximation error calculation efficiency of the three-axis CNC machining of the surface spherical head is solved, and efficient and accurate approximation error calculation is achieved.
Patent Information
- Application Number
- CN202310060417.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-16
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2043-01-16
AI Technical Summary
The prior art calculates the approximate error of three-axis CNC machining of curved spherical head knife, and the calculation efficiency is low, and traditional geometric iteration methods are difficult to further improve. The particle swarm algorithm is prone to convergence prematurely on complex problems and fall into local optimality.
The optimized particle swarm algorithm is adopted to improve the balance between the global search capability and local search capability by setting the particle search interval, establishing the fitness function of the approximation error, optimizing the inertial weight and learning factor, and combining the cosine function to control the learning factor strategy of inertial weight changes and linear changes, the algorithm's global search capability and local search capability balance is improved.
It realizes efficient calculation of the approximation error of the three-axis ball head tool on the surface, reduces the calculation time, improves the calculation efficiency, and meets the needs of high-precision tool track generation.
Smart Images

Figure CN116300684B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided manufacturing (CAM), and in particular to a method for calculating approximation errors in three-axis numerical control finishing machining. Background Art
[0002] In CNC machining tool path generation, the approach error refers to the maximum error between the envelope formed by the tool moving from one tool position to the next in the feed direction and the tool contact point trajectory line. The approach error is positively correlated with the distance between adjacent tool contact points and tool positions (i.e., the step length). In actual machining, the approach error of the tool path must be lower than the maximum allowable value (threshold). The approach error of each tool position should be calculated and judged to see whether it exceeds the threshold. If it does, the step length should be shortened to reduce the approach error until it is lower than the threshold. The essence of the approximation error calculation is to search for a tool contact point on the tool contact point trajectory line. The distance from this tool contact point to the line connecting the tool positions is the minimum value. Currently, the geometric iteration method is generally used. The iterative process lacks an intelligent adjustment strategy, and the computational efficiency is difficult to further improve.
[0003] Intelligent algorithms are optimization algorithms derived from observing the behavior of biological swarms or physical phenomena in nature, abstracting the collaborative search mechanisms of biological swarms and the changes driven by physical principles. These algorithms offer significant advantages over traditional iterative and traversal methods in terms of global optimization accuracy and efficiency. In theory, they can be used to search for the point on the tool contact trajectory that is the closest to the line connecting the tool positions. The particle swarm optimization algorithm, one of the most widely used intelligent algorithms, was proposed by Kennedy and Eberhart in 1995. It simulates the foraging behavior of bird flocks or bee colonies to search for optimal solutions. Due to its clear algorithmic approach, ease of implementation, and computational efficiency, it has been widely used in various fields. However, the particle swarm optimization algorithm is prone to premature convergence and becoming trapped in local optima when solving complex problems.
[0004] The geometric principle of approximation error and the traditional calculation process are integrated with the particle swarm algorithm, and the problems of premature convergence and falling into local optimality of the particle swarm algorithm are solved at the same time. The particle swarm algorithm can calculate the approximation error, thereby improving the calculation efficiency.
[0005] The papers "Research on the Method of Calculating Tool Paths for Point Cloud CNC Machining Using the Equal Error Step Method" (published in the journal "Manufacturing Automation" in 2017, Vol. 39, No. 9, pp. 50-53) and "Calculating Point Cloud Tool Path Planning Using the Equal Error Step Method for Section Lines" (published in the journal "Mechanical Science and Technology" in 2013, Vol. 32, No. 6, pp. 824-828) provide a method for calculating the approximation error of three-axis ball-end tool finishing and a method for generating equal error tool paths for point cloud models. The equal error tool contact points are calculated mainly by constructing a circle on the tool contact point section plane to approximate the maximum allowable error value and calculating the tangent. This method uses a geometric iteration method to calculate the approximation error and can only calculate the approximation error for tool contact points on a two-dimensional plane.
[0006] The paper "Research on an Equal-Error Step Size Algorithm for Tool Path Generation in Triangular Mesh Surface Machining" (published in 2015 in the journal Mechanical Science and Technology, Vol. 34, No. 9, pp. 1370-1374) presents a method for generating equal-error toolpaths and approximation errors for three-axis ball-end tool finishing of triangular mesh models. The method first obtains the intersection point set of the projection lines of adjacent tool contact points with the triangular mesh. The maximum error with the line connecting the adjacent tool contact points is calculated as the linear error. The rotational error at the triangular mesh is then calculated as the angle between the mesh surface normals at two adjacent tool positions along the tool feed direction. The two errors are added for convex surfaces and subtracted for concave surfaces, resulting in the approximation error. This method is only applicable to triangular mesh models, and its computational accuracy is limited by the mesh's division accuracy and density. To achieve high accuracy, the computational time increases significantly.
[0007] Chinese patent application number ZL202110004876.3 discloses a method for generating equal-error tool paths for five-axis machining of parametric surfaces with flat-bottom cutters. This method primarily involves calculating the approximation error for five-axis machining of flat-bottom cutters and generating equal-error tool paths. First, the five-axis tool position and tool axis vector for the flat-bottom cutter are calculated based on the tool contact points on the tool contact trajectory line. The approximation error for the five-axis machining of the flat-bottom cutter is then calculated, and the step size is adjusted to achieve the equal-error requirement. Finally, the equal-error tool path for the five-axis machining of the flat-bottom cutter is obtained. This patent is only applicable to the approximation error calculation for five-axis machining of flat-bottom cutters and cannot be used for the approximation error calculation for three-axis machining of ball-end cutters.
[0008] Chinese patent application number ZL201910902263.4 discloses a turntable eccentricity error measurement method using particle swarm optimization (PSO) for photoelectric detection modulation period. This method uses a photoelectric detection device for the modulation signal period of a rotating optical shutter. A counter continuously measures the period value of the turntable modulation signal at each modulation period. Based on the relationship equation between the period value and the angle corresponding to the evenly distributed lines or teeth on the turntable, the eccentricity of the turntable, and the eccentricity position angle, a particle swarm optimization method is used to determine the eccentricity and eccentricity of the turntable, providing a basis for coaxial adjustment of turntable components. This patented PSO solves a problem in a different field from the present invention and cannot be used to calculate CNC machining approximation errors.
[0009] The above-mentioned invention patent with patent application number ZL202110004876.3 and the two papers all provide methods for calculating the approximation error, but the methods vary greatly depending on the tool path type and applicable objects. The patent with application number ZL202110004876.3 is aimed at the five-axis machining of flat-bottomed knives. The calculated approximation error is the maximum deviation between the envelope surface and the curved surface formed by the five-axis linkage of the flat-bottomed knives. It is affected by the nonlinear error generated by the linkage of the rotary axis and the linear error generated by the linkage of the XYZ axes. The approximation error of the three-axis machining of ball-end knives is different from that of the five-axis machining of flat-bottomed knives. There is no nonlinear error, and the linear error is also different from that of flat-bottomed knives.
[0010] The first paper mentioned above is about three-axis ball-end tool machining of point cloud models. Point cloud models are composed of a large number of discrete points and cannot provide continuous and complete model data. Therefore, this paper uses the intersection method to plan the tool contact trajectory line, and uses the geometric iteration method to calculate the bow height error for the point set serving as the intersection line on the cutting plane, and then calculates the rotation error, and adds or subtracts the two as the approximation error. The second paper mentioned above is about three-axis ball-end tool machining of triangular mesh models. Similar to the first paper, the cutting plane intersects with the mesh model, and the geometric iteration method is used to calculate the bow height error for the intersection line on the cutting plane as the approximation error. The methods of the two papers are essentially one-way search geometric iteration methods, which are completely different from the group and individual optimization iteration methods of the particle swarm algorithm.
[0011] The aforementioned invention patent, application number ZL201910902263.4, is a method for measuring the eccentricity of a turntable. It applies a particle swarm optimization algorithm to determine the amount and position of the turntable's eccentricity, achieving relatively good results. This invention demonstrates that the particle swarm optimization algorithm can be applied to solve engineering problems, but it cannot be directly applied to the technical field of the present invention.
[0012] Due to differences between five-axis and three-axis machining, between flat-bottom and ball-end tools, between approximation and bow errors, between curved surfaces and point clouds, and between triangular meshes, the aforementioned methods are unable to calculate approximation errors for three-axis machining with a ball-end tool. Particle swarm optimization (PSO) has advantages such as clear algorithmic thinking and efficient computation, and has been applied in engineering. However, no published results have been found applying it to approximation error calculation.
[0013] The information disclosed in this background technology section is only intended to enhance understanding of the overall background of the invention and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the Invention
[0014] The purpose of the present invention is to provide a method for calculating the approximation error of three-axis CNC machining of curved surface ball-end cutters based on an optimized particle swarm algorithm, which can efficiently calculate the approximation error of three-axis finishing of ball-end cutters.
[0015] To achieve the above objectives, an embodiment of the present invention provides a method for calculating the approximation error of three-axis CNC machining of curved ball-end tooling based on an optimized particle swarm algorithm, which is characterized by including the following optimization aspects:
[0016] Step 1: Set the particle search range;
[0017] Step 2: Establish the fitness function of the approximation error;
[0018] Step 3: Optimize inertia weight;
[0019] Step 4: Optimize the learning factor.
[0020] In one or more embodiments of the present invention, in step 1, setting the search interval includes:
[0021] (1) Input the parameters of adjacent knife contacts on the knife contact trajectory line;
[0022] (2) Map the parameter interval between adjacent knife contacts to the standard interval [0,1];
[0023] (3) The standard interval [0,1] is used as the particle search interval, and the values within the interval are used as particles in actual calculation.
[0024] In one or more embodiments of the present invention, in step 2, establishing the approximation error fitness function includes:
[0025] (1) Calculate the corresponding knife contact parameter value for the particle and calculate the point on the knife contact trajectory line corresponding to the parameter value;
[0026] (2) Calculate the distance between the knife contact point and the knife position point;
[0027] (3) Calculate the difference between the distance between the tool contact point and the tool position point and the tool radius, and use this difference as the fitness value of the particle.
[0028] In one or more embodiments of the present invention, in step 3, optimizing the inertia weight includes:
[0029] (1) Map the number of iterations of the particle swarm optimization algorithm to the interval [0, π / 2];
[0030] (2) Construct an inertia weight change function based on the cosine function with the number of iterations as the independent variable to realize that the inertia weight changes with the number of iterations.
[0031] In one or more embodiments of the present invention, in step 4, optimizing the learning factor includes:
[0032] (1) The individual and group learning factors change linearly with the number of iterations;
[0033] (2) Combined with the characteristics of the inertia weight change strategy, different numerical values are assigned to the maximum and minimum values of individual and group learning factors.
[0034] Currently, geometric iteration methods are commonly used to calculate approximation errors. Existing algorithmic models offer little improvement in computational efficiency, making it difficult to reduce the time required to generate high-precision and constant-error tool paths, which require extensive approximation error calculations. Compared to existing techniques, this invention applies a particle swarm optimization algorithm to approximation error calculations, aiming to achieve both high computational accuracy and improved computational efficiency.
[0035] Compared with the standard particle swarm algorithm, in step 1, the data points of the local tool contact trajectory are mapped to the standard interval [0,1], and the discrete values in the standard interval [0,1] are used as the particles for actual calculation, which can improve the universality of the algorithm; in step 2, the tool contact parameter values corresponding to the particles are calculated and the corresponding points of the parameter values on the tool contact trajectory are calculated, and the distance between the tool contact point and the tool position point is calculated and the difference is taken from the tool radius as the particle fitness value, thereby realizing the calculation of the approximation error (i.e., fitness) with discrete values in the standard interval [0,1] as particles. response value); in step 3, it is proposed to utilize the nonlinear characteristics of the cosine curve in the interval [0, π / 2], that is, the speed of decrease from slow to fast in the front, middle and back sections, and map the number of iterations of the particle swarm optimization algorithm to the interval [0, π / 2] to control the inertia weight, so that the global search ability of the particles is strong in the early stage and then gradually weakens, while the local search ability gradually increases; in step 4, it is proposed to adopt a linear change strategy for the learning factor, which corresponds to the inertia weight change strategy, which can effectively improve the convergence efficiency of the algorithm and thus reduce the calculation time.
[0036] By utilizing the method of the present invention, the approximation error of three-axis ball-end tool finishing of curved surfaces can be calculated efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is the approximation error e according to one embodiment of the present invention i Schematic diagram;
[0038] Figure 2 is a knife contact p according to an embodiment of the present invention j Mapping to standard interval diagram;
[0039] Figure 3 is an inertia weight change diagram according to one embodiment of the present invention;
[0040] Figure 4 is a learning factor change diagram according to one embodiment of the present invention.
[0041] Figure 5 1 is a free-form surface and a generated equal-error tool path according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific embodiments.
[0043] Unless expressly stated otherwise, throughout the specification and claims, the term "comprise" or variations such as "include" or "comprising", etc., will be understood to include the stated elements or components but not to exclude other elements or other components.
[0044] like Figures 1 to 5 As shown, according to a preferred embodiment of the present invention, a method for calculating the approximation error of three-axis CNC machining of a curved ball-end tool based on an optimized particle swarm algorithm is described. The specific implementation is as follows:
[0045] Step 1: Establish the fitness function of the approximation error.
[0046] Take the i-th and i+1-th knife contact points P in any row of knife contact track CC i CC 、 and its knife point P i CL 、 Take the example to illustrate the algorithm.
[0047] Blade contact P i CC 、 The parameters are u i 、u i+1, then the data point corresponding to the approximation error is located in the parameter interval [u i ,u i+1 ] on the local knife contact trajectory. Compared with the point coordinates, the parameter u is only one-dimensional and directly determines the relative position and coordinates of the point on the knife contact trajectory, which is very suitable as a particle. In order to improve the standardization and universality of the algorithm, it is proposed to map the data points of the local knife contact trajectory to the standard interval [0,1] and use the discrete values in the standard interval [0,1] as the actual calculated particles. Any point p j The value m mapped to the standard interval j It can be obtained by formula (1), and the mapping process is as follows Figure 2 shown.
[0048]
[0049] Step 2: Establish the fitness function of the approximation error.
[0050] Knife point P i CL 、 The approximation error between the knife contact point P i CC 、 The knife contact trajectory to the line segment The maximum value of the difference between the distance and the tool radius R, so the difference between the two is the ideal fitness function. For any j-th particle m in the interval [0,1] j , the calculation process of its fitness is as follows:
[0051] Step 2.1: Use formula (2) to calculate the particle m j The corresponding parameter value u of the knife contact j , substitute into formula (3) to calculate the parameter value u j The corresponding point p on the knife contact trajectory CC j .
[0052] u j =m j u i +(1-m j )u i+1 (2)
[0053] p j =CC(u j ) (3)
[0054] Step 2.2: Use formula (4) to calculate the distance L between the knife contact point and the knife position point line j .
[0055]
[0056] Step 2.3: Use formula (5) to calculate the particle m j The fitness value of .
[0057] f(j)=RL j (5)
[0058] Step 3: Optimize the inertia weight.
[0059] The particle swarm algorithm balances its global and local search capabilities by adjusting the inertia weight factor. In the early stages of the algorithm, a larger inertia weight value can achieve stronger global search capabilities; in the later stages of the algorithm, a smaller inertia weight value can enable particles to converge to the global optimum faster.
[0060] The currently commonly used inertia weight optimization adopts a linear decreasing optimization method, which can accelerate the convergence speed of the particle swarm, but reduces the global search capability. To this end, the present invention uses the nonlinear characteristics of the cosine curve in the interval [0,π / 2], where the speed of the front, middle and back segments decreases from slow to fast, and proposes mapping the number of iterations of the particle swarm optimization algorithm to the interval [0,π / 2]. The inertia weight function is formula (6), where k is the number of iterations, w max 、w min are the maximum and minimum values of the inertia weight coefficient.
[0061]
[0062] This function can obtain slower, faster, and faster inertia weight decrease rates in the early, middle, and late stages of the search, respectively, so that the global search ability of the particle is stronger in the early stage and then gradually weakens, while the local search ability gradually increases.
[0063] During the algorithm operation, the maximum and minimum values of the inertia weight w max and w min The value of has a great influence on the performance of the algorithm. In order to select the appropriate value, multiple sets of numerical combinations were selected for testing. max =0.9, w min = 0.4, the algorithm performance is significantly improved, and the inertia weight w obtained by formula (6) changes with the number of iterations k as follows: Figure 3 shown.
[0064] Step 4: Optimize the learning factor.
[0065] The individual and group learning factors c1 and c2 respectively determine the weights of the individual optimal position and the group optimal position in the calculation of the particle flight speed. When c1>c2, the particle movement is more inclined to the individual optimal direction, and vice versa.
[0066] The standard particle swarm algorithm generally takes a constant value, and particles tend to converge prematurely and obtain a local optimal solution. In the early stages of iteration, since the distance to the optimal solution is far, particles should focus on self-recognition and search based on the individual optimal solution; in the middle and late stages of iteration, when the optimal solution is relatively close, particles should focus on group recognition and focus on local search in the neighborhood of the group optimal solution. To this end, the present invention adopts a linear change strategy for the learning factor, as shown in formula (7), where c 1max 、c 1min 、c 2max and c 2min are the maximum and minimum values of individual and group learning factors, respectively. As the number of iterations k increases, c1 and c2 decrease and increase, respectively.
[0067]
[0068] For the maximum and minimum values c of individual learning factors and group learning factors 1max 、c 1min 、c 2min and c 2max , some literatures set the learning factor to 2. The present invention combines the changing trend of the inertia weight after optimization and selects multiple sets of numerical combinations for testing. 1max =1.6, c 1min =2.5, c 2max =1.3, c 2min = 2.2, as the number of iterations k increases, c1 decreases linearly from 2.5 to 1.6, while c2 increases linearly from 1.3 to 2.2, as shown in the following example: Figure 4 As shown in the figure, the learning factor optimization strategy is implemented, which meets the requirements of focusing on particle motion traversability and global search capability in the early and middle stages. In the later stages, c2>c1, and the gap becomes larger and larger, meeting the requirement of enhancing local search capability.
[0069] A typical embodiment of the present invention is as follows:
[0070] by Figure 5 The surface in (a) is used as an example to generate a tool path. The surface size is 120mm×120mm×45mm. The tool selected is a ball-end tool with a diameter of 10mm. The tool path line number is 80. The tool path is generated according to the equal error step method with a calculation accuracy of 0.1μm. The geometric iteration algorithm and the algorithm of the present invention are used to calculate the equal error tool path respectively. The generated equal error tool path has an approximation error range of 9μm to 10μm. Figure 5 As shown in (b), four different ranges of approximation errors are then calculated. The operating environment is a PC with an Intel i7-10700 and 16G RAM. The time consumed is shown in Table 1. The algorithm of the present invention reduces the calculation time by more than 16% compared with the geometric iterative algorithm, verifying its advantage in computational efficiency.
[0071] Table 1 Calculation time of equal error tool path
[0072] Approximation error range / μm 2.5~3 4.5~5 9~10 19~20 45~50 Approximation error calculation times 39372 38733 26554 24973 11762 Geometric iteration algorithm time / s 13.080 11.950 8.720 7.357 3.778 The algorithm of the present invention takes time / s 10.739 10.030 7.114 6.020 3.082 The time consumption reduction ratio of the algorithm of the present invention 17.90% 16.07% 18.42% 18.17% 18.42%
[0073] The foregoing descriptions of specific exemplary embodiments of the present invention are for purposes of illustration and description. These descriptions are not intended to limit the invention to the precise forms disclosed, and it is apparent that many variations and modifications are possible in light of the foregoing teachings. The exemplary embodiments have been selected and described for the purpose of explaining the specific principles of the invention and their practical application, thereby enabling those skilled in the art to realize and utilize a variety of exemplary embodiments of the invention and various options and modifications. The scope of the invention is intended to be defined by the claims and their equivalents.
Claims
1. A method for calculating the approximation error of three-axis CNC machining of curved ball-end tool based on optimized particle swarm algorithm, characterized in that: The following optimization aspects are included: Step 1: Set the particle search interval, which specifically includes: (1) inputting the parameters of adjacent knife contacts on the knife contact trajectory line; (2) mapping the parameter interval between adjacent knife contacts to the standard interval [0,1]; (3) using the standard interval [0,1] as the particle search interval, and the values within the interval are used as particles in the actual calculation; Step 2: Establishing the fitness function of the approximation error, which specifically includes: calculating the corresponding tool contact point parameter value for the particle, and calculating the corresponding point of the parameter value on the tool contact trajectory; calculating the distance between the tool contact point and the tool position line; calculating the difference between the distance between the tool contact point and the tool position line and the tool radius, and using this difference as the fitness value of the particle; Step 3: Optimize inertia weight; Step 4: Optimize the learning factor.
2. The method for calculating the approximation error of three-axis CNC machining of curved ball-end tool based on optimized particle swarm algorithm according to claim 1, characterized in that: The optimizing inertia weight comprises: (1) Map the number of iterations of the particle swarm optimization algorithm to On the interval; (2) Construct an inertia weight change function based on the cosine function with the number of iterations as the independent variable to realize that the inertia weight changes with the number of iterations.
3. The method for calculating the approximation error of three-axis CNC machining of curved ball-end tool based on optimized particle swarm algorithm according to claim 1, characterized in that: The optimized learning factors include: Individual and group learning factors change linearly with the number of iterations; Combined with the characteristics of the inertia weight change strategy, different numerical values are assigned to the maximum and minimum values of individual and group learning factors.
Citation Information
Patent Citations
A Rotary Disk Eccentricity Error Measurement Method Based on Optimized Particle Swarm Detection Modulation Period
CN110617783B
Method for Generating Equal Error Toolpaths in Parametric Surface Flat End Machining (5-Axis)
CN112987647B
PID parameter tuning method for particle swarm optimization based on inertia weight cosine adjustment
CN109696827A
Equal-error tool path generation method for five-axis machining of parametric curved surface flat-bottomed cutter
CN112987647A