Method for calculating tool path approximation error of five-axis numerical control machining flat-bottomed cutter
By applying a collaborative nested PSO algorithm in five-axis CNC machining, the problem of low calculation efficiency of approximate error of flat-bottomed tool tracks in five-axis CNC machining is solved, and more efficient tool track generation and higher machining accuracy are achieved.
Patent Information
- Application Number
- CN202510262968.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, it is difficult to efficiently calculate the approximation error of flat-bottomed tool tracks in five-axis CNC machining, resulting in a long time to generate the tool track, low machining efficiency and accuracy.
The collaborative nested PSO algorithm is used to calculate the approximation error that meets the accuracy requirements through the three-layer nested PSO algorithm, including the first layer, second layer and third layer PSO algorithm, and the optimization capability of the particle swarm algorithm is used to improve the computing efficiency.
It effectively reduces the tool track generation time, improves the efficiency and accuracy of five-axis CNC machining, and has higher calculation efficiency than traditional geometric iteration methods.
Smart Images

Figure CN120103779A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer-aided manufacturing (CAM), and in particular relates to a method for calculating the tool path approximation error of a flat-bottomed tool in five-axis numerical control machining. Background Art
[0002] With the development of Computer Aided Manufacturing (CAM), CAM technology and CNC machining have become the main means of free-form surface tool path planning and machining. CAM algorithms can generate CNC machining tool paths for free-form surfaces. The tool paths are input into the CNC system to control the machine tools and tools for machining. Three-axis and five-axis CNC machining are the main methods for surface machining. Among them, five-axis linkage CNC machining is one of the main machining methods for many parts with complex shapes and high precision requirements. It plays a vital role in the manufacturing industry, especially for the manufacture of complex parts such as precision molds and aircraft engine blades containing free-form surfaces. In the process of five-axis linkage machining, the tool is linked from the current tool position to the next tool position, and the envelope surface swept by its cutting edge is the actual contour of the tool cutting. In order to ensure the manufacturing of high-precision parts, the approximation error must be calculated and ensured that it does not exceed the maximum allowable value.
[0003] The invention patent with Chinese patent application number CN201910839404.2 discloses a nonlinear error control method based on eight-parameter five-axis linear interpolation, which is used to solve the control problem of the nonlinear error of the linear trajectory of the tool contact point during five-axis linear interpolation. This method establishes a mathematical model of the nonlinear error of the linear trajectory of the tool contact point based on the generation mechanism of the nonlinear error of the linear trajectory of the tool contact point caused by the tool swing and combined with the principle of coordinate transformation of the motion of the five-axis machine tool. When performing eight-parameter five-axis linear interpolation, the interpolation tool center point and the corresponding interpolation tool contact point of the current interpolation cycle are calculated, and the vertical foot position coordinates between the interpolation tool center point and the linear trajectory of the tool contact point and the spatial distance between the interpolation tool contact point and the linear trajectory of the tool contact point are calculated respectively, so as to determine the nonlinear error compensation repair vector, and finally calculate and output the new interpolation tool center point position coordinates to complete the control of the nonlinear error of the tool contact point in one interpolation cycle.
[0004] The invention patent with Chinese patent application number CN202010772233.9 discloses a control method for the nonlinear error between the tool tip point and the tool axis direction in five-axis machining. The tool axis command path is obtained from the original machining tool position data, and the ideal path of the tool axis is obtained based on the shortest path principle. The deviation between the tool axis command path and the ideal path is used as the tool axis nonlinear error and corrected; the corrected tool position data is converted into machining code and the tool tip point command path in the machine tool coordinate system is obtained. The tool tip point theoretical path in the machine tool coordinate system is obtained through coordinate transformation, and the point corresponding to the maximum deviation value from its theoretical path in the command path of the tool tip point in the machine tool coordinate system is found, and the point is converted to the workpiece coordinate system, and the straight-line distance from the point to the theoretical path of the tool tip point is calculated as the tool tip point nonlinear error, and the limit feed rate is obtained from the tool tip point nonlinear error, and the target speed is planned with the limit feed rate to compensate for the tool tip point nonlinear error.
[0005] The invention patent with Chinese patent application number CN202110004876.3 discloses an equal-error tool path generation method for five-axis machining of parametric surface flat-bottom tools. The tool motion envelope surface and tool contact point trajectory line between adjacent tool position points are replaced by discrete tool bottom circle and tool contact point set, and the tool contact points of linear error and nonlinear error are calculated. In the neighborhood of two points, the tool position is obtained by iterative parameter method and the approximation error is calculated, and the calculation accuracy is used as the calculation termination condition.
[0006] The purpose of the first two invention patents mentioned above is to prevent the nonlinear error of the tool path in five-axis machining from exceeding the maximum allowable value. The invention patent with Chinese patent application number CN201910839404.2 establishes a nonlinear error model and calculates the nonlinear error compensation repair vector to generate a new interpolation tool center point to achieve the purpose of controlling the nonlinear error. The invention patent with Chinese patent application number CN202010772233.9 uses the deviation between the tool axis command path and the ideal path as the tool axis nonlinear error, corrects the tool position data, and then converts it to the machine tool coordinate system to calculate the tool tip point nonlinear error, and finally plans the limit feed rate and target speed to compensate for the tool tip point nonlinear error. The actual approximation error in five-axis machining is jointly determined by the nonlinear error and the linear error, but it is not a simple superposition, but it is necessary to obtain the real tool motion envelope surface and local surface information for calculation. Because these two invention patents are optimization processing of the existing tool path nonlinear error, they cannot be used for the calculation of approximation errors. The purpose of the third invention patent mentioned above is to generate equal-error tool paths, which includes an approximation error algorithm. However, in the process of calculating the approximation error, traditional geometric discretization and simple algebraic iteration are used, which has low calculation efficiency. The calculation method and principle are different from those of the present invention.
[0007] The significance of solving the problems existing in the above-mentioned prior art: The present invention discloses a method for calculating the tool path approximation error of a five-axis CNC machining flat-bottomed tool. By introducing the PSO intelligent algorithm, the approximation error that meets the precision requirements can be calculated efficiently, thereby effectively reducing the tool path generation time and improving the machining efficiency and precision. Summary of the invention
[0008] The purpose of the embodiments of the present invention is to provide a method for calculating the tool path approximation error of a flat-bottomed tool in five-axis CNC machining, thereby improving the calculation efficiency of the tool path approximation error in five-axis CNC machining.
[0009] Specifically, the technical solution of the present invention is as follows:
[0010] Step 1: Obtain the data required for calculating the tool path approach error;
[0011] Step 2: Design and apply the first-level PSO algorithm to calculate the minimum distance from a point on the tool circle to the tool contact point trajectory;
[0012] Step 3: Using the result of the first-layer PSO algorithm as the fitness value of the second-layer PSO algorithm, design and use the second-layer PSO algorithm to calculate the minimum distance from the tool circle to the tool contact point trajectory line;
[0013] Step 4 uses the result of the second-layer PSO algorithm as the fitness value of the third-layer PSO algorithm, designs and uses the third-layer PSO algorithm to calculate the approximation error value.
[0014] The first-layer PSO algorithm in step 2 uses a collaborative mechanism to optimize and output the global optimal solution as the minimum distance from a point on the tool circle to the tool contact point trajectory. The specific steps of the first-layer PSO algorithm in step 2 are as follows:
[0015] Step 2.1 Obtain the tool contact trajectory parameter information and set the search interval [u k ,u k+1 ] is mapped to [0,1], setting the speed threshold v max and v min , population size N, crossover probability p c , mutation probability p m , simulated annealing initial temperature, cooling coefficient, maximum number of iterations k max Or the calculation accuracy is used as the termination condition, and the reverse learning Tent initializes the knife contact particle position and the knife contact particle speed.
[0016] Step 2.2 randomly divides the knife contact particles into population 1 and population 2. Population 1 proceeds to step 2.3, and population 2 proceeds to step 2.5.
[0017] Step 2.3 calculates the fitness values of the knife contact particles in population 1 and arranges them in descending order, and then goes to step 2.4.
[0018] Step 2.4 selects a certain proportion (such as 20%) of particles with larger fitness values to perform differential mutation operations, form a new population and calculate the fitness value. Go to step 2.11.
[0019] Step 2.5 calculates the fitness value of the knife contact particle in population 2 and goes to step 2.6.
[0020] Step 2.6: For the contact particles of population 2, the crossover probability p c Perform crossover operation.
[0021] Step 2.7 calculates the fitness value of the new particle after the crossover operation, uses the Metropolis criterion to determine whether the new particle is accepted after the crossover operation, updates the population, calculates the fitness value, and arranges it in descending order.
[0022] Step 2.8: With mutation probability p m A portion (eg, 5%) of the knife contact particles with the smallest fitness value after the crossover operation are selected for mutation operation.
[0023] Step 2.9 calculates the fitness value of the new particle after the mutation operation, and uses the Metropolis criterion to determine whether the new particle is accepted after the mutation operation.
[0024] Step 2.10 calculates the fitness value of the new population of population 2.
[0025] Step 2.11 Combine population 1 with population 2 and update the individual optimal p best and the global optimal g best .
[0026] Step 2.12 determines whether the convergence conditions are met (such as satisfying the calculation accuracy or reaching the maximum number of iterations). If so, go to step 2.14; otherwise, go to step 2.13.
[0027] Step 2.13 Update the inertia weight and change the learning factor c 1 、c 2 Update the particle's velocity and position, process the position and velocity of the out-of-bounds particle, and then perform a cooling operation. Go to step 2.2 to continue the iteration.
[0028] Step 2.14 outputs the current optimal particle position fitness value as the minimum distance from a point on the tool circle to the tool contact point trajectory, and the algorithm terminates.
[0029] The tent initialization knife contact particle position and the initialization knife contact particle velocity described in step 2.1 include:
[0030] Step 2.1.1 Set the particle value range to [0,1].
[0031] Step 2.1.2 Generate a random number between [0,1] as the initial value x 0 .
[0032] Step 2.1.3 Calculate the next value x from equation (1) i+1 .
[0033] Step 2.1.4: x i+1 Sets the value of to the new initial value.
[0034] Step 2.1.5 Repeat the first three steps to obtain x 1 、x 2 …x n , until the required number of random numbers between [0,1] are generated and placed in a set called the original solution set.
[0035] Step 2.1.6 The search interval is the standard interval, and the particle is x k , then the reverse particle is 1-x k , the reverse vectors of all particles in the original solution set are calculated to form the reverse solution set.
[0036] Step 2.1.7 calculates the fitness value of the original solution set and the reverse solution set as the initial value of the particles, and takes the target number of particles with the best fitness value as the initial population.
[0037]
[0038] The calculation of the fitness value of the particle in step 2.3 includes:
[0039] By the approximation error e i From the expression (2), we can see that the knife point P i CL , The approach error between the knife contact point P i CC , The knife contact trajectory between the line segment P i CL 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:
[0040]
[0041] Calculate the particle m j The corresponding parameter value u of the knife contact j , use equations (3) and (4) to calculate the parameter value u jThe corresponding point p on the knife contact trajectory CC j . Use formula (2) to calculate the knife contact point p j The distance L between the tool position points j , use formula (5) to calculate the particle m j The fitness value f(m j ).
[0042] u j =m j u i +(1-m j ) i+1 (3)
[0043] p j =CC(u j ) (4)
[0044] f(m j )=|RL j | (5)
[0045] Furthermore, in a D-dimensional search space, there are N particles, and the position and “flying” speed of the i-th particle are shown in equations (6) and (7). The individual optimal value position parameter p obtained by the iterative search is best It can be expressed by formula (8), the optimal position parameter g of the population searched in successive iterations is best It can be expressed by formula (9).
[0046] x i (k) = {x i1 (k),x i2 (k),...,x iD (k)},i=1,2,...,N (6)
[0047] v i (k) = {v i1 (k),v i2 (k),...,v iD (k)},i=1,2,...,N(7)
[0048] p best ={p i1 ,p i2 ,...,p iD}(8)
[0049] g best ={p g1 ,p g2 ,...,p gD}(9)
[0050] Step 2.11 updates the individual optimal p bestand the global optimal g best Calculation method: The speed and position of the d-th dimension of the ith particle of the kth generation evolving to the k+1th generation can be calculated by formula (10), where d = 1, 2, 3…D, w is the inertia weight factor, c 1 、c 2 are the individual and group learning factors, r 1 、r 2 are mutually independent random numbers between (0,1), and f is the fitness function. Then the two extreme values p in the particle swarm are best and g best It can be calculated by equations (11) and (12). The update of the speed and position can be calculated by equation (13).
[0051]
[0052] The crossover operation, mutation operation and selection operation constitute the core mechanism of the genetic algorithm, which realizes the evolution and optimization of the population by simulating the process of natural selection, mating and mutation. The crossover operation simulates the mating process in biological evolution, and the mutation operation simulates the gene mutation process in biological evolution.
[0053] The Metropolis criterion is the core mechanism of the simulated annealing algorithm, which is used to determine whether to accept a new solution at each temperature.
[0054] The inertia weight w, the learning factor c 1 and c 2 It can be calculated by equations (14) and (15).
[0055]
[0056] The cooling operation is that the simulated annealing algorithm needs to set the initial temperature at the beginning of the iteration, and the temperature is cooled by a certain cooling coefficient t after each iteration. down Attenuation.
[0057] The position and velocity of the out-of-bounds particle are processed. In this step, after the standard interval particle crosses the boundary, it is assumed that the particle is x id (k), inertia weight factor w and individual and group learning factors c 1 、c 2 They are calculated by equations (16) and (17) respectively.
[0058]
[0059] Step 3: The second layer POS algorithm includes:
[0060] Step 3.1 Obtain tool circle parameter information, standardize tool circle parameter coordinates, set population size N and speed threshold vmax 、v min , set the maximum number of iterations k max Or the calculation accuracy is used as the termination condition, and the reverse learning Tent initializes the tool circular particle position and the tool circular particle speed.
[0061] Step 3.2 uses the first layer of PSO algorithm steps to calculate the fitness value of the tool circle particle, that is, the minimum distance from each tool circle particle to the tool contact point trajectory line.
[0062] Step 3.3 Update the individual optimal p best and the global optimal g best .
[0063] Step 3.4 arranges the tool circle particles in descending order according to the fitness values, and selects particles with larger fitness values (such as 20%) for differential mutation operation to form a new population.
[0064] Step 3.5 determines whether the convergence conditions are met (such as satisfying the calculation accuracy or reaching the maximum number of iterations). If so, go to step 3.7; otherwise, go to step 3.6.
[0065] Step 3.6 Update the inertia weight and change the learning factor c 1 、c 2 Update the velocity and position of the particles, and process the position and velocity of particles that cross the cutter circle. Go to step 3.2 to continue iteration.
[0066] Step 3.7 outputs the fitness value of the current optimal tool circle particle position as the minimum distance from the tool circle to the tool contact point trajectory line, and the algorithm terminates.
[0067] The third layer POS algorithm in step 4 includes:
[0068] Step 4.1 Obtain tool position parameter information, standardize the tool positioning point connection parameter coordinates, set the population size N and speed threshold v max 、v min , set the maximum number of iterations k max Or use the calculation accuracy as the termination condition, reverse learning Tent to initialize the particle position of the positioning point, and initialize the particle speed of the positioning point.
[0069] Step 4.2 calculates the fitness value of the positioning point particle according to the second-layer PSO algorithm step, that is, the minimum distance from the tool circle corresponding to each point particle to the tool contact point trajectory line.
[0070] Step 4.3 Update the individual optimal p best and the global optimal g best .
[0071] Step 4.4 arranges the particles at the positioning points in descending order according to the fitness values, and selects particles with smaller fitness values (such as 5%) for differential mutation operation to form a new population.
[0072] Step 4.5 determines whether the convergence conditions are met (such as satisfying the calculation accuracy or reaching the maximum number of iterations). If so, go to step 4.7; otherwise, go to step 4.6.
[0073] Step 4.6 Update the inertia weight and learning factor c 1 、c 2 , update the velocity and position of the particle, process the position and velocity of the particle that crosses the boundary, and go to step 4.2 to continue iteration.
[0074] Step 4.7 outputs the fitness value of the particle position of the current optimal positioning point, that is, the maximum value of the minimum distance from the tool circle to the tool contact point trajectory line of all tool positions, which is the required approximation error of the tool path between the two tool position points, and the algorithm terminates.
[0075] The purpose of the present invention is to improve the calculation efficiency of the tool path approximation error of a flat-bottomed tool in five-axis numerical control machining while meeting the requirements of calculation accuracy, and a five-axis numerical control machining tool path approximation error calculation method based on a collaborative nested PSO algorithm is proposed. In order to use the PSO algorithm for the five-axis numerical control machining tool path approximation error calculation, the five-axis numerical control machining tool path approximation error calculation method is structurally designed as a three-layer nesting, and each layer uses the PSO algorithm for calculation. In order to improve the universality of the algorithm, the standard PSO algorithm is standardized for three different search intervals of particles and a fitness function is established. In order to improve the convergence speed of the algorithm, a reverse learning mechanism is designed to initialize the Tent map, improve the particle cross-boundary processing method, and improve the worst particle position by differential mutation, so as to form an optimized PSO algorithm for the second and third layers of the five-axis numerical control machining tool path approximation error calculation. The calculation results are fed back from the first layer to the third layer layer by layer as the particle fitness value of the next layer, and a collaborative nested PSO algorithm suitable for the five-axis numerical control machining tool path approximation error is constructed. The proposed algorithm has higher calculation efficiency than the geometric iteration method. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0077] Figure 1 is a schematic diagram of a method flow chart of a nested PSO algorithm flow chart according to one embodiment of the present invention;
[0078] Figure 2is an approximation error diagram between two adjacent tool positions according to one embodiment of the present invention;
[0079] Figure 3 is a three-layer nested particle distribution position diagram according to one embodiment of the present invention;
[0080] Figure 4 is a schematic diagram of errors between adjacent tool positions according to one embodiment of the present invention;
[0081] Figure 5 is a schematic diagram of the standardized search intervals of the first and third layer PSO algorithms according to one embodiment of the present invention;
[0082] Figure 6 is a standardized schematic diagram of a tool circle particle search interval of a second-layer PSO algorithm according to one embodiment of the present invention;
[0083] Figure 7 is a point p of the knife contact trajectory according to one embodiment of the present invention. m and point C on the tool circle k Distance diagram;
[0084] Figure 8 is a schematic diagram of a collaborative PSO algorithm according to one embodiment of the present invention;
[0085] Fig. 9 is a schematic diagram of a free-form surface model 1 according to one embodiment of the present invention;
[0086] Fig.10 FIG. 2 is a schematic diagram of a free-form surface model 2 according to one embodiment of the present invention. DETAILED DESCRIPTION
[0087] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0088] The present invention proposes a method for calculating the tool path approach error of a five-axis CNC machining flat-bottomed tool, which comprises the following specific steps:
[0089] Based on the principle of five-axis CNC machining tool path approximation error and the optimization of particle swarm algorithm, the present invention designs a nested PSO algorithm for calculating the tool path approximation error of five-axis CNC machining of flat bottom cutters. By calculating the fitness value of the particles, iteratively finding the optimal particles and their optimal fitness values, using the set calculation accuracy as the calculation termination condition, and finally outputting the optimal solution of the third-layer particle swarm algorithm as the approximation error.
[0090] The calculation flow charts of the three-layer PSO algorithm are as follows: Figure 1 As shown in (a), (b), and (c), Figure 1 The fitness value in (c) is given by Figure 1 (b) Calculate, Figure 1 The fitness value of (b) is given by Figure 1 (a) Calculated. Through the nesting of the three-layer PSO algorithm, the approximation error between adjacent tool positions is obtained. The calculation of the approximation error combines the fitness function value in each layer, and finally obtains the maximum value of the minimum distance from the tool circle to the tool contact trajectory line corresponding to all tool positions, and takes it as the approximation error between adjacent tool positions. The specific three-layer PSO calculation steps are described below.
[0091] The first-level PSO algorithm steps are as follows:
[0092] Step 1: Get the tool contact trajectory parameter information and set the search interval [u k ,u k+1 ] is mapped to [0,1], setting the speed threshold v max and v min , population size N, crossover probability p c , mutation probability p m , simulated annealing initial temperature, cooling coefficient, maximum number of iterations k max Or the calculation accuracy is used as the termination condition, and the reverse learning Tent initializes the knife contact particle position and the knife contact particle speed.
[0093] Step 2 randomly divides the knife contact particles into population 1 and population 2. Population 1 proceeds to step 3, and population 2 proceeds to step 5.
[0094] Step 3 calculates the fitness values of the contact particles in population 1 and arranges them in descending order, then goes to step 4.
[0095] Step 4: Select a certain proportion (such as 20%) of particles with larger fitness values to perform differential mutation operation, form a new population and calculate the fitness value. Go to step 11.
[0096] Step 5 calculates the fitness value of the contact particle of population 2, and then goes to step 6.
[0097] Step 6: The contact particles of population 2 are quantized with a crossover probability p. cPerform crossover operation.
[0098] Step 7 calculates the fitness value of the new particle after the crossover operation, uses the Metropolis criterion to determine whether the new particle is accepted after the crossover operation, updates the population, calculates the fitness value, and arranges it in descending order.
[0099] The crossover operation, mutation operation and selection operation constitute the core mechanism of the genetic algorithm, which realizes the evolution and optimization of the population by simulating the process of natural selection, mating and mutation. The crossover operation simulates the mating process in biological evolution, and the mutation operation simulates the gene mutation process in biological evolution. The specific algorithm steps are:
[0100] Step 1: Randomly generate an initial population containing multiple individuals. Each individual represents a possible solution to the problem, usually represented by binary code. Set the maximum number of iterations, crossover probability, mutation probability, etc.
[0101] Step 2 calculates the fitness value of each individual according to the objective function. The fitness value reflects the quality of the individual solution.
[0102] Step 3: Through the selection operation, individuals with higher fitness are selected from the current population as parents to reproduce the next generation of population.
[0103] Step 4: Select parent individuals and perform crossover operation according to the crossover probability to generate new individuals as offspring.
[0104] Step 5: mutate the offspring individuals according to the mutation probability, and the mutated individuals replace the original individuals.
[0105] Step 6: Combine the parent and offspring individuals to form a new population, and calculate the fitness of each individual in the new population. Perform a selection, and take the individual with the best fitness value as the current best individual.
[0106] Step 7 determines whether the maximum number of iterations or termination conditions of the algorithm are met. If so, the optimal solution is output; otherwise, go to step 3 to continue iterating.
[0107] Step 8: With mutation probability p m A portion (eg, 5%) of the knife contact particles with the smallest fitness value after the crossover operation are selected for mutation operation.
[0108] Step 9 calculates the fitness value of the new particle after the mutation operation, and uses the Metropolis criterion to determine whether the new particle is accepted after the mutation operation.
[0109] Step 10 calculates the fitness value of the new population of population 2.
[0110] Step 11: Combine population 1 with population 2 and use equations (6) and (7) to update the individual optimal pbest and the global optimal g best .
[0111] The individual optimal p best and the global optimal g best There are N particles in a D-dimensional search space. The position and “flying” speed of the i-th particle are shown in equations (1) and (2). The individual optimal position parameter p obtained by the iterative search is best It can be expressed by formula (3): the optimal position parameter g of the population searched in successive iterations is best It can be expressed by formula (4).
[0112] x i (k) = {x i1 (k),x i2 (k),...,x iD (k)},i=1,2,...,N(1)
[0113] v i (k) = {v i1 (k),v i2 (k),...,v iD (k)},i=1,2,...,N(2)
[0114] p best ={p i1 ,p i2 ,...,p iD}(3)
[0115] g best ={p g1 ,p g2 ,...,p gD}(4)
[0116] The updated individual optimal p best and the global optimal g best The calculation method is as follows: the update formula of speed and position when the d-dimensional particle of the k-th generation evolves to the k+1-th generation is:
[0117]
[0118] Where d = 1, 2, 3...D, w is the inertia weight factor, c 1 、c 2 are the individual and group learning factors, r 1 、r 2 are mutually independent random numbers between (0,1), and f is the fitness function. Then the two extreme values p in the particle swarm are best and g best It can be calculated by equations (6) and (7).
[0119]
[0120] Step 12 determines whether the convergence condition is met (such as satisfying the calculation accuracy or reaching the maximum number of iterations). If so, turn to step 14, otherwise turn to step 13.
[0121] Step 13: Use formula (8) to update the inertia weight and use formula (9) to change the learning factor c. 1 、c 2 Use formula (5) to update the velocity and position of the particle, use formula (21) and formula (22) to process the position and velocity of the out-of-bounds particle, and use formula (10) to perform cooling operation. Go to step 2 to continue iteration.
[0122] The inertia weight w indicates how much the particle inherits the previous velocity. In the early stage of the PSO algorithm, a larger inertia weight factor is generally required to obtain a stronger global search capability, and it decreases as the number of iterations increases, thereby accelerating particle convergence. The inertia weight w can be calculated by formula (8), where k is the number of iterations, w max 、w min are the maximum and minimum values of the inertia weight coefficient.
[0123]
[0124] The learning factor c of the PSO algorithm 1 and c 2 The individual learning ability and group learning ability are adjusted respectively, which can be calculated by formula (9), where c 1max 、c 1min 、c 2max and c 2min are the maximum and minimum values of individual and group learning factors respectively.
[0125]
[0126] The cooling operation is that the simulated annealing algorithm needs to set the initial temperature at the beginning of the iteration, and the temperature is cooled by a certain cooling coefficient t after each iteration. down Attenuation is performed as shown in formula (10).
[0127] T k =t down ×T k-1 (10)
[0128] Step 14 outputs the current optimal particle position fitness value as the minimum distance from a point on the tool circle to the tool contact point trajectory, and the algorithm terminates.
[0129] The second and third layer POS algorithms include:
[0130] Step 1: Obtain tool circle parameter information, standardize tool circle parameter coordinates, set population size N and speed threshold v max 、v min , set the maximum number of iterations k max Or the calculation accuracy is used as the termination condition, and the reverse learning Tent initializes the tool circular particle position and the tool circular particle speed.
[0131] Step 2 uses the first layer of PSO algorithm steps to calculate the fitness value of the tool circle particle, that is, the minimum distance from each tool circle particle to the tool contact point trajectory line.
[0132] Step 3: Use equations (6) and (7) to update the individual optimal p best and the global optimal g best .
[0133] Step 4: Arrange the tool circle particles in descending order according to the fitness value, and select particles with larger fitness value (such as 20%) for differential mutation operation to form a new population.
[0134] Step 5 determines whether the convergence condition is met (such as satisfying the calculation accuracy or reaching the maximum number of iterations). If so, go to step 7; otherwise, go to step 6.
[0135] Step 6: Use formula (8) to update the inertia weight and use formula (9) to change the learning factor c 1 、c 2 Use equation (5) to update the velocity and position of the particle, and use equations (21) and (22) to process the position and velocity of the particle that crosses the cutter circle. Go to step 2 to continue iteration.
[0136] Step 7 outputs the fitness value of the current optimal tool circle particle position as the minimum distance from the tool circle to the tool contact point trajectory line of a tool position, and the algorithm terminates.
[0137] The above content is the main steps of the method for calculating the tool path approximation error of a flat-bottomed tool in five-axis CNC machining. More details of the invention are introduced below:
[0138] This paper takes the five-axis machining of flat bottom cutter as an example to briefly introduce the geometric principle of the tool path approximation error of five-axis CNC machining, such as Figure 2 As shown in the figure, the jth and j+1th tool positions on the i-th tool path are and O i,j and O i,j+1 It is the positioning point of the tool fixture. and the knife contact trajectory CC between the two points i,j There is a maximum distance That is, linear error. m Yes i,j Oi,j+1 The midpoint of O m The line connecting the bottom circle of the tool and the tool contact point There is a maximum distance That is, nonlinear error, O m The tool data can be calculated by formula (11), where L T is the tool length, T i,j , T m , T i,j+1 is the tool axis vector. Five axis linkage When the tool circle passes through the actual cutting trajectory, the tool envelope surface is the actual cutting contour of the tool. The envelope surface is consistent with CC i,j The maximum error between max It is the approximation error. The iterative algorithm based on the geometric method generally obtains a set of tool circles according to the discretization of the tool position on the envelope surface, and calculates the trajectory line CC from each tool circle to the tool contact point. i,j The maximum value of all minimum distance values is the approximation error.
[0139]
[0140] In order to use the PSO algorithm to calculate the tool path approach error of five-axis flat-bottom tool machining, three PSO algorithm nestings are required to calculate the approach error value, so the calculation method of the five-axis CNC machining tool path approach error is designed as three layers in structure. The three-layer nested particle distribution diagram, such as Figure 3 The three layers are:
[0141] First layer: The PSO algorithm distributes particles on the tool contact trajectory (referred to as tool contact particles). The tool contact is the particle, and the particle moves on the tool contact trajectory. The distance between the tool contact particle and a known point on the tool circle is used as the fitness value. The minimum distance from a point on the tool circle to the tool contact trajectory can be obtained through iterative calculation.
[0142] Second layer: The PSO algorithm distributes particles on a tool circle corresponding to a certain tool position (referred to as tool circle particles). The particles move on the tool circle, and the distance from the particle to the tool contact point trajectory is used as the fitness value, which can be calculated by the first layer. Through the second layer of PSO iteration, the position point on the tool circle with the minimum distance to the tool contact point trajectory can be obtained.
[0143] The third layer: PSO algorithm distributes particles at the positioning point O of the tool fixture i,j and O i,j+1 The minimum distance from the tool circle to the tool contact point trajectory corresponding to each tool position is taken as the fitness value on the connection line (referred to as the positioning point particle). The fitness value can be determined by the second-layer PSO algorithm, and the maximum value of all minimum distance values is the approximation error.
[0144] Through these three layers of PSO algorithms nested layer by layer ( Figure 4 As shown), the adjacent knife positions can be calculated and Approximate error value between .
[0145] (1) Standardized particle search interval
[0146] Compared with point coordinates, parameter u is only one-dimensional and can directly determine the relative position and coordinates of the point, making it more suitable as a particle. In order to improve the standardization and universality of the algorithm, it is proposed to map the search interval to the standard [0,1] and use the discrete values within [0,1] as the particles actually calculated.
[0147] The first layer of tool contact particle search interval is the tool contact trajectory line, the local tool contact trajectory line is mapped to the standard interval [0,1], and the discrete values in [0,1] are used as the actual calculated particles. The third layer of positioning point particle search interval is the positioning point O of the tool fixture. i,j and O i,j+1 Connect O i,j and O i,j+1 The line interval is mapped to the standard interval [0,1], and any point O on the line is j The corresponding particle m j It can be obtained from formula (12) that any point p on the knife contact trajectory line is m The corresponding particle m m It can be obtained by formula (13), and the mapping process is as follows Figure 5 (a) with Figure 5 (b) as shown.
[0148]
[0149]
[0150] The second-layer particle search interval is a tool circle corresponding to a tool position, so it cannot be directly mapped to the standard interval. With T m In the case of P m The coordinates of are (x m ,y n ,z m), (a, b, c), and the tool circle with radius r and its plane can be represented by equations (14) and (15) respectively. For the convenience of calculation, in this section, the circle is represented by a two-dimensional polar coordinate system. The Cartesian coordinates of any particle position are converted into polar coordinates, represented by (r, θ), where r is the radius of the tool circle and θ is the polar angle of the particle on the tool circle, which is in the interval [0, 2π). The polar angle θ of a point on the tool circle is mapped to the standard interval using equation (16). It is a value mapped to the standard interval [0,1). The discrete values in [0,1) are used as particles in actual calculation. The polar angle of each particle is continuously updated in iteration to represent different positions on the tool circle. After being converted into Cartesian coordinates, the fitness value corresponding to the particle can be calculated. The specific process diagram is as follows: Figure 6 shown.
[0151] a 2 (xx m ) 2 +b 2 (yy m ) 2 ++c 2 (zz m ) 2 =r 2 (14)
[0152] a(xx m )+b(yy m )+c(zz m )=0 (15)
[0153]
[0154] (2) Establishing the fitness function for approximation error calculation
[0155] The fitness value of the particles in the third-layer PSO algorithm is the minimum distance from the tool circle to the tool contact trajectory corresponding to a tool position. The second-layer PSO algorithm uses the minimum distance from the tool circle particle to the tool contact trajectory as the fitness value, and the first-layer PSO algorithm uses the distance between the tool contact particle and a known point on the tool circle as the fitness value. These three layers are closely linked. The fitness value of the third-layer PSO algorithm can be obtained from the second-layer PSO algorithm, and the fitness value of the second-layer PSO algorithm can be obtained from the first-layer PSO algorithm. Therefore, the only fitness function that needs to be established is the distance from the tool contact particle of the third-layer PSO algorithm to a position on the tool circle.
[0156] Adjacent knife point and Taking the knife contact trajectory as an example, use step 1 to map the knife contact trajectory interval to the interval [0,1], and take any m-th particle m mTake as an example, the calculation process of fitness is given, and the minimum fitness value of all knife contact particles in the interval is calculated. The calculation process is as follows:
[0157] Step 1: Use equation (17) to calculate the particle m m The corresponding parameter value u of the knife contact m , substitute into formula (18) to calculate the parameter value m m The corresponding point p on the knife contact trajectory CC m .
[0158] u m =m m u k +(1-m m ) k+1 (17)
[0159] p m =CC(u m ) (18)
[0160] Step 2 uses the Euclidean distance formula to calculate the distance between the tool contact point and a fixed point on the tool circle. Figure 7 As shown, the knife contact trajectory point p m and point C on the tool circle k For example, their coordinates are (x m ,y m ,z m ) and (x k ,y k ,z k ), the distance between two points D(P m ,C k ) can be calculated by formula (19).
[0161]
[0162] (3) Tent mapping initialization based on reverse learning mechanism
[0163] In the PSO algorithm, the initial position of the particle has an important impact on the performance and stability of the algorithm. Generally speaking, the initial position is randomly selected, which may cause the PSO algorithm to produce different results in different runs. In order to improve the performance and stability of PSO, some improvement methods have been proposed, one of which is the Opposition-Based Learning (OL) mechanism. The basic idea of the Opposition-Based Learning mechanism is to use the reverse position of the particle to initialize a part of the particles. The reverse position refers to flipping the current position of the particle along the central symmetry axis of the search space. The purpose of this is to introduce diversity and help the algorithm better explore the search space.
[0164] Based on the initialization of the Tent mapping population, a reverse learning mechanism is introduced, and the particle value range is [0,1]. The specific steps are as follows:
[0165] Step 1 Generate a random number between [0,1] as the initial value x 0 .
[0166] Step 2: Calculate the next value x by formula (10) i+1 .
[0167]
[0168] Step 3: x i+1 Sets the value of to the new initial value.
[0169] Step 4 Repeat steps 1, 2, and 3 to obtain x 1 、x 2 …x n , until the required number of random numbers between [0,1] are generated and placed in a set called the original solution set.
[0170] Step 5 The search interval is the standard interval, and the particle is x k , then the reverse particle is 1-x k , the reverse vectors of all particles in the original solution set are calculated to form the reverse solution set.
[0171] Step 6 calculates the fitness value of the original solution set and the reverse solution set as the initial value of the particles, and takes the target number of particles with the best fitness value as the initial population.
[0172] (4) Method for handling out-of-bounds particles
[0173] In the PSO algorithm, an out-of-bounds particle usually refers to a particle whose position is outside the search space. The out-of-bounds may be caused by factors such as the setting of the initial position and the speed update. In order to handle out-of-bounds particles, the standard PSO algorithm uses boundary correction, that is, when the position of a particle is out of bounds, its position is adjusted to the boundary of the search space, as shown in equations (22) and (23). This correction usually involves checking the position component of each particle. If it exceeds the upper or lower limit of the search space, it is corrected to the corresponding boundary value. The present invention also uses a reverse mechanism for out-of-bounds particles. After the standard interval particle crosses the boundary, it is assumed that the particle is x id (k), then adjust the particle position and velocity as shown in equations (21) and (22), where X min , X max is the minimum and maximum position of the particle, V min 、V max is the minimum and maximum speed of the particle, x id (k) and v id(k) are the position and velocity of the particle during the search process. Reverse adjustment can quickly bring the particle back to a reasonable search range and allow the particle to move freely near the boundary of the search space, which helps to reduce boundary effects and improve the robustness of the algorithm.
[0174]
[0175] (5) Differential operation improves the worst particle position
[0176] The differential operation is a commonly used operation in differential evolution algorithms to generate new individuals or solutions. In the differential operation, three individuals (called "parent individuals") are usually selected from the population, and then their information is used to generate a new individual (called "offspring individual"). The differential operation is a method of generating new individuals based on the differential vector. It calculates the differences between different individuals in the population to generate new individual positions. Its advantages are that it is simple and easy to implement, does not require complex calculations and parameter adjustments, can effectively increase the diversity of the population, is conducive to a more comprehensive exploration of the algorithm in the search space, and can introduce a certain degree of randomness, which helps to jump out of the local optimal solution.
[0177] This step introduces a differential operation to perform differential mutation on a certain proportion of particles with poor fitness values. The differential operation introduces a kind of diversity, making the search process more diverse. The differential operation can use the information in the current population to guide the mutation process. By mutating the worst particles, the existing information in the population can be used to more effectively explore the search space and make the mutated new particles more likely to have better fitness values. By introducing a differential operation to mutate the worst particles, the algorithm's search ability can be effectively improved, the algorithm's global search performance can be increased, and thus the algorithm's performance and stability can be improved. The specific mutation steps are as follows:
[0178] Step 1 sorts the fitness values and selects a certain proportion (such as 20%) of particles with poor fitness values to enter the mutation pool.
[0179] Step 2: Select a particle x from the mutation pool 1 As the target particle, three particles x are randomly selected from the particle population outside the cross pool. 2 、x 3 、x 4 as a reference particle.
[0180] Step 3: For each reference particle, calculate the difference vector Ve between it and the target individual. The difference vector is calculated by the linear combination of the reference particle and the target particle. As shown in formula (23), α, β, and γ are the difference vector weight coefficients.
[0181] Ve=α(x 2 -x1 )+β(x 3 -x 1 )+γ(x 4 -x 1 ) (twenty three)
[0182] Step 4: Combine the difference vector to mutate the target particle and generate a new particle. As shown in formula (14).
[0183]
[0184] Step 5: Perform steps 2 to 4 on all particles in the cross pool.
[0185] (6) Co-evolutionary mechanism
[0186] The co-evolution mechanism is an optimization strategy that integrates multiple independent individuals or subgroups to collaboratively search the solution space. Its core idea is to find the global optimal solution in different local search spaces through information exchange and interaction between individuals. This mechanism can enhance the algorithm's search ability, improve the quality of the solution and the convergence speed, avoid falling into the local optimal solution, and maintain the diversity of the population. The co-evolution mechanism plays an important role in the optimization algorithm and provides an effective solution for solving complex problems.
[0187] Therefore, the present invention introduces the coordination mechanism into the PSO algorithm for the first-layer algorithm operation, as shown in the schematic diagram. Figure 8 As shown, the specific steps are as follows:
[0188] Step 1: Randomly divide the initial particles into two populations: population 1 and population 2.
[0189] Step 2 uses the PSO algorithm optimized in sections (1) to (4) to calculate the fitness value of population 1.
[0190] Step 3 calculates the fitness value of population 2.
[0191] Step 4: After one iteration, merge the particles of the two populations, update the optimal position, and enter the next iteration.
[0192] Introducing the collaborative mechanism into the PSO algorithm can enable the entire group to find the global optimal solution more quickly, thereby improving the global search ability of the algorithm. Through the collaborative evolution mechanism, particles can influence and cooperate with each other, reducing the possibility of falling into the local optimal solution, thereby enhancing the convergence and stability of the algorithm.
[0193] The implementation and verification of the present invention are as follows:
[0194] (1) Algorithm Implementation
[0195] The implementation of the algorithm requires the population size N, the maximum number of iterations k max , maximum speed v max With minimum speed v min , inertia weight w, learning factor c 1 and c 2 , crossover probability p c , mutation probability p m , temperature drop coefficient t down The initial temperature T and the difference vector weight coefficients α, β, and γ are set.
[0196] PSO parameter settings, population size N is 50, maximum number of iterations k max is 100, v max With v min is 0.2 and 0.05, w max =0.9, w min =0.4, c 1max =2.5, c 1min =1.5, c 2max =2.5, c 2min =1.5, crossover probability p c and mutation probability p m They are 0.6 and 0.05 respectively, and the temperature reduction coefficient is 0.9.
[0197] Typically, the difference vector weight coefficients α, β, and γ range from (0, 2), which provides enough flexibility to allow the algorithm to explore the search space and achieve good performance on different problems. Within this range, 0.5 is a typical choice, which is neither too conservative nor too aggressive. Choosing 0.5 as the difference vector weight allows for smaller variations to retain some excellent individual characteristics in the population, while allowing enough variation to promote the generation and exploration of new solutions. Therefore, after many tests, the difference vector weight coefficients α, β, and γ were determined to be 0.5.
[0198] After completing the above numerical selection, the program development of all algorithms was completed on the self-developed CAM software, and the tool path approximation error calculation function of five-axis flat-bottom tool CNC machining was realized.
[0199] (2) Algorithm Verification
[0200] by Fig. 9 (a) and 10 (a) are used as examples to generate equal error tool paths. The model and tool path information are shown in Table 1. The geometric iteration algorithm in the invention patent with application number CN201910839404.2 and the proposed collaborative nested PSO algorithm are both used to calculate the approximation error of the equal error tool path and compared. The tool paths of the two surfaces are shown in Fig. 9 (b) and Fig.10(b) The simulation diagrams of the two models are shown in Fig. 9 (c) and Fig.10 (c) is shown. The time consumption of the two methods is shown in Table 2. Under the condition of ensuring accuracy, the computation time of the collaborative nested PSO algorithm is reduced by more than 11% compared with the geometric iteration algorithm, which proves the effectiveness of the collaborative nested PSO algorithm. The operating environment is a computer with Intel i5-13400 and 16G RAM.
[0201] Table 1 Surface and tool path information
[0202]
[0203] Table 2 Comparison of time consumption of two methods
[0204]
[0205] In summary, the present invention provides a method for calculating the tool path approximation error of five-axis CNC machining based on a collaborative nested PSO algorithm. Purpose In order to use PSO for the calculation of the tool path approximation error of five-axis CNC machining, the calculation method of the tool path approximation error of five-axis CNC machining is structurally designed into three layers, and each layer uses a PSO algorithm for nested calculation. In order to improve the universality of the algorithm, the standard PSO is standardized for three different search intervals of particles and a fitness function is established. The design combines the reverse learning mechanism with the initialization of the Tent map, improves the particle out-of-bounds processing method, improves the worst particle position by differential mutation, and improves the convergence speed of the algorithm to form an optimized PSO algorithm for the second and third layers of calculation of the tool path approximation error of five-axis CNC machining. The optimized PSO algorithm is collaboratively calculated with the hybrid PSO algorithm proposed in Chapter 3, and the optimal solutions of the two algorithms are taken to form a collaborative PSO algorithm for the first layer of calculation of the approximation error calculation. The calculation results are fed back from the first layer to the third layer layer by layer as the fitness value of the particles of the next layer, and a collaborative nested PSO algorithm suitable for the tool path approximation error of five-axis CNC machining is constructed. The test results show that, while ensuring accuracy, the proposed collaborative nested PSO algorithm reduces the time consumption by more than 11% compared with the traditional geometric iteration method, verifying the feasibility and effectiveness of the collaborative nested PSO algorithm in the calculation of tool path approximation errors in five-axis CNC machining of free-form surfaces.
[0206] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.
Claims
1. A method for calculating the tool path approach error of a five-axis CNC machining flat-bottom tool, characterized in that: The following steps are involved: Step 1: Obtain the data required for calculating the tool path approach error; Step 2: Design and apply the first-level PSO algorithm to calculate the minimum distance from a point on the tool circle to the tool contact point trajectory; Step 3: Using the result of the first-layer PSO algorithm as the fitness value of the second-layer PSO algorithm, design and use the second-layer PSO algorithm to calculate the minimum distance from the tool circle to the tool contact point trajectory line; Step 4 uses the result of the second-layer PSO algorithm as the fitness value of the third-layer PSO algorithm, designs and uses the third-layer PSO algorithm to calculate the approximation error value.
2. The method for calculating the tool path approach error of a five-axis CNC machining flat-bottomed tool according to claim 1, characterized in that: The data required to calculate the approximation error include: Tool radius, length, rake angle, first and last tool contact points, tool position points, and tool contact trajectory line between tool contact points.
3. The method for calculating the tool path approach error of a five-axis CNC machining flat-bottomed tool according to claim 1, characterized in that: The step 2 designs and applies the first-layer PSO algorithm including: Step 2.1 Obtain the tool contact trajectory parameter information and set the search interval [u k ,u k+1 ] is mapped to [0,1], setting the speed threshold v max and v min , population size N, crossover probability p c , mutation probability p m , simulated annealing initial temperature, cooling coefficient, maximum number of iterations k max Or the calculation accuracy is used as the termination condition, reverse learning Tent initializes the knife contact particle position, initializes the knife contact particle speed; Step 2.2: randomly divide the knife contact particles into population 1 and population 2. Population 1 proceeds to step 2.3, and population 2 proceeds to step 2.
5. Step 2.3 calculates the fitness values of the contact particles of population 1 and arranges them in descending order, and then goes to step 2.4; Step 2.4 selects a certain proportion (such as 20%) of particles with larger fitness values to perform differential mutation operations, forms a new population and calculates the fitness value, and then turns to step 2.11; Step 2.5 calculates the fitness value of the contact particle of population 2, and goes to step 2.6; Step 2.6: For the contact particles of population 2, the crossover probability p c Perform crossover operations; Step 2.7 calculates the fitness value of the new particle after the crossover operation, uses the Metropolis criterion to determine whether the new particle is accepted after the crossover operation, updates the population, calculates the fitness value and arranges it in descending order; Step 2.8: With mutation probability p m Select a portion (e.g. 5%) of the knife contact particles with the smallest fitness value after the crossover operation to perform mutation operation; Step 2.9 calculates the fitness value of the new particle after the mutation operation, and uses the Metropolis criterion to determine whether the new particle is accepted after the mutation operation; Step 2.10 calculates the fitness value of the new population of population 2; Step 2.11 Combine population 1 with population 2 and update the individual optimal p best and the global optimal g best ; Step 2.12 determines whether the convergence condition is met (such as the calculation accuracy is met or the maximum number of iterations is reached). If so, go to step 2.14; otherwise, go to step 2.13; Step 2.13 updates the inertia weight, changes the learning factors c1 and c2, updates the velocity and position of the particles, processes the position and velocity of the out-of-bounds particles, then performs a cooling operation and turns to step 2.2 to continue the iteration; Step 2.14 outputs the current optimal particle position fitness value as the minimum distance from a point on the tool circle to the tool contact point trajectory, and the algorithm terminates.
4. The method for calculating the tool path approach error of a five-axis CNC machining flat-bottomed tool according to claim 1, characterized in that: The design of step 3 and application of the second-layer PSO algorithm include: Step 3.1 Obtain tool circle parameter information, standardize tool circle parameter coordinates, set population size N and speed threshold v max 、v min , set the maximum number of iterations k max Or the calculation accuracy is used as the termination condition, and the reverse learning Tent initializes the tool circular particle position and the tool circular particle speed; Step 3.2 uses the first layer of PSO algorithm steps to calculate the fitness value of the tool circle particle, that is, the minimum distance from each tool circle particle to the tool contact point trajectory line; Step 3.3 Update individual optimal p best and the global optimal g best ; Step 3.4: Arrange the tool circle particles in descending order according to the fitness value, and select the particles with larger fitness value (such as 20%) for differential mutation operation to form a new population; Step 3.5 determines whether the convergence condition is met (such as the calculation accuracy is met or the maximum number of iterations is reached). If so, go to step 3.7; otherwise, go to step 3.6; Step 3.6 updates the inertia weight, changes the learning factors c1 and c2, updates the velocity and position of the particles, processes the position and velocity of the particles that cross the tool circle, and turns to step 3.2 to continue iteration; Step 3.7 outputs the fitness value of the current optimal tool circle particle position as the minimum distance from the tool circle to the tool contact point trajectory line, and the algorithm terminates.
5. The method for calculating the tool path approach error of a five-axis CNC machining flat-bottomed tool according to claim 1, characterized in that: The design of step 4 and the application of the third-layer PSO algorithm include: Step 4.1 Obtain tool position parameter information, standardize the tool positioning point connection parameter coordinates, set the population size N and speed threshold v max 、v min , set the maximum number of iterations k max Or use the calculation accuracy as the termination condition, reverse learning Tent initializes the particle position of the positioning point, and initializes the particle velocity of the positioning point; Step 4.2 calculates the fitness value of the positioning point particle according to the second-layer PSO algorithm step, that is, the minimum distance from the tool circle to the tool contact point trajectory line corresponding to each point particle; Step 4.3 Update the individual optimal p best and the global optimal g best ; Step 4.4: Arrange the particles at the positioning points in descending order according to the fitness values, and select particles with smaller fitness values (such as 5%) for differential mutation operation to form a new population; Step 4.5 determines whether the convergence condition is met (such as the calculation accuracy is met or the maximum number of iterations is reached). If so, go to step 4.7; otherwise, go to step 4.6; Step 4.6 updates the inertia weight and learning factors c1 and c2, updates the velocity and position of the particles, processes the position and velocity of the particles that cross the boundary, and turns to step 4.2 to continue iteration; Step 4.7 outputs the fitness value of the particle position at the current optimal positioning point, that is, the maximum value of the minimum distance from the tool circle to the tool contact point trajectory line of all tool positions, which is the required approximation error of the tool path between the two tool position points, and the algorithm terminates.
6. A terminal, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the five-axis CNC machining flat-bottom tool path approximation error calculation method as described in any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for calculating the tool path approximation error of a flat-bottom tool in five-axis CNC machining according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Non-linear error control method based on eight-parameter five-axis linear interpolation
CN110501974A
Control method for nonlinear error between five-axis machining tool nose point and tool axis direction
CN111913438A
Method for Generating Equal Error Toolpaths in Parametric Surface Flat End Machining (5-Axis)
CN112987647B