Proportional valve PID control method and storage medium based on improved particle swarm algorithm
By improving the particle swarm algorithm and the simplex method to optimize the PID controller parameters of the proportional valve, the problems of large calculation volume and slow convergence speed in the prior art are solved, and the rapid and precise control of the proportional valve is achieved.
Patent Information
- Application Number
- CN202510621971.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-05-15
AI Technical Summary
The existing PID controller parameter tuning method has a large calculation amount and slow convergence speed, which leads to insufficient control performance of proportional valves.
The improved particle swarm algorithm is used to optimize the PID controller parameters in combination with the simplex method, and the initial population is generated through the Lorenz chaotic algorithm, and the particle position is updated in combination with reflection, expansion and compression operations to improve local search capabilities and global search efficiency.
It realizes rapid and precise optimization of PID control parameters, and improves the control accuracy and stability of proportional valves.
Smart Images

Figure CN120143599B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PID control, and in particular to a proportional valve PID control method and a storage medium based on an improved particle swarm algorithm. Background Art
[0002] A proportional valve is a hydraulic or pneumatic component used to control the pressure, flow, or direction of fluids (such as hydraulic oil and air). It is widely used in industrial automation, engineering machinery, aerospace, and other fields. It controls the output pressure, flow, or direction proportionally to the input signal, thereby achieving precise control of the fluid system.
[0003] Because proportional valves require precise control and quick response to system dynamics, they are typically controlled using a PID (Proportional-Integral-Derivative) controller. In practice, PID controller parameters must be adjusted to adapt PID control to different proportional valve types and application scenarios.
[0004] In the existing technology, genetic algorithms, particle swarm algorithms, etc. are usually used to tune the parameters of PID controllers. However, the calculation amount is large, the convergence speed is slow, and the calculated parameters are not accurate enough, which makes the control performance of the proportional valve not good enough. Summary of the Invention
[0005] The embodiment of the present invention provides a proportional valve PID control method and storage medium based on an improved particle swarm algorithm to solve the problems of large computational complexity, slow convergence speed, and inaccurate calculated parameters in existing PID controller parameter tuning methods, which makes the proportional valve poorly adaptable to dynamic environments.
[0006] In a first aspect, an embodiment of the present invention provides a proportional valve PID control method based on an improved particle swarm optimization algorithm, comprising:
[0007] Obtain the operating parameters of the proportional valve and establish a PID controller model based on the operating parameters;
[0008] The particle swarm algorithm is used to optimize the parameters of the PID controller model, and the simplex method is combined to update the particles to obtain the target control parameters; the target control parameters include: proportional coefficient, integral coefficient and differential coefficient;
[0009] The target control parameters are sent to the PID controller for controlling the proportional valve.
[0010] Optionally, a particle swarm optimization algorithm is used to optimize the parameters of the PID controller model, and the simplex method is combined to update the particles to obtain the target control parameters, including:
[0011] The parameter search space is set, and the improved Lorenz chaos algorithm is used to generate the initial population in the search space; wherein the proportional coefficient, integral coefficient and differential coefficient correspond to the x-axis coordinate, y-axis coordinate and z-axis coordinate of the particle respectively;
[0012] Calculate the fitness of each particle in the initial population and take the minimum value of each fitness as the global optimal value;
[0013] Update the speed and position of each particle in the population;
[0014] The simplex method is used to update the position of each particle in the population, and the fitness of each particle in the population is calculated, and the minimum value of each fitness is taken as the optimal value of the current iteration;
[0015] If the optimal value of the current iteration is less than the current global optimal value, the optimal value of the current iteration is used as the new global optimal value; otherwise, the global optimal value is not updated;
[0016] Determine whether the maximum number of iterations has been reached;
[0017] If so, the position of the particle corresponding to the current global optimal value is used as the target control parameter;
[0018] Otherwise, jump to the step of updating the speed and position of each particle in the population and continue execution.
[0019] Optionally, the simplex method is used to update the position of each particle in the population, including:
[0020] Get the fitness of each particle in the population and sort them in ascending order;
[0021] The particle with the smallest fitness is regarded as the global optimal particle, the particle with the largest fitness is regarded as the global worst particle, and the particle before the global worst particle is regarded as the global previous worst point;
[0022] Obtain reflected particles through reflection operation;
[0023] Calculate the fitness of the reflected particle, the fitness of the global optimal particle and the fitness of the global previous difference respectively;
[0024] If the fitness of the reflected particle is not less than the fitness of the global optimal particle and is less than the fitness of the global previous worst point, the reflected particle is used to replace the global worst particle;
[0025] If the fitness of the reflected particle is less than the fitness of the global optimal particle, an expansion particle is obtained through the expansion operation, and the position of each particle in the population is updated according to the expansion particle;
[0026] If the fitness of the reflected particle is not less than the fitness of the global previous difference point, a compressed particle is obtained through compression operation, and the position of each particle in the population is updated according to the compressed particle.
[0027] Optionally, update the positions of each particle in the population based on the expanded particle, including:
[0028] Calculate the fitness of the expanded particles;
[0029] If the fitness of the expansion particle is less than that of the reflection particle, the expansion particle is used to replace the global worst particle;
[0030] Otherwise, the reflective particle is used to replace the global worst particle.
[0031] Optionally, update the positions of each particle in the population based on the compressed particle, including:
[0032] Calculate the fitness of compressed particles;
[0033] If the fitness of the compressed particle is less than the fitness of the global worst particle, the compressed particle is used to replace the global worst particle;
[0034] Otherwise, the positions of each particle in the population are updated according to the global optimal particle.
[0035] Optionally, update the position of each particle in the population based on the global optimal particle, including:
[0036] Based on the global optimal particle, the position of each particle in the population is updated in combination with the first formula;
[0037] The first formula includes:
[0038]
[0039] in, For the population The position of the particle, is the position of the global optimal particle, is the shrinkage coefficient.
[0040] Optionally, reflective particles are obtained through reflection operations, including:
[0041] The second formula is used to determine the reflected particles;
[0042] The second formula includes:
[0043]
[0044]
[0045] in, is the position of the reflected particle, is the reflection coefficient, is the position of the global worst particle, Remove the center position of the global worst particle for the current population, For the population The position of the particle, is the total number of particles in the population.
[0046] Optionally, obtaining the expanded particle by the expansion operation includes: determining the expanded particle using a third formula;
[0047] The third formula includes:
[0048]
[0049] Obtaining compressed particles through a compression operation includes: determining the compressed particles using a fourth formula;
[0050] The fourth formula includes:
[0051]
[0052] in, is the position of the expanded particle, Remove the center position of the global worst particle for the current population, is the position of the reflected particle, is the expansion coefficient; is the position of the compressed particle, is the compression coefficient, is the position of the global worst particle; is the fitness function.
[0053] Optionally, an improved Lorenz chaos algorithm is used to generate an initial population in the search space, including:
[0054] Use the fifth formula to generate the initial population in the search space;
[0055] The fifth formula includes:
[0056]
[0057]
[0058]
[0059] in, , , The first The x-axis coordinate, y-axis coordinate and z-axis coordinate of each particle; 、 、 is an adjustable parameter; , is the total number of particles in the population.
[0060] In a second aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the proportional valve PID control method based on the improved particle swarm algorithm in the first aspect or any possible implementation of the first aspect.
[0061] The embodiment of the present invention provides a proportional valve PID control method and storage medium based on an improved particle swarm algorithm. The above-mentioned proportional valve PID control method based on the improved particle swarm algorithm includes: obtaining the operating parameters of the proportional valve, and establishing a PID controller model according to the operating parameters; optimizing the parameters of the PID controller model using the particle swarm algorithm, and updating the particles in combination with the simplex method to obtain target control parameters; wherein the target control parameters include: proportional coefficient, integral coefficient and differential coefficient; sending the target control parameters to the PID controller for controlling the proportional valve. The embodiment of the present invention combines the simplex method with the particle swarm algorithm to optimize the PID control parameters, while introducing more accurate local search capabilities while maintaining the efficiency of the global search, with a fast convergence speed, improved stability and accuracy of the optimization, and better control performance of the PID controller, thereby making the control of the proportional valve more accurate and stable. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This is an application scenario diagram of a proportional valve PID control method based on an improved particle swarm algorithm provided by an embodiment of the present invention;
[0063] Figure 2 This is a flow chart of an implementation of a proportional valve PID control method based on an improved particle swarm algorithm provided by an embodiment of the present invention;
[0064] Figure 3 This is a comparison chart of the fitness of the PID control parameter solving method provided by an embodiment of the present invention and the traditional particle swarm algorithm for solving PID control parameters;
[0065] Figure 4 This is a comparison chart of the responses of the PID control parameter solving method provided by an embodiment of the present invention and the traditional particle swarm algorithm for solving PID control parameters;
[0066] Figure 5Schematic diagram of the structure of a proportional valve PID control device based on an improved particle swarm algorithm provided by an embodiment of the present invention;
[0067] Figure 6 is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0069] PID control is a classic control technique widely used in industrial control systems. It continuously adjusts the system's output based on feedback from the system's current state to maintain a stable output near the desired value. PID control technology consists of three main components: proportional, integral, and derivative. PID control regulates the system by combining the effects of these three components, adjusting their weights (proportional, integral, and derivative coefficients) based on actual needs to achieve fast and accurate control. The selection of these weighting parameters is crucial. PID controllers have been successfully applied in many fields due to their simplicity, adjustability, wide applicability, stability, robustness, and cost-effectiveness.
[0070] Proportional valves require precise control and must respond quickly to system dynamics. Therefore, PID controllers are often used to control proportional valves. Due to the high control requirements of proportional valves, the tuning of PID control parameters plays a crucial role in their precise control.
[0071] In the existing technology, genetic algorithms, particle swarm algorithms, etc. are usually used to tune the parameters of PID controllers. However, the calculation amount is large, the convergence speed is slow, and the calculated parameters are not accurate enough, which makes the control performance of the proportional valve not good enough.
[0072] Based on the above, an embodiment of the present invention provides a proportional valve PID control method based on an improved particle swarm optimization algorithm to solve the above technical problems.
[0073] Figure 1 This is an application scenario diagram of the proportional valve PID control method based on the improved particle swarm algorithm provided by an embodiment of the present invention. The electronic device calculates the PID control parameters and sends them to the PID controller, which uses the calculated PID control parameters to control the proportional valve.
[0074] See also Figure 2 , which shows an implementation flow chart of a proportional valve PID control method based on an improved particle swarm algorithm provided by an embodiment of the present invention, as detailed below:
[0075] The above-mentioned proportional valve PID control method based on the improved particle swarm algorithm includes:
[0076] S101: Acquire operating parameters of the proportional valve and establish a PID controller model based on the operating parameters;
[0077] In the embodiment of the present invention, a particle swarm is used to solve the PID control parameters. Its application scenario is the control of a proportional valve. Therefore, it is necessary to build a PID control model based on the operating parameters of the proportional valve, combine it with the actual application scenario, and import the model parameters for subsequent data processing.
[0078] S102: Optimizing the parameters of the PID controller model using a particle swarm algorithm and updating the particles in combination with the simplex method to obtain target control parameters; wherein the target control parameters include: proportional coefficient, integral coefficient, and differential coefficient;
[0079] In an embodiment of the present invention, three control parameters of the PID controller: the proportional coefficient (Kp), the integral coefficient (Ki), and the differential coefficient (Kd) are used as optimization variables and optimized using a particle swarm algorithm. Simultaneously, the particle update is performed in combination with the simplex method. Since the simplex method has high solving efficiency, each iteration can significantly improve the objective function value and can provide rich information. Therefore, applying it to the particle swarm algorithm will make the particle swarm algorithm converge faster. While introducing a more accurate local search, it also ensures the efficiency of the global search, and the parameter calculation process is more stable and accurate.
[0080] Specifically, in a possible implementation, S102 may include:
[0081] S1021: Setting a parameter search space and using an improved Lorenz chaos algorithm to generate an initial population in the search space; wherein the proportional coefficient, integral coefficient, and differential coefficient correspond to the x-axis coordinate, y-axis coordinate, and z-axis coordinate of the particle, respectively;
[0082] The value ranges of the proportional coefficient (Kp), integral coefficient (Ki) and differential coefficient (Kd) are key parameters for PID control, and their value ranges are usually determined based on the actual control requirements and system characteristics. This application is applied to the control of proportional valves, and the value ranges of the PID control parameters can be determined based on the performance and control requirements of the proportional valve. For example, the value range of the proportional coefficient (Kp) is [0,10], the value range of the integral coefficient (Ki) is [0,1], and the value range of the differential coefficient (Kd) is [0,0.1]. These ranges constitute the parameter search space, and the subsequent optimization process will be carried out within this space.
[0083] The ordinary differential equations of basic Lorenz chaos in the three-dimensional space coordinate system are:
[0084]
[0085] in, 、 、 is an adjustable parameter, 、 、 They are the X-axis coordinate, Y-axis coordinate and Z-axis coordinate respectively.
[0086] This application integrates chaotic mapping, adds nonlinear factors based on Lorenz chaos, increases complex behaviors through the alienation of nonlinear factors, and generates an initial population with a more uniform distribution in the early stage.
[0087] Specifically, in a possible implementation, using an improved Lorenz chaos algorithm to generate an initial population in a search space may include:
[0088] Use the fifth formula to generate the initial population in the search space;
[0089] The fifth formula may include:
[0090]
[0091]
[0092]
[0093] in, , , The first The x-axis coordinate, y-axis coordinate and z-axis coordinate of each particle; 、 、 is an adjustable parameter, , is the total number of particles in the population.
[0094] By iteratively solving the fifth equation, we obtain a series of (x, y, z) values. These values are mapped into the parameter search space according to a specific mapping rule, so that x corresponds to Kp, y corresponds to Ki, and z corresponds to Kd. Each combination of (Kp, Ki, Kd) constitutes a particle, and multiple such particles form the initial population.
[0095] S1022: Calculate the fitness of each particle in the initial population, and take the minimum value of each fitness as the global optimal value;
[0096] The fitness function is used to evaluate the quality of each particle, that is, the quality of a set of PID control parameters (Kp, Ki, Kd). The PID control parameters are substituted into the PID controller model for simulation, and the fitness value is calculated in combination with the fitness function. In this embodiment of the present invention, based on the least squares method, the fitness function can be:
[0097]
[0098] in, For fitness, is the expected output value of the system, is the actual output value of the system.
[0099] Compare the fitness values of all particles in the initial population and find the minimum value. The particle corresponding to this minimum value represents the optimal PID control parameter combination in the current population, and this minimum value is taken as the global optimal value.
[0100] In a possible implementation, the transfer function of the particle swarm optimization algorithm can be:
[0101]
[0102] in, is the transfer function, is a function variable.
[0103] S1023: Update the speed and position of each particle in the population;
[0104] Particles in the particle swarm algorithm have two properties: velocity V and position X. Each particle independently searches for the optimal solution in the search space and records it as the current individual extreme value. This individual extreme value is then shared with other particles in the swarm. The best individual extreme value found becomes the current global optimal solution for the entire swarm. All particles in the swarm adjust their speed and position based on their current individual extreme value and the current global optimal solution shared by the entire swarm.
[0105] In the embodiment of the present invention, the speed and position of each particle can be updated using the method in the prior art. Specifically, the speed and position update formula is as follows:
[0106]
[0107]
[0108] in, and Respectively The particle in The speed and position at the iteration; and is the learning factor; It is a random number between 0 and 1. and They are the individual optimum that guides particles to explore their own historical optimal direction and the global optimum that guides particles to converge to the group optimal direction.
[0109] S1024: Use the simplex method to update the position of each particle in the population, calculate the fitness of each particle in the population, and take the minimum value of each fitness as the optimal value of the current iteration;
[0110] In order to introduce more accurate local search capabilities, the simplex method is combined with particles in the embodiment of the present invention to update the position of each particle.
[0111] The simplex method is an optimization algorithm for solving linear programming problems. In this step, the position of each particle (PID control parameter) is used as an initial point to construct a simplex. The simplex is a polyhedron consisting of n+1 points (n is the dimension of the problem, n=3 here, representing Kp, Ki, and Kd). By comparing the fitness values of each simplex vertex, operations such as reflection, expansion, and contraction are performed to continuously adjust the shape and position of the simplex to find a more optimal point. After a certain number of iterations, the new position of each particle is obtained.
[0112] For each particle after its position is updated, its corresponding PID control parameters are again substituted into the PID controller model for simulation and the fitness value is calculated. The fitness values of all particles are compared and the minimum value is found. This minimum value is used as the optimal value for the current iteration.
[0113] In the embodiment of the present invention, a simplex is used to update the position of the selected particles, and its information is fed back to the entire particle group, thereby introducing a more accurate local search capability while maintaining the efficiency of the global search and preventing the algorithm from falling into a local optimal solution.
[0114] S1025: If the optimal value of the current iteration is less than the current global optimal value, the optimal value of the current iteration is used as the new global optimal value; otherwise, the global optimal value is not updated;
[0115] Compare the optimal value of the current iteration with the current global optimal value. If the optimal value of the current iteration is smaller, it means that a better PID control parameter combination has been found after updating the particle position using the simplex method. In this case, the optimal value of the current iteration is used as the new global optimal value. If the optimal value of the current iteration is not less than the current global optimal value, it means that the current global optimal value is still the best and no update is performed.
[0116] S1026: Determine whether the maximum number of iterations has been reached;
[0117] In order to prevent the algorithm from falling into an infinite loop, a maximum number of iterations needs to be set; the current number of iterations is recorded, and it is determined whether the current number of iterations has reached the maximum number of iterations. This is one of the termination conditions of the algorithm and is used to control the running time and convergence of the algorithm.
[0118] S1027: If yes, the position of the particle corresponding to the current global optimal value is used as the target control parameter;
[0119] If the maximum number of iterations is reached, it means that the algorithm has performed enough iterations and the optimal PID control parameter combination is found. The particle position corresponding to the current global optimal value, i.e. (Kp, Ki, Kd), is used as the target control parameter in the actual PID controller.
[0120] S1028: Otherwise, jump to the step of updating the speed and position of each particle in the population and continue execution.
[0121] If the maximum number of iterations has not been reached, the algorithm can continue to search for a better solution. At this point, the process jumps to step S1023 to continue updating the speed and position of each particle in the population and enter the next iteration process until the termination condition is met.
[0122] By iterating through the above steps, the PID control parameters are continuously optimized, and finally a set of optimal parameter combinations is found to achieve the best performance of the controller.
[0123] The specific steps of updating particles using the simplex method are described in detail below.
[0124] In a possible implementation, S1024 may include:
[0125] 1. Obtain the fitness of each particle in the population and sort them in ascending order;
[0126] In an optimization problem, each particle represents a possible solution. Fitness is used to measure the quality of each solution; smaller fitness values indicate better solutions. For each particle in the population, its corresponding parameters are substituted into the fitness function to calculate the corresponding fitness value.
[0127] After obtaining the fitness values of all particles, use a suitable sorting algorithm (such as quick sort, merge sort, etc.) to sort these fitness values in ascending order. The purpose of sorting is to facilitate the subsequent identification of the particles with the smallest and largest fitness values.
[0128] 2. The particle with the smallest fitness is regarded as the global optimal particle, the particle with the largest fitness is regarded as the global worst particle, and the particle before the global worst particle is regarded as the global previous difference;
[0129] After sorting, the solution represented by the particle with the lowest fitness is the optimal solution in the current population and is defined as the global optimal particle. This particle will serve as a reference standard in the subsequent optimization process, guiding other particles to approach it.
[0130] The solution represented by the particle with the highest fitness is the worst solution in the current population and is defined as the global worst particle. This particle is the object of improvement, and subsequent operations attempt to find a better solution to replace it.
[0131] The particle immediately preceding the global worst particle, whose fitness is second only to the global worst particle, is defined as the global previous worst point. This particle will also play an important reference role in subsequent judgments and operations.
[0132] 3. Obtain reflected particles through reflection operation;
[0133] Reflection is a common operation in optimization algorithms used to explore new solution spaces based on the current solution. By using reflection, we can explore the solution space in the opposite direction of the global worst particle, potentially finding a better solution.
[0134] In a possible implementation, obtaining reflected particles through a reflection operation may include:
[0135] The second formula is used to determine the reflected particles;
[0136] The second formula may include:
[0137]
[0138]
[0139] in, is the position of the reflected particle, is the reflection coefficient, is the position of the global worst particle, Remove the center position of the global worst particle for the current population, For the population The position of the particle, is the total number of particles in the population.
[0140] First calculate the center position of the current population excluding the global worst particle ,by As a reference, the global worst particle Reflecting in the opposite direction allows us to explore new areas in the solution space and find better solutions. This operation helps the algorithm escape from local optimal solutions and enhances global search capabilities.
[0141] 4. Calculate the fitness of the reflected particle, the fitness of the global optimal particle, and the fitness of the global previous difference respectively;
[0142] For the reflection particle, the global optimal particle, and the global last difference, their corresponding parameters are substituted into the fitness function to calculate their respective fitness values. These fitness values will be used in subsequent judgments and decisions to determine whether the particles in the population need to be updated.
[0143] 5. If the fitness of the reflected particle is not less than the fitness of the global optimal particle and is less than the fitness of the previous global worst point, the reflected particle is used to replace the global worst particle;
[0144] Comparing the three particles, if the reflected particle's fitness is not less than the global optimal particle's fitness and less than the fitness of the previous global worst-case scenario, this indicates that while the reflected particle is not better than the global optimal particle, it is better than the previous global worst-case scenario. In this case, the reflected particle is used to replace the original global worst-case scenario. This aims to gradually eliminate poor solutions and improve the overall quality of the population.
[0145] 6. If the fitness of the reflected particle is less than the fitness of the global optimal particle, an expansion particle is obtained through the expansion operation, and the position of each particle in the population is updated according to the expansion particle;
[0146] When the fitness of the reflected particle is lower than that of the global optimal particle, the reflection operation has found a direction that is better than the current global optimal solution. At this point, an expansion operation can be performed to further explore this better direction. After obtaining the expanded particle, the positions of each particle in the population are updated based on the information from the expanded particle, thus guiding the population to search for a more optimal solution space.
[0147] In one possible implementation, updating the position of each particle in the population according to the expanded particle may include:
[0148] (1) Calculate the fitness of the expanded particles;
[0149] (2) If the fitness of the expansion particle is less than that of the reflection particle, the expansion particle is used to replace the global worst particle;
[0150] Reflected particles are particles discovered through reflection operations in the solution space, while dilated particles are the result of further exploration based on the reflected particles. If the fitness of the dilated particle is lower than that of the reflected particle, it means that the dilation operation has achieved a better result than the reflected particle. During the optimization process, the global worst particle represents the least ideal solution in the population. We aim to continuously replace poor solutions to improve the population quality. Therefore, by replacing the original global worst particle with the dilated particle and updating its position, the worst solution in the population is updated. Subsequent optimization operations can then proceed based on this relatively better population state, searching for a more optimal solution.
[0151] (3) Otherwise, the reflective particle is used to replace the global worst particle.
[0152] If the fitness of the expansion particle is not less than that of the reflection particle, it indicates that the expansion operation has not achieved a better solution than the solution represented by the reflection particle. In this case, according to the optimization strategy, the reflection particle replaces the original global worst particle, eliminating relatively poor solutions, so that the population always evolves towards a better solution.
[0153] The expansion operation is performed on the basis of the reflection particles, and further exploration is carried out towards a better solution based on the reflection particles.
[0154] The expansion operation is usually based on the reflected particle and continues along the reflection direction. Based on this, in one possible implementation, obtaining the expanded particle through the expansion operation may include: using the third formula to determine the expanded particle;
[0155] The third formula may include:
[0156]
[0157] in, is the position of the expanded particle, Remove the center position of the global worst particle for the current population, is the position of the reflected particle, is the expansion coefficient.
[0158] 7. If the fitness of the reflected particle is not less than the fitness of the global previous difference point, a compressed particle is obtained through compression operation, and the position of each particle in the population is updated according to the compressed particle.
[0159] If the fitness of the reflected particle is not less than the fitness of the previous global difference point, the reflection operation has not found a better solution, and a compression operation is needed to narrow the search range. After obtaining the compressed particle, the positions of each particle in the population are updated based on the compressed particle's information. This compression operation prevents the algorithm from over-searching in a poor solution space, improves search efficiency, and enables the population to converge to the optimal solution more quickly.
[0160] In one possible implementation, updating the position of each particle in the population according to the compressed particle may include:
[0161] (1) Calculate the fitness of compressed particles;
[0162] (2) If the fitness of the compressed particle is less than the fitness of the global worst particle, the compressed particle is used to replace the global worst particle;
[0163] After obtaining the fitness value of the compressed particle, it is compared with the fitness of the current global worst particle. If the fitness of the compressed particle is lower than that of the global worst particle, this means that the solution represented by the compressed particle is better than the current global worst solution. The compressed particle is then replaced with the original global worst particle, and the position of the global worst particle is updated. This improves the worst solution in the population, allowing subsequent optimization operations to proceed based on this relatively better population state, helping to guide the algorithm towards a more optimal solution.
[0164] (3) Otherwise, update the position of each particle in the population according to the global optimal particle.
[0165] If the fitness of the compressed particle is not less than the fitness of the global worst particle, it means that the compression operation has not achieved a better result than the current global worst solution. In this case, in order to promote the evolution of the population towards a better solution, the global optimal particle is used to update the position of each particle in the population, guiding the algorithm to search for a better solution.
[0166] In one possible implementation, updating the position of each particle in the population according to the global optimal particle may include:
[0167] Based on the global optimal particle, the position of each particle in the population is updated in combination with the first formula;
[0168] The first formula may include:
[0169]
[0170] in, For the population The position of the particle, is the position of the global optimal particle, is the shrinkage coefficient.
[0171] The global optimal particle represents the optimal solution found in the current population. Bringing all points in the population closer to the global optimal particle helps the algorithm converge to a better solution and improves the effectiveness of the entire optimization process.
[0172] The compression operation is usually performed between the global worst particle and the midpoint or between the reflection particle and the midpoint. Based on this, in one possible implementation, obtaining the compressed particle through the compression operation may include: determining the compressed particle using the fourth formula;
[0173] The fourth formula may include:
[0174]
[0175] in, is the position of the expanded particle, Remove the center position of the global worst particle for the current population, is the position of the reflected particle, is the expansion coefficient; is the position of the compressed particle, is the compression coefficient, is the position of the global worst particle; is the fitness function.
[0176] S103: Send the target control parameter to the PID controller for controlling the proportional valve.
[0177] The target control parameters are calculated using step S102. Since the calculated target control parameters are more accurate, when they are applied to the PID controller, the control of the proportional valve is more precise, more stable, and has better control performance.
[0178] Comparing the step S102 of the embodiment of the present invention with the traditional particle swarm algorithm, refer to Figure 3 and Figure 4 , while ensuring the efficiency of global search, it is more accurate and has better stability.
[0179] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0180] The following are device embodiments of the present invention. For details not fully described therein, reference may be made to the corresponding method embodiments described above.
[0181] Figure 5The following is a schematic diagram showing the structure of a proportional valve PID control device based on an improved particle swarm algorithm according to an embodiment of the present invention. For ease of explanation, only the parts related to the embodiment of the present invention are shown, which are described in detail as follows:
[0182] like Figure 5 As shown, the proportional valve PID control device based on the improved particle swarm algorithm includes:
[0183] The model building module 21 is used to obtain the operating parameters of the proportional valve and build a PID controller model according to the operating parameters;
[0184] The parameter solving module 22 is used to optimize the parameters of the PID controller model using a particle swarm algorithm and update the particles in combination with the simplex method to obtain target control parameters; wherein the target control parameters include: proportional coefficient, integral coefficient and differential coefficient;
[0185] The control module 23 is used to send the target control parameters to the PID controller for controlling the proportional valve.
[0186] In a possible implementation, the parameter solving module 22 may include:
[0187] The initialization unit is used to set the parameter search space and generate the initial population in the search space using the improved Lorenz chaos algorithm; wherein the proportional coefficient, integral coefficient and differential coefficient correspond to the x-axis coordinate, y-axis coordinate and z-axis coordinate of the particle respectively;
[0188] The first optimization unit is used to calculate the fitness of each particle in the initial population and take the minimum value of each fitness as the global optimal value;
[0189] The first updating unit is used to update the speed and position of each particle in the population;
[0190] The second updating unit is used to update the position of each particle in the population using the simplex method, and calculate the fitness of each particle in the population, and take the minimum value of each fitness as the optimal value of the current iteration;
[0191] The second optimization unit is configured to use the optimal value of the current iteration as the new global optimal value if the optimal value of the current iteration is less than the current global optimal value; otherwise, the global optimal value is not updated;
[0192] An iteration number judgment unit, used to judge whether the maximum iteration number has been reached;
[0193] A result output unit is used for taking the position of the particle corresponding to the current global optimal value as the target control parameter;
[0194] The loop jump unit is used to jump to the step of updating the speed and position of each particle in the population and continue execution otherwise.
[0195] In a possible implementation, the second updating unit may be specifically configured to:
[0196] 1. Obtain the fitness of each particle in the population and sort them in ascending order;
[0197] 2. The particle with the smallest fitness is regarded as the global optimal particle, the particle with the largest fitness is regarded as the global worst particle, and the particle before the global worst particle is regarded as the global previous difference;
[0198] 3. Obtain reflected particles through reflection operation;
[0199] 4. Calculate the fitness of the reflected particle, the fitness of the global optimal particle, and the fitness of the global previous difference respectively;
[0200] 5. If the fitness of the reflected particle is not less than the fitness of the global optimal particle and is less than the fitness of the previous global worst point, the reflected particle is used to replace the global worst particle;
[0201] 6. If the fitness of the reflected particle is less than the fitness of the global optimal particle, an expansion particle is obtained through the expansion operation, and the position of each particle in the population is updated according to the expansion particle;
[0202] 7. If the fitness of the reflected particle is not less than the fitness of the global previous difference point, a compressed particle is obtained through compression operation, and the position of each particle in the population is updated according to the compressed particle.
[0203] In one possible implementation, updating the position of each particle in the population according to the expanded particle may include:
[0204] (1) Calculate the fitness of the expanded particles;
[0205] (2) If the fitness of the expansion particle is less than that of the reflection particle, the expansion particle is used to replace the global worst particle;
[0206] (3) Otherwise, the reflective particle is used to replace the global worst particle.
[0207] In one possible implementation, updating the position of each particle in the population according to the compressed particle may include:
[0208] (1) Calculate the fitness of compressed particles;
[0209] (2) If the fitness of the compressed particle is less than the fitness of the global worst particle, the compressed particle is used to replace the global worst particle;
[0210] (3) Otherwise, update the position of each particle in the population according to the global optimal particle.
[0211] In one possible implementation, updating the position of each particle in the population according to the global optimal particle may include:
[0212] Based on the global optimal particle, the position of each particle in the population is updated in combination with the first formula;
[0213] The first formula may include:
[0214]
[0215] in, For the population The position of the particle, is the position of the global optimal particle, is the shrinkage coefficient.
[0216] In a possible implementation, obtaining reflected particles through a reflection operation may include:
[0217] The second formula is used to determine the reflected particles;
[0218] The second formula may include:
[0219]
[0220]
[0221] in, is the position of the reflected particle, is the reflection coefficient, is the position of the global worst particle, Remove the center position of the global worst particle for the current population, For the population The position of the particle, is the total number of particles in the population.
[0222] In a possible implementation, obtaining the expanded particle through the expansion operation may include: determining the expanded particle using a third formula;
[0223] The third formula may include:
[0224]
[0225] Obtaining compressed particles through the compression operation may include: determining the compressed particles using the fourth formula;
[0226] The fourth formula may include:
[0227]
[0228] in, is the position of the expanded particle, Remove the center position of the global worst particle for the current population, is the position of the reflected particle, is the expansion coefficient; is the position of the compressed particle, is the compression coefficient, is the position of the global worst particle; is the fitness function.
[0229] In a possible implementation, the initialization unit may be specifically configured to:
[0230] Use the fifth formula to generate the initial population in the search space;
[0231] The fifth formula may include:
[0232]
[0233]
[0234]
[0235] in, , , The first The x-axis coordinate, y-axis coordinate and z-axis coordinate of each particle; 、 、 is an adjustable parameter; , is the total number of particles in the population.
[0236] Figure 6 FIG. 3 is a schematic diagram of an electronic device 3 provided in an embodiment of the present invention. Figure 6 As shown, the electronic device 3 of this embodiment includes a processor 30 and a memory 31. The memory 31 stores a computer program 32. When the processor 30 executes the computer program 32, the steps of the above-described method embodiments are implemented. Alternatively, when the processor 30 executes the computer program 32, the functions of the modules / units in the above-described device embodiments are implemented.
[0237] Exemplarily, the computer program 32 may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 30 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program 32 in the electronic device 3.
[0238] The electronic device 3 may include, but is not limited to, a processor 30 and a memory 31. Those skilled in the art will appreciate that Figure 6 It is only an example of electronic device 3 and does not constitute a limitation of electronic device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, electronic device 3 may also include input and output devices, network access devices, buses, etc.
[0239] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0240] The memory 31 can be an internal storage unit of the electronic device 3, such as the hard drive or memory of the electronic device 3. The memory 31 can also be an external storage device of the electronic device 3, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the electronic device 3. Furthermore, the memory 31 can include both the internal storage unit of the electronic device 3 and an external storage device. The memory 31 is used to store the computer program 32 and other programs and data required by the electronic device 3. The memory 31 can also be used to temporarily store data that has been output or is about to be output.
[0241] For the sake of convenience and brevity, the division of the above functional modules / units is only used as an example. In actual applications, the above functions can be assigned to different functional modules / units as needed. The above modules / units can be implemented in the form of hardware, software, or a combination of hardware and software.
[0242] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods in the above-mentioned method embodiments.
[0243] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the methods in the above-mentioned method embodiments.
[0244] The term "computer program" includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. Computer-readable media may include any entity or device capable of carrying computer program code, recording media, USB flash drives, removable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunications signals, and software distribution media.
[0245] In the above embodiments, the descriptions of each embodiment have their own focus. For parts not described or recorded in detail in one embodiment, please refer to the relevant descriptions of other embodiments. Unless otherwise specified or there is a logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other. The technical features of different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0246] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A proportional valve PID control method based on improved particle swarm optimization algorithm, characterized in that: include: Acquiring operating parameters of the proportional valve and establishing a PID controller model based on the operating parameters; The parameters of the PID controller model are optimized using a particle swarm algorithm, and the particles are updated in combination with a simplex method to obtain target control parameters; wherein the target control parameters include: a proportional coefficient, an integral coefficient, and a differential coefficient; Sending the target control parameter to a PID controller for controlling the proportional valve; The particle swarm algorithm is used to optimize the parameters of the PID controller model, and the simplex method is combined to update the particles to obtain the target control parameters, including: Setting a parameter search space and generating an initial population in the search space using an improved Lorenz chaos algorithm; wherein the proportional coefficient, the integral coefficient, and the differential coefficient correspond to the x-axis coordinate, the y-axis coordinate, and the z-axis coordinate of the particle, respectively; Calculating the fitness of each particle in the initial population, and taking the minimum value of each fitness as the global optimal value; Update the speed and position of each particle in the population; The simplex method is used to update the position of each particle in the population, and the fitness of each particle in the population is calculated, and the minimum value of each fitness is used as the optimal value of the current iteration; If the optimal value of the current iteration is less than the current global optimal value, the optimal value of the current iteration is used as the new global optimal value; otherwise, the global optimal value is not updated; Determine whether the maximum number of iterations has been reached; If yes, the position of the particle corresponding to the current global optimal value is used as the target control parameter; Otherwise, jump to the step of updating the speed and position of each particle in the population and continue executing; The step of generating an initial population in the search space by using the improved Lorenz chaos algorithm includes: Generating the initial population in the search space using the fifth formula; The fifth formula includes: in, , , The first The x-axis coordinate, y-axis coordinate and z-axis coordinate of each particle; 、 、 is an adjustable parameter; , is the total number of particles in the population.
2. The proportional valve PID control method based on improved particle swarm optimization algorithm according to claim 1 is characterized in that: The method of updating the position of each particle in the population by using the simplex method includes: Get the fitness of each particle in the population and sort them in ascending order; The particle with the smallest fitness is regarded as the global optimal particle, the particle with the largest fitness is regarded as the global worst particle, and the particle before the global worst particle is regarded as the global previous difference point; Obtain reflected particles through reflection operation; Calculating the fitness of the reflected particle, the fitness of the global optimal particle, and the fitness of the global previous difference respectively; If the fitness of the reflected particle is not less than the fitness of the global optimal particle and is less than the fitness of the global previous worst point, the reflected particle is used to replace the global worst particle; If the fitness of the reflected particle is less than the fitness of the global optimal particle, an expansion operation is performed to obtain an expanded particle, and the position of each particle in the population is updated according to the expanded particle; If the fitness of the reflected particle is not less than the fitness of the global previous difference point, a compressed particle is obtained through a compression operation, and the position of each particle in the population is updated according to the compressed particle.
3. The proportional valve PID control method based on improved particle swarm optimization algorithm according to claim 2 is characterized in that: The updating of the position of each particle in the population according to the expanded particle comprises: Calculating the fitness of the expanded particle; If the fitness of the expansion particle is less than the fitness of the reflection particle, the expansion particle is used to replace the global worst particle; Otherwise, the reflection particle is used to replace the global worst particle.
4. The proportional valve PID control method based on improved particle swarm optimization algorithm according to claim 2 is characterized in that: The updating of the position of each particle in the population according to the compressed particles comprises: calculating the fitness of the compressed particles; If the fitness of the compressed particle is less than the fitness of the global worst particle, the compressed particle is used to replace the global worst particle; Otherwise, the position of each particle in the population is updated according to the global optimal particle.
5. The proportional valve PID control method based on improved particle swarm optimization algorithm according to claim 4 is characterized in that: The updating of the position of each particle in the population according to the global optimal particle includes: According to the global optimal particle, the position of each particle in the population is updated in combination with the first formula; The first formula includes: in, For the population The position of the particle, is the position of the global optimal particle, is the shrinkage coefficient.
6. The proportional valve PID control method based on improved particle swarm optimization algorithm according to claim 2 is characterized in that: Obtaining the reflected particles through the reflection operation includes: Determining the reflective particles using a second formula; The second formula includes: in, is the position of the reflecting particle, is the reflection coefficient, is the position of the global worst particle, Remove the center position of the global worst particle from the current population, For the population The position of the particle, is the total number of particles in the population.
7. The proportional valve PID control method based on improved particle swarm optimization algorithm according to claim 2 is characterized in that: The obtaining of the expanded particles by the expansion operation includes: determining the expanded particles using a third formula; The third formula includes: The obtaining of compressed particles by the compression operation includes: determining the compressed particles using a fourth formula; The fourth formula includes: in, is the position of the expanded particle, Remove the center position of the global worst particle from the current population, is the position of the reflecting particle, is the expansion coefficient; is the position of the compressed particle, is the compression coefficient, is the position of the global worst particle; is the fitness function.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the proportional valve PID control method based on the improved particle swarm algorithm according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Artificial bee colony optimization method based on local searching capability improvement
CN107145934A