Motor adaptive angle correction method

By using elliptic correction and online residual correction methods based on orthogonal Hall sensor pairs, the jitter problem caused by manufacturing defects in the drone gimbal motor was solved, reducing costs and improving product quality. This method is suitable for drone gimbal applications that are sensitive to size, weight, and cost.

CN122247277APending Publication Date: 2026-06-19SHINE OPTICS TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHINE OPTICS TECH CO LTD
Filing Date
2026-03-11
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

The drive motors of terminal devices such as drone gimbals have manufacturing defects in the mass production supply chain, such as uneven magnetization, magnetic pole eccentricity, and back EMF distortion. These defects lead to torque pulsation, speed tooth ripple, and increased noise, affecting the user experience. Furthermore, traditional control strategies rely on high-precision sensors and expensive encoders, which increases costs and reduces yield.

Method used

An orthogonal Hall sensor is used for elliptic correction. The mechanical angle is calculated and residuals are corrected through offline calibration and online correction methods. The residual compensation value is dynamically updated by combining the exponential weighted moving average method and double buffering technology, which reduces the dependence on high-precision hardware.

Benefits of technology

It reduces hardware and software costs, improves supply chain utilization and product cost-effectiveness, can adapt to motor manufacturing defects, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122247277A_ABST
    Figure CN122247277A_ABST
Patent Text Reader

Abstract

This invention discloses a method for adaptive angle correction of a motor, comprising: pre-installing a pair of orthogonal Hall sensors on the stator of the motor and determining elliptic correction compensation parameters; writing the offline residual value of the mechanical angle into a worksheet in an offline state; calculating and detecting the mechanical angle through elliptic correction in an online working state; querying the first residual correction value in the worksheet to correct the detected mechanical angle, using the corrected mechanical angle as the real-time mechanical angle; calculating the second residual correction value based on the detected mechanical angle and the current theoretical predicted value of the mechanical angle and writing it into a shaded table; performing a replacement operation at predetermined intervals, replacing the worksheet with the shaded table. In this invention, compensation is not dependent on current loop feedback, which simplifies the structure of the control system; the double-buffered structure enables dynamic updating of the residual compensation value without stopping or restarting the motor control system, continuously absorbing slow-changing errors such as motor temperature drift and aging without interrupting control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of motor control, and in particular relates to a method for adaptive angle correction of a motor. Background Technology

[0002] For terminal devices such as drone gimbals that are highly sensitive to size, weight, and cost, their drive motors (such as permanent magnet synchronous motors and brushless DC motors) often suffer from manufacturing defects in the mass production supply chain, such as uneven magnetization, magnetic pole eccentricity, back EMF distortion, Hall amplitude and phase mismatch, and inconsistent six-sector angle width. These defects can cause torque pulsation (leading to jitter), speed tooth ripple (leading to unstable speed), and increased noise during motor operation. Ultimately, this is reflected in the gimbal screen as image jitter, which seriously affects the user experience.

[0003] In the traditional SVPWM+FOC (with current loop feedback) control architecture, to suppress these defects, the system must rely on high-precision current sensors and expensive encoders, and can only use the highest quality motors. This strategy directly leads to soaring material costs and a decline in supply chain yield due to excessively high motor quality requirements. Therefore, to effectively reduce system costs, it is necessary to improve the control algorithm. By developing a more intelligent control strategy, the system can be made "fault-tolerant," that is, able to "tolerate" the inherent defects of the motor, thereby reusing "inferior motors" that were originally rejected due to manufacturing defects, thus optimizing the overall system cost. Summary of the Invention

[0004] In view of the shortcomings of the prior art, the technical problem to be solved by the present invention is to provide a method for adaptive angle correction of motors.

[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: A method for adaptive angle correction of a motor includes the following steps: S100. Install a pair of quadrature Hall sensors on the stator of the motor in advance, and determine the elliptic correction compensation parameters of the quadrature Hall sensor pair through offline calibration. S200. In offline mode, calibrate the offline residual value corresponding to each mechanical angle of the motor, use the offline residual value as the first residual correction value, and write the correspondence between the mechanical angle and the first residual correction value into the worksheet. S300: When the motor is in online working condition, the original output signal of the orthogonal Hall sensor pair is elliptic corrected according to the elliptic correction compensation parameter, and the detection mechanical angle is calculated based on the elliptic corrected output signal of the orthogonal Hall sensor pair. S400: Query the corresponding first residual correction value in the worksheet based on the detected machine angle, correct the detected machine angle using the first residual correction value, and use the corrected machine angle as the real-time machine angle. S500: Calculate the second residual correction value based on the detected machine angle and the current theoretical prediction value of the machine angle, and write the correspondence between the machine angle and the second residual correction value into the shaded table. S600: Perform a replacement operation at predetermined intervals, using a shaded table to replace the worksheet.

[0006] Furthermore, in step S500, the online residual value of the machine angle is calculated based on the detected machine angle and the current theoretical prediction value of the machine angle, and the online residual value is learned by the exponential weighted moving average method to obtain the second residual correction value.

[0007] Furthermore, in step S600, a consistency check is performed on the shadow table before the replacement operation is executed. If the consistency check passes, the replacement operation is executed; otherwise, the replacement operation is abandoned.

[0008] Furthermore, the consistency check of the shadow table includes the following sub-steps: The absolute value of all second residual correction values ​​in the shadow table is checked. If the absolute value of any second residual correction value is greater than the preset residual threshold, the consistency check is deemed to have failed. After verifying that all vector sectors of the electrical angles corresponding to each magnetic pole of the motor can be smoothly connected at the boundary after using the shaded table as the worksheet, the consistency check is deemed to have failed.

[0009] Furthermore, in step S600, the worksheet is replaced entirely using an atomic switching method when performing the replacement operation.

[0010] Furthermore, the motor is applied to scenarios where rotation is restricted. The mechanical angle region where the motor can rotate normally during use is defined as the ROI sector, and a space window is set on both sides of the ROI sector. In step S400, if the detected mechanical angle is located in the ROI sector, the detected mechanical angle is corrected by the first residual correction value, and the corrected mechanical angle is used as the real-time mechanical angle. If the detected mechanical angle is located in the space window region, the weighted sum of the detected mechanical angle and the corrected mechanical angle is used as the real-time mechanical angle. If the detected mechanical angle is located in an area outside the ROI sector and the space window, the detected mechanical angle is directly used as the real-time mechanical angle.

[0011] Furthermore, the quadrature Hall sensor pair includes a sine Hall sensor and a cosine Hall sensor, wherein the original output signal of the cosine Hall sensor is... The original output signal of the sinusoidal Hall sensor is ; The elliptic correction compensation parameters include a 2×1 DC offset matrix. and 2×2 affine transformation matrix ;in, , This represents the DC offset of the cosine Hall sensor. This indicates the DC offset of the sinusoidal Hall sensor.

[0012] Furthermore, the method for determining the elliptic correction compensation parameters includes the following sub-steps: S110. Run the motor at a constant speed under no-load for at least one revolution at low to medium speed to collect the raw output signal of the cosine Hall sensor. The original output signal of the sinusoidal Hall sensor And calculate the DC offset of the cosine Hall sensor. DC offset of the sinusoidal Hall sensor ; S120, convert the original output signal and The corresponding DC offsets are removed to obtain the decentering signal. and ; S130, Decentering signals are processed using a whitening algorithm. and Mapping an ellipse to a unit circle of equal amplitude and orthogonality, the calculated whitening matrix is ​​then... As an affine transformation matrix .

[0013] Furthermore, the whitening matrix was calculated. The method includes the following sub-steps: S135, Based on the decentralization signal and Calculate the covariance matrix ; S136, Regarding the covariance matrix Eigenvalue decomposition yields orthogonal and diagonal matrices, as shown in the formula:

[0014] in, It is a 2×2 orthogonal matrix, and its column vectors point in the directions of the major and minor axes of the ellipse; It is a 2×2 diagonal matrix. , It is a diagonalization function; Represents the variance along the major axis. Represents the variance along the minor axis; S137. Calculate the whitening matrix. The calculation formula is: .

[0015] Furthermore, in step S300, the compensation formula for elliptic correction of the original output signal of the orthogonal Hall sensor pair is as follows:

[0016] In the formula, This represents the raw output signal of the cosine Hall sensor. The elliptic-corrected output signal obtained after elliptic correction; The original output signal of the sinusoidal Hall sensor is The elliptic-corrected output signal obtained after elliptic correction; Represents the original data matrix. ; In step S300, the detection machine angle is calculated. The formula is:

[0017] in, This is an enhanced version of the standard arctangent function, representing the angle value between -180° and 180° in the calculation result of the standard arctangent function; This represents the zero-position alignment correction value for the mechanical angle.

[0018] This invention eliminates the phase current closed loop in the classic SVPWM+FOC architecture, thus saving the hardware cost and software overhead of the high-precision current sampling link. Furthermore, it does not rely on a high-resolution encoder, using only two low-cost quadrature Hall elements as the sole position sensor. It boasts extremely low hardware BOM cost, low computational resources, and powerful software correction capabilities for motor manufacturing defects. The structure is extremely simple, with low computational load and low processor requirements. It is particularly suitable for applications such as UAV gimbals that are highly sensitive to cost, size, and weight, and whose dynamic performance requirements are not extreme. It can correct traditionally defective motors to a usable or even good level, significantly improving supply chain utilization and product cost-effectiveness. The dual-buffered structure allows for dynamic updates of residual compensation values ​​without stopping or restarting the motor control system, continuously absorbing slow-changing errors such as motor temperature drift and aging without interrupting control. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a block diagram of the SVPWM+FOC hardware architecture with current loop feedback in an existing motor control system.

[0020] Figure 2 This is a flowchart of an embodiment of the motor adaptive angle correction method of the present invention.

[0021] Figure 3 This is a hardware architecture block diagram of the motor control system in this embodiment. Detailed Implementation

[0022] The following specific examples illustrate the implementation of the present invention. The illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0023] Motor control systems typically employ a combination of FOC (Field-Oriented Control) and SVPWM (Space Vector Pulse Width Modulation) to generate corresponding motor control signals based on real-time electrical angles. The existing hardware architecture of motor control systems is as follows: Figure 1 As shown.

[0024] The core concept of FOC (Focus on Current Loop Feedback) is to control AC motors in the same way as DC motors. The working process of an FOC with current loop feedback includes the following parts: First, coordinate transformation: mapping AC to DC. A Clark transformation (i.e., 3-phase to 2-phase) is performed to convert the measured phase currents (Ia, Ib, Ic) in the three-phase stationary coordinate system (a, b, c) into equivalent currents (Iα, Iβ) in the two-phase stationary coordinate system (α, β). This reduces the number of variables, but the current remains an AC quantity.

[0025] Then, a Park transformation (i.e., stationary to rotating) is performed. Using the real-time electrical angle θ of the motor rotor obtained from the sensor, (Iα, Iβ) is transformed into a two-phase rotating coordinate system (d, q) that rotates synchronously with the rotor's magnetic field, resulting in (Id, Iq). Here, the d-axis (direct axis) is aligned with the direction of the rotor's permanent magnet magnetic field, and Id controls the excitation component. The q-axis (quadrature axis) leads the d-axis by 90°, and Iq controls the torque component. In this coordinate system that rotates synchronously with the rotor, Id and Iq are no longer sinusoidal alternating currents, but adjustable direct currents.

[0026] Second, the core control: Controlled like a DC motor, in the dq rotating coordinate system, the control objective becomes very simple, as detailed below: (1) Torque control: The electromagnetic torque is proportional to Iq. Therefore, the motor torque can be directly and linearly controlled by controlling Iq. The output of the speed outer loop PI controller is the command value Iq_ref of Iq.

[0027] (2) Magnetic field control: For surface-mounted permanent magnet synchronous motors, Id=0 control is usually adopted, that is, the direct axis current command Id_ref=0. This makes the stator magnetic field perpendicular to the rotor permanent magnet magnetic field, realizing maximum torque control per unit current and the highest efficiency.

[0028] (3) Current loop (inner loop) feedback: Id_ref and Iq_ref are compared with the actual Id and Iq fed back from the Park transformation, and the error is sent to their respective PI controllers. The outputs of these two PI controllers are voltage commands Vd_ref and Vq_ref in the rotating coordinate system. Among them, Vd_ref is the control command for the direct-axis voltage (excitation voltage) Vd, and Vq_ref is the control command for the quadrature-axis voltage (torque voltage) Vq.

[0029] Thirdly, inverse transformation and modulation: the command is transformed back into three-phase voltage, and using the same electrical angle θ, the voltage command (Vd_ref, Vq_ref) in the rotating coordinate system is inversely transformed back into the voltage vector (Valpha, Vbeta) in the stationary coordinate system.

[0030] The core concept of SVPWM is to efficiently synthesize a continuously rotating voltage vector using the discrete states of the switching transistors. The SVPWM algorithm treats the switching states of a three-phase inverter (including six switching transistors) as voltage vectors in the α–β coordinate system. The six switching transistors of the three-phase inverter can combine to form eight basic switching states (six effective vectors and two zero vectors). Within each PWM cycle, the desired voltage vector can be synthesized by combining two adjacent effective vectors and one zero vector at different times. Its goal is to generate a rotating magnetic field in the motor stator that is as circular as possible, thereby reducing torque ripple and current harmonics, improving voltage utilization, and enhancing motor running smoothness.

[0031] However, in the methods described above, current sampling typically requires at least two high-precision, fast-response current sensors (such as a sampling resistor and an operational amplifier) ​​to measure the two-phase current of the motor in real time. Position / speed sensors require high-resolution encoders or resolvers to provide accurate real-time rotor position. θ (For Park transform and inverse transform) and velocity ω m (Used for speed loop feedback).

[0032] Using the above control method, if the motor has uneven magnetization, although the FOC can still operate and achieve closed-loop control of speed and torque, it will introduce a series of negative effects. The most typical manifestations are increased torque ripple, vibration, and noise. Electrically, this will lead to increased q-axis current. Ripple appears in the torque current, while the d-axis current... The excitation current can be disturbed and deviate from zero, causing the effective current value to rise, which in turn increases copper losses and temperature rise, reducing overall efficiency. In severe cases, the motor needs to inject a larger current at certain angles to maintain the load, making it more likely to trigger the current limit or cause controller saturation. During commutation, defects can cause sector switching misalignment or boundary jitter, manifested as: q-axis current A dip or spike appears near the 60° electrical angle boundary, resulting in a strong sense of control discontinuity; d-axis current This produces a typical needle-like pulse spike at the same location, which is a hallmark feature of uneven magnetization faults in the current spectrum.

[0033] Therefore, the aforementioned control method places extremely high demands on the consistency of the motor itself, and its current loop and coordinate transformation are based on the accuracy of the motor parameters. When the motor has defects such as uneven magnetization or back EMF distortion, it will lead to model mismatch. To maintain performance, either more complex parameter identification and compensation algorithms are required, or high-cost motor screening is necessary. In addition, due to the need to perform multiple coordinate transformations and PI calculations of two current loops in real time, the computational complexity is high, and the computing power of the MCU is also highly demanding.

[0034] Please see Figure 2 , Figure 2 This is a flowchart of an embodiment of the motor adaptive angle correction method of the present invention. The motor adaptive angle correction method of this embodiment includes the following steps: S100. Install a pair of quadrature Hall sensors on the stator of the motor in advance, and determine the elliptic correction compensation parameters of the quadrature Hall sensor pair through offline calibration.

[0035] The quadrature Hall sensor pair includes a sine Hall sensor and a cosine Hall sensor, wherein the original output signal of the cosine Hall sensor is defined as... The original output signal of the sinusoidal Hall sensor is defined as follows: .

[0036] Ideally, two perfectly orthogonal Hall sensors at 90° to each other will output signals. and The data trajectories obtained by using the horizontal and vertical axes as coordinates should form a perfect unit circle. The detected mechanical angle can be calculated using the following formula. :

[0037] in, This is an enhanced version of the standard arctangent function, representing the angle value between -180° and 180° in the calculation result of the standard arctangent function.

[0038] However, due to uneven magnetization of the magnet, Hall effect sensor misalignment, and inconsistent chip gain / bias, the actual output signal... and The data trajectory obtained by using the horizontal and vertical axes as coordinates is a tilted, flattened, and offset ellipse. When directly using the above formula for calculation... This will introduce periodic angular errors, resulting in torque pulsation.

[0039] Therefore, the main defects of mass-produced Hall signals are unequal amplitudes, non-strict 90° phases, and signal distortion. The elliptic correction algorithm essentially performs real-time online calibration of the signals from orthogonal Hall sensor pairs, compensating for gain and phase deviations to make the two output signals as close as possible to ideal sine and cosine signals.

[0040] The elliptic correction compensation parameters may include a 2×1 DC offset matrix. and 2×2 affine transformation matrix ;in, , This represents the DC offset of the cosine Hall sensor. This indicates the DC offset of the sinusoidal Hall sensor.

[0041] The method for determining elliptic correction compensation parameters may include the following sub-steps: S110. Run the motor at a constant speed under no-load for at least one revolution (e.g., 1 to 2 revolutions) at a low to medium speed (e.g., 20% to 50% of the motor's rated speed) to collect the raw output signal from the cosine Hall sensor. The original output signal of the sinusoidal Hall sensor And calculate the DC offset of the cosine Hall sensor. DC offset of the sinusoidal Hall sensor Thus, the DC offset matrix is ​​obtained. .

[0042] S120, convert the original output signal and The corresponding DC offsets are removed to obtain the decentering signal. and decentralized signals Thus, a decentralized signal matrix is ​​obtained. ; .in, ; The original data matrix, The above calculations can eliminate the DC bias and move the center of the ellipse to the origin.

[0043] S130, Decentering signals are processed using a whitening algorithm. and Mapping an ellipse to a unit circle of equal amplitude and orthogonality, the calculated whitening matrix is ​​then... As an affine transformation matrix The calculated whitening matrix The method may include the following sub-steps: S131, Based on the decentralization signal and Calculate the covariance matrix Covariance matrix It is a 2×2 matrix containing the variance (diagonal) and covariance (off-diagonal, reflecting correlation and non-orthogonality) of the two signals.

[0044] S132, regarding the covariance matrix Eigenvalue decomposition yields orthogonal and diagonal matrices. Eigenvalue decomposition follows a conventional method, with the following formula:

[0045] in, It is a 2×2 orthogonal matrix (rotation matrix) whose column vectors point in the directions of the major and minor axes of the ellipse. Multiply by This is equivalent to rotating the coordinate system so that the coordinate axes align with the axis of the ellipse, thus eliminating the tilt. It is a 2×2 diagonal matrix (scaling matrix). .in, This is a diagonalization function, meaning that the elements inside the parentheses are placed on the diagonal, and the rest are filled with "0". Represents the variance along the major axis. This represents the variance along the minor axis.

[0046] S133, Calculate the whitening matrix The calculation formula is: .

[0047] The geometric meaning of whitening transformation is: first, rotate the ellipse to align it with the coordinate axes (eliminating correlation), then scale it along the two principal axes until both have a variance of 1. This achieves equal amplitude and orthogonality in one step, transforming the data distribution into a zero-mean, unit-variance, uncorrelated circular point cloud. The calculated whitening matrix... It can be used as an affine transformation matrix. .

[0048] S200. In offline mode, calibrate the offline residual value corresponding to each mechanical angle of the motor (the residual refers to the difference between the actual measured value and the theoretical predicted value of the mechanical angle). Use the offline residual value as the first residual correction value, and write the correspondence between the mechanical angle and the first residual correction value into the worksheet. The worksheet uses a mechanical angle index. By performing a table search on the worksheet based on the detected mechanical angle, the residual correction value of each detected mechanical angle can be retrieved, thereby correcting the detected mechanical angle using the residual correction value.

[0049] Uneven magnetization is a common problem in the manufacturing process of ring magnets for electric motors, mainly caused by the following two categories of reasons: One issue is the multi-pole magnetization of magnetic rings, which involves directly magnetizing a single ring magnet into multiple poles. For example, insufficient machining precision of the pole shoes or yoke used for magnetization, or uneven air gaps, can lead to uneven magnetic field distribution, with some areas having excessively strong magnetic fields and others too weak. Unstable energy in the magnetizer's discharge capacitor, or inconsistent pulse peak / width, can result in varying degrees of magnetization saturation and inconsistent magnetic force across each pole. Furthermore, misalignment or tilting of the magnetic ring within the fixture, or inaccurate angle steps during multi-segment magnetization, can cause inconsistent pole widths or inaccurate pole positions.

[0050] Secondly, there are problems with single-magnet mounting, i.e., when multiple independent magnets are attached to the rotor core. For example, if the magnet is attached at an off-center angle, in the wrong position, or with an inconsistent gap from the core, the magnetic flux will not change uniformly with the angle during motor rotation. When different batches of magnets have different remanence or coercivity, or when there are deviations in magnetization direction or large dimensional tolerances, the magnetic force of each magnet will vary. When encountering high temperatures, strong reverse magnetic fields, or damage / stress caused by impacts during assembly, localized demagnetization and weakened magnetic force can occur.

[0051] To overcome the influence of uneven magnetization of the motor magnets, this embodiment performs offline calibration of the residual values ​​of each mechanical angle. A worksheet is established based on the calibrated residual values, which is then used to further correct the measured mechanical angle values. Through precise correction of the measured mechanical angle values, the corresponding electrical angle can be directly calculated from the corrected real-time mechanical angle, eliminating the need for further correction of the electrical angle and thus omitting steps related to current loop feedback.

[0052] During offline calibration, it is not necessary to measure and calibrate all machine angle values. For example, only 128–256 numerical points can be measured and calibrated, and then the residual calibration value can be determined by linear interpolation between adjacent numerical points, thereby obtaining the residual calibration value of all machine angles.

[0053] S300: When the motor is in online working condition, the original output signal of the orthogonal Hall sensor pair is elliptic corrected according to the elliptic correction compensation parameters, and the detection mechanical angle is calculated based on the elliptic corrected output signal of the orthogonal Hall sensor pair.

[0054] In this step, the compensation formula for elliptic correction of the original output signal of the orthogonal Hall sensor pair is as follows:

[0055] In the formula, This represents the raw output signal of the cosine Hall sensor. The elliptic-corrected output signal obtained after elliptic correction; The original output signal of the sinusoidal Hall sensor is The elliptic-corrected output signal obtained after elliptic correction.

[0056] Calculate the mechanical angle of the test The formula is:

[0057] in, This represents the zero-position alignment correction value for the mechanical angle. Used for zero-position alignment to compensate for this absolute angular offset; calibration can be performed by combining mechanical positioning (e.g., locking the rotor in a known d-axis position) or electrical testing (e.g., injecting d-axis current and observing whether torque is generated). .

[0058] S400, according to the detection mechanical angle Look up the corresponding first residual correction value in the worksheet. Through the first residual correction value For the inspection of mechanical angles The corrected mechanical angle is obtained by performing correction. The following correction formula can be used:

[0059] When the motor is used in a scenario where it can rotate 360°, the corrected mechanical angle is adjusted accordingly. As a real-time mechanical angle ,Right now: .

[0060] When the motor is used in scenarios with restricted rotation (such as a drone gimbal), the mechanical angle region where the motor can rotate normally during use is defined as the ROI sector, and a space window is set on each side of the ROI sector. In this step, it is first checked whether the detected mechanical angle is located within the ROI sector or the space window region. If the detected mechanical angle is located within the ROI sector, the detected mechanical angle is corrected using the first residual correction value, and the corrected mechanical angle is used as the real-time mechanical angle, that is: .

[0061] If the detected machine angle is located within the spatial window region, the weighted sum of the detected machine angle and the corrected machine angle is used as the real-time machine angle, i.e.: .in, These are the weighting coefficients. The value gradually transitions from 1 to 0 from one end of the spatial window closest to the ROI sector to the other.

[0062] If the detected machine angle is located outside the ROI sector and the spatial window, then the detected machine angle is directly used as the real-time machine angle, i.e.: .

[0063] Real-time mechanical angle Using the above compensation method, for the original output signal at each sampling time... and The correction calculation process is simple, greatly reducing the amount of computation. Furthermore, this step replaces the high-precision hardware compensation method with a one-time offline calibration and online lookup table compensation, significantly reducing costs.

[0064] S500: Calculate the second residual correction value based on the detected machine angle and the current theoretical prediction value of the machine angle, and write the correspondence between the machine angle and the second residual correction value into the shaded table. For example, the second residual correction value can be obtained by learning the online residual value using the exponentially weighted moving average (EWMA) method. The current theoretical prediction value of the machine angle can be obtained by forward integration of the real-time machine angle from the previous control cycle according to the current angular velocity command value or the estimated angular velocity. The shaded table uses the same machine angle index as the worksheet to facilitate replacing the worksheet with the shaded table.

[0065] The exponentially weighted moving average (AMA) is a commonly used smoothing and trend estimation method in time series analysis and machine learning. Its core idea is to assign exponentially decreasing weights to historical data, so that data points more recent to the current time have greater weights. This allows it to adapt more quickly to changing data trends while retaining historical information. Its basic formula is:

[0066] This represents the observation value at the current moment; This represents the EWMA value (smoothed estimate) of the data at the current time. This represents the EWMA value of the data from the previous time step. This represents the smoothing coefficient (also known as the attenuation factor), which ranges from 0 to 1 (the value is usually close to 1, for example, 0.9).

[0067] EWMA compresses historical information into a single state variable through exponential weighting. Its computation is efficient (only the previous state needs to be stored), adapts to non-stationary sequences, smooths noise, and highlights trends. A key characteristic is that the weights decay exponentially over time, with more recent data having a greater impact. Therefore, it is well-suited for the need for online residual updates.

[0068] S600. A replacement operation is performed at predetermined intervals, replacing the worksheet with a shaded table (i.e., replacing all first residual correction values ​​in the worksheet with second residual correction values ​​in the shaded table). Since the motor may experience slow-changing errors such as temperature drift and aging during operation, this embodiment generates a shaded table through online learning and periodically updates the worksheet using the shaded table to continuously absorb these slow-changing errors without interrupting control.

[0069] To avoid affecting the normal operation of the motor after the replacement operation due to data errors in the shaded table, this step can also perform a consistency check on the shaded table before performing the replacement operation. If the consistency check passes, the replacement operation is performed; otherwise, the replacement operation is abandoned. Performing a consistency check on the shaded table can include the following sub-steps: S610. Detect the absolute value of all second residual correction values ​​in the shadow table. Since the residual values ​​are relatively accurate after offline calibration, they are unlikely to change drastically. Therefore, a residual threshold can be preset. If the absolute value of any second residual correction value in the shadow table is greater than the residual threshold, it indicates that the data is incorrect, the consistency check fails, and the replacement operation is abandoned.

[0070] S620. After using the shaded table as the worksheet, verify whether all vector sectors of the electrical angles corresponding to each magnetic pole of the motor can be smoothly connected at the boundary. If they cannot be smoothly connected, it also indicates that there is a data error. The consistency check is judged to have failed, and the replacement operation is abandoned.

[0071] In the SVPWM algorithm, the eight basic switching states of a three-phase inverter correspond to six active vectors and two zero vectors. The six active vectors are spaced 60° apart, forming six vector sectors. If adjacent vector sectors cannot be smoothly connected, torque pulsation (sudden fluctuations in motor output torque) will occur when the voltage vector switches between adjacent sectors. The judgment method can be as follows: If the compensated endpoint of the previous sector and the compensated starting point of the next vector sector are within the allowable error range, then it is determined that the two adjacent vector sectors can be smoothly connected at the boundary; otherwise, it is determined that the two adjacent vector sectors cannot be smoothly connected at the boundary.

[0072] In this step, the replacement operation can be performed using an atomic switch method to replace the entire worksheet. An atomic switch refers to replacing the parameters in the original worksheet with the entire set of new parameters from the shaded table as a complete, indivisible unit, all at once without interruption. Atomic switching is a critical system safety design; by ensuring the integrity and immediacy of parameter updates, it allows online adaptive learning to proceed safely without interrupting or affecting the system's real-time control performance.

[0073] Please see Figure 3 This describes the hardware architecture of the motor control system in this embodiment. The control system in this embodiment bypasses the hardware requirement for directly measuring high-resolution electrical angles; instead, it predicts high-precision mechanical angles using a software method of "offline modeling + online table lookup." This approach "reduces the burden" and "reconstructs" the classic SVPWM+FOC architecture, eliminating the phase current closed loop and saving the hardware cost and software overhead of the high-precision current sampling link. Furthermore, it does not rely on a high-resolution encoder, using only two low-cost quadrature Hall elements as the sole position sensor. It can also correct traditionally faulty motors to a usable or even good level, significantly improving the utilization rate of the supply chain and the cost-effectiveness of the product.

[0074] Furthermore, this embodiment employs a dual-buffered data exchange technique using worksheets and shaded tables. The system maintains two identical buffers: one in the "foreground" for use, and the other in the "background" for preparation. Once preparation is complete, a quick switch brings the contents of the background buffer to the foreground. This enables hot updates of the residual compensation value, allowing dynamic updates without stopping or restarting the motor control system. This continuously absorbs slow-changing errors such as motor temperature drift and aging without interrupting control.

[0075] The above embodiments merely illustrate preferred implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention should be determined by the appended claims.

Claims

1. A method for adaptive angle correction of a motor, characterized in that, Includes the following steps: S100. Install a pair of quadrature Hall sensors on the stator of the motor in advance, and determine the elliptic correction compensation parameters of the quadrature Hall sensor pair through offline calibration. S200. In offline mode, calibrate the offline residual value corresponding to each mechanical angle of the motor, use the offline residual value as the first residual correction value, and write the correspondence between the mechanical angle and the first residual correction value into the worksheet. S300: When the motor is in online working condition, the original output signal of the orthogonal Hall sensor pair is elliptic corrected according to the elliptic correction compensation parameters, and the detection mechanical angle is calculated based on the elliptic corrected output signal of the orthogonal Hall sensor pair. S400: Query the corresponding first residual correction value in the worksheet based on the detected mechanical angle, correct the detected mechanical angle using the first residual correction value, and use the corrected mechanical angle as the real-time mechanical angle. S500: Calculate the second residual correction value based on the detected machine angle and the current theoretical prediction value of the machine angle, and write the correspondence between the machine angle and the second residual correction value into the shaded table. S600: Perform a replacement operation at predetermined intervals, using a shaded table to replace the worksheet.

2. The motor adaptive angle correction method as described in claim 1, characterized in that: In step S500, the online residual value of the machine angle is calculated based on the detected machine angle and the current theoretical prediction value of the machine angle, and the online residual value is learned by the exponential weighted moving average method to obtain the second residual correction value.

3. The motor adaptive angle correction method as described in claim 1, characterized in that: In step S600, a consistency check is performed on the shadow table before the replacement operation is executed. If the consistency check passes, the replacement operation is executed; otherwise, the replacement operation is abandoned.

4. The motor adaptive angle correction method as described in claim 3, characterized in that, Performing a consistency check on the shaded table includes the following sub-steps: The absolute value of all second residual correction values ​​in the shadow table is checked. If the absolute value of any second residual correction value is greater than the preset residual threshold, the consistency check is deemed to have failed. After verifying that all vector sectors of the electrical angles corresponding to each magnetic pole of the motor can be smoothly connected at the boundary after using the shaded table as the worksheet, the consistency check is deemed to have failed.

5. The motor adaptive angle correction method as described in claim 1, characterized in that: In step S600, the worksheet is replaced entirely using an atomic switching method when performing the replacement operation.

6. The motor adaptive angle correction method as described in claim 1, characterized in that: The motor is used in scenarios where rotation is restricted. The mechanical angle region where the motor can rotate normally during use is defined as the ROI sector, and a space window is set on both sides of the ROI sector. In step S400, if the detected mechanical angle is located in the ROI sector, the detected mechanical angle is corrected by the first residual correction value, and the corrected mechanical angle is used as the real-time mechanical angle. If the detected mechanical angle is located in the space window region, the weighted sum of the detected mechanical angle and the corrected mechanical angle is used as the real-time mechanical angle. If the detected mechanical angle is located in the region outside the ROI sector and the space window, the detected mechanical angle is directly used as the real-time mechanical angle.

7. The motor adaptive angle correction method according to any one of claims 1 to 6, characterized in that: The quadrature Hall sensor pair includes a sine Hall sensor and a cosine Hall sensor, wherein the original output signal of the cosine Hall sensor is... The original output signal of the sinusoidal Hall sensor is ; The elliptic correction compensation parameters include a 2×1 DC offset matrix. and 2×2 affine transformation matrix ;in, , This represents the DC offset of the cosine Hall sensor. This represents the DC offset of the sinusoidal Hall sensor.

8. The motor adaptive angle correction method as described in claim 7, characterized in that, The method for determining elliptic correction compensation parameters includes the following sub-steps: S110. Run the motor at a constant speed under no-load for at least one revolution at low to medium speed to collect the raw output signal of the cosine Hall sensor. The original output signal of the sinusoidal Hall sensor And calculate the DC offset of the cosine Hall sensor. DC offset of the sinusoidal Hall sensor ; S120, convert the original output signal and The corresponding DC offsets are removed to obtain the decentering signal. and decentralized signals ; S130, Decentering signals are processed using a whitening algorithm. and Mapping an ellipse to a unit circle of equal amplitude and orthogonality, the calculated whitening matrix is ​​then... As an affine transformation matrix .

9. The motor adaptive angle correction method as described in claim 8, characterized in that, The whitening matrix obtained by calculation The method includes the following sub-steps: S135, Based on the decentralization signal and Calculate the covariance matrix ; S136, Regarding the covariance matrix Eigenvalue decomposition yields orthogonal and diagonal matrices, as shown in the formula: in, It is a 2×2 orthogonal matrix, and its column vectors point in the directions of the major and minor axes of the ellipse; It is a 2×2 diagonal matrix. , It is a diagonalization function; Represents the variance along the major axis. Represents the variance along the minor axis; S137. Calculate the whitening matrix. The calculation formula is: 。 10. The motor adaptive angle correction method as described in claim 7, characterized in that, In step S300, the compensation formula for elliptic correction of the original output signal of the orthogonal Hall sensor pair is as follows: In the formula, This represents the raw output signal of the cosine Hall sensor. The elliptic-corrected output signal obtained after elliptic correction; The original output signal of the sinusoidal Hall sensor is The elliptic-corrected output signal obtained after elliptic correction; Represents the original data matrix. ; In step S300, the detection machine angle is calculated. The formula is: in, This is an enhanced version of the standard arctangent function, representing the angle value between -180° and 180° in the calculation result of the standard arctangent function; This represents the zero-position alignment correction value for the mechanical angle.