CN-121994281-A - Harmonic compensation method for angle error of magnetic encoder
Abstract
The embodiment of the invention discloses a harmonic compensation method for angle errors of a magnetic encoder, which comprises the steps of in a setting mode, uniformly rotating the magnetic encoder, collecting sine and cosine signals output by the magnetic encoder, obtaining an initial angle sequence containing fundamental waves and harmonic errors through CORDIC (coordinated rotation digital computer) calculation, extracting harmonic components through a self-adaptive wave trap, constructing a harmonic compensation polynomial, and storing various coefficients, in an application mode, collecting the magnetic encoder signals in real time, calculating a current initial angle value, calculating a harmonic compensation quantity according to the current fundamental wave angle frequency and the stored coefficients, and subtracting the compensation quantity from the initial angle value to obtain an accurate angle value. The invention directly eliminates each subharmonic error through the harmonic compensation polynomial without external reference signals and a large amount of storage space, avoids the approximation error caused by the traditional linear interpolation, and improves the compensation precision by only increasing the polynomial term number without obviously increasing the storage requirement.
Inventors
- ZHANG LIANG
- XIANG CHEN
Assignees
- 昂赛微电子(上海)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260410
Claims (10)
- 1. A method for harmonic compensation of angular errors of a magnetic encoder, the method comprising: In a constant-speed rotation state of the magnetic encoder, acquiring a sine signal and a cosine signal output by the magnetic encoder, and obtaining an initial angle sequence containing fundamental wave and each subharmonic error through a CORDIC algorithm; Carrying out harmonic analysis on the initial angle sequence, extracting the amplitude of each subharmonic component, and constructing a harmonic compensation polynomial; Storing coefficients of the harmonic compensation polynomial; in the actual angle measurement process, acquiring sine signals and cosine signals output by a magnetic encoder in real time, and obtaining an initial angle value at the current moment through a CORDIC algorithm; Calculating harmonic compensation quantity according to the fundamental wave angular frequency at the current moment and the stored harmonic compensation polynomial coefficient; and subtracting the harmonic compensation amount from the initial angle value to obtain a compensated accurate angle value.
- 2. A method of harmonic compensation of angular errors of a magnetic encoder as claimed in claim 1 wherein the performing harmonic analysis on the initial angular sequence, extracting magnitudes of harmonic components therein, and constructing a harmonic compensation polynomial comprises: and filtering the initial angle sequence by adopting an adaptive wave trap, extracting fundamental wave and each subharmonic component, and obtaining the amplitude of each subharmonic.
- 3. A method of harmonic compensation of angular errors of a magnetic encoder as claimed in claim 2 wherein the centre frequency of the adaptive notch filter tracks the variation of the fundamental angular frequency.
- 4. A method for harmonic compensation of angular errors in a magnetic encoder as claimed in claim 1, wherein the harmonic compensation polynomial has a harmonic order in the range of 2 to 8.
- 5. A method of harmonic compensation of angular errors of a magnetic encoder as defined in claim 1 wherein the initial angular sequence is subjected to harmonic analysis, the magnitudes of the sub-harmonic components thereof are extracted, and a harmonic compensation polynomial is constructed, further comprising: And acquiring initial angle sequences of a plurality of periods in a uniform rotation state, and obtaining the amplitude of each subharmonic through Fourier transformation or an adaptive wave trap.
- 6. A method for harmonic compensation of angular errors of a magnetic encoder as claimed in claim 1, wherein calculating the harmonic compensation amount based on the fundamental angular frequency at the current time and the stored harmonic compensation coefficient comprises: The fundamental angular frequency is determined in real time by measuring the current rotational speed of the magnetic encoder.
- 7. A method for harmonic compensation of angular errors of a magnetic encoder as claimed in claim 1, wherein the magnetic encoder is an AMR magnetoresistive encoder whose two sets of output sine and cosine signals are 45 degrees out of phase.
- 8. A method for harmonic compensation of angular errors of a magnetic encoder as claimed in claim 1, wherein the CORDIC algorithm converts rectangular coordinates into polar coordinates by means of iterative rotation, thereby solving for the initial angular value.
- 9. A method for harmonic compensation of angular errors of a magnetic encoder as defined in claim 1 wherein the constructed harmonic compensation polynomial comprises only cosine terms.
- 10. A method for harmonic compensation of angular errors of a magnetic encoder as claimed in claim 1 wherein the number of terms of the harmonic compensation polynomial is increased when an increase in compensation accuracy is required.
Description
Harmonic compensation method for angle error of magnetic encoder Technical Field The invention relates to the technical field of magneto-electric encoders, in particular to a harmonic compensation method for angle errors of a magnetic encoder. Background The magneto-electric encoder is an angle measuring sensor widely applied to the fields of industrial automation, robots, automobile electronics and the like, and the basic principle is that a magnetic sensor chip senses a changing magnetic field generated when a rotor rotates, converts the changing magnetic field into an analog sine and cosine signal to be output, and then obtains the accurate position information of the rotor through analog-digital conversion and decoding calculation. Compared with a photoelectric encoder, the magnetic encoder has the advantages of strong pollution resistance, high response speed, low cost and the like, but has relatively low precision, and the high-precision application requirement can be met by error compensation. Currently, the main methods of angle error compensation of magnetic encoders are mainly classified into the following categories: 1. Compensation method based on table lookup and linear interpolation This is the most widely used conventional compensation method at present. The method comprises the basic steps of selecting N reference points in a range of 0-360 degrees in a uniform step length mode, measuring angle errors of each reference point through high-precision reference equipment, establishing an error compensation table, and calculating a compensation value of a current angle through linear interpolation when an actual detection angle is located between the two reference points, so that error correction is achieved. However, the method has inherent limitations that firstly, the compensation precision is in direct proportion to the number of reference points, more calibration points are required to be acquired for improving the precision, so that the storage space requirement is greatly increased, secondly, compensation data between the two points can only be obtained through linear approximation, interpolation errors are introduced, thirdly, each compensation operation involves multiplication and division, more time is consumed through a digital circuit, the operation efficiency is low, and fourthly, the method cannot effectively compensate harmonic drift caused by temperature change. 2. Harmonic compensation method based on Fourier transform In order to overcome the limitation of the table lookup method, researchers have proposed a compensation method based on harmonic analysis. Patent CN117516596A published by Huazhong university of science and technology proposes an online compensation scheme, wherein a plurality of points are sampled when a motor rotor rotates for one circle, harmonic components are obtained through FFT calculation, harmonic in X, Y channel signals is removed, orthogonality correction is carried out, and harmonic parameters can be updated iteratively to realize online temperature compensation. The method can adapt to harmonic drift caused by temperature change, but needs FFT operation in each circle, and has higher calculation complexity. 3. Compensation method based on specified subharmonic extraction The sine and cosine signals of the magnetic encoder are subjected to coordinate transformation by utilizing a double synchronous rotation coordinate system, harmonic components with specified times are extracted through a forward and reverse decoupling network, and then fed back to the original signals for subtraction to form closed loop compensation. The method can accurately compensate for specific times of harmonic waves, but the system structure is complex, and multiple coordinate transformation and decoupling operations are involved. 4. Intelligent compensation method based on machine learning and deep learning In recent years, researchers have attempted to introduce artificial intelligence techniques into the field of magnetic encoder error compensation. The learner puts forward a hybrid prediction model based on an improved deep belief network, combines a variation modal decomposition feature engineering and a particle swarm optimization algorithm, introduces temperature into a prediction feature sequence, effectively reduces the interference of errors on a prediction result through the feature engineering, and improves the precision from 0.22 degrees to 0.0025 degrees. Such methods have high compensation accuracy, but require a large amount of training data and higher computing resources, and are difficult to deploy in resource-constrained embedded systems. 5. Real-time tracking compensation method based on phase-locked loop Aiming at dynamic errors under the working condition of variable rotating speed, a scholars propose an angle calculation method based on a high-order phase-locked loop, noise and harmonic influence in orthogonal signals are removed through a self-adaptive