PID controller self-tuning method combining tuning parameters with gradient descent
By combining the method of adjusting the participating gradient descent, the PID controller is automatically adjusted, and the problem of high resource consumption and easy to fall into local convergence in the prior art is solved, and efficient and accurate PID controller parameter tuning is achieved.
Patent Information
- Application Number
- CN202510089169.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-01-21
AI Technical Summary
The existing PID controller parameter tuning methods have problems such as high calculation and storage resources, easy to fall into local convergence, difficult to take into account both parameter scale and fitting capabilities, and manual parameter adjustment is time-consuming and labor-intensive, and the effect is not good.
The PID controller self-tuning method combined with the adjustment of the gradient descent is adopted. By setting the initial parameter value, the sampling rules are used to obtain the sample value, the cost function is calculated, the sampling step is adjusted, and the parameter value is updated based on the Adam optimization algorithm until the iteration stop condition is met.
It realizes the self-tuning of the PID controller, improves the setting speed and accuracy, avoids local convergence and resource consumption problems, is not affected by individual differences between the system and the PID controller, and is suitable for all types of systems.
Smart Images

Figure CN119535953B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of PID control, in particular to a PID controller self-tuning method combining a tuning parameter with a gradient descent. Background Art
[0002] Currently, the commonly used PID controller parameter tuning methods are manual tuning and machine tuning. Manual tuning is to use experience to tune parameters, while machine tuning generally extracts the open-loop transfer function through system identification, and then sets parameters to achieve the expected damping ratio; or tunes parameters by training a neural network.
[0003] In the scenario where a large number of PID controllers need to be tuned, each PID controller has individual differences. If machine tuning based on neural networks is used, model training needs to be performed separately according to different individual differences. The process is cumbersome and this method is prone to local convergence and consumes a lot of computing and storage resources. It is difficult to balance parameter scale and fitting capabilities. More often, it is necessary to sacrifice more real-time performance in exchange for improved accuracy. Therefore, this method can provide guidance for parameter tuning, but it cannot completely replace the motion laws of actual objects, so it cannot achieve the expected results. If manual tuning is used, it is time-consuming and labor-intensive. If unified parameters are used for setting in the process, insufficient accuracy may result. If the accuracy reaches a certain level, the human eye's ability to observe the effect or analyze the curve is often not as good as the PID controller's performance in terms of accuracy and consistency. Therefore, the adjustment progress is slow or the expected effect cannot be achieved.
[0004] The existing public patent document 1, with the publication number CN119002236A, discloses a fractional-order PID controller and parameter tuning method based on KAN, which relates to the field of PID control technology, including: step 1, determining the structure of two KAN sub-networks and initializing the network, the two KAN sub-networks are the tuning network KAN1 and the identification network KAN2; step 2, sampling to obtain the actual output of the controlled object, and comparing it with the target output to calculate the error; step 3, inputting the actual output, the target output, and the error into KAN1, and KAN1 outputs five adjustable parameters of the fractional-order PID controller; step 4, calculating the control output of the fractional-order PID controller, and inputting it to the controlled object; step 5, KAN1 and KAN2 adjust the activation functions of different nodes to realize the adaptive tuning of the fractional-order PID controller; step 6, sampling the next time and returning to step 2; step 7, pruning KAN1 and KAN2.
[0005] The existing public patent document 2, with the publication number of CN118859686A, discloses a feedforward adaptive PID control optimization method, which belongs to the field of PID control optimization technology, and the specific steps are: step 1, constructing a feedforward adaptive PID control model; step 2, improving the Arctic puffin optimization algorithm, and the improvement strategy is: D1, using the Circle chaos mapping strategy fused with Latin hypercube to generate the initial population; D2, using an adaptive nonlinear search adjustment strategy to improve the mathematical model of the diving predation stage; D3, using a bidirectional elite perturbation strategy to improve the mathematical model of the collection and foraging stage; step 3, using the improved Arctic puffin optimization algorithm to adjust the parameters of the PID controller module in the feedforward adaptive PID control model, and obtaining the optimal Kp, Ki, Kd parameters through optimization; step 4, inputting the obtained optimal Kp, Ki, Kd parameters into the feedforward adaptive PID control model to optimize the control effect. Summary of the invention
[0006] The present invention provides a PID controller self-tuning method combining parameter adjustment and gradient descent, which overcomes the shortcomings of the above-mentioned prior art and can effectively solve the problems of the existing machine parameter adjustment method for training neural networks, which requires a large amount of computing and storage resources and has poor convergence effect.
[0007] One of the technical solutions of the present invention is achieved by the following measures: a PID controller self-tuning method combined with gradient descent, comprising:
[0008] The initial values of the parameters of the PID controller are used as reference values of the parameters, and two sampling values corresponding to each reference value are obtained according to a sampling rule, wherein the sampling rule includes determining a sampling step of the parameter, and starting from the reference value, obtaining two corresponding sampling values in the direction of increasing and decreasing a sampling step respectively;
[0009] Determine whether the cost of each sample value is greater than or equal to the cost of the corresponding reference value, wherein the cost is obtained based on the cost function;
[0010] In response to this, the sampling step size is reduced, and two sampling points corresponding to each reference value are obtained again according to the sampling rule;
[0011] If the response is no, the gradient of each parameter is determined, and the updated value of each parameter is determined based on the Adam optimization algorithm, and the updated value of each parameter is output when the iteration stop condition is met. Otherwise, the value with the smallest cost among the updated value, reference value and sampling value of each parameter is used as the new reference value, and two sampling values corresponding to each reference value are obtained according to the sampling rules.
[0012] The following are further optimizations and / or improvements to the above technical solutions:
[0013] When the iteration stop condition is met, the updated value of each parameter is output. Otherwise, the updated value, reference value, and sampled value of each parameter with the lowest cost is used as the new reference value, including:
[0014] Determining a cost of updating a value of a parameter, wherein the cost is obtained based on a cost function;
[0015] Determine whether the cost of the updated value is less than the minimum cost in the last sampling data, where the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling;
[0016] In response to yes, the updated value of the parameter is used as a new reference value, and it is determined whether the new reference value satisfies the iteration stop condition. If so, the updated value of the parameter is output. If not, two sampling values corresponding to the new reference value are obtained according to the sampling rule.
[0017] In response to no, the value with the minimum cost is selected from the current reference value and the sampled value of the parameter as the new reference value;
[0018] Repeat the above steps to iterate over each parameter.
[0019] The above cost function includes:
[0020] The system equilibrium point is a stable equilibrium point, and the cost function is as follows:
[0021]
[0022] in, After the target step real-time value reaches the target value for the first time The average value of After the target step real-time value reaches the target value for the first time The maximum value of After the target step real-time value reaches the target value for the first time The average value of is the waveform oscillation frequency; is the waveform oscillation amplitude; is the convergence trend of the waveform; It is the time taken for the real-time value to reach the target value for the first time after the target step; 、 、 、 、 、 All are weight values;
[0023] If the system equilibrium point is an unstable equilibrium point, the cost function is as follows:
[0024]
[0025] in, After the target step real-time value reaches the target value for the first time The average value of After the target step real-time value reaches the target value for the first time The maximum value of After the target step real-time value reaches the target value for the first time The average value of is the waveform oscillation frequency; is the waveform oscillation amplitude; is the convergence trend of the waveform; All are weight values.
[0026] The process of determining the initial values of the parameters of the above PID controller includes:
[0027] The order of magnitude of each parameter was determined using a logarithmic scale random search method;
[0028] Set the proportional factor, and determine the first value of each parameter by making detailed adjustments to each parameter;
[0029] Determine the initial value of each parameter based on its magnitude and first value.
[0030] The above determination of the gradients of various parameters includes:
[0031]
[0032] in, is the scale parameter P The sampling step length; is the integration parameter I The sampling step length; is the differential parameter D The sampling step length; 、 The scale parameters are P The cost of two sample values of ; 、 The integration parameters are I The cost of two sample values of ; 、 is the differential parameter D The cost of two sample values.
[0033] The above-mentioned Adam optimization algorithm is used to determine the updated values of various parameters, including:
[0034] Determine the first and second moments corresponding to the gradient of a parameter;
[0035] Determining bias correction values of the first-order moment and the second-order moment based on the first-order moment and the second-order moment;
[0036] Correcting the reference value of the parameter using the deviation correction value to obtain a corresponding updated value;
[0037]
[0038] in, is the updated value of the parameter; is the reference value of the parameter; is the learning rate; is the deviation correction value of the first-order moment; is the bias correction value of the second-order moment; is a constant;
[0039] Repeat the above steps to determine the updated value of each parameter.
[0040] The above iteration stop conditions include:
[0041] The difference between the cost of the updated value of the parameter and the minimum cost in the last sampling data is less than the difference threshold, wherein the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling;
[0042] or,
[0043] The cost of updating the parameter value is less than or equal to the cost threshold.
[0044] The present invention realizes the self-tuning of the PID controller. Compared with the manual parameter adjustment method, it frees up human labor and improves the adjustment speed and accuracy. Compared with the existing machine parameter adjustment methods using genetic algorithms, random parallel gradient descent methods, particle swarm algorithms, ant colony algorithms and other algorithms, it is not easy to fall into local convergence and consume a large amount of computing and storage resources. Specifically, by setting the initial values of each parameter of the PID controller, the time added from the random starting point is reduced. By calculating and judging the cost, the sampling step size can be automatically adjusted to improve the convergence accuracy. By introducing the Adam optimization algorithm to determine the update value of each parameter, the landing direction of each parameter is determined to improve the convergence effect. Further, the PID controller self-tuning method combined with the adjustment parameter and gradient descent disclosed in the embodiment of the present invention is not affected by the individual differences of various systems and PID controllers, and can be effectively applied to various systems and PID controllers. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] AttachedFigure 1 A schematic flow chart of a PID controller self-tuning method provided by one embodiment of the present invention.
[0046] Attached Figure 2 A schematic flow chart of a method for determining an initial value of a parameter provided by an embodiment of the present invention.
[0047] Attached Figure 3 A schematic diagram of a target function waveform provided for an embodiment of the present invention.
[0048] Attached Figure 4 A schematic flow chart of a method for determining an updated value of a parameter provided by an embodiment of the present invention.
[0049] Attached Figure 5 A schematic flow chart of a reference value updating method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The present invention is not limited by the following embodiments, and specific implementation methods can be determined based on the technical solution of the present invention and actual conditions.
[0051] Before explaining the embodiments of the present invention in detail, the terms involved in the embodiments of the present invention are explained first:
[0052] PID controller (Proportion Integration Differentiation) is an automatic controller, which consists of a proportional unit (P), an integral unit (I) and a differential unit (D). By setting the proportional parameter, integral parameter and differential parameter, PID controller is widely used in industrial control, especially in linear systems whose dynamic characteristics do not change with time. Its working principle is to calculate the control quantity by measuring the error between the actual output value and the expected output value of the system, and then adjust the input quantity of the system to make the system reach a stable state by using the three parameters of proportional, integral and differential.
[0053] Proportional parameter: The proportional parameter is used to eliminate static error, that is, to compensate for the error size, and determines the degree to which the controller amplifies the deviation; a larger proportional parameter will make the system respond faster, but may cause system oscillation, while a smaller proportional parameter will make the system respond slower, but have better stability.
[0054] Integral parameter: The integral parameter is set to eliminate the static error of the system, that is, the duration of the compensation error; the longer the integral time, the weaker the integral effect, and the slower the system's cumulative effect on the deviation; the shorter the integral time, the stronger the integral effect, and the faster the system's cumulative effect on the deviation.
[0055] Differential parameter: It is used to overcome the hysteresis problem of the system, that is, to compensate for the error change rate and improve the response speed and stability of the system; the longer the differential time, the stronger the differential effect, the faster the system responds to changes, but the sensitivity to noise also increases. The selection of differential time needs to be adjusted according to the dynamic characteristics of the system to achieve the best dynamic response effect.
[0056] The comprehensive adjustment of the three parameters can make the system reach the desired state quickly and stably, and has good robustness and adaptability.
[0057] The technical solution of the present invention will be introduced and explained below with reference to several examples.
[0058] Embodiment 1: As attached Figure 1 As shown, an embodiment of the present invention discloses a PID controller self-tuning method combining a tuning parameter with a gradient descent, comprising:
[0059] Step S110, taking the initial values of the parameters of the PID controller as the reference values of the parameters, and obtaining two sampling values corresponding to each reference value according to the sampling rule, wherein the sampling rule includes determining the sampling step of the parameter, starting from the reference value, respectively obtaining the corresponding two sampling values in the direction of increasing and decreasing a sampling step.
[0060] Specifically, when setting the initial values of various parameters of the PID controller, it can be, but is not limited to, setting them based on the characteristics of the controlled system or using the experience of manual parameter adjustment, such as setting the proportional parameter to a smaller value, the integral parameter to a relatively large value, and the differential parameter to 0.
[0061] Specifically, the sampling rule includes determining the sampling step of the parameter, starting from the reference value, and obtaining the corresponding two sampling values in the direction of increasing and decreasing one sampling step respectively. If the sampling step is too long, the system will respond slowly, and if it is too short, it will cause oscillation and instability. Therefore, the sampling step needs to be set reasonably. The specific setting method can be, but is not limited to, determining the minimum sampling time according to the system's requirements for response speed, considering other limiting factors of the system, such as computing resources, accuracy requirements, etc., and setting after observing the system behavior using an oscilloscope or other measurement tools.
[0062] In this step, according to the sampling rules, a sampling step is added or subtracted for each parameter based on its reference value to form positive and negative sampling points, that is, two sampling values are obtained, and a total of six sampling values for the three parameters. It should be noted that the parameter range limit here cannot be negative.
[0063] Step S120 , determining whether the cost of each sampling value is greater than or equal to the cost of the corresponding reference value, wherein the cost is obtained based on a cost function.
[0064] Specifically, the cost function is used to measure the implementation effect of the current value of each parameter of the PID controller. It can be obtained by obtaining the consumption cost and the consumption cost of the waveform in the response process within the system and setting corresponding weights for each consumption cost. The consumption cost here is referred to as cost in the present invention.
[0065] It should also be noted that judging whether the cost of each sampling value is greater than or equal to the cost of the corresponding reference value means judging whether the costs of the six sampling values are greater than or equal to the costs of the corresponding reference values.
[0066] Step S130: In response to yes, the sampling step length is reduced, and two sampling points corresponding to each reference value are obtained again according to the sampling rule.
[0067] Specifically, if the cost of each sampling value is greater than or equal to the cost of the corresponding reference value, it means that the sampling step may be too large. If the sampling step is too large, the subsequent Adam optimization algorithm will jump too much and miss the local area of the optimal solution. Therefore, when the cost of each sampling value is greater than or equal to the cost of the corresponding reference value, it is necessary to return to step S110, reduce the sampling step, and re-obtain two sampling points corresponding to each reference value according to the sampling rule, so as to facilitate more detailed exploration of the solution space, gradually approach the optimal solution, and improve the convergence accuracy. It should be noted that the reduction in the sampling step can be set as needed.
[0068] Step S140, if the response is no, then determine the gradient of each parameter, and determine the updated value of each parameter based on the Adam optimization algorithm, and output the current updated value of each parameter when the iteration stop condition is met. Otherwise, use the updated value, reference value, and sampling value of each parameter with the lowest cost as the new reference value, and obtain two sampling values corresponding to each reference value according to the sampling rule.
[0069] The Adam optimization algorithm can be seen as a combination of Momentum and RMSprop. Like Momentum, it can maintain the moving average of the gradient to help the model converge quickly in the right direction. At the same time, like RMSprop, it can handle noise and sparse gradient problems by adjusting the learning rate. In the embodiment of the present invention, the update value of each parameter is determined based on the Adam optimization algorithm, that is, the landing direction of each parameter is determined, so that the convergence effect can be achieved faster.
[0070] The embodiment of the present invention discloses a PID controller self-tuning method combining tuning parameters with gradient descent, which realizes the self-tuning of the PID controller. Compared with the manual tuning method, it frees up human labor, improves the tuning speed and accuracy, and is not easy to fall into local convergence and consume a large amount of computing and storage resources compared with the existing machine tuning methods using genetic algorithms, random parallel gradient descent methods, particle swarm algorithms, ant colony algorithms, etc. Specifically, by setting the initial values of each parameter of the PID controller, the time added from the random starting point is reduced, and the sampling step size can be automatically adjusted by calculating and judging the cost to improve the convergence accuracy. By introducing the Adam optimization algorithm to determine the update value of each parameter, the landing direction of each parameter is determined to improve the convergence effect. Further, the PID controller self-tuning method combined with the tuning parameters gradient descent disclosed in the embodiment of the present invention is not affected by the individual differences of various systems and PID controllers, and can be effectively applied to various systems and PID controllers.
[0071] Embodiment 2: As attached Figure 2 As shown, the embodiment of the present invention is a further optimization of the above embodiment, wherein the process of determining the initial values of various parameters of the PID controller includes:
[0072] Step S210, determining the order of magnitude of each parameter using a logarithmic scale random search method.
[0073] Specifically, the range of each parameter is determined and the logarithmic scale random search method is used to find the optimal value according to 10 n The power form of is sampled and searched to determine the order of magnitude n of each parameter.
[0074] Step S220, setting the proportional factor, and determining the first value of each parameter by making detailed adjustments to each parameter.
[0075] Step S230, determining the initial value of each parameter in combination with the order of magnitude and the first digit of each parameter.
[0076] It should be noted that the sampling step size of the sampling search can be set to 5 * 10 (n-1) , to ensure that the optimal parameter value is gradually searched within a suitable range.
[0077] The embodiment of the present invention determines the initial value of each parameter based on the experience of manually adjusting the parameters in combination with a logarithmic scale random search method, thereby reducing the time consumption added from a random starting point.
[0078] Embodiment 3: The embodiment of the present invention is a further optimization of the above embodiment, wherein the cost function includes:
[0079] (I) If the system equilibrium point is a stable equilibrium point, the cost function is as follows:
[0080]
[0081] in, After the target step real-time value reaches the target value for the first time The average value of After the target step real-time value reaches the target value for the first time The maximum value of After the target step real-time value reaches the target value for the first time The average value of is the waveform oscillation frequency; is the waveform oscillation amplitude; is the convergence trend of the waveform; It is the time taken for the real-time value to reach the target value for the first time after the target step, that is, the corresponding duration; They are all weight values, and the sum of all weight values is 1.
[0082] The cost function includes , corresponding to the consumption cost in the response process (referred to as cost in this invention). and Often used to describe the performance indicators of the system response process. It can amplify larger error values more effectively, so it is better than the simple error mean in the design of the cost function. Its sensitivity to larger errors helps to suppress larger deviations more quickly during the optimization process, thereby pushing the system toward a state with lower errors.
[0083] The cost function , the consumption cost of the corresponding waveform (referred to as cost in the present invention). The investigation of the waveform frequency domain is added, and the frequency of the fluctuation is multiplied by the amplitude of the fluctuation, which helps to amplify the influence of the high-frequency components in the system, especially in the case of high-frequency oscillation or divergent behavior. This method effectively increases the cost of the high-frequency oscillation part, prompting the system to approach the lower frequency and smaller amplitude area, thereby achieving the improvement of system stability or the low frequency of the spectrum. This process is manifested in the frequency domain as the dynamic behavior of the system gradually converges to the low-frequency area, reducing high-frequency noise and instability, and optimizing the convergence and steady-state response of the system.
[0084] Above ,Right now is the difference between the target value and the real-time value after the target step, where is the real-time value after the target step, is the target value, calculate The objective function is as follows:
[0085]
[0086] in , is the target waveform amplitude; is the target base value; is a single sampling period; is a step signal.
[0087] The target function produces two step changes in one sampling period, and the function shape is a square wave, as shown in the attached figure. Figure 3 shown.
[0088] After the system reaches a stable equilibrium point, under a certain range of parameter conditions, the system fluctuates less near the steady-state target point. Therefore, in addition to paying attention to the steady-state error of the target point, it is also necessary to consider the dynamic characteristics of the response process, especially the oscillation amplitude and convergence speed of the response curve. Therefore, it is necessary to introduce a step input as the target signal in order to more comprehensively evaluate the time domain response performance of the system.
[0089] (ii) If the system equilibrium point is an unstable equilibrium point, the cost function is as follows:
[0090]
[0091] in, After the target step real-time value reaches the target value for the first time The average value of After the target step real-time value reaches the target value for the first time The maximum value of After the target step real-time value reaches the target value for the first time The average value of is the waveform oscillation frequency; is the waveform oscillation amplitude; is the convergence trend of the waveform; All are weight values.
[0092] Above ,Right now is the difference between the target value and the real-time value after the target step, where is the real-time value after the target step, is the target value, calculate The objective function is as follows:
[0093]
[0094] Here, the objective function is a constant. The purpose of this is to eliminate the influence of external disturbances and evaluate the stability and robustness of the control algorithm by observing the response of the system. The state variables of the system (such as angle, angular velocity, etc.) will be affected by small disturbances when approaching the equilibrium point, resulting in changes in the dynamic response of the system. By setting the objective function as a constant, we can focus on analyzing the transient response and steady-state behavior of the system under different initial conditions, thereby providing a basis for further adjusting the PID controller parameters or designing more complex adaptive control strategies. This method can effectively avoid the complex dynamic behavior in the unstable area and highlight the essential response characteristics of the system when approaching the equilibrium point.
[0095] Embodiment 4: The embodiment of the present invention is a further optimization of the above embodiment, wherein the gradient of each parameter is determined, and the update value of each parameter is determined based on the Adam optimization algorithm, and the current update value of each parameter is output when the iteration stop condition is met, otherwise the value with the minimum cost among the update value, reference value and sampling value of each parameter is used as the new reference value, and two sampling values corresponding to each reference value are obtained according to the sampling rule, including:
[0096] (1) Determine the gradient of each parameter, including:
[0097]
[0098] in, is the scale parameter P The sampling step length; is the integration parameter I The sampling step length; is the differential parameter D The sampling step length; 、 The scale parameters are P The cost of two sample values of ; 、 The integration parameters are I The cost of two sample values of ; 、 is the differential parameter D The cost of two sample values.
[0099] (2) As attached Figure 4 As shown, the update values of various parameters are determined based on the Adam optimization algorithm, including:
[0100] Step S310, determining the first-order moment and the second-order moment corresponding to the gradient of a certain parameter;
[0101]
[0102] in, is the first moment of a parameter, is the second moment of a parameter, is the gradient of a parameter, for The square of That is, any parameter among the proportional parameter, integral parameter, and differential parameter; , are constants, Usually set to 0.9, Usually set to 0.99;
[0103] Step S320, determining deviation correction values of the first-order moment and the second-order moment based on the first-order moment and the second-order moment;
[0104]
[0105] in, is the deviation correction value of the first-order moment of a parameter; is the deviation correction value of the second-order moment of a parameter; is the first moment of a parameter; is the second moment of a parameter; 、 are constants, Usually set to 0.9, Usually set to 0.999; is the number of steps of the current iteration;
[0106] Step S330, correcting the reference value of the parameter using the deviation correction value to obtain a corresponding updated value;
[0107]
[0108] in, is the updated value of the parameter; is the reference value of the parameter; is the learning rate; is the deviation correction value of the first-order moment of a parameter; is the deviation correction value of the second-order moment of a parameter; is a constant, which is a very small constant added to prevent division by zero errors.
[0109] Step S340, repeat the above steps to determine the updated value of each parameter.
[0110] (3) After determining the gradient of each parameter and determining the updated value of each parameter based on the Adam optimization algorithm, it is necessary to determine whether the updated value of each parameter meets the iteration stop condition. If the iteration stop condition is met, the updated value of each parameter is output. Otherwise, the value with the lowest cost among the updated value, reference value, and sampling value of each parameter is used as the new reference value, and two sampling values corresponding to each reference value are obtained according to the sampling rules.
[0111] Take any parameter as an example to explain the steps. Figure 5 As shown, it is determined whether the iteration stop condition is met. If the iteration stop condition is met, the updated value of each parameter is output. Otherwise, the updated value, reference value, and sampled value of each parameter with the minimum cost are used as the new reference value, including:
[0112] Step S410, determining the cost of updating the parameter value, wherein the cost is obtained based on a cost function;
[0113] Step S420, determine the cost of updating the value Is it less than the minimum cost in the last sampling data? , where the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling;
[0114] Step S430, in response to yes, the updated value of the parameter is used as a new reference value, and it is determined whether the new reference value satisfies the iteration stop condition. If so, the updated value of the parameter is output. If not, two sampling values corresponding to the new reference value are obtained according to the sampling rule.
[0115] The cost of the above updated value Less than the minimum cost in the sampled data , it means that the new parameter optimization is effective and can reduce the system error, thereby improving the performance of the PID controller.
[0116] The above iteration stop conditions include:
[0117] The difference between the cost of the updated value of the parameter and the minimum cost in the last sampling data is less than the difference threshold, wherein the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling;
[0118] or,
[0119] The cost of updating the parameter value is less than or equal to the cost threshold.
[0120] The settings of the difference threshold and the cost threshold are determined according to the required update accuracy.
[0121] Step S440: If the response is no, then the value with the minimum cost is selected from the current reference value and the sampled value of the parameter as the new reference value.
[0122] It should be noted that in the process of step (3), the processes of executing steps S410 to S440 for each parameter can be independent of each other and executed separately. In this process, if one or two parameters meet the iteration stop condition and the setting is completed, the remaining parameters can continue to be polarity sampled and iterated until the iteration stop condition is met.
[0123] The above content is only a specific implementation mode of the present invention, which has strong adaptability and implementation effect, but the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope covered by the present invention.
Claims
1. A PID controller self-tuning method combining adjustment parameter and gradient descent, characterized in that: include: The initial values of the parameters of the PID controller are used as reference values of the parameters, and two sampling values corresponding to each reference value are obtained according to a sampling rule, wherein the sampling rule includes determining a sampling step of the parameter, and starting from the reference value, obtaining two corresponding sampling values in the direction of increasing and decreasing a sampling step respectively; Determine whether the cost of each sample value is greater than or equal to the cost of the corresponding reference value, wherein the cost is obtained based on the cost function; In response to this, the sampling step size is reduced, and two sampling points corresponding to each reference value are obtained again according to the sampling rule; If the response is no, the gradient of each parameter is determined, and the updated value of each parameter is determined based on the Adam optimization algorithm, and the updated value of each parameter is output when the iteration stop condition is met. Otherwise, the value with the minimum cost among the updated value, reference value and sampled value of each parameter is used as the new reference value, and two sampled values corresponding to each reference value are obtained according to the sampling rule; Among them, the cost function includes: The system equilibrium point is a stable equilibrium point, and the cost function is as follows: If the system equilibrium point is an unstable equilibrium point, the cost function is as follows: in, After the target step real-time value reaches the target value for the first time The average value of After the target step real-time value reaches the target value for the first time The maximum value of After the target step real-time value reaches the target value for the first time The average value of is the waveform oscillation frequency; is the waveform oscillation amplitude; is the convergence trend of the waveform; It is the time taken for the real-time value to reach the target value for the first time after the target step; All are weight values; Among them, the update value of each parameter is determined based on the Adam optimization algorithm, including: Determine the first and second moments corresponding to the gradient of a parameter; Determining bias correction values of the first-order moment and the second-order moment based on the first-order moment and the second-order moment; Correcting the reference value of the parameter using the deviation correction value to obtain a corresponding updated value; in, is the updated value of the parameter; is the reference value of the parameter; is the learning rate; is the deviation correction value of the first-order moment; is the bias correction value of the second-order moment; is a constant; Repeat the above steps to determine the updated value of each parameter.
2. The PID controller self-tuning method combining adjustment parameter and gradient descent according to claim 1 is characterized in that: The method outputs the updated value of each parameter when the iteration stop condition is met, and otherwise uses the updated value, reference value, and sampled value of each parameter with the minimum cost as the new reference value, including: Determining a cost of updating a value of a parameter, wherein the cost is obtained based on a cost function; Determine whether the cost of the updated value is less than the minimum cost in the last sampling data, where the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling; In response to yes, the updated value of the parameter is used as a new reference value, and it is determined whether the new reference value satisfies the iteration stop condition. If so, the updated value of the parameter is output. If not, two sampling values corresponding to the new reference value are obtained according to the sampling rule. In response to no, the value with the minimum cost is selected from the current reference value and the sampled value of the parameter as the new reference value; Repeat the above steps to iterate over each parameter.
3. The PID controller self-tuning method combining adjustment parameter and gradient descent according to claim 1 or 2, characterized in that: The process of determining the initial values of the various parameters of the PID controller includes: The order of magnitude of each parameter was determined using a logarithmic scale random search method; Set the proportional factor, and determine the first value of each parameter by making detailed adjustments to each parameter; Determine the initial value of each parameter based on its magnitude and first value.
4. The PID controller self-tuning method combining adjustment parameter and gradient descent according to claim 1 or 2, characterized in that: Determining the gradient of each parameter includes: in, is the scale parameter P The sampling step length; is the integration parameter I The sampling step length; is the differential parameter D The sampling step length; The scale parameters are P The cost of two sample values of ; The integration parameters are I The cost of two sample values of ; is the differential parameter D The cost of two sample values.
5. The PID controller self-tuning method combining adjustment parameter and gradient descent according to claim 3 is characterized in that: Determining the gradient of each parameter includes: in, is the sampling step of the proportional parameter P; is the integration parameter I The sampling step length; is the differential parameter D The sampling step length; The scale parameters are P The cost of two sample values of ; The integration parameters are I The cost of two sample values of ; is the differential parameter D The cost of two sample values.
6. The PID controller self-tuning method combining adjustment parameter and gradient descent according to claim 1, 2 or 5, characterized in that: The iteration stop condition includes: The difference between the cost of the updated value of the parameter and the minimum cost in the last sampling data is less than the difference threshold, wherein the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling; or, The cost of updating the parameter value is less than or equal to the cost threshold.
7. The PID controller self-tuning method combining adjustment parameter and gradient descent according to claim 3, characterized in that: The iteration stop condition includes: The difference between the cost of the updated value of the parameter and the minimum cost in the last sampling data is less than the difference threshold, wherein the minimum cost in the last sampling data is the minimum cost between the reference value and the sampling value of the parameter in the last sampling; or, The cost of updating the parameter value is less than or equal to the cost threshold.
Citation Information
Patent Citations
Feed-forward type self-adaptive PID (Proportion Integration Differentiation) control optimization method
CN118859686A
Fractional order PID controller based on KAN and parameter setting method
CN119002236A
PID controller parameter setting method based on neural network
CN109459927A
PID parameter setting method, device and system and readable storage medium
CN110308658A