Absolute electrical angle detection method, system and computer readable storage medium

文档序号:1533050 发布日期:2020-02-14 浏览:25次 中文

阅读说明:本技术 绝对电角度检测方法、系统及计算机可读存储介质 (Absolute electrical angle detection method, system and computer readable storage medium ) 是由 毕超 龙财 毕磊 于 2019-12-23 设计创作,主要内容包括:本发明公开了一种绝对电角度检测方法、系统及计算机可读存储介质,该方法包括:获取与第一方向磁分量对应的角度正弦信号和与第二方向磁分量对应的角度余弦信号;根据角度正弦信号、角度余弦信号和定标补偿公式计算定标补偿正弦信号和定标补偿余弦信号;确定定标补偿正弦信号和定标补偿余弦信号对应的角度区间,并根据角度区间对应的预设三角函数计算被测磁钢的相对电角度值;获取霍尔传感器检测的霍尔信号,并根据霍尔信号确定磁编码器的极性位置;根据相对电角度值和极性位置,计算获得绝对电角度。本发明通过定标补偿公式对磁编码器检测的信号进行修正,避免偏置误差和高次谐波的影响,从而提高计算得到的相对电角度和绝对电角度的精确度。(The invention discloses an absolute electrical angle detection method, a system and a computer readable storage medium, wherein the method comprises the following steps: acquiring an angle sine signal corresponding to the first direction magnetic component and an angle cosine signal corresponding to the second direction magnetic component; calculating a calibration compensation sine signal and a calibration compensation cosine signal according to the angle sine signal, the angle cosine signal and a calibration compensation formula; determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating a relative electric angle value of the measured magnetic steel according to a preset trigonometric function corresponding to the angle interval; acquiring Hall signals detected by a Hall sensor, and determining the polarity position of a magnetic encoder according to the Hall signals; and calculating to obtain an absolute electrical angle according to the relative electrical angle value and the polarity position. The invention corrects the signal detected by the magnetic encoder through the calibration compensation formula, avoids the influence of offset error and higher harmonic, and improves the accuracy of the calculated relative electrical angle and absolute electrical angle.)

1. The method for detecting the absolute electric angle of the magnetic encoder is characterized by comprising a magnetic resistance sensor for detecting a magnetic component in a first direction and a Hall sensor for detecting a magnetic component in a second direction and a polar position, or comprising a magnetic resistance sensor for detecting a magnetic component in the first direction and a magnetic component in the second direction and a Hall sensor for detecting a polar position, wherein the directions of the magnetic component in the first direction and the magnetic component in the second direction are vertical; the method for detecting the absolute electrical angle comprises the following steps:

acquiring an angle sine signal corresponding to the first direction magnetic component and an angle cosine signal corresponding to the second direction magnetic component;

calculating a calibration compensation sine signal and a calibration compensation cosine signal according to the angle sine signal, the angle cosine signal and a calibration compensation formula;

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating a relative electric angle value of the measured magnetic steel according to a preset trigonometric function corresponding to the angle interval;

acquiring a Hall signal detected by the Hall sensor, and determining the polarity position of the magnetic encoder according to the Hall signal;

calculating to obtain an absolute electrical angle according to the relative electrical angle value and the polarity position; wherein, the calibration compensation formula is as follows:

Figure 70094DEST_PATH_IMAGE001

in the formula, Vsc(theta) compensating the sinusoidal signal for scaling, Vcc(theta) is the scaled cosine compensation signal, Vs(theta) is an angle sinusoidal signal, Vc(theta) is an angle cosine signal, Vs0For presetting the offset error of the sinusoidal signal, Vc0For presetting the offset error, V, of the cosine signals1For harmonic amplitude compensation of a predetermined sinusoidal signal, Vc1For the harmonic amplitude compensation of the predetermined cosine signal.

2. The absolute electric angle detection method according to claim 1, wherein the step of acquiring an angle sine signal corresponding to the first-direction magnetic component and an angle cosine signal corresponding to the second-direction magnetic component further comprises:

acquiring periodic voltage signals of the measured magnetic steel rotating for one circle, wherein the periodic voltage signals comprise preset standard sine signals corresponding to the first direction magnetic components and preset standard cosine signals corresponding to the second direction magnetic components;

substituting the periodic voltage signal into a bias error calculation formula and a harmonic amplitude compensation calculation formula to obtain the bias error and the harmonic amplitude compensation of the voltage signal, and respectively storing the bias error and the harmonic amplitude compensation as the bias error V of a preset sinusoidal signals0Presetting the offset error V of the cosine signalc0Harmonic amplitude compensation V of the preset sinusoidal signalsnThe harmonic amplitude compensation V of the cosine signal is presetcn

The offset error calculation formula is as follows:

Figure 510433DEST_PATH_IMAGE002

the harmonic amplitude compensation calculation formula is as follows:

Figure 690879DEST_PATH_IMAGE003

wherein N is the period number of the signal, N is the nth harmonic, theta is the relative electrical angle of the measured magnetic steel, Vs0For presetting the offset error of the sinusoidal signal, Vc0For presetting the offset error, V, of the cosine signals(theta) is a predetermined target sinusoidal signal of the periodic voltage signal, Vc(theta) is a scaled cosine signal of the periodic voltage signal, VsnHarmonic amplitude compensation, V, for the nth preset sinusoidal signalcnAnd compensating the harmonic amplitude of the nth preset cosine signal.

3. The absolute electrical angle detection method of claim 2, wherein the step of determining the angle intervals corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating the relative electrical angle value of the magnetic steel to be detected according to the preset trigonometric function corresponding to the angle intervals comprises:

judging whether the angles corresponding to the calibration compensation sine signal and the calibration compensation cosine signal are within a preset angle interval, wherein the preset angle interval is-45 degrees to 45 degrees and 135 degrees to 225 degrees;

if the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is within the preset angle interval, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

Figure 149542DEST_PATH_IMAGE004

if the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is not within the preset angle interval, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

Figure 491662DEST_PATH_IMAGE005

wherein, theta is the relative electrical angle of the tested magnetic steel; vsc (theta) is a scaled compensated sine signal, and Vcc (theta) is a scaled cosine compensated signal.

4. The absolute electrical angle detection method of claim 2, wherein the step of determining the angle intervals corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating the relative electrical angle value of the magnetic steel to be detected according to the preset trigonometric function corresponding to the angle intervals comprises:

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal;

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (-45 degrees and 45 degrees), iteratively calculating the iterative electric angle value of the measured magnetic steel according to the following formula:

Figure 419298DEST_PATH_IMAGE006

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (45 degrees, 135 degrees) ], iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 137855DEST_PATH_IMAGE007

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (135 degrees, 225 degrees), iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (225 degrees, 315 degrees'), iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 291942DEST_PATH_IMAGE009

when the relative electrical angle or the iteration times meet the preset iteration rule, setting the iteration electrical angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained;

wherein theta is the relative electrical angle of the measured magnetic steel calculated in the nth iteration; thetan+1The relative electrical angle of the measured magnetic steel is calculated for the (n + 1) th iteration; vsc(theta) compensating the sinusoidal signal for scaling, Vcc(θ) is the scaled cosine compensation signal; k1、K2、K3、K4、L1、L2、L3、L4、L5And L6Is a preset constant.

5. The absolute electrical angle detection method of claim 4, wherein the preset constant K is set to be constant1、K2、K3、K4、L1、L2、L3、L4、L5And L6Respectively calculated by the following formula:

Figure 831508DEST_PATH_IMAGE010

Figure 229122DEST_PATH_IMAGE011

Figure 272164DEST_PATH_IMAGE012

Figure 107582DEST_PATH_IMAGE014

Figure 308887DEST_PATH_IMAGE015

Figure 389156DEST_PATH_IMAGE017

Figure 27948DEST_PATH_IMAGE018

Figure 784999DEST_PATH_IMAGE020

Figure 341883DEST_PATH_IMAGE021

Figure 202391DEST_PATH_IMAGE022

Figure 870133DEST_PATH_IMAGE023

Figure 617640DEST_PATH_IMAGE024

Figure 693229DEST_PATH_IMAGE026

Figure 399783DEST_PATH_IMAGE029

Figure 969304DEST_PATH_IMAGE030

Figure 887899DEST_PATH_IMAGE032

Figure 776755DEST_PATH_IMAGE034

6. the absolute electrical angle detection method of claim 4, wherein the iterative electrical angle value θ is set when the iterative electrical angle or the number of iterations meets a preset iteration rulen+1The step of measuring the relative electric angle value of the magnetic steel comprises the following steps:

determining an iterative electrical angle θn+1And an iterative electrical angle thetanWhether the difference value of (a) is less than a first preset threshold value;

if the electrical angle theta is iteratedn+1And an iterative electrical angle thetanIs less than the first preset threshold value, an iterative electrical angle value theta is setn+1The relative electric angle value of the measured magnetic steel is obtained.

7. The absolute electrical angle detection method of claim 4, wherein the iterative electrical angle value θ is set when the iterative electrical angle or the number of iterations meets a preset iteration rulen+1The step of measuring the relative electric angle value of the magnetic steel comprises the following steps:

judging whether the iteration number n +1 is equal to a second preset threshold value or not;

if the iteration times are equal to a second preset threshold value, setting an iteration electric angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained.

8. The absolute electrical angle detection method according to any one of claims 1 to 7, wherein the step of obtaining an absolute electrical angle by calculation based on the relative electrical angle value and the polar position comprises:

if the polar position is that the magnetic encoder is positioned on the N pole side of the measured magnetic steel, calculating according to a first angle calculation formula to obtain an absolute electrical angle;

if the polar position is that the magnetic encoder is positioned on the S pole side of the measured magnetic steel, calculating according to a second angle calculation formula to obtain an absolute electrical angle; wherein the first angle calculation formula is: θ = θcAnd/2, the second angle calculation formula is as follows: θ = θc2+180 DEG theta is the absolute electrical angle thetacIs a relative electrical angle value.

9. An absolute electric angle detection system is characterized by comprising a magnetic encoder and a control device, wherein the magnetic encoder comprises a magnetic resistance sensor for detecting a magnetic component in a first direction and a Hall sensor for detecting a magnetic component in a second direction and a polar position, or comprises a magnetic resistance sensor for detecting a magnetic component in the first direction and a magnetic component in the second direction and a Hall sensor for detecting a polar position, and the directions of the magnetic components in the first direction and the magnetic components in the second direction are vertical; the control device comprises a processor, a memory, and an absolute electrical angle detection program stored on the memory and executable by the processor, wherein the absolute electrical angle detection program, when executed by the processor, implements the steps of the absolute electrical angle detection method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon an absolute electrical angle detection program, wherein the absolute electrical angle detection program, when executed by a processor, implements the steps of the absolute electrical angle detection method according to any one of claims 1 to 8.

Technical Field

The invention relates to the technical field of electromagnetic structures and signal processing, in particular to a magnetic encoder, an absolute electrical angle detection method, an absolute electrical angle detection system and a readable storage medium.

Background

Currently, magnetic encoders for angular position detection using a magnetoresistive sensor chip (MR) and an anisotropic magnetoresistive sensor chip (AMR) have been used in various control systems, which detect a magnetic field component of a measured rotating magnetic field in a tangential-axial plane, or a tangential-radial plane, or a radial-axial plane, and output a voltage signal. However, since the MR and AMR magnetoresistive sensors are sensitive only to the magnitude of the magnetic field and not to its polarity, when the magnetic field of the measured magnetic steel is rotated by 360 ° in electrical angle, i.e. the magnetic field is subjected to a periodic variation, the output signal of the magnetoresistive sensor has two periodic variations. Therefore, such a signal of the magnetoresistive sensor is not an absolute electrical angle signal of the measured magnetic field, that is, the existing magnetic encoder cannot measure the absolute electrical angle of the measured magnetic steel.

Disclosure of Invention

The invention mainly aims to provide a magnetic encoder, an absolute electrical angle detection method, an absolute electrical angle detection system and a readable storage medium, and aims to solve the problem that the existing magnetic encoder cannot accurately measure the absolute electrical angle of the measured magnetic steel.

In order to achieve the above object, the present invention provides a method for detecting an absolute electrical angle of a magnetic encoder, the magnetic encoder includes a magnetoresistive sensor for detecting a first-direction magnetic component, and a hall sensor for detecting a second-direction magnetic component and a polar position, or includes a magnetoresistive sensor for detecting a first-direction magnetic component and a second-direction magnetic component, and a hall sensor for detecting a polar position, the first-direction magnetic component and the second-direction magnetic component are perpendicular to each other; the method for detecting the absolute electrical angle comprises the following steps:

acquiring an angle sine signal corresponding to the first direction magnetic component and an angle cosine signal corresponding to the second direction magnetic component;

calculating a calibration compensation sine signal and a calibration compensation cosine signal according to the angle sine signal, the angle cosine signal and a calibration compensation formula;

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating a relative electric angle value of the measured magnetic steel according to a preset trigonometric function corresponding to the angle interval;

acquiring a Hall signal detected by the Hall sensor, and determining the polarity position of the magnetic encoder according to the Hall signal;

and calculating to obtain an absolute electrical angle according to the relative electrical angle value and the polarity position.

Preferably, the step of acquiring an angle sine signal corresponding to the first-direction magnetic component and an angle cosine signal corresponding to the second-direction magnetic component further includes:

acquiring periodic voltage signals of the measured magnetic steel rotating for one circle, wherein the periodic voltage signals comprise preset standard sine signals corresponding to the first direction magnetic components and preset standard cosine signals corresponding to the second direction magnetic components;

substituting the periodic voltage signal into a bias error calculation formula and a harmonic amplitude compensation calculation formula to obtain the bias error and the harmonic amplitude compensation of the voltage signal, and respectively storing the bias error and the harmonic amplitude compensation as the bias error V of a preset sinusoidal signals0Presetting the offset error V of the cosine signalc0Harmonic amplitude compensation V of the preset sinusoidal signalsnThe harmonic amplitude compensation V of the cosine signal is presetcn

Preferably, the step of determining the angle intervals corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating the relative electric angle value of the measured magnetic steel according to the preset trigonometric function corresponding to the angle intervals includes:

judging whether the angles corresponding to the calibration compensation sine signal and the calibration compensation cosine signal are within a preset angle interval, wherein the preset angle interval is-45 degrees to 45 degrees and 135 degrees to 225 degrees;

if the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is within the preset angle interval, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

Figure 851391DEST_PATH_IMAGE001

if the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is not within the preset angle interval, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

wherein, theta is the relative electrical angle of the tested magnetic steel; vsc (theta) is a scaled compensated sine signal, and Vcc (theta) is a scaled cosine compensated signal.

Preferably, the step of determining the angle intervals corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating the relative electric angle value of the measured magnetic steel according to the preset trigonometric function corresponding to the angle intervals includes:

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal;

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (-45 degrees and 45 degrees), iteratively calculating the iterative electric angle value of the measured magnetic steel according to the following formula:

Figure 282689DEST_PATH_IMAGE003

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (45 degrees, 135 degrees) ], iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (135 degrees, 225 degrees), iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 39741DEST_PATH_IMAGE005

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is (225 degrees, 315 degrees'), iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

when the relative electrical angle or the iteration times meet the preset iteration rule, setting the iteration electrical angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained;

wherein theta is the relative electrical angle of the measured magnetic steel calculated in the nth iteration; thetan+1The relative electrical angle of the measured magnetic steel is calculated for the (n + 1) th iteration; vsc(theta) compensating the sinusoidal signal for scaling, Vcc(θ) is the scaled cosine compensation signal; k1、K2、K3、K4、L1、L2、L3、L4、L5And L6Is a preset constant.

Preferably, when the iteration electrical angle or the iteration times meet a preset iteration rule, the iteration electrical angle value theta is setn+1The step of measuring the relative electric angle value of the magnetic steel comprises the following steps:

determining an iterative electrical angle θn+1And an iterative electrical angle thetanWhether the difference value of (a) is less than a first preset threshold value;

if the electrical angle theta is iteratedn+1And an iterative electrical angle thetanIs less than the first preset threshold value, an iterative electrical angle value theta is setn+1The relative electric angle value of the measured magnetic steel is obtained.

Preferably, when the iteration electrical angle or the iteration times meet a preset iteration rule, the iteration electrical angle value theta is setn+1The step of measuring the relative electric angle value of the magnetic steel comprises the following steps:

judging whether the iteration number n +1 is equal to a second preset threshold value or not;

if the iteration times are equal to a second preset threshold value, setting an iteration electric angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained.

Preferably, the step of calculating an absolute electrical angle according to the relative electrical angle value and the polarity position includes:

if the polar position is that the magnetic encoder is positioned on the N pole side of the measured magnetic steel, calculating according to a first angle calculation formula to obtain an absolute electrical angle;

and if the polar position is that the magnetic encoder is positioned on the S pole side of the measured magnetic steel, calculating according to a second angle calculation formula to obtain an absolute electrical angle. Wherein the first angle calculation formula is: θ = θcAnd/2, the second angle calculation formula is as follows: θ = θc2+180 DEG theta is the absolute electrical angle thetacIs a relative electrical angle value.

The invention also provides an absolute electric angle detection system, which comprises a magnetic encoder and a control device, wherein the magnetic encoder comprises a magnetic resistance sensor for detecting a magnetic component in a first direction and a Hall sensor for detecting a magnetic component in a second direction and a polar position, or comprises a magnetic resistance sensor for detecting a magnetic component in the first direction and a magnetic component in the second direction and a Hall sensor for detecting a polar position, and the directions of the magnetic components in the first direction and the magnetic components in the second direction are vertical; the control device comprises a processor, a memory, and an absolute electrical angle detection program stored on the memory and executable by the processor, wherein the steps of the absolute electrical angle detection method as described above are implemented when the absolute electrical angle detection program is executed by the processor.

The present invention also provides a computer-readable storage medium having an absolute electrical angle detection program stored thereon, wherein the absolute electrical angle detection program, when executed by a processor, implements the steps of the absolute electrical angle detection method as described above.

In the technical scheme of the invention, the signals detected by the magnetic encoder are corrected by a calibration compensation formula, so that the influence of offset errors and higher harmonics is avoided, and the calculated relative electric angle and absolute electric angle are improved; through setting up hall sensor to can differentiate magnetic encoder and face the N utmost point or the S utmost point of magnet steel that awaits measuring, calculate the absolute electrical angle who reachs the magnet steel that is surveyed.

Drawings

FIG. 1 is a schematic flow chart of a first embodiment of a method for detecting an absolute electrical angle according to the present invention;

FIG. 2 is a partial schematic flow chart of a second embodiment of the absolute electrical angle detection method according to the present invention;

fig. 3 is a schematic diagram of a hardware configuration of a system according to an embodiment of the present invention;

fig. 4 is a schematic diagram of a detection state of the magnetic encoder and the magnetic steel to be detected in an embodiment of the present invention.

The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.

Detailed Description

It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

The absolute electrical angle detection method is mainly applied to an absolute electrical angle test system and used for detecting the absolute electrical angle of rotor magnetic steel, and the absolute electrical angle test system comprises a magnetic encoder, a system controller and a memory.

Referring to fig. 3, fig. 3 is a schematic structural diagram of a system according to an embodiment of the present invention. In an embodiment of the present invention, the controller may include a processor 1001 (e.g., a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used for realizing connection communication among the components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface); the memory 1005 may be a high-speed RAM memory, or may be a non-volatile memory (e.g., a magnetic disk memory), and optionally, the memory 1005 may be a storage device independent of the processor 1001.

The magnetic encoder comprises a magnetic resistance sensor for detecting a first direction magnetic component and a Hall sensor for detecting a second direction magnetic component and a polar position, or comprises a magnetic resistance sensor for detecting a first direction magnetic component and a second direction magnetic component and a Hall sensor for detecting a polar position, and the directions of the first direction magnetic component and the second direction magnetic component are vertical.

In one embodiment, the magnetic encoder includes a magnetoresistive sensor and a hall sensor, wherein the magnetoresistive sensor is an MR sensor or an AMR sensor for detecting a single direction, and the magnetoresistive sensor is a planar component. The quantity of the magnetic resistance sensors is two, one magnetic resistance sensor only measures the magnetic component in one direction, and the two magnetic resistance sensors respectively measure the magnetic components in two orthogonal directions, so that the magnetic encoder can realize the measurement of a two-dimensional magnetic field, and the directions of the magnetic components detected by the two magnetic resistance sensors can be in the same direction with the tangential direction and the axial direction of the measured magnetic steel, also can be in the same direction with the radial direction and the tangential direction of the measured magnetic steel, and also can be in the same direction with the radial direction and the axial direction of the measured magnetic steel. In this embodiment, the first direction magnetic component and the second direction magnetic component may be a tangential magnetic component and an axial magnetic component of the magnetic steel to be measured, respectively.

In another embodiment, the magnetic encoder includes a magnetoresistive sensor and a hall sensor, wherein the magnetoresistive sensor is an MR sensor or an AMR sensor that detects a single direction, and the magnetoresistive sensor is a planar component. The magnetic encoder comprises a magnetic encoder, a magnetic sensor and a Hall sensor, wherein the magnetic encoder is provided with a plurality of magnetic sensors, the number of the magnetic sensors is one, one magnetic sensor only measures magnetic components in one direction, and the magnetic sensors and the Hall sensor respectively measure two magnetic components in orthogonal directions, so that the magnetic encoder can realize the measurement of a two-dimensional magnetic field.

In yet another embodiment, the magnetic encoder includes a magnetoresistive sensor, which is an MR sensor or an AMR sensor that detects two orthogonal directions, and a hall sensor, which is a planar component. The number of magnetoresistive sensors is one, so that the magnetic encoder can realize the measurement of a two-dimensional magnetic field.

Because the periodicity of the Hall signal generated by the Hall sensor for detecting the measured magnetic steel is the same as the periodicity of the magnetic field of the measured magnetic steel, the Hall signal can be used for determining whether the polar position of the magnetic encoder facing the measured magnetic steel is the N pole or the S pole. As shown in fig. 4, the magnetic encoder 1 is located opposite to the magnetic steel 4 to be measured, and in the coordinate system of fig. 4 (c), the direction I is a tangential direction, the direction II is an axial direction, and the direction III is a radial direction. The magnetic steel 4 to be measured is a rotor, and the magnetic resistance sensor and the hall sensor can be separate devices or devices integrated together in an integrated manner.

The invention can utilize the magnetic resistance sensor to detect the magnetic components of the measured magnetic steel 4 in two directions, and utilize the signal processing technology to calculate the value of the relative electric angle of the measured magnetic steel 4; or further utilizing a Hall sensor and a signal processing technology to calculate the absolute electrical angle of the measured magnet steel 4.

In the present invention, the magnetic encoder may detect a two-dimensional magnetic field, that is, a tangential-axial magnetic component of the measured magnetic steel, a radial-tangential magnetic component of the measured magnetic steel, or a radial-axial magnetic component of the measured magnetic steel, and for convenience of description, in the following embodiments of the present invention, the description is given by taking an example in which the magnetoresistive sensor detects an axial-tangential magnetic component. It can be understood by those skilled in the art that, when the invention detects the radial-tangential magnetic component or the radial-axial magnetic component, it is only necessary to adjust the detection plane of the magnetoresistive sensor to be in the same plane as the detected magnetic component, and adaptively adjust the relative position relationship between the hall sensor and the detected magnetic steel. For convenience of description, in the following embodiments of the present invention, the tangential magnetic field, the axial magnetic field, and the radial magnetic field each represent a distribution of tangential magnetic components, an axial magnetic component, and a radial magnetic component in a magnetic field, rather than an independently existing magnetic field.

Those skilled in the art will appreciate that the hardware configuration shown in fig. 3 does not constitute a limitation of the apparatus, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.

With continued reference to fig. 3, the memory 1005 of fig. 3, which is a type of computer-readable storage medium, may include an operating system, a network communication module, and an absolute electrical angle detection program.

In fig. 1, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

acquiring an angle sine signal corresponding to the first direction magnetic component and an angle cosine signal corresponding to the second direction magnetic component;

calculating a calibration compensation sine signal and a calibration compensation cosine signal according to the angle sine signal, the angle cosine signal and a calibration compensation formula;

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating a relative electric angle value of the measured magnetic steel according to a preset trigonometric function corresponding to the angle interval;

acquiring a Hall signal detected by the Hall sensor, and determining the polarity position of the magnetic encoder according to the Hall signal;

and calculating to obtain an absolute electrical angle according to the relative electrical angle value and the polarity position. Wherein, the calibration compensation formula is as follows:

in the formula, Vsc(theta) compensating the sinusoidal signal for scaling, Vcc(theta) is the scaled cosine compensation signal, Vs(theta) is an angle sinusoidal signal, Vc(theta) is an angle cosine signal, Vs0For presetting the offset error of the sinusoidal signal, Vc0For presetting the offset error, V, of the cosine signals1For harmonic amplitude compensation of a predetermined sinusoidal signal, Vc1For the harmonic amplitude compensation of the predetermined cosine signal.

Further, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

acquiring periodic voltage signals of the measured magnetic steel rotating for one circle, wherein the periodic voltage signals comprise preset standard sine signals corresponding to the first direction magnetic components and preset standard cosine signals corresponding to the second direction magnetic components;

substituting the periodic voltage signal into a bias error calculation formula and a harmonic amplitude compensation calculation formulaWherein the bias error and harmonic amplitude compensation of the voltage signal are obtained and stored as the bias error V of the preset sinusoidal signals0Presetting the offset error V of the cosine signalc0,Harmonic amplitude compensation V of preset sinusoidal signalsnThe harmonic amplitude compensation V of the cosine signal is presetcn

The offset error calculation formula is as follows:

Figure 656033DEST_PATH_IMAGE008

the harmonic amplitude compensation calculation formula is as follows:

Figure 493338DEST_PATH_IMAGE009

wherein N is the period number of the signal, N is the nth harmonic, theta is the relative electrical angle of the measured magnetic steel, Vs0For presetting the offset error of the sinusoidal signal, Vc0For presetting the offset error, V, of the cosine signals(theta) is a predetermined target sinusoidal signal of the periodic voltage signal, Vc(theta) is a scaled cosine signal of the periodic voltage signal, VsnFor harmonic amplitude compensation of a predetermined sinusoidal signal, VcnFor the harmonic amplitude compensation of the predetermined cosine signal.

Further, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal;

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is-45 degrees to 45 degrees/or 135 degrees to 225 degrees, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

Figure 955544DEST_PATH_IMAGE001

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is-45 degrees to 45 degrees, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

wherein, theta is the relative electrical angle of the tested magnetic steel; vsc (theta) is a scaled compensated sine signal, and Vcc (theta) is a scaled cosine compensated signal.

Further, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal;

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is-45 degrees to 45 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 243623DEST_PATH_IMAGE003

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is 45-135 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is 135-225 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 806639DEST_PATH_IMAGE005

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is 225-315 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 251527DEST_PATH_IMAGE006

when the relative electrical angle or the iteration times meet the preset iteration rule, setting the iteration electrical angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained;

wherein theta is the relative electrical angle of the measured magnetic steel calculated in the nth iteration; thetan+1The relative electrical angle of the measured magnetic steel is calculated for the (n + 1) th iteration; vsc(theta) compensating the sinusoidal signal for scaling, Vcc(θ) is the scaled cosine compensation signal; k1、K2、K3、K4、L1、L2、L3、L4、L5And L6Is a preset constant.

Further, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

determining an iterative electrical angle θn+1And an iterative electrical angle thetanWhether the difference value of (a) is less than a first preset threshold value;

if the electrical angle theta is iteratedn+1And an iterative electrical angle thetanIs less than the first preset threshold value, an iterative electrical angle value theta is setn+1The relative electric angle value of the measured magnetic steel is obtained.

Further, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

judging whether the iteration number n +1 is equal to a second preset threshold value or not;

if the iteration times are equal to a second preset threshold value, setting an iteration electric angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained.

Further, the processor 1001 may call the absolute electrical angle detection program stored in the memory 1005, and perform the following steps:

if the polar position is that the magnetic encoder is positioned on the N pole side of the measured magnetic steel, calculating according to a first angle calculation formula to obtain an absolute electrical angle;

and if the polar position is that the magnetic encoder is positioned on the S pole side of the measured magnetic steel, calculating according to a second angle calculation formula to obtain an absolute electrical angle. Wherein the first angle calculation formula is: θ = θcAnd/2, the second angle calculation formula is as follows: θ = θc2+180 DEG theta is the absolute electrical angle thetacIs a relative electrical angle value.

Referring to fig. 1, in a first embodiment of the present invention, a method for detecting an absolute electrical angle includes the following steps:

step S100, acquiring an angle sine signal corresponding to the first-direction magnetic component and an angle cosine signal corresponding to the second-direction magnetic component;

specifically, install magnetic encoder in the magnetic field region of being surveyed the magnet steel, adopt the magnetic encoder above detect the magnetic field of being surveyed the magnet steel, magnetic encoder can output corresponding voltage signal, this voltage signal include with the angle sine signal that first direction magnetic component corresponds and with the angle cosine signal that second direction magnetic component corresponds.

And step S200, calculating a calibration compensation sine signal and a calibration compensation cosine signal according to the angle sine signal, the angle cosine signal and a calibration compensation formula. Wherein, the calibration compensation formula is as follows:

Figure 29176DEST_PATH_IMAGE011

in the formula, Vsc(theta) compensating the sinusoidal signal for scaling, Vcc(theta) is the scaled cosine compensation signal, Vs(theta) is an angle sinusoidal signal, Vc(theta) is an angle cosine signal, Vs0For presetting the offset error of the sinusoidal signal, Vc0For presetting the offset error, V, of the cosine signals1For harmonic amplitude compensation of a predetermined sinusoidal signal, Vc1For the harmonic amplitude compensation of the predetermined cosine signal.

In fact, when the magnetic encoder is used for detection, the output voltage signal often contains more higher harmonics and also contains offset error caused by the influence of the control circuit,in order to improve the detection accuracy, it is necessary to deal with the offset error of the magnetic encoder and the higher harmonics in the output voltage signal. In this embodiment, the angle sine signal and the angle cosine signal are corrected by a calibration compensation formula to generate a calibration compensation sine signal and a calibration compensation cosine signal, so as to improve the accuracy of the relative electrical angle and the absolute electrical angle obtained by the precise calculation. Wherein the offset error V of the sine signal is presets0、Presetting offset error V of cosine signalc0And the harmonic amplitude compensation V of the preset sinusoidal signals1And a harmonic amplitude compensation V of the preset cosine signalc1The input may be entered and stored by those skilled in the art in advance after the magnetic encoder is first powered up, or may be entered by those skilled in the art each time the magnetic encoder performs a test. In the invention, V is adopted in the harmonic amplitude compensation of the preset sinusoidal signals1And VsnDenotes, in particular, Vs1Presetting the harmonic amplitude compensation, V, of the sinusoidal signal for the first harmonicsnAnd harmonic amplitude compensation of the sinusoidal signal is preset for the nth harmonic. One skilled in the art can then preset the harmonic amplitude compensation of the cosine signal.

Step S300, determining angle intervals corresponding to the calibration compensation sine signal and the calibration compensation cosine signal, and calculating the relative electric angle value of the measured magnetic steel according to a preset trigonometric function corresponding to the angle intervals;

step S400, acquiring a Hall signal detected by the Hall sensor, and determining the polarity position of the magnetic encoder according to the Hall signal;

because the periodicity of the Hall signal generated by the Hall sensor for detecting the measured magnetic steel is the same as the periodicity of the magnetic field of the measured magnetic steel, the Hall signal can be used for determining whether the polar position of the magnetic encoder facing the measured magnetic steel is the N pole or the S pole.

And S500, calculating to obtain an absolute electrical angle according to the relative electrical angle value and the polarity position.

Specifically, if the polar position is that the magnetic encoder is positioned on the N pole side of the measured magnetic steel, calculating according to a first angle calculation formula to obtain an absolute electrical angle;

and if the polar position is that the magnetic encoder is positioned on the S pole side of the measured magnetic steel, calculating according to a second angle calculation formula to obtain an absolute electrical angle. Wherein the first angle calculation formula is: θ = θcAnd/2, the second angle calculation formula is as follows: θ = θc2+180 DEG theta is the absolute electrical angle thetacIs a relative electrical angle value.

In the technical scheme of the invention, the signals detected by the magnetic encoder are corrected by a calibration compensation formula, so that the influence of offset errors and higher harmonics is avoided, and the calculated relative electric angle and absolute electric angle are improved; through setting up hall sensor to can differentiate magnetic encoder and face the N utmost point or the S utmost point of magnet steel that awaits measuring, calculate the absolute electrical angle who reachs the magnet steel that is surveyed.

Referring to fig. 2, fig. 2 is a partial flow chart of a second embodiment of the absolute electrical angle detection method according to the present invention; based on the above embodiment, step S100 is preceded by:

step S600, obtaining periodic voltage signals of the measured magnetic steel rotating for one circle, wherein the periodic voltage signals comprise preset standard sine signals corresponding to the first direction magnetic components and preset standard cosine signals corresponding to the second direction magnetic components;

step S700, substituting the periodic voltage signal into a bias error calculation formula and a harmonic amplitude compensation calculation formula to obtain the bias error and the harmonic amplitude compensation of the voltage signal, and respectively storing the bias error and the harmonic amplitude compensation as the bias error V of a preset sinusoidal signals0Presetting the offset error V of the cosine signalc0

The offset error calculation formula is as follows:

the harmonic amplitude compensation calculation formula is as follows:

Figure 640734DEST_PATH_IMAGE013

wherein N isThe period number of the signal, n is the nth harmonic, theta is the relative electrical angle of the measured magnetic steel, Vs0For presetting the offset error of the sinusoidal signal, Vc0For presetting the offset error, V, of the cosine signals(theta) is a predetermined target sinusoidal signal of the periodic voltage signal, Vc(theta) is a scaled cosine signal of the periodic voltage signal, VsnHarmonic amplitude compensation, V, for the nth preset sinusoidal signalcnAnd compensating the harmonic amplitude of the nth preset cosine signal.

Specifically, the measured magnetic steel can be controlled to rotate for a circle, the magnetic encoder measures a voltage signal of the measured magnetic steel in the circle as a periodic voltage signal, the periodic voltage signal is substituted into the offset error calculation formula and the harmonic amplitude compensation calculation formula, and the calculated offset error and the calculated harmonic amplitude are stored so as to be used for correcting a signal detected by the subsequent magnetic encoder.

Based on the above embodiments, step S300 in the third embodiment of the absolute electrical angle detection method of the present invention includes:

judging whether the angles corresponding to the calibration compensation sine signal and the calibration compensation cosine signal are within a preset angle interval, wherein the preset angle interval is-45 degrees to 45 degrees and 135 degrees to 225 degrees;

specifically, whether the corresponding angles of the scaled compensated sine signal and the scaled compensated cosine signal are within the preset angle interval (-45 °, 45 °), (135 °, 225 °) is determined by the values of the scaled compensated sine signal Vsc (θ) and/or the scaled cosine compensated signal Vcc (θ).

If the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is within the preset angle interval, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

if the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is not within the preset angle interval, calculating the relative electric angle value of the measured magnetic steel according to the following formula:

wherein, theta is the relative electrical angle of the tested magnetic steel; vsc (theta) is a scaled compensated sine signal, and Vcc (theta) is a scaled cosine compensated signal.

Further, step S300 in the fourth embodiment of the absolute electrical angle detecting method of the present invention includes:

determining an angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal;

due to the influence of higher harmonics, the method provided by the third embodiment is adopted to calculate the relative electrical angle, so that a larger error exists in the result, and the calculation amount is large by adopting an inverse trigonometric function. The method provided by the embodiment is adopted to weaken the influence of higher harmonics and accelerate the calculation speed. The angle of one rotation of the measured magnetic steel is divided into 4 angle intervals, which respectively correspond to (-45 degrees, 45 degrees), (-135 degrees, 225 degrees), (-225 degrees), and (225 degrees), 315 degrees, and similarly, the angle interval in which the angle corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is determined by the value of the calibration compensation sine signal Vsc (theta) and/or the calibration cosine compensation signal Vcc (theta).

If the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is-45 degrees to 45 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 736549DEST_PATH_IMAGE016

wherein, K1、K2Calculated by the following formula:

Figure 697683DEST_PATH_IMAGE017

Figure 519008DEST_PATH_IMAGE018

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is 45-135 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

wherein, K3、K4Calculated by the following formula:

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is 135-225 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 648004DEST_PATH_IMAGE021

wherein L is1、L2、L3The formula is as follows:

Figure 199202DEST_PATH_IMAGE022

Figure 781494DEST_PATH_IMAGE023

Figure 972303DEST_PATH_IMAGE024

Figure 790087DEST_PATH_IMAGE025

Figure 320425DEST_PATH_IMAGE026

Figure 152246DEST_PATH_IMAGE027

if the angle interval corresponding to the calibration compensation sine signal and the calibration compensation cosine signal is 225-315 degrees, iteratively calculating the iterative electrical angle value of the measured magnetic steel according to the following formula:

Figure 655089DEST_PATH_IMAGE029

wherein L is4、L5And L6Calculated by the following formula:

Figure 102251DEST_PATH_IMAGE030

Figure 636131DEST_PATH_IMAGE031

Figure 4796DEST_PATH_IMAGE032

Figure 747941DEST_PATH_IMAGE034

Figure 436411DEST_PATH_IMAGE035

Figure 292372DEST_PATH_IMAGE036

Figure 6381DEST_PATH_IMAGE037

Figure 162556DEST_PATH_IMAGE038

Figure 428452DEST_PATH_IMAGE039

when the relative electrical angle or the iteration times meet the preset iteration rule, setting the iteration electrical angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained;

wherein theta is the relative electrical angle of the measured magnetic steel calculated in the nth iteration; thetan+1An iteration electrical angle value calculated for the (n + 1) th iteration; vsc(theta) compensating the sinusoidal signal for scaling, Vcc(θ) is the scaled cosine compensation signal; k1、K2、K3、K4、L1、L2、L3、L4、L5And L6Is a preset constant.

In the embodiment, 4 different angle intervals are set, and the corresponding iterative formula is adopted to calculate the relative electrical angle, so that the influence of higher harmonics can be reduced, the use of an inverse trigonometric function is reduced, and the calculation speed is increased.

Based on the above embodiments, in the fifth embodiment of the absolute electrical angle detection method according to the present invention, when the relative electrical angle or the iteration number meets the preset iteration rule, the iteration electrical angle value θ is setn+1The step of measuring the relative electric angle value of the magnetic steel comprises the following steps:

determining an iterative electrical angle θn+1And an iterative electrical angle thetanWhether the difference value of (a) is less than a first preset threshold value;

if the electrical angle theta is iteratedn+1And an iterative electrical angle thetanIs less than the first preset threshold value, an iterative electrical angle value theta is setn+1The relative electric angle value of the measured magnetic steel is obtained.

In a sixth embodiment of the absolute electrical angle detecting method of the present invention, when the relative electrical angle or the number of iterations meets a preset iteration rule, an iteration electrical angle value θ is setn+1The step of measuring the relative electric angle value of the magnetic steel comprises the following steps:

judging whether the iteration number n +1 is equal to a second preset threshold value or not;

if the iteration times are equal to a second preset threshold value, setting an iteration electric angle value thetan+1The relative electric angle value of the measured magnetic steel is obtained.

In the fifth embodiment, a first preset threshold is set to determine whether an error of an iteration electrical angle value obtained by two adjacent iteration calculations is within a preset range, so that whether iteration continues can be controlled. The sixth embodiment determines whether the total number of iterations reaches the preset number by setting a second preset threshold, so that whether the iterations continue can be controlled. A person skilled in the art can set the first preset threshold and the second preset threshold according to actual requirements, and can use any one of the fifth embodiment and the sixth embodiment to determine whether the iteration is continued.

In addition, the invention also provides a computer readable storage medium.

The computer-readable storage medium of the present invention stores thereon an absolute electrical angle detection program, wherein the absolute electrical angle detection program, when executed by a processor, implements the steps of the absolute electrical angle detection method as described above.

The method for implementing the absolute electrical angle detection program when executed may refer to various embodiments of the absolute electrical angle detection method of the present invention, and will not be described herein again.

As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.

The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:工件测量装置、工件测量方法以及计算机可读介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!