Method for compensating motor angle and control device
By injecting a high-frequency square wave voltage into the d-axis of the motor and performing online compensation, the problems of cumbersome staged control logic and angle deviation in motor angle estimation by the traditional high-frequency injection algorithm are solved, realizing fast and smooth low-speed start-up and high-precision control of the motor.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GREBO INTELLIGENT POWER TECHNOLOGY (NINGBO) CO LTD
- Filing Date
- 2026-05-15
- Publication Date
- 2026-07-14
AI Technical Summary
Traditional high-frequency injection algorithms suffer from cumbersome staged control logic and poor continuity in motor angle estimation. They are also sensitive to injection signals, leading to prolonged low-speed start-up cycles and angle deviations that affect control accuracy.
By injecting a high-frequency square wave voltage into the d-axis of the motor, high-frequency d-axis and q-axis currents are obtained. Online compensation is performed using a phase-locked loop and frequency filtering. The polarity and offset compensation angle are determined by combining the set speed and operating stage, simplifying the control logic and improving the stability and reliability of angle estimation.
It enables rapid angle correction and offset calculation of the motor during the low-speed start-up phase, shortens the start-up time, improves control accuracy and the smooth operation capability of the motor, and simplifies the control process.
Smart Images

Figure CN122394442A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motor technology, and in particular to a method and control device for compensating motor angle. Background Technology
[0002] High-performance control of permanent magnet synchronous motors relies on accurate acquisition of the rotor's angular position. Traditional solutions primarily rely on position sensors for detection or estimation using positionless control algorithms to obtain the motor angle. For positionless control algorithms, high-frequency injection algorithms are widely used for low-speed and zero-speed operation due to their excellent load-bearing starting capability. However, traditional high-frequency injection algorithms are typically divided into three independent stages: initial positioning, polarity determination, and formal angle identification. This staged control logic not only leads to a cumbersome process and poor continuity, but also requires the insertion of shut-off blank control segments between different stages to reduce high-frequency noise interference, thus prolonging the low-speed starting cycle of the motor. Furthermore, high-frequency injection algorithms are highly sensitive to the amplitude and sampling quality of the injected signal. For example, mismatched injected current and voltage parameters or large sampling fluctuations can easily lead to deviations in the angle after convergence of the high-frequency injection algorithm, thereby affecting control accuracy. Summary of the Invention
[0003] The main objective of this invention is to provide a method and control device for compensating motor angles, which aims to improve angle deviation and enhance motor control accuracy.
[0004] To achieve the above objectives, the present invention proposes a method for compensating motor angles, the method comprising: Inject a high-frequency square wave voltage into the d-axis of the motor so that the motor generates a high-frequency current corresponding to the injected high-frequency square wave voltage. The three-phase current of the motor is obtained, and high-frequency current extraction is performed on the three-phase current to obtain the high-frequency d-axis current and high-frequency q-axis current. Within a preset time period of motor start-up, if the absolute value of the high-frequency d-axis current is less than a preset current threshold, the offset angle is determined based on the high-frequency d-axis current and the initial offset coefficient. If the absolute value of the high-frequency d-axis current corresponding to the current sampling period is less than the absolute value of the high-frequency d-axis current corresponding to the historical sampling period, the initial offset coefficient is adjusted. If the absolute value of the high-frequency d-axis current corresponding to the current sampling period is greater than or equal to the absolute value of the high-frequency d-axis current corresponding to the historical sampling period, the initial offset coefficient remains unchanged. The high-frequency q-axis current is subjected to phase-locked loop processing and frequency filtering processing in sequence to obtain the filtering frequency; The motor angle is compensated online based on the offset angle and the filtering frequency to obtain the compensated motor angle.
[0005] In one embodiment, the online compensation process for the motor angle based on the offset angle and the filtering frequency to obtain the compensated motor angle includes: The polarity compensation angle is determined based on the set rotational speed and the filter frequency, and the offset compensation angle is determined based on the motor's operating stage and the offset angle. The sum of the polarity compensation angle, the offset compensation angle, and the motor angle is taken as the compensated motor angle.
[0006] In one embodiment, determining the polarity compensation angle based on the set rotational speed and the filter frequency includes: When the set rotational speed is greater than 0 and the filter frequency is less than the negative value of the reverse minimum rotational speed frequency, the polarity error flag is set to 1; When the set rotational speed is less than 0 and the filter frequency is greater than a positive value of the reverse minimum rotational speed frequency, the polarity error flag is set to 1.
[0007] In one embodiment, determining the offset compensation angle based on the motor's operating stage and the offset angle includes: When it is determined that the motor is in the high-frequency current operation stage, the offset angle is determined as the offset compensation angle; If it is determined that the motor is not in the high-frequency current operation stage, 0 is determined as the offset compensation angle.
[0008] In one embodiment, the high-frequency current extraction of the three-phase current to obtain the high-frequency d-axis current and the high-frequency q-axis current includes: The three-phase currents are subjected to Clark transformation and Park transformation to obtain the d-axis feedback current and q-axis feedback current; High-frequency current extraction is performed on the d-axis feedback current and the q-axis feedback current to obtain high-frequency d-axis current and high-frequency q-axis current.
[0009] In one embodiment, the step of performing high-frequency current extraction on the d-axis feedback current and the q-axis feedback current to obtain high-frequency d-axis current and high-frequency q-axis current includes: The difference between the d-axis feedback current corresponding to the current sampling period and the d-axis feedback current corresponding to the previous sampling period is calculated to obtain the d-axis feedback current difference value. The difference between the q-axis feedback current corresponding to the current sampling period and the q-axis feedback current corresponding to the previous sampling period is calculated to obtain the q-axis feedback current difference value. Half of the difference in d-axis feedback current is taken as the high-frequency d-axis current, and half of the difference in q-axis feedback current is taken as the high-frequency q-axis current, so as to obtain the high-frequency d-axis current and the high-frequency q-axis current.
[0010] In one embodiment, determining the offset angle based on the high-frequency d-axis current and the initial offset coefficient when the absolute value of the high-frequency d-axis current is less than a preset current threshold includes: Calculate the difference between the preset current threshold and the absolute value of the high-frequency d-axis current; The product of the difference and the preset offset integral coefficient is integrated to obtain the first integral value; The product of the first integral value and the initial offset coefficient is used as the offset angle.
[0011] In one embodiment, the initial offset coefficient is 1, and adjusting the initial offset coefficient includes: The initial offset coefficient is adjusted to -1.
[0012] In one embodiment, the step of sequentially performing phase-locked loop processing and frequency filtering processing on the high-frequency q-axis current to obtain the filtered frequency includes: The product of the high-frequency q-axis current and the preset integration parameter is integrated to obtain the second integral value; The sum of the product of the high-frequency q-axis current and the preset proportional parameter and the second integral value is taken as the electrical frequency; Multiply the preset filter coefficients by the electrical frequency to obtain the first product; The difference between 1 and the preset filter coefficient is multiplied by the filter frequency corresponding to the previous sampling period to obtain the second product; The sum of the first product and the second product is used as the filter frequency.
[0013] The present invention also proposes a control device, the control device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the motor angle compensation method described above.
[0014] In practical applications, a primary current judgment process quickly identifies significant errors caused by unsuitable injected voltage or initial angle deviation, while a secondary current judgment process further verifies the effectiveness of the compensation action. Specifically, by performing two high-frequency current judgments, online compensation is provided for angle deviations in high-frequency injection convergence caused by unsuitable injected high-frequency square wave voltage or excessive sampling fluctuations. Simultaneously, automatic angle polarity compensation is achieved through online calculation of the filter frequency, integrating polarity judgment into the dynamic compensation process. This directly eliminates the separate "precise initial angle positioning" and "static polarity judgment" steps found in traditional algorithms, improving the stability and reliability of angle convergence. Furthermore, the motor can complete angle polarity correction and offset calculation during the 0 fundamental current startup phase without interruption or additional testing procedures, shortening the motor startup time, simplifying the control logic, and enabling the motor to enter normal operating conditions faster and more smoothly. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating an embodiment of the motor angle compensation method of the present invention. Figure 2 A flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 3 This is a flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 4 A flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 5 A flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 6 This is a flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 7 A flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 8 A flowchart illustrating another embodiment of the motor angle compensation method of the present invention; Figure 9 This is a flowchart illustrating another embodiment of the motor angle compensation method of the present invention.
[0018] The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0019] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of the present invention and are not intended to limit the present invention.
[0020] To better understand the technical solution of the present invention, a detailed description will be provided below in conjunction with the accompanying drawings and specific embodiments.
[0021] High-performance control of permanent magnet synchronous motors relies on accurate acquisition of the rotor's angular position. Traditional solutions primarily rely on position sensors for detection or estimation using positionless control algorithms to obtain the motor angle. For positionless control algorithms, high-frequency injection algorithms are widely used for low-speed and zero-speed operation due to their excellent load-bearing starting capability. However, traditional high-frequency injection algorithms are typically divided into three independent stages: initial positioning, polarity determination, and formal angle identification. This staged control logic not only leads to a cumbersome process and poor continuity, but also requires the insertion of shut-off blank control segments between different stages to reduce high-frequency noise interference, thus prolonging the low-speed starting cycle of the motor. Furthermore, high-frequency injection algorithms are highly sensitive to the amplitude and sampling quality of the injected signal. For example, mismatched injected current and voltage parameters or large sampling fluctuations can easily lead to deviations in the angle after convergence of the high-frequency injection algorithm, thereby affecting control accuracy.
[0022] Therefore, refer to Figure 1 This invention proposes a method for compensating motor angles, the method comprising: Step S100: Inject a high-frequency square wave voltage into the d-axis of the motor so that the motor generates a high-frequency current corresponding to the injected high-frequency square wave voltage. In this embodiment, the motor angle compensation method of the present invention can be applied to a motor control device. The control device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is configured to implement the steps of the motor angle compensation method. The control device can be implemented using a main controller, such as an MCU, DSP (Digital Signal Processor), FPGA (Field Programmable Gate Array), PLC, or SOC (System on Chip).
[0023] In this embodiment, within the vector control framework of motor control, the control device can superimpose a high-frequency, small-amplitude square wave voltage signal onto the d-axis (direct axis) of the motor rotor. This voltage signal is applied to the three-phase windings of the motor through coordinate transformation (such as inverse Park transform). That is, a known, specific frequency excitation signal (such as a high-frequency square wave voltage) is injected into the motor to detect the rotor position. Because the motor itself has magnetic saliency (i.e., the inductances of the d-axis and q-axis are different), this injected high-frequency square wave voltage signal will generate a high-frequency current response carrying rotor position information.
[0024] Optionally, since the d-axis typically corresponds to the direction of the motor's magnetic flux, injecting a signal into the d-axis has relatively little interference with the torque (mainly determined by the q-axis current), and it is convenient to extract position information using the motor's salient pole effect (the difference between Ld and Lq). Therefore, an amplitude of [value missing] can be injected into the d-axis output voltage. Positive and negative high-frequency voltages, with an injection frequency of , Switching frequency Half of it. Therefore, there's no need to set up a complex sine wave lookup table; you only need to output positive and negative voltages respectively within two switching cycles. Taking an 8kHz switching frequency as an example, a 4kHz high-frequency square wave voltage needs to be injected, and one complete high-frequency injection cycle occupies exactly two PWM switching cycles. The injection amplitude in the first switching cycle is... The voltage, the injection amplitude in the second switching cycle is The voltage, the injection amplitude in the third switching cycle is The voltage, and the injection amplitude in the next switching cycle is The voltage, in this alternating "positive-negative-positive-negative" pattern, forms a standard square wave on the d-axis. Compared to sinusoidal wave injection, square wave injection does not require complex trigonometric function calculations, saving computational resources for the control device. It refers to the amplitude of the high-frequency square wave voltage, which can be set by R&D personnel based on the motor voltage level and empirical values, or dynamically adjusted based on the current response during the initial startup phase. .
[0025] In this way, by utilizing the frequency-relationship between the PWM switching frequency and the injected signal frequency (which is twice the frequency), a high-frequency magnetic field disturbance is generated on the d-axis of the motor by alternately applying voltage in each switching cycle. This excites a high-frequency current carrying rotor position information, allowing the control device to identify the rotor position even when the motor is not rotating or is rotating at low speed.
[0026] Step S200: Obtain the three-phase current of the motor, and perform high-frequency current extraction on the three-phase current to obtain the high-frequency d-axis current and the high-frequency q-axis current; In this embodiment, the three-phase currents (Ia, Ib, Ic) of the motor can be acquired using a current sensor. Then, the three-phase currents are transformed to an estimated rotating coordinate system using coordinate transformations (e.g., Clark transform and Park transform) to obtain the d-axis current (Id) and q-axis current (Iq). Then, using a bandpass filter or a preset signal processing algorithm (e.g., differential method), the high-frequency components with the same frequency as the injected square wave are separated from the total Id and Iq, thus obtaining the high-frequency d-axis current (Ia, Ib, Ic). ) and high-frequency q-axis current ( In this way, the fundamental current used for torque control and the high-frequency current used for position estimation can be separated.
[0027] Understandably, if a current sensor used to detect the current in one phase fails, the currents in the other two phases can be used for calculation.
[0028] Step S300: Within the preset time of motor start-up, if the absolute value of the high-frequency d-axis current is less than the preset current threshold, determine the offset angle based on the high-frequency d-axis current and the initial offset coefficient. In this embodiment, during the initial stage of motor startup (e.g., the first 0.2 seconds), the control device only injects a high-frequency signal to estimate the position, but does not output the fundamental current (i.e., torque current) used to drive the motor rotation. At this time, the motor is in a "stationary detection" state. That is, during the motor startup process from 0 RPM, a short startup time t0 with zero fundamental current is reserved at the very beginning of the high-frequency injection startup. The preset duration t0 can be set by the R&D personnel, for example, t0 can be set within 0.2 seconds. If it is within 0.2 seconds, a high-frequency current judgment is performed; otherwise, the high-frequency current judgment is skipped, and normal high-frequency injection phase-locked loop estimation of frequency angle and motor startup process is performed. In other words, the quality of angle estimation is judged within the t0 window period. Once the t0 time exceeds (t>t0), regardless of the result, the motor will enter the normal startup process, that is, it will start outputting the fundamental current to make the motor rotate, and continue to use a conventional phase-locked loop (PLL) for angle estimation. This reduces the risk of unnecessary judgments interfering with the normal operation of the motor after it has already started.
[0029] Understandably, ideally, if the estimated rotor d-axis perfectly coincides with the actual d-axis of the motor (i.e., the estimated angle of the high-frequency injection is correct), then the current response generated by the high-frequency voltage injected into the d-axis should also be entirely on the d-axis. In this case, the high-frequency current on the q-axis... It should be close to 0; the high-frequency current response will be mainly concentrated on the d-axis. The magnitude of this value directly reflects the error in angle estimation. In this embodiment, when there is a deviation in the estimated angle, the high-frequency current response will "leak" to the q-axis, causing the current response on the d-axis to be affected. The amplitude decreases. Therefore, The amplitude of the high-frequency d-axis current can be used as an indicator of the quality of angle estimation. When the absolute value of the high-frequency d-axis current is less than the preset current threshold, it indicates that the current high-frequency current response amplitude is too low, and the angle estimation has a large deviation, requiring compensation. Therefore, the subsequent offset angle calculation process can be executed (e.g., determining the offset angle based on the high-frequency d-axis current and the initial offset coefficient). When the absolute value of the high-frequency d-axis current is greater than or equal to the preset current threshold, it indicates that the high-frequency current response amplitude is strong enough, the angle estimation is relatively accurate, and the deviation is within an acceptable range. No compensation is needed, and the offset angle calculation process can be skipped directly, using the currently estimated angle for startup, thus simplifying the process and improving efficiency.
[0030] It should be noted that the preset current threshold Characterized at the current injection voltage and motor parameters ( The theoretically maximum high-frequency current that can be generated under these conditions. The formula for calculating the preset current threshold is: ; in, The coefficient used to calculate the threshold is typically between 0.7 and 0.8. The injected high-frequency square wave voltage, Bus voltage For the PWM period, This is the motor inductance.
[0031] Step S400: If the absolute value of the high-frequency d-axis current corresponding to the current sampling period is less than the absolute value of the high-frequency d-axis current corresponding to the historical sampling period, adjust the initial offset coefficient. The initial offset coefficient is 1, and adjusting the initial offset coefficient includes: The initial offset coefficient is adjusted to -1.
[0032] In this embodiment, after the first current judgment (determining whether the absolute value of the high-frequency d-axis current is less than a preset current threshold) is performed, the control device can wait for N sampling periods, for example, N=10. After the wait is over, the control device will perform a second current judgment, determining the absolute value of the high-frequency d-axis current in the current sampling period. Is it less than the absolute value of the high-frequency d-axis current of the historical sampling period? In this embodiment, N=10, and the historical sampling period is 10, that is... This is the absolute value of the high-frequency d-axis current ten sampling periods ago. If... Less than This indicates that after this period of adjustment, the high-frequency response has actually weakened. This usually means that we adjusted in the wrong direction, causing the estimated angle to deviate from the true position, or that oscillations have occurred. Therefore, it is necessary to check the offset coefficient and adjust the initial offset coefficient kpor from the default value of 1 to -1 to prevent the error from expanding further.
[0033] Step S500: If the absolute value of the high-frequency d-axis current corresponding to the current sampling period is greater than or equal to the absolute value of the high-frequency d-axis current corresponding to the historical sampling period, keep the initial offset coefficient unchanged. if Greater than or equal to This indicates that after adjustment, the high-frequency response has not weakened and is closer to the actual position, meaning the motor system is in a relatively stable state. Therefore, no additional offset coefficient verification is needed; simply maintain the current offset coefficient and continue operating. The initial offset coefficient remains at its default value of 1.
[0034] Step S600: Perform phase-locked loop processing and frequency filtering processing on the high-frequency q-axis current in sequence to obtain the filtering frequency; In this embodiment, the extracted high-frequency q-axis current ( The signal is fed into the phase-locked loop (PLL). The PLL will track the signal. The phase information in the signal outputs a frequency signal related to the rotor position. This frequency signal is then filtered (e.g., low-pass filtered) to remove noise and jitter, resulting in a smooth and accurate estimated frequency (i.e., the filtered frequency). This allows the acquisition of the motor rotor's real-time speed information.
[0035] Step S700: Perform online compensation processing on the motor angle based on the offset angle and the filtering frequency to obtain the compensated motor angle.
[0036] In this embodiment, reference Figure 9 Online compensation processing can include four steps: high-frequency comparison, polarity angle compensation, offset angle compensation, and output angle calculation. For example, if the sign and magnitude of the filtered frequency meet specific conditions, the initial angle polarity is determined to be incorrect, and 180° (π) compensation is required. The offset angle calculated by S300-S500 and the result of the polarity judgment (0 or π) are then superimposed on the basic estimated angle (motor angle) to obtain the final compensated motor angle.
[0037] In practical applications, a primary current judgment process quickly identifies significant errors caused by unsuitable injected voltage or initial angle deviation, while a secondary current judgment process further verifies the effectiveness of the compensation action. Specifically, by performing two high-frequency current judgments, online compensation is provided for angle deviations in high-frequency injection convergence caused by unsuitable injected high-frequency square wave voltage or excessive sampling fluctuations. Simultaneously, automatic angle polarity compensation is achieved through online calculation of the filter frequency, integrating polarity judgment into the dynamic compensation process. This directly eliminates the separate "precise initial angle positioning" and "static polarity judgment" steps found in traditional algorithms, improving the stability and reliability of angle convergence. Furthermore, the motor can complete angle polarity correction and offset calculation during the 0 fundamental current startup phase without interruption or additional testing procedures, shortening the motor startup time, simplifying the control logic, and enabling the motor to enter normal operating conditions faster and more smoothly.
[0038] In another embodiment, reference Figure 2 The online compensation process for the motor angle based on the offset angle and the filtering frequency to obtain the compensated motor angle includes: Step S510: Determine the polarity compensation angle based on the set speed and the filter frequency, and determine the offset compensation angle based on the motor's operating stage and the offset angle. Step S520: The sum of the polarity compensation angle, the offset compensation angle, and the motor angle is taken as the compensated motor angle.
[0039] In this embodiment, the set rotational speed represents the desired speed of motor rotation. If the output control command is to control the motor to rotate forward, but the feedback speed is reversed, it indicates that the polarity of the angle estimation is reversed, and correction is needed. Simultaneously, during the low-speed start-up phase of the motor, the high-frequency injection method is easily affected by parameter deviations or noise, leading to inaccurate convergence angles. In this case, it is necessary to determine and correct the offset compensation angle to ensure smooth motor start-up without jitter. However, after the motor enters high-speed operation, the back electromotive force method (or flux linkage observer) is generally more accurate than the high-frequency injection method. At this point, if the offset angle from the low-frequency phase is forcibly superimposed, it may introduce errors or cause instability; in this case, the offset compensation angle can be 0.
[0040] refer to Figure 3 The step of determining the polarity compensation angle based on the set rotational speed and the filter frequency includes: Step S511: When the set rotational speed is greater than 0 and the filter frequency is less than the negative value of the reverse minimum rotational speed frequency, set the polarity error flag bit to 1. Step S512: When the set rotational speed is less than 0 and the filter frequency is greater than the positive value of the reverse minimum rotational speed frequency, set the polarity error flag bit to 1.
[0041] In this embodiment, the control device needs to perform high-frequency comparison. If the control device outputs a desired speed command to the motor based on preset commands such as input user instructions, the motor is required to rotate forward. If the desired speed command requires the motor to rotate in reverse, the motor is set to be less than 0.
[0042] In this embodiment, when the desired speed command requires the motor to rotate forward, the filter frequency Freq should be positive (greater than 0). If the filter frequency is negative and less than the negative value of the minimum reverse speed frequency (Freq <- FreqSet), it indicates that the motor is clearly rotating in reverse. That is, the desired speed command commands forward rotation but it is actually rotating violently in reverse, indicating an error in polarity judgment (the angle estimation is off by 180°, causing the magnetic field thrust direction to be reversed). At this time, the polarity error flag bit FlagPor needs to be set to 1 for subsequent 180° angle correction, so the polarity error flag bit FlagPor is set to 1. When the desired speed command requires the motor to rotate in reverse, the filter frequency Freq should be negative (less than 0). If the filter frequency is greater than the minimum reverse speed frequency (Freq > FreqSet), it indicates that the motor is clearly rotating forward, which also indicates an error in polarity judgment, requiring correction, so the polarity error flag bit FlagPor is set to 1. Thus, if FlagPor is set to 1, polarity angle compensation is performed, and the polarity compensation angle Theta_Por = pi; otherwise, the polarity compensation angle Theta_Por = 0.
[0043] It should be noted that the minimum reverse speed frequency FreqSet represents the minimum speed frequency determined by the direction of convergence speed being opposite to the desired speed. It can be set by the R&D personnel, and it can generally be set to 20-30Hz to prevent misjudgment caused by positive and negative fluctuations in convergence near 0 speed.
[0044] refer to Figure 4 The step of determining the offset compensation angle based on the motor's operating stage and the offset angle includes: Step S513: When it is determined that the motor is in the high-frequency current operation stage, the offset angle is determined as the offset compensation angle. Step S514: If it is determined that the motor is not in the high-frequency current operation stage, 0 is determined as the offset compensation angle.
[0045] In this embodiment, the control device also needs to determine whether the motor is currently in the high-frequency current operation stage. It should be noted that the high-frequency current operation stage typically refers to the motor being in the low-speed or zero-speed stage, where the high-frequency injection method is primarily used. During the low-speed start-up stage, the high-frequency injection method is easily affected by parameter deviations or noise, leading to inaccurate convergence angles. In this case, this offset angle must be used for correction to ensure smooth motor start-up without jitter. If it is determined that the motor is not in the high-frequency current operation stage (usually meaning the motor has accelerated into medium-high speed and switched to back EMF observer mode), the offset compensation angle is forcibly set to 0. This is because when the motor enters high-speed operation, the back EMF method (or flux linkage observer) is usually more accurate than the high-frequency injection method. If the offset angle from the low-frequency stage is forcibly superimposed at this time, it may introduce errors or cause instability.
[0046] In this embodiment, the control device can determine whether the motor is currently in the "high-frequency current operation stage" (i.e., low-speed or zero-speed start-up stage) based on the received flag bit or state variable. If the high-frequency current operation stage is met, the offset angle (Theta_off) calculated and calibrated through steps S300-S500 is assigned to the final offset compensation angle (Theta_os), that is, the offset compensation angle Theta_os = Theta_off. Conversely, if it is not in the "high-frequency current operation stage", the offset compensation angle Theta_os = 0.
[0047] Based on the above embodiments, the motor angle before compensation is Theta_before = Theta_beforeZ1 + Freq * Tpwm, where Theta_beforeZ1 is the motor angle before compensation calculated in the previous step. The motor angle after compensation is Theta_out = Theta_before + Theta_Por + Theta_os. Here, Theta_Por is the polarity compensation angle, and Theta_os is the offset compensation angle. Thus, the compensated angle Theta_out is used as the output angle and output to the functional modules required for motor control, thereby completing the entire motor control during low-speed operation.
[0048] In another embodiment, reference Figure 5 The step of extracting high-frequency current from the three-phase current to obtain high-frequency d-axis current and high-frequency q-axis current includes: Step S210: Perform Clark transformation and Park transformation on the three-phase current to obtain the d-axis feedback current and q-axis feedback current; Step S220: Perform high-frequency current extraction on the d-axis feedback current and the q-axis feedback current to obtain high-frequency d-axis current and high-frequency q-axis current.
[0049] In this embodiment, the Clark transformation is used to transform the current collected in the three-phase stationary coordinate system (…). , , ) converted to current in a two-phase stationary coordinate system ( and The Park transformation refers to using the currently estimated angle (θ) to... and The rotational transformation results in currents in a two-phase rotating coordinate system: the d-axis feedback current and the q-axis feedback current. The high-frequency injected signal is superimposed on the d-axis voltage; therefore, the actual sampled current must be transformed to the same rotating coordinate system (dq-axis) to observe the response generated by the injected signal. Only in the dq-axis system can it be distinguished which currents are the fundamental currents used to generate torque and which are the high-frequency response currents used to estimate position. Therefore, the Clark and Park transformations can unify the reference frame.
[0050] refer to Figure 6 Step S220 includes: Step S221: Subtract the d-axis feedback current corresponding to the current sampling period from the d-axis feedback current corresponding to the previous sampling period to obtain the d-axis feedback current difference value; and subtract the q-axis feedback current corresponding to the current sampling period from the q-axis feedback current corresponding to the previous sampling period to obtain the q-axis feedback current difference value. In this embodiment, since the injected wave is a square wave with alternating positive and negative polarities, the high-frequency current response has opposite polarities (one positive and one negative) in adjacent cycles, while the fundamental current (the current generated by the motor operation) changes relatively slowly and can be considered to remain basically unchanged in adjacent cycles. The fundamental current can be eliminated by subtraction. The Park transform requires the motor angle. Since the angle of the current PWM cycle has not yet been estimated, the angle of the previous cycle needs to be used for estimation, i.e., Theta_pre = Theta_Z1 + Freq_Z1 * Tpwm, where Theta_Z1 is the motor angle estimated in the previous PWM cycle by high-frequency injection, Freq_Z1 is the motor frequency estimated in the previous PWM cycle by high-frequency injection, Tpwm is the PWM cycle, and Theta_pre is the angle of the previous cycle.
[0051] Step S222: Take half of the difference in d-axis feedback current as the high-frequency d-axis current, and take half of the difference in q-axis feedback current as the high-frequency q-axis current, so as to obtain the high-frequency d-axis current and the high-frequency q-axis current.
[0052] In this embodiment, the difference value processed by subtraction is twice the amplitude of the high-frequency current (because it is a superposition of positive and negative values). Therefore, in order to restore the true amplitude of the high-frequency current response, half of the difference of the d-axis feedback current needs to be used as the high-frequency d-axis current, and half of the difference of the q-axis feedback current needs to be used as the high-frequency q-axis current.
[0053] In this embodiment, the d-axis feedback current is The q-axis feedback current is Then, by extracting the high-frequency current based on the d-axis feedback current and the q-axis feedback current, the high-frequency d-axis current can be obtained. and high-frequency q-axis current .
[0054] In this embodiment, the formula for calculating the high-frequency d-axis current is: The formula for calculating the high-frequency q-axis current is: , in This is the d-axis feedback current obtained from the previous PWM cycle. This is the q-axis feedback current obtained in the previous PWM cycle.
[0055] The simple subtraction operation significantly reduces the computational burden on the control device. By using the estimated angle and frequency from the previous PWM cycle to compensate for the control delay, it ensures that the coordinate transformation angle is updated in real time during signal processing in the current cycle. This reduces the risk of signal distortion caused by angle lag and improves the accuracy of high-frequency signal extraction.
[0056] In one embodiment, reference Figure 7 The step of determining the offset angle based on the high-frequency d-axis current and the initial offset coefficient when the absolute value of the high-frequency d-axis current is less than a preset current threshold includes: Step S310: Calculate the difference between the preset current threshold and the absolute value of the high-frequency d-axis current; Step S320: Integrate the product of the difference and the preset offset integral coefficient to obtain the first integral value; Step S330: The product of the first integral value and the initial offset coefficient is used as the offset angle.
[0057] Optionally, the offset angle is greater than or equal to -90 degrees and less than or equal to 90 degrees.
[0058] In this embodiment, the difference between the absolute value of the high-frequency d-axis current and the preset current threshold is equivalent to the calculation error. If the difference is 0 (or close to 0), it means that the absolute value of the high-frequency d-axis current, abs(IdH), has reached the theoretical maximum value, the angle estimation is accurate, and no compensation is needed. If the difference is large (positive), it means that abs(IdH) is much smaller than the theoretical value, which means that the estimated angle deviates from the actual rotor position, causing the high-frequency current response to "leak" to the q-axis, and the d-axis response to weaken. This difference is the "error" that we need to eliminate. Therefore, the product of the difference and the preset offset integral coefficient is integrated to obtain the first integral value. That is, the difference is multiplied by an integral coefficient, and the product is integrated to obtain the first integral value. Then, the integral value is multiplied by the initial offset coefficient to obtain the offset angle. That is, the formula for calculating the offset angle is: Theta_off = kpor*∫ki_off*(IdH_Val–abs(IdH)), where kpor is the initial offset coefficient, which is 1 by default, ki_off is the preset offset integral coefficient, and abs is the absolute value function.
[0059] It should be noted that since the angle error of high-frequency injection usually does not exceed 90 degrees, if the calculated compensation angle is too large, it indicates that the system is abnormal (such as sensor failure or severe interference). Therefore, the offset angle is limited to between -pi / 2 and pi / 2 to prevent the motor from going out of control or reversing due to an excessively large compensation angle.
[0060] In another embodiment, reference Figure 8 The step of sequentially performing phase-locked loop processing and frequency filtering on the high-frequency q-axis current to obtain the filtered frequency includes: Step S710: Integrate the product of the high-frequency q-axis current and the preset integration parameter to obtain a second integral value; Step S720: The sum of the product of the high-frequency q-axis current and the preset proportional parameter and the second integral value is taken as the electrical frequency; Step S730: Multiply the preset filter coefficients by the electrical frequency to obtain the first product; Step S740: Multiply the difference between 1 and the preset filter coefficient by the filter frequency corresponding to the previous sampling period to obtain the second product; Step S750: The sum of the first product and the second product is used as the filter frequency.
[0061] In this embodiment, the high-frequency q-axis current With preset integration parameters Integrate the product to obtain the second integral value. Then, the high-frequency q-axis current is compared with a preset proportional parameter. product The sum of the second integral value and the electrical frequency Set the preset filter coefficients With electrical frequency Multiply to obtain the first product. Then, 1 is compared with the preset filter coefficient. The difference between the filter frequency corresponding to the previous sampling period and the filter frequency of the previous sampling period Multiply to obtain the second product. The sum of the first and second products is used as the filter frequency. .
[0062] In this embodiment, the formula for calculating the electrical frequency is: ; The formula for calculating the filter frequency is: , in, For preset ratio parameters, For preset integration parameters, The preset filter coefficients, The filter frequency of the previous PWM cycle is injected into the high frequency.
[0063] The present invention also proposes a control device, the control device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the motor angle compensation method described above.
[0064] The control device provided by this invention is based on the motor angle compensation method described above. Compared with the prior art, the beneficial effects of the control device provided by this invention are the same as those of the motor angle compensation method provided in the above embodiments, and other technical features in the control device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0065] The above description is only a part of the embodiments of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made under the technical concept of the present invention using the contents of the present invention specification and drawings, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. A method for compensating motor angle, characterized in that, The method for compensating for the motor angle includes: Inject a high-frequency square wave voltage into the d-axis of the motor so that the motor generates a high-frequency current corresponding to the injected high-frequency square wave voltage. The three-phase current of the motor is obtained, and high-frequency current extraction is performed on the three-phase current to obtain the high-frequency d-axis current and high-frequency q-axis current. Within a preset time period of motor start-up, if the absolute value of the high-frequency d-axis current is less than a preset current threshold, the offset angle is determined based on the high-frequency d-axis current and the initial offset coefficient. If the absolute value of the high-frequency d-axis current corresponding to the current sampling period is less than the absolute value of the high-frequency d-axis current corresponding to the historical sampling period, the initial offset coefficient is adjusted. If the absolute value of the high-frequency d-axis current corresponding to the current sampling period is greater than or equal to the absolute value of the high-frequency d-axis current corresponding to the historical sampling period, the initial offset coefficient remains unchanged. The high-frequency q-axis current is subjected to phase-locked loop processing and frequency filtering processing in sequence to obtain the filtering frequency; The motor angle is compensated online based on the offset angle and the filtering frequency to obtain the compensated motor angle.
2. The motor angle compensation method as described in claim 1, characterized in that, The online compensation process for the motor angle based on the offset angle and the filtering frequency to obtain the compensated motor angle includes: The polarity compensation angle is determined based on the set rotational speed and the filter frequency, and the offset compensation angle is determined based on the motor's operating stage and the offset angle. The sum of the polarity compensation angle, the offset compensation angle, and the motor angle is taken as the compensated motor angle.
3. The motor angle compensation method as described in claim 2, characterized in that, The process of determining the polarity compensation angle based on the set rotational speed and the filter frequency includes: When the set rotational speed is greater than 0 and the filter frequency is less than the negative value of the reverse minimum rotational speed frequency, the polarity error flag is set to 1; When the set rotational speed is less than 0 and the filter frequency is greater than a positive value of the reverse minimum rotational speed frequency, the polarity error flag is set to 1.
4. The motor angle compensation method as described in claim 2, characterized in that, Determining the offset compensation angle based on the motor's operating stage and the offset angle includes: When it is determined that the motor is in the high-frequency current operation stage, the offset angle is determined as the offset compensation angle; If it is determined that the motor is not in the high-frequency current operation stage, 0 is determined as the offset compensation angle.
5. The motor angle compensation method as described in claim 1, characterized in that, The step of extracting high-frequency current from the three-phase current to obtain high-frequency d-axis current and high-frequency q-axis current includes: The three-phase currents are subjected to Clark transformation and Park transformation to obtain the d-axis feedback current and q-axis feedback current; High-frequency current extraction is performed on the d-axis feedback current and the q-axis feedback current to obtain high-frequency d-axis current and high-frequency q-axis current.
6. The motor angle compensation method as described in claim 5, characterized in that, The step of extracting high-frequency current from the d-axis feedback current and the q-axis feedback current to obtain high-frequency d-axis current and high-frequency q-axis current includes: The difference between the d-axis feedback current corresponding to the current sampling period and the d-axis feedback current corresponding to the previous sampling period is calculated to obtain the d-axis feedback current difference value. The difference between the q-axis feedback current corresponding to the current sampling period and the q-axis feedback current corresponding to the previous sampling period is calculated to obtain the q-axis feedback current difference value. Half of the difference in d-axis feedback current is taken as the high-frequency d-axis current, and half of the difference in q-axis feedback current is taken as the high-frequency q-axis current, so as to obtain the high-frequency d-axis current and the high-frequency q-axis current.
7. The motor angle compensation method as described in claim 1, characterized in that, When the absolute value of the high-frequency d-axis current is less than a preset current threshold, determining the offset angle based on the high-frequency d-axis current and the initial offset coefficient includes: Calculate the difference between the preset current threshold and the absolute value of the high-frequency d-axis current; The product of the difference and the preset offset integral coefficient is integrated to obtain the first integral value; The product of the first integral value and the initial offset coefficient is used as the offset angle.
8. The motor angle compensation method as described in claim 1, characterized in that, The initial offset coefficient is 1, and adjusting the initial offset coefficient includes: The initial offset coefficient is adjusted to -1.
9. The motor angle compensation method as described in claim 1, characterized in that, The process of sequentially performing phase-locked loop processing and frequency filtering on the high-frequency q-axis current to obtain the filtered frequency includes: The product of the high-frequency q-axis current and the preset integration parameter is integrated to obtain the second integral value; The sum of the product of the high-frequency q-axis current and the preset proportional parameter and the second integral value is taken as the electrical frequency; Multiply the preset filter coefficients by the electrical frequency to obtain the first product; The difference between 1 and the preset filter coefficient is multiplied by the filter frequency corresponding to the previous sampling period to obtain the second product; The sum of the first product and the second product is used as the filter frequency.
10. A control device, characterized in that, The control device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the motor angle compensation method as described in any one of claims 1 to 9.