[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN115589180B - A quadrature error compensation method based on sine-cosine position encoder - Google Patents

A quadrature error compensation method based on sine-cosine position encoder Download PDF

Info

Publication number
CN115589180B
CN115589180B CN202211320364.9A CN202211320364A CN115589180B CN 115589180 B CN115589180 B CN 115589180B CN 202211320364 A CN202211320364 A CN 202211320364A CN 115589180 B CN115589180 B CN 115589180B
Authority
CN
China
Prior art keywords
cosine
sine
sincorr
coscorr
quadrature error
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211320364.9A
Other languages
Chinese (zh)
Other versions
CN115589180A (en
Inventor
明耀
杨安晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Southeast University
Original Assignee
Southeast University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Southeast University filed Critical Southeast University
Priority to CN202211320364.9A priority Critical patent/CN115589180B/en
Publication of CN115589180A publication Critical patent/CN115589180A/en
Application granted granted Critical
Publication of CN115589180B publication Critical patent/CN115589180B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P21/00Arrangements or methods for the control of electric machines by vector control, e.g. by control of field orientation
    • H02P21/14Estimation or adaptation of machine parameters, e.g. flux, current or voltage
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P21/00Arrangements or methods for the control of electric machines by vector control, e.g. by control of field orientation
    • H02P21/06Rotor flux based control involving the use of rotor position or rotor speed sensors
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P21/00Arrangements or methods for the control of electric machines by vector control, e.g. by control of field orientation
    • H02P21/14Estimation or adaptation of machine parameters, e.g. flux, current or voltage
    • H02P21/18Estimation of position or speed

Landscapes

  • Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

The invention discloses an orthogonal error compensation method based on a sine and cosine position encoder in the technical field of motor control, which comprises the following steps: detecting and sampling a sine and cosine encoder voltage signal; performing amplitude scaling and zero point offset of sine and cosine digital variables; performing quadrature error calculation of sine and cosine variables; calculating an ideal cosine variable; and (5) performing position angle calculation after quadrature error compensation. According to the invention, an ideal cosine waveform is fitted according to the sampled sine and cosine waveform with the orthogonal error by a curve fitting method, so that the problem of overlarge position error caused by the orthogonal error is solved, and the stability of a control system is improved while the cost is reduced by adopting a low-cost sine and cosine encoder; the method is free from motor parameters, can be realized only by voltage sampling values of the original sine and cosine encoder, and has higher precision, better effect and easier realization method; the excessive computing power of the MCU is not required, and the number of required instruction cycles is less.

Description

一种基于正余弦位置编码器的正交误差补偿方法A quadrature error compensation method based on sine-cosine position encoder

技术领域Technical Field

本发明属于电机控制技术领域,具体涉及一种基于正余弦位置编码器的正交误差补偿方法。The invention belongs to the technical field of motor control, and in particular relates to an orthogonal error compensation method based on a sine-cosine position encoder.

背景技术Background Art

永磁电机结构简单,效率高,应用范围广泛。永磁电机需要位置反馈来进行有效的控制,然而,采用高精度的位置传感器成本太高,因此实际产品中经常会采用成本较低的编码器方案。通常高精度的位置传感器,例如光电编码器、旋转变压器等价格可能达到几百,在大批量生产中的成本几乎是不可接收的。相比之下,低成本的正余弦编码器结构简单,通常只需要一个霍尔传感器配上相关的调理电路即可实现,成本可达到几十甚至更低。且正余弦编码器能够输出绝对位置,甚至比成本更高的增量式光电编码器使用起来更为方便,比起普通霍尔传感器只能实现分区判断精度大大提高了,因此经常在需要正弦波控制永磁电机的企业产品上使用。Permanent magnet motors have a simple structure, high efficiency and a wide range of applications. Permanent magnet motors require position feedback for effective control. However, the cost of using high-precision position sensors is too high, so lower-cost encoder solutions are often used in actual products. Usually, high-precision position sensors, such as photoelectric encoders and resolvers, can cost hundreds of dollars, and the cost in mass production is almost unacceptable. In contrast, low-cost sine and cosine encoders have a simple structure and usually only require a Hall sensor with related conditioning circuits to achieve a cost of tens or even less. In addition, sine and cosine encoders can output absolute position, and are even more convenient to use than more expensive incremental photoelectric encoders. Compared with ordinary Hall sensors that can only achieve partition judgment accuracy, the accuracy is greatly improved, so they are often used in corporate products that require sine wave control of permanent magnet motors.

正余弦位置编码器通常会产生两条相互正交的正弦和余弦电压波形,MCU通过AD采样后将正余弦电压的幅值缩放、偏移到-π~π之间,并通过atan2运算即可获得当前的机械位置角。然而实际应用中低成本的正余弦编码器产生的正余弦波形通常并不精确,主要误差包含正余弦幅值不相等、中位偏移、存在谐波和不正交等。其中幅值不等和中位偏移在采样后通过缩放和偏移可以基本消除影响,谐波问题可以通过采样电路增加跟随电路、软硬件滤波等方法减小影响,但是正余弦波形不正交带来的问题相对难以消除。高精度的正余弦编码器在正弦、余弦电压波形之间的相位差基本为π/2,误差一般小于±0.5°,但低成本的正余弦编码器在正弦、余弦电压波形之间的相位差与π/2相差较大,实际使用过的低成本正余弦编码器产品甚至误差可达3.77°,使用这种低成本编码器时计算出来的位置角精度大大降低。The sine and cosine position encoder usually generates two mutually orthogonal sine and cosine voltage waveforms. After AD sampling, the MCU scales and offsets the amplitude of the sine and cosine voltage to between -π and π, and obtains the current mechanical position angle through atan2 operation. However, the sine and cosine waveforms generated by low-cost sine and cosine encoders in actual applications are usually not accurate. The main errors include unequal sine and cosine amplitudes, median offset, harmonics, and non-orthogonality. Among them, the unequal amplitudes and median offset can be basically eliminated by scaling and offsetting after sampling. The harmonic problem can be reduced by adding a follower circuit to the sampling circuit, software and hardware filtering, etc., but the problem caused by the non-orthogonality of the sine and cosine waveforms is relatively difficult to eliminate. The phase difference between the sine and cosine voltage waveforms of high-precision sine and cosine encoders is basically π/2, and the error is generally less than ±0.5°, but the phase difference between the sine and cosine voltage waveforms of low-cost sine and cosine encoders is much different from π/2. The actual low-cost sine and cosine encoder products that have been used can even have an error of 3.77°. The accuracy of the position angle calculated when using such low-cost encoders is greatly reduced.

发明内容Summary of the invention

针对现有技术的不足,本发明的目的在于提供一种基于正余弦位置编码器的正交误差补偿方法,以解决上述背景技术中提出的问题。In view of the deficiencies in the prior art, an object of the present invention is to provide an orthogonal error compensation method based on a sine-cosine position encoder to solve the problems raised in the above background technology.

本发明的目的可以通过以下技术方案实现:The purpose of the present invention can be achieved through the following technical solutions:

一种基于正余弦位置编码器的正交误差补偿方法,包括以下步骤:A quadrature error compensation method based on a sine-cosine position encoder comprises the following steps:

步骤1、进行正余弦编码器电压信号的检测与采样:Step 1: Detect and sample the sine-cosine encoder voltage signal:

检测位置编码器输出的正余弦电压信号usin5和ucos5,经过电平转换芯片或运放进行幅值缩放得到可供MCU采样的正余弦电压信号usin3和ucos3,并通过MCU的AD采样模块将电压信号转换为数字变量Dsindata和DcosdataDetect the sine and cosine voltage signals u sin5 and u cos5 output by the position encoder, and obtain sine and cosine voltage signals u sin3 and u cos3 for MCU sampling through the level conversion chip or operational amplifier, and convert the voltage signals into digital variables D sindata and D cosdata through the AD sampling module of the MCU;

步骤2、进行正余弦数字变量的幅值缩放和零点偏移:Step 2: Perform amplitude scaling and zero point offset of sine and cosine digital variables:

取步骤1中得到的正余弦数字变量Dsindata和Dcosdata,计算这两个变量的最大值、最小值和中值,通过对幅值与中点进行缩放和偏移得到标准的幅值范围在-π~π,中值为0的正余弦变量Dsincorr和DcoscorrTake the sine and cosine digital variables D sindata and D cosdata obtained in step 1, calculate the maximum, minimum and median of the two variables, and obtain the standard sine and cosine variables D sincorr and D coscorr with an amplitude range of -π to π and a median of 0 by scaling and offsetting the amplitude and the midpoint;

步骤3、进行正余弦变量的正交误差计算:Step 3: Calculate the orthogonal error of the sine and cosine variables:

将电机匀速旋转时的正余弦变量Dsincorr和Dcoscorr每个时刻的值记录下来,计算出这两个变量对应当前转速下的幅值Asin,Acos、频率fsin,fcos和初相 可得到正余弦变量关于时间的表达式Dsincorr(t)和Dcoscorr(t),确认幅值频率一致后对做差,得到真实的正余弦相位差 Record the values of the sine and cosine variables D sincorr and D coscorr at each moment when the motor rotates at a constant speed, and calculate the amplitude A sin , A cos , frequency f sin , f cos and initial phase of these two variables corresponding to the current speed The expressions of sine and cosine variables with respect to time, D sincorr (t) and D coscorr (t), can be obtained. After confirming that the amplitude and frequency are consistent, and Do the difference to get the real sine and cosine phase difference

步骤4、进行理想余弦变量的计算:Step 4: Calculate the ideal cosine variable:

用步骤3计算得到的真实的正余弦相位差与理想情况下的正交相位差π/2做差得到正交误差基于采样到的余弦变量的表达式Dcoscorr(t)计算出一条与正弦变量表达式Dsincorr(t)正交的理想余弦变量表达式Dcosideal(t),幅值和频率与Dcoscorr(t)相同,初相为 The actual sine and cosine phase difference calculated in step 3 The quadrature error is obtained by subtracting the ideal quadrature phase difference of π/2. Based on the sampled cosine variable expression D coscorr (t), an ideal cosine variable expression D cosideal (t) orthogonal to the sine variable expression D sincorr (t) is calculated. The amplitude and frequency are the same as D coscorr (t), and the initial phase is

步骤5、进行正交误差补偿后的位置角计算:Step 5: Calculate the position angle after orthogonal error compensation:

用步骤3中得到的Dsincorr(t)和Dcoscorr(t)去拟合步骤4中得到的Dcosideal(t),得到Dcosideal与Dsincorr和Dcoscorr关系表达式,以便通过实时采样到的正余弦信号得到实时的理想余弦信号,将真实的正弦变量Dsincorr与计算得到的Dcosideal进行atan2运算得到补偿后的位置角,用于矢量控制中断PARK和IPark变换,提高永磁电机矢量控制的精度和效果,确保永磁电机的稳定运行。Use D sincorr (t) and D coscorr (t) obtained in step 3 to fit D cosideal (t) obtained in step 4, and obtain the relationship expression between D cosideal and D sincorr and D coscorr , so as to obtain the real-time ideal cosine signal through the real-time sampled sine and cosine signals, and perform atan2 operation on the real sinusoidal variable D sincorr and the calculated D cosideal to obtain the compensated position angle, which is used for vector control interrupt PARK and IPark transformation, thereby improving the accuracy and effect of permanent magnet motor vector control and ensuring the stable operation of the permanent magnet motor.

优选地,所述步骤1中编码器输出的正余弦电压信号usin5和ucos5为在0~5V之间正弦变化的电压,可供MCU采样的正余弦电压信号usin3和ucos3的幅值范围为0~3V。Preferably, the sine and cosine voltage signals u sin5 and u cos5 output by the encoder in step 1 are voltages that vary sinusoidally between 0 and 5V, and the amplitude range of the sine and cosine voltage signals u sin3 and u cos3 available for sampling by the MCU is 0 to 3V.

优选地,所述步骤3中正余弦变量关于时间的表达式Dsincorr(t)和Dcoscorr(t)如下式所示:Preferably, the expressions of the sine and cosine variables with respect to time in step 3, D sincorr (t) and D coscorr (t), are as follows:

式中,Asin,Acos分别为Dsincorr(t)和Dcoscorr(t)的幅值,理想情况下Asin=Acos=π,fsin,fcos分别为Dsincorr(t)和Dcoscorr(t)的频率,理想情况下相等且为当前匀速运行的转速对应的机械角频率。Wherein, A sin , A cos are the amplitudes of D sincorr (t) and D coscorr (t), respectively. Ideally, A sin =A cos =π. f sin , f cos are the frequencies of D sincorr (t) and D coscorr (t), respectively. Ideally, they are equal and are the mechanical angular frequencies corresponding to the current uniform speed.

优选地,所述步骤3中当正余弦变量存在正交误差且未经过补偿时,位置角与存在的正交误差关系如下式所示:Preferably, in step 3, when the sine and cosine variables have orthogonal errors and have not been compensated, the relationship between the position angle and the existing orthogonal errors is as follows:

θerr=θ-θcomp θ err = θ - θ comp

式中,θerr为未补偿时的机械位置角存在的理论误差。Where θ err is the theoretical error of the uncompensated mechanical position angle.

优选地,所述步骤4中理想余弦变量表达式Dcosideal(t)如下式所示:Preferably, the ideal cosine variable expression D cosideal (t) in step 4 is as follows:

优选地,所述步骤5中正交误差补偿后的位置角计算表达式如下式所示:Preferably, the position angle calculation expression after orthogonal error compensation in step 5 is as follows:

θcomp=atan2(Dsincorr(t),Dcosideal(t))θ comp =atan2(D sincorr (t),D cosional (t))

式中,θcomp为补偿后的机械位置角;Where, θ comp is the mechanical position angle after compensation;

正交误差补偿前的位置角计算表达式如下式所示:The position angle calculation expression before orthogonal error compensation is as follows:

θ=atan2(Dsincorr(t),Dcoscorr(t))θ=atan2(D sincorr (t),D coscorr (t))

式中,θ为未补偿的机械位置角;Where θ is the uncompensated mechanical position angle;

由Dsincorr(t)和Dcoscorr(t)拟合的Dcosideal(t)的表达式如下式所示:The expression of D cosideal (t) fitted by D sincorr (t) and D coscorr (t) is as follows:

Dcosideal(t)=p00+p10Dsincorr(t)+p01Dcoscorr(t)D cosideal (t)=p00+p10D sincorr (t)+p01D coscorr (t)

式中,p00、p10和p01为曲线拟合得到的系数。Where p00, p10 and p01 are the coefficients obtained by curve fitting.

本发明的有益效果:Beneficial effects of the present invention:

1、本发明通过曲线拟合的方法,根据采样到的存在正交误差的正余弦波形拟合出理想的余弦波形,用以减少正交误差带来的位置误差过大的问题,在采用低成本正余弦编码器降低成本的同时,提高了控制系统的稳定性;1. The present invention uses a curve fitting method to fit an ideal cosine waveform according to the sampled sine and cosine waveforms with orthogonal errors, so as to reduce the problem of excessive position error caused by the orthogonal error. While using a low-cost sine and cosine encoder to reduce costs, the stability of the control system is improved;

2、本发明无需电机参数,仅需原本正余弦编码器的电压采样值即可实现,校正对象仅涉及编码器,与电机无关,因而通用性好,使用方便,相比于对位置角误差进行直接补偿精度更高、效果更好、实现方法更容易;2. The present invention does not require motor parameters, but only requires the voltage sampling value of the original sine-cosine encoder to be implemented. The correction object only involves the encoder and has nothing to do with the motor. Therefore, the present invention has good versatility and is easy to use. Compared with direct compensation of the position angle error, the present invention has higher accuracy, better effect and easier implementation method.

3、本发明通过离线计算曲线拟合的方法,无需占用MCU过多的算力,在MCU中仅需额外进行两次三角函数运算,对于有三角法数学单元(TMU)的MCU(如DSP 280049C、DSP28075)所需指令周期数更少。3. The present invention adopts an offline curve fitting method, which does not need to occupy too much computing power of the MCU. Only two additional trigonometric function operations are required in the MCU. For MCUs with a trigonometric math unit (TMU) (such as DSP 280049C, DSP28075), fewer instruction cycles are required.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

图1是本发明正交误差补偿方法的流程图;FIG1 is a flow chart of a quadrature error compensation method of the present invention;

图2是本发明中存在正交误差时机械位置角理论误差值图;FIG2 is a diagram showing theoretical error values of mechanical position angles when orthogonal errors exist in the present invention;

图3是本发明中低成本正余弦编码器实测的机械角误差的波形图;FIG3 is a waveform diagram of the mechanical angle error measured by the low-cost sine-cosine encoder of the present invention;

图4是本发明中采样到的正余弦与理想余弦波形对比图;FIG4 is a comparison diagram of the sampled sine and cosine waveforms and the ideal cosine waveform in the present invention;

图5是本发明中理想余弦波形曲线拟合示意图。FIG. 5 is a schematic diagram of an ideal cosine waveform curve fitting in the present invention.

具体实施方式DETAILED DESCRIPTION

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

请参阅图1所示,本发明一种基于正余弦位置编码器的正交误差补偿方法,先通过AD采样到正余弦编码器直接产生的存在正交误差的正余弦波形,通过幅值缩放、零点偏移等操作将正余弦波形缩放到-π~π之间,匀速转动电机记录下正余弦变量的值并计算出对应的正余弦相位,建立理想的余弦波形函数并通过曲线拟合的方式得到理想余弦波形的表达式,再根据采样正弦波形和理想余弦波形计算出补偿后的位置角,以消除不正交带来的位置误差。Please refer to FIG. 1 , which is a quadrature error compensation method based on a sine-cosine position encoder. The sine-cosine waveform with quadrature error directly generated by the sine-cosine encoder is first sampled through AD, and the sine-cosine waveform is scaled to between -π and π through operations such as amplitude scaling and zero point offset. The motor is rotated at a constant speed to record the values of the sine-cosine variables and calculate the corresponding sine-cosine phases. An ideal cosine waveform function is established and the expression of the ideal cosine waveform is obtained by curve fitting. The compensated position angle is then calculated based on the sampled sine waveform and the ideal cosine waveform to eliminate the position error caused by non-orthogonality.

本发明正交误差补偿方法包括以下步骤:The orthogonal error compensation method of the present invention comprises the following steps:

步骤1、正余弦编码器电压信号的检测与采样:Step 1: Detection and sampling of sine-cosine encoder voltage signals:

检测位置编码器输出的正余弦电压信号usin5和ucos5(通常为0~5V之间正弦变化的电压),经过电平转换芯片或运放进行幅值缩放得到可供MCU采样的幅值范围为0~3V的正余弦电压信号usin3和ucos3,并通过MCU的AD采样模块将电压信号转换为0~4095的数字变量(以AD采样基准电压为3V的12位AD采样口为例)Dsindata和DcosdataDetect the sine and cosine voltage signals u sin5 and u cos5 (usually a voltage with a sinusoidal variation between 0 and 5 V) output by the position encoder, and obtain sine and cosine voltage signals u sin3 and u cos3 with an amplitude range of 0 to 3 V for MCU sampling through a level conversion chip or an operational amplifier. The voltage signals are converted into digital variables D sindata and D cosdata with an amplitude range of 0 to 4095 (taking a 12-bit AD sampling port with an AD sampling reference voltage of 3 V as an example) through the AD sampling module of the MCU.

步骤2、正余弦数字变量的幅值缩放和零点偏移:Step 2: Amplitude scaling and zero offset of sine and cosine digital variables:

取步骤1中得到的正余弦数字变量Dsindata和Dcosdata,计算这两个变量的最大值、最小值和中值,通过对幅值与中点进行缩放和偏移得到标准的幅值范围在-π~π,中值为0的正余弦变量Dsincorr和DcoscorrTake the sine and cosine digital variables D sindata and D cosdata obtained in step 1, calculate the maximum, minimum and median of the two variables, and obtain the standard sine and cosine variables D sincorr and D coscorr with an amplitude range of -π to π and a median of 0 by scaling and offsetting the amplitude and the midpoint;

步骤3、正余弦变量的正交误差计算:Step 3: Calculation of orthogonal errors of sine and cosine variables:

将电机匀速旋转时的正余弦变量Dsincorr和Dcoscorr每个时刻的值记录下来(至少记录完整的两个周期以上以缩小随机误差),计算出这两个变量对应当前转速下的幅值Asin,Acos、频率fsin,fcos和初相可得到正余弦变量关于时间的表达式Dsincorr(t)和Dcoscorr(t),确认幅值频率一致后对做差,得到真实的正余弦相位差 Record the values of the sine and cosine variables D sincorr and D coscorr at each moment when the motor rotates at a constant speed (record at least two complete cycles to reduce random errors), and calculate the amplitude A sin , A cos , frequency f sin , f cos and initial phase of these two variables corresponding to the current speed. The expressions of sine and cosine variables with respect to time, D sincorr (t) and D coscorr (t), can be obtained. After confirming that the amplitude and frequency are consistent, and Do the difference to get the real sine and cosine phase difference

其中,正余弦变量关于时间的表达式Dsincorr(t)和Dcoscorr(t)分别为:Among them, the expressions of sine and cosine variables with respect to time are D sincorr (t) and D coscorr (t), respectively:

式中,Asin,Acos分别为Dsincorr(t)和Dcoscorr(t)的幅值,理想情况下Asin=Acos=π,fsin,fcos分别为Dsincorr(t)和Dcoscorr(t)的频率,理想情况下相等且为当前匀速运行的转速对应的机械角频率;Wherein, A sin , A cos are the amplitudes of D sincorr (t) and D coscorr (t), respectively. Ideally, A sin = A cos = π. f sin , f cos are the frequencies of D sincorr (t) and D coscorr (t), respectively. Ideally, they are equal and are the mechanical angular frequencies corresponding to the current uniform speed.

当正余弦变量存在正交误差且未经过补偿时,位置角与存在的正交误差关系为:When there is an orthogonal error in the sine and cosine variables and they are not compensated, the relationship between the position angle and the existing orthogonal error is:

θerr=θ-θcomp θ err = θ - θ comp

式中,θerr为未补偿时的机械位置角存在的理论误差。Where θ err is the theoretical error of the uncompensated mechanical position angle.

步骤4、理想余弦变量的计算:Step 4: Calculation of ideal cosine variables:

取步骤3计算得到的真实的正余弦相位差与理想情况下的正交相位差π/2做差得到正交误差基于采样到的余弦变量的表达式Dcoscorr(t)计算出一条与正弦变量表达式Dsincorr(t)正交的理想余弦变量表达式Dcosideal(t),幅值和频率与Dcoscorr(t)相同,初相为 Take the actual sine and cosine phase difference calculated in step 3 The quadrature error is obtained by subtracting the ideal quadrature phase difference of π/2. Based on the sampled cosine variable expression D coscorr (t), an ideal cosine variable expression D cosideal (t) orthogonal to the sine variable expression D sincorr (t) is calculated. The amplitude and frequency are the same as D coscorr (t), and the initial phase is

其中,理想余弦变量表达式Dcosideal(t)可以表示为:Among them, the ideal cosine variable expression D cosideal (t) can be expressed as:

步骤5、正交误差补偿后的位置角计算:Step 5: Position angle calculation after orthogonal error compensation:

用步骤3中得到的Dsincorr(t)和Dcoscorr(t)去拟合步骤4中得到的Dcosideal(t),得到Dcosideal与Dsincorr和Dcoscorr关系表达式,以便通过实时采样到的正余弦信号得到实时的理想余弦信号,将真实的正弦变量Dsincorr与计算得到的Dcosideal进行atan2运算得到补偿后的位置角,用于矢量控制中断PARK和IPark变换,提高永磁电机矢量控制的精度和效果,确保永磁电机的稳定运行;Use D sincorr (t) and D coscorr (t) obtained in step 3 to fit D cosideal (t) obtained in step 4, and obtain the relationship expression between D cosideal and D sincorr and D coscorr , so as to obtain the real-time ideal cosine signal through the real-time sampled sine and cosine signals, and perform atan2 operation on the real sinusoidal variable D sincorr and the calculated D cosideal to obtain the compensated position angle, which is used for vector control interrupt PARK and IPark transformation, so as to improve the accuracy and effect of permanent magnet motor vector control and ensure the stable operation of the permanent magnet motor;

其中,正交误差补偿后的位置角计算表达式为:Among them, the calculation expression of the position angle after orthogonal error compensation is:

θcomp=atan2(Dsincorr(t),Dcosideal(t))θ comp =atan2(D sincorr (t),D cosional (t))

式中,θcomp为补偿后的机械位置角。Where θ comp is the compensated mechanical position angle.

正交误差补偿前的位置角计算表达式为:The position angle calculation expression before orthogonal error compensation is:

θ=atan2(Dsincorr(t),Dcoscorr(t))θ=atan2(D sincorr (t),D coscorr (t))

式中,θ为未补偿的机械位置角。Where θ is the uncompensated mechanical position angle.

由Dsincorr(t)和Dcoscorr(t)拟合的Dcosideal(t)的表达式为:The expression of D cosideal (t) fitted by D sincorr (t) and D coscorr (t) is:

Dcosideal(t)=p00+p10Dsincorr(t)+p01Dcoscorr(t)D cosideal (t)=p00+p10D sincorr (t)+p01D coscorr (t)

式中,p00、p10和p01为曲线拟合得到的系数。Where p00, p10 and p01 are the coefficients obtained by curve fitting.

可以得到当存在未补偿的正交误差时,位置角的误差不是一个恒定值,而是随着两倍机械角频率变化的,这也导致了位置角误差很难被直接补偿。因此在atan2计算前就对误差进行补偿是更好的解决方法。It can be seen that when there is an uncompensated orthogonal error, the position angle error is not a constant value, but changes with twice the mechanical angular frequency, which also makes it difficult to directly compensate the position angle error. Therefore, compensating the error before atan2 calculation is a better solution.

根据采样到的存在正交误差的正余弦波形拟合出理想的余弦波形,再进行atan2运算能够明显的减小机械位置角误差,在采用低成本正余弦编码器时能取得很好的永磁电机矢量控制效果,而且本发明同样适用于其他存在正交误差的正余弦函数进行误差校正。An ideal cosine waveform is fitted based on the sampled sine-cosine waveform with orthogonal error, and then an atan2 operation is performed, which can significantly reduce the mechanical position angle error. When a low-cost sine-cosine encoder is used, a good permanent magnet motor vector control effect can be achieved. The present invention is also applicable to other sine-cosine functions with orthogonal errors for error correction.

图2为理论上正交误差为3.77°时的机械位置角误差图。此时最大的机械位置角误差约为0.065rad,即3.724°。以5对极的永磁电机为例,此时电角度误差最大可达约18.6°,严重影响电机的正常矢量控制运行。Figure 2 shows the mechanical position angle error when the theoretical quadrature error is 3.77°. At this time, the maximum mechanical position angle error is about 0.065rad, or 3.724°. Taking a 5-pole permanent magnet motor as an example, the maximum electrical angle error can reach about 18.6°, which seriously affects the normal vector control operation of the motor.

图3为实测正交误差约为3.77°的低成本正余弦编码器的实测机械角误差的波形图。其中由正交误差导致的动态变化的位置角误差范围约为0.065rad(其余误差为其它原因导致的静态误差),基本与理论值相符。此图验证了低成本正余弦编码器动态位置误差的来源。Figure 3 is a waveform diagram of the measured mechanical angle error of a low-cost sine-cosine encoder with a measured quadrature error of approximately 3.77°. The dynamic position angle error range caused by the quadrature error is approximately 0.065 rad (the remaining errors are static errors caused by other reasons), which is basically consistent with the theoretical value. This figure verifies the source of the dynamic position error of the low-cost sine-cosine encoder.

图4为电机以240rpm匀速运行时采样到的正余弦波形与拟合出的理想余弦波形的对比图。FIG4 is a comparison diagram of the sine and cosine waveforms sampled when the motor runs at a constant speed of 240 rpm and the fitted ideal cosine waveforms.

图5为通过采样到的正余弦波形拟合出理想余弦波形的曲线拟合示意图。FIG. 5 is a schematic diagram of curve fitting of fitting an ideal cosine waveform by fitting the sampled sine and cosine waveforms.

在本说明书的描述中,参考术语“一个实施例”、“示例”、“具体示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

以上显示和描述了本发明的基本原理、主要特征和本发明的优点。本行业的技术人员应该了解,本发明不受上述实施例的限制,上述实施例和说明书中描述的只是说明本发明的原理,在不脱离本发明精神和范围的前提下,本发明还会有各种变化和改进,这些变化和改进都落入要求保护的本发明范围内。The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.

Claims (7)

1. The quadrature error compensation method based on the sine and cosine position encoder is characterized by comprising the following steps:
step 1, detecting and sampling a sine and cosine encoder voltage signal:
Detecting sine and cosine voltage signals u sin5 and u cos5 output by the position encoder, performing amplitude scaling through a level conversion chip or an operational amplifier to obtain sine and cosine voltage signals u sin3 and u cos3 which can be sampled by an MCU, and converting the voltage signals into digital variables D sindata and D cosdata through an AD sampling module of the MCU;
step 2, amplitude scaling and zero point offset of sine and cosine digital variables are carried out:
Taking sine and cosine digital variables D sindata and D cosdata obtained in the step 1, calculating the maximum value, the minimum value and the median of the two variables, and scaling and shifting the amplitude and the midpoint to obtain sine and cosine variables D sincorr and D coscorr with standard amplitude ranges of-pi and median values of 0;
step 3, quadrature error calculation of sine and cosine variables is carried out:
The values of the sine variable D sincorr and the cosine variable D coscorr at each moment when the motor rotates at a constant speed are recorded, and the amplitude A sin,Acos, the frequency f sin,fcos and the initial phase of the two variables corresponding to the current rotating speed are calculated The expressions D sincorr (t) and D coscorr (t) of sine and cosine variables relative to time can be obtained, and the pair is obtained after confirming that the amplitude frequency is consistentAndMaking a difference to obtain a true sine and cosine phase difference
Step 4, calculating ideal cosine variable:
the true sine and cosine phase difference calculated by the step3 Quadrature error obtained by making a difference from the ideal quadrature phase difference pi/2Calculating an ideal cosine variable expression D cosideal (t) orthogonal to the sine variable expression D sincorr (t) based on the sampled cosine variable expression D coscorr (t), wherein the amplitude and the frequency are the same as those of the expression D coscorr (t), and the initial phase is
Step 5, calculating a position angle after quadrature error compensation:
D sincorr (t) and D coscorr (t) obtained in the step 3 are used for fitting the D cosideal (t) obtained in the step 4, relational expressions of D cosideal, D sincorr and D coscorr are obtained, real-time ideal cosine signals are obtained through real-time sampled sine and cosine signals, the real sine variable D sincorr and the calculated D cosideal are subjected to atan2 operation to obtain a compensated position angle, the position angle is used for vector control interruption PARK and IPark conversion, the accuracy and effect of vector control of the permanent magnet motor are improved, and stable operation of the permanent magnet motor is ensured.
2. The quadrature error compensation method based on the sine and cosine position encoder as set forth in claim 1, wherein the sine and cosine voltage signals u sin5 and u cos5 outputted from the encoder in the step 1 are voltages with sine variation between 0 and 5V, and the amplitude ranges of the sine and cosine voltage signals u sin3 and u cos3 for the MCU to sample are 0 to 3V.
3. The quadrature error compensation method of claim 1, wherein the expressions D sincorr (t) and D coscorr (t) of the sine and cosine variable with respect to time in the step 3 are as follows:
Where A sin,Acos is the amplitude of D sincorr (t) and D coscorr (t), respectively, and ideally A sin=Acos=π,fsin,fcos is the frequency of D sincorr (t) and D coscorr (t), respectively, and ideally is the same and is the mechanical angular frequency corresponding to the current speed of constant speed operation.
4. The quadrature error compensation method based on the sine and cosine position encoder as set forth in claim 1, wherein, in the step 3, when the sine and cosine variable has a quadrature error and is not compensated, a relationship between a position angle and the quadrature error is as follows:
θerr=θ-θcomp
where θ err is the theoretical error in the mechanical position angle at the time of uncompensated.
5. The quadrature error compensation method based on the sine and cosine position encoder as set forth in claim 1, wherein the ideal cosine variable expression D cosideal (t) in the step 4 is as follows:
6. the quadrature error compensation method based on the sine and cosine position encoder as set forth in claim 1, wherein the quadrature error compensated position angle calculation expression in the step 5 is as follows:
θcomp=atan2(Dsincorr(t),Dcosideal(t))
Wherein, theta comp is the mechanical position angle after compensation;
the position angle calculation expression before quadrature error compensation is as follows:
θ=atan2(Dsincorr(t),Dcoscorr(t))
Wherein θ is an uncompensated mechanical position angle;
The expression of D cosideal (t) fitted by D sincorr (t) and D coscorr (t) is shown as follows:
Dcosideal(t)=p00+p10Dsincorr(t)+p01Dcoscorr(t)
where p00, p10 and p01 are coefficients obtained by curve fitting.
7. The quadrature error compensation method of claim 1, wherein the quadrature error compensation method is also applicable to other quadrature error-based sine and cosine functions for error correction.
CN202211320364.9A 2022-10-26 2022-10-26 A quadrature error compensation method based on sine-cosine position encoder Active CN115589180B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211320364.9A CN115589180B (en) 2022-10-26 2022-10-26 A quadrature error compensation method based on sine-cosine position encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211320364.9A CN115589180B (en) 2022-10-26 2022-10-26 A quadrature error compensation method based on sine-cosine position encoder

Publications (2)

Publication Number Publication Date
CN115589180A CN115589180A (en) 2023-01-10
CN115589180B true CN115589180B (en) 2024-11-08

Family

ID=84782625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211320364.9A Active CN115589180B (en) 2022-10-26 2022-10-26 A quadrature error compensation method based on sine-cosine position encoder

Country Status (1)

Country Link
CN (1) CN115589180B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116614045B (en) * 2023-04-28 2024-07-16 江苏科技大学 Permanent magnet synchronous motor rotor position sensor fault compensation method and control system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110426062A (en) * 2019-07-31 2019-11-08 中车永济电机有限公司 It is a kind of to inhibit the digital RDC of function to decode system with error
CN114204855A (en) * 2021-11-29 2022-03-18 中电科创智联(武汉)有限责任公司 FPGA-based rotary transformer decoding and error compensation system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9933276B2 (en) * 2016-03-31 2018-04-03 Delta Tau Data Systems, Inc. Method and apparatus for encoder interpolation

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110426062A (en) * 2019-07-31 2019-11-08 中车永济电机有限公司 It is a kind of to inhibit the digital RDC of function to decode system with error
CN114204855A (en) * 2021-11-29 2022-03-18 中电科创智联(武汉)有限责任公司 FPGA-based rotary transformer decoding and error compensation system and method

Also Published As

Publication number Publication date
CN115589180A (en) 2023-01-10

Similar Documents

Publication Publication Date Title
CN107607037B (en) Magnetoelectric encoder calibration method based on arc tangent trans-interval tabulation method
CN101719752B (en) Method and device for detecting rotor position of brushless motor
CN101521480B (en) Resolution method and resolver for signals of rotating transformer
CN108196213A (en) Zero-bit angle test device, the method and system of a kind of rotary transformer
CN111464107B (en) Motor, motor data analysis method, device and system
CN111817615A (en) Device and method for detecting rotor position of high-speed permanent magnet synchronous motor
CN115589180B (en) A quadrature error compensation method based on sine-cosine position encoder
CN102636194B (en) Orthogonal sine and cosine axial angle encoder signal detecting and converting circuit
CN207780217U (en) A kind of zero-bit angle test device of rotary transformer
US5933106A (en) Encoder signal analysis system for high-resolution position measurement
KR20180019920A (en) Device and method for estimating rotor angle in motor
CN110022097B (en) Resolver angular position calculating device and method for rotary transformer
US6950769B2 (en) Encoder signal interpolation divider
KR101012740B1 (en) Resolver digital converter and position detecting apparatus
JP2013205366A (en) Position detection device
US6320524B1 (en) R/D converter
CN112485460A (en) Signal acquisition and compensation method for rotary transformer
Karabeyli et al. Enhancing the accuracy for the open-loop resolver to digital converters
JP2001057761A (en) Resolver assembly equipment
TWM577495U (en) A rotary encoder eccentricity correction apparatus
CN218675812U (en) Turntable structure with 1Vpp sine-cosine encoder subdivision resolving mechanism
Shi et al. Online demodulation of miniatured capacitive angular position sensor based on ASIC implementation
Bi et al. Signal correction of linear Hall for PMSM control system
Sivappagari et al. High accuracy resolver to digital converter based on modified angle tracking observer method
CN115655332B (en) A calibration and compensation system for resolver harmonic errors based on rate gyroscope

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Lin Mingyao

Inventor after: Yang Anchen

Inventor before: Ming Yao

Inventor before: Yang Anchen