Motor control PID parameter setting method and motor control system

Through discrete model and FFT technology adaptively adjusting PID parameters, the accuracy of PID parameters in the permanent magnet synchronous motor control system under actual working conditions is solved, and the control accuracy and stability of the motor control system is improved, and it is especially suitable for high-precision servo control.

CN120474403AActive Publication Date: 2025-08-12HEFEI GEYI INTEGRATED CIRCUIT CO LTD

Patent Information

Application Number
CN202410154449.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-02
Publication Date
2025-08-12
Estimated Expiration
2044-02-02

AI Technical Summary

Technical Problem

In the existing permanent magnet synchronous motor control system, it is difficult for PID parameters to meet the requirements of high-precision servo control under actual operating conditions, especially in the fields of high-precision position control such as robotic arms and robots. The measurement errors and changes of motor parameters lead to poor control performance.

Method used

The theoretical PID parameters are calculated using discrete models, and the difference between the actual feedback current and the given current is obtained by using multi-point FFT technology. The PID parameters of the current ring, speed ring and position ring are adaptively adjusted to improve control accuracy.

Benefits of technology

It improves the control accuracy and stability of the motor control system, especially in the three-closed loop servo control scenario, which can better adapt to changes in motor parameters and improves the dynamic response ability and stability characteristics of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120474403A_ABST
    Figure CN120474403A_ABST
Patent Text Reader

Abstract

The invention provides a motor control PID parameter setting method and a motor control system. The method comprises the following steps: calculating a theoretical current loop PID parameter value according to a parameter when a motor is static and a discrete current loop model; performing actual control by using a theoretical current loop PID parameter value, and inputting a given current to a q axis during the actual control so as to obtain a feedback current; a comparison result of the feedback current and the given current is obtained based on multi-point FFT calculation; and based on the comparison result, adjusting the PID parameter value of the current loop until a new comparison result meets a predetermined condition. Theoretical PID parameters are obtained through calculation based on a discrete model, phase and amplitude changes of actual feedback current compared with given current are calculated through FFT, a current loop is adjusted in a self-adaptive mode according to the phase and amplitude changes, and PID parameters of a speed loop and a position loop can be further adjusted. According to the invention, the anti-noise capability of the FFT algorithm is utilized to improve the control precision, and the method is especially suitable for three-closed-loop servo control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of motor control, and in particular to a motor control PID parameter tuning method and a motor control system. Background Art

[0002] In the motor control process, in order to achieve maximum torque output throughout the entire control cycle, FOC (Field-Oriented Control) is often used to control the motor. Existing permanent magnet synchronous motor control systems mainly use PID control.

[0003] Currently, permanent magnet synchronous motor control systems primarily employ a dual closed-loop control strategy consisting of a speed loop and a current loop. In some high-precision position control applications, servo control of the motor is required. This servo control requires sampling, creating a three-loop closed-loop control strategy that also includes a position loop. The performance of the current, speed, and position loops is closely related to their PID parameters. Therefore, optimizing PID parameters to improve closed-loop performance has become a key challenge in this field. Summary of the Invention

[0004] In order to solve at least one of the above problems, the present disclosure proposes a motor control PID parameter tuning scheme, which uses a discrete model to obtain theoretical PID parameters, and obtains the difference between the actual feedback current and the given current based on multi-point FFT technology, and adaptively tunes the PID parameters obtained from the theoretical calculation.

[0005] According to a first aspect of the present disclosure, a motor control PID parameter tuning method is proposed, comprising: calculating theoretical current loop PID parameter values based on motor parameters at rest and a discrete current loop model; performing actual motor control using the theoretical current loop PID parameter values, during which a first given current is input into the q-axis to obtain a first feedback current, wherein the first given current is a sinusoidal current with a first given frequency; obtaining a first comparison result between the first feedback current and the first given current based on a multi-point FFT calculation; and adjusting the current loop PID parameter values based on the first comparison result until a new first feedback current obtained by performing actual motor control using the adjusted current loop PID parameter values and a new first comparison result between the first given current and the first feedback current meet a first predetermined condition.

[0006] Optionally, the multi-point FFT calculation is 2 N Point FFT calculation, N is a positive integer, and the first given frequency is an integer multiple of the frequency resolution, wherein the frequency resolution is the control frequency of the motor and 2 N Business.

[0007] Optionally, a value of an expected bandwidth of the current loop is determined based on the current loop theoretical PID parameter value, and a value of N is selected so that the first given frequency does not differ from the expected bandwidth of the current loop by more than a predetermined threshold.

[0008] Optionally, selecting the value of N so that the first given frequency does not differ from the expected bandwidth of the current loop by more than a predetermined threshold includes: using the default N value to calculate the integer multiple value closest to the expected bandwidth of the current loop; calculating the error value between the signal frequency at the closest integer multiple value and the expected bandwidth of the current loop; if the error value is less than the predetermined threshold, using the signal frequency at the closest integer multiple value as the first given frequency; and if the error value is greater than the predetermined threshold, increasing the value of N until the new error value is less than the predetermined threshold.

[0009] Optionally, the first comparison result includes a first amplitude comparison result and a first phase comparison result, and obtaining the first comparison result between the first feedback current and the first given current based on multi-point FFT calculation includes: obtaining the amplitude and phase of the first feedback current through multi-point FFT calculation; and using the amplitude comparison result between the first feedback current and the first given current as the first amplitude comparison result, and using the phase comparison result between the first feedback current and the first given current as the first phase comparison result.

[0010] Optionally, based on the first comparison result, adjusting the current loop PID parameter value until a new first feedback current obtained by using the adjusted current loop PID parameter value for actual motor control and a new first comparison result of the first given current meet a first predetermined condition, including: in response to the first amplitude comparison result being greater than a first theoretical amplitude change value and the first phase comparison result being less than a first theoretical phase change value, adjusting the value of the current loop PID parameter until the newly obtained first amplitude comparison result is not greater than the first theoretical amplitude change value or the first phase comparison result is not less than the theoretical phase change value.

[0011] Optionally, based on the first comparison result, adjusting the current loop PID parameter value until a new first feedback current obtained by using the adjusted current loop PID parameter value for actual motor control and a new first comparison result of the first given current meet a first predetermined condition, including: in response to the first amplitude comparison result being less than a first theoretical amplitude change value and / or the first phase comparison result being greater than a first theoretical phase change value, adjusting the value of the current loop PID parameter until the newly obtained first amplitude comparison result is not less than the first theoretical amplitude change value and the first phase comparison result is not greater than the first theoretical phase change value.

[0012] Optionally, adjusting the current loop PID parameter value includes: reducing the value of the current loop proportional coefficient in response to the first comparison result being better than the theoretical change value; and increasing the value of the current loop proportional coefficient in response to the first comparison result being worse than the theoretical change value.

[0013] Optionally, the method also includes: calculating a theoretical speed loop PID parameter value based on the parameters of the motor when it is stationary and a discrete current loop model; and using the adjusted current loop PID parameter value to perform actual motor control to adjust the speed loop PID parameter value, wherein adjusting the speed loop PID parameter value further includes: using the adjusted current loop PID parameter value and the theoretical speed loop PID parameter value to perform actual motor control, during which a second given speed is input into the speed loop to obtain a second feedback speed, wherein the second given speed is a sinusoidal speed signal with a second given frequency; obtaining a second comparison result between the second feedback speed and the second given speed; and adjusting the speed loop PID parameter value based on the second comparison result until a new second feedback speed obtained by using the adjusted speed loop PID parameter value to perform actual motor control and a new second comparison result between the second given speed and the second given speed meet a second predetermined condition.

[0014] Optionally, the method also includes: calculating theoretical position loop PID parameter values based on the parameters of the motor when it is stationary and a discrete current loop model; and using the adjusted current loop PID parameter values and the adjusted speed loop PID parameter values to perform actual motor control to adjust the position loop PID parameter values; using the adjusted current loop PID parameter values, the adjusted speed loop PID parameter values and the theoretical position loop PID parameter values to perform actual motor control, during which a third given position is input into the position loop to obtain a third feedback position, wherein the third given position is a sinusoidal position signal with a third given frequency; obtaining a third comparison result between the third feedback position and the third given position; and adjusting the position loop PID parameter value based on the third comparison result until a new third feedback position obtained by using the adjusted position loop PID parameter values to perform actual motor control and a new third comparison result between the third given position and the third feedback position meet a third predetermined condition.

[0015] Optionally, the method also includes: writing the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value and the adjusted position loop PID parameter value into the controller of the motor; and the controller performing magnetic oriented vector control during the operation of the permanent magnet synchronous motor based on the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value and the adjusted position loop PID parameter value.

[0016] According to a second aspect of the present disclosure, a motor control system is proposed, comprising: a motor; and a control module for controlling the motor using adjusted PID parameters obtained based on the PID parameter tuning method according to the first aspect.

[0017] Therefore, this disclosure proposes a solution that uses theoretical current loop, velocity loop, and optional position loop PID parameters calculated based on a discrete model. This solution uses FFT to calculate the phase lag and amplitude attenuation of the actual feedback current compared to a given current, and adaptively adjusts the current loop PID parameters accordingly. This solution can also further adjust the velocity loop and position loop PID parameters. This solution leverages the noise immunity of the FFT algorithm to improve control accuracy, making it particularly suitable for three-loop closed-loop servo control including a position loop. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings, wherein like reference numerals generally represent like components in the exemplary embodiments of the present disclosure.

[0019] Figure 1 The schematic diagram of FOC control for PMSM is shown.

[0020] Figure 2 The schematic diagram of FOC control including position loop is shown.

[0021] Figure 3 Shows the structure diagram of the series PID discrete control motor.

[0022] Figure 4 A simplified structural diagram of the discrete current loop model is shown.

[0023] Figure 5 The step responses for different damping ratios are shown.

[0024] Figure 6 The simplified double closed-loop control diagram of the discrete model motor is shown.

[0025] Figure 7 The simplified three-loop control diagram of the discrete model motor is shown.

[0026] Figure 8 A schematic flowchart of a motor control PID parameter tuning method according to an embodiment of the present disclosure is shown.

[0027] Figure 9 A block diagram of a current loop PID response simulation test is shown.

[0028] Figure 10 The figure shows the simulated response curve when the sinusoidal given frequency is 500 Hz.

[0029] Figure 11 The actual response curve of the motor when 1187.5 Hz is selected as the first given frequency is shown.

[0030] Figure 12 The figure shows the actual response curve when the sinusoidal given frequency is 1187.5 Hz after the current loop PID parameters are adjusted.

[0031] Figure 13 The figure shows the actual response curve when the sinusoidal given frequency is 1187.5 Hz after the current loop PID parameters are adjusted.

[0032] Figure 14 The actual response curve of the speed loop sinusoidal given frequency is shown as 109.4 Hz.

[0033] Figure 15 The figure shows the actual response curve when the sinusoidal reference frequency is 109.4 Hz after the speed loop PID parameters are adjusted.

[0034] Figure 16 The actual response curve of the position loop sinusoidal given frequency is shown as 39.0625 Hz.

[0035] Figure 17 The figure shows the actual response curve when the sinusoidal reference frequency is 39.0625 Hz after the position loop PID parameters are adjusted.

[0036] Figure 18 The response curves of the speed, current and position three-loop are shown under the theoretical PID parameters.

[0037] Figure 19 The response curves of the speed, current and position three-loop are shown under the adjusted PID parameters.

[0038] Figure 20 A schematic diagram showing the composition of a motor control system according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0039] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art. The terms "first," "second," and similar expressions herein are intended to distinguish between different objects of the same type, rather than to distinguish between their order or importance.

[0040] In the control process of permanent magnet synchronous motor (PMSM), in order to obtain the maximum torque output throughout the entire control cycle, FOC (magnetic oriented vector control) is often used to control the motor. Figure 1 The schematic diagram of FOC control for PMSM is shown.

[0041] As shown in the figure, a position sensor such as a magnetic encoder obtains the rotor speed n and rotor position θ of the motor M (in a sensorless setting, they can also be obtained according to various methods. In a sensorless motor, the rotor speed n and rotor position θ of the motor M can be obtained by various types of observers, such as sliding mode observer, Lomborg observer, flux linkage observer, etc.). In practical applications, for example, based on the speed reference n obtained by user input ref The difference between the obtained rotor speed n and the speed loop PID is input to the PID1 module (i.e., the speed loop PID). The output of the speed loop PID is the q-axis reference current i qref When the field weakening control is not performed, the d-axis reference current i dref = 0. At this time, the reference current i of the q-axis and d-axis can be qref and i dref The q-axis and d-axis current i of the motor are actually fed back. q and i d The PID2 and PID3 modules are used to adjust the q-axis and d-axis voltages V after adjustment (the PID parameters of the two current loops are usually the same). d and V q , and then converted into α-axis and β-axis voltage V through Park inverse transformation α and V β , and then through SVPWM (space voltage vector modulation) to obtain the three-phase voltage V a 、V b 、V c , and then drives the motor M to rotate through the three-phase inverter bridge. In FOC control, the three-phase current i is obtained through the sampling resistor a 、i b 、i c , after Clarke transformation, we can get the α-axis and β-axis current i α and i β , and then get the feedback d-axis and q-axis current i through Park transformation d and i q , participating in current loop control.

[0042] At present, the control system of permanent magnet synchronous motor mainly adopts Figure 1 The dual closed-loop control strategy shown here includes both a velocity loop and a current loop. However, high-precision position control in applications such as robotic arms and robots often requires servo control of the motor. Servo control is a three-loop control strategy, meaning that in addition to the current and velocity loops, it also includes a position loop. Figure 2 The FOC control principle diagram including the position loop is shown. As shown in the figure, in the case of three closed-loop control, the position reference p ref The output of the position loop PID is used as a substitute for the rotor mechanical position p. Figure 1 The user input in the speed loop speed reference n ref , and the subsequent Figure 1 Similar control operations.

[0043] As can be seen from the above control structure diagram, Figure 1 There are two types of PID used in motor control: current loop PID and speed loop PID; Figure 2 Servo control employs three types of PID controllers: current loop PID, speed loop PID, and position loop PID. The performance of two-loop and three-loop PID controllers directly impacts control performance. Therefore, improving the dynamic response and stability of the speed loop, current loop, and, in some cases, the position loop is crucial for achieving optimal control performance. If the motor model parameters are accurate, standard PID parameters for the speed loop, current loop, and position loop can be derived based on the desired dual-loop or triple-loop response curves, completing the PID parameter tuning for permanent magnet synchronous motor control.

[0044] However, in actual measurements, the motor's electrical parameters (e.g., resistance R, inductance L) and mechanical parameters (e.g., moment of inertia J) are often affected by the measuring instruments, making accurate measurement difficult. Furthermore, the electrical and mechanical parameters measured when the motor is stationary often change during operation, resulting in significant differences between the actual operating characteristic curve and the theoretical one. Consequently, theoretically calculated PID parameters often fail to meet actual operating requirements.

[0045] In light of this, the present disclosure proposes a motor control PID parameter tuning scheme. This scheme uses a discrete model to obtain theoretical PID parameters. Using multi-point FFT technology, the difference between the actual feedback current and the set current is obtained, and the theoretically calculated PID parameters are adaptively tuned. This tuning scheme utilizes a discrete model for more accurate parameter determination and adaptive tuning, making it particularly suitable for servo tuning processes that require higher model accuracy than conventional FOC control and need to account for delays introduced during the control process.

[0046] In order to facilitate the understanding of this solution, the calculation of the theoretical values of the motor control PID parameters based on the discrete model is first described. It should be known that PID corresponds to proportional, integral, and differential (Proportion Integration Differentiation) control. In actual operation, the coefficients corresponding to the proportional, integral, and differential terms can usually be adjusted to achieve optimized control that is compatible with the current system. In the current loop and speed loop of the motor, since they usually only contain proportional terms and integral terms, the desired control can be performed by adjusting the proportional and integral coefficients. In servo control, the position loop usually uses a pure proportional link, so the desired control can be performed only by adjusting the proportional system. The present invention is not limited to this. In the embodiment where the current loop and the speed loop contain differential terms, the corresponding differential coefficients can also be adjusted in a similar manner to the present invention. Similarly, in the embodiment where the position loop contains integral terms and differential terms, the corresponding integral terms and differential terms can also be adjusted in a similar manner to the present invention. In addition, it is well known to those skilled in the art that "motor control PID parameter adjustment" can cover the adjustment of any one of the proportional, integral, and differential term coefficients or any combination thereof. I. Calculation of theoretical values of PID parameters based on discrete models

[0047] PID parameter tuning for motor control (such as a permanent magnet synchronous motor) involves tuning the current loop and the velocity loop. The tuning process begins with tuning the current loop, followed by the velocity loop. Servo control also includes the position loop, and position PID parameter tuning must be performed after tuning the current and velocity loops. To this end, the current loop tuning process is analyzed first, followed by the velocity loop, and finally the position loop. Discrete models are used throughout the analysis.

[0048] 1.1. Current loop adjustment

[0049] During the current loop tuning process, the motor can be approximately considered as an electrical model with resistance R and inductance L. Figure 3 The diagram shows the structure of the series PID discrete control motor. As shown in the figure, the proportional and integral modules are connected in series. The coefficient of the proportional module is K p_c (corresponding to the current loop ratio K below p_c ), the coefficient of the integral module is K i_c (corresponding to the current loop integration factor K below i_c ). Here, s refers to the Laplace transform domain. T d The delay caused by the current loop control cycle, T p The delay caused by seven-segment and five-segment modulation. When the control period of the current loop is T s At this time, T d =T s , T p =T s / 2.

[0050] Due to the delay and It is not conducive to design and analysis, so the Taylor series is used to expand it and approximate it as a first-order inertia link:

[0051]

[0052]

[0053] When the transfer function has multiple high-frequency small inertia links, the order of the system is very high. Therefore, it is necessary to perform order reduction first, that is:

[0054]

[0055] thus, Figure 4 The simplified structure diagram of the discrete current loop model is shown in FIG. d +T p =3T s / 2. The system open-loop transfer function is:

[0056]

[0057] In order to achieve zero-pole cancellation, the order of the system should be reduced as much as possible. To achieve zero-pole cancellation, equation (4) can be simplified to:

[0058]

[0059]

[0060] It can be seen that the system is a second-order oscillation system at this time, and the undamped oscillation frequency of the system is and damping ratio Bandwidth frequency ω of a typical second-order system b_c and the natural oscillation frequency ω n_c The relationship between ω b_c Yes n_c The increasing function is ε c A decreasing function of the damping ratio It can be seen that when K p_c The larger the ε is, the c The smaller the ω n_c The larger the value, the greater the b_c The larger the K p_c The smaller the time, the c The larger the ω n_c The smaller it is, the smaller ω b_c The smaller it is. For a typical second-order system, ω b_cThe smaller the value (the smaller the bandwidth), the slower the system response, the higher the stability, and the smaller the steady-state fluctuation; ω b_c The larger the value (the larger the bandwidth), the faster the system response, the worse the stability, and the greater the steady-state volatility.

[0061] Figure 5 The step response under different damping ratios is shown in Table 1. Meanwhile, the response characteristics under different damping ratios are shown in Table 1 below.

[0062]

[0063] Table 1

[0064] When the motor runs within the rated speed range, the current loop and closed-loop transfer functions can be simplified:

[0065]

[0066] From the above introduction, we can see that Therefore, the simplified current loop closed-loop transfer function can be expressed as ε c The form is:

[0067]

[0068] Therefore, we can combine Table 1 to select different damping ratios ε according to different current loop response requirements. c . Engineering optimal damping ratio at this time At this time, the optimal oscillation frequency ω n_c and bandwidth frequency ω b_c The same. Thus, at the optimal damping ratio same, When the motor control frequency is higher, the control period T s The smaller the current loop is, the better the damping ratio is in the project. The current loop bandwidth frequency ω can be designed under b_c The bigger.

[0069] In some cases, the current loop can be reduced in order, and equation (8) can be expressed as:

[0070]

[0071] The reduced-order transfer function shown in Equation (9) is based on the engineering optimal damping ratio In specific application conditions, in order to obtain the required response speed, stability, and steady-state volatility, different damping ratios ε can be selected. c , so the reduced-order transfer function will be different. In this case, you can refer to the unreduced formula (8).

[0072] 1.2. Speed loop tuning

[0073] During the speed loop tuning process, the current loop closed-loop transfer function can be simplified to Figure 6 The simplified double closed-loop control diagram of the discrete model motor is shown.

[0074] In the figure, T d The delay caused by the speed loop control cycle, ε c is the current loop damping ratio, by setting different ε c , different current response speeds can be obtained. The open-loop transfer function of the motor speed and current dual closed-loop system can be expressed as:

[0075]

[0076] make Then formula (10) can be simplified as:

[0077]

[0078] In order to ensure the cutoff frequency ω c_s The maximum phase margin is at Define σ as the damping factor for analysis.

[0079] Therefore, for the discrete model, the double closed-loop tuning process is as follows:

[0080] First, adjust the current loop integral coefficient Realize zero-pole cancellation in the current loop transfer function and simplify the system model.

[0081] Then adjust the current loop proportional coefficient K p_c When adjusting the current loop, the transfer function of the current loop is a second-order oscillation system. In actual use, the current loop damping ratio ε can be adjusted according to the actual application. c Adjustment is required. If the motor response speed is high and the steady-state fluctuation is not high, a smaller ε can be selected. c , so that the motor works in an underdamped state; if the motor response speed is not required to be high, but the steady-state fluctuation is required to be high, a larger ε can be selected. c , so that the motor works in an over-damped state. In some general occasions, a compromise is generally made between response speed and stability, and the second-order system is corrected to the engineering optimal second-order system. At this time, the optimal damping ratio

[0082] When the speed loop is adjusted, the current loop can be simplified to a first-order inertia link. At this time, the speed and current double closed loop system is a third-order system, and its second turning frequency is (current loop bandwidth frequency), the size of the damping factor σ will determine the first turning frequency ω1 and the cutoff frequency ω c_s , which determines the response speed and stability of the system. The larger the damping factor σ, the stronger the stability, but the slower the system response speed; the smaller the damping factor σ, the worse the stability, but the faster the system response speed. The corresponding damping factor σ can be set according to the actual system needs. At this time, When the current loop operates at the optimal damping ratio At this time

[0083] 1.3. Position loop tuning

[0084] When modeling and analyzing the motor position loop, the speed loop is a high-order system, so the design of the position loop is very complex. At the same time, since the response speed of the position loop is slower than that of the speed loop, the speed loop can be reduced in order when tuning the position loop. That is, the closed-loop transfer function of the speed loop is simplified to a first-order inertia link. The open-loop transfer function of the speed loop can be expressed as:

[0085]

[0086] In formula (12), K V It is the speed loop closed loop magnification factor. In practical applications, it is generally set to 1, that is, the steady-state speed is consistent with the given speed when stable, and there is no magnification relationship. V is the integral time constant of the equivalent inertia link. In practical applications, in order to simplify the calculation, T V Set to the reciprocal of the speed loop cutoff frequency, that is, Therefore, the simplified closed-loop transfer function of the speed loop can be expressed as:

[0087]

[0088] Because position is derived from velocity integration, the position loop itself has an integral component. Therefore, a purely proportional position loop can achieve steady-state error-free operation. However, during the control process, the velocity and current loops introduce phase lag. Using PI control results in minimal phase margin, making it difficult to increase the position loop bandwidth. Therefore, in motor control, the position loop generally uses a purely proportional component.

[0089] Figure 7 The following figure shows the simplified three-loop control diagram of the discrete model motor. p_p is the proportional coefficient of the position loop. Since the output of the speed loop is the speed, the unit is r / min, it is combined with Multiply and convert to rad / s, through the integration link The final rotor position is obtained, so the open-loop transfer function of the position loop can be expressed as:

[0090]

[0091] The position loop generally needs to ensure that the response has no overshoot, so the control system needs to be in critical damping ε p =1 or overdamped ε p >1. Equation (14) can be organized into the standard form of the open-loop function of a second-order system.

[0092]

[0093] Where, ω n_p is the natural oscillation frequency of the second-order position loop system In order to ensure that the position loop has no overshoot, (The system works in critical damping or overdamping state), simplifying to: K p_p ≤2.3875ω c_s , depending on the selected K p_p , the bandwidth of the position loop can be obtained

[0094] Since the position loop generally needs to ensure that the response has no overshoot, the control system is in a critical damping state ε p =1, then it satisfies Right now:

[0095] K p_p =ω c_s ×0.25×9.55=2.3875ω c_s (16)

[0096] At this time, the natural oscillation frequency of the second-order system is ω b_p =0.643ω n_p =0.32ω c_s .

[0097] As above combined with the attached Figure 3-7 This article describes a method for calculating theoretical PID parameter values for the current loop, velocity loop, and position loop based on motor parameters using a discrete model. It should be understood that in other implementations, methods other than those described above may be used to calculate theoretical PID parameter values based on a discrete model.

[0098] II. Adjustment of PID parameter theoretical values

[0099] 2.1. Adjustment of the theoretical values of the current loop PID parameters

[0100] In the prior art, calculated PID theoretical parameter values are often used directly to control motor operation. However, in actual measurement, the motor's electrical parameters are difficult to accurately measure due to the influence of the measuring instrument. Furthermore, the electrical and mechanical parameters often change during motor operation, making it difficult for the theoretically calculated PID parameters to meet actual operating requirements. Therefore, this disclosure proposes a high-precision PID parameter tuning solution for motor control.

[0101] Figure 8 The schematic flow chart of the motor control PID parameter tuning method according to one embodiment of the present disclosure is shown. The method can fine-tune the PID parameters according to the comparison value between the actual feedback current and the given current. The method can be applied to Figure 1 The double closed loop control shown is particularly suitable for Figure 2 The three closed-loop servo control scenario shown in the figure should be understood that in actual operation, Figure 1 The current loops PID2 and PID3 shown have the same PID parameters and can therefore be adjusted as a whole.

[0102] In step S810, theoretical current loop PID parameter values are calculated based on the motor's stationary parameters and a discrete current loop model. For example, the theoretical current loop PID parameter values are calculated based on the discrete current loop model as described in Section I above. Furthermore, a desired current loop bandwidth can be determined based on the theoretical current loop PID parameter values. This desired current loop bandwidth can be used for the preferred operation in step S820.

[0103] In step S820, actual motor control is performed using the theoretical current loop PID parameter values. During this process, a first given current is input into the q-axis to obtain a first feedback current. This first given current is a sinusoidal current having a first given frequency. It can be considered that during the control process, a sinusoidal current with a determined frequency and amplitude is continuously injected into the q-axis for multiple cycles. Here, "sinusoidal current" can be a "sinusoidal current" injected starting with any initial phase. In other words, the injected current can also be a cosine current or a sinusoidal current with another initial phase.

[0104] Then, in step S830, a first comparison result between the first feedback current and the first given current is obtained based on a multi-point FFT calculation. Since the theoretical PID value calculation is based on a discrete model in step S810, the actual feedback current can be directly calculated in the frequency domain. Compared with time domain signal processing, the frequency domain signal processing method has high data utilization, high measurement accuracy, and strong anti-interference ability. In some dual closed-loop control situations, the time domain signal processing method can be used to calculate the feedback current. In control systems with higher precision requirements, such as Figure 2In the servo control system shown, a frequency domain signal processing method needs to be adopted.

[0105] Common frequency domain signal processing methods include DFT (Discrete Fourier Transform) and FFT (Fast Fourier Transform). As a special case of DFT, FFT has a much smaller computational complexity than DFT. Therefore, in this disclosure, FFT is used to calculate the feedback current signal. Before introducing FFT, the calculation formula of DFT is first introduced. The N-point DFT of signal x(n) is expressed as:

[0106]

[0107] When the DFT processed signal is 2 N times, based on the rotation factor Symmetry Periodicity Reducibility The DFT operation can be converted to an FFT operation. In other words, the number of points processed by the FFT needs to be 2 N , where N is a positive integer. At this time, the N-point DFT algorithm operation time is compared with the N-point FFT operation time to reduce the algorithm operation amount. By analogy with the 512-point, 1024-point, and 2048-point FFTs used in the preferred embodiment of the present disclosure, the computational complexity of the DFT is 114 times, 205 times, and 372 times that of the FFT, respectively. This shows that using FFT for signal processing can significantly reduce the computational complexity of the algorithm.

[0108] Therefore, the multi-point FFT calculation in step S830 is actually 2 N Point FFT calculation, where N is a positive integer. In addition, spectrum leakage needs to be avoided when using FFT calculation. Simply put, the reason for spectrum leakage is that the sampling frequency is not synchronized with the signal frequency, which makes the phase of the periodic sampling signal discontinuous at the beginning and end. Therefore, in order to avoid spectrum leakage, the first given frequency needs to be an integer multiple of the frequency resolution. Here, the frequency resolution is the ratio of the control frequency to 2 N For example, in the FOC control system, the control frequency is 16KHz, 2 N =512 (corresponding to N=9), the frequency resolution is Δf=16KHz / 512=31.25Hz, that is, when the processed signal frequency is an integer multiple of 31.25Hz, no spectrum leakage will occur, and the accuracy of the calculated feedback signal amplitude and phase can be guaranteed.

[0109] Furthermore, the motor control PID parameter tuning method disclosed herein is intended to improve the actual operating performance of the motor, and the feedback current at the desired current loop bandwidth is more representative of the actual operating conditions of the motor. Therefore, in one embodiment, the first given frequency is preferably the desired current loop bandwidth value, or at least a frequency that is not far from the desired current loop bandwidth, such as a frequency that does not differ from the desired current loop bandwidth by more than a predetermined threshold. The expected threshold can be an expected percentage. For example, when the desired current loop bandwidth value is 1200 Hz and the expected threshold is 4%, other frequencies between 1152 and 1248 Hz can be selected.

[0110] Since the first given frequency needs to be an integer multiple of the frequency resolution, the value of N needs to be selected so that the difference between the first given frequency and the current loop expected bandwidth does not exceed a predetermined threshold. For example, when the current loop expected bandwidth is 1200 Hz and the expected threshold is 4%, if N=7 (i.e., 2 N =128), then the frequency resolution is Δf=16KHz / 128=125Hz. The integer multiple frequency of 125Hz closest to 1200Hz is 1250Hz, which exceeds the 4% threshold. Therefore, it is necessary to further increase the value of N. For example, if N=8 (i.e., 2 N =256), the frequency resolution is Δf=16KHz / 256=62.5Hz. The integer multiple frequency of 62.5Hz closest to 1200Hz is 1187.5Hz, which does not exceed the 4% threshold. Therefore, in this case, it is necessary to select a multi-point FFT calculation of at least 256 points or more. In theory, the larger the value of N, the higher the calculation accuracy, but due to the limited computing power of the motor MCU, it is necessary to reasonably select the value of N. For example, in the following embodiment of the present disclosure, N can be selected to be no less than 9, that is, the multi-point FFT is at least 512-point FFT calculation, and the default value of N is 9, that is, N FFT =512.

[0111] In one embodiment, selecting the value of N so that the first given frequency does not differ from the desired bandwidth of the current loop by more than a predetermined threshold may include: using a default N value to calculate the integer multiple value closest to the desired bandwidth of the current loop (corresponding to the integer multiple value num FFT ); Calculate the signal frequency under the nearest integer multiple value (corresponding to the following ω ref ) and the error between the current loop expected bandwidth (corresponding to the following error ratio ); if the error value is less than the predetermined threshold, using the signal frequency at the closest integer multiple value as the first given frequency; and if the error value is greater than the predetermined threshold, increasing the value of N until the new error value is less than the predetermined threshold.

[0112] As will be described in detail below, the comparison between the first feedback current and the first given current can be an amplitude comparison or a phase comparison, preferably a comparison of both amplitude and phase. To this end, in one embodiment, the first comparison result includes a first amplitude comparison result and a first phase comparison result, and obtaining the first comparison result between the first feedback current and the first given current based on a multi-point FFT calculation includes: obtaining the amplitude and phase of the first feedback current through a multi-point FFT calculation; and using the amplitude comparison result between the first feedback current and the first given current as the first amplitude comparison result, and using the phase comparison result between the first feedback current and the first given current as the first phase comparison result.

[0113] Subsequently, in step S830, the current loop PID parameter values can be adjusted based on the first comparison result until a new first feedback current obtained by controlling the actual motor using the adjusted current loop PID parameter values and a new first comparison result with the first set current meet a first predetermined condition. Specifically, if the first comparison result indicates a discrepancy with the first predetermined adjustment, the current loop PID parameter values can be adjusted, and the actual motor control and q-axis first set current injection can be re-performed using the adjusted PID parameter values. The actual feedback current obtained under the adjusted current loop PID parameters can be obtained. This adjustment can be repeated until the new first comparison result with the first set current meets the first predetermined condition. It should be understood that during this repeated adjustment, the frequency and amplitude of the first set current preferably remain unchanged. In other embodiments, since the amplitude comparison value between the set current and the feedback current is obtained, the amplitude of the first set current can be changed. In one embodiment, the first predetermined condition can specify that the amplitude and phase of the actual feedback current must be compared with the amplitude and phase of the first set current.

[0114] Because actual motor parameters obtained through labeling or measurement deviate from their true values, and because these parameters change during motor operation, directly using theoretical motor control PID parameters calculated based on labeling or measurement to control the motor often results in deviations between the actual response characteristics and the theoretical analysis. Therefore, the present disclosure fine-tunes the theoretically calculated current loop PID parameters based on the actual response characteristics, enabling motor control to better meet the needs of practical applications.

[0115] The first predetermined condition typically requires that the new first comparison result be no worse than the theoretical change value. Here, "worse than" can mean that the amplitude and phase changes of the actual feedback current are generally worse than the theoretical change values; more specifically, the amplitude attenuation of the actual feedback current is greater than the theoretical amplitude attenuation (i.e., the amplitude change value of the actual feedback current after attenuation is less than the theoretical amplitude change value), and / or the phase change of the actual feedback current is greater than the theoretical phase change value (the phase lag of the actual feedback current relative to the given current is greater than the theoretical value). To this end, the first predetermined condition requires that both the new first amplitude comparison result and the first phase comparison result be no worse than their respective theoretical values.

[0116] In one embodiment, the first predetermined condition may be a requirement that the comparison result of the new first feedback current obtained under the current loop PID parameters after tuning and the new first amplitude of the first given current is not less than the first theoretical amplitude change value, and the comparison result of the new first feedback current and the new first phase of the first given current is not greater than the first theoretical amplitude change value. In other words, it is required that the actual feedback amplitude is not less than the amplitude of the simulated feedback current obtained by simulating the theoretical value, and the phase does not lag behind the phase of the simulated feedback current. For example, in the following combination Figure 11 In the example, when the first given current is the desired bandwidth of the current loop, the amplitude ratio of the simulated feedback current to the given current is 0.707 (i.e., the amplitude change value is 0.707), and the phase of the simulated feedback current lags behind the phase of the given current by 45°. In this case, the first theoretical amplitude change value is 0.707, and the first theoretical amplitude change value is 45°. In this case, the first predetermined adjustment can require that the new first amplitude comparison result is no less than 0.707 and the new first phase comparison result is no greater than 45°. In other words, the amplitude ratio of the new first feedback current to the first given current is required to be no less than 0.707, and the phase lag is required to be no more than 45°.

[0117] At this time, based on the first comparison result, adjusting the current loop PID parameter value until a new first feedback current obtained by using the adjusted current loop PID parameter value for actual motor control and a new first comparison result of the first given current meet a first predetermined condition, including: in response to the first amplitude comparison result being greater than the first theoretical amplitude change value and / or the first phase comparison result being less than the first theoretical phase change value, adjusting the value of the current loop PID parameter until the newly obtained first comparison result is no longer inferior to the theoretical change value, that is, the newly obtained first amplitude comparison result is not less than the first theoretical amplitude change value and the first phase comparison result is not greater than the theoretical phase change value.

[0118] In one embodiment, the current loop integral coefficient K can be adjusted i_c and the current loop proportional coefficient K p_c Both are used to adjust the current loop PID parameter value.

[0119] Due to the increase of the current loop integral coefficient K i_c It is easy to cause the system to lose control, so this disclosure mainly adopts the method of automatically increasing the proportional factor K p_c The integration factor K i_c Fine-tuning can be performed selectively. In one embodiment, only the current loop proportional coefficient K can be adjusted. p_c By increasing the current loop proportional coefficient K p_c , in order to increase the actual bandwidth of the current loop, thereby improving the control performance of the motor.

[0120] Although increasing the actual bandwidth of the current loop can improve the response speed of the motor, it can also easily lead to system instability. Therefore, when the first feedback current performance obtained by the theoretical current loop PID parameters is better than the theoretical change value, the current loop proportional coefficient K can be reduced. p_c , reducing the actual bandwidth of the current loop so that it is ultimately the same as the expected bandwidth value, thereby improving system stability while meeting the theoretical control performance. Similarly, "better than" here can mean that the amplitude and phase changes of the actual feedback current are better than their respective corresponding theoretical change values; more specifically, the amplitude attenuation of the actual feedback current is less than the theoretical amplitude attenuation (that is, the amplitude change value of the actual feedback current after attenuation is greater than the theoretical amplitude change value), and the phase change of the actual feedback current is less than the theoretical phase change value (the phase lag of the actual feedback current relative to the given current is smaller than the theoretical value). To this end, as a supplement, the first predetermined condition also requires that both the new first amplitude comparison result and the first phase comparison result are not better than their respective theoretical values.

[0121] Therefore, in one embodiment, based on the first comparison result, adjusting the current loop PID parameter value until a new first feedback current obtained by using the adjusted current loop PID parameter value for actual motor control and a new first comparison result of the first given current meet a first predetermined condition, including: in response to the first amplitude comparison result being greater than a first theoretical amplitude change value and the first phase comparison result being less than a first theoretical phase change value, adjusting the value of the current loop PID parameter until the newly obtained first comparison result is no longer better than the theoretical change value, that is, the newly obtained first amplitude comparison result is not greater than the first theoretical amplitude change value and / or the first phase comparison result is not less than the theoretical phase change value.

[0122] In addition, it should be understood that the adjustment of the current loop PID parameter value of the present disclosure can be automatically performed based on the comparison result. For example, if the comparison result indicates that the current loop proportional coefficient needs to be increased, the current loop proportional coefficient can be adjusted according to a predetermined step length until the new comparison result satisfies the conditions. Similarly, if the comparison result indicates that the current loop proportional coefficient needs to be decreased, the current loop proportional coefficient can be adjusted according to a predetermined step length until the new comparison result satisfies the conditions. When the current loop proportional coefficient is near the preferred value, the current loop proportional coefficient can also be adjusted with a smaller step length.

[0123] For ease of understanding, the adjustment of the theoretical values of the current loop PID parameters will be further described below with reference to the accompanying drawings and examples.

[0124] 2.2. Current loop PID parameter adjustment example

[0125] Response test performed on a 24V motor: resistance R = 0.24Ω, inductance L = 0.00023H; mechanical parameters: moment of inertia J = 0.0000288 kg·m 2 First, the implementation process can be simulated and tested. During the test, the motor parameters and motor model are accurate. During the test, the current loop bandwidth ω is adjusted according to the response requirements. b_c Set to 7542rad / s, the corresponding frequency is f b_c =1200Hz.

[0126] According to the above calculation process, the current loop PID parameters can be obtained

[0127] First, perform a current loop frequency sweep test in the simulation. Figure 9 The following figure shows the block diagram of the current loop PID response simulation test. When the current loop PID parameters are adjusted, the speed loop and position loop related operations are not included. Figure 9 The test does not need to include Figure 1 The speed loop PID and Figure 2 In addition, since the PID parameters of the two current loops are the same, the following are not performed here. Figure 1 The distinction between PID2 and PID3 is shown.

[0128] amp*sin(ωt) is the q-axis current reference, amp is the amplitude of the given sinusoidal current, sin(ωt) is the sinusoidal reference, and ω is the given signal frequency. In some embodiments, the q-axis current reference can also be const+amp*sin(ωt), where const is a reference offset value corresponding to the offset of the given sinusoidal current (or cosine current or other sinusoidal current with an initial phase). In some control modes with a position sensor, that is, when the rotor position θ can be correctly detected even when the motor is at zero speed or in a forward and reverse cycle, const can be set to 0. In some sensorless control modes, the motor's rotor position θ can only be correctly detected when the motor is in a rotating state. Therefore, an offset value can be selectively added based on the actual application (the rotor position θ participates in the Park transform and inverse Park transform, which are essential in the current loop control process). In addition, although not shown in the figure, the given current can also have a non-zero initial phase. Since the phase lag between the feedback current and the given current is required, the introduction of the initial phase will not have any impact on this value.

[0129] In servo control, absolute position encoders are often used. When the motor is at zero speed or cyclically rotating forward and reverse, the rotor position θ can be correctly detected. At this time, the amp can be set to a sinusoidal signal of different frequencies to test the current loop response characteristics.

[0130] Figure 10 The following figure shows the simulated response curve for a sinusoidal reference frequency of 500 Hz. As shown, the sinusoidal reference frequency is set to ω = 3142 rad / s, corresponding to a frequency of f = 500 Hz and an amp of 0.5 A. In the figure, the black curve represents the reference current value, the red curve represents the feedback current value, the black dots represent the sampling points of the reference current, and the red dots represent the sampling points of the feedback current.

[0131] When the control frequency is 16KHz and the current loop given signal frequency is 500Hz, the number of sampling points in one cycle is If the default 512-point FFT operation is used, that is, the default N value = 9, the frequency resolution is When the signal frequency is an integer multiple of 31.25Hz, spectrum leakage does not occur, ensuring the accuracy of the calculated amplitude and phase. The accuracy of the calculated amplitude and phase is guaranteed because the current loop's given signal frequency is 500Hz, and 500Hz / 15.625Hz = 16. In this case, the value at X(k = 16) can be directly calculated. Its amplitude and phase are:

[0132]

[0133]

[0134] Where, XR (k) is the real part of X(k), X I (k) is the imaginary part of X(k).

[0135] According to the above calculation method, the given current signal amplitude is 0.500, the phase is 112.5°, the feedback current signal amplitude is 0.496, the phase is 76.5°, so the amplitude change value is 0.496 / 0.500=0.992, and the phase lag is 112.5°-76.5°=36.0°.

[0136] The above describes the process of calculating the amplitude change value and phase lag value by FFT. However, in the actual process, the calculated bandwidth is not necessarily an integer multiple of 31.25Hz. Therefore, according to the actual calculated bandwidth frequency, it is necessary to find the nearest current loop bandwidth ω. b_c =7542rad / s(1200Hz) and the point where spectrum leakage can be avoided. According to 1200Hz / 31.25Hz=38.4, the default N value is calculated to be the integer multiple value num closest to the expected bandwidth of the current loop. FFT =38. Then calculate the error between the signal frequency at the nearest integer multiple value and the expected bandwidth of the current loop. At this time, the signal frequency at the nearest integer multiple value ω ref =31.25Hz×38=1187.5Hz.

[0137] In one embodiment, the error ratio error can be calculated according to the following formula ratio :

[0138]

[0139] In another embodiment, the error ratio error can be calculated according to the formula ratio :

[0140]

[0141] Regardless of the calculation method, the obtained error ratio is smaller than the predetermined threshold (for example, 5%). Therefore, 1187.5 Hz is selected as the current loop sweep frequency, that is, as the first given frequency. Figure 11 The actual response curve of the motor when 1187.5Hz is selected as the first given frequency is shown. At this time, the PID parameters adjusted according to the theory are K p_c =1.173, K i_c =1091.

[0142] When the current loop sinusoidal given frequency is 1187.5Hz, it is close to the current loop bandwidth frequency ω b_c=7542rad / s (1200Hz), the response current amplitude is 0.664 times the given current amplitude (corresponding to the first amplitude comparison result), and the phase lag is 100.7° (corresponding to the first phase comparison result). In order to ensure that the current loop is within the bandwidth frequency ω b_c It has a higher response speed. Generally, it is necessary to ensure that the response signal amplitude at the bandwidth frequency is greater than 0.707 times the given signal amplitude, and the phase lag is less than 45.0° (that is, the first theoretical amplitude change value is 0.707, and the first theoretical phase change value is 45.0°. These two values can be calculated based on the theoretical value of the given frequency of 1200Hz. The subsequent speed loop and position loop can also be adjusted according to this principle). At this time, the PID parameters obtained according to the theoretical adjustment do not meet the actual response requirements (at this time, the first amplitude comparison result is less than the first theoretical amplitude change value and the first phase comparison result is greater than the first theoretical phase change value). Therefore, PID self-adjustment is required on this basis. Increase the proportional factor K p_c and the integrating factor K i_c The bandwidth of the system can be improved on this basis, but the present disclosure preferably adopts the automatic increase of the proportional factor K p_c The integration factor K i_c Fine-tuning is optional.

[0143] Figure 12 The figure shows the actual response curve when the sinusoidal given frequency is 1187.5Hz after the current loop PID parameters are adjusted. p_c =3.173, the response current amplitude is 1.05 times the given value, and the phase lag is 61.7°. Although the first amplitude comparison result is greater than the first theoretical amplitude change value, the first phase comparison result is still greater than the first theoretical phase change value, which does not meet the first predetermined condition. Therefore, it is necessary to continue to increase the proportional factor K. p_c .

[0144] Figure 13 The figure shows the actual response curve when the sinusoidal given frequency is 1187.5Hz after the current loop PID parameters are adjusted. p_c =5.2, the response current amplitude is 1.07 times the given value, and the phase lag is 45.0°. At this time, the first amplitude comparison result is greater than the first theoretical amplitude change value, and the first phase comparison result is not greater than the first theoretical phase change value, which meets the first predetermined condition. Therefore, it can be considered that the adjusted current loop PID parameter (K p_c =5.2) to meet actual bandwidth requirements.

[0145] 2.3. Speed loop PID parameter adjustment

[0146] In one embodiment, only the current loop PID parameter values may be adjusted. In this case, the adjusted current loop PID parameter values may be used to obtain the speed loop PID parameter values, and the obtained speed loop PID parameter values may be directly used to participate in actual motor control.

[0147] In another embodiment, after the current loop PID parameter value is fully adjusted, the speed loop PID parameter value can also be adjusted accordingly. In this case, the PID parameter value adjustment method disclosed herein further includes: calculating the theoretical speed loop PID parameter value based on the parameters of the motor when it is stationary and the discrete current loop model; using the adjusted current loop PID parameter value to perform actual motor control to adjust the speed loop PID parameter value, wherein the adjusting the speed loop PID parameter value further includes: using the adjusted current loop PID parameter value and the theoretical speed loop PID parameter value to perform actual motor control, during which a second given speed is input to the speed loop to obtain a second feedback speed, wherein the second given speed is a sinusoidal speed signal with a second given frequency; obtaining a second comparison result between the second feedback speed and the second given speed; and adjusting the speed loop PID parameter value based on the second comparison result until the new second feedback speed obtained by using the adjusted speed loop PID parameter value to perform actual motor control and the new second comparison result between the second given speed and the second given speed meet the second predetermined condition.

[0148] It should be understood that the theoretical speed loop PID parameter values can be calculated together with the theoretical current loop PID parameter values in step S810 based on the parameters when the motor is stationary. Furthermore, while the terms "second set speed" and "second feedback speed" are used herein, the "second" designation refers to the speed loop rather than the current loop, and does not imply that a "first set speed" or "first feedback speed" must be prepared when tuning the current loop PID parameter values.

[0149] Similar to adjusting the current loop PID parameters, when adjusting the speed loop PID parameters, a frequency that differs from the desired bandwidth of the speed loop within a predetermined threshold and does not cause frequency leakage can also be used as the frequency corresponding to the second given speed. Furthermore, during the specific comparison, the amplitude attenuation and phase lag values of the second feedback speed compared to the second given speed can be compared with the theoretical change value. If the second predetermined condition is not met, the corresponding speed loop PID parameter adjustment is performed. It should be understood that if, due to the adjustment of the current loop PID parameters, the comparison result of the second feedback speed under the control of the speed loop PID parameters thereby obtained satisfies the second predetermined condition, i.e., the amplitude attenuation and phase lag values of the second feedback speed are not inferior to the theoretical change value (i.e., the amplitude attenuation of the feedback speed is not greater than the theoretical amplitude attenuation (the second amplitude comparison result is not less than the corresponding theoretical value) and the phase lag value is not greater than the theoretical phase lag value), then the speed loop PID parameters may no longer be adjusted.

[0150] In a specific implementation example, when the speed loop is tuned, the damping factor of the speed loop is σ=6.0. At this time, the cutoff frequency of the speed loop is ω c_s =667rad / s(106.1Hz), and at the same time, the adjusted current loop parameters are brought in. At this time, if the 512-point FFT operation is continued, according to So it is closest to the speed loop cutoff frequency ω c_s =667rad / s(106.1Hz) and the given signal frequency that can avoid spectrum leakage is 31.25H×3=93.75Hz. But in fact, when the speed loop is tuned, At this time, the given sweep signal frequency is 93.75Hz and the speed loop cutoff frequency ω c_s A large difference will lead to a large measurement error. When adjusting the position loop, since the bandwidth frequency of the position loop will be lower, continuing to use the 512-point FFT sweep experiment will cause a larger measurement error. Increasing the number of FFT operation points will increase the frequency resolution Δf, but the corresponding FFT operation time will be longer. Therefore, it is necessary to balance the operation time and the required resolution and select a reasonable number of FFT operation points while meeting actual needs. Define the speed loop cutoff frequency ω c_s and the sweep signal frequency ω ref The error ratio between them is as follows:

[0151]

[0152] Generally speaking, when error ratio Within the range of 5%, the sweep signal frequency ω can be approximately considered ref ≈cutoff frequencyω c_s In other words, the second predetermined threshold of the speed loop can be set to 5%, and the error ratio When it is less than the second predetermined threshold value of 5%, it can be determined that the PID parameters adjusted by the frequency sweep are accurate.

[0153] According to the above theory, the frequency sweep process using FFT is optimized, and the speed loop cutoff frequency ω is completed. c_s After calculation, first calculate In the formula, floor represents the integer rounded up to four and five, N FFT is the number of FFT operation points. Initially, N FFT is 512 points, (F s is the motor control frequency. In the FOC control process, F s If 16KHz is selected, the integer multiples of the frequency resolution are:

[0154]

[0155] Thus ω ref =num FFT ×(F s / N FFT )×2π=585rad / s(93.1Hz), and calculate the error based on this ratio , 512 o'clock

[0156] At this point, it is necessary to further increase N FFT is 1024 points. Thus ω ref =num FFT ×(F s / N FFT )×2π=687rad / s, At this time error ratio =3.0%<5.0%, sweep signal frequency ω ref ≈cutoff frequencyω c_s Therefore, a 1024-point FFT sweep frequency experiment was conducted on the velocity loop under these parameters. The velocity loop set signal frequency was 687 rad / s, and the set velocity signal amplitude was 30.

[0157] Figure 14 The actual response curve of the speed loop sine given frequency is 109.4Hz. At this time, the speed loop PID parameters used are still the parameters calculated based on the theoretical values, specifically K p_s =0.062, K i_s =174.5. When the speed loop sinusoidal given frequency is 687rad / s (109.4Hz), it is close to the speed loop cutoff frequency ω c_s =667rad / s (106.1Hz), the response speed amplitude is 0.856 times the given value, and the phase lag is 57.5°. In order to ensure that the speed loop has a high response speed at the bandwidth frequency, it is generally necessary to ensure that the response signal amplitude at the bandwidth frequency is greater than 0.707 times the given signal amplitude, and the phase lag is less than 45.0°. The amplitude attenuation and phase lag target conditions for fine-tuning the speed loop PID parameters. That is, the second theoretical amplitude change value and the second theoretical phase change value are also 0.707 and 45.0°. At this time, the PID parameters obtained by tuning do not meet the actual response requirements and need to be fine-tuned.

[0158] Here, the amplitude attenuation and phase lag of the second feedback speed can also be improved by increasing the speed loop proportional coefficient. Figure 15 The figure shows the actual response curve when the sinusoidal given frequency is 109.4Hz after the speed loop PID parameters are adjusted. p_s =0.080, K i_s=174.5. At this time, the response speed amplitude is 0.98 times the given value, and the phase lag is 44.9°, both of which are better than their corresponding second theoretical change values (0.98 is greater than 0.707 and 44.9° is less than 45.0°, meeting the second predetermined condition). At this time, it can be considered that the adjusted speed loop PID parameters meet the actual bandwidth requirements.

[0159] 2.4. Position loop PID parameter adjustment

[0160] In one embodiment, only the current loop PID parameter values may be adjusted. In this case, the adjusted current loop PID parameter values may be used to obtain the speed loop and position loop PID parameter values, and the obtained speed loop and position loop PID parameter values may be directly used to participate in the actual motor servo control.

[0161] In one embodiment, after adjusting the current loop PID parameter value, the speed loop can be adjusted, and the adjusted current loop and speed loop PID parameters can be used to obtain the position loop PID parameter value, and the obtained position loop PID parameter value can be directly used to participate in the actual motor servo control.

[0162] In another embodiment, after the current loop and speed loop PID parameter values are adjusted, the position loop PID parameters can also be adjusted accordingly. In this case, the PID parameter value adjustment method disclosed herein further includes: calculating the theoretical position loop PID parameter value based on the parameters of the motor when it is stationary and the discrete current loop model; using the adjusted current loop PID parameter value and the adjusted speed loop PID parameter value to obtain the position loop PID parameter value; using the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value and the position loop PID parameter value to perform actual motor control, during which the position loop inputs a third given position to obtain a third feedback position, wherein the third given position is a sinusoidal position signal with a third given frequency; obtaining a third comparison result between the third feedback position and the third given position; and adjusting the position loop PID parameter value based on the third comparison result until the new third feedback position obtained by using the adjusted position loop PID parameter value to perform actual motor control and the new third comparison result between the third given position and the third feedback position meet a third predetermined condition.

[0163] It should be understood that the theoretical position loop PID parameter values can be calculated based on the motor's stationary parameters, along with the theoretical current loop PID parameter values in step S810 and the theoretical speed loop PID parameter values described above. Furthermore, while the terms "third given position" and "third feedback position" are used herein, the "third" designation is intended to illustrate the position loop operation and does not imply the need to prepare a "first given position" and "second given position" or obtain a "first feedback position" and "second feedback position" when tuning the current loop or speed loop PID parameter values.

[0164] Similar to the adjustment of the current loop and velocity loop PID parameters, when adjusting the position loop PID parameters, a frequency that differs from the desired bandwidth of the position loop within a predetermined threshold and does not cause frequency leakage can also be used as the corresponding frequency of the third given position. Furthermore, during the specific comparison, the amplitude change and phase lag of the third feedback position relative to the third given position can be compared with the theoretical change values. If the third predetermined condition is not met, then corresponding adjustments can be made. It should be understood that if, due to the adjustment of the current loop and velocity loop PID parameters, the comparison result of the third given position under the control of the position loop PID parameters thus obtained satisfies the third predetermined condition, i.e., the amplitude attenuation and phase lag values of the third given position are not inferior to their respective theoretical change values (i.e., the amplitude attenuation of the feedback position is not greater than the theoretical amplitude attenuation (the third amplitude comparison result is not less than the corresponding theoretical value) and the phase lag value is not greater than the theoretical phase lag value), then the position loop PID parameters can be further adjusted.

[0165] Specifically, the position loop can be subjected to a frequency sweep test using the same method. The bandwidth of the position loop is 256 rad / s (40.7 Hz). p_ p=1592.0. The minimum value of N can be obtained based on the FFT processing point calculation method similar to that of the speed loop. Here, the third predetermined threshold can also be 5%.

[0166] First select N FFT =512, at this time ω ref =num FFT ×(F s / N FFT )×2π=196rad / s, at this time

[0167] When N FFT =1024, at this time ω ref =num FFT ×(F s / N FFT )×2π=295rad / s, at this time

[0168] When N FFT =2048, at this time ω ref =num FFT ×(F s / N FFT )×2π=245rad / s, at this time At this time error ratio <5%, sweep signal frequency ω ref Position loop bandwidth frequency ω b_p .

[0169] Figure 16 The actual response curve is shown when the position loop sinusoidal given frequency is 39.0625Hz. ref =245rad / s(39.0625Hz), the position loop PID parameters used are still those calculated based on theoretical values, and the specific proportional coefficient is K p_p =1592.0.

[0170] When the position loop sinusoidal given frequency is 39.0625Hz, it is close to the position loop bandwidth ω b_p =256rad / s (40.7Hz), which meets the requirements of the third predetermined threshold. The response position amplitude shown in the figure is 0.63 times the given value, and the phase lag is 34.3°. At this time, if the third theoretical amplitude change value and the third theoretical phase change value are also 0.707 and 45.0°, the third phase comparison result is less than the third theoretical phase change value, but the third amplitude comparison result is still less than the third theoretical amplitude change value, which does not meet the third predetermined condition. It is necessary to continue to increase K p_p The position loop feedback position amplitude is attenuated to more than 0.707 times the given value.

[0171] Figure 17 The figure shows the actual response curve when the sinusoidal given frequency is 39.0625Hz after the position loop PID parameters are adjusted. ref =245rad / s(39.0625Hz), K p_p =2300.0. At this time, the feedback position amplitude is 0.708 times the given value, and the phase lag is 30.3°. It can be seen that the phase lag of the feedback position is less than 45.0°, and the feedback position amplitude is greater than 0.707 times the given position amplitude, meeting the third predetermined condition. At this time, it can be considered that the adjusted position loop PID parameters meet the actual bandwidth requirements.

[0172] Figure 18The figure shows the response curves of the three closed-loop speed, current, and position functions under theoretical PID parameters. The top portion shows the position loop response curve, the middle portion shows the speed loop response curve, and the bottom portion shows the current loop response curve. The figure shows that the current loop has the fastest response speed. When the set current changes, the feedback current follows the set current change in real time. The speed loop responds slower than the current loop, but faster than the position loop. After the speed loop reaches stability at point C, the position loop reaches stability at point B a short time later. The bandwidth difference between the position and speed loops is small.

[0173] Figure 19 The figure shows the response curves of the speed, current and position closed loops under the adjusted PID parameters. Similarly, the upper part is the position loop response curve, the middle part is the speed loop response curve, and the lower part is the current loop response curve. As shown in the figure, after adjustment, the current loop bandwidth has been significantly improved, and the speed loop bandwidth has been slightly improved, which is clearly different from the position loop bandwidth. At the same time, the C1 point of the speed loop stability should be earlier than Figure 1 Point C in 8, point B1 of the position loop is stable before Figure 1 Point B in 8. It can be seen that after PID parameter tuning, the control performance of the three closed loops has been improved.

[0174] The adjusted current loop PID parameter values obtained by the method described in this disclosure (when adjusting the speed loop and position loop parameters, the adjusted speed loop and position loop PID parameters are also written) can be written into the controller of the permanent magnet synchronous motor. The controller can then perform magnetic oriented vector control on the permanent magnet synchronous motor based on the adjusted current loop PID parameter values. In some application scenarios, the PID parameters can be adjusted again based on the current actual feedback current after the motor has been in actual use for a period of time.

[0175] In the motor whose PID parameters are adjusted by this method, a sinusoidal signal is given (the control frequency is divided by an integer multiple of the number of FFT operation points. For a 502-point FFT, the given signal frequency is a sine wave (current loop, speed loop, position loop, and the frequency is an integer multiple of the control frequency / 502. The effects are similar for 1024- and 2048-point FFTs). The feedback signals (current, speed, position) will also show the same frequency changes, and their amplitude attenuation and phase lag values are better than those of the motor controlled based on theoretical PID parameters, so they are easy to identify.

[0176] Figure 20 FIG1 shows a schematic diagram of the composition of a motor control system according to an embodiment of the present invention. As shown in the figure, the motor control system includes not only a motor part but also a control module for controlling the motor. Figure 20As shown, in one embodiment, the motor control system further includes a power supply, a microcontroller (MCU), a driver, an inverter, and a current sampling device, wherein the control module can be implemented by a processing unit in the MCU. In the present disclosure, the control module can control the motor using the adjusted PID parameters obtained based on the PID parameter tuning method described above. In some embodiments, the control module can perform FOC control, and in other embodiments, the control module can perform servo control.

[0177] Existing servo three-loop PID parameter tuning is mostly based on experience. Even when tuning is based on a model, it is usually performed according to a continuous model, ignoring the delay in the control process. This leads to inaccurate model construction and a certain gap between the theoretically tuned servo three-loop PID parameters and the actual PID parameters. Therefore, for servo three-loop PID parameter tuning, the present disclosure uses an FFT algorithm to automatically calculate amplitude attenuation and phase lag after completing the theoretical PID tuning. At the same time, the number of FFT operation points is automatically adjusted according to the frequency at the calculation bandwidth. This ensures that the given signal frequency is more accurate while avoiding spectrum leakage.

[0178] The present invention can first build a theoretical model of the servo system based on the motor parameters (electrical parameters, mechanical parameters) when the motor is stationary, combined with various delays caused by the discrete control process, to calculate relatively accurate theoretical three-loop PID parameters. Then, combined with the calculated theoretical PID parameters, during the actual motor control process of the MCU, frequency sweep experiments are performed on the current loop, speed loop, and position loop respectively (in order to maximize the accuracy of the frequency sweep results, multi-point FFT is used for amplitude and phase calculations, and in order to avoid spectrum leakage, an algorithm for automatically adjusting the number of FFT operation points is used). According to the frequency sweep results of the current loop, speed loop, and position loop, the PID parameters are automatically adjusted to achieve precise position control of the servo system.

[0179] This paper proposes a solution that uses theoretical current loop, velocity loop, and optional position loop PID parameters calculated based on discrete models. It uses FFT to calculate the phase lag and amplitude attenuation of the actual feedback current compared to a given current, and adaptively adjusts the current loop PID parameters accordingly. The scheme can also further adjust the velocity and position loop PID parameters. This solution leverages the noise immunity of the FFT algorithm to improve control accuracy, making it particularly suitable for three-loop closed-loop servo control including a position loop.

[0180] While various embodiments of the present invention have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for adjusting PID parameters of a motor control, comprising: Calculate the theoretical current loop PID parameter values based on the motor's static parameters and the discrete current loop model; Performing actual motor control using the theoretical current loop PID parameter value, during which a first given current is input into the q-axis to obtain a first feedback current, wherein the first given current is a sinusoidal current with a first given frequency; Obtaining a first comparison result between the first feedback current and the first given current based on multi-point FFT calculation; and Based on the first comparison result, the current loop PID parameter value is adjusted until a new first feedback current obtained by using the adjusted current loop PID parameter value to perform actual motor control and a new first comparison result of the first given current meets a first predetermined condition.

2. The method according to claim 1, wherein The multi-point FFT calculation is 2 N Point FFT calculation, N is a positive integer, and the first given frequency is an integer multiple of the frequency resolution, wherein the frequency resolution is the control frequency of the motor and 2 N Business.

3. The method according to claim 2, wherein: The value of the expected bandwidth of the current loop is determined based on the theoretical PID parameter value of the current loop, and the value of N is selected so that the first given frequency does not differ from the expected bandwidth of the current loop by more than a predetermined threshold.

4. The method according to claim 2, wherein: Selecting a value of N so that the first given frequency does not differ from the desired bandwidth of the current loop by more than a predetermined threshold comprises: Calculate the integer multiple value closest to the expected bandwidth of the current loop using the default N value; Calculating an error value between the signal frequency at the closest integer multiple value and the expected bandwidth of the current loop; If the error value is smaller than the predetermined threshold, using the signal frequency at the closest integer multiple value as the first given frequency; and If the error value is greater than the predetermined threshold, the value of N is increased until the new error value is less than the predetermined threshold.

5. The method according to claim 1, wherein The first comparison result includes a first amplitude comparison result and a first phase comparison result. The first comparison result between the first feedback current and the first given current obtained based on multi-point FFT calculation includes: Obtaining the amplitude and phase of the first feedback current by multi-point FFT calculation; and A result of comparing the amplitudes of the first feedback current and the first given current is used as a first amplitude comparison result, and a result of comparing the phases of the first feedback current and the first given current is used as a first phase comparison result.

6. The method according to claim 5, wherein: Adjusting the current loop PID parameter value based on the first comparison result until a new first feedback current obtained by using the adjusted current loop PID parameter value to perform actual motor control and a new first comparison result with the first given current satisfies a first predetermined condition includes: In response to the first amplitude comparison result being greater than a first theoretical amplitude change value and the first phase comparison result being less than a first theoretical phase change value, the value of the current loop PID parameter is adjusted until the newly obtained first amplitude comparison result is not greater than the first theoretical amplitude change value or the first phase comparison result is not less than the theoretical phase change value.

7. The method according to claim 5, wherein: Adjusting the current loop PID parameter value based on the first comparison result until a new first feedback current obtained by using the adjusted current loop PID parameter value to perform actual motor control and a new first comparison result with the first given current satisfies a first predetermined condition includes: In response to the first amplitude comparison result being less than the first theoretical amplitude change value and / or the first phase comparison result being greater than the first theoretical phase change value, the value of the current loop PID parameter is adjusted until the newly obtained first amplitude comparison result is not less than the first theoretical amplitude change value and the first phase comparison result is not greater than the first theoretical phase change value.

8. The method of claim 1, wherein: The adjusting the current loop PID parameter value includes: In response to the first comparison result being better than the theoretical change value, reducing the value of the current loop proportional coefficient; and In response to the first comparison result being inferior to the theoretical change value, the value of the current loop proportional coefficient is increased.

9. The method of claim 1 , further comprising: Calculate theoretical speed loop PID parameter values based on the motor's static parameters and discrete current loop model; as well as Performing actual motor control using the adjusted current loop PID parameter value to adjust the speed loop PID parameter value, wherein adjusting the speed loop PID parameter value further includes: performing actual motor control using the adjusted current loop PID parameter value and the theoretical speed loop PID parameter value, during which a second given speed is input into the speed loop to obtain a second feedback speed, wherein the second given speed is a sinusoidal speed signal having a second given frequency; Obtaining a second comparison result between the second feedback speed and the second given speed; and Based on the second comparison result, the speed loop PID parameter value is adjusted until a new second comparison result between a new second feedback speed obtained by using the adjusted speed loop PID parameter value to perform actual motor control and the second given speed meets a second predetermined condition.

10. The method of claim 9, further comprising: Calculate the theoretical position loop PID parameter values based on the motor's static parameters and the discrete current loop model; as well as Performing actual motor control using the adjusted current loop PID parameter value and the adjusted speed loop PID parameter value to adjust the position loop PID parameter value; performing actual motor control using the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value, and the theoretical position loop PID parameter value, during which a third given position is input into the position loop to obtain a third feedback position, wherein the third given position is a sinusoidal position signal having a third given frequency; Obtaining a third comparison result between the third feedback position and the third given position; and Based on the third comparison result, the position loop PID parameter value is adjusted until a new third feedback position obtained by using the adjusted position loop PID parameter value to perform actual motor control and a new third comparison result of the third given position meet a third predetermined condition.

11. The method of claim 10, further comprising: Writing the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value, and the adjusted position loop PID parameter value into a controller of the motor; as well as The controller performs magnetic orientation vector control during operation of the permanent magnet synchronous motor based on the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value, and the adjusted position loop PID parameter value.

12. A motor control system comprising: Motor; A control module is configured to control the motor using adjusted PID parameters obtained based on the PID parameter tuning method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Current ring starting method for permanent magnet synchronous motor with variable PID parameters

    CN107046387A

  • Parameter self-tuning method for permanent magnet synchronous servo motor control

    CN113824375A

  • Current control method and device of salient pole motor and motor control system

    CN116760327A

  • Method and device for adjusting current control gain of current control system

    JP2000184785A

  • Adaptive Controller for STATCOM to Enhance Voltage Stability

    US20130207620A1

Cited By

  • Servo motor rotating speed control method and device based on prediction model optimization

    CN121216970A

  • Servo motor speed control method and device based on prediction model optimization

    CN121216970B