Search

CN-115979324-B - Nonlinear calibration method and device for magnetic encoder

CN115979324BCN 115979324 BCN115979324 BCN 115979324BCN-115979324-B

Abstract

The invention discloses a nonlinear calibration method and device of a magnetic encoder. The method comprises the steps of setting a plurality of inflection points on an angle curve graph formed based on an angle scanning result to divide an angle period into a plurality of angle curve segments, wherein each angle curve segment is approximately a first-order curve, obtaining a compensation coefficient of each angle curve segment, obtaining an angle output threshold of each angle curve segment, starting calibration after detecting a data valid signal, and obtaining a calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold according to an input angle. The invention divides a complete angle period into a plurality of angle curve segments by arranging a plurality of inflection points, each angle curve segment is approximate to a first-order curve, the slope of each angle curve segment is approximate to 1 by a compensation coefficient, and a target output angle matched with an angle measurement value of an angle measuring instrument is obtained after calibration, thereby simplifying a compensation algorithm and reducing resource consumption.

Inventors

  • HUANG XU

Assignees

  • 上海兴感半导体有限公司

Dates

Publication Date
20260512
Application Date
20221229

Claims (9)

  1. 1. A nonlinear calibration method of a magnetic encoder is characterized by comprising the steps of setting a plurality of inflection points on an angle graph formed based on an angle scanning result to divide an angle period into a plurality of angle curve segments, wherein each angle curve segment is approximately a first-order curve, obtaining a compensation coefficient of each angle curve segment, obtaining the compensation coefficient of each angle curve segment further comprises the steps of taking the reciprocal of a slope of a connecting line between two end points of the angle curve segment, obtaining a trimming coefficient corresponding to the angle curve segment, obtaining a difference value between the trimming coefficient and 1 as the compensation coefficient, obtaining an angle output threshold value of each angle curve segment, starting calibration after detecting a data valid signal, and obtaining a calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold value according to an input angle.
  2. 2. The method of claim 1, wherein the angle graph is formed by plotting a plurality of angle scan results, and wherein the inflection point is set with an angle measurement value of an angle measurement instrument as an angle standard and written into a register.
  3. 3. The method of claim 1 further comprising writing the compensation coefficient into a register after digital codeword conversion, wherein if the compensation coefficient is positive, digital codeword conversion is performed by coeff_code 20479, and if the compensation coefficient is negative, digital codeword conversion is performed by 8192- |coeff_code| 20479, wherein coeff_code is the compensation coefficient.
  4. 4. The method of claim 1, wherein the step of obtaining the angular output threshold value for each angular curve segment further comprises calculating the angular output threshold value using the formula current threshold value= (current inflection point-previous inflection point)/current compensation factor + previous threshold value.
  5. 5. The method of claim 1, wherein the step of obtaining the calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold according to the input angle further comprises matching a target angle output threshold, a target inflection point and a target compensation coefficient based on the input angle, obtaining an angle change based on a difference between the input angle and the target angle output threshold, obtaining a target trimming coefficient based on the target compensation coefficient, and obtaining the target output angle based on the angle change and the target trimming coefficient.
  6. 6. The method of claim 5, wherein the step of obtaining the calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold according to the input angle further comprises obtaining the target output angle using a calculation formula of target output angle= (input angle-target angle output threshold)/(1+ target compensation coefficient) +target inflection point.
  7. 7. The method of claim 1, further comprising delaying the target output angle by a register by a predetermined number of clock cycles before outputting.
  8. 8. A nonlinear calibration device of a magnetic encoder is characterized by comprising a setting module, a first acquisition module, a second acquisition module and a calibration module, wherein the setting module is used for setting a plurality of inflection points on an angle graph formed based on an angle scanning result to divide an angle period into a plurality of angle curve segments, each angle curve segment is approximately a first-order curve, the first acquisition module is used for acquiring a compensation coefficient of each angle curve segment, the first acquisition module is used for taking the reciprocal of a slope of a connecting line between two end points of the angle curve segment, acquiring a trimming coefficient corresponding to the angle curve segment, and acquiring a difference value between the trimming coefficient and 1 as the compensation coefficient, the second acquisition module is used for acquiring an angle output threshold value of each angle curve segment, and the calibration module is used for starting calibration after detecting a data valid signal, and acquiring a calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold value according to an input angle.
  9. 9. The apparatus of claim 8, further comprising a register to store the inflection point, the compensation coefficient, and to delay the target output angle by a predetermined number of clock cycles for output.

Description

Nonlinear calibration method and device for magnetic encoder Technical Field The present invention relates to the field of magnetic encoders, and in particular, to a method and apparatus for nonlinear calibration of a magnetic encoder. Background Due to limitations of the manufacturing process and deviations of the system itself, there is a certain deviation between the measured angle of the magnetic encoder and the actual value, which is called a nonlinear error. The effect of such deviations is negligible for systems with low accuracy requirements, but needs to be minimized for high accuracy devices with servo motor control systems. There is therefore a need for a compensation algorithm suitable for use in a magnetic encoder to reduce such linear errors. Common compensation algorithms in the prior art are interpolation, least square, neural network compensation and look-up tables. Although the above-described compensation scheme can reduce the linearity error, the implementation is too cumbersome, and there is a problem in that resources are extremely consumed or a huge amount of effort is consumed. Disclosure of Invention The invention aims to provide a nonlinear calibration method and a nonlinear calibration device for a magnetic encoder, which simplify a compensation algorithm and reduce resource consumption, so as to solve the technical problems of extremely consuming resources or consuming huge calculation power in the existing compensation algorithm for the magnetic encoder. In order to achieve the above purpose, the invention provides a nonlinear calibration method of a magnetic encoder, which comprises the steps of setting a plurality of inflection points on an angle graph formed based on an angle scanning result to divide an angle period into a plurality of angle curve segments, wherein each angle curve segment approximates to a first order curve, acquiring a compensation coefficient of each angle curve segment, acquiring an angle output threshold value of each angle curve segment, starting calibration after detecting a data valid signal, and acquiring a calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold value according to an input angle. In order to achieve the above purpose, the invention also provides a nonlinear calibration device of a magnetic encoder, which comprises a setting module, a first acquisition module, a second acquisition module and a calibration module, wherein the setting module is used for setting a plurality of inflection points on an angle curve graph formed based on an angle scanning result to divide an angle period into a plurality of angle curve segments, each angle curve segment approximates to a first-order curve, the first acquisition module is used for acquiring a compensation coefficient of each angle curve segment, the second acquisition module is used for acquiring an angle output threshold value of each angle curve segment, and the calibration module is used for starting calibration after detecting a data valid signal, and acquiring a calibrated target output angle based on the corresponding compensation coefficient and the angle output threshold value according to an input angle. The invention divides a complete angle period into a plurality of angle curve segments by arranging a plurality of inflection points, each angle curve segment is approximate to a first-order curve, the slope of each angle curve segment is approximate to 1 by a compensation coefficient, and a target output angle matched with an angle measurement value of an angle measuring instrument is obtained after calibration, thereby simplifying a compensation algorithm and reducing resource consumption. Drawings FIG. 1 is a flow chart of a method for nonlinear calibration of a magnetic encoder according to an embodiment of the present invention; FIG. 2 is a schematic diagram of an inflection point setup according to an embodiment of the present invention; FIG. 3 is a schematic diagram of a nonlinear calibration apparatus of a magnetic encoder according to an embodiment of the present invention. Detailed Description The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention. Fig. 1 is a flowchart of a method for calibrating nonlinearity of a magnetic encoder according to an embodiment of the invention. The method of the embodiment comprises the following steps of S1, setting a plurality of inflection points on an angle curve graph formed based on an angle scanning result to divide an angle period into a plurality of angle curve segme