Magnetic encoder jump point suppression method and device based on particle swarm spider wasp algorithm

Through the particle swarm spider wasp algorithm combined with the magnetic encoder, the problem of multi-pole angle value jump is solved, the resolution and accuracy of the magnetic encoder is improved, noise interference is blocked, and errors are avoided.

CN120448666APending Publication Date: 2025-08-08HARBIN UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510536050.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

When determining the angle value of the pole number, magnetic encoder is prone to angle value jumps, which affects the accurate judgment of the pole number and leads to a decrease in resolution.

Method used

The particle swarm spider wasp algorithm is adopted. By adding the window value θwind at the jump position of the multi-pin pole angle value, combining the arctangent algorithm and analog-to-digital conversion, the rapid convergence characteristics of the spider wasp algorithm are used to optimize the window value θwind, suppress zero-point jumps, and accurately judge the number of poles.

Benefits of technology

The resolution of the magnetic encoder is improved, external noise interference is shielded, and the axial movement error of the motor spindle is avoided, so as to achieve fast and accurate pole number discrimination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448666A_ABST
    Figure CN120448666A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of magnetic encoder manufacturing, and relates to a magnetic encoder jump point suppression method and device based on a particle swarm spider wasp algorithm. The method comprises the following steps of: converting acquired single-antipode and multi-antipode magnetic field signals into angle values through an arc tangent algorithm by utilizing a magnetic encoder combined with single-antipode and multi-antipode magnetic steel and utilizing a Hall element with a phase difference of 90 degrees, sequencing, adding a window value theta wind to the multi-antipode angle values, determining upper and lower bounds of a window, and dividing regions, so as to obtain the multi-antipode magnetic field sensor. And forming a pole number judgment interval, carrying out subdivision calculation on a multi-antipode angle value by using the limited pole number, carrying out differential processing, combining with a wasp algorithm, optimizing key parameters of the wasps by using a particle swarm algorithm, and continuously substituting into a window value theta wind for iterative calculation. According to the method, through the characteristics of high convergence speed, high efficiency and the like of the spider wasp algorithm, the optimal window value generated without the jump point can be accurately and quickly found, and the method is a quick and convenient angle zero-crossing jump point suppression method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of encoder manufacturing, and in particular relates to a magnetic encoder jump point suppression method and device based on a particle swarm spider wasp algorithm. Background Art

[0002] A magnetic encoder is a sensor that measures motor speed and rotor position. It primarily consists of a magnetic disk, a sensor, and a control circuit. Magnetic encoders offer high resolution, high accuracy, reliability, long life, and excellent stability, making them suitable for applications where traditional encoders are inadequate.

[0003] Magnetic encoders are categorized as single-pole and multi-pole encoders, depending on the number of pole pairs in the magnet. Combination magnetic encoders, which combine single-pole and multi-pole magnets, significantly improve resolution. However, due to temperature, vibration, and noise, angle values may jump when determining the number of poles in multi-pole angles, affecting accurate pole number determination. Summary of the Invention

[0004] In response to the above problem, the present invention proposes a solution to solve the angle value jump point when the magnetic encoder has multiple pole pairs. Through the spider wasp algorithm based on particle swarm, the angle value jump of multiple pole pairs, that is, the pole number changes, increases the window value θ wind , accurately determine the number of multiple pole pairs, suppress the misjudgment of pole numbers caused by zero point jump, and improve the resolution of the magnetic encoder.

[0005] The invention discloses a magnetic encoder jump point suppression method based on a particle swarm spider wasp algorithm, which includes the following steps.

[0006] Step 1: When the motor spindle rotates, the radially magnetized single-pole magnet will generate a radial magnetic field, and the axially magnetized multi-pole magnet will generate an axial magnetic field. Through the magnetic conductor, the single-pole Hall a1 and a2 collect the single-pole angle value signals A+ and A-, and the multi-pole Hall b1 and b2 collect the single-pole angle value signals B+ and B-. The encoder signal solver performs analog-to-digital conversion on the single-pole signals A+ and A- and the multi-pole signals B+ and B- to obtain the single-pole digital signal H A+ 、H A- With the multi-pole digital signal H B+ 、H B- , the single-pole angle value θ1 and the multi-pole angle value θ2 are solved by the inverse tangent algorithm. The solution formula is:

[0007]

[0008] Step 2: Sort the multi-pole angle values θ2 in the order of increasing single-pole angle values θ1 to obtain the corresponding relationship between the multi-pole angle values θ2 and the single-pole angle values θ1. The number of pole pairs of the multi-pole magnet used is P. Therefore, in one rotation cycle, when the single-pole angle value θ1 increases from 0 to 65535 once, the multi-pole angle value θ2 changes from 0 to 65535 P times; the single-pole angle value corresponding to the zero point of the multi-pole angle value is z. The zero point calibration of the single-pole and multi-pole angle values is performed using the following formula:

[0009]

[0010] where θ 1_temp The new single-pole angle value θ is obtained by calibrating the single-pole angle value θ. 1_new After the multiple pairs of pole angle values are sorted, a limit value, namely the window value θ, is assigned to the multiple pole angle values θ2. wind , the formula is:

[0011]

[0012] where θ wind_upper is the upper boundary of the window with multiple pairs of pole angles, θ wind_lower The upper and lower boundaries of the window are divided by 65535 to obtain the number of intervals corresponding to each digital angle. The formula is:

[0013]

[0014] Where wind_upper is the number of intervals corresponding to the upper limit of the window, and wind_lower is the number of intervals corresponding to the lower limit of the window. Then re-determine the upper and lower boundary values, the formula is:

[0015]

[0016] where θ wind_upper_rem is the newly determined upper limit of the window, θ wind_lower_rem is the newly determined lower limit value of the window;

[0017] Step 3: The sorted single-pole angle value θ 1_new Divide by 65535, θ 1_new The value range of is changed from [0,65535] to a decimal between [0,1], and then multiplied by the interval length Interval_Length for compression. The compressed data is rounded with the integer function, and the single-pair-of-pole angle value is mapped to the Interval_Length interval. The specific formula is:

[0018]

[0019] where θ1_Interval is the single-pole angle value after compression and rounding, the value range is [0,Interval_Length], Int is the rounding command, the rounding method is: take the integer smaller than the current value and closest to the current value; i is the number of data sampling points, the value is [1,g]; the sequence θ 1_Interval Extract the serial numbers of all the values in and make them into a separate sequence Interval_M;

[0020] Step 4: Use the data values in the sequence Interval_M as the multi-pole angle value θ2 and the multi-pole angle value θ on the upper limit of the window wind_upper_rem 、Multiple pairs of extreme angle values θ at the lower limit of the window wind_lower_rem Sort the sequence numbers in the array by the formula:

[0021]

[0022] where θ 2_tab is the standard multi-pole angle value, θ upper_tab is the upper limit of the standard window, θ lower_tab is the angle value of the multiple pairs of poles under the standard window, δ is the number of data in the sequence Interval_M; after completing the above operation, 2_tab ,θ upper_tab ,θ lower_tab Then perform the difference calculation, the formula is as follows:

[0023] θ 2_tab_error =θ 2_tab (i+1)-θ 2_tab (i) (9)

[0024] where θ 2_tab_error is the sequence after difference calculation. If the data point in the difference sequence is less than -45000, then the original unbounded multiple pole number θ 2_num Add 1 until the value of the pole pair number is equal to the pole pair number P of the multi-pole magnet. When it is greater than P, the pole pair number is 1. upper_tab ,θ lower_tab Perform the same process to obtain the number of pole pairs θ on the upper limit of the window wind_upper_num , the number of pole pairs under the window is θ wind_lower_num ;

[0025] Step 5: Arrange the three sets of multiple pole pairs. If θ wind_upper_num (i)>θ 2_num (i) and θ2(i)<4096, then θ 2_num (i) Add 1; if θ 2_num (i)>θ wind_lower_num (i) and θ2(i)>61440, then θ 2_num(i) minus 1; if θ 2_num (i)-θ wind_upper_num (i)=1 and θ2(i)>61440, then θ 2_num (i) Subtract 1; for multiple pairs of pole angle values, the formula is:

[0026] θ 2_new =(P-1)×65535+θ2 (10)

[0027] θ 2_new is the angle value of multiple pairs of poles after subdivision, P is the pole number sequence obtained in step 4, and its value is [1,16]. 2_new For differential calculation, take the absolute value of the differential value and define the data point with an absolute value greater than 45,000 as a jump point;

[0028] Step 6: Define the function:

[0029] Y=TD(θ wind )(11)

[0030] Where Y is the number of jump points recorded, TD is the function of the execution process from step 2 to step 5, θ wind is the determined window value;

[0031] The main process of the spider wasp algorithm is hunting and nesting behavior. The hunting process mainly consists of three stages: searching, following, and fleeing. The search process is as follows:

[0032]

[0033] in is the set of solutions; t is the index, i is a natural number between 0 and N; μ1 indicates the specified moving direction; a and b are two randomly selected indices in the population for direction specification; r1 is a random number between the interval [0, 1]; rn is a random number that satisfies the normal distribution; the following stage is as follows:

[0034]

[0035] where c is a randomly selected index in the population; t and t max Indicates the current index and maximum index; r5 and r6 are randomly generated values between [0, 1]; the escape stage is as follows:

[0036]

[0037] in is a vector generated between k and -k according to the normal distribution; after the hunting phase is completed, the nesting phase begins, and the formula is as follows:

[0038]

[0039] in represents the best solution so far; wasps mate to produce offspring, and the offspring produced after mating are the optional solutions, and the formula is:

[0040]

[0041] Where Crossover represents the uniform crossover operator and CR represents the crossover rate; and There are two types of female and male spider wasps; male spider wasps spawn as follows:

[0042]

[0043] Where β and β1 are randomly generated values from a normal distribution, e is an exponential constant, and l is a randomly generated number in the interval [1, -2]. Where h, j, and k are the exponentials of three solutions randomly selected from the population, such that h ≠ j ≠ k ≠ i. The trade-off between hunting and mating behavior is based on a predefined factor called the tradeoff rate (TR). The particle swarm algorithm is used to select appropriate CR and TR values. The core formula of the particle swarm algorithm is:

[0044]

[0045] Where i is the particle number; k is the number of iterations; ω is the inertia weight; c1 is the individual learning factor; c2 is the group learning factor; r1 and r2 are random numbers in the interval [0, 1] to increase the randomness of the search; represents the d-th dimension velocity vector of particle i in the k-th iteration; represents the d-th dimension position vector of particle i in the k-th iteration; represents the historical optimal position of particle i in the d-th dimension in the k-th iteration; Represents the historical optimal position of the d-th dimension of the group in the k-th iteration; after iterative calculation by this algorithm, the window value θ that satisfies the number of jump points of 0 can be accurately found wind .

[0046] The beneficial effects of the present invention are:

[0047] 1. The present invention uses a multi-pole magnet with 16 pole pairs. The algorithm of the present invention is used to improve the resolution of the magnetic encoder.

[0048] 2. The single-pole magnet steel in the magnetic encoder used in the present invention is radially magnetized, and the direction of the magnetic field is changed by the magnetic ring. This can not only shield the influence of external noise on the signal, but also avoid the error caused by the axial movement of the motor spindle.

[0049] 3. The present invention combines the particle swarm-based Spider Wasp algorithm with a magnetic encoder resolution calculation method. Leveraging the advantages of the particle swarm-based Spider Wasp algorithm, such as fast convergence speed and high precision, this method can accurately and quickly find the limit determination window value x where no jump points are generated. This method is a fast and convenient method for suppressing the impact of jump points after the subdivision of multiple pairs of pole angle values. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] For ease of explanation, the present invention is described in detail with reference to the following specific embodiments and accompanying drawings:

[0051] Figure 1 This is a schematic diagram of the overall structure of the new magnetic encoder described in the present invention;

[0052] Figure 2 This is a schematic diagram of the internal structure of the new magnetic encoder of the present invention;

[0053] Figure 3 This is a schematic diagram of the magnetic steel structure of the new magnetic encoder described in the present invention;

[0054] Figure 4 This is a structural diagram of the encoder solver board of the present invention;

[0055] Figure 5 This is a schematic diagram of the structure of the magnetic conductor of the present invention;

[0056] Figure 6-a This is a schematic diagram of the zero point of the single-pole angle value without its multi-pole angle value according to the present invention;

[0057] Figure 6-b Schematic diagram of the zero point of the single-pole angle value and its multi-pole angle value according to the present invention;

[0058] Figure 7 Schematic diagram of the window upper limit, window lower limit, and original multi-pole angle values according to the present invention;

[0059] Figure 8 This is a schematic diagram of the area division according to the present invention;

[0060] Figure 9 This is a schematic diagram of multiple pairs of epipolar angle values after resolution improvement and amplification according to the present invention;

[0061] Figure 10 This is a schematic diagram of jump points after using window values to subdivide multiple pairs of polar angle values according to the present invention;

[0062] Figure 11 This is a schematic diagram of determining the relationship between window value and jump point using the particle swarm-based spider-wasp algorithm of the present invention;

[0063] Figure 12This is a comparison chart of the accuracy errors of the particle swarm-based spider-wasp algorithm of the present invention;

[0064] In the figure, 1. Motor main shaft; 2. Bearing; 3. Flange; 4. Support plate; 5. Multi-pole magnet; 6. Magnetic field shielding ring; 7. Magnetic conductor; 7-1. Single-pole Hall slot c1; 7-2. Single-pole Hall slot c2; 8. Single-pole magnet; 9. Encoder solver board; 9-1. Single-pole Hall a1; 9-2. Single-pole Hall a2; 9-3. Multi-pole Hall b1; 9-4. Multi-pole Hall b2; 10. Encoder end cover; 11. Single-chip microcomputer. DETAILED DESCRIPTION

[0065] The specific embodiments / examples described herein are specific embodiments of the present invention and are used to illustrate the concept of the present invention. They are illustrative and exemplary and should not be construed as limiting the embodiments of the present invention or the scope of the present invention. In addition to the examples described herein, those skilled in the art can also adopt other obvious technical solutions based on the claims and the disclosure of the specification. These technical solutions, including any obvious replacements and modifications of the embodiments described herein, are all within the scope of protection of the present invention.

[0066] To make the objectives, technical solutions, and advantages of the present invention more clearly apparent, the present invention is described below using specific embodiments shown in the accompanying drawings. However, it should be understood that these descriptions are merely illustrative and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present invention.

[0067] The structural composition of the present invention is as follows Figure 1 、 Figure 2 、 Figure 3 、 Figure 4 、 Figure 5 , and further illustrate the specific structure and specific implementation of the present invention in conjunction with the accompanying drawings.

[0068] The magnetic encoder structure is as follows Figure 2As shown, it is characterized in that: the encoder structure includes (1), a motor spindle (2), a bearing (3), a flange (4), a support plate (5), a multi-pole magnetic steel (6), a magnetic field shielding ring (7), a magnetizer (8), a single-pole magnetic steel (9), an encoder signal decomposition board (10), an encoder end cover (11), and a single-chip microcomputer; wherein the encoder signal decomposition board (9) is welded with a direct-insert single-pole Hall a1 (9-1) and a single-pole Hall a2 (9-2), a patch-type multi-pole Hall b1 (9-3) and a multi-pole Hall b2 (9-4), and a single-chip microcomputer (11); the single-pole Hall a1 (9-1) and the single-pole Hall a2 (9-2) are placed at 90 degrees on the same circumference, the multi-pole Hall b1 (9-3) and the multi-pole Hall b2 (9-4) are placed at 90 degrees on the same circumference, and the magnetizer (7) is provided with a single-pole Hall slot c1 (7-1), a single-pole Hall The invention relates to a slot c2 (7-2), wherein the support plate (4) is glued to the motor main shaft (1), the multi-pole magnet steel (5) of axial magnetization mode is glued to the support plate (4), the magnetic field shielding ring (6) is glued to the support plate (4), the single-pole magnet steel (8) of radial magnetization mode is glued to the motor main shaft (1), the magnetizer (7) is glued to the encoder signal solution board (9), the encoder signal solution board (9) is glued to the encoder end cover (10), and the encoder end cover (10) is connected to the flange (3) by threaded connection; when the motor shaft (1) starts to rotate, the single-pole magnet steel (8), the magnetic field shielding ring (6), the multi-pole magnet steel (5), and the support plate (4) are driven to rotate together; the radial magnetic field of the single-pole magnet steel (8) receives the single-pole magnetic field signal through the single-pole Hall glued to the encoder signal solution board (9), and the multi-pole Hall is located directly above the multi-pole magnet steel (5) and is used to receive the multi-pole magnetic field signal.

[0069] A magnetic encoder jump point suppression method and device based on the particle swarm spider wasp algorithm, the specific implementation process of the method is as follows:

[0070] Step 1: When the motor spindle rotates, the radially magnetized single-pole magnet will generate a radial magnetic field, and the axially magnetized multi-pole magnet will generate an axial magnetic field. Through the magnetic conductor, the single-pole Hall a1 and a2 collect the single-pole angle value signals A+ and A-, and the multi-pole Hall b1 and b2 collect the single-pole angle value signals B+ and B-. The encoder signal solver performs analog-to-digital conversion on the single-pole signals A+ and A- and the multi-pole signals B+ and B- to obtain the single-pole digital signal H A+ 、H A- With the multi-pole digital signal H B+ 、H B- , the single-pole angle value θ1 and the multi-pole angle value θ2 are solved by the inverse tangent algorithm. The solution formula is:

[0071]

[0072] Step 2: Sort the multiple-pole angle values θ2 in a sequence of increasing single-pole angle values θ1 to obtain a corresponding relationship between the multiple-pole angle values θ2 and the single-pole angle values θ1. The number of pole pairs of the multiple-pole magnetic steel used in the present invention is 16. Therefore, within one rotation cycle, when the single-pole angle value θ1 increases from 0 to 65535 once, the multiple-pole angle value θ2 changes from 0 to 65535 16 times. As shown in FIG6 , the zero point of the single-pole angle value and the zero point of the multiple-pole angle value are not aligned. The single-pole angle value corresponding to the zero point of the multiple-pole angle value is z. The zero point calibration formula for the single-pole and multi-pole angle values is:

[0073]

[0074] where θ 1_temp The new single-pole angle value θ is obtained by calibrating the single-pole angle value θ. 1_new After the multiple pairs of pole angle values are sorted, the multiple pole angle values θ2 are assigned a limit value, that is, a window value θ wind , the formula is:

[0075]

[0076] where θ wind_upper is the upper boundary of the window with multiple pairs of pole angles, θ wind_lower The upper and lower boundaries of the window are divided by 65535 to obtain the number of intervals corresponding to each digital angle. The formula is:

[0077]

[0078] Where wind_upper is the number of intervals corresponding to the upper limit of the window, and wind_lower is the number of intervals corresponding to the lower limit of the window. Then re-determine the upper and lower boundary values, the formula is:

[0079]

[0080] where θ wind_upper_rem is the newly determined upper limit of the window, θ wind_lower_rem is the newly determined lower limit value of the window, such as Figure 7 As shown;

[0081] Step 3: The sorted single-pole angle value θ 1_new Divide by 65535, θ 1_new The value range of is changed from [0,65535] to a decimal between [0,1], and then multiplied by the interval length 2048 for compression. The compressed data is rounded with the integer function, and the single-pair-of-pole angle value is mapped to the interval [0,2048]. The specific formula is:

[0082]

[0083] where θ 1_Interval is the single-pole angle value after compression and rounding, with a value range of [0,2048]. Int is the rounding command, and the rounding method is: take the integer that is smaller than the current value and closest to the current value. i is the number of data sampling points, with a value of [1,g]. 1_Interval Extract the serial numbers of all the values in and make them into a separate sequence Interval_M;

[0084] Step 4: Use the data values in the sequence Interval_M as the multi-pole angle value θ2 and the multi-pole angle value θ on the upper limit of the window wind_upper_rem , the window lower limit multiple pairs of pole angle values θ wind_lower_rem Sort the sequence numbers in the array by the formula:

[0085] where θ 2_tab is the standard multi-pole angle value, θ upper_tab is the upper limit of the standard window, θ lower_tab is the angle value of the multiple pairs of poles under the standard window, δ is the number of data in the sequence Interval_M; after completing the above operation, 2_tab ,θ upper_tab ,θ lower_tab Then perform the difference calculation, the formula is as follows:

[0086] θ 2_tab_error =θ 2_tab (i+1)-θ 2_tab (i) (9)

[0087] where θ 2_tab_error is the sequence after difference calculation, θ 2_tab (i+1) is the sequence after difference calculation, θ 2_tab (i) is the difference series. If the data point in the difference series is less than -45000, then the original unbounded multi-pole number θ 2_num Add 1 until the pole pair number is equal to 16, when it is greater than 16, the pole pair number is set to 1; upper_tab ,θ lower_tab Perform the same process to obtain the number of pole pairs θ on the upper limit of the window wind_upper_num , the number of pole pairs under the window is θ wind_lower_num ;

[0088] Step 5: Arrange the three groups of multi-pole pairs, such as Figure 8 As shown in the figure, the angle values of multiple pairs of poles will fluctuate abnormally when the number of poles changes; if θ wind_upper_num (i)>θ 2_num(i) and θ2(i)<4096, then θ 2_num (i) Add 1; if θ 2_num (i)>θ wind_lower_num (i) and θ2(i)>61440, then θ 2_num (i) minus 1; if θ 2_num (i)-θ wind_upper_num (i)=1 and θ2(i)>61440, then θ 2_num (i) Subtract 1; for multiple pairs of pole angle values, the formula is:

[0089] θ 2_new =(P-1)×65535+θ2 (10)

[0090] θ 2_new are multiple pairs of pole angle values after subdivision, such as Figure 9 As shown; P is the pole number sequence obtained in step 4, and its value is [1,16]. 2_new For differential calculation, take the absolute value of the differential value and define the data point with an absolute value greater than 45,000 as a jump point;

[0091] Step 6: Define the function:

[0092] Y=TD(θ wind )(11)

[0093] Where Y is the number of jump points recorded, TD is the function of the execution process from step 2 to step 5, θ wind is the determined window value; the main process of the spider wasp algorithm is hunting and nesting behavior. Its hunting process mainly consists of three stages: searching, following and escaping. Its search process is as follows:

[0094]

[0095] in is the set of solutions; t is the index, i is a natural number between 0 and N; μ1 indicates the specified moving direction; a and b are two randomly selected indices in the population for direction specification; r1 is a random number between the interval [0, 1]; rn is a random number that satisfies the normal distribution; the following stage is as follows:

[0096]

[0097] where c is a randomly selected index in the population; t and t max Indicates the current index and maximum index; r5 and r6 are randomly generated values between [0, 1]; the escape stage is as follows:

[0098]

[0099] in is a vector generated between k and -k according to the normal distribution; after the hunting phase is completed, the nesting phase begins, and the formula is as follows:

[0100]

[0101] in represents the best solution so far; wasps mate to produce offspring, and the offspring produced after mating are the optional solutions, and the formula is:

[0102]

[0103] Where Crossover represents the uniform crossover operator and CR represents the crossover rate; and There are two types of female and male spider wasps; male spider wasps spawn as follows:

[0104]

[0105]

[0106] Where β and β1 are randomly generated values from a normal distribution, e is an exponential constant, and l is a randomly generated number in the interval [1, -2]. Where h, j, and k are the exponentials of three solutions randomly selected from the population, such that h ≠ j ≠ k ≠ i. The trade-off between hunting and mating behavior is based on a predefined factor called the tradeoff rate (TR). The particle swarm algorithm is used to select appropriate CR and TR values. The core formula of the particle swarm algorithm is:

[0107]

[0108] Where i is the particle number; k is the number of iterations; ω is the inertia weight; c1 is the individual learning factor; c2 is the group learning factor; r1 and r2 are random numbers in the interval [0, 1] to increase the randomness of the search; represents the d-th dimension velocity vector of particle i in the k-th iteration; represents the d-th dimension position vector of particle i in the k-th iteration; represents the historical optimal position of particle i in the d-th dimension in the k-th iteration; represents the historical optimal position of the dth dimension of the group in the kth iteration; set the target objective function Y = TD (θ wind ), the population size is 100, and the maximum number of iterations is 200; after the particle swarm algorithm optimization, the TR is 0.8 and the CR is 0.6; after the iterative calculation of this algorithm, when the window value is [0,65535], it can be concluded that when the window value is [1820,46768], the number of jump points can be 0, such as Figure 11 As shown in the figure, when a non-optimal window width is used, a jump point is generated. When the window width is optimized to 21038, the jump point generation can be suppressed, as shown in the figure. Figure 10 As shown, the reliability of this method is proved; after the angle value jump point is suppressed by the spider wasp algorithm based on particle swarm, the resolution and accuracy of the encoder are good, and the accuracy error of the magnetic encoder is as follows Figure 12 shown.

[0109] The basic principles, main features, and advantages of the present invention are shown and described above. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are merely illustrative of the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the present invention. The scope of protection claimed in the present invention is defined by the appended claims and their equivalents.

Claims

1. A magnetic encoder jump point suppression method and device based on particle swarm spider wasp algorithm, the structure of the magnetic encoder comprising: (1), a motor spindle (2), a bearing (3), a flange (4), a support plate (5), a multi-pole magnet (6), a magnetic field shielding ring (7), a magnetic conductor (8), a single-pole magnet (9), an encoder signal decomposition board (10), an encoder end cover (11), and a single-chip microcomputer; wherein the encoder signal decomposition board (10) is welded with a direct-insert single-pole Hall a1 (9-1) and a single-pole Hall a2 (9-2), a patch-type multi-pole Hall b1 (9-3) and a multi-pole Hall b2 (9-4), a single-chip microcomputer (11), and a single-pole Hall a1 (9-1) and a single-pole Hall a2 (9-2) The multi-pole Hall b1 (9-3) and the multi-pole Hall b2 (9-4) are placed at 90 degrees on the same circumference, and the magnetizer (7) has a single-pole Hall slot c1 (7-1) and a single-pole Hall slot c2 (7-2), wherein the support plate (4) is glued to the motor main shaft (1), the multi-pole magnetic steel (5) of the axial magnetization method is glued to the support plate (4), the magnetic field shielding ring (6) is glued to the support plate (4), the single-pole magnetic steel (8) of the radial magnetization method is glued to the motor main shaft (1), the magnetizer (2) is glued to the encoder signal solution board (9), the encoder signal solution board (9) is glued to the encoder end cover (10), and the encoder end cover (10) is threadedly connected to the flange (3); Its characteristics are: The specific implementation process of the method is: Step 1: When the motor spindle rotates, the radially magnetized single-pole magnet will generate a radial magnetic field, and the axially magnetized multi-pole magnet will generate an axial magnetic field. Through the magnetic conductor, the single-pole Hall a1 and a2 collect the single-pole angle value signals A+ and A-, and the multi-pole Hall b1 and b2 collect the single-pole angle value signals B+ and B-. The encoder signal solver performs analog-to-digital conversion on the single-pole signals A+ and A- and the multi-pole signals B+ and B- to obtain the single-pole digital signal H A+ 、H A- With the multi-pole digital signal H B+ 、H B- , the single-pole angle value θ1 and the multi-pole angle value θ2 are solved by the inverse tangent algorithm. The solution formula is: Step 2: Sort the multi-pole angle values θ2 in the order of increasing single-pole angle values θ1 to obtain the corresponding relationship between the multi-pole angle values θ2 and the single-pole angle values θ1. The number of pole pairs of the multi-pole magnet used is P. Therefore, in one rotation cycle, when the single-pole angle value θ1 increases from 0 to 65535 once, the multi-pole angle value θ2 changes from 0 to 65535 P times; the single-pole angle value corresponding to the zero point of the multi-pole angle value is z. The zero point calibration of the single-pole and multi-pole angle values is performed using the following formula: i 1_temp =θ1-z where θ 1_temp The new single-pole angle value θ is obtained by calibrating the single-pole angle value θ. 1_new After the multiple pairs of pole angle values are sorted, a limit value, namely the window value θ, is assigned to the multiple pole angle values θ2. wind , the formula is: where θ wind_upper is the upper boundary of the window with multiple pairs of pole angles, θ wind_lower The upper and lower boundaries of the window are divided by 65535 to obtain the number of intervals corresponding to each digital angle. The formula is: Where wind_upper is the number of intervals corresponding to the upper limit of the window, and wind_lower is the number of intervals corresponding to the lower limit of the window. Then re-determine the upper and lower boundary values, the formula is: where θ wind_upper_rem is the newly determined upper limit of the window, θ wind_lower_rem is the newly determined lower limit value of the window; Step 3: The sorted single-pole angle value θ 1_new Divide by 65535, θ 1_new The value range of is changed from [0,65535] to a decimal between [0,1], and then multiplied by the interval length Interval_Length for compression. The compressed data is rounded with the integer function, and the single polar angle value is mapped to the Interval_Length interval. The specific formula is: where θ 1_Interval is the single-pole angle value after compression and rounding, the value range is [0,Interval_Length], Int is the rounding command, the rounding method is: take the integer smaller than the current value and closest to the current value; i is the number of data sampling points, the value is [1,g]; the sequence θ 1_Interval Extract the serial numbers of all the values in and make them into a separate sequence Interval_M; Step 4: Use the data values in the sequence Interval_M as the multi-pole angle value θ2 and the multi-pole angle value θ on the upper limit of the window wind_upper_rem 、Multiple pairs of extreme angle values θ at the lower limit of the window wind_lower_rem Sort the sequence numbers in the array by the formula: where θ 2_tab is the standard multi-pole angle value, θ upper_tab is the upper limit of the standard window, θ lower_tab is the angle value of the multiple poles under the standard window, δ is the number of data in the sequence Interval_M; after completing the above operation, 2_tab ,θ upper_tab ,θ lower_tab Then perform the difference calculation, the formula is as follows: θ 2_tab_error =θ 2_tab (i+1)-θ 2_tab (i) (9)where θ 2_tab_error is the sequence after difference calculation. If the data point in the difference sequence is less than -45000, then the original unbounded multiple pole number θ 2_num Add 1 until the value of the pole pair number is equal to the pole pair number P of the multi-pole magnet. When it is greater than P, the pole pair number is 1. upper_tab ,θ lower_tab Perform the same process to obtain the number of pole pairs on the upper limit of the window θ wind_upper_num , the number of pole pairs under the window is θ wind_lower_num ; Step 5: Arrange the three sets of multiple pole pairs. If θ wind_upper_num (i)>θ 2_num (i) and θ2(i)<4096, then θ 2_num (i) Add 1; if θ 2_num (i)>θ wind_lower_num (i) and θ2(i)>61440, then θ 2_num (i) minus 1; if θ 2_num (i)-θ wind_upper_num (i)=1 and θ2(i)>61440, then θ 2_num (i) Subtract 1; for multiple pairs of pole angle values, the formula is: θ 2_new =(P-1)×65535+θ2 (10)θ 2_new is the angle value of multiple pairs of poles after subdivision, P is the pole number sequence obtained in step 4, and its value is [1,16]. 2_new For differential calculation, take the absolute value of the differential value and define the data point with an absolute value greater than 45,000 as a jump point; Step 6: Define the function: Y=TD(θ wind )(11) Where Y is the number of jump points recorded, TD is the function of the execution process from step 2 to step 5, θ wind is the determined window value; the main process of the spider wasp algorithm is hunting and nesting behavior. Its hunting process mainly consists of three stages: searching, following and escaping. Its search process is as follows: in is the set of solutions; t is the index, i is a natural number between 0 and N; μ1 represents the specified moving direction; a and b are two randomly selected indices in the population, used to specify the direction; r1 is a random number between the interval [0, 1]; rn is a random number that satisfies the normal distribution; the following stage is as follows: where c is a randomly selected index in the population; t and t max Indicates the current index and maximum index; r5 and r6 are randomly generated values between [0, 1]; the escape stage is as follows: in is a vector generated between k and -k according to the normal distribution; after the hunting phase is completed, the nesting phase begins, and the formula is as follows: in represents the best solution so far; wasps mate to produce offspring, and the offspring produced after mating are the optional solutions, and the formula is: Where Crossover represents the uniform crossover operator and CR represents the crossover rate; and There are two types of female and male spider wasps; male spider wasps spawn as follows: Where β and β1 are randomly generated values from a normal distribution, e is an exponential constant, and l is a randomly generated number in the interval [1, -2]. h, j, and k are the exponentials of three solutions randomly selected from the population, such that h ≠ j ≠ k ≠ i. The trade-off between hunting and mating behavior is based on a predefined factor called the tradeoff rate (TR). The particle swarm algorithm is used to select appropriate CR and TR values. The core formula of the particle swarm algorithm is: Where i is the particle number; k is the number of iterations; ω is the inertia weight; c1 is the individual learning factor; c2 is the group learning factor; r1 and r2 are random numbers in the interval [0, 1] to increase the randomness of the search; represents the d-th dimension velocity vector of particle i in the k-th iteration; represents the d-th dimension position vector of particle i in the k-th iteration; represents the historical optimal position of particle i in the d-th dimension in the k-th iteration; Represents the historical optimal position of the d-th dimension of the group in the k-th iteration; after iterative calculation by this algorithm, the window value θ that satisfies the number of jump points of 0 can be accurately found wind .