A method for optimizing square-wave current equalization of a motor

CN123019557APending Publication Date: 2026-10-30SHENZHEN GREENWAY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611217171.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0003]但是,常规的控制方法多依赖于PI调节器配合脉宽调制技术,通过闭环调节生成驱动信号,受限于调节器带宽与响应速度,导致实际电流波形与给定电流波形存在偏差,影响控制精度

Benefits of technology

[0021]本发明的电机方波电流均波优化方法的有益效果是:通过获取当前电角度扇区对应的运行数据和基础控制参数,能够为后续补偿计算提供与扇区实时工况精确匹配的数据输入,确保补偿动作具有明确的物理依据和时域针对性,避免因数据滞后或失配导致的无效补偿;根据运行数据通过扇区电流均波补偿规则得到补偿量,能够将扇区间的电流不均衡程度量化为具体的修正指令,使补偿输出与当前扇区的实际调节需求精确对应,为后续修正提供可靠的调整依据;将补偿量与基础控制参数叠加得到优化方波控制参数,能够以最小改动的方式将补偿结果嵌入原有控制链路,避免因参数突变引发系统振荡或保护误动作,同时实现补偿效果的平稳输出。通过补偿量的精确计算与平稳叠加,能够显著降低各扇区间的电流不均衡程度,有效抑制母线纹波对输出电流的干扰,从而提升角磨机在切削工况下的转矩平稳性与控制精度,并延长控制器使用寿命。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123019557A_ABST
    Figure CN123019557A_ABST
Patent Text Reader

Abstract

The application provides a motor square wave current uniform wave optimization method, and relates to the technical field of motor control. The motor square wave current uniform wave optimization method comprises the following steps: obtaining operation data and basic control parameters corresponding to a current electric angle sector of a motor; obtaining a compensation amount according to the operation data through a sector current uniform wave compensation rule; and superimposing the compensation amount and the basic control parameters to obtain optimized square wave control parameters. The application can improve the control precision of the motor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor control technology, and more specifically, to a method for optimizing the uniformity of square wave current in a motor. Background Technology

[0002] With the large-scale application of permanent magnet synchronous motors in industrial drives, power tools, and new energy vehicles, the performance requirements of their control systems are increasing. Taking brushless angle grinders as an example, as typical handheld power tools, the accuracy of the motor's current control directly affects the motor's torque ripple, noise level, and temperature rise characteristics, which in turn affects the overall service life and operating comfort of the machine.

[0003] However, conventional control methods often rely on PI controllers combined with pulse width modulation technology to generate drive signals through closed-loop regulation. Due to limitations in controller bandwidth and response speed, the actual current waveform deviates from the given current waveform, affecting control accuracy. Summary of the Invention

[0004] The problem addressed by this invention is how to improve the control precision of motors.

[0005] To address the above problems, this invention provides a method for optimizing the uniformity of square wave current in a motor.

[0006] In a first aspect, the present invention provides a method for optimizing the uniformity of square wave current in a motor, comprising: Obtain the operating data and basic control parameters corresponding to the current electrical angle sector of the motor; The compensation amount is obtained based on the operational data using the sector current averaging compensation rule; The optimized square wave control parameters are obtained by superimposing the compensation amount and the basic control parameters.

[0007] Optionally, before acquiring the operating data and basic control parameters corresponding to the current electrical angle sector of the motor, the method further includes: The corresponding sector number is determined according to the current electrical angle sector by a preset sector number matching rule, wherein the sector number matching rule includes a one-to-one correspondence between the electrical angle sector and the sector number; The corresponding power switch transistor conduction combination is obtained according to the sector number through a preset logic commutation mapping rule, wherein the logic commutation mapping rule includes a one-to-one correspondence between the sector number and the power switch transistor combination; The basic control parameters are generated based on the power switch transistor conduction combination.

[0008] Optionally, the operating data includes bus voltage, average current, and motor speed; obtaining the compensation amount based on the operating data using sector current ripple compensation rules includes: The corresponding bus ripple region is obtained by analyzing the ripple region based on the bus voltage. The corresponding sector deviation is obtained by comparing the average current with the deviation. Based on a preset sampling window, the corresponding operating condition gain is obtained through operating condition identification according to the motor speed, the current signal, and the bus voltage; The compensation amount is obtained based on the bus ripple region, the sector deviation, and the operating condition gain through a preset compensation relationship.

[0009] Optionally, the step of obtaining the corresponding bus ripple region based on the bus voltage through ripple region analysis includes: The bus reference voltage is obtained by processing the bus voltage through a moving average filter. The ripple component is obtained based on the difference between the bus voltage and the bus reference voltage; The ripple slope is obtained from the ripple components through a preset differential relationship; The corresponding busbar ripple region is obtained by comparing the ripple component and the ripple slope using a threshold.

[0010] Optionally, the bus ripple region includes a peak region, a falling region, a valley region, and a rising region; the step of obtaining the corresponding bus ripple region by comparing the ripple components and the ripple slope through a threshold includes: When the ripple component is greater than or equal to a preset peak threshold, and the absolute value of the ripple slope is less than or equal to a preset first slope threshold, the bus ripple region is determined to be a peak region. When the ripple component is less than or equal to a preset valley threshold, and the absolute value of the ripple slope is less than or equal to the first slope threshold, the bus ripple region is determined to be a valley region. When the ripple component is greater than the valley threshold and less than the peak threshold, the bus ripple region is determined based on the ripple slope.

[0011] Optionally, determining the busbar ripple region based on the ripple slope includes: When the ripple slope is greater than the first slope threshold, the bus ripple region is determined to be an upward region; When the ripple slope is less than a preset second slope threshold, the bus ripple region is determined to be a decreasing region, wherein the first slope threshold is a positive number, and the first slope threshold and the second slope threshold are opposite numbers to each other.

[0012] Optionally, obtaining the corresponding sector deviation based on the average current through deviation comparison includes: Obtain the historical average current of the sector corresponding to the current electrical angle sector and the average current of adjacent sectors; The adjacent deviation is obtained based on the difference between the average current and the average current of the adjacent sectors; The historical deviation is obtained based on the difference between the average current and the historical average current of the sector; The sector deviation is obtained by weighted summation of the adjacent deviation and the historical deviation.

[0013] Optionally, obtaining the corresponding operating condition gain based on the motor speed, the current signal, and the bus voltage through operating condition identification includes: The speed drop rate is obtained based on the motor speed through a preset speed drop relationship; The current rise rate is obtained based on the average current through a preset current change relationship; The bus voltage collapse rate is obtained based on the bus voltage through a preset voltage collapse relationship; The current operating condition is determined by comparing the speed drop rate, the current rise rate, and the bus voltage collapse rate using a threshold comparison. The corresponding operating condition gain is obtained according to the current operating condition state through a preset compensation gain rule, wherein the compensation gain rule includes a one-to-one correspondence between the operating condition state and the operating condition gain. The speed drop rate satisfies: ; The current rise rate satisfies: ; The bus voltage collapse rate satisfies: ; Where Rω is the speed drop rate, ω0 is the motor speed at the start of the sampling window, and ω n ω represents the motor speed corresponding to the current electrical angle sector, i.e., the motor speed at the end of the sampling window. min The minimum motor speed within the sampling window, max() is the larger value within the parentheses, RI is the current rise rate, and I n I0 is the average current of the current electrical angle sector, N is the number of sampling periods in the sampling window, Ts is the sampling period, RU is the bus voltage collapse rate, and U0 is the bus voltage at the starting point of the sampling window. n U is the bus voltage of the current electrical angle sector. min为 The minimum bus voltage within the sampling window.

[0014] Optionally, the compensation relationship includes a duty cycle compensation relationship, a freewheeling ratio compensation relationship, and a commutation advance angle compensation relationship; the compensation amount includes a duty cycle compensation amount, a freewheeling ratio compensation amount, and a commutation advance angle compensation amount; the compensation amount is obtained based on the bus ripple region, the sector deviation, and the operating condition gain through a preset compensation relationship, including: Obtain the duty cycle correction coefficient, freewheeling correction coefficient, and commutation correction coefficient corresponding to the bus ripple region; The duty cycle compensation amount is obtained based on the sector deviation, the bus ripple region, and the operating condition gain through the duty cycle compensation relationship.

[0015] The freewheeling ratio compensation amount is obtained based on the bus ripple region and the operating condition gain through the freewheeling ratio compensation relationship. The commutation advance angle compensation amount is obtained based on the sector deviation and the operating condition gain through the commutation advance angle compensation relationship; The duty cycle compensation amount satisfies: ; The freewheeling ratio compensation amount satisfies: ; The commutation advance angle compensation amount satisfies: ; Among them, D comp F is the duty cycle compensation amount. comp A is the amount of the freewheeling ratio compensation. comp K is the amount of compensation for the commutation advance angle. d K is the duty cycle compensation coefficient. u K is the bus voltage compensation coefficient. f K is the freewheeling compensation coefficient. a K is the advance angle compensation coefficient. ω K is the speed drop compensation coefficient. load For the operating condition gain, I sec For the sector deviation, I base As a preset current reference, G bus F is the duty cycle correction factor. bus R is the freewheeling correction factor. ω D is the commutation correction factor. max F is the duty cycle compensation amount. max As the upper limit of the continuous current ratio compensation, A max This is the upper limit of the commutation advance angle compensation.

[0016] Optionally, the method further includes: When the phase current or bus current of the motor is greater than or equal to the preset current limiting threshold, the positive duty cycle compensation and commutation advance angle compensation are stopped. When the bus voltage is less than the preset undervoltage warning threshold, the positive duty cycle compensation upper limit is reduced according to the preset first ratio. When the bus voltage is less than the preset undervoltage stop threshold, the wave averaging compensation is terminated.

[0017] When the collected motor temperature is greater than the preset derating temperature threshold, the upper limit of the positive duty cycle compensation is reduced according to the preset second ratio. When the motor temperature exceeds the preset protection stop threshold, it enters the protection stop state; When the engine speed equals the preset upper limit threshold of the allowable engine speed, positive advance angle compensation and duty cycle compensation are stopped.

[0018] Secondly, the present invention provides a device for optimizing the square wave current of a motor, comprising: The acquisition module is used to acquire the operating data and basic control parameters corresponding to the current electrical angle sector of the motor; The compensation module is used to obtain the compensation amount based on the operating data and the sector current averaging compensation rule; The optimization module is used to superimpose the compensation amount and the basic control parameters to obtain optimized square wave control parameters.

[0019] Thirdly, the present invention provides an electronic device, including a memory and a processor; Memory, used to store computer programs; A processor, used to implement, when executing a computer program, the motor square wave current equalization optimization method as described in the first aspect.

[0020] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the motor square wave current equalization optimization method as described in the first aspect.

[0021] The beneficial effects of the motor square wave current averaging optimization method of the present invention are as follows: By acquiring the operating data and basic control parameters corresponding to the current electrical angle sector, it can provide data input that accurately matches the real-time operating conditions of the sector for subsequent compensation calculations, ensuring that the compensation action has a clear physical basis and time-domain specificity, and avoiding invalid compensation due to data lag or mismatch; by obtaining the compensation amount through the sector current averaging compensation rule based on the operating data, the degree of current imbalance between sectors can be quantified into specific correction instructions, making the compensation output accurately correspond to the actual adjustment needs of the current sector, providing a reliable adjustment basis for subsequent corrections; by superimposing the compensation amount with the basic control parameters to obtain optimized square wave control parameters, the compensation result can be embedded into the original control link with minimal modification, avoiding system oscillation or protection malfunction caused by parameter mutations, while achieving stable output of the compensation effect. Through accurate calculation and stable superposition of the compensation amount, the degree of current imbalance between sectors can be significantly reduced, effectively suppressing the interference of bus ripple on the output current, thereby improving the torque stability and control accuracy of the angle grinder under cutting conditions, and extending the service life of the controller. Attached Figure Description

[0022] Figure 1 This is a flowchart illustrating a method for optimizing the square wave current of a motor according to an embodiment of the present invention. Figure 2 This is a schematic diagram of a motor square wave current equalization optimization device according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0023] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the accompanying drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.

[0024] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0025] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to"; the term "based on" means "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; and the term "optionally" means "optional embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first," "second," etc., mentioned in this invention are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0026] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0027] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0028] In related technologies, PI regulators generate voltage commands by performing proportional and integral calculations based on the current current error, essentially employing a linear time-invariant control strategy. However, in actual motor operation, parameters such as stator resistance and inductance drift with temperature and operating frequency, and load disturbances also exhibit nonlinear characteristics. Fixed-coefficient PI parameters struggle to maintain optimal tracking performance across the entire operating range. Especially during high-speed operation or the square-wave current commutation phase, the rate of change of the current command increases sharply. Limited control bandwidth prevents the regulator from providing sufficient gain in a timely manner, causing lag in the actual current at the rising and falling edges, resulting in overshoot or drop, deviating from the ideal square-wave profile. The combined effect of these factors makes it difficult for the actual current to accurately track the given waveform, introducing amplitude errors and phase lag, directly reducing the control accuracy of the current loop.

[0029] To address the problems existing in the aforementioned related technologies, embodiments of the present invention provide a method for optimizing the square wave current uniformity of a motor.

[0030] like Figure 1 As shown in the figure, an embodiment of the present invention provides a method for optimizing the square wave current of a motor, comprising: S110: Obtain the operating data and basic control parameters corresponding to the current electrical angle sector of the motor.

[0031] Specifically, the rotor position information of the motor is acquired in real time using position sensors or sensorless algorithms, and the current electrical angle sector number is determined based on the rotor position. Then, the motor's operating data is collected within this sector, including at least the bus voltage, phase current, and speed feedback values, to characterize the motor's actual operating state under the current conditions. Simultaneously, the basic control parameters of the motor control system, either pre-stored or calculated in real time, are acquired. These parameters include the proportional and integral gain of the current loop PI regulator, carrier frequency, modulation method, and basic duty cycle command. These parameters constitute the basic control basis for the normal operation of the motor. Furthermore, the operating data may include temperature feedback values ​​to compensate for the impact of temperature changes on motor parameters. The acquisition of the above operating data and basic control parameters provides necessary data support and benchmark reference for subsequent sector current averaging compensation, and is a prerequisite for ensuring the accuracy of compensation calculation and the real-time response of the control system. This allows for precise understanding of the motor's actual operating state and control benchmark within each electrical angle sector, thus laying the data foundation for subsequent differentiated compensation.

[0032] S120, the compensation amount is obtained according to the sector current ripple compensation rule based on the operating data.

[0033] Specifically, the acquired operational data is used as input, including the current electrical angle sector number, instantaneous bus voltage value, phase current feedback value, and speed information. Then, compensation is calculated based on pre-built and stored sector current ripple compensation rules in the control system. These rules include compensation coefficients and function mapping relationships corresponding to each electrical angle sector. The core of these rules is to apply differentiated compensation strategies to address the distortion characteristics of the ripple current waveform in different sectors. During the calculation, the bus voltage is processed through a moving average to obtain the bus reference voltage. Ripple components are then extracted through difference calculations, and the ripple slope is obtained through differential relationships. Finally, a threshold comparison is used to determine the current position. The bus ripple region is identified. Based on this, the corresponding sector weight coefficient is matched according to the current sector number. The ripple region determination result, along with variables such as speed drop rate and load coefficient, are substituted into the preset compensation formula. After being limited by a saturation function, the final compensation amount is output. This compensation amount is used to correct the basic duty cycle command to suppress the current waveform distortion caused by bus ripple. Throughout the calculation process, the sector current ripple reduction compensation rule is pre-calibrated based on offline optimization or online adaptive methods. It can adjust the compensation output in real time according to the dynamic changes in operating data, ensuring that the compensation amount matches the actual operating conditions. This effectively reduces the deviation between the actual current waveform and the ideal square wave, improving the current loop control accuracy. The sector current ripple reduction compensation rule is used to specifically process the operating data, providing accurate compensation input for subsequent superposition stages.

[0034] S130, the compensation amount and the basic control parameters are superimposed to obtain the optimized square wave control parameters.

[0035] Specifically, the compensation amounts include at least duty cycle compensation, freewheeling ratio compensation, and commutation advance angle compensation. The duty cycle compensation is superimposed on the base duty cycle command to correct voltage amplitude deviation caused by bus ripple; the freewheeling ratio compensation is superimposed on the base freewheeling ratio command to adjust the freewheeling tube's duty cycle and optimize the current freewheeling characteristics during commutation; and the commutation advance angle compensation is superimposed on the base commutation advance angle command to dynamically adjust the commutation timing and compensate for commutation delay caused by bus voltage fluctuations. The duty cycle compensation, freewheeling ratio compensation, and commutation advance angle compensation are algebraically superimposed with the basic duty cycle command, basic freewheeling ratio command, and basic commutation advance angle command in the basic control parameters. That is, the optimized duty cycle command equals the basic duty cycle command plus the duty cycle compensation, the optimized freewheeling ratio command equals the basic freewheeling ratio command plus the freewheeling ratio compensation, and the optimized commutation advance angle command equals the basic commutation advance angle command plus the commutation advance angle compensation. Each compensation is calculated independently based on the current sector and ripple conditions and then superimposed onto its respective basic value. The compensation can be positive or negative; positive compensation increases the output capability on top of the basic value, while negative compensation decreases the output capability on top of the basic value. This capability allows for dynamic correction of amplitude deviations and phase lags in basic control parameters under different sectors and ripple conditions. During the superposition process, a safety limiting module is used to limit the amplitude of each superposition result to ensure that each optimized control parameter does not exceed the preset safety modulation range, avoiding undesired conditions such as overmodulation or abnormal switching timing. The optimized square wave control parameters obtained after superposition are finally output to the pulse width modulation module to generate corresponding switching drive signals to control the on / off timing of the power switching transistors in the inverter. This comprehensively achieves coordinated optimization of voltage amplitude, freewheeling characteristics, and commutation timing, enabling the actual current waveform to approximate the ideal square wave profile in each sector.

[0036] For example, suppose that at a certain moment, the basic duty cycle command is 0.75, the basic freewheeling ratio command is 0.10, and the basic commutation advance angle command is 15° electrical angle. If the duty cycle compensation calculated based on the current sector operating data is -0.05, the freewheeling ratio compensation is +0.02, and the commutation advance angle compensation is +3° electrical angle, then the three are superimposed to obtain an optimized duty cycle command of 0.70, an optimized freewheeling ratio command of 0.12, and an optimized commutation advance angle command of 18° electrical angle. Through this superposition mechanism, multiple compensation values ​​calculated in the preceding compensation stage are synchronously converted into actually executable modulation commands, achieving precise correction and multi-dimensional collaborative optimization of the basic control parameters. This comprehensively suppresses the current waveform distortion problem in the square wave drive of the electrolytic capacitor-free permanent magnet synchronous motor, improving the system's current control accuracy, commutation smoothness, and dynamic response performance over a wide operating range.

[0037] In this embodiment, by acquiring the operating data and basic control parameters corresponding to the current electrical angle sector, data input that precisely matches the real-time operating conditions of the sector can be provided for subsequent compensation calculations. This ensures that the compensation action has a clear physical basis and time-domain specificity, avoiding invalid compensation due to data lag or mismatch. The compensation amount is obtained based on the operating data through the sector current ripple compensation rule, quantifying the current imbalance between sectors into specific correction instructions. This ensures that the compensation output precisely corresponds to the actual adjustment needs of the current sector, providing a reliable adjustment basis for subsequent corrections. The compensation amount is superimposed with the basic control parameters to obtain optimized square wave control parameters. This allows the compensation result to be embedded into the original control link with minimal modifications, avoiding system oscillations or protection malfunctions caused by parameter mutations, while achieving a stable output of the compensation effect. Through precise calculation and stable superposition of the compensation amount, the current imbalance between sectors can be significantly reduced, effectively suppressing the interference of bus ripple on the output current, thereby improving the torque stability and control accuracy of the angle grinder under cutting conditions and extending the lifespan of the controller.

[0038] Optionally, before acquiring the operating data and basic control parameters corresponding to the current electrical angle sector of the motor, the method further includes: The corresponding sector number is determined according to the current electrical angle sector by a preset sector number matching rule, wherein the sector number matching rule includes a one-to-one correspondence between the electrical angle sector and the sector number; The corresponding power switch transistor conduction combination is obtained according to the sector number through a preset logic commutation mapping rule, wherein the logic commutation mapping rule includes a one-to-one correspondence between the sector number and the power switch transistor combination; The basic control parameters are generated based on the power switch transistor conduction combination.

[0039] In this optional embodiment, firstly, the corresponding sector number is determined according to the current electrical angle sector by a preset sector number matching rule. That is, after the controller obtains the rotor position information in real time, it maps the current 60-degree electrical angle interval to the corresponding sector numbers S1 to S6 according to the one-to-one correspondence between the electrical angle and the sector number. Then, the corresponding power switch transistor conduction combination is obtained according to the sector number by a preset logic commutation mapping rule. That is, the controller determines which power switches in the three-phase inverter bridge should be turned on and which should be turned off in the current sector according to the one-to-one correspondence between the sector number and the power switch transistor combination in the six-step square wave control logic, so as to form the correct power-on circuit. Finally, basic control parameters are generated according to the power switch transistor conduction combination, including basic duty cycle command, basic freewheeling ratio command, and basic commutation advance angle command. These basic control parameters constitute the basic control basis for the normal operation of the motor in the current sector. Through the above preprocessing, the correspondence between rotor position and switching action can be accurately established in each sector, ensuring the correctness of commutation logic and the rationality of basic control parameters. This provides a correct prerequisite for the subsequent acquisition of operating data and calculation of compensation, avoiding compensation failure or system malfunction due to sector identification errors or commutation logic confusion.

[0040] Optionally, the operating data includes bus voltage, average current, and motor speed; obtaining the compensation amount based on the operating data using sector current ripple compensation rules includes: The corresponding bus ripple region is obtained by analyzing the ripple region based on the bus voltage.

[0041] The corresponding sector deviation is obtained by comparing the average current with the deviation. Based on a preset sampling window, the corresponding operating condition gain is obtained through operating condition identification according to the motor speed, the current signal, and the bus voltage; The compensation amount is obtained based on the bus ripple region, the sector deviation, and the operating condition gain through a preset compensation relationship.

[0042] In this optional embodiment, after acquiring the operating data, the bus voltage is first analyzed for ripple region. Low-frequency fluctuation components in the bus voltage are extracted using a moving average filter. Combined with the direction and degree of deviation of the current bus voltage relative to the reference, the current bus ripple region is determined to be a peak region, a falling region, a valley region, or a rising region, thus determining the phase state of the bus energy supply. Simultaneously, the acquired current signal is processed by intra-sector integration averaging to obtain the average current of the current sector. This average current is then compared with the average current of adjacent sectors or the historical reference current of the same sector to calculate the sector deviation, which is used to quantify the direction and magnitude of the deviation of the current sector's output capability relative to the target value. Based on this, and using a preset sampling window, the motor speed, current signal, and bus voltage are synchronously sampled and statistically analyzed. By calculating the speed drop rate, current rise rate, and bus voltage collapse rate, and combining this with a preset operating condition identification state machine, the specific operating condition of the angle grinder—whether it is currently unloaded, lightly grinding, cutting in, heavily grinding, or stalled—is determined, and the corresponding operating condition gain is output to characterize the intensity requirement of the ripple compensation under the current load condition. Finally, the aforementioned bus ripple region, sector deviation, and operating condition gain are input into a preset compensation relationship to calculate the duty cycle compensation, freewheeling ratio compensation, and commutation advance angle compensation, ensuring that the compensation amount simultaneously includes current balance correction, ripple phase adaptation, and load condition self-adaptation. Through this processing, the energy fluctuation state of the bus, the degree of current imbalance in the sectors, and the impact intensity of the load can be quantified into specific compensation commands, providing a comprehensive and accurate adjustment basis for subsequent superposition correction. This ensures that the compensation amount has the correct adjustment direction and amplitude under the current operating condition, avoiding insufficient or over-compensation due to missing information.

[0043] Optionally, the step of obtaining the corresponding bus ripple region based on the bus voltage through ripple region analysis includes: The bus reference voltage is obtained by processing the bus voltage through a moving average filter. The ripple component is obtained based on the difference between the bus voltage and the bus reference voltage; The ripple slope is obtained from the ripple components through a preset differential relationship; The corresponding busbar ripple region is obtained by comparing the ripple component and the ripple slope using a threshold.

[0044] Specifically, after acquiring the bus voltage, a moving average filter is first applied to remove high-frequency switching noise and transient spikes, extracting a bus reference voltage that reflects the slow changing trend of the bus voltage. Then, the real-time acquired bus voltage is subtracted from this bus reference voltage, and the difference is calculated as the ripple component. This ripple component characterizes the instantaneous deviation direction and magnitude of the bus voltage relative to the reference value at the current moment. Next, the ripple slope is obtained based on this ripple component through a preset differential relationship. That is, the ripple components at adjacent moments are differentially calculated and divided by the sampling period to obtain the rate of change of the ripple component over time, which is used to determine the changing trend of the ripple component. Finally, the current bus ripple region is determined by comparing the ripple component and the ripple slope through a threshold.

[0045] In this optional embodiment, the amplitude, phase, and trend information of low-frequency ripple are accurately extracted from the original bus voltage containing high-frequency noise. The continuous bus voltage waveform is quantized into four discrete regional states, providing an accurate basis for judging the phase of bus energy supply for subsequent compensation calculations. This ensures that the compensation action can be performed differently according to the real-time state of the bus voltage, avoiding further current distortion caused by applying positive compensation when the bus energy is insufficient.

[0046] Optionally, the bus ripple region includes a peak region, a falling region, a valley region, and a rising region; the step of obtaining the corresponding bus ripple region by comparing the ripple components and the ripple slope through a threshold includes: When the ripple component is greater than or equal to a preset peak threshold, and the absolute value of the ripple slope is less than or equal to a preset first slope threshold, the bus ripple region is determined to be a peak region. When the ripple component is less than or equal to a preset valley threshold, and the absolute value of the ripple slope is less than or equal to the first slope threshold, the bus ripple region is determined to be a valley region. When the ripple component is greater than the valley threshold and less than the peak threshold, the bus ripple region is determined based on the ripple slope.

[0047] Specifically, when determining the bus ripple region, the ripple component is compared with preset peak and valley thresholds: when the ripple component is greater than or equal to the preset peak threshold, and the absolute value of the ripple slope is less than or equal to the preset first slope threshold, it indicates that the current ripple component is at the maximum positive deviation position and the rate of change is approaching zero. The bus ripple region is determined as the peak region, at which point the bus voltage is near the highest point within a ripple cycle, and the energy supply is most sufficient. When the ripple component is less than or equal to the preset valley threshold, and the absolute value of the ripple slope is less than or equal to the first slope threshold, it indicates that the current ripple component is at the maximum negative deviation position and the rate of change is approaching zero. The bus ripple region is determined as the valley region, at which point the bus voltage is near the lowest point within a ripple cycle, and the energy supply is weakest. When the ripple component is between the valley threshold and the peak threshold, i.e., neither the peak nor the valley, the bus ripple region is determined based on the magnitude and direction of the ripple slope. By introducing slope determination, the division of the intermediate region has a clear directional basis.

[0048] In this optional embodiment, the combined logic of threshold comparison and slope determination can accurately divide the continuously changing bus ripple waveform into four discrete regions: peak, falling, valley, and rising. This provides clear bus energy phase information for subsequent compensation calculations, avoids misjudgment in the transition region between peak and valley values ​​by relying solely on amplitude determination, and improves the accuracy of region determination and anti-interference capability.

[0049] Optionally, determining the busbar ripple region based on the ripple slope includes: When the ripple slope is greater than the first slope threshold, the bus ripple region is determined to be an upward region; When the ripple slope is less than a preset second slope threshold, the bus ripple region is determined to be a decreasing region, wherein the first slope threshold is a positive number, and the first slope threshold and the second slope threshold are opposite numbers to each other.

[0050] Specifically, when the ripple component is in the intermediate region between the peak threshold and the valley threshold, the bus ripple region is further determined based on the ripple slope: when the ripple slope is greater than the preset first slope threshold, it indicates that the ripple component is in a rapid rising phase, that is, the bus voltage is rising from the valley to the peak, and the energy supply capacity is continuously increasing, and the bus ripple region is determined to be the rising region; when the ripple slope is less than the preset second slope threshold, it indicates that the ripple component is in a rapid falling phase, that is, the bus voltage is falling from the peak to the valley, and the energy supply capacity is continuously weakening, and the bus ripple region is determined to be the falling region; where the first slope threshold is a positive number, and the second slope threshold is the opposite of the first slope threshold, that is, the two have the same absolute value but opposite signs, thus forming a hysteresis interval centered at zero and twice the width of the slope threshold between the rising region and the falling region, avoiding frequent region jumps caused by small fluctuations of the ripple component near the peak or valley. By comparing the slope thresholds mentioned above, the trend of bus voltage change can be accurately determined by the slope direction when the ripple amplitude is in the middle region. This enables a reliable division between the rising and falling regions, ensuring that the bus ripple region determination still has a clear basis for judgment during the transition phase, and improving the robustness and anti-interference capability of region determination.

[0051] Optionally, obtaining the corresponding sector deviation based on the average current through deviation comparison includes: Obtain the historical average current of the sector corresponding to the current electrical angle sector and the average current of adjacent sectors; The adjacent deviation is obtained based on the difference between the average current and the average current of the adjacent sectors; The historical deviation is obtained based on the difference between the average current and the historical average current of the sector; The sector deviation is obtained by weighted summation of the adjacent deviation and the historical deviation.

[0052] Optionally, the sector offset satisfies: ; Among them, I sec For the sector deviation, I avg (k) represents the average current of the current electrical angle sector, I avg (k-1) represents the average current of adjacent sectors as described above, I hist (k+1) represents the historical average current of the sector described later, I hist (k) represents the current historical average current of the sector, W. adj W is the preset adjacent weight coefficient. hist为 Preset historical weighting coefficient, W adj +W hist =1.

[0053] Specifically, after obtaining the average current of the current sector, the historical average current of the sector corresponding to the current electrical angle sector and the average current of adjacent sectors are further obtained. The historical average current of the sector refers to the average current recorded under the same sector number in the previous electrical cycle, used to characterize the fixed deviation characteristics of the sector under the inherent asymmetry of the motor and inverter. The average current of adjacent sectors refers to the average current of the two adjacent sectors before and after the current sector. When the data for the next sector has not yet been formed, the data of adjacent sectors with the same number in the previous electrical cycle can be used instead, i.e., I... hist (k+1) is used to characterize the real-time imbalance of the current sector relative to its adjacent sectors within the current electrical cycle. Then, the average current of the current sector is subtracted from the average current of the adjacent sectors to obtain the adjacent deviation. This deviation reflects the real-time current difference between the current sector and its adjacent sectors and is used to guide dynamic balance adjustment within the current electrical cycle. Simultaneously, the average current of the current sector is subtracted from the historical average current of the sector to obtain the historical deviation. This deviation reflects the repetitive deviation of the sector across different electrical cycles and is used to compensate for systematic imbalances caused by fixed factors such as differences in motor windings, Hall effect installation deviations, or inverter arm asymmetry. Finally, the adjacent deviation and historical deviation are multiplied by their respective weighting coefficients and summed to obtain the final sector deviation. The allocation of weighting coefficients determines the proportion of real-time dynamic adjustment and historical learning compensation in the total compensation. For example, the default adjacent deviation weight is 0.7 and the historical deviation weight is 0.3, making the compensation primarily based on real-time balance and secondarily based on historical learning. Under conditions of switching or regrinding, the adjacent deviation weight can be further increased to enhance real-time response capability.

[0054] In this optional embodiment, by means of deviation extraction and weighted fusion processing, the sources of sector current imbalance can be distinguished into two categories: real-time dynamic deviation and fixed system deviation. This allows the sector deviation to include both transient imbalance information within the current electrical cycle and the inherent repetitive deviation information of the sector, providing a more comprehensive and accurate input for subsequent compensation calculations and avoiding insufficient or excessive compensation due to reliance on a single deviation source.

[0055] Optionally, obtaining the corresponding operating condition gain based on the motor speed, the current signal, and the bus voltage through operating condition identification includes: The speed drop rate is obtained based on the motor speed through a preset speed drop relationship; The current rise rate is obtained based on the average current through a preset current change relationship; The bus voltage collapse rate is obtained based on the bus voltage through a preset voltage collapse relationship; The current operating condition is determined by comparing the speed drop rate, the current rise rate, and the bus voltage collapse rate using a threshold comparison. The corresponding operating condition gain is obtained according to the current operating condition state through a preset compensation gain rule, wherein the compensation gain rule includes a one-to-one correspondence between the operating condition state and the operating condition gain. The speed drop rate satisfies: ; The current rise rate satisfies: ; The bus voltage collapse rate satisfies: ; Where Rω is the speed drop rate, ω0 is the motor speed at the start of the sampling window, and ω n ω represents the motor speed corresponding to the current electrical angle sector, i.e., the motor speed at the end of the sampling window. min The minimum motor speed within the sampling window, max() is the larger value within the parentheses, RI is the current rise rate, and I n I0 is the average current of the current electrical angle sector, N is the number of sampling periods in the sampling window, Ts is the sampling period, RU is the bus voltage collapse rate, and U0 is the bus voltage at the starting point of the sampling window. n U is the bus voltage of the current electrical angle sector. min为 The minimum bus voltage within the sampling window.

[0056] Specifically, after obtaining the motor speed, average current, and bus voltage, the speed drop rate is first obtained based on a preset speed drop relationship. This involves using a preset number of PWM cycles as a judgment window, subtracting the current speed value from the initial speed value at the start of the window, and then dividing by the initial speed value to obtain the relative decrease in speed within the window. This represents the degree of speed drop when the load suddenly increases. Simultaneously, the current rise rate is obtained based on a preset current change relationship. This involves subtracting the average current at the end of the window from the average current at the start, and then dividing by the window duration to obtain the average rate of change of current within the window. This represents the severity of the sudden increase in load current. Finally, the bus voltage collapse rate is obtained based on a preset voltage collapse relationship. This involves subtracting the current bus voltage from the reference bus voltage at the start of the window, and then dividing by the reference bus voltage at the start, to obtain the relative drop in bus voltage within the window. This represents the impact of a sudden load increase on the bus voltage. Then, the current operating condition is determined by comparing thresholds based on the speed drop rate, current rise rate, and bus voltage collapse rate. Specifically, when the current rise rate exceeds the cut-in threshold and the speed drop rate or bus voltage collapse rate exceeds the corresponding lower threshold, it is determined to be in the cut-in state. When the current rise rate, speed drop rate, and bus voltage collapse rate all exceed their respective re-grinding thresholds, it is determined to be in the re-grinding state. When the speed is lower than the stall speed threshold or the speed drop rate exceeds the stall threshold and the current is close to the current limiting value, it is determined to be in the stall trend. When the current is lower than the no-load threshold and the speed drop rate and bus voltage collapse rate are both less than their respective no-load thresholds, it is determined to be in the no-load state. Finally, the corresponding operating condition gain is obtained according to the current operating condition through preset compensation gain rules. Different operating conditions correspond to different gain values. A lower gain is used when no-load to avoid unnecessary compensation disturbances. A higher gain is used when cutting in and re-grinding to enhance the average waveform response speed. When there is a stall trend, the gain is limited to zero or the protection value, and current limiting or shutdown protection is prioritized.

[0057] In this optional embodiment, through the above-mentioned working condition identification and gain mapping, the response intensity of the uniform wave compensation can be automatically adjusted according to the strength of the actual load impact of the angle grinder, so that the compensation intensity matches the current working condition requirements, avoiding excessive compensation under light load conditions to generate noise and additional losses, while ensuring that compensation can quickly intervene when heavy load is switched in to suppress current spikes and torque jerking.

[0058] Optionally, the compensation relationship includes a duty cycle compensation relationship, a freewheeling ratio compensation relationship, and a commutation advance angle compensation relationship; the compensation amount includes a duty cycle compensation amount, a freewheeling ratio compensation amount, and a commutation advance angle compensation amount; the compensation amount is obtained based on the bus ripple region, the sector deviation, and the operating condition gain through a preset compensation relationship, including: Obtain the duty cycle correction coefficient, freewheeling correction coefficient, and commutation correction coefficient corresponding to the bus ripple region; The duty cycle compensation amount is obtained based on the sector deviation, the bus ripple region, and the operating condition gain through the duty cycle compensation relationship.

[0059] The freewheeling ratio compensation amount is obtained based on the bus ripple region and the operating condition gain through the freewheeling ratio compensation relationship. The commutation advance angle compensation amount is obtained based on the sector deviation and the operating condition gain through the commutation advance angle compensation relationship; The duty cycle compensation amount satisfies: ; The freewheeling ratio compensation amount satisfies: ; The commutation advance angle compensation amount satisfies: ; Among them, D comp F is the duty cycle compensation amount. comp A is the amount of the freewheeling ratio compensation. comp K is the amount of compensation for the commutation advance angle. d K is the duty cycle compensation coefficient. u K is the bus voltage compensation coefficient. f K is the freewheeling compensation coefficient. a K is the advance angle compensation coefficient. ω K is the speed drop compensation coefficient. load For the operating condition gain, I sec For the sector deviation, I base As a preset current reference, G bus F is the duty cycle correction factor. bus R is the freewheeling correction factor. ω D is the commutation correction factor. max F is the duty cycle compensation amount. max As the upper limit of the continuous current ratio compensation, A max This is the upper limit of the commutation advance angle compensation.

[0060] Specifically, after obtaining the bus ripple region, sector deviation, and operating condition gain, the corresponding duty cycle correction coefficient, freewheeling correction coefficient, and commutation correction coefficient are first obtained by looking up a table based on the current bus ripple region. The values ​​of each correction coefficient are different under different ripple regions, which are used to make the compensation amount adaptively adjusted with the phase of the bus energy supply. Then, the duty cycle compensation amount is obtained through the duty cycle compensation relationship based on the sector deviation, bus ripple region, and operating condition gain. That is, the sector deviation is used as the main control term to reflect the current balance requirement, the correction coefficient provided by the bus ripple region is used to adjust the compensation direction, and the operating condition gain is used to adjust the compensation intensity. When the sector deviation is positive, the duty cycle is reduced; when it is negative, the duty cycle is increased. Positive compensation is limited in the bus valley region to avoid increasing the current when the energy is insufficient. At the same time, based on the bus ripple region and... The operating gain is used to obtain the freewheeling ratio compensation amount through the freewheeling ratio compensation relationship. That is, the deviation between the peak and valley difference of the sector current and the target value is used as the main control term. The freewheeling ratio is increased in the valley region of the bus to smooth the commutation current, and the freewheeling ratio is reduced in the peak region to reduce unnecessary freewheeling losses. At the same time, the operating gain adjusts the compensation intensity. Simultaneously, the commutation advance angle compensation amount is obtained through the commutation advance angle compensation relationship based on the sector deviation and the operating gain. That is, the sector deviation is used as the main control term. When the deviation is negative, the advance angle is increased to build up the current in advance. When the deviation is positive, the advance angle is reduced to avoid overcurrent. The operating gain adjusts the compensation amplitude. At the same time, the advance angle is fine-tuned in combination with the speed drop rate. When the speed drops rapidly, the advance angle is appropriately increased to enhance the torque output capability. The three compensation amounts are calculated independently and then output together.

[0061] In this optional embodiment, by parallel calculation of multi-dimensional compensation relationships, the bus ripple phase, sector current deviation and load impact intensity can be converted into correction instructions of three different dimensions: duty cycle, freewheeling ratio and commutation advance angle. This allows each compensation amount to be precisely adjusted for voltage amplitude, commutation smoothness and commutation timing, achieving multi-angle collaborative optimization and avoiding the limitation of single-dimensional compensation being unable to fully suppress current waveform distortion.

[0062] Optionally, the method further includes: When the phase current or bus current of the motor is greater than or equal to the preset current limiting threshold, the positive duty cycle compensation and commutation advance angle compensation are stopped. When the bus voltage is less than the preset undervoltage warning threshold, the positive duty cycle compensation upper limit is reduced according to the preset first ratio. When the bus voltage is less than the preset undervoltage stop threshold, the wave averaging compensation is terminated.

[0063] When the collected motor temperature is greater than the preset derating temperature threshold, the upper limit of the positive duty cycle compensation is reduced according to the preset second ratio. When the motor temperature exceeds the preset protection stop threshold, it enters the protection stop state; When the engine speed equals the preset upper limit threshold of the allowable engine speed, positive advance angle compensation and duty cycle compensation are stopped.

[0064] Specifically, before or during the superposition of the compensation amount with the basic control parameters, it is necessary to constrain each compensation amount and the superposition result through the safety limiting module to ensure that the average wave compensation does not destroy the original protection logic. The current limiting mechanism includes the following features: When the phase current of the motor or the bus current is detected to be greater than or equal to a preset current limiting threshold, all positive duty cycle compensation and commutation advance angle compensation are immediately stopped, prohibiting any compensation actions that increase output capability. However, negative duty cycle compensation is allowed to reduce current or increase the freewheeling ratio to smooth current decay, preventing compensation actions from exacerbating overcurrent risks. The bus voltage limiting mechanism includes: When the bus voltage is less than a preset undervoltage warning threshold, the upper limit of positive duty cycle compensation is linearly reduced according to a preset first ratio. This means that the lower the bus voltage, the smaller the allowed positive duty cycle increment, preventing further voltage collapse caused by continued current increase when bus energy is insufficient. When the bus voltage is less than a preset undervoltage stop threshold, the waveform compensation is exited, and the control priority is switched to undervoltage protection, ensuring that the controller prioritizes system safety over waveform compensation during severe undervoltage conditions. The temperature limiting mechanism includes: When the collected motor temperature or power device temperature is greater than a preset derating temperature threshold, the upper limit of positive duty cycle compensation is linearly reduced according to a preset second ratio, allowing the compensation capability to adjust with temperature. The temperature rise is gradually reduced to avoid increased switching losses due to compensation action under overheating conditions; when the temperature exceeds the preset protection stop threshold, the system enters a protection stop state and completely stops output; motor speed limit: when the motor speed reaches or exceeds the preset allowable speed upper limit threshold, positive advance angle compensation and duty cycle compensation are stopped to avoid overspeed or loss of synchronization due to compensation action during high-speed operation; trigger limit: when the trigger setpoint drops rapidly, the rate of change of the optimized duty cycle command is constrained according to the trigger setpoint change rate to limit its descent rate, avoiding unexpected acceleration caused by sudden output increase due to rapid removal of compensation when the grinding wheel is unloaded; rate of change limit: the final output optimized duty cycle command and optimized commutation advance angle command must also meet their respective rate of change constraints, that is, the change in duty cycle between adjacent control cycles does not exceed the preset maximum duty cycle change rate threshold, and the change in commutation advance angle does not exceed the preset maximum advance angle change rate threshold, to avoid new current surges or torque jitter caused by abrupt changes in the compensation amount between adjacent cycles.

[0065] In this optional embodiment, through the above-mentioned multi-dimensional safety limiting processing, the mean wave compensation can always operate within the safety boundaries of current, voltage, temperature and speed. When abnormal operating conditions occur, the safety of the controller and motor is prioritized, and the compensation amount is prevented from becoming the cause of triggering protection under extreme operating conditions, so that mean wave optimization and system protection can coexist in a coordinated manner.

[0066] like Figure 2As shown, an embodiment of the present invention provides a motor square wave current equalization optimization device 200, comprising: The acquisition module 210 is used to acquire the operating data and basic control parameters corresponding to the current electrical angle sector of the motor; The compensation module 220 is used to obtain the compensation amount according to the sector current averaging compensation rule based on the operating data; The optimization module 230 is used to superimpose the compensation amount and the basic control parameters to obtain optimized square wave control parameters.

[0067] The motor square wave current equalization optimization device in this embodiment is used to implement the above-mentioned motor square wave current equalization optimization method. Its advantages over the prior art are the same as the advantages of the above-mentioned motor square wave current equalization optimization method over the prior art, and will not be repeated here.

[0068] like Figure 3 As shown, an electronic device 300 provided in this embodiment of the invention includes a memory 310 and a processor 320; the memory 310 is used to store a computer program; the processor 320 is used to implement the above-mentioned motor square wave current equalization optimization method when the computer program is executed.

[0069] Alternatively, an electronic device 300 includes a memory 310 and a processor 320 coupled to the memory 310; the memory 310 is configured to store a computer program; the processor 320 is configured to perform the following operations when the computer program is executed: Obtain the operating data and basic control parameters corresponding to the current electrical angle sector of the motor; The compensation amount is obtained based on the operational data using the sector current averaging compensation rule; The optimized square wave control parameters are obtained by superimposing the compensation amount and the basic control parameters.

[0070] The present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the above-mentioned method for optimizing the square wave current of a motor.

[0071] Alternatively, a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the following operations: Obtain the operating data and basic control parameters corresponding to the current electrical angle sector of the motor; The compensation amount is obtained based on the operational data using the sector current averaging compensation rule; The optimized square wave control parameters are obtained by superimposing the compensation amount and the basic control parameters.

[0072] The present invention will now be described an electronic device 300 that can serve as a server or client of the present invention, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic device 300 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 300 can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0073] Electronic device 300 includes a computing unit that can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) or a computer program loaded from a storage unit into random access memory (RAM). The RAM may also store various programs and data required for device operation. The computing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.

[0074] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. In this application, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention according to actual needs. Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.

[0075] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.

Claims

1. A method for optimizing the ripple distribution of square wave current in a motor, characterized in that, include: Obtain the operating data and basic control parameters corresponding to the current electrical angle sector of the motor; The compensation amount is obtained based on the operational data using the sector current averaging compensation rule; The optimized square wave control parameters are obtained by superimposing the compensation amount and the basic control parameters.

2. The method for optimizing the square wave current of a motor according to claim 1, characterized in that, Before acquiring the operating data and basic control parameters corresponding to the current electrical angle sector of the motor, the process also includes: The corresponding sector number is determined according to the current electrical angle sector by a preset sector number matching rule, wherein the sector number matching rule includes a one-to-one correspondence between the electrical angle sector and the sector number; The corresponding power switch transistor conduction combination is obtained according to the sector number through a preset logic commutation mapping rule, wherein the logic commutation mapping rule includes a one-to-one correspondence between the sector number and the power switch transistor combination; The basic control parameters are generated based on the power switch transistor conduction combination.

3. The method for optimizing the square wave current of a motor according to claim 1, characterized in that, The operating data includes bus voltage, average current, and motor speed; the compensation amount obtained based on the operating data using sector current ripple compensation rules includes: The corresponding bus ripple region is obtained by analyzing the ripple region based on the bus voltage. The corresponding sector deviation is obtained by comparing the average current with the deviation. Based on a preset sampling window, the corresponding operating condition gain is obtained through operating condition identification according to the motor speed, the current signal, and the bus voltage; The compensation amount is obtained based on the bus ripple region, the sector deviation, and the operating condition gain through a preset compensation relationship.

4. The method for optimizing the square wave current of a motor according to claim 3, characterized in that, The step of obtaining the corresponding bus ripple region based on the bus voltage through ripple region analysis includes: The bus reference voltage is obtained by processing the bus voltage through a moving average filter. The ripple component is obtained based on the difference between the bus voltage and the bus reference voltage; The ripple slope is obtained from the ripple components through a preset differential relationship; The corresponding busbar ripple region is obtained by comparing the ripple component and the ripple slope using a threshold.

5. The method for optimizing the square wave current of a motor according to claim 4, characterized in that, The busbar ripple region includes a peak region, a falling region, a valley region, and a rising region; the step of obtaining the corresponding busbar ripple region by comparing the ripple components and the ripple slope through a threshold includes: When the ripple component is greater than or equal to a preset peak threshold, and the absolute value of the ripple slope is less than or equal to a preset first slope threshold, the bus ripple region is determined to be a peak region. When the ripple component is less than or equal to a preset valley threshold, and the absolute value of the ripple slope is less than or equal to the first slope threshold, the bus ripple region is determined to be a valley region. When the ripple component is greater than the valley threshold and less than the peak threshold, the bus ripple region is determined based on the ripple slope.

6. The method for optimizing the square wave current of a motor according to claim 5, characterized in that, Determining the busbar ripple region based on the ripple slope includes: When the ripple slope is greater than the first slope threshold, the bus ripple region is determined to be an upward region; When the ripple slope is less than a preset second slope threshold, the bus ripple region is determined to be a decreasing region, wherein the first slope threshold is a positive number, and the first slope threshold and the second slope threshold are opposite numbers to each other.

7. The method for optimizing the square wave current of a motor according to claim 3, characterized in that, The step of obtaining the corresponding sector deviation based on the average current through deviation comparison includes: Obtain the historical average current of the sector corresponding to the current electrical angle sector and the average current of adjacent sectors; The adjacent deviation is obtained based on the difference between the average current and the average current of the adjacent sectors; The historical deviation is obtained based on the difference between the average current and the historical average current of the sector; The sector deviation is obtained by weighted summation of the adjacent deviation and the historical deviation.

8. The method for optimizing the square wave current of a motor according to claim 3, characterized in that, The step of obtaining the corresponding operating condition gain based on the motor speed, the current signal, and the bus voltage through operating condition identification includes: The speed drop rate is obtained based on the motor speed through a preset speed drop relationship; The current rise rate is obtained based on the average current through a preset current change relationship; The bus voltage collapse rate is obtained based on the bus voltage through a preset voltage collapse relationship; The current operating condition is determined by comparing the speed drop rate, the current rise rate, and the bus voltage collapse rate using a threshold comparison. The corresponding operating condition gain is obtained according to the current operating condition state through a preset compensation gain rule, wherein the compensation gain rule includes a one-to-one correspondence between the operating condition state and the operating condition gain. The speed drop rate satisfies: ; The current rise rate satisfies: ; The bus voltage collapse rate satisfies: ; Where Rω is the speed drop rate, ω0 is the motor speed at the start of the sampling window, and ω n ω represents the motor speed corresponding to the current electrical angle sector, i.e., the motor speed at the end of the sampling window. min The minimum motor speed within the sampling window, max() is the larger value within the parentheses, RI is the current rise rate, and I n I0 is the average current of the current electrical angle sector, N is the number of sampling periods in the sampling window, Ts is the sampling period, RU is the bus voltage collapse rate, and U0 is the bus voltage at the starting point of the sampling window. n U is the bus voltage of the current electrical angle sector. min为 The minimum bus voltage within the sampling window.

9. The method for optimizing the square wave current of a motor according to claim 3, characterized in that, The compensation relationships include duty cycle compensation relationship, freewheeling ratio compensation relationship, and commutation advance angle compensation relationship; the compensation amounts include duty cycle compensation amount, freewheeling ratio compensation amount, and commutation advance angle compensation amount. The compensation amount is obtained based on the bus ripple region, the sector deviation, and the operating condition gain through a preset compensation relationship, including: Obtain the duty cycle correction coefficient, freewheeling correction coefficient, and commutation correction coefficient corresponding to the bus ripple region; The duty cycle compensation amount is obtained based on the sector deviation, the bus ripple region, and the operating condition gain through the duty cycle compensation relationship. The freewheeling ratio compensation amount is obtained based on the bus ripple region and the operating condition gain through the freewheeling ratio compensation relationship. The commutation advance angle compensation amount is obtained based on the sector deviation and the operating condition gain through the commutation advance angle compensation relationship; The duty cycle compensation amount satisfies: ; The freewheeling ratio compensation amount satisfies: ; The commutation advance angle compensation amount satisfies: ; Among them, D comp F is the duty cycle compensation amount. comp A is the amount of the freewheeling ratio compensation. comp K is the amount of compensation for the commutation advance angle. d K is the duty cycle compensation coefficient. u K is the bus voltage compensation coefficient. f K is the freewheeling compensation coefficient. a K is the advance angle compensation coefficient. ω K is the speed drop compensation coefficient. load For the operating condition gain, I sec For the sector deviation, I base As a preset current reference, G bus F is the duty cycle correction factor. bus R is the freewheeling correction factor. ω D is the commutation correction factor. max F is the duty cycle compensation amount. max As the upper limit of the continuous current ratio compensation, A max This is the upper limit of the commutation advance angle compensation.

10. The method for optimizing the square wave current of a motor according to claim 9, characterized in that, Also includes: When the phase current or bus current of the motor is greater than or equal to the preset current limiting threshold, the positive duty cycle compensation and commutation advance angle compensation are stopped. When the bus voltage is less than the preset undervoltage warning threshold, the positive duty cycle compensation upper limit is reduced according to the preset first ratio. When the bus voltage is less than the preset undervoltage stop threshold, the wave averaging compensation is terminated. When the collected motor temperature is greater than the preset derating temperature threshold, the positive duty cycle compensation upper limit is reduced according to the preset second ratio. When the motor temperature exceeds the preset protection stop threshold, it enters the protection stop state; When the engine speed equals the preset upper limit threshold of the allowable engine speed, positive advance angle compensation and duty cycle compensation are stopped.