A method for setting parameters of a PID system based on an enhanced whale optimization algorithm

By introducing a multi-random number lateral crossover mutation mechanism into the whale optimization algorithm, the problem of limited search space in PID parameter tuning of the traditional whale optimization algorithm is solved, realizing more efficient PID system parameter tuning, which is suitable for complex systems.

CN119376231BActive Publication Date: 2026-03-17HUBEI UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Traditional whale optimization algorithms have limited effective exploration of the search space during PID parameter tuning, resulting in non-global optimal solutions, especially in high-dimensional, nonlinear, or multi-local optimal problems.

Method used

A multi-random number horizontal crossover mutation mechanism is introduced into the whale optimization algorithm to enhance the mutation process of PID system parameters, increase randomness and range, and improve the optimization ability of the whale optimization algorithm.

Benefits of technology

It improves the effectiveness of PID system parameter tuning, avoids the problem of low efficiency and easy getting trapped in local optima during local search, and enhances the applicability of parameter tuning for complex systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376231B_ABST
    Figure CN119376231B_ABST
Patent Text Reader

Abstract

The application relates to a PID system parameter setting method based on an enhanced whale optimization algorithm, and belongs to the technical field of PID setting. The PID system parameter setting method comprises the following steps: initializing parameters of the whale optimization algorithm, setting a maximum iteration number, taking PID system parameters including proportional gain, integral time constant and differential time constant as whale individuals and randomly generating a plurality of initial values to form an initial whale population; iteratively updating a global optimal individual in the initial whale population, and introducing a multi-random number horizontal crossover mutation mechanism for new individuals generated after updating, wherein the new individuals represent updated PID system parameters; and outputting the new individuals after updating and mutation when a preset iteration stop condition is reached, so that the setting is completed. The application effectively solves the problem that, in the prior art, the effective exploration of a search space is limited, and the obtained result is not a global optimal solution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of PID tuning technology, and in particular to a method for tuning PID system parameters based on the enhanced whale optimization algorithm. Background Technology

[0002] PID parameter tuning is a complex process that generally requires gradual adjustments based on the target object. Two common methods are the extended critical proportional gain tuning method and the extended response curve method.

[0003] With the development of technology, the Whale Optimization Algorithm (WOA) has been widely used in the process of PID parameter tuning. However, in the mutation process of the traditional Whale Optimization Algorithm, the offspring individuals are usually generated by a simple linear combination of the parent individuals, which may limit the effective exploration of the search space, especially when dealing with high-dimensional, nonlinear or problems with multiple local optima. Summary of the Invention

[0004] In view of this, it is necessary to provide a PID system parameter tuning method based on the enhanced whale optimization algorithm to solve the problem that the results obtained by the existing technology are not the global optimal solution due to the limited effective exploration of the search space.

[0005] To address the aforementioned problems, this invention provides a PID system parameter tuning method based on an enhanced whale optimization algorithm, comprising:

[0006] Initialize the parameters of the whale optimization algorithm, set the maximum number of iterations, and use the PID system parameters, including proportional gain, integral time constant and derivative time constant, as individual whales and randomly generate several initial values ​​to form an initial whale population;

[0007] The global optimal individual in the initial whale population is iteratively updated, and a multi-random number horizontal crossover mutation mechanism is introduced into the new individual generated after the update. Here, the new individual represents the PID system parameters after numerical update.

[0008] When the preset iteration stopping condition is met, the updated and mutated new individual is output, and the tuning is completed.

[0009] In one possible implementation, the iterative update of the globally optimal individual in the initial value includes:

[0010] Randomly generate stage selection parameters, and determine the next stage of the algorithm based on the stage selection parameters.

[0011] In one possible implementation, the parameters selected during the generation phase include: random numbers. p and coefficient vectorA ;

[0012] The step of determining the next stage of the algorithm based on the stage selection parameters includes:

[0013] when At that point, the algorithm is confirmed to have entered the spiral attack phase;

[0014] when and At this point, the algorithm is determined to enter the random search phase;

[0015] when and At this point, the algorithm is determined to have entered the prey-encircling phase.

[0016] In one possible implementation, during the prey-encircling phase, the globally optimal individual in the initial values ​​is updated based on the following formula:

[0017]

[0018] In the formula, t Indicates the number of iterations; A and C It is a coefficient vector; It is the position vector of the current best individual; It is the position vector of the remaining whales; This represents the position vector of the optimal individual after the update.

[0019] In one possible implementation, during the spiral attack phase, the globally optimal individual in the initial values ​​is updated based on the following formula:

[0020]

[0021] In the formula, Indicates the position between the whale and its prey. b It is a constant used to define the shape of the helix. l It is a random number in (-1, 1).

[0022] In one possible implementation, during the random search phase, the globally optimal individual in the initial values ​​is updated based on the following formula:

[0023]

[0024] In the formula, This indicates the location of a random individual whale.

[0025] In one possible implementation, the introduction of a multi-random-number horizontal crossover mutation mechanism into the newly generated individuals after the update includes:

[0026] A multi-random number horizontal crossover mutation mechanism is introduced for the new individuals generated in the prey-encircling phase of the whale algorithm.

[0027] In one possible implementation, the new individuals generated during the prey-encircling phase of the whale algorithm introduce a multi-random number lateral crossover mutation mechanism, including:

[0028] The mutation formula is used to mutate new individuals generated during the prey encirclement phase of the whale algorithm.

[0029] The mutation formula includes:

[0030]

[0031] In the formula, r 1. c 1 is a random number in the range [0,1]. , , For new individuals A i PID parameters, , , For new individuals A n PID parameters, , , For the new individual after mutation A i+1 The PID parameters, where, This represents the proportional gain in the PID parameters. Represents the integration time constant. This represents the differential time constant.

[0032] In one possible implementation, r 1. c 1. In the calculation of proportional gain Integral time constant and differential time constant The values ​​in the formula are independent of each other.

[0033] In one possible implementation, the preset iteration stopping condition includes:

[0034] The whale algorithm has reached its maximum set number of iterations.

[0035] The beneficial effects of this invention are as follows: This invention provides a PID system parameter tuning method based on an enhanced whale optimization algorithm. The whale optimization algorithm is applied to the parameter tuning process of a PID system, and a multi-random number lateral crossover mutation method is introduced into the whale optimization algorithm. Since the multi-random number lateral crossover mutation method can increase the randomness and range of the mutation process, by increasing the number of random factors in the mutation process, the diversity of offspring individuals and the overall optimization ability of the algorithm are enhanced. This makes the improved whale optimization algorithm more suitable for tuning complex PID system parameters, thereby effectively solving the problem that the results obtained by existing technologies are not globally optimal solutions due to the limited effective exploration of the search space. Attached Figure Description

[0036] Figure 1 This is a flowchart illustrating an embodiment of the PID system parameter tuning method based on the enhanced whale optimization algorithm provided by the present invention.

[0037] Figure 2 for Figure 1 The flowchart of step S101. Detailed Implementation

[0038] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0039] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0040] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.

[0041] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0042] To solve the above problems, such as Figure 1As shown, this invention provides a method for tuning PID system parameters based on the enhanced whale optimization algorithm, comprising:

[0043] S101. Initialize the parameters of the whale optimization algorithm, set the maximum number of iterations, and use the PID system parameters, including proportional gain, integral time constant and derivative time constant, as individual whales and randomly generate several initial values ​​to form an initial whale population.

[0044] S102. Iteratively update the globally optimal individual in the initial whale population, and introduce a multi-random number horizontal crossover mutation mechanism for the new individuals generated after the update.

[0045] Here, the new individual represents the updated PID system parameters;

[0046] S103. When the preset iteration stopping condition is met, output the updated and mutated new individual to complete the tuning.

[0047] It should be noted that after obtaining the mutated new individuals in each iteration, the fitness of the new individuals needs to be compared with the global best individuals in the initial value. The individuals with better performance will be selected into the next generation of the population.

[0048] In one possible implementation, the preset iteration stopping condition includes: the number of iterations of the whale algorithm reaches the set maximum number of iterations.

[0049] Compared with existing technologies, this invention provides a PID system parameter tuning method based on an enhanced whale optimization algorithm. The whale optimization algorithm is applied to the parameter tuning process of PID systems, and a multi-random number lateral crossover mutation method is introduced into the whale optimization algorithm. Since the multi-random number lateral crossover mutation method can increase the randomness and range of the mutation process, by increasing the number of random factors in the mutation process, the diversity of offspring individuals and the overall optimization ability of the algorithm are enhanced. This makes the improved whale optimization algorithm more suitable for tuning complex PID system parameters, thus effectively solving the problem that existing technologies suffer from low efficiency and are prone to getting trapped in local optima during local searches due to the lack of an effective control mechanism.

[0050] like Figure 2 In one possible implementation, step S102 includes:

[0051] S201. Randomly generate stage selection parameters and determine the next stage of the algorithm based on the stage selection parameters.

[0052] Furthermore, the parameters selected during the generation phase include: random numbers. p and coefficient vector A .

[0053] Step S201 includes:

[0054] Based on randomly generated random numbers p and coefficient vector A The algorithm is determined to enter the attack phase for updating the optimal individual, including:

[0055] when At that point, the algorithm is confirmed to have entered the spiral attack phase;

[0056] when and At this point, the algorithm is determined to enter the random search phase;

[0057] when and At this point, the algorithm is determined to have entered the prey-encircling phase.

[0058] In one possible implementation, during the prey encirclement phase, the globally optimal individual from the initial values ​​is updated based on the following formula:

[0059] (1)

[0060] In equation (1), t Indicates the number of iterations; A and C It is a coefficient vector; It is the position vector of the current best individual; It is the position vector of the remaining whales; This represents the position vector of the optimal individual after the update.

[0061] In one possible implementation, during the spiral attack phase, the globally optimal individual in the initial values ​​is updated based on the following formula:

[0062] (2)

[0063] In equation (2), Indicates the position between the whale and its prey. b It is a constant used to define the shape of the helix. l It is a random number in (-1, 1).

[0064] In one possible implementation, during the random search phase, the globally optimal individual from the initial values ​​is updated based on the following formula:

[0065] (3)

[0066] In equation (3), This indicates the location of a random individual whale.

[0067] In one possible implementation, step S102 further includes:

[0068] S202. Introduce a multi-random number horizontal crossover mutation mechanism for the new individuals generated in the prey encirclement phase of the whale algorithm.

[0069] In one possible implementation, step S202 includes:

[0070] The mutation formula is used to mutate new individuals generated during the prey encirclement phase of the whale algorithm.

[0071] The mutation formulas include:

[0072] (4)

[0073] In equation (4), r 1. c 1 is a random number in the range [0,1]. , , For new individuals A i PID parameters, , , For new individuals A n PID parameters, , , For the new individual after mutation A i+1 The PID parameters, where, This represents the proportional gain in the PID parameters. Represents the integration time constant. This represents the differential time constant.

[0074] Specifically, after the WOA whale algorithm completes one generation of offspring individuals, the following procedure is introduced, and the next iteration will begin after the following procedure is completed:

[0075] (1) Initiate the mutation program of offspring individuals

[0076] % Add arithmetic cross

[0077] for cross_idx = 1:floor(SearchAgents_no / 2) % Perform crossover on half of the individuals

[0078] % Randomly select two different individuals

[0079] idx1 = randi(SearchAgents_no);

[0080] idx2 = idx1;

[0081] while idx2 == idx1

[0082] idx2 = randi(SearchAgents_no);

[0083] end

[0084] % Calculate the fitness of each individual separately.

[0085] fitness1 = Obj_PID_IAE(Positions(idx1,:));

[0086] fitness2 = Obj_PID_IAE(Positions(idx2,:));

[0087] (2) Generate random numbers to allow for variation in offspring individuals.

[0088] % Calculate new offspring individuals

[0089] a1 = rand();

[0090] c1 = 2 * rand - 1;

[0091] a2 = rand();

[0092] c2 = 2 * rand - 1;

[0093] a3 = rand();

[0094] c3 = 2 * rand - 1;

[0095] (3) Using the formula, generate new offspring individuals. K p , K i , K d value

[0096] avg_Kp=a1*(Positions(idx1,1))+(1-a1)*(Positions(idx2,1))+c1*(Positions(idx1,1)-Positions(idx2,1));

[0097] avg_Ki=a2*(Positions(idx1,2))+(1-a2)*(Positions(idx2,2))+c2*(Positions(idx1,2)-Positions(idx2,2));

[0098] avg_Kd=a3*(Positions(idx1,3))+(1-a3)*(Positions(idx2,3))+c3*(Positions(idx1,3)-Positions(idx2,3));

[0099] % Create a new individual

[0100] new_individual = [avg_Kp, avg_Ki, avg_Kd];

[0101] % Ensure the parameters of the new individual are within the limits.

[0102] new_individual = max(min(new_individual, ub), lb);

[0103] % Assess the fitness of new individuals

[0104] new_fitness = Obj_PID_IAE(new_individual);

[0105] (5) Perform offspring replacement

[0106] If the fitness of the new individual is better than that of one of its parents, then replace it.

[0107] if new_fitness <fitness1% Change '<' to '> ' for maximization problems

[0108] Positions(idx1,:) = new_individual;

[0109] elseif new_fitness <fitness2% Change '<' to '> ' for maximizationproblems

[0110] Positions(idx2,:) = new_individual;

[0111] end

[0112] end

[0113] In one possible implementation, r 1. c 1. In the calculation of proportional gain Integral time constant and differential time constant The values ​​in the formula are independent of each other.

[0114] It should be noted that the mutation mechanisms employed in this invention include:

[0115] Introduction of multiple random numbers: For each PID controller parameter (proportional gain) K p Integral time constant K i Differential time constant K d Generate two independent sets of random numbers respectively. r 1 and c 1. A total of six random numbers are used to increase the randomness and range of mutations. By introducing more random numbers, the range of mutations in offspring individuals is significantly increased, which helps to prevent the algorithm from converging to a local optimum too early.

[0116] Horizontal crossover mutation: Mutation is no longer a simple linear combination between two individuals, but adopts a horizontal crossover method. That is, for each parameter, different random numbers are used for independent mutation, which enhances the mutation ability of offspring individuals. In addition, the horizontal crossover mutation method also helps the algorithm to perform a more detailed search when it is close to the optimal solution region, accelerating the local optimization process.

[0117] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer medium. The computer medium can be a disk, optical disk, read-only memory, or random access memory, etc.

[0118] The above provides a detailed description of the PID system parameter tuning method based on the enhanced whale optimization algorithm provided by this invention. Specific examples have been used to illustrate the principle and implementation of this invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of ​​this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of ​​this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A PID system parameter setting method based on an enhanced whale optimization algorithm, characterized in that, Comprise: Initialize parameters of the whale optimization algorithm, set the maximum number of iterations, set the PID system parameters including proportional gain, integral time constant and derivative time constant as whale individuals and randomly generate several initial values to form an initial whale population; Iteratively update the global optimal individual in the initial whale population, and introduce a multi-random number horizontal crossover mutation mechanism for the new individual generated after updating, wherein the new individual represents the updated PID system parameters; Output the updated and mutated new individual when the preset iteration stopping condition is reached, and complete the tuning; The iteratively updating the global optimal individual in the initial value comprises: randomly generating a stage selection parameter, including: a random number p and a coefficient vector A ; Determining the next stage of the algorithm according to the stage selection parameter, comprising: When the determination algorithm enters the spiral attack phase; When and the determination algorithm enters the random search phase; When and the determination algorithm enters the surround prey phase; In the surround prey stage, update the global optimal individual in the initial value based on the following formula: wherein t denotes the number of iterations; A and C is the coefficient vector; is the position vector of the current best individual; is the position vector of the current remaining whale; denotes the position vector of the updated best individual; The multi-random number horizontal crossover mutation mechanism for the new individual generated after updating comprises: Introducing a multi-random number horizontal crossover mutation mechanism for the new individual generated by the surround prey stage of the whale algorithm; The multi-random number horizontal crossover mutation mechanism for the new individual generated by the surround prey stage of the whale algorithm comprises: Based on the mutation formula, the new individual generated by the surround prey stage of the whale algorithm is mutated; The mutation formula comprises: wherein r 1, c 1 is a random number in [0, 1], , , PID parameters of the new individual A i , , , PID parameters of the new individual A n , , , PID parameters of the mutated new individual A i+1 , wherein denotes a proportional gain in the PID parameters, denotes an integral time constant, denotes a derivative time constant. r 1、 c 1In the formulas for calculating the proportional gain , the integral time constant , and the derivative time constant , the values are independent of each other.

2. The PID system parameter tuning method of claim 1, wherein, In the spiral attack stage, update the global optimal individual in the initial value based on the following formula: wherein represents the position between the whale and the prey, b is a constant used to define the shape of the spiral, l is a random number in (-1, 1).

3. The method of tuning PID system parameters according to claim 1, wherein, In the random search stage, update the global optimal individual in the initial value based on the following formula: In the formulae, represents the position of a random whale individual.

4. The method of tuning PID system parameters according to claim 1, wherein, The preset iteration stopping condition comprises: The number of iterations of the whale algorithm reaches the set maximum number of iterations.