Motor control PID parameter tuning method and motor control system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]为了解决如上至少一个问题,本公开提出了一种电机控制PID参数整定方案,该方案利用离散模型求取理论PID参数,并基于多点FFT技术获取实际反馈电流与给定电流的差异,对理论计算得到的PID参数进行自适应整定。
Smart Images

Figure CN120474403B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of motor control, and more particularly to a method for tuning PID parameters for motor control and a motor control system. Background Technology
[0002] In motor control, to ensure maximum torque output throughout the entire control cycle, Field-Oriented Control (FOC) is commonly used. Existing permanent magnet synchronous motor control systems primarily employ PID control.
[0003] Currently, the control systems of permanent magnet synchronous motors mainly employ a dual closed-loop control strategy with speed and current loops. In some high-precision position control applications, servo control of the motor is required. Servo control necessitates a triple closed-loop control system, including an additional position loop. The performance of the current, speed, and position loops is closely related to their PID parameters. Therefore, how to tune the PID parameters to improve closed-loop performance has become a problem to be solved in this field. Summary of the Invention
[0004] To address at least one of the above problems, this disclosure proposes a motor control PID parameter tuning scheme. This scheme uses a discrete model to obtain theoretical PID parameters and uses multi-point FFT technology to obtain the difference between the actual feedback current and the given current, and then adaptively tunes the theoretically calculated PID parameters.
[0005] According to a first aspect of this disclosure, a method for tuning PID parameters for motor control is proposed, comprising: calculating theoretical current loop PID parameter values based on parameters of the motor 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 to the q-axis to obtain a first feedback current, wherein the first given current is a sinusoidal current having 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 adjusting the current loop PID parameter values based on the first comparison result until a new first comparison result between the new first feedback current obtained by performing actual motor control using the adjusted current loop PID parameter values and the first given current satisfies a first predetermined condition.
[0006] Optionally, the multi-point FFT is calculated as 2. N Point FFT calculation is performed, where 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 The business.
[0007] Optionally, the desired bandwidth of the current loop is determined based on the theoretical PID parameter values of the current loop, and the value of N is selected such that the difference between the first given frequency and the desired bandwidth of the current loop does not exceed a predetermined threshold.
[0008] Optionally, selecting a value for N such that the difference between the first given frequency and the desired bandwidth of the current loop does not exceed a predetermined threshold includes: calculating the nearest integer multiple of the desired bandwidth of the current loop using a default N value; calculating the error value between the signal frequency at the nearest integer multiple and the desired bandwidth of the current loop; if the error value is less than the predetermined threshold, using the signal frequency at the nearest integer multiple 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. 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 the new first feedback current obtained by actual motor control using the adjusted current loop PID parameter value satisfies the first predetermined condition with the new first comparison result of the first given current includes: in response to the first amplitude comparison result being greater than the first theoretical amplitude change value and 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 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 the new first feedback current obtained by actual motor control using the adjusted current loop PID parameter value satisfies the first predetermined condition with the new first comparison result of the first given current 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, 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: decreasing the current loop proportional coefficient in response to the first comparison result being better than the theoretical change value; and increasing the current loop proportional coefficient in response to the first comparison result being worse than the theoretical change value.
[0013] Optionally, the method further includes: calculating theoretical speed loop PID parameter values based on the parameters of the motor when stationary and a discrete current loop model; and performing actual motor control using the adjusted current loop PID parameter values to adjust the speed loop PID parameter values, wherein adjusting the speed loop PID parameter values further includes: performing actual motor control using the adjusted current loop PID parameter values and the theoretical speed loop PID parameter values, 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 values based on the second comparison result until a new second comparison result between the new second feedback speed obtained by performing actual motor control using the adjusted speed loop PID parameter values and the second given speed satisfies a second predetermined condition.
[0014] Optionally, the method further includes: calculating theoretical position loop PID parameter values based on the parameters of the motor when stationary and a discrete current loop model; performing actual motor control using adjusted current loop PID parameter values and adjusted speed loop PID parameter values to adjust the position loop PID parameter values; performing actual motor control using the adjusted current loop PID parameter values, the adjusted speed loop PID parameter values, and the theoretical position loop PID parameter values, during which a third given position is input to 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 values based on the third comparison result until the new third feedback position obtained by performing actual motor control using the adjusted position loop PID parameter values and the new third comparison result between the third given position and the third feedback position satisfy a third predetermined condition.
[0015] Optionally, the method further 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 magneto-orientation vector control based on the adjusted current loop PID parameter value, the adjusted speed loop PID parameter value, and the adjusted position loop PID parameter value during the operation of the permanent magnet synchronous motor.
[0016] According to a second aspect of this 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 described in the first aspect.
[0017] Therefore, this disclosure proposes a scheme based on theoretical current loop, speed loop, and optional position loop PID parameters calculated using a discrete model. The scheme uses FFT to calculate the phase lag and amplitude attenuation of the actual feedback current compared to the given current, and adaptively adjusts the current loop PID parameters accordingly. Furthermore, the speed loop and position loop PID parameters can be adjusted. This disclosure utilizes the noise immunity of the FFT algorithm to improve control accuracy, and is particularly suitable for three-loop servo control including a position loop. Attached Figure Description
[0018] The above and other objects, features and advantages of this disclosure will become more apparent from the more detailed description of exemplary embodiments thereof taken in conjunction with the accompanying drawings, wherein like reference numerals generally denote like parts.
[0019] Figure 1 The FOC control principle diagram for PMSM is shown.
[0020] Figure 2 The diagram shows the FOC control principle including the position loop.
[0021] Figure 3 The diagram shows the structure of a 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 response under different damping ratios is shown.
[0024] Figure 6 A simplified control diagram of a discrete model motor with two closed loops is shown.
[0025] Figure 7 A simplified three-loop control diagram for a 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 for simulating the PID response of the current loop is shown.
[0028] Figure 10 The simulated response curve is shown when the sinusoidal frequency is given as 500Hz.
[0029] Figure 11 The actual response curve of the motor is shown when 1187.5Hz is selected as the first given frequency.
[0030] Figure 12 The actual response curve is shown when the current loop PID parameters are adjusted and the sinusoidal setpoint frequency is 1187.5Hz.
[0031] Figure 13 The actual response curve is shown when the current loop PID parameters are adjusted and the sinusoidal setpoint frequency is 1187.5Hz.
[0032] Figure 14 The actual response curve of the velocity loop sinusoidal circuit at a given frequency of 109.4 Hz is shown.
[0033] Figure 15 The actual response curve is shown when the PID parameters of the speed loop are adjusted and the sinusoidal setpoint is 109.4 Hz.
[0034] Figure 16 The actual response curve of the position loop sinusoidal circuit at a given frequency of 39.0625 Hz is shown.
[0035] Figure 17 The actual response curve is shown when the sinusoidal given frequency is 39.0625Hz after adjusting the position loop PID parameters.
[0036] Figure 18 The response curves of the three-loop system (velocity, current, and position) under theoretical PID parameters are shown.
[0037] Figure 19 The response curves of the three closed loops of speed, current, and position are shown under adjusted PID parameters.
[0038] Figure 20 A schematic diagram of the composition of a motor control system according to an embodiment of the present invention is shown. Detailed Implementation
[0039] Preferred embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the disclosure to those skilled in the art. The terms "first," "second," and similar expressions used herein are intended to distinguish different objects of the same kind, rather than to differentiate their sequence 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 orientation vector control) is often used to control the motor. Figure 1 The FOC control principle diagram 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 motor M (in sensorless settings, these can also be obtained using various methods; in sensorless motors, various types of observers can be used to obtain the rotor speed n and rotor position θ of motor M, such as sliding mode observers, Lombberg observers, flux linkage observers, etc.). In practical applications, for example, the speed reference n is obtained based on user input. ref The difference between the measured rotor speed n and the actual rotor speed n 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 Without field weakening control, the d-axis reference current i can be set. dref =0. At this point, the reference currents i on the q-axis and d-axis can be set to 0. qref and i dref The actual q-axis and d-axis currents i fed back by the motor q and i d The difference is calculated, and after being adjusted by PID2 and PID3 modules respectively (the PID parameters of the two current loops are usually the same), the output q-axis and d-axis voltages V are obtained. d and V q Then, through the inverse Park transform, it is converted into α-axis and β-axis voltages V. α and V β Then, the three-phase voltage V is obtained through SVPWM (Space Vector Modulation). a V b V c The current is then transmitted to the motor M via a three-phase inverter bridge. In FOC control, the three-phase current i is obtained through a sampling resistor. a i b i c The α-axis and β-axis currents i are obtained through Clarke transformation. α and i β Then, after Park transformation, the feedback d-axis and q-axis currents i are obtained. d and i q It participates in current loop control.
[0042] Currently, the control systems of permanent magnet synchronous motors mainly adopt, such as Figure 1 The diagram illustrates a dual-closed-loop control strategy including a speed loop and a current loop. However, in high-precision position control applications such as robotic arms and robots, servo control of the motor is often required. Servo control is a three-closed-loop control, meaning that in addition to the current loop and speed loop, a position loop is also included. Figure 2 The diagram shows the FOC control principle including the position loop. As shown in the figure, in the case of three-loop control, the position reference p ref The difference between the rotor's mechanical position p and the input is given to the PID0 module (i.e., the position loop PID). The output of the position loop PID replaces... Figure 1 User input in the speed loop refers to the rotational speed n. ref And from this, proceed with the subsequent... Figure 1 Similar control operations.
[0043] As can be seen from the control structure block diagram above... Figure 1 Two types of PID controllers are used in the motor control: current loop PID and speed loop PID. Figure 2 The servo control utilizes 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 affects the control performance. Therefore, reasonably improving the dynamic response capability and stability characteristics of the speed loop, current loop, and, in some cases, the position loop becomes crucial for enhancing control performance. With accurate motor model parameters, standard speed loop, current loop, and position loop PID parameters can be obtained based on the desired dual-loop or triple-loop response curves, thus completing the tuning of the permanent magnet synchronous motor control PID parameters.
[0044] However, in actual measurements, the electrical parameters (e.g., resistance R, inductance L) and mechanical parameters (e.g., moment of inertia J) of a motor 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, leading to significant differences between the actual operating characteristic curves and the theoretical ones. Therefore, the theoretically calculated PID parameters often fail to meet the requirements of actual operating conditions.
[0045] In view of this, this disclosure proposes a PID parameter tuning scheme for motor control. This scheme utilizes a discrete model to obtain theoretical PID parameters and uses multi-point FFT technology to obtain the difference between the actual feedback current and the given current, thereby adaptively tuning the theoretically calculated PID parameters. The tuning scheme of this disclosure uses a discrete model for more accurate parameter acquisition and adaptive tuning, and is particularly suitable for servo tuning processes that require higher model accuracy compared to general FOC control and need to consider delays introduced during control.
[0046] To facilitate understanding of this solution, the calculation of the theoretical values of PID parameters for motor control based on a discrete model is first described. It should be understood that PID corresponds to Proportional-Integral-Derivative (PID) control. In practice, the coefficients corresponding to the proportional, integral, and derivative terms can usually be adjusted to achieve optimized control adapted to the current system. In the current and speed loops of a motor, since only proportional and integral terms are typically included, the desired control can be achieved by adjusting the proportional and integral coefficients. In servo control, the position loop typically uses a pure proportional element, so the desired control can be achieved simply by adjusting the proportional system. This invention is not limited to this; in embodiments where the current and speed loops include derivative terms, the corresponding derivative coefficients can also be tuned in a similar manner according to this invention. Similarly, in embodiments where the position loop includes integral and derivative terms, the corresponding integral and derivative terms can also be tuned in a similar manner according to this invention. Furthermore, it is well known to those skilled in the art that "PID parameter tuning for motor control" can encompass the tuning of any one or any combination of the proportional, integral, and derivative coefficients. I. Calculation of Theoretical Values of PID Parameters Based on a Discrete Model
[0047] PID parameter tuning for motor control (e.g., permanent magnet synchronous motors) includes current loop and speed loop. The tuning process involves tuning the current loop first, followed by the speed loop. Servo control also includes a position loop, and the position PID parameter tuning must be performed after the current and speed loop tuning. Therefore, this analysis first examines the current loop tuning process, then the speed loop tuning process, and finally the position loop tuning process. Discrete models are used throughout the analysis.
[0048] 1.1. Current Loop Setting
[0049] During the current loop tuning process, the motor can be approximated as an electrical model of resistor R and inductor L. Figure 3 The diagram shows the structure of a series PID discrete control motor. As shown, the proportional and integral modules are connected in series. The coefficient of the proportional module is K. p_c (corresponding to the current loop proportion K below) p_c The coefficients of the integral module are K. i_c (corresponding to the current loop integral factor K below) i_c Here, s refers to the Laplace transform domain. d T is the delay caused by the current loop control cycle. p The delay is due to the seven-segment and five-segment modulation. When the control period of the current loop is T... s At this time, T is satisfied. d =T s T p =T s / 2.
[0050] Due to the delay process and This is not conducive to design and analysis, so a Taylor series expansion is used to approximate it as a first-order inertial element:
[0051]
[0052]
[0053] When the transfer function contains multiple high-frequency small inertial elements, the system order is very high. Therefore, it is necessary to perform order reduction processing first, that is:
[0054]
[0055] thus, Figure 4 A simplified structural diagram of the discrete current loop model is shown. In the diagram, T = T d +T p =3T s / 2. The system open-loop transfer function is:
[0056]
[0057] To achieve pole-zero cancellation and minimize the system order, To achieve pole-zero cancellation, equation (4) can be simplified to:
[0058]
[0059]
[0060] It can be seen that the system is a second-order oscillating system at this time, and the undamped oscillation frequency of the system is... Damping ratio The bandwidth frequency ω of a typical second-order system b_c With natural oscillation frequency ω n_c The relationship between them is ω b_c It is ω n_c The increasing function is ε. c The decreasing function, derived from the damping ratio It can be seen that when K p_c When ε is larger, c The smaller ω n_c The larger ω is, the more b_c The larger K is; p_c The smaller the value, the lower the ε c The larger ω is n_c The smaller ω is, the more... b_c The smaller ω is. For a typical second-order system, ω b_cThe smaller 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 bandwidth, the faster the system response, but the worse the stability and the greater the steady-state fluctuation.
[0061] Figure 5 The step response under different damping ratios is shown. Table 1 below shows the response characteristics under different damping ratios.
[0062]
[0063] Table 1
[0064] When the motor is operating within its rated speed range, the closed-loop transfer function of the current loop can be simplified:
[0065]
[0066] As can be seen from the above introduction, Therefore, the simplified closed-loop transfer function of the current loop can be expressed as ε c The form is:
[0067]
[0068] Therefore, based on Table 1, different damping ratios ε can be selected according to different current loop response requirements. c Optimal damping ratio in engineering at this time At this point, the optimal oscillation frequency ω n_c With bandwidth frequency ω b_c The same. Therefore, at the optimal damping ratio same, The higher the motor control frequency, the shorter the control period T. s The smaller the value, the better the current loop damping ratio in engineering. The designable current loop bandwidth frequency ω b_c The larger.
[0069] In some cases, the current loop can be reduced in order, and equation (8) can then be expressed as:
[0070]
[0071] The reduced-order transfer function shown in equation (9) is based on the engineering optimal damping ratio. To achieve the desired response speed, stability, and steady-state fluctuations under specific application conditions, different damping ratios ε can be selected. c The resulting reduced transfer function will be different. In this case, you can refer to the unreduced equation (8).
[0072] 1.2. Speed Loop Tuning
[0073] During the speed loop tuning process, the closed-loop transfer function of the current loop can be simplified to: Figure 6 A simplified control diagram of a discrete model motor with two closed loops is shown.
[0074] In the diagram, T d ε is the delay caused by the speed loop control cycle. c The current loop damping ratio is determined by setting different ε values. c Different current response speeds can be obtained. The open-loop transfer function of the motor speed-current dual closed-loop system can be expressed as:
[0075]
[0076] make Equation (10) can be simplified to:
[0077]
[0078] To ensure the cutoff frequency ω c_s At this point, the phase margin is at its maximum. Define σ as the damping factor for analysis, at this time
[0079] Therefore, for the discrete model, the dual closed-loop tuning process is as follows:
[0080] First, set the integral coefficient of the current loop. To achieve zero-pole cancellation in the current loop transfer function, the system model is simplified.
[0081] Next, set the proportional coefficient K of the current loop. p_c When tuning the current loop, the transfer function of the current loop is a second-order oscillating system. In practical applications, the current loop damping ratio ε can be adjusted according to the specific application. c Adjustments can be made. If a high motor response speed is required but steady-state fluctuations are not critical, a smaller ε can be selected. c This allows the motor to operate in an underdamped state; if the motor response speed requirement is not high, but the steady-state fluctuation requirement is high, a larger ε can be selected. c This causes the motor to operate in an overdamped state. In some general applications, a trade-off is made between response speed and stability, and the second-order system is corrected to the engineering-optimal second-order system, at which point the optimal damping ratio is found.
[0082] When tuning the velocity loop, the current loop can be simplified to a first-order inertial element. In this case, the velocity-current dual-closed-loop system becomes a third-order system, with its second corner frequency... The magnitude of the damping factor σ (current loop bandwidth frequency) will determine the first corner frequency ω1 and the cutoff frequency ω. c_s The damping factor σ determines the system's response speed and stability. A larger damping factor σ results in stronger stability but a slower system response; a smaller damping factor σ results in weaker stability but a faster system response. The appropriate damping factor σ can be set according to the actual system requirements. 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 design of the position loop is very complex because the speed loop is a high-order system. Furthermore, since the response speed of the position loop is slower than that of the speed loop, the speed loop can be reduced in order during position loop tuning. This involves simplifying the closed-loop transfer function of the speed loop to a first-order inertial element. Therefore, the open-loop transfer function of the speed loop can be expressed as:
[0085]
[0086] In equation (12), K V This represents the closed-loop amplification factor of the velocity loop. In practical applications, it is generally set to 1, meaning that the steady-state velocity remains consistent with the given velocity at steady state, with no amplification relationship. V For the integral time constant of the equivalent inertial element, in practical applications, to simplify calculations, T can be... V Set to the reciprocal of the tuned speed loop cutoff frequency, i.e. Therefore, the simplified velocity loop closed-loop transfer function can be expressed as:
[0087]
[0088] Since position is derived from velocity integration, and the position loop itself contains an integral element, a purely proportional element in the position loop can achieve steady-state error-free operation. However, during control, the velocity and current loops introduce phase lag. With PI control, the phase margin is very small, making it difficult to increase the position loop bandwidth. Therefore, in motor control, a purely proportional element is generally used for the position loop.
[0089] Figure 7 A simplified three-closed-loop control diagram for a discrete model motor is shown. In the diagram, K... p_p This is the proportional coefficient for the position loop. Since the output of the speed loop is rotational speed in r / min, it is proportional to... The product is converted to rad / s, and then integrated. The final rotor position is obtained, and the open-loop transfer function of the position loop can be expressed as:
[0090]
[0091] The position loop generally needs to ensure no overshoot in the response, therefore the control system needs to be at the critical damping ε. p =1 or overdamped ε p >1. Equation (14) can be rearranged into the standard form of the open-loop function of a second-order system.
[0092]
[0093] In the formula, ω n_p The natural oscillation frequency of the second-order position loop system To ensure that the position loop has no overshoot (The system is operating in a critically damped or overdamped state), simplifying to: K p_p ≤2.3875ω c_s Depending on the choice of K p_p The bandwidth of the position ring can be obtained.
[0094] Since the position loop generally needs to ensure no overshoot in the response, the control system is in a critical damping state ε. p =1, at this time it satisfies Right now:
[0095] K p_p =ω c_s ×0.25×9.55=2.3875ω c_s (16)
[0096] At this point, the natural oscillation frequency of the second-order system is ω b_p =0.643ω n_p =0.32ω c_s .
[0097] As per the above, combined with the appendix Figure 3-7 This paper describes a method for obtaining the theoretical PID parameters for the current loop, speed loop, and position loop based on a discrete model using motor parameters. It should be understood that in other implementations, methods other than those described above can also be used to calculate the theoretical PID parameters based on the discrete model.
[0098] II. Adjustment of theoretical values of PID parameters
[0099] 2.1. Adjustment of theoretical values of current loop PID parameters
[0100] In existing technologies, calculated theoretical PID parameters are typically used directly for motor operation control. However, in actual measurements, the electrical parameters of the motor are difficult to measure accurately due to the influence of measuring instruments, and both electrical and mechanical parameters often change during motor operation, making it difficult for the theoretically calculated PID parameters to meet the requirements of actual operating conditions. Therefore, this disclosure proposes a high-precision PID parameter tuning scheme for motor control.
[0101] Figure 8 A schematic flowchart of a motor control PID parameter tuning method according to an embodiment of the present disclosure is shown. This method fine-tunes the PID parameters based on a comparison between the actual feedback current and the given current. This method can be applied to... Figure 1 The dual closed-loop control shown is particularly suitable for applications due to its high precision. Figure 2 The example shown is a three-closed-loop servo control scenario. It should be understood that in actual operation... Figure 1 The current loops PID2 and PID3 shown have the same PID parameters, so they can be adjusted as a whole.
[0102] In step S810, the theoretical current loop PID parameter values are calculated based on the parameters of the motor when it is stationary and the 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 Part I above. Furthermore, the desired current loop bandwidth can be determined based on the theoretical current loop PID parameter values, and this desired current loop bandwidth can be used in the preferred operation of step S820.
[0103] In step S820, actual motor control is performed using theoretical current loop PID parameter values, during which a first given current is input to the q-axis to obtain a first feedback current. This first given current is a sinusoidal current with a first given frequency. It can be considered that during the control process, a sinusoidal current with a defined frequency and amplitude for multiple cycles is continuously injected into the q-axis. Here, "sinusoidal current" can be a sinusoidal current injected with any initial phase; in other words, the injected current can also be a cosine current, or a sinusoidal current with other initial phases.
[0104] Subsequently, in step S830, a first comparison result between the first feedback current and the first given current is obtained based on multi-point FFT calculation. Since step S810 is based on the theoretical PID value calculation using a discrete model, the actual feedback current can be calculated directly in the frequency domain. Compared to time-domain signal processing, frequency-domain signal processing methods offer higher data utilization, higher measurement accuracy, and stronger anti-interference capabilities. In some dual-loop control applications, time-domain signal processing methods can be used to calculate the feedback current. However, in control systems with high accuracy requirements, such as... Figure 2In the servo control system shown, frequency domain signal processing methods are required.
[0105] Common frequency domain signal processing methods include DFT (Discrete Fourier Transform) and FFT (Fast Fourier Transform). FFT, as a special case of DFT, has a much lower computational complexity than DFT. Therefore, this disclosure uses FFT to calculate the feedback current signal. Before introducing FFT, we first introduce the calculation formula for DFT. The N-point DFT of signal x(n) is expressed as:
[0106]
[0107] When the signal processed by DFT is 2 N When the time factor is multiplied, this is based on the rotation factor. Symmetry Periodic Reducibility A DFT operation can be converted to an FFT operation. In other words, the FFT requires 2^32 points to process. N Where N is a positive integer. At this point, the computation time of the N-point DFT algorithm is compared to that of the N-point FFT algorithm, thus reducing the computational load. Using the 512-point, 1024-point, and 2048-point FFT analogies selected in the preferred embodiments of this disclosure, the computational complexity of DFT is 114 times, 205 times, and 372 times that of FFT, respectively. This demonstrates that using FFT for signal processing can significantly reduce the computational load of the algorithm.
[0108] Therefore, the multi-point FFT calculation in step S830 is actually 2 N Point FFT calculation is used, where N is a positive integer. Furthermore, spectral leakage must be avoided when using FFT calculation. Simply put, spectral leakage occurs when the sampling frequency and signal frequency are out of sync, causing the phase of the periodically sampled signal to be discontinuous at the beginning and end. Therefore, to avoid spectral leakage, the first given frequency must be an integer multiple of the frequency resolution. Here, the frequency resolution is the control frequency multiplied by 2. N The quotient. For example, in the FOC control system, the control frequency is 16kHz, 2 N When the frequency is 512 (corresponding to N=9), the frequency resolution is Δf=16KHz / 512=31.25Hz. That is, when the frequency of the processed signal is an integer multiple of 31.25Hz, there will be no spectral leakage, which can guarantee the accuracy of the amplitude and phase of the calculated feedback signal.
[0109] Furthermore, the motor control PID parameter tuning method of this disclosure aims to improve the actual operating performance of the motor, and the feedback current under the expected bandwidth of the current loop is more representative of the actual operating conditions of the motor. Therefore, in one embodiment, the first given frequency is preferably the expected bandwidth value of the current loop, or at least a frequency that is not far from the expected bandwidth of the current loop, such as a frequency that does not differ from the expected bandwidth of the current loop by more than a predetermined threshold. The expected threshold can be an expected percentage; for example, when the expected bandwidth value of the current loop 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 chosen so that the difference between the first given frequency and the expected bandwidth of the current loop does not exceed a predetermined threshold. For example, when the expected bandwidth of the current loop is 1200Hz and the expected threshold is 4%, if N = 7 (i.e., 2...), ... N If N = 128, then the frequency resolution is Δf = 16kHz / 128 = 125Hz. The closest integer multiple of 125Hz to 1200Hz is 1250Hz, which exceeds the 4% threshold. Therefore, the value of N needs to be further increased. For example, choosing N = 8 (i.e., 2... N If N = 256, then the frequency resolution is Δf = 16kHz / 256 = 62.5Hz. The closest integer multiple of 62.5Hz to 1200Hz is 1187.5Hz, which does not exceed the 4% threshold. Therefore, in this case, at least 256 points or more of multi-point FFT calculation is required. Theoretically, the larger the value of N, the higher the calculation accuracy. However, due to the limited computing power of the motor MCU, the value of N needs to be chosen reasonably. For example, in the following embodiment of this disclosure, N can be selected to be not less than 9, that is, the multi-point FFT calculation is at least 512 points, and the default value of N is 9, i.e., N FFT =512.
[0111] In one embodiment, selecting a value for N such that the first given frequency differs from the desired bandwidth of the current loop by no more than a predetermined threshold may include: calculating the nearest integer multiple of the desired bandwidth of the current loop using a default N value (corresponding to an integer multiple num as follows). FFT ); Calculate the signal frequency at the nearest integer multiple of the given value (corresponding to ω as follows). ref The error value between the current loop and the expected bandwidth (corresponding to the following error) ratio If the error value is less than the predetermined threshold, the signal frequency at the nearest integer multiple of the value is used 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.
[0112] As will be described in detail below, the comparison between the first feedback current and the first given current can be a comparison of amplitude or a comparison of phase, preferably a comparison of both amplitude and phase. Therefore, 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 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 of the first feedback current and the first given current as the first amplitude comparison result, and using the phase comparison result of 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 the new first feedback current obtained by actual motor control using the adjusted current loop PID parameter values satisfies the first predetermined condition with the new first comparison result of the first given current. Specifically, if the first comparison result shows a difference from the first predetermined adjustment, the PID parameter values of the current loop can be adjusted, and the actual motor control and q-axis first given current injection can be performed again using the adjusted PID parameter values to obtain the actual feedback current under the adjusted current loop PID parameters. The above adjustment can be repeated until the new first comparison result of the new first feedback current and the first given current satisfies the first predetermined condition. It should be understood that in the above repeated adjustments, it is preferable that the frequency and amplitude of the first given current remain unchanged. In other embodiments, since the amplitude comparison value of the given current and the feedback current is obtained, the amplitude of the first given current can be changed. In one embodiment, the first predetermined condition may specify that the comparison result of the amplitude and phase of the actual feedback current with the amplitude and phase of the first given current needs to be limited.
[0114] Because there are deviations between the actual motor parameters obtained from labeling or measurement and their true values, and because these parameters change during motor operation, directly using the theoretical PID parameters calculated from labeling or measurement often leads to discrepancies between the actual response characteristics and the theoretical analysis. Therefore, this disclosure fine-tunes the theoretically calculated current loop PID parameters based on the actual response characteristics, making the motor control more aligned with the needs of practical applications.
[0115] The first predetermined condition typically requires that the new first comparison result is not 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 value; more specifically, the amplitude decay of the actual feedback current is greater than the theoretical amplitude decay (i.e., the amplitude change value of the decayed actual feedback current is smaller 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 actual feedback current lags behind the theoretical value by a larger margin in phase compared to the given current). Therefore, the first predetermined condition requires that both the new first amplitude comparison result and the first phase comparison result are not worse than their respective theoretical values.
[0116] In one embodiment, the first predetermined condition may be that the comparison result of the new first amplitude of the new first feedback current obtained under the tuned current loop PID parameters 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 phase 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 from the theoretical simulation, and the phase is not lagging 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 ratio of the amplitude of the simulated feedback current to the given current is 0.707 (i.e., the amplitude change is 0.707), and the phase of the simulated feedback current lags behind the phase of the given current by 45°. At this time, the first theoretical amplitude change is also 0.707, and the first theoretical amplitude change is 45°. Therefore, the first predetermined adjustment can require that the new first amplitude comparison result is not less than 0.707, and the new first phase comparison result is not greater than 45°. In other words, it requires that the ratio of the amplitude of the new first feedback current to the first given current is not less than 0.707, and the phase lag does not exceed 45°.
[0117] At this time, based on the first comparison result, the current loop PID parameter value is adjusted until the new first feedback current obtained by actual motor control using the adjusted current loop PID parameter value satisfies the first predetermined condition with the new first comparison result of the first given current. This includes: 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, the value of the current loop PID parameter is adjusted 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 current loop proportionality coefficient K p_c Both are used to adjust the PID parameter values of the current loop.
[0119] Due to the increase of the current loop integral coefficient K i_c This could easily lead to system malfunction; therefore, this disclosure primarily employs an automatic scaling factor K. p_c The method, the integration factor K i_c Fine-tuning is optional. In one embodiment, only the current loop scaling factor K can be adjusted. p_c By increasing the current loop proportionality coefficient K p_c This increases the actual bandwidth of the current loop, thereby improving the control performance of the motor.
[0120] While increasing the actual bandwidth of the current loop can improve the motor's response speed, it can also easily lead to system instability. Therefore, when the performance of the first feedback current obtained from the theoretical current loop PID parameters is better than the theoretical change value, the proportional gain K of the current loop can be reduced. p_c This reduces the actual bandwidth of the current loop to match the desired bandwidth, improving system stability while meeting theoretical control performance requirements. Similarly, "better than" here can refer to the actual feedback current's amplitude and phase changes being better than their corresponding theoretical values; more specifically, the actual feedback current's amplitude attenuation should be less than the theoretical amplitude attenuation (i.e., the attenuated actual feedback current's amplitude change should be greater than the theoretical amplitude change), and the actual feedback current's phase change should be less than the theoretical phase change (the actual feedback current's phase lag compared to the given current is smaller than the theoretical value). Therefore, 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 both better than their respective theoretical values.
[0121] Therefore, in one embodiment, adjusting the current loop PID parameter value based on the first comparison result until the new first feedback current obtained by actual motor control using the adjusted current loop PID parameter value satisfies the first predetermined condition with the new first comparison result of the first given current includes: in response to the first amplitude comparison result being greater than the first theoretical amplitude change value and 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 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] Furthermore, it should be understood that the adjustment of the current loop PID parameter values in this disclosure can be performed automatically based on comparison results. 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 meets 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 meets the conditions. When near the preferred value, the current loop proportional coefficient can also be adjusted with a smaller step length.
[0123] To facilitate understanding, the following will further describe the adjustment of the theoretical values of the current loop PID parameters with reference to the accompanying diagrams and examples.
[0124] 2.2. Example of PID parameter adjustment for current loop
[0125] The response was tested on a 24V motor with resistance R = 0.24Ω and inductance L = 0.00023H; mechanical parameters: moment of inertia J = 0.0000288Kg·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 7542 rad / s, corresponding to a frequency of f. b_c =1200Hz.
[0126] Based on the above calculation process, the current loop PID parameters can be obtained.
[0127]
[0128] First, a current loop frequency sweep test is performed in the simulation. Figure 9 A block diagram for simulating the current loop PID response is shown. The current loop PID parameter tuning does not include operations related to the speed and position loops, therefore... Figure 9 The test does not need to include Figure 1 The speed loop PID and Figure 2 The position loop is shown. Additionally, since the PID parameters for the two current loops are identical, no further details are provided here. Figure 1 The distinction between PID2 and PID3 is shown.
[0129] amp*sin(ωt) is the q-axis current reference, where 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 bias value corresponding to the bias of the given sinusoidal current (or cosine current or other sinusoidal current with an initial phase). In some control modes with position sensors, where the rotor position θ can be correctly detected even when the motor is at zero speed or in cyclic forward and reverse rotation, const can be set to 0. However, in some sensorless control modes, the rotor position θ of the motor can only be correctly detected when the motor is rotating. Therefore, a bias value can be selectively added according to the actual application (the rotor position θ participates in Park transformation and inverse Park transformation, which are essential in the current loop control process). Additionally, although not shown in the figure, the reference current can also have a non-zero initial phase. Since what is needed is the phase lag between the feedback current and the reference current, the introduction of the initial phase will not affect this value.
[0130] In servo control, absolute position encoders are often used. When the motor is at zero speed or in cyclic forward and reverse rotation, the rotor position θ can be correctly detected. At this time, amp can be set to sinusoidal signals of different frequencies to test the current loop response characteristics.
[0131] Figure 10 The simulated response curve is shown when the sinusoidal given frequency is 500Hz. As shown in the figure, the sinusoidal given frequency is set to ω=3142rad / s, corresponding to a frequency of f=500Hz, and amp=0.5A. In the figure, the black curve represents the given current value, the red curve represents the feedback current value, the black dots are the sampling points of the given current, and the red dots are the sampling points of the feedback current.
[0132] With a control frequency of 16kHz and a current loop reference signal frequency of 500Hz, the number of sampling points per cycle is as follows: Points. If the default 512-point FFT operation is used, i.e., the default N value = 9, then the frequency resolution is... No spectral leakage occurs when the processed signal frequency is an integer multiple of 31.25Hz, ensuring the accuracy of the calculated amplitude and phase. Since the current loop provides a signal frequency of 500Hz, 500Hz / 15.625Hz = 16. Therefore, the value at X (k = 16) can be calculated directly. Its amplitude and phase are as follows:
[0133]
[0134]
[0135] In the formula, XR (k) is the real part of X(k), X I (k) is the imaginary part of X(k).
[0136] According to the above calculation method, given a current signal amplitude of 0.500 and a phase of 112.5°, and a feedback current signal amplitude of 0.496 and a phase of 76.5°, the amplitude change is 0.496 / 0.500 = 0.992, and the phase lag is 112.5° - 76.5° = 36.0°.
[0137] The above describes the process of calculating the amplitude change and phase lag values using FFT. However, in practice, the calculated bandwidth is not necessarily an integer multiple of 31.25Hz. Therefore, based on the actually calculated bandwidth frequency, it is necessary to find the nearest current loop bandwidth ω. b_c =7542 rad / s (1200 Hz) and a point that avoids spectral leakage. Based on 1200 Hz / 31.25 Hz = 38.4, the default N value is used to calculate the integer multiple 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 and the expected bandwidth of the current loop. At this point, the signal frequency ω at the nearest integer multiple is... ref =31.25Hz × 38 = 1187.5Hz.
[0138] In one embodiment, the error ratio can be calculated according to the following formula: ratio :
[0139]
[0140] In another embodiment, the error ratio can be calculated according to the formula. ratio :
[0141]
[0142] Regardless of the calculation method, the resulting error ratio is less than a predetermined threshold (e.g., 5%). Therefore, 1187.5Hz is selected as the current loop sweep frequency, i.e., as the first given frequency. Figure 11 The actual motor response curve is shown when 1187.5Hz is selected as the first given frequency. At this time, the theoretically tuned PID parameter is K. p_c =1.173, K i_c =1091.
[0143] When the sinusoidal frequency of the current loop is given at 1187.5Hz, it is close to the bandwidth frequency ω of the current loop. b_c= 7542 rad / s (1200 Hz), 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). To ensure the current loop operates at the bandwidth frequency ω... b_c To achieve a high response speed, the response signal amplitude at the bandwidth frequency should generally be greater than 0.707 times the given signal amplitude, and the phase lag should be less than 45.0° (i.e., the first theoretical amplitude change is 0.707, and the first theoretical phase change is 45.0°; these two values can be calculated based on theoretical values at a given frequency of 1200Hz, and subsequent speed loops and position loops can also be tuned according to this principle). However, if the PID parameters obtained from theoretical tuning do not meet the actual response requirements (at this point, 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), then PID self-tuning is necessary. This involves increasing the proportional factor K. p_c and integral factor K i_c All of these methods can be used to increase the system bandwidth, but this disclosure preferably uses an automatic scaling factor K. p_c The method, the integration factor K i_c Fine-tuning can be selectively performed.
[0144] Figure 12 The actual response curve is shown when the current loop PID parameters are adjusted and the sinusoidal setpoint is 1187.5Hz. At this time, K... 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 further increase the scaling factor K. p_c .
[0145] Figure 13 The actual response curve is shown when the current loop PID parameters are adjusted and the sinusoidal setpoint is 1187.5Hz. At this time, K... 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, satisfying the first predetermined condition. Therefore, the adjusted current loop PID parameters (K) can be considered acceptable. p_c =5.2) Meets actual bandwidth requirements.
[0146] 2.3. Adjustment of PID parameters in the speed loop
[0147] In one embodiment, only the current loop PID parameter values can be adjusted. In this case, the adjusted current loop PID parameter values can be used to obtain the speed loop PID parameter values, and the obtained speed loop PID parameter values can be directly used in the actual motor control.
[0148] In another embodiment, the speed loop PID parameters can also be adjusted after the current loop PID parameter values have been fully adjusted. In this case, the PID parameter adjustment method of this disclosure further includes: calculating theoretical speed loop PID parameter values based on the parameters of the motor when stationary and the discrete current loop model; performing actual motor control using the adjusted current loop PID parameter values to adjust the speed loop PID parameter values, wherein adjusting the speed loop PID parameter values further includes: performing actual motor control using the adjusted current loop PID parameter values and the theoretical speed loop PID parameter values, 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 values based on the second comparison result until the new second feedback speed obtained by performing actual motor control using the adjusted speed loop PID parameter values and the new second comparison result between the second feedback speed and the second given speed satisfy a second predetermined condition.
[0149] 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, although "second given speed" and "second feedback speed" are used here, "second" is intended to indicate operation for the speed loop rather than the current loop, and does not imply that a "first given speed" needs to be prepared or a "first feedback speed" needs to be obtained when tuning the current loop PID parameter values.
[0150] Similar to the adjustment of current loop PID parameters, when adjusting speed loop PID parameters, a frequency within a predetermined threshold difference from the desired bandwidth of the speed loop that does not cause frequency leakage can be used as the frequency corresponding to the second given speed. In the specific comparison, the amplitude attenuation and phase lag 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, then the corresponding speed loop PID parameters are adjusted. It should be understood that if the adjustment of the current loop PID parameters results in the comparison result of the second feedback speed under the control of the speed loop PID parameters satisfying the second predetermined condition—that is, the amplitude attenuation and phase lag 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 is not greater than the theoretical phase lag value)—then the speed loop PID parameters no longer need to be adjusted.
[0151] 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 = 667 rad / s (106.1 Hz), and the tuned current loop parameters are also substituted. If the 512-point FFT calculation continues at this point, according to... Therefore, it is closest to the velocity loop cutoff frequency ω. c_s =667 rad / s (106.1 Hz) and the given signal frequency that can avoid spectral leakage is 31.25 Hz × 3 = 93.75 Hz. However, in actual speed loop tuning, At this point, the given sweep frequency signal frequency is 93.75Hz and the velocity loop cutoff frequency ω c_s Significant differences in frequency will lead to larger measurement errors. When tuning the position loop, the bandwidth frequency of the position loop will be lower, so continuing to use a 512-point FFT frequency sweep experiment will cause even greater measurement errors. Increasing the number of FFT operation points will improve the frequency resolution Δf, but the corresponding FFT operation time will increase. Therefore, it is necessary to weigh the operation time against the required resolution and choose a reasonable number of FFT operation points while meeting actual needs. Define the velocity loop cutoff frequency ω. c_s With the frequency ω of the sweep signal ref The error ratios between them are shown below:
[0152]
[0153] Generally speaking, when error ratio Within a 5% range, the frequency ω of the swept signal can be approximated. ref ≈ Cutoff frequency ω c_s In other words, the second predetermined threshold of the speed loop can be set to 5%, based on the calculated error. ratio When the value is less than 5% of the second predetermined threshold, the PID parameters tuned by frequency sweep can be considered accurate.
[0154] Based on the above theory, the frequency sweeping process using FFT is optimized to achieve the velocity loop cutoff frequency ω. c_s After the calculation, the first step is to calculate... In the formula, floor represents rounding down to the nearest integer (4-inclusive), and N... FFT N is the number of FFT operation points. Initially, N... FFT The value is 512 points, (F) s For motor control frequency, during FOC control, F s When 16kHz is selected, the integer multiples of the frequency resolution are:
[0155]
[0156] Therefore ω ref =num FFT ×(F s / N FFT ) × 2π = 585 rad / s (93.1 Hz), and the error is calculated based on this. ratio At 512 points
[0157] At this point, N needs to be further increased. FFT The value is 1024 points at this time. Therefore ω ref =num FFT ×(F s / N FFT ) × 2π = 687 rad / s, At this time, error ratio =3.0% < 5.0%, sweep frequency signal frequency ω ref ≈ Cutoff frequency ω c_s Therefore, a 1024-point FFT frequency sweep experiment was conducted on the speed loop under these parameters. The given signal frequency of the speed loop was 687 rad / s, and the given speed signal amplitude was 30.
[0158] Figure 14 The actual response curve of the speed loop is shown when the sinusoidal setpoint is 109.4 Hz. At this time, the speed loop PID parameters used are still calculated based on theoretical values, specifically K. p_s =0.062, K i_s =174.5. When the given frequency of the velocity loop sinusoidal signal is 687 rad / s (109.4 Hz), it approaches the velocity loop cutoff frequency ω. c_s = 667 rad / s (106.1 Hz), the response speed amplitude is 0.856 times the given value, and the phase lag is 57.5°. To ensure a high response speed of the speed loop 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°. This is the target condition for amplitude attenuation and phase lag in fine-tuning of the speed loop PID parameters. That is, the second theoretical amplitude change value and the second theoretical phase change value are both 0.707 and 45.0°. At this point, the PID parameters tuned do not meet the actual response requirements and need to be fine-tuned.
[0159] Similarly, the amplitude attenuation and phase lag of the second feedback velocity can be improved by increasing the speed loop proportional coefficient. Figure 15 The actual response curve is shown when the PID parameters of the speed loop are adjusted to a sinusoidal setpoint of 109.4 Hz. The figure shows K. p_s =0.080, K i_sThe response curve is shown when the value is 174.5. At this point, 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 respective second theoretical change values (0.98 is greater than 0.707 and 44.9° is less than 45.0°, satisfying the second predetermined condition). At this point, it can be considered that the adjusted speed loop PID parameters meet the actual bandwidth requirements.
[0160] 2.4. Adjustment of PID parameters in the position loop
[0161] In one embodiment, only the PID parameter values of the current loop can be adjusted. In this case, the adjusted current loop PID parameter values can be used to obtain the PID parameter values of the speed loop and position loop, and the obtained speed loop and position loop PID parameter values can be directly used in the actual motor servo control.
[0162] In one embodiment, the current loop PID parameter values can be adjusted first, then the speed loop can be adjusted, and the position loop PID parameter values can be obtained using the adjusted current loop and speed loop PID parameters. The obtained position loop PID parameter values can then be directly used in the actual motor servo control.
[0163] In another embodiment, the position loop PID parameters can also be adjusted after the current loop and speed loop PID parameter values have been fully adjusted. In this case, the PID parameter adjustment method of this disclosure further includes: calculating theoretical position loop PID parameter values based on the parameters of the motor when stationary and the discrete current loop model; obtaining position loop PID parameter values using the adjusted current loop PID parameter values and the adjusted speed loop PID parameter values; performing actual motor control using the adjusted current loop PID parameter values, the adjusted speed loop PID parameter values, and the position loop PID parameter values, during which a third given position is input to 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 values based on the third comparison result until the new third feedback position obtained by performing actual motor control using the adjusted position loop PID parameter values and the new third comparison result between the third given position and the third feedback position satisfy a third predetermined condition.
[0164] It should be understood that the theoretical position loop PID parameter values can be calculated together with the theoretical current loop PID parameter values from step S810 and the theoretical speed loop PID parameter values as described above, based on the parameters when the motor is stationary. Furthermore, although "third given position" and "third feedback position" are used here, "third" is intended to indicate operation for the position loop, but does not imply that "first given position" and "second given position" or "first feedback position" and "second feedback position" need to be prepared or obtained when tuning the current loop or speed loop PID parameter values.
[0165] Similar to the PID parameter adjustments for the current and speed loops, when adjusting the PID parameters for the position loop, a frequency within a predetermined threshold difference from the desired bandwidth of the position loop that does not cause frequency leakage can be used as the corresponding frequency for the third given position. In the specific comparison, the amplitude change and phase lag of the third feedback position compared to the third given position can be compared with the theoretical change values. If the third predetermined condition is not met, then corresponding adjustments are made. It should be understood that if the adjustment of the current and speed loop PID parameters results in the comparison result of the third given position under the control of the obtained position loop PID parameters meeting the third predetermined condition—that is, the amplitude attenuation and phase lag 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 is not greater than the theoretical phase lag value)—then no further adjustment of the position loop PID parameters is required.
[0166] Specifically, the position loop can be frequency swept and tested using the same method. The position loop bandwidth is 256 rad / s (40.7 Hz), K p_ p = 1592.0. The minimum value of N can be obtained using an FFT-based point calculation method similar to that used for the velocity loop. Here, the third predetermined threshold can also be 5%.
[0167] First, choose N. FFT =512, at this time ω ref =num FFT ×(F s / N FFT ) × 2π = 196 rad / s, at this time
[0168] When N FFT When = 1024, at this time ω ref =num FFT ×(F s / N FFT ) × 2π = 295 rad / s, at this time
[0169] When N FFT =2048, at this time ω ref =num FFT ×(F s / N FFT ) × 2π = 245 rad / s, at this time At this time, error ratio <5%, sweep frequency signal frequency ω ref Position loop bandwidth frequency ω b_p .
[0170] Figure 16 The actual response curve is shown when the sinusoidal frequency of the position loop is 39.0625 Hz. At this time, the sinusoidal frequency ω of the position loop is... ref =245rad / s (39.0625Hz), the position loop PID parameters used are still calculated based on theoretical values, and the specific proportional coefficient is K. p_p =1592.0.
[0171] When the sinusoidal frequency of the position loop is given at 39.0625Hz, the bandwidth ω of the position loop is approximately... b_p =256 rad / s (40.7 Hz), meeting the requirement of the third predetermined threshold. The response position shown in the figure has an amplitude of 0.63 times the given value and a phase lag of 34.3°. At this point, if the third theoretical amplitude change and the third theoretical phase change are both 0.707 and 45.0°, respectively, 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, failing to meet the third predetermined condition. K needs to be further increased. p_p This causes the position loop feedback amplitude to decay to more than 0.707 times the given value.
[0172] Figure 17 The actual response curve is shown when the sinusoidal setpoint frequency is 39.0625Hz after adjusting the position loop PID parameters. The figure shows the position loop sinusoidal setpoint frequency ω. ref = 245 rad / s (39.0625 Hz), K p_p The response curve when the value is 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, which meets the third predetermined condition. At this time, it can be considered that the adjusted position loop PID parameters meet the actual bandwidth requirements.
[0173] Figure 18The graph shows the response curves of the three closed-loop systems (speed, current, and position) under theoretical PID parameters. The upper part represents the position loop response curve, the middle part represents the speed loop response curve, and the lower part represents the current loop response curve. It can be seen from the graph that the current loop has the fastest response speed; after a change in the given current, the feedback current immediately follows the change. The speed loop response speed is slower than the current loop response speed but faster than the position loop response speed. After the speed loop reaches stability at point C, the position loop reaches stability at point B shortly afterward. The bandwidth difference between the position and speed loops is relatively small.
[0174] Figure 19 The response curves of the three closed loops (speed, current, and position) under adjusted PID parameters are shown. Similarly, the upper part represents the position loop response curve, the middle part the speed loop response curve, and the lower part the current loop response curve. As shown in the figure, the current loop bandwidth is significantly improved after adjustment, while the speed loop bandwidth is slightly improved, showing a clear distinction from the position loop bandwidth. Furthermore, the speed loop stabilizes at point C1 earlier than... Figure 1 Point C in 8, point B1, which has a stable position cycle, must precede it. Figure 1 Point B in Figure 8. This shows that after PID parameter tuning, the control performance of the three-loop system is improved.
[0175] The adjusted current loop PID parameter values obtained via the method described in this disclosure (and the adjusted speed loop and position loop PID parameters are also written when adjusting the speed loop and position loop parameters) can be written into the controller of the permanent magnet synchronous motor. The controller can then perform magneto-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.
[0176] In motors where this method is applied to adjust PID parameters, given a sinusoidal signal (control frequency 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 effect is similar for 1024 and 2048-point FFTs), the feedback signals (current, speed, and position) will also change at the same frequency, and their amplitude attenuation and phase lag values are better than those of motors controlled based on theoretical PID parameters, thus making them easy to identify.
[0177] Figure 20 A schematic diagram of a motor control system according to an embodiment of the present invention is shown. As shown, in addition to a motor component, the motor control system also includes 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 this disclosure, the control module can control the motor using 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.
[0178] Existing servo three-loop PID parameter tuning often relies on experience, and even when based on models, it's done using continuous models, neglecting delays in the control process. This leads to inaccurate model building and discrepancies between theoretically tuned servo three-loop PID parameters and actual PID parameters. Therefore, this disclosure addresses servo three-loop PID parameter tuning by employing an FFT algorithm to automatically calculate amplitude attenuation and phase lag after theoretical PID tuning. Simultaneously, it automatically adjusts the number of FFT operation points based on the frequency at the calculation bandwidth, ensuring more accurate given signal frequency while avoiding spectral leakage.
[0179] This disclosure first establishes a theoretical model of the servo system based on the motor parameters (electrical and mechanical parameters) when the motor is stationary, combined with various delays introduced during discrete control. This model calculates relatively accurate theoretical three-loop PID parameters. Then, using these calculated PID parameters, frequency sweep experiments are conducted on the current loop, speed loop, and position loop during actual motor control by the MCU. (To maximize the accuracy of the frequency sweep results, multi-point FFT is used for amplitude and phase calculations; simultaneously, an algorithm for automatically adjusting the number of FFT operation points is employed to avoid spectral leakage.) Based on the frequency sweep results of the current loop, speed loop, and position loop, the PID parameters are automatically adjusted, thereby achieving precise position control of the servo system.
[0180] This disclosure proposes a scheme based on theoretical current loop, velocity loop, and optional position loop PID parameters calculated using a discrete model. It calculates the phase lag and amplitude attenuation of the actual feedback current compared to the given current using FFT, and adaptively adjusts the current loop PID parameters accordingly. Furthermore, it allows for further adjustment of the velocity and position loop PID parameters. This disclosure leverages the noise immunity of the FFT algorithm to improve control accuracy, and is particularly suitable for three-loop servo control including a position loop.
[0181] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they 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 chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for tuning PID parameters for motor control, comprising: The theoretical current loop PID parameter values are calculated based on the parameters of the motor when it is stationary and the discrete current loop model. The actual motor control is performed using the current loop PID parameter values of the theory, during which a first given current is input to the q-axis to obtain a first feedback current, wherein the first given current is a sinusoidal current with a first given frequency. The first comparison result between the first feedback current and the first given current is obtained based on multi-point FFT calculation; and Based on the first comparison result, the current loop PID parameter values are adjusted until the new first feedback current obtained by actual motor control using the adjusted current loop PID parameter values and the new first comparison result of the first given current satisfy a first predetermined condition. Wherein, the multi-point FFT is calculated as 2 N Point FFT calculation is performed, where 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 The merchants, Specifically, the value of the desired bandwidth of the current loop is determined based on the current loop PID parameter value based on the theory, and the value of N is selected such that the difference between the first given frequency and the desired bandwidth of the current loop does not exceed a predetermined threshold.
2. The method as described in claim 1, wherein, Selecting a value for N such that the difference between the first given frequency and the desired bandwidth of the current loop does not exceed a predetermined threshold includes: The integer multiple closest to the expected bandwidth of the current loop is calculated using the default N value; Calculate the error value between the signal frequency at the closest integer multiple and the expected bandwidth of the current loop; If the error value is less than the predetermined threshold, then the signal frequency at the nearest integer multiple of the error value is used as the first given frequency; and If the error value is greater than the predetermined threshold, then the value of N is increased until the new error value is less than the predetermined threshold.
3. The method as described in claim 1, wherein, The first comparison result includes a first amplitude comparison result and a first phase comparison result. The first comparison result of the first feedback current and the first given current obtained based on multi-point FFT calculation includes: The amplitude and phase of the first feedback current are obtained through multi-point FFT calculation; and The amplitude comparison result between the first feedback current and the first given current is taken as the first amplitude comparison result, and the phase comparison result between the first feedback current and the first given current is taken as the first phase comparison result.
4. The method of claim 3, wherein, Based on the first comparison result, the current loop PID parameter values are adjusted until the new first feedback current obtained by using the adjusted current loop PID parameter values for actual motor control and the new first comparison result of the first given current satisfy the first predetermined condition, including: In response to the first amplitude comparison result being greater than the first theoretical amplitude change value and the first phase comparison result being less than the first theoretical phase change value, the values of the current loop PID parameters are 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 first theoretical phase change value.
5. The method of claim 3, wherein, Based on the first comparison result, the current loop PID parameter values are adjusted until the new first feedback current obtained by using the adjusted current loop PID parameter values for actual motor control and the new first comparison result of the first given current satisfy the first predetermined condition, including: 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 values of the current loop PID parameters are 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.
6. The method of claim 1, wherein, The adjustment of the current loop PID parameter value includes: In response to the first comparison result being better than the theoretical change value, the value of the current loop proportional coefficient is reduced; and In response to the first comparison result being worse than the theoretical change value, the value of the current loop proportional coefficient is increased.
7. The method of claim 1, further comprising: The theoretical speed loop PID parameter values are calculated based on the parameters of the motor when it is stationary and the discrete current loop model. as well as Actual motor control is performed using the adjusted current loop PID parameter values to adjust the speed loop PID parameter values, wherein adjusting the speed loop PID parameter values includes: Actual motor control is performed using the adjusted current loop PID parameter values and the theoretical speed loop PID parameter values, 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. Calculate the 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 the new second feedback speed obtained by actual motor control using the adjusted speed loop PID parameter value satisfies the second predetermined condition with the new second comparison result of the second given speed.
8. The method of claim 7, further comprising: The theoretical position loop PID parameter values are calculated based on the parameters of the motor when it is stationary and the discrete current loop model. as well as Actual motor control is performed using adjusted current loop PID parameter values and adjusted speed loop PID parameter values to adjust the position loop PID parameter values; Actual motor control is performed using the adjusted current loop PID parameter values, the adjusted speed loop PID parameter values, and the theoretical position loop PID parameter values, during which a third given position is input to the position loop to obtain a third feedback position, wherein the third given position is a sinusoidal position signal with a third given frequency. Calculate the 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 the new third feedback position obtained by actual motor control using the adjusted position loop PID parameter value satisfies the third predetermined condition with the new third comparison result of the third given position.
9. The method of claim 8, further comprising: The adjusted current loop PID parameter values, the adjusted speed loop PID parameter values, and the adjusted position loop PID parameter values are written into the motor controller; as well as The controller performs magnetodirectional vector control during the operation of the motor based on the adjusted current loop PID parameter values, the adjusted speed loop PID parameter values, and the adjusted position loop PID parameter values.
10. A motor control system, comprising: Electric motor; A control module is used to control the motor using adjusted PID parameters obtained based on the PID parameter tuning method as described in any one of claims 1-8.
Citation Information
Patent Citations
Current ring starting method for permanent magnet synchronous motor with variable PID parameters
CN107046387A
Adaptive Controller for STATCOM to Enhance Voltage Stability
US20130207620A1