Servo motor speed ring self-tuning method and device

By collecting error values ​​and steady-state indicators in the servo motor speed adjustment process in real time, calculating volatility indicators, and adjusting PID controller parameters using linear functions or fuzzy strategies, the problem of time-consuming and inaccurate manual parameters in the existing technology is solved, and automated, stable and efficient servo motor control is achieved.

CN120049793AInactive Publication Date: 2025-05-27SHENZHEN RECURSIVE AUTOMATION TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510081343.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-05-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing servo motor control methods rely on manual experience to manually adjust the parameters of the PID controller, which makes it time-consuming and susceptible to human factors, and cannot quickly obtain the optimal control parameters.

Method used

By obtaining the desired speed and initial control parameters, the servo motor speed is cyclically adjusted, the error value, steady-state error and steady-state duration are collected, and the volatility index is calculated. When the volatility index is less than the threshold and the steady-state error is greater than the threshold, the initial control parameters are adjusted using a preset linear function or a fuzzy strategy to obtain the target control parameters.

Benefits of technology

It realizes automatic adjustment of PID controller parameters, reduces the workload of manual debugging, improves the stability and response speed of the system, and adapts to stable and accurate adjustment under various working conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120049793A_ABST
    Figure CN120049793A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of control systems, and provides a servo motor speed ring self-tuning method and device, and the method comprises the steps: collecting an error value, a steady-state error and steady-state time in the speed adjustment process of a servo motor in real time, and calculating a fluctuation index, thereby achieving the self-tuning of the speed ring of the servo motor. And the adjustment effect of the PID controller parameters can be comprehensively evaluated. When the volatility index is smaller than a first threshold value, a linear function is adopted to adjust the initial PID parameter, a first target control parameter is obtained, and therefore the adjusting performance is optimized; and when the volatility index does not reach the standard, performing adaptive adjustment by using a fuzzy strategy to obtain a second target control parameter. By dynamically adjusting PID parameters, external interference or load change can be effectively handled, the problems of over-adjustment, under-adjustment and the like are reduced, and the stability and response speed of the system are improved. The manual debugging workload is reduced, especially in a complex application scene, the system efficiency and stability are remarkably improved, the debugging cost is reduced, and the deployment efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of control systems, and particularly relates to a servo motor speed loop self-tuning method and device. Background Art

[0002] Servo motors are widely used in industrial automation, robotics, precision instruments and other fields. Due to their high precision and high responsiveness, they are particularly suitable for occasions that require rapid and stable adjustment of the movement speed. In a servo motor control system, the speed loop is an important part of regulating the motor operating speed, and usually adopts the PID (Proportional-Integral-Derivative) control algorithm to achieve precise control of the motor speed. The PID controller controls the response speed, steady-state error and stability of the transient process of the servo motor by adjusting three parameters: the proportional gain (P), the integral gain (I) and the derivative gain (D).

[0003] However, in practical applications, due to factors such as load changes of the servo motor, system disturbances and improper controller parameter settings, the performance of the PID controller may be affected, resulting in an unsatisfactory system response speed, an excessive or too small steady-state error, and even oscillation or instability. Therefore, how to accurately determine and optimize the parameters of the PID controller so that the servo motor can reach the desired speed smoothly and quickly under different working conditions has always been a key issue in the research of servo motor control systems.

[0004] Existing servo motor control methods usually rely on manual experience to manually adjust the parameters of the PID controller. This method is not only time-consuming but also vulnerable to human factors, and it is impossible to obtain the optimal control parameters in a short time. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a servo motor speed loop self-tuning method and device to solve the technical problem that existing servo motor control methods usually rely on manual experience to manually adjust the parameters of the PID controller.

[0006] The first aspect of the embodiments of the present invention provides a servo motor speed loop self-tuning method, and the servo motor speed loop self-tuning method includes:

[0007] Obtain the desired speed and the initial control parameters of the speed loop, and input the desired speed into a PID controller with the initial control parameters, and cyclically adjust the speed of the servo motor; the initial control parameters include the initial proportional gain, the initial integral gain and the initial derivative gain of the PID controller; the initial control parameters are used to adjust the speed of the servo motor to the desired speed;

[0008] During the process of cyclically adjusting the speed of the servo motor based on the desired speed, the error value, steady-state error, and steady-state duration of each speed adjustment are collected; the steady-state error refers to the average value among multiple current error values, and the multiple current error values refer to the error values that fluctuate only within a preset fluctuation range within a preset duration, and the steady-state duration refers to the duration required to reach the steady-state error;

[0009] According to multiple error values, steady-state error, and steady-state duration, calculate the volatility index corresponding to the initial control parameter;

[0010] When the volatility index is less than the first threshold and the steady-state error is greater than the second threshold, use a preset linear function to adjust the initial control parameter to obtain the first target control parameter;

[0011] Input the desired speed into a PID controller with the first target control parameter to cyclically adjust the speed of the servo motor; the first target control parameter is used to adjust the speed of the servo motor to the desired speed;

[0012] When the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, use a preset fuzzy strategy to adjust the initial control parameter to obtain the second target control parameter;

[0013] Input the desired speed into a PID controller with the second target control parameter to cyclically adjust the speed of the servo motor; the second target control parameter is used to adjust the speed of the servo motor to the desired speed.

[0014] Further, the step of collecting the error value, steady-state error, and steady-state duration of each speed adjustment during the process of cyclically adjusting the speed of the servo motor based on the desired speed includes:

[0015] Step A1: Adjust the speed of the servo motor based on the initial control parameter and collect the actual speed; the actual speed refers to the real-time speed collected by a speed sensor;

[0016] Step A2: Calculate the error value between the desired speed and the actual speed;

[0017] Step A3: Cyclically execute Step A1 to Step A2 to obtain the error value corresponding to each speed adjustment;

[0018] Step A4: When multiple consecutive current error values are less than the third threshold, use the average value of the multiple consecutive current error values as the steady-state error;

[0019] Step A5: Use the duration between the first speed adjustment and reaching the steady-state error as the steady-state duration.

[0020] Further, the step of calculating the volatility index corresponding to the initial control parameter according to multiple error values, steady-state error, and steady-state duration includes:

[0021] Inputting multiple error values, steady-state error, and steady-state duration into a first function to obtain the volatility index corresponding to the initial control parameter;

[0022] The first function is:

[0023]

[0024] where VI represents the volatility index corresponding to the initial control parameter, T ss represents the steady-state duration, ΔE(t) represents the error change rate, E(t) represents the error value at the t-th moment, ∈ ss represents the steady-state error, σ E represents the error mean of multiple error values, T max represents a preset upper limit value of the steady-state duration.

[0025] Further, the step of, when the volatility index is less than a first threshold and the steady-state error is greater than a second threshold, adjusting the initial control parameter by using a preset linear function to obtain a first target control parameter includes:

[0026] When the volatility index is less than the first threshold and the steady-state error is greater than the second threshold, obtaining a preset step speed; the step speed is greater than the desired speed and is used to test the response of the servo motor;

[0027] Inputting the step speed into a PID controller with the initial control parameter to cyclically adjust the speed of the servo motor;

[0028] During the process of cyclically adjusting the speed of the servo motor based on the step speed, collecting the steady-state gain, response time, and time parameter; the steady-state gain refers to the ratio between the steady-state output and the step speed and is used to represent the sensitivity of the servo motor to input changes; the steady-state output represents the actual output speed of the servo motor before cyclic adjustment; the response time refers to the delay time before the servo motor responds to the input step speed, and the time parameter refers to the duration for the servo motor to reach the step speed;

[0029] Inputting the steady-state gain, the response time, and the time parameter into a preset linear function to obtain a first target control parameter; the first target control parameter includes the first target proportional gain, the first target integral gain, and the first target derivative gain of the PID controller;

[0030] The preset linear function is:

[0031]

[0032] Among them, K p represents the first target proportional gain, T i represents the first target integral gain, T d represents the first target derivative gain, τ represents the time parameter, L represents the response time, and K represents the steady-state gain.

[0033] Further, the step of, when the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, adopting a preset fuzzy strategy to adjust the initial control parameter to obtain the second target control parameter includes:

[0034] When the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, obtain the error mean and error change rate of multiple error values; the error mean is calculated based on the real-time speed and the desired speed;

[0035] Calculate the first membership degree corresponding to the error mean among multiple fuzzy labels;

[0036] Calculate the second membership degree corresponding to the error change rate among multiple fuzzy labels; the fuzzy labels include negative large, negative small, zero, positive small, and positive large;

[0037] Extract the maximum first membership degree among multiple first membership degrees, and extract the maximum second membership degree among multiple second membership degrees;

[0038] Match the regulation coefficients corresponding to the maximum first membership degree fuzzy label and the maximum second membership degree fuzzy label in the pre-stored mapping table; the regulation coefficients include proportional gain regulation coefficient, integral gain regulation coefficient, and derivative gain regulation coefficient; the maximum first membership degree fuzzy label refers to the fuzzy label corresponding to the maximum first membership degree; the maximum second membership degree fuzzy label refers to the fuzzy label corresponding to the maximum second membership degree;

[0039] Multiply the initial proportional gain by the proportional gain regulation coefficient and add it to the initial proportional gain to obtain the second target proportional gain in the second target control parameter;

[0040] Multiply the initial integral gain by the integral gain regulation coefficient and add it to the initial integral gain to obtain the second target integral gain in the second target control parameter;

[0041] Multiply the initial derivative gain by the derivative gain regulation coefficient and add it to the initial derivative gain to obtain the second target derivative gain in the second target control parameter.

[0042] Further, the step of calculating the first membership degree corresponding to the error mean among multiple fuzzy labels includes:

[0043] Input the mean error into the first function set to obtain the corresponding first membership degrees among multiple fuzzy labels;

[0044] The first function set is:

[0045]

[0046]

[0047]

[0048] where, μ NB (E) represents the first membership degree corresponding to negative large, μ NS (E) represents the first membership degree corresponding to negative small, μ Z (E) represents the first membership degree corresponding to zero, μ PS (E) represents the first membership degree corresponding to positive small, μ PB (E) represents the first membership degree corresponding to positive large, ΔE and -ΔE represent the preset value ranges of the mean error, and E represents the mean error.

[0049] Further, the step of calculating the corresponding second membership degrees of the error change rate among multiple fuzzy labels includes:

[0050] Input the error change rate into the second function set to obtain the corresponding second membership degrees among multiple fuzzy labels;

[0051] The second function set is:

[0052]

[0053]

[0054]

[0055] where, μμ NB (H) represents the second membership degree corresponding to negative large, μμ NS (H) represents the second membership degree corresponding to negative small, μ Z (H) represents the second membership degree corresponding to zero, μ PS (H) represents the second membership degree corresponding to positive small, μ PB (H) represents the second membership degree corresponding to positive large, H represents the error change rate, and -Δ and Δ represent the value ranges of the error change rate.

[0056] The second aspect of the embodiments of the present invention provides a servo motor speed loop self-tuning device, including:

[0057] An acquisition unit, configured to acquire a desired speed and initial control parameters of a speed loop, input the desired speed into a PID controller with the initial control parameters, and cyclically adjust the speed of a servo motor; the initial control parameters include an initial proportional gain, an initial integral gain, and an initial derivative gain of the PID controller; the initial control parameters are used to adjust the speed of the servo motor to the desired speed;

[0058] A collection unit, configured to collect an error value, a steady-state error, and a steady-state duration of each speed adjustment during the process of cyclically adjusting the speed of the servo motor based on the desired speed; the steady-state error refers to an average value among multiple current error values, and the multiple current error values refer to error values that only fluctuate within a preset fluctuation range within a preset duration, and the steady-state duration refers to the duration required to reach the steady-state error;

[0059] A first calculation unit, configured to calculate a volatility index corresponding to the initial control parameters according to multiple error values, the steady-state error, and the steady-state duration;

[0060] A second calculation unit, configured to, when the volatility index is less than a first threshold and the steady-state error is greater than a second threshold, adopt a preset linear function to adjust the initial control parameters to obtain first target control parameters;

[0061] A first adjustment unit, configured to input the desired speed into a PID controller with the first target control parameters, and cyclically adjust the speed of the servo motor; the first target control parameters are used to adjust the speed of the servo motor to the desired speed;

[0062] A third calculation unit, configured to, when the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, adopt a preset fuzzy strategy to adjust the initial control parameters to obtain second target control parameters;

[0063] A second adjustment unit, configured to input the desired speed into a PID controller with the second target control parameters, and cyclically adjust the speed of the servo motor; the second target control parameters are used to adjust the speed of the servo motor to the desired speed.

[0064] A third aspect of an embodiment of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where when the processor executes the computer program, the steps of the servo motor speed loop self-tuning method described in the first aspect above are implemented.

[0065] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the servo motor speed loop self-tuning method described in the first aspect above are implemented.

[0066] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: By collecting the error value, steady-state error, and steady-state duration during the speed regulation process of the servo motor in real time, and calculating the volatility index based on these data, the adjustment effect of the current PID controller parameters can be comprehensively evaluated. When the volatility index is less than the first threshold, a preset linear function is used to adjust the initial PID controller parameters to obtain the first target control parameters, further optimizing the regulation performance of the servo motor. When the volatility index does not meet the conditions, a fuzzy strategy is used for adaptive adjustment to obtain the second target control parameters. This adaptive adjustment strategy can flexibly respond to different working environments according to different control requirements, ensuring that the system can achieve relatively stable and accurate regulation under various working conditions. By dynamically adjusting the parameters of the PID controller in real time, the present invention can effectively cope with the influence brought by external interference or load changes, reduce overshoot, undershoot and other phenomena caused by improper PID parameter settings, thereby improving the stability and response speed of the system. The calculation of the steady-state error and steady-state duration can further help determine whether the system has reached the expected stable state, thus achieving more accurate speed control. Through the self-tuning mechanism, the workload of manually debugging PID parameters is reduced. Especially in complex application scenarios, the efficiency and stability of the system can be significantly improved. The self-tuning method does not require manual repeated experiments and experience accumulation, thereby reducing the cost during the debugging process and improving the efficiency of system deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or related technical descriptions. Obviously, the following described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0068] Figure 1 It shows a schematic flowchart of a servo motor speed loop self-tuning method provided by the present invention;

[0069] Figure 2 It shows a schematic diagram of a servo motor speed loop self-tuning device provided by an embodiment of the present invention;

[0070] Figure 3 It shows a schematic diagram of a terminal device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0071] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, in order to thoroughly understand the embodiments of the present invention. However, those skilled in the art should clearly understand that the present invention can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present invention.

[0072] Embodiments of the present invention provide a servo motor speed loop self-tuning method and device to solve the technical problem that existing servo motor control methods usually rely on manual experience to manually adjust the parameters of the PID controller.

[0073] First of all, the present invention provides a servo motor speed loop self-tuning method. Please refer to Figure 1 , Figure 1 which shows a schematic flowchart of a servo motor speed loop self-tuning method provided by the present invention. As Figure 1 shown, the servo motor speed loop self-tuning method may include the following steps:

[0074] Step 101: Obtain the desired speed and the initial control parameters of the speed loop, and input the desired speed into a PID controller with the initial control parameters to cyclically adjust the speed of the servo motor; the initial control parameters include the initial proportional gain, initial integral gain, and initial derivative gain of the PID controller; the initial control parameters are used to adjust the speed of the servo motor to the desired speed;

[0075] First, obtain the desired speed (target speed) of the servo motor. The desired speed is the speed that the control system hopes the servo motor will ultimately reach. At the same time, it is also necessary to obtain the initial control parameters of the PID controller. The initial control parameters include, but are not limited to:

[0076] Proportional gain (P): Adjusts the response degree of the system to the current error.

[0077] Integral gain (I): Adjusts the response degree of the system to the cumulative error and eliminates the steady-state error.

[0078] Derivative gain (D): Adjusts the response degree of the system to the rate of change of the error and reduces overshoot and oscillation.

[0079] Input the desired speed into the PID controller and start cyclically adjusting the motor speed. At this time, the PID controller adjusts the output according to the initial P, I, and D parameters to make the speed of the motor gradually approach the desired speed.

[0080] Step 102: During the process of cyclically adjusting the speed of the servo motor based on the desired speed, collect the error value, steady-state error, and steady-state duration for each speed adjustment; the steady-state error refers to the average value among multiple current error values, and the multiple current error values refer to the error values that fluctuate only within a preset fluctuation range within a preset duration, and the steady-state duration refers to the duration required to reach the steady-state error.

[0081] During the adjustment process, the following key indicators need to be collected:

[0082] Error value: The difference between the actual speed of the motor and the desired speed after each adjustment.

[0083] Steady-state error: It means that after a long-term adjustment, the error gradually tends to a small value, which is called "steady state". The steady-state error is the average value of multiple error values, and these error values refer to the situation where the error fluctuates within a fixed range within a preset duration.

[0084] Steady-state duration: The time required from the start of adjustment until the motor speed stabilizes and remains within a predetermined error range.

[0085] These information helps to evaluate the performance of the PID controller under the current control parameters. Among them, the specific logic for collecting the error value, steady-state error, and steady-state duration for each speed adjustment is as follows:

[0086] Specifically, Step 102 specifically includes Step A1 to Step A5:

[0087] Step A1: Adjust the speed of the servo motor based on the initial control parameters and collect the actual speed; the actual speed refers to the real-time speed collected by the speed sensor;

[0088] The actual speed is the motor output speed monitored in real time by the speed sensor. This speed reflects the actual movement situation of the servo motor under control.

[0089] The purpose of Step A1 is to start the adjustment process and obtain the current actual speed of the motor through the sensor, which serves as the basis for subsequent error calculation.

[0090] Step A2: Calculate the error value between the desired speed and the actual speed;

[0091] The error value is the difference between the desired speed and the actual speed.

[0092] Step A3: Cyclically execute Step A1 to Step A2 to obtain the error value corresponding to each speed adjustment;

[0093] In each adjustment cycle, step A1 (adjust and collect the actual speed) and step A2 (calculate the error) are continuously and cyclically executed. This is a dynamic process. With each adjustment, the system continuously obtains the error value and gradually approaches the target speed.

[0094] The result of each cycle will generate a new error value, and these error values will be recorded and used for subsequent analysis.

[0095] Step A4: When multiple consecutive current error values are less than the third threshold, take the average value of the multiple consecutive current error values as the steady-state error;

[0096] The steady-state error refers to the situation where, during the motor adjustment process, the error value tends to be stable and fluctuates within a small range after a certain period of time. Generally speaking, the steady-state error reflects the accuracy of the control system. The smaller it is, the more stable the system is.

[0097] The third threshold is used to determine whether the current error is small enough to meet the standard of the steady-state error. That is, when multiple consecutive error values are less than the third threshold, the system considers that it has reached a steady state and calculates the average value of these error values as the final steady-state error.

[0098] Step A5: Take the duration between the first speed adjustment and the attainment of the steady-state error as the steady-state duration.

[0099] The steady-state duration refers to the time required from the start of the first adjustment until the error value stabilizes and reaches the steady-state error. This period reflects the response speed of the system adjustment. A shorter steady-state duration usually indicates that the system adjusts quickly and rapidly approaches the target speed. The steady-state duration is the time interval from the start of the adjustment (the first speed adjustment) until the error value stabilizes and reaches the steady-state error.

[0100] In this embodiment, by collecting the error value between the actual speed and the desired speed during each speed adjustment process, the present invention can monitor the adjustment effect of the system in real time. The calculation of each error value provides the basic data for the subsequent evaluation of the steady-state error and the steady-state duration. When multiple consecutive current error values are less than the second threshold, by using the average value of these error values as the steady-state error, this method helps to accurately evaluate whether the system has reached the expected steady state, avoiding misjudgment caused by instantaneous errors or unstable factors, and further improving the speed adjustment accuracy. By measuring the duration required from the first speed adjustment to reaching the steady-state error, the present invention can provide accurate steady-state duration data. The collection of the steady-state duration can help optimize the adjustment process of the system, reduce the phenomena of too slow or too fast response, and improve the working efficiency of the system. By continuously and circularly executing step A1 to step A2, the system can obtain the error value in real time and adjust the adjustment strategy according to the actual situation. This technical solution can dynamically feedback the performance of the servo motor and provide support for adaptive control. This technical solution provides a comprehensive evaluation method based on the error value, the steady-state error, and the steady-state duration, which can help analyze the performance of the servo motor under different working conditions, thereby guiding the optimization of the adjustment parameters. This optimization makes the motor adjustment process more refined, reduces the phenomena of overshoot or undershoot, and helps to improve the overall stability, accuracy, and response speed of the system.

[0101] Step 103: Calculate the volatility index corresponding to the initial control parameter according to multiple error values, the steady-state error, and the steady-state duration;

[0102] Based on the collected error value, the steady-state error, and the steady-state duration, calculate a volatility index. This index reflects the stability and accuracy in the motor adjustment process. The specific calculation logic of the volatility index is as follows:

[0103] Specifically, step 103 specifically includes:

[0104] Input multiple error values, the steady-state error, and the steady-state duration into the first function to obtain the volatility index corresponding to the initial control parameter;

[0105] The first function is:

[0106]

[0107] where VI represents the volatility index corresponding to the initial control parameter, T ss represents the steady-state duration, ΔE(t) represents the error change rate, E(t) represents the error value at the t-th moment, ∈ ss represents the steady-state error, σ E represents the error mean of multiple error values, T max represents the preset upper limit value of the steady-state duration.

[0108] Make the volatility index inversely proportional to the steady-state duration. The shorter the steady-state duration, the higher the index, indicating that the system has poor convergence and large volatility. The steady-state duration is T ss It reflects the time taken for the system to reach the steady state from the start. Ideally, the control system of the servo motor should stabilize in the shortest time, and the error should quickly converge to the steady-state error ∈ ss . If the steady-state duration of the system is too long, it indicates that the system has strong fluctuations or oscillations, which may be due to inappropriate parameters, slow response, or instability of the system itself. Therefore, the steady-state duration is closely related to volatility. The longer the steady-state duration, the greater the volatility of the system may be.

[0109] This term reflects the rate of change of the error over time and its fluctuations. ΔE(t) is the error change rate, indicating the rate of change of the system error over time. If the error changes quickly and frequently, it means that the system's response to the error is unstable and the volatility is large. After normalizing the error change rate (i.e., dividing by the steady-state error ∈ ss ), it can eliminate the influence of the absolute value of the error, making the volatility index focus on the measurement of relative volatility. Integrating the square of the change rate is to emphasize larger fluctuations, which have a greater impact on the system's volatility. In practice, if the error changes violently and frequently exceeds the preset range, it means that the system is unstable, and the value of this term will be large, and the volatility will also be large.

[0110] This term is used to measure the volatility of the steady-state error. σ E is the mean error of the error, indicating the amplitude of the error fluctuations throughout the process. The larger the mean error, the stronger the fluctuations. ∈ ss is the steady-state error, representing the error range that the system can reach in the steady state. This ratio can reflect the error fluctuation situation of the system in the steady state. If the steady-state error ∈ ss is very small, while the mean error σ E is large, it means that there are still large fluctuations in the error when the system reaches the steady state. On the contrary, if the mean error is small, it means that the system tends to be stable and the volatility is low.

[0111] This term reflects the relationship between the steady-state duration T ss and the maximum observation time T max . If T ss is larger, it means that the system needs more time to stabilize, indicating that there are large fluctuations and unstable factors in the system before entering the steady state. Therefore, the volatility will increase, and the index value will also increase. If T ssThe smaller it is, the faster and more stable the system is, with less volatility. By introducing this term, the volatility index can consider the "convergence" time of the system before reaching the steady state, further improving the accuracy of the formula.

[0112] Through such multi-dimensional combinations, the first function can comprehensively consider the response speed, stability, and error volatility of the servo motor control system, generating a single index VI that can reflect the system's volatility. If the value of VI is large, it indicates that the error fluctuation of the system is large, and there may be strong oscillations or delayed responses, requiring optimization of the control parameters. If the value of VI is small, it means that the system is relatively stable, with small error fluctuations, quickly entering the steady state, and showing good control performance. Through the volatility index, the volatility of the servo motor can be more accurately and systematically quantified, enabling real-time monitoring and optimization of the performance of the servo motor control system.

[0113] During the self-tuning process, the system may experience overshoot or oscillation, resulting in the error not being able to quickly stabilize within a suitable range. By calculating the volatility index VI, overshoot and oscillation can be quantified and avoided, thus ensuring a smoother transition of the system to the steady state.

[0114] Step 104: When the volatility index is less than the first threshold and the steady-state error is greater than the second threshold, use a preset linear function to adjust the initial control parameters to obtain the first target control parameters;

[0115] When the volatility index is less than the first threshold and the steady-state error is greater than the second threshold, the system believes that the current volatility performance is relatively stable, but the steady-state error is too large, meaning that although the adjustment tends to be stable, the goal of precise control has not been achieved. Therefore, the system will use a preset linear function to adjust the initial control parameters (proportional, integral, and derivative gains) to obtain the first target control parameters.

[0116] The role of the linear function is to adjust the control parameters based on the current error and volatility through simple mathematical mapping, optimizing the response of the PID controller. The specific processing logic for using the preset linear function is as follows:

[0117] Specifically, step 104 specifically includes steps 1041 to 1044:

[0118] Step 1041: When the volatility index is less than the first threshold and the steady-state error is greater than the second threshold, obtain the preset step speed; the step speed is greater than the desired speed and is used to test the response of the servo motor;

[0119] The step speed is a preset speed value higher than the desired speed, which is used to test the response characteristics of the system to input changes. The step input can help understand the response of the servo motor when facing sudden input changes. The step speed is set to be greater than the desired speed, aiming to fully display the adjustment performance of the motor when the input speed suddenly changes.

[0120] Step 1042: Input the step speed into the PID controller with the initial control parameters, and cyclically adjust the speed of the servo motor.

[0121] After inputting the step speed into the controller, the PID controller adjusts according to the current initial control parameters (proportional, integral, and derivative gains). During the adjustment process, the actual speed of the motor will continuously change until a new steady state is reached.

[0122] Step 1043: During the process of cyclically adjusting the speed of the servo motor based on the step speed, collect the steady-state gain, response time, and time parameter; the steady-state gain refers to the ratio between the steady-state output and the step speed, which is used to represent the sensitivity of the servo motor to input changes; the steady-state output represents the actual output speed of the servo motor before cyclic adjustment; the response time refers to the delay time before the servo motor responds to the input step speed, and the time parameter refers to the duration for the servo motor to reach the step speed.

[0123] The steady-state gain refers to the ratio between the final output speed (steady-state output) of the servo motor and the step speed under a step input. The steady-state gain reflects the sensitivity of the motor to input changes. A higher steady-state gain indicates that the motor is more sensitive to speed adjustment.

[0124] The response time refers to the time delay from the input of the step speed signal to the start of the servo motor's response. A shorter response time indicates a fast response of the system to the input signal, and generally, a shorter response time is desired.

[0125] The time parameter refers to the time required for the motor to reach a steady state after the step speed input. A shorter time parameter indicates that the motor can quickly reach and stabilize at the target speed.

[0126] Step 1044: Input the steady-state gain, the response time, and the time parameter into a preset linear function to obtain the first target control parameter; the first target control parameter includes the first target proportional gain, the first target integral gain, and the first target derivative gain of the PID controller.

[0127] The preset linear function is:

[0128]

[0129] Where, K p represents the first target proportional gain, Ti represents the first target integral gain, T d represents the first target derivative gain, τ represents the time parameter, L represents the response time, and K represents the steady-state gain.

[0130] The goal of this embodiment is to design a PID controller such that the system can respond to any input change, especially a step input, in a fast and stable manner. The PID controller has three tuning parameters:

[0131] Proportional gain: Affects the response speed of the system. Increasing the proportional gain makes the system respond faster.

[0132] Integral time constant: Affects the steady-state error of the system. The integral action can eliminate the persistent steady-state error.

[0133] Derivative time constant: Affects the overshoot and oscillation of the system. The derivative action can predict the change of the error and reduce the overshoot and oscillation of the system.

[0134] The first target proportional gain K p Directly affects the output of the system by increasing the response of the control quantity. When the first target proportional gain K p increases, the response of the system becomes faster, but it may cause the system to overshoot or even become unstable. The first target proportional gain K p is set to: The setting principle is: The first target proportional gain K p is based on the steady-state gain K of the servo motor, that is, the steady-state gain of the servo motor determines the magnitude of the proportional gain. At the same time, the first target proportional gain K p is also related to the ratio of the time parameter τ and the response time L. This is because if the time constant and lag time of the system are large, the system response is slow, and a larger proportional gain is required to make the system respond faster.

[0135] The first target integral gain T i functions to eliminate the steady-state error, that is, when the system deviates from the set value, the integral term accumulates the error over time, and finally makes the error zero. The first target integral gain T i determines the "strength" of the integral action, that is, how much time to start the integration. The first target integral gain T i is set to: The design principle is: The time parameter τ and the response time L jointly determine the integral time constant. A system with a longer lag time requires a longer integral time constant, indicating that the system needs more time to eliminate the error.

[0136] The first target derivative gain T dIts function is to predict the future trend of the prediction error and reduce the overshoot of the system. The first target differential gain T d is designed to be The design principle is that the first target differential gain T d is selected based on the dead time and the time constant. A system with a larger dead time requires a smaller differential time constant because the system responds slowly and the effect of the differential action is relatively weak.

[0137] The first target control parameters include the proportional gain, integral gain, and differential gain in the PID controller. After being adjusted by a linear function, these parameters will be different from the initial control parameters, aiming to better match the actual response requirements of the system. Finally, the first target control parameters will be applied to the PID controller, and the new control parameters can improve the response speed, accuracy, and stability of the system and improve the regulation performance of the servo motor.

[0138] In this embodiment, through the step response test method, the steady-state gain, response time, and time parameters of the system are measured, and the initial control parameters of the PID controller are adjusted using a preset linear function to obtain a control parameter that is more suitable for the current system state. This process helps to optimize the performance of the PID controller by adjusting the system response characteristics when the steady-state error is large, thereby improving the accuracy and response speed of the servo motor.

[0139] Step 105: Input the desired speed into the PID controller with the first target control parameters, and cyclically adjust the speed of the servo motor; the first target control parameters are used to adjust the speed of the servo motor to the desired speed;

[0140] Step 106: When the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, adopt a preset fuzzy strategy to adjust the initial control parameters to obtain the second target control parameters;

[0141] When the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold:

[0142] The system considers that there is a large volatility in the adjustment process and the steady-state error is still large. At this time, linear adjustment may not be able to effectively optimize the control, and the system will switch to a preset fuzzy strategy. The fuzzy strategy usually adjusts the control parameters through a fuzzy logic system to more flexibly handle complex and uncertain system behaviors.

[0143] The fuzzy strategy will adjust the PID parameters according to the error size, volatility, and steady-state performance in order to obtain a more accurate and stable control effect and obtain the second target control parameters. Among them, the specific logic of the preset fuzzy strategy is as follows:

[0144] Specifically, step 106 specifically includes steps 1061 to 1068:

[0145] Step 1061: when the volatility index is not less than the first threshold value and the steady-state error is greater than the second threshold value, obtaining an error mean and an error change rate of a plurality of error values; the error mean is calculated based on the real-time speed and the expected speed;

[0146] The volatility index indicates the degree of fluctuation of the system error. If the volatility index is high, it means that the system error fluctuates greatly.

[0147] Steady-state error refers to the error between the desired speed and the actual speed after the adjustment process reaches stability. If the steady-state error is large, it means that the system has not yet achieved the expected performance.

[0148] The conditional judgment in this step is to identify situations where the system control performance is not ideal and decide whether the fuzzy control strategy needs to be applied.

[0149] The error mean is used to measure the dispersion of the error value, that is, the amplitude of the error fluctuation. The larger the error mean, the more drastic the error fluctuation and the poorer the stability of the system control. The error change rate measures the rate at which the error changes over time. A high error change rate may indicate that the system is over-responsive or the adjustment process is not stable.

[0150] Step 1062: Calculate the first degree of membership corresponding to the error mean value in multiple fuzzy labels;

[0151] Membership indicates the degree of match between a value and a fuzzy label. The error mean and error change rate are assigned to five fuzzy labels: Negative Large, Negative Small, Zero, Positive Small, and Positive Large. These labels represent different degrees of error and change rate. The specific calculation logic of the first membership is as follows:

[0152] Specifically, step 1062 includes the following steps:

[0153] Inputting the error mean into a first function set to obtain a first degree of membership corresponding to a plurality of fuzzy labels;

[0154] The first function set is:

[0155]

[0156]

[0157]

[0158] Among them, μNB (E) represents the first membership degree corresponding to the large negative, μ NS (E) represents the first membership degree corresponding to the small negative, μ Z (E) represents the first membership degree corresponding to zero, μ PS (E) represents the first membership degree corresponding to the small positive, μ PB (E) represents the first membership degree corresponding to the large positive, ΔE and -ΔE represent the preset value range of the error mean, and E represents the error mean.

[0159] Negative large (NB) means that the error mean is very large and negative, usually indicating that the system is moving away from the target at a relatively fast rate. This situation may occur in the initial startup stage of the system or when there is a large disturbance. Negative small (NS) means that the error mean is negative but changing slowly, which may indicate that the system has approached the target but still requires some adjustment. Zero (Z) means that the error mean is close to zero and the system is in a stable state. At this time, the change trend of the system error has no obvious change, indicating that the system has approached the target value and there will be no large-scale adjustment. Positive small (PS) means that the error mean is positive and the change is small, usually indicating that the system is gradually approaching the target. Positive large (PB) means that the error mean is very large and positive, meaning that the system is moving away from the target. Usually, this situation occurs when the error value is too large or the system is disturbed.

[0160] It should be noted that the function corresponding to the large negative usually indicates that when the error mean is a large negative value, the system is deviating from the target in the reverse direction.

[0161] The function corresponding to the small negative indicates that the error mean is negative but small, and is usually used to represent small adjustments when approaching the target.

[0162] The function corresponding to zero usually indicates that the system error mean is close to zero, indicating that the system tends to be stable.

[0163] The function corresponding to the small positive indicates that the error mean is positive but small, and the system may gradually tend to the target.

[0164] The function corresponding to the large positive indicates that the error mean is positive and large, and the system may be moving away from the target.

[0165] Step 1063: Calculate the second membership degree corresponding to the error change rate among multiple fuzzy labels; the fuzzy labels include negative large, negative small, zero, positive small, and positive large;

[0166] Specifically, step 1063 is calculated in the following way:

[0167] Input the error change rate into the second function set to obtain the second membership degree corresponding to multiple fuzzy labels;

[0168] The second function set is:

[0169]

[0170]

[0171]

[0172] where μ NB (H) represents the second membership degree corresponding to the large negative, μ NS (H) represents the second membership degree corresponding to the small negative, μ Z (H) represents the second membership degree corresponding to zero, μ PS (H) represents the second membership degree corresponding to the small positive, μ PB (H) represents the second membership degree corresponding to the large positive, H represents the rate of change of the error, and --Δ and Δ represent the value range of the rate of change of the error.

[0173] Negative large (NB) means that the rate of change of the error is very large and negative, usually indicating that the system is moving away from the target at a relatively fast speed. This situation may occur in the initial startup stage of the system or when there is a large disturbance. Negative small (NS) means that the rate of change of the error is negative but changes slowly, which may indicate that the system has approached the target but still requires some adjustment. Zero (Z) means that the rate of change of the error is close to zero and the system is in a stable state. At this time, the trend of the error change of the system has no obvious change, indicating that the system has approached the target value and there will be no large-scale adjustment. Positive small (PS) means that the rate of change of the error is positive and changes little, usually indicating that the system is gradually approaching the target and adjusting at a small rate. Positive large (PB) means that the rate of change of the error is very large and positive, meaning that the system is moving away from the target. Usually, this situation occurs when the error value is too large or the system is disturbed.

[0174] It should be noted that the function corresponding to the large negative usually indicates that when the rate of change of the error is a large negative value, the system is deviating in the opposite direction from the target.

[0175] The function corresponding to the small negative indicates that the rate of change of the error is negative but small, and is usually used to represent small adjustments when approaching the target.

[0176] The function corresponding to zero usually indicates that the rate of change of the system error is close to zero, indicating that the system tends to be stable.

[0177] The function corresponding to the small positive indicates that the rate of change of the error is positive but small, and the system may gradually tend to the target.

[0178] The function corresponding to the large positive indicates that the rate of change of the error is positive and large, and the system may be moving away from the target.

[0179] The design of the second set of functions helps the system to make dynamic adjustments according to the change rate of the error. By reasonably designing the fuzzy sets and membership functions of the error change rate, the control system can be made more flexible and responsive, adapting to the uncertainties and dynamic characteristics of the system. The definition of each membership function classifies and models the error change trend of the system under different control states, helping the fuzzy control algorithm to make more accurate control decisions.

[0180] Step 1064: Extract the maximum first membership degree among multiple first membership degrees, and extract the maximum second membership degree among multiple second membership degrees;

[0181] Among multiple membership degree values, the maximum membership degree corresponds to the label that can best reflect the current error and change rate. For example, if the membership degree of the error mean is the largest under the "Positive Big" label, and the membership degree of the error change rate is the largest under the "Zero" label, then these two labels respectively represent the characteristics of the current system's error mean and error change rate.

[0182] Step 1065: Match the regulation coefficients corresponding to the maximum first membership degree fuzzy label and the maximum second membership degree fuzzy label in the pre-stored mapping table; the regulation coefficients include a proportional gain regulation coefficient, an integral gain regulation coefficient, and a derivative gain regulation coefficient; the maximum first membership degree fuzzy label refers to the fuzzy label corresponding to the maximum first membership degree; the maximum second membership degree fuzzy label refers to the fuzzy label corresponding to the maximum second membership degree;

[0183] The mapping table pre-stores the regulation coefficients corresponding to different combinations of fuzzy labels. The regulation coefficients include a proportional gain regulation coefficient, an integral gain regulation coefficient, and a derivative gain regulation coefficient, aiming to adjust the parameters of the PID controller according to the fuzzy control rules.

[0184] For example, the combination of the "Positive Big" of the error mean and the "Zero" of the error change rate corresponds to a specific regulation coefficient, and these coefficients are used to adjust the control parameters.

[0185] Exemplarily, the mapping table can be the mapping relationship shown in Table 1:

[0186] Table 1 is as follows:

[0187]

[0188] Among them, in the above Table 1, K 1 represents the proportional gain regulation coefficient, K 2 represents the integral gain regulation coefficient, K 3 represents the derivative gain regulation coefficient, and so on. Among them, the above Table 1 is only for example and is not subject to any limitation.

[0189] Step 1066: Multiply the initial proportional gain by the proportional gain regulation coefficient, and add the result to the initial proportional gain to obtain the second target proportional gain in the second target control parameter;

[0190] Step 1067: Multiply the initial integral gain by the integral gain regulation coefficient, and add the result to the initial integral gain to obtain the second target integral gain in the second target control parameter;

[0191] Step 1068: Multiply the initial derivative gain by the derivative gain regulation coefficient, and add the result to the initial derivative gain to obtain the second target derivative gain in the second target control parameter.

[0192] Multiply the initial proportional gain by the proportional gain regulation coefficient, and add the result to the initial proportional gain to obtain a new proportional gain. The formula is: Second target proportional gain = initial proportional gain * proportional gain regulation coefficient + initial proportional gain.

[0193] Integral gain adjustment: Adjust the integral gain in a similar manner. Derivative gain adjustment: Adjust the derivative gain in the same way. These adjusted parameters form the second target control parameter, which are the controller parameters optimized by the fuzzy control strategy.

[0194] Finally, the adjusted control parameters (i.e., the second target control parameter) will be input into the PID controller, and the PID controller uses these new parameters to re - regulate the speed of the servo motor in order to improve the stability and performance of the system.

[0195] In this embodiment, the error mean and the error change rate are evaluated in real time through a fuzzy logic strategy, and the regulation coefficient is extracted according to the fuzzy membership degree, so that more detailed and accurate adjustment of control parameters can be realized. This technology can adaptively adjust the proportional gain, integral gain, and derivative gain of the PID controller, enabling the servo motor to maintain high-efficiency and precise control performance in complex and changing working environments. By adopting a fuzzy strategy to automatically adjust the control parameters when both the volatility index and the steady-state error do not meet the expected conditions, the ability of the system to cope with various disturbances and changes can be effectively improved. This method can automatically adjust the control strategy according to different working states, ensuring that the system still maintains good stability and accuracy under the influence of factors such as dynamic load and external interference. The present invention completely replaces the process of manually adjusting the PID control parameters through a fuzzy strategy, reducing the dependence on human experience. Through the adaptive adjustment of fuzzy logic, problems such as overshoot, undershoot, and system instability caused by improper manual adjustment can be effectively avoided, reducing the operation complexity and improving the automation level of the system. By introducing the fuzzy strategy, the present invention can dynamically adjust the control parameters according to the changes in the error mean and the error change rate of the error. By continuously optimizing the parameters of the PID controller, the control process can be smoother, reducing the oscillation or instability phenomenon caused by parameter mismatch and improving the overall stability of the system. The fuzzy tags (such as negative large, negative small, zero, positive small, positive large) in the present invention provide multiple possible regulation paths for the regulation process. Each fuzzy tag corresponds to a different control coefficient, enabling the system to flexibly adjust according to the actual working state and adapt to different load conditions and working condition changes. This fuzzy control mechanism enhances the self-adaptability of the system and avoids over-regulation or insufficient control caused by changes in working conditions.

[0196] Step 107: Input the desired speed into the PID controller with the second target control parameter, and cyclically adjust the speed of the servo motor; the second target control parameter is used to adjust the speed of the servo motor to the desired speed.

[0197] Once the first target control parameter or the second target control parameter is obtained, these new PID parameters will be input into the PID controller, and the speed regulation of the servo motor will continue until the desired speed reaches or is very close to the target.

[0198] Among them, when the steady-state error is not greater than the second threshold, the self-tuning process does not need to be executed.

[0199] In this embodiment, by collecting the error value, steady-state error, and steady-state duration during the speed regulation process of the servo motor in real time, and calculating the volatility index based on these data, the adjustment effect of the current PID controller parameters can be comprehensively evaluated. When the volatility index is less than the first threshold, a preset linear function is used to adjust the initial PID controller parameters to obtain the first target control parameters, further optimizing the regulation performance of the servo motor. When the volatility index does not meet the conditions, a fuzzy strategy is used for adaptive adjustment to obtain the second target control parameters. This adaptive adjustment strategy can flexibly respond to different working environments according to different control requirements, ensuring that the system can achieve relatively stable and accurate regulation under various working conditions. By dynamically adjusting the parameters of the PID controller in real time, the present invention can effectively cope with the influence brought by external interference or load change, reduce overshoot, undershoot and other phenomena caused by improper PID parameter setting, thereby improving the stability and response speed of the system. The calculation of the steady-state error and steady-state duration can further help to judge whether the system has reached the expected stable state, so as to achieve more accurate speed control. Through the self-tuning mechanism, the workload of manually debugging PID parameters is reduced. Especially in complex application scenarios, the efficiency and stability of the system can be significantly improved. The self-tuning method does not require manual repeated experiments and experience accumulation, thereby reducing the cost during the debugging process and improving the efficiency of system deployment.

[0200] As Figure 2 The present invention provides a servo motor speed loop self-tuning device. Please refer to Figure 2 , Figure 2 which shows a schematic diagram of a servo motor speed loop self-tuning device provided by the present invention. As Figure 2 shown, a servo motor speed loop self-tuning device includes:

[0201] An acquisition unit 21, configured to acquire a desired speed and initial control parameters of the speed loop, and input the desired speed into a PID controller with the initial control parameters to cyclically regulate the speed of the servo motor; the initial control parameters include an initial proportional gain, an initial integral gain, and an initial derivative gain of the PID controller; the initial control parameters are used to regulate the speed of the servo motor to the desired speed;

[0202] A collection unit 22, configured to collect an error value, a steady-state error, and a steady-state duration of each speed regulation during the process of cyclically regulating the speed of the servo motor based on the desired speed; the steady-state error refers to the average value between multiple current error values, and the multiple current error values refer to error values that only fluctuate within a preset fluctuation range within a preset time period, and the steady-state duration refers to the time required to reach the steady-state error;

[0203] The first calculation unit 23 is configured to calculate a volatility index corresponding to the initial control parameter according to a plurality of error values, a steady-state error, and a steady-state duration;

[0204] The second calculation unit 24 is configured to, when the volatility index is less than a first threshold and the steady-state error is greater than a second threshold, adjust the initial control parameter by using a preset linear function to obtain a first target control parameter;

[0205] The first adjustment unit 25 is configured to input the desired speed into a PID controller with the first target control parameter to cyclically adjust the speed of the servo motor; the first target control parameter is used to adjust the speed of the servo motor to the desired speed;

[0206] The third calculation unit 26 is configured to, when the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, adjust the initial control parameter by using a preset fuzzy strategy to obtain a second target control parameter;

[0207] The second adjustment unit 27 is configured to input the desired speed into a PID controller with the second target control parameter to cyclically adjust the speed of the servo motor; the second target control parameter is used to adjust the speed of the servo motor to the desired speed.

[0208] A servo motor speed loop self-tuning device provided by the present invention can comprehensively evaluate the adjustment effect of the current PID controller parameters by collecting error values, steady-state errors, and steady-state durations in real time during the speed adjustment process of the servo motor and calculating the volatility index according to these data. When the volatility index is less than the first threshold, a preset linear function is used to adjust the parameters of the initial PID controller to obtain a first target control parameter, further optimizing the adjustment performance of the servo motor. When the volatility index does not meet the conditions, a fuzzy strategy is used for adaptive adjustment to obtain a second target control parameter. This adaptive adjustment strategy can flexibly respond to different working environments according to different control requirements, ensuring that the system can achieve relatively stable and accurate adjustment under various working conditions. By dynamically adjusting the parameters of the PID controller in real time, the present invention can effectively cope with the influence brought by external interference or load changes, reduce overshoot, undershoot and other phenomena caused by improper PID parameter settings, thereby improving the stability and response speed of the system. The calculation of the steady-state error and the steady-state duration can further help to judge whether the system has reached the expected stable state, so as to achieve more accurate speed control. Through the self-tuning mechanism, the workload of manually debugging PID parameters is reduced. Especially in complex application scenarios, the efficiency and stability of the system can be significantly improved. The self-tuning method does not require manual repeated experiments and experience accumulation, thereby reducing the cost during the debugging process and improving the efficiency of system deployment.

[0209] Figure 3It is a schematic diagram of a terminal device provided by an embodiment of the present invention. As Figure 3 shown, a terminal device 3 in this embodiment includes: a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30, such as a servo motor speed loop self-tuning program. When the processor 30 executes the computer program 32, the steps in the above-mentioned embodiments of various servo motor speed loop self-tuning methods are implemented, such as Figure 1 the steps 101 to 107 shown. Alternatively, when the processor 30 executes the computer program 32, the functions of each unit in the above-mentioned device embodiments are implemented, such as Figure 2 the functions of the units shown.

[0210] Exemplarily, the computer program 32 can be divided into one or more units. The one or more units are stored in the memory 31 and executed by the processor 30 to complete the present invention. The one or more units can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program 32 in the terminal device 3. For example, the specific functions of the computer program 32 divided into each unit are as follows:

[0211] An acquisition unit, configured to acquire a desired speed and initial control parameters of a speed loop, and input the desired speed into a PID controller with the initial control parameters to cyclically adjust the speed of the servo motor; the initial control parameters include an initial proportional gain, an initial integral gain, and an initial derivative gain of the PID controller; the initial control parameters are used to adjust the speed of the servo motor to the desired speed;

[0212] A collection unit, configured to collect an error value, a steady-state error, and a steady-state duration of each speed adjustment during the process of cyclically adjusting the speed of the servo motor based on the desired speed; the steady-state error refers to the average value among multiple current error values, and the multiple current error values refer to error values that only fluctuate within a preset fluctuation range within a preset duration, and the steady-state duration refers to the duration required to reach the steady-state error;

[0213] A first calculation unit, configured to calculate a volatility index corresponding to the initial control parameters according to multiple error values, the steady-state error, and the steady-state duration;

[0214] A second calculation unit, configured to, when the volatility index is less than a first threshold and the steady-state error is greater than a second threshold, adjust the initial control parameters by using a preset linear function to obtain first target control parameters;

[0215] The first adjustment unit is configured to input the desired speed into a PID controller with the first target control parameter, and cyclically adjust the speed of the servo motor; the first target control parameter is used to adjust the speed of the servo motor to the desired speed;

[0216] The third calculation unit is configured to, when the volatility index is not less than the first threshold and the steady-state error is greater than the second threshold, adopt a preset fuzzy strategy to adjust the initial control parameter to obtain a second target control parameter;

[0217] The second adjustment unit is configured to input the desired speed into a PID controller with the second target control parameter, and cyclically adjust the speed of the servo motor; the second target control parameter is used to adjust the speed of the servo motor to the desired speed.

[0218] The terminal device includes, but is not limited to, a processor 30 and a memory 31. Those skilled in the art can understand that Figure 3 This is merely an example of a terminal device 3, and does not constitute a limitation on a terminal device 3. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the terminal device may further include input / output devices, network access devices, buses, etc.

[0219] The processor 30 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0220] The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the terminal device 3. Further, the memory 31 may also include both the internal storage unit and the external storage device of the terminal device 3. The memory 31 is used to store the computer program and other programs and data required by the roaming control device. The memory 31 may also be used to temporarily store the data that has been output or will be output.

[0221] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0222] It should be noted that the information interaction, execution process, etc. between the above devices / units, due to being based on the same concept as the method embodiments of the present invention, for their specific functions and the technical effects brought, reference may be specifically made to the method embodiment part, and details are not described herein again.

[0223] The embodiments of the present invention also provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps in the above various method embodiments can be implemented.

[0224] The embodiments of the present invention provide a computer program product, and when the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above various method embodiments when executed.

[0225] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of the present invention, a computer program can be used to instruct the relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can at least include: recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, USB flash drive, mobile hard disk, magnetic disk, or optical disc, etc.

[0226] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0227] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units. They can be located in one place or distributed to multiple network units.

[0228] It should be understood that when used in the specification and appended claims of the present invention, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0229] It should also be understood that the term "and / or" used in the specification and appended claims of the present invention refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0230] The above-described embodiments are only used to illustrate the technical solutions of the present invention, not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A servo motor speed loop self-tuning method, characterized in that: The servo motor speed loop self-tuning method comprises: Obtaining the desired speed and initial control parameters of the speed loop, and inputting the desired speed into a PID controller having the initial control parameters to cyclically adjust the servo motor speed; the initial control parameters include an initial proportional gain, an initial integral gain, and an initial differential gain of the PID controller; the initial control parameters are used to adjust the servo motor speed to the desired speed; In the process of adjusting the speed of the servo motor based on the expected speed cycle, the error value, steady-state error and steady-state duration of each speed adjustment are collected; the steady-state error refers to the average value between multiple current error values, the multiple current error values ​​refer to the error values ​​that fluctuate only within a preset fluctuation range within a preset duration, and the steady-state duration refers to the time required to reach the steady-state error; Calculating a volatility index corresponding to the initial control parameter according to a plurality of error values, a steady-state error, and a steady-state duration; When the volatility index is less than a first threshold value and the steady-state error is greater than a second threshold value, a preset linear function is used to adjust the initial control parameter to obtain a first target control parameter; Inputting the desired speed into a PID controller having the first target control parameter to cyclically adjust the servo motor speed; the first target control parameter is used to adjust the servo motor speed to the desired speed; When the volatility index is not less than a first threshold value and the steady-state error is greater than a second threshold value, a preset fuzzy strategy is adopted to adjust the initial control parameter to obtain a second target control parameter; The desired speed is input into a PID controller having the second target control parameter to cyclically adjust the servo motor speed; the second target control parameter is used to adjust the servo motor speed to the desired speed.

2. The servo motor speed loop self-tuning method according to claim 1, characterized in that: In the process of cyclically adjusting the speed of the servo motor based on the expected speed, the step of collecting the error value, the steady-state error and the steady-state duration of each speed adjustment comprises: Step A1: adjusting the servo motor speed based on the initial control parameters and collecting the actual speed; the actual speed refers to the real-time speed collected by the speed sensor; Step A2: Calculating the error value between the expected speed and the actual speed; Step A3: cyclically execute step A1 to step A2 to obtain the error value corresponding to each speed adjustment; Step A4: when a plurality of consecutive current error values ​​are less than a third threshold, taking an average value corresponding to the plurality of consecutive current error values ​​as the steady-state error; Step A5: The time between the first speed adjustment and reaching the steady-state error is taken as the steady-state time.

3. The servo motor speed loop self-tuning method according to claim 1, characterized in that: The step of calculating the volatility index corresponding to the initial control parameter according to the plurality of error values, the steady-state error and the steady-state duration comprises: Inputting a plurality of error values, steady-state errors and steady-state durations into a first function to obtain a volatility index corresponding to the initial control parameter; The first function is: Wherein, VI represents the volatility index corresponding to the initial control parameter, T ss represents the steady-state duration, ΔE(t) represents the error change rate, E(t) represents the error value at the tth moment, ∈ SS represents the steady-state error, σ E Represents the error mean of multiple error values, T max Indicates the preset upper limit of the steady-state duration.

4. The servo motor speed loop self-tuning method according to claim 1, characterized in that: When the volatility index is less than a first threshold value and the steady-state error is greater than a second threshold value, the step of using a preset linear function to adjust the initial control parameter to obtain a first target control parameter includes: When the volatility index is less than a first threshold value and the steady-state error is greater than a second threshold value, a preset step speed is obtained; the step speed is greater than the expected speed and is used to test the response of the servo motor; Inputting the step speed into a PID controller having the initial control parameters to cyclically adjust the servo motor speed; In the process of adjusting the servo motor speed based on the step speed cycle, the steady-state gain, response time and time parameter are collected; the steady-state gain refers to the ratio between the steady-state output and the step speed, which is used to indicate the sensitivity of the servo motor to the input change; the steady-state output indicates the actual output speed of the servo motor before the cycle adjustment; the response time refers to the delay time before the servo motor responds to the input step speed, and the time parameter refers to the time length for the servo motor to reach the step speed; Input the steady-state gain, the response time and the time parameter into a preset linear function to obtain a first target control parameter; the first target control parameter includes a first target proportional gain, a first target integral gain and a first target differential gain of a PID controller; The preset linear function is: Among them, K p represents the first target proportional gain, T i represents the first target integral gain, T d represents the first target differential gain, τ represents the time parameter, L represents the response time, and K represents the steady-state gain.

5. The servo motor speed loop self-tuning method according to claim 1, characterized in that: When the volatility index is not less than the first threshold value and the steady-state error is greater than the second threshold value, the step of using a preset fuzzy strategy to adjust the initial control parameter to obtain the second target control parameter includes: When the volatility index is not less than a first threshold value and the steady-state error is greater than a second threshold value, obtaining an error mean and an error change rate of a plurality of error values; the error mean is calculated based on the real-time speed and the expected speed; Calculating a first degree of membership corresponding to the error mean value in a plurality of fuzzy labels; Calculating a second degree of membership corresponding to the error change rate among a plurality of fuzzy labels; the fuzzy labels include negative large, negative small, zero, positive small, and positive large; Extracting a maximum first degree of membership from a plurality of first degrees of membership, and extracting a maximum second degree of membership from a plurality of second degrees of membership; Matching the control coefficients corresponding to the maximum first membership fuzzy label and the maximum second membership fuzzy label in a pre-stored mapping table; the control coefficients include a proportional gain control coefficient, an integral gain control coefficient, and a differential gain control coefficient; the maximum first membership fuzzy label refers to the fuzzy label corresponding to the maximum first membership; the maximum second membership fuzzy label refers to the fuzzy label corresponding to the maximum second membership; The initial proportional gain is multiplied by the proportional gain control coefficient, and the result is added to the initial proportional gain to obtain a second target proportional gain in the second target control parameter; The initial integral gain is multiplied by the integral gain control coefficient, and the result is added to the initial integral gain to obtain a second target integral gain in the second target control parameter; The initial differential gain is multiplied by the differential gain control coefficient, and the resultant is added to the initial differential gain to obtain a second target differential gain in the second target control parameter.

6. The servo motor speed loop self-tuning method according to claim 5, characterized in that: The step of calculating the first degree of membership corresponding to the error mean value in a plurality of fuzzy labels comprises: Inputting the error mean into a first function set to obtain a first degree of membership corresponding to a plurality of fuzzy labels; The first function set is: Among them, μ NB (E) represents the first degree of membership corresponding to the negative large, μ NS (E) represents the first degree of membership corresponding to the negative small, μ Z (E) represents the first degree of membership corresponding to the zero, μ PS (E) represents the first degree of membership corresponding to the positive small, μ PB (E) represents the first degree of membership corresponding to the positive value, ΔE and -ΔE represent the preset value range of the error mean, and E represents the error mean.

7. The servo motor speed loop self-tuning method according to claim 5, characterized in that: The step of calculating the second degree of membership corresponding to the error change rate in a plurality of fuzzy labels comprises: Inputting the error change rate into a second function set to obtain a second degree of membership corresponding to a plurality of fuzzy labels; The second function set is: Among them, μ NB (H) represents the second membership degree corresponding to the negative large, μ NS (H) represents the second membership degree corresponding to the negative small, μ Z (H) represents the second degree of membership corresponding to the zero, μ PS (H) represents the second membership degree corresponding to the positive small, μ PB (H) represents the second membership degree corresponding to the positive value, H represents the error change rate, and -Δ and Δ represent the value range of the error change rate.

8. A servo motor speed loop self-tuning device, characterized in that: The servo motor speed loop self-tuning device comprises: An acquisition unit is used to acquire a desired speed and initial control parameters of a speed loop, and input the desired speed into a PID controller having the initial control parameters to cyclically adjust the speed of the servo motor; the initial control parameters include an initial proportional gain, an initial integral gain, and an initial differential gain of the PID controller; the initial control parameters are used to adjust the speed of the servo motor to the desired speed; A collection unit is used to collect the error value, steady-state error and steady-state duration of each speed adjustment in the process of adjusting the speed of the servo motor based on the expected speed cycle; the steady-state error refers to the average value between multiple current error values, the multiple current error values ​​refer to the error values ​​that fluctuate only within a preset fluctuation range within a preset time, and the steady-state duration refers to the time required to reach the steady-state error; A first calculation unit, configured to calculate a volatility index corresponding to the initial control parameter according to a plurality of error values, a steady-state error and a steady-state duration; a second calculation unit, configured to adjust the initial control parameter using a preset linear function to obtain a first target control parameter when the volatility index is less than a first threshold and the steady-state error is greater than a second threshold; A first regulating unit, configured to input the desired speed into a PID controller having the first target control parameter, and cyclically regulate the speed of the servo motor; the first target control parameter is used to regulate the speed of the servo motor to the desired speed; a third calculation unit, configured to, when the volatility index is not less than the first threshold value and the steady-state error is greater than the second threshold value, use a preset fuzzy strategy to adjust the initial control parameter to obtain a second target control parameter; The second regulating unit is used to input the desired speed into a PID controller having the second target control parameter to cyclically regulate the servo motor speed; the second target control parameter is used to regulate the servo motor speed to the desired speed.

9. A terminal device, characterized in that: The terminal device includes: a memory, a processor, and a servo motor speed loop self-tuning program stored in the memory and executable on the processor, wherein the servo motor speed loop self-tuning program is configured to implement the steps in the servo motor speed loop self-tuning method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the servo motor speed loop self-tuning method as claimed in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Control method of frameless servo motor

    CN120613968A

  • Vehicle door control method and device

    CN121618917A

  • A control method and device for a vehicle door

    CN121618917B