PID control method based on PNGAPSO
By introducing gradient descent factor and inertial weight factor into the PSO algorithm, the velocity update of particles is improved, and combined with hyperbolic tangent function and greedy probability, the problem of insufficient stability of the PID controller is solved, achieving higher control accuracy and stability.
Patent Information
- Application Number
- CN202510527577.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-01
AI Technical Summary
The existing PID controllers have insufficient stability in parameter setting, which is easy to fall into the problem of local optimal solutions.
The PID control method based on PNGAPSO is adopted, and the learning factors of gradient descent factors, inertia weight factors and asynchronous change are added to the PSO algorithm to improve the velocity update of particles, and the hyperbolic tangent function and greed probability are introduced to improve the algorithm's global search ability.
The stability and convergence accuracy of the PID controller are improved, avoiding falling into local optimal solutions, and achieving faster convergence speed and higher control accuracy.
Smart Images

Figure CN120406089A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PID control, and particularly to a PID control method based on PNGAPSO. Background Art
[0002] Industrial control systems include: temperature control systems, pressure control systems, flow control systems, speed and position control, automotive and traffic control, etc. How to improve system stability is an urgent problem to be solved;
[0003] The PID controller is a feedback control algorithm widely used in industrial control systems. By adjusting the control output in real time, the actual output of the system (such as temperature, speed, pressure, etc.) can be made as close as possible to the target value. In the prior art, the parameter tuning of the PID controller relies on the empirical method to adjust the parameters to ensure the stability of the system;
[0004] In the patent with the publication number CN111221245A, a discrete PID control algorithm is selected; a fuzzy control regulation for setting the adjustment factor is set, and the particle swarm optimization algorithm is used to optimize the adjustment factor; the global optimal position is obtained, and the corresponding PID value is obtained; the PSO algorithm is combined with the traditional fuzzy PID algorithm and applied to the tension control system of the stenter; a fuzzy rule with a correction factor is established to obtain the optimal fuzzy rule; the PSO algorithm is used to optimize the correction factor in the fuzzy rule, and then the optimal fuzzy rule is obtained. Although this method improves the control accuracy to a certain extent, the design of the fuzzy rule base is complex and relies on experience; the computational complexity is large and the real-time performance is limited; the parameter tuning is still not fully adaptive and there are problems with insufficient stability. Summary of the Invention
[0005] Aiming at the deficiencies of the existing methods, the present invention solves the problems of insufficient stability and easy to fall into local optimal solutions when the PSO algorithm is used to tune the PID controller.
[0006] The technical solution adopted by the present invention is: a PID control method based on PNGAPSO includes the following steps:
[0007] Step 1: Construct a model of the controlled object;
[0008] As a preferred embodiment of the present invention, the controlled object includes: robots, computer room fans, new energy vehicles.
[0009] Step 2: The PNGAPSO algorithm adds a gradient descent factor when updating the particle velocity of the PSO algorithm, and introduces an inertia weight factor and an asynchronous change learning factor to improve the particle velocity update;
[0010] As a preferred embodiment of the present invention, the formula for updating the particle velocity is:
[0011] v ij (t + 1)= w Lin W vij (t)+ c Asy1 r1[f pi (t) / (10f i (t))][p ij (t)- x ij (t)]+ c Asy2 r2[f i (t) / (10f g (t))][p gj (t)- x ij (t)]
[0012] Among them, v ij (t) is the j - dimensional velocity component of the i - th particle at the t - th iteration; x ij (t) is the j - dimensional position component of the i - th particle at the t - th iteration; r1, r2 are random numbers between 0 and 1; p ij (t) is the j - dimensional historical best position component of the i - th particle at the t - th iteration; p gj (t) is the j - dimensional global best position component of the particles in the particle swarm at the t - th iteration; f pi (t) is the current individual fitness of the i - th particle at the t - th iteration; f i (t) is the individual historical best value of the i - th particle at the t - th iteration; f g (t) is the group historical best value at the t - th iteration; w LinW is the inertia weight factor; c Asy1 、c Asy2 are the learning factors respectively.
[0013] As a preferred embodiment of the present invention, the formula for the inertia weight factor is:
[0014]
[0015] Among them, w max and w min represent the maximum value and the minimum value of w LinW respectively; when w max = 0.9, w min = 0.4, the effect is optimal, t is the current iteration number, t max is the maximum iteration number.
[0016] As a preferred embodiment of the present invention, the formula for the learning factor is:
[0017]
[0018] Among them, c ini1 and c ini2 respectively represent the initial values of c Asy1 and c Asy2 ; c fin1 and c fin2 respectively represent the iteration final values of c Asy1 and c Asy2 .
[0019] As a preferred embodiment of the present invention, it further includes: improving the particle position update based on the hyperbolic tangent function, and the formula is:
[0020] x ij (t + 1) = x ij (t) + ηv ij (t + 1) (6)
[0021] Among them, η is an adaptive adjustment coefficient.
[0022] As a preferred embodiment of the present invention, the formula of the adaptive adjustment coefficient is:
[0023]
[0024] In the formula, t is the number of iterations, and t max is the maximum number of iterations.
[0025] As a preferred embodiment of the present invention, a greedy probability is introduced to increase the randomness of particle search.
[0026] Step 3: Use the PNGAPSO algorithm to tune the PID control parameters, with the performance index function as the fitness function; take it as the solution and solve the optimal parameters through iteration;
[0027] As a preferred embodiment of the present invention, the performance index function is IAE.
[0028] As a preferred embodiment of the present invention, the PID control system based on PNGAPSO includes: a memory for storing instructions executable by a processor; a processor for executing the instructions to implement the PID control method based on PNGAPSO.
[0029] The beneficial effects of the present invention:
[0030] 1. Being prone to premature convergence, slow convergence speed and low convergence accuracy are the main disadvantages of PSO. As the number of iterations gradually increases, PSO obtains the optimal solution in a local range due to the rapid concentration of particles; the present invention proposes the PNGAPSO algorithm, which can improve the convergence accuracy of the algorithm and enable it to avoid falling into the local optimal solution and search for the optimal solution in the global range, thereby improving the stability of the PID controller;
[0031] 2. The inertial weight factor w of the present invention is constructed LinW By optimizing and selecting the velocity value of the particle in the previous iteration, the particle can more easily get rid of local extrema due to a larger inertial weight factor in the early stage of search; as the number of iterations increases, with the help of a smaller factor, the local search ability of the particle can be strengthened, thus facilitating the PSO algorithm to search for the optimal solution.
[0032] 3. The learning factors c1 and c2 that change asynchronously are constructed Asy1 and c2 Asy2 Optimize the learning factors of the particles, enabling PSO to change differently during the iteration process; in the initial search stage, the individual learning ability of the particles is better while the swarm learning is poor, thus strengthening its global search; as the number of iterations increases, the particles show better swarm learning and poorer individual learning abilities, which will facilitate the search for the optimal solution.
[0033] 4. The gradient descent method has obvious advantages in solving convex optimization problems, mainly manifested as updating parameters in the opposite direction of the gradient; based on this idea, in order to strengthen the global search ability of the particles and avoid the particles falling into local optimal solutions, an individual optimization weight [f1(t) / f(t)] and a swarm optimization weight [f2(t) / f(t)] are introduced in the velocity update; the individual optimization weight maintains better individual learning ability; the swarm optimization weight maintains better swarm learning ability. pi (t) / f i (t)] and swarm optimization weight [f i (t) / f g (t)]; the individual optimization weight maintains better individual learning ability; the swarm optimization weight maintains better swarm learning ability.
[0034] 5. An adaptive adjustment coefficient defined based on the hyperbolic tangent function is adopted to prompt the particles to better update their positions, and the particles reduce the search iteration step size accordingly as the number of iterations increases.
[0035] 6. Introduce a greedy probability to increase the randomness of the algorithm and improve the algorithm performance.
[0036] 7. Through PID controller tuning, improve the stability of the speed control of the controlled object. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 FIG. is the flowchart of the PID control method based on PNGAPSO of the present invention;
[0038] Figure 2 FIG. is the block diagram of the PID system of PNGAPSO of the present invention;
[0039] Figure 3 FIG. is the graph of the fitness value change of function f1;
[0040] Figure 4 FIG. is the graph of the fitness value change of function f2;
[0041] Figure 5 This is the flow chart of the PNGAPSO algorithm of the present invention. Specific implementation mode
[0042] The present invention will be further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner. Therefore, it only shows the components related to the present invention.
[0043] Particle Swarm Optimization (PSO) simulates the collective behavior of a bird flock during foraging, and finds the optimal solution to the problem through information exchange and cooperation among individual birds. The update formulas for the particle position and velocity in the PSO algorithm are as follows:
[0044] v ij (t)+1) = wv ij (t)+c1r1[p ij (t)-x ij (t)]+c2r2[p gj (t)-x ij (t)];
[0045] x ij (t + 1) = x ij (t)+v ij (t + 1);
[0046] In the formula, w is the inertia weight; c1, c2 are learning factors; r1, r2 are random numbers between 0 and 1; v ij (t + 1) is the jth - dimensional velocity component of the ith particle at the (t + 1) - th iteration; x ij (t + 1) is the jth - dimensional position component of the ith particle at the (t + 1) - th iteration; p ij (t) is the jth - dimensional component of the historical best position of the ith particle at the t - th iteration; p gj (t) is the jth - dimensional component of the historical best position of the particles in the particle swarm at the t - th iteration; where, 1 ≤ i, g ≤ M, 1 ≤ j ≤ N.
[0047] Due to its simple theoretical structure, PSO has a wide range of application fields. However, due to the drawback that PSO is prone to fall into local extrema, there are many improvement methods proposed for PSO. The following are several main improvement strategies: The improvement of the inertia weight includes random inertia weight, linearly varying inertia weight, and adaptive inertia weight; in terms of the improvement of the learning factor, the common ones are synchronously varying learning factor and asynchronously varying learning factor; optimizing the PSO algorithm by introducing a convergence factor; combining PSO with other evolutionary or optimization algorithms, and the common hybrid algorithms include Genetic Algorithm (GA), Immune Algorithm (IA), Artificial Fish - Swarm Algorithm (AFSA), and Ant Colony Algorithm (ACA).
[0048] PID controllers are widely used in industrial control systems, and their performance mainly depends on the settings of proportional (P), integral (I), and derivative (D) parameters. However, due to the complex dynamic characteristics of the system, even non-linear or time-varying, traditional manual tuning methods (such as the Ziegler-Nichols method) have been difficult to meet the requirements of high precision and stability. To solve these problems, PID parameter tuning methods based on intelligent optimization algorithms have gradually emerged. Among them, the PSO algorithm, as one of the representatives of intelligent optimization algorithms, can continuously iterate and optimize PID parameters by simulating swarm intelligence and individual cooperation, and finally find the optimal solution.
[0049] Such as Figure 1 、 5 As shown in, a PID control method based on PNGAPSO includes the following steps:
[0050] Step 1: Construct a model of the controlled object;
[0051] The controlled object includes: robots, computer room fans, new energy vehicles;
[0052] Control the speed of the controlled object; such as speed control during robot path planning, speed control of computer room fans, and speed control during the driving of new energy vehicles.
[0053] The disadvantages of the standard PSO algorithm include easy premature convergence, slow convergence speed, and low convergence accuracy. As the number of iterations increases, the particles in the particle swarm quickly approach each other, causing the algorithm to fall into a local optimal solution. To improve the convergence accuracy of the algorithm and avoid falling into a local optimal solution, the algorithm needs to be improved to search for the optimal solution globally. Therefore, the present invention proposes a Proportional Negative Gradient and Adaptive Particle Swarm Optimization Algorithm (PNGAPSO). Since the gradient descent algorithm has obvious advantages in solving convex optimization problems, in order to enhance the global search ability of the particles and avoid the particles falling into a local optimal solution, the PNGAPSO algorithm is constructed.
[0054] Step 2: The PNGAPSO algorithm adds a gradient descent factor when updating the particle velocity in the PSO algorithm, and introduces an inertia weight factor and asynchronous changing learning factors c Asy1 and c Asy2 to improve the particle velocity update;
[0055] The particle velocity update formula is:
[0056] v ij (t + 1) = w LinW vij (t) + c Asy1 r1[f pi (t) / (10f i (t))][p ij (t) - x ij (t)] + c Asy2 r2[f i (t) / (10f g (t))][p gj (t) - x ij (t)] (1)
[0057] Among them, v ij (t) is the j-th dimensional velocity component of the i-th particle at the t-th iteration; x ij (t) is the j-th dimensional position component of the i-th particle at the t-th iteration; r1, r2 are random numbers between 0 and 1; p ij (t) is the j-th dimensional historical optimal position component of the i-th particle at the t-th iteration; p gj (t) is the j-th dimensional global optimal position component of the particles in the particle swarm at the t-th iteration; f pi (t) is the current individual fitness of the i-th particle at the t-th iteration; f i (t) is the individual historical optimal value of the i-th particle at the t-th iteration; f g (t) is the group historical optimal value at the t-th iteration; w LinW is the inertia weight factor; c Asy1 , c Asy2 are the learning factors respectively.
[0058]
[0059] Among them, w max and w min represent the maximum and minimum values of w LinW respectively; when w max = 0.9, w min = 0.4, the effect is optimal, t is the current iteration number, t max is the maximum iteration number;
[0060]
[0061] Among them, c ini1 , c ini2 represent the initial values of c Asy1 and c Asy2 respectively; generally set to 2.5 and 0.5 respectively; c fin1 , c fin2 represent c Asy1 and c Asy2The iteration final value is set to 0.5 and 2.5.
[0062] f pi (t) / f i (t) adds a new individual optimization weight when the particle learns from its own experience, that is, the ratio of the current individual fitness of particle individual i at the t-th iteration to the individual historical optimal value at the t-th iteration. When the gap between the current individual fitness and the individual historical optimal value is large, this weight is large, maintaining good individual learning ability, and vice versa, reducing the individual's learning ability.
[0063] Similarly, f i (t) / f g (t) adds a new population optimization weight when the particle accepts the experience of individual particles in the population, that is, the ratio of the individual historical optimal value of particle individual i at the t-th iteration to the population historical optimal value at the t-th iteration; when the gap between the individual historical optimal value and the population historical optimal value is large, this weight is large, maintaining good population learning ability, and vice versa, reducing the population learning ability.
[0064] It also includes: improving the particle position update based on the hyperbolic tangent function;
[0065] Since the particles in the early stage of iteration have a large difference in each iteration update during the search process, the particles at this time should have a large search iteration step size to accelerate the global search; but as the iteration progresses, the solution space range of the algorithm becomes smaller, and at this time, using a correspondingly reduced search iteration step size can converge to the optimal solution more precisely; therefore, an adaptive adjustment coefficient η defined based on the hyperbolic tangent function is used to help the particles better update their positions, and the expression of η is as follows:
[0066]
[0067] In the formula, t is the iteration number, and t max is the maximum iteration number.
[0068] The formula for improving the particle position update is:
[0069] x ij (t + 1) = x ij (t) + ηv ij (t + 1) (6)
[0070] The particle reduces the search iteration step size accordingly as the iteration number increases; in addition, a greedy probability ε (0 < ε < 1) is introduced to increase the randomness of particle search.
[0071] The velocity and position update methods of particles in PNGAPSO are:
[0072] When R < ε, the velocity and position of the particle are updated according to Equations (1) and (6); otherwise, the update formulas for the particle position and velocity of the standard PSO algorithm are adopted. R is a random number between 0 and 1.
[0073] As Figure 2 shown, in Step 3, the PNGAPSO algorithm is used to tune the PID control parameters, with the performance index function as the fitness function; the PID control parameters K P , K I and K D are regarded as three-dimensional solutions, and a set of optimal parameters is obtained through iterative solution;
[0074] The formula for the performance index function is:
[0075]
[0076] where t ss is the set simulation time, and e(t) is the error signal between the reference input (desired response) and the system response (actual output) of the controlled object.
[0077] Experimental process:
[0078] As Figure 3 and 4 shown, to prove the performance of the PNGAPSO algorithm, two test functions shown in Table 1 are selected for comparative verification; the specific function expressions, the dimensions of the solutions of the variables taken during the test, the value ranges of the variables, and the theoretical minimum values of the test functions are given in the table; among them, f1(x) is a unimodal test function and f2(x) is a multimodal test function; the PNGAPSO algorithm, the standard PSO algorithm, the LinWPSO algorithm, the AsyLnCPSO algorithm, the RandWPSO algorithm, and the SAPSO algorithm are respectively applied to each test function. The experiment is carried out in the MATLAB R2021b environment.
[0079] Table 1 Test functions
[0080] Test function Dimension of the solution Variable range Minimum value <![CDATA[f1(x) = 100x 2 > 1 [-10,10] 0 <![CDATA[f2x = x 2 |sin x| + |x|]]> 1 [-4π,4π] 0
[0081] Based on the above experimental results, the PNGAPSO algorithm has higher convergence accuracy and faster convergence speed compared with the other four PSO algorithms. A step signal is applied at the Setpoint, with the performance index function as the fitness function, and K P , K I and K D are regarded as three-dimensional solutions. Given K P , K I and K DThe value ranges are [0.1, 3], [0.1, 5] and [0, 1] respectively, and the maximum particle velocity is limited to 0.1.
[0082] Table 2 Controller parameter values and system dynamic performance index values
[0083]
[0084] As shown in Table 2, the PNGAPSO algorithm and other improved PSO algorithms obtain the same optimal performance index function values after restricting the value ranges of K P 、K I and K D However, the system response simulated by the PID controller parameters searched by the PNGAPSO algorithm is more superior. Using the PID controller parameters tuned by the PNGAPSO algorithm, the system adjustment time is shorter than that of the system under other controllers.
[0085] Inspired by the ideal embodiments of the present invention described above, through the above description, relevant staff can completely make various changes and modifications without departing from the technical idea of the present invention. The technical scope of the present invention is not limited to the content in the specification, and its technical scope must be determined according to the scope of the claims.
Claims
1. A PID control method based on PNGAPSO, characterized in that, It includes the following steps: Step 1, construct the model of the object to be controlled; Step 2, in the PNGAPSO algorithm, a gradient descent factor is added when updating the particle velocity of the PSO algorithm, and an inertia weight factor and an asynchronous changing learning factor are introduced to improve the particle velocity update; Step 3, use the PNGAPSO algorithm to tune the PID control parameters, and use the performance index function as the fitness function; Take it as the solution and solve the optimal parameters through iteration.
2. The PID control method based on PNGAPSO according to claim 1, wherein, The formula for updating the particle velocity is: v ij (t + 1)= w LinW v ij (t)+ c Asy1 r1[f pi (t) / (10f i (t))][p ij (t)- x ij (t)]+ c Asy2 r2[f i (t) / (10f g (t))][p gj (t)- x ij (t)] Among them, v ij (t) is the j-th dimensional velocity component of the i-th particle at the t-th iteration; x ij (t) is the j-th dimensional position component of the i-th particle at the t-th iteration; r1, r2 are random numbers between 0 and 1; p ij (t) is the j-th dimensional historical optimal position component of the i-th particle at the t-th iteration; p gj (t) is the j-th dimensional global optimal position component of the particles in the particle swarm at the t-th iteration; f pi (t) is the current individual fitness of the i-th particle at the t-th iteration; f i (i) is the individual historical optimal value of the i-th particle at the t-th iteration; f g (t) is the group historical optimal value at the t-th iteration; w LinW is the inertia weight factor; c Asy1 、c Asy2 are the learning factors respectively.
3. The PID control method based on PNGAPSO according to claim 2, wherein The formula for the inertia weight factor is: Among them, w max and w min respectively represent the maximum value and the minimum value of w LinW ; when w max = 0.9 and w min = 0.4, the effect is optimal. t is the current iteration number, and t max is the maximum iteration number.
4. The PID control method based on PNGAPSO according to claim 2, wherein The formula for the learning factor is: Among them, c ini1 and c ini2 respectively represent the initial values of c Asy1 and c Asy2 ; C fin1 and c fin2 respectively represent the final iteration values of c Asy1 and c Asy2 .
5. The PID control method based on PNGAPSO according to claim 1, wherein It also includes: Improve the particle position update based on the hyperbolic tangent function, and the formula is: x ij (t + 1) = x ij (t) + ηv ij (t + 1)(6) Among them, η is the adaptive adjustment coefficient.
6. The PID control method based on PNGAPSO according to claim 5, wherein The formula for the adaptive adjustment coefficient is: where t is the number of iterations, and t max is the maximum number of iterations.
7. The PID control method based on PNGAPSO according to claim 1, characterized in that Introduce the greedy probability to increase the randomness of particle search.
8. The PID control method based on PNGAPSO according to claim 1, wherein The performance index function is IAE.
9. The PID control method based on PNGAPSO according to claim 1, wherein The objects to be controlled include: robots, computer room fans, and new energy vehicles.
10. The PID control system based on PNGAPSO is characterized in that, It includes: A memory for storing instructions executable by the processor; A processor for executing instructions to implement the PNGAPSO-based PID control method according to any one of claims 1-8.
Citation Information
Patent Citations
PSO-based setting machine fuzzy PID tension control parameter self-tuning method
CN111221245A