Voice coil motor PID controller parameter optimization method based on ant colony algorithm and fuzzy PID
Through the combination of ant colony algorithm and fuzzy PID optimization of the PID controller parameters of the voice coil motor, the problems of long adjustment time and large overshooting amount of traditional PID controllers are solved, and the rapid response and high robustness control of the voice coil motor are achieved.
Patent Information
- Application Number
- CN202510419371.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-11
AI Technical Summary
Traditional PID controller parameter setting depends on experience, long adjustment time, large overshoot, low efficiency, and intelligent optimization algorithms such as particle swarm algorithms are prone to local convergence.
The PID controller parameters are optimized by using ant colony algorithm, combined with the fuzzy PID control model, and dynamically adjust the proportion, integral, and differential gain coefficients through ant colony search and fuzzy logic inference to achieve adaptive optimization.
Significantly reduce overshoot and adjustment time, improve response speed and robustness, and improve system dynamic performance and control accuracy.
Smart Images

Figure CN120295095A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of voice coil motor control, and specifically designs a method for optimizing the parameters of a voice coil motor PID controller based on the ant colony algorithm and fuzzy PID. Background Technique
[0002] PID is the abbreviation of proportional integral differential, and it is a widely used control strategy at present. The parameters of traditional PID controllers mostly adopt the ZN method based on experience. This parameter setting method not only requires experience, but also has an overly long overshoot adjustment time, a large adjustment amount, and low efficiency.
[0003] At present, many methods for optimizing PID parameters have been developed. Among them, intelligent optimization algorithms have achieved effects that cannot be compared with traditional optimization algorithms in PID parameter tuning, such as fuzzy algorithms, genetic algorithms, etc. A relatively new optimization method that has emerged in recent years is the particle swarm algorithm. This algorithm has been highly regarded for its advantages such as easy implementation, fast convergence speed, and strong adaptability, but it still has the problem of being easily trapped in local convergence. Compared with the traditional ZN method, the control method of the ant colony algorithm plus fuzzy PID adopted by the present invention has greatly reduced overshoot and adjustment time, and has strong self-adaptability. It can dynamically adjust the PID parameters on the basis of the optimization of the ant colony algorithm, has stronger robustness, and better response speed. Summary of the Invention
[0004] The present invention provides a method for optimizing the parameters of a voice coil motor PID controller based on the ant colony algorithm and fuzzy PID to solve the technical problems existing in the above background technique.
[0005] The present invention adopts the following technical solutions: A method for optimizing the parameters of a voice coil motor PID controller based on the ant colony algorithm and fuzzy PID, including the following steps: Construct a position objective function and set the maximum number of iterations and the number of ants ; Create an initial amount of pheromone and an initial pheromone increment , and randomly generate the starting position of each ant based on the parameters of the position objective function . In each iteration, the temporary ant position matrix saves the candidate positions of the ants. After being evaluated by the objective function, the positions that meet the conditions are updated to the empty ant position matrix , and the pheromone matrix is updated synchronously, where ; Define the current iteration number as , , and execute each iteration according to the following steps: Traverse each ant , calculate the ant At the current iteration number of the movement probability , according to the movement probability select an ant for the next position , the ant moves according to the next position and moves to the neighborhood and extremely obtains the new position of the ant ; meanwhile, update and obtain the information increment at the current iteration number and the amount of information ; calculate the objective function values of the current positions of all ants, and output the minimum objective function value and the corresponding position; Based on the new position , the information increment at the current iteration number and the amount of information enter the th iteration until the iteration times; Find the minimum value among all the output minimum objective function values, and the ant position corresponding to the minimum value is the PID controller parameter: proportional gain coefficient , integral term gain coefficient and derivative gain coefficient .
[0006] In a further embodiment, the following steps are further included: Establish a fuzzy PID control model, and input the proportional gain coefficient , integral term gain coefficient and derivative gain coefficient into the fuzzy PID control model, and output the proportional gain coefficient difference , integral term gain coefficient difference and derivative gain coefficient difference ; Optimize the proportional gain coefficient , integral term gain coefficient and derivative gain coefficient to obtain the optimized proportional gain coefficient , integral term gain coefficient and derivative gain coefficient : .
[0007] In a further embodiment, the generation steps of the starting position of each ant include: Define the initial information volume as a matrix of all 1s , the initial information increment as a matrix of all 0s ; Create an empty ant position matrix and a temporary ant position matrix ; The empty ant position matrix is used to initialize and store the initial positions of all ants, providing an initial data container for position updates in subsequent iterations; the temporary ant position matrix is used to temporarily save the candidate positions of ants during the iteration process, calculating the intermediate state before the movement probability or pheromone update; According to the value range of each parameter in the position objective function, randomly generate the starting position of each ant .
[0008] In a further embodiment, the calculation method of the movement probability is as follows: Use the following formula to calculate the heuristic quantity between ant and its adjacent ant : ; wherein, is the objective function value of ant at the current position, is the objective function value of ant at the current position; Then, the movement probability is the probability that ant moves towards ant , and its formula expression form is: ; In the formula, is the pheromone amount at the position of ant , is the pheromone weight, is the heuristic weight, is the pheromone amount at the position of ant , ant and ant the heuristic quantity between them, ant is the ant adjacent to ant , .
[0009] In a further embodiment, the selection process of the next position of ant is as follows: Generate a random number , , calculate the movement probability of each ant, calculate the cumulative sum of all non-zero movement probabilities, and select the first position where the cumulative sum is greater than as the next position .
[0010] In a further embodiment, the new position of the ant is calculated as follows: ; where is the dimension of the position objective function, represents a random vector, is the interval reduction factor, is the current iteration number.
[0011] In a further embodiment, the information increment of the current iteration number is updated as follows: ; In the formula, is the objective function value of the ant at the current position, is the objective function value of the ant at the next position .
[0012] In a further embodiment, the update formula of the information amount is as follows: ; where is the pheromone evaporation factor, is the information amount of iteration .
[0013] In a further embodiment, the fuzzy PID control model includes: fuzzification, fuzzy logic inference, and defuzzification; Among them, the fuzzy PID control model uses a triangular membership function to divide the basic domain of the input variable into seven fuzzy levels from large to small: Negative large fuzzy level, negative medium fuzzy level, negative small fuzzy level, zero fuzzy level, positive small fuzzy level, positive medium fuzzy level, and positive large fuzzy level; Determine the level combination corresponding to the input variable, and finally generate the proportional gain coefficient difference , integral term gain coefficient difference and differential gain coefficient difference The adjustment amount to achieve dynamic optimization of PID parameters.
[0014] Advantages of the present invention: In motor displacement control, compared with other motor control methods, fuzzy PID fine-tunes the Kp, Ki, and Kd output by the ant colony algorithm, with the following advantages: The present invention realizes the adaptive dynamic adjustment of PID parameters through the global search and multi-round iteration mechanism of the ant colony algorithm: such as the defined iteration process (maximum number of loops NCmax) and pheromone update rule (pheromone and information increment ), enabling the ant colony to gradually approach the optimal solution in the search space. Correspondingly, in each round of iteration, the ants update the movement probability according to the objective function value and balance exploration and exploitation through the pheromone evaporation factor p, and finally output the globally optimal Kp, Ki, and Kd to achieve the adaptive optimization of parameters.
[0015] Combining the fuzzy inference rules of fuzzy logic to enhance the processing ability of nonlinear systems: The defined fuzzy PID control model uses triangular membership functions and 49 fuzzy rules to map the error e and the error change rate ec to the adjustment amounts of ΔKp, ΔKi, and ΔKd. For example, when the system is in a nonlinear state (such as an error mutation), the fuzzy rule "If (e is NB) and (ec is NB) then (ΔKp is PB)" quickly suppresses overshoot by adjusting the proportional gain, avoiding the linear limitations of traditional PID.
[0016] Improving the system robustness through the synergistic effect of the ant colony algorithm and fuzzy PID: The ant colony algorithm provides initial parameter optimization, and fuzzy PID fine-tunes in real time. The combination of the two reduces the dependence on an accurate mathematical model. Further, under external disturbances (such as load mutations), fuzzy PID dynamically corrects parameters according to real-time errors, and the global search ability of the ant colony algorithm ensures that the parameter adjustment does not fall into a local optimum. Description of the Drawings
[0017] Figure 1 It is the operation logic diagram of the ant colony algorithm.
[0018] Figure 2 It is the operation framework diagram of PID control.
[0019] Figure 3 It is in fuzzy PID Membership function diagram.
[0020] Figure 4 It is in fuzzy PID Membership function diagram.
[0021] Figure 5 It is in fuzzy PID Membership function diagram.
[0022] Figure 6 is fuzzy PID control 、 、 Adjustment amount diagram.
[0023] Figure 7 is a Simulink model diagram.
[0024] Figure 8 is a comparison diagram of the ant colony algorithm and the results of the present invention. Specific implementation manner
[0025] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention.
[0026] The existing PID controller adjusts the objective function through the combined action of proportional, integral, and differential.
[0027] Proportional control is the basic part of PID control, which directly correlates the error signal with the controller output in proportion. The proportional gain coefficient ( ) is the key parameter in proportional control, which determines the strength of proportional control. Proportional control can quickly respond to system errors, but it cannot eliminate the steady-state error when used alone.
[0028] The integral control part calculates the accumulated error in the past to eliminate the steady-state error. The integral term gain coefficient ( ) determines the strength of the integral action. Integral control can ensure that the system finally reaches the expected value, but it may cause the system response to slow down and may cause overshoot and oscillation.
[0029] The differential control part predicts the future trend of the error signal to reduce the overshoot and oscillation of the system. The differential gain coefficient ( ) is the key parameter in differential control. Differential control can improve the stability and response speed of the system, but it is sensitive to noise and has little effect when the system is close to the steady state.
[0030] The control of PID follows the formula: ; where represents the output signal of the controller, represents the deviation signal, and t is the time point.
[0031] However, ordinary PID control is sensitive to interference and difficult to adjust parameters. What the present invention does is to use the ant colony algorithm plus fuzzy PID to adjust the proportional gain coefficient , the integral term gain coefficient and the differential gain coefficient Optimize and adjust. The flowchart of the ant colony algorithm is as follows Figure 1 shown. The following describes the specific running steps according to the framework diagram: Construct a position objective function and set the maximum number of iterations and the number of ants ; Create the initial pheromone and the initial pheromone increment , and randomly generate the starting position of each ant based on the parameters of the position objective function . In each iteration, the temporary ant position matrix saves the candidate positions of the ants. After being evaluated by the objective function, the positions that meet the conditions are updated to the empty ant position matrix , and the pheromone matrix is updated synchronously, where ; Define the current iteration number as , , and execute each iteration according to the following steps: Traverse each ant , calculate the movement probability of ant at the current iteration number , select the next position of ant according to the movement probability , ant moves according to the next position , moves to the neighborhood of and obtains the new position of the ant extremely; At the same time, update the pheromone increment and the pheromone amount of the current iteration number based on the change of the function value of the objective function; Calculate the current position objective function values of all ants, and output the minimum objective function value and the corresponding position; ; Enter the th iteration until the pheromone increment and the pheromone amount of the current iteration number ; times; Find the minimum value among all the output minimum objective function values. The ant position corresponding to the minimum value is the PID controller parameter: proportional gain coefficient , integral term gain coefficient and derivative gain coefficient .
[0032] Furthermore, the starting position of each ant The generation steps include: Define the initial information volume as a matrix of all 1s , and the initial information increment as a matrix of all 0s ; Create an empty ant position matrix and a temporary ant position matrix ; The empty ant position matrix is used to initialize and store the initial positions of all ants, providing an initial data container for position updates in subsequent iterations; the temporary ant position matrix is used to temporarily save the candidate positions of ants during the iteration process, calculating the intermediate state before the movement probability or information update; According to the value range of each parameter in the position objective function, randomly generate the starting position of each ant .
[0033] The calculation method of the movement probability is as follows: Use the following formula to calculate the heuristic quantity between ant and the adjacent ant : ; Among them, is the objective function value of ant at the current position, is the objective function value of ant at the current position; Then, the movement probability is the probability that ant moves towards ant , and its formula expression form is: ; In the formula, is the information volume of the position of ant , is the information volume weight, is the heuristic quantity weight, is the information volume of the position of ant , ant and ant the heuristic quantity between them, ant is the ant adjacent to ant , .
[0034] The selection process of the next position of ant is as follows: Generate a random number , , calculate the movement probability of each ant, calculate the cumulative sum of all non-zero movement probabilities, and select the first position where the cumulative sum is greater than as the next position. .
[0035] The new position of the ant has the following calculation formula: ; where, is the dimension of the position objective function, represents a random vector, is the interval reduction factor, is the current iteration number.
[0036] Correspondingly, the information increment of the current iteration number has the following update formula: ; In the formula, is the objective function value of the ant at the current position, is the objective function value of the ant at the next position .
[0037] The update formula of the information amount is as follows: ; where, is the pheromone evaporation factor, is the information amount of the iteration .
[0038] In another embodiment, when the output proportional gain coefficient , integral term gain coefficient and derivative gain coefficient are obtained, in order to enhance the robustness and dynamic performance of the result and meet the adaptive ability and anti-interference ability of the voice coil motor, the present invention adds a fuzzy PID control on the basis of the ant colony algorithm. Further, the following steps are also included: Establish a fuzzy PID control model, input the proportional gain coefficient , integral term gain coefficient and derivative gain coefficient into the fuzzy PID control model, and output the proportional gain coefficient difference , integral term gain coefficient difference and derivative gain coefficient difference ; For the said proportional gain coefficient , integral term gain coefficient and derivative gain coefficient perform optimization to obtain the optimized proportional gain coefficient , integral term gain coefficient and derivative gain coefficient : .
[0039] Among them, the fuzzy PID control model uses triangular membership functions to divide the basic domain of the input variable into seven fuzzy levels from large to small: Negative large fuzzy level, negative medium fuzzy level, negative small fuzzy level, zero fuzzy level, positive small fuzzy level, positive medium fuzzy level, and positive large fuzzy level; Determine the level combination corresponding to the input variable, and finally generate the adjustment amount of the proportional gain coefficient difference , integral term gain coefficient difference and derivative gain coefficient difference through defuzzification by the weighted average method, realizing the dynamic optimization of the PID parameters.
[0040] Furthermore, that is, through the proportional gain coefficient , integral term gain coefficient and derivative gain coefficient obtain the error e and the error change rate ec. In this embodiment, the domain of each variable is divided into seven fuzzy levels by triangular membership functions: negative large fuzzy level (NB), negative medium fuzzy level (NM), negative small fuzzy level (NS), zero fuzzy level (Z0), positive small fuzzy level (PS), positive medium fuzzy level (PM), and positive large fuzzy level (PB). Taking ΔKp as an example, the coverage intervals of each level are: NB corresponds to [-3, -2], NM corresponds to [-2.5, -0.5], NS corresponds to [-1.5, 0.5], ZO corresponds to [-0.5, 0.5], PS corresponds to [0.5, 1.5], PM corresponds to [1.5, 2.5], and PB corresponds to [2, 3]. The fuzzy rule table (Table 1) is based on the level combination of the input variable, and through defuzzification by the weighted average method, finally generates the adjustment amounts of ΔKp, ΔKi, and ΔKd, realizing the dynamic optimization of the PID parameters.
[0041] For example, substitute the proportional gain coefficient , integral term gain coefficient and derivative gain coefficient into the simulink model diagram of the PID of the present invention as shown in Figure 7 , Figure 7 The simulink model operation framework diagram ofFigure 2 as shown
[0042] The fuzzy PID receives the error e and the error change rate ec. After being fuzzified first, it performs fuzzy inference under the action of the fuzzy rule table, and then undergoes defuzzification to obtain , , , and fine-tunes the , and of the ant colony algorithm. The specific adjustment range is as shown in the Figure 6 waveform diagram
[0043] Table 1 Therefore, this fuzzy rule table (Table 1) is also applicable to e and ec, as shown in the Figure 3 shown , , membership function graphs of,,. Their domain ranges are different, and the inputs e and ec are exactly the same as . According to the , and given by the ant colony algorithm, set the membership function range of to [-3, 3], set the membership function range of ΔKi to [-0.2, 0.2], and set the membership function range of to [-0.02, 0.02].
[0044] There are a total of 49 rules in the table, and the rule form is as follows, and so on: 1. If (e is NB) and (ec is NB) then (kp is PB)(ki is NB)(kd is PS) (1) 2. If (e is NB) and (ec is NM) then (kp is PB)(ki is NB)(kd is NS) (1) In the simulink simulation diagram, there are the following modules: the step function module step, which inputs a step signal, the fuzzy PID module, the constant module responsible for inputting the Kp, Ki, Kd values obtained by the ant colony algorithm, the transfer function module, and the scope module for the final image display. And in order to compare the optimization effect, a conventional PID module is added below. Since the parameters of the PID are too cumbersome to adjust, the input is the calculation result of the ant colony algorithm, which can better compare the advantages of this algorithm. The final result comparison diagram is as shown in Figure 8 as shown
[0045] According to Figure 8 Figure 8 Through comparison, it can be seen that when acting on the voice coil motor, the control method of the present invention reduces the overshoot by 15% and shortens the response time by 20%, which is better than a single algorithm. The adjustment time of the system under step input is less than 50 ms, meeting the requirements of the high-speed response of the voice coil motor. It is more advantageous than the ant colony algorithm in terms of overshoot and stability.
[0046] Moreover, the dynamic parameter adjustment performance of the present invention is much stronger than that of the pure PID, and the control accuracy is also higher. Generally speaking, it better meets the requirements of the voice coil motor. It not only solves the problem of difficult adjustment of PID parameters, but also greatly alleviates the problems of poor dynamic performance and low robustness of PID parameters. Therefore, combining the ant colony algorithm and fuzzy PID helps the practical application and popularization of PID control technology in voice coil motors and even other fields.
[0047] All in all, the ant colony algorithm in this embodiment drives parameter search through the objective function without the need to establish a motor transfer function; fuzzy PID adjusts parameters through empirical rules, avoiding complex mathematical modeling. When there is a lack of an accurate motor model, stable control can still be achieved by adjusting the fuzzy rule table (Table 1) and the number of ant colony iterations (NCmax), reducing the development cost.
Claims
1. A method for optimizing the parameters of a PID controller of a voice coil motor based on the ant colony algorithm and fuzzy PID, characterized in that, It includes the following steps: Construct the position objective function and set the maximum number of iterations and the number of ants ; Create the initial pheromone and the initial pheromone increment , and randomly generate the starting position of each ant based on the parameters of the position objective function . In each iteration, the temporary ant position matrix saves the candidate positions of the ants. After being evaluated by the objective function, the positions that meet the conditions are updated to the empty ant position matrix , and the pheromone matrix is updated synchronously, where ; Define the current iteration number as , , and perform each iteration according to the following steps: Traverse each ant , calculate the ant's movement probability at the current iteration , and select the ant's next position according to the movement probability . The ant moves according to the next position and moves to the neighborhood and finally gets the ant's new position ; meanwhile, update the information increment and the amount of information at the current iteration based on the change in the function value of the objective function; calculate the objective function values of the current positions of all ants, and output the minimum objective function value and the corresponding position; Based on the new position and the current iteration number the information increment and the amount of information enter the th iteration until the th iteration; Find the minimum value among all the minimum objective function values output. The ant position corresponding to this minimum value is the PID controller parameter: the proportional gain coefficient , the integral term gain coefficient and the derivative gain coefficient .
2. The method for optimizing the PID controller parameters of a voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that, It also includes the following steps: Establish a fuzzy PID control model, and input the proportional gain coefficient , integral term gain coefficient , and derivative gain coefficient into the fuzzy PID control model, and output the difference of the proportional gain coefficient , the difference of the integral term gain coefficient , and the difference of the derivative gain coefficient ; For the proportional gain coefficient , the integral term gain coefficient and the derivative gain coefficient , optimize them to obtain the optimized proportional gain coefficient , the integral term gain coefficient and the derivative gain coefficient : 。 3. The parameter optimization method of the PID controller for a voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that, The starting position of each ant The generation steps include: Define the initial information volume is a matrix of all 1s , the initial information increment is a matrix of all 0s ; Create an empty ant position matrix and a temporary ant position matrix ; The empty ant position matrix is used to initialize and store the initial positions of all ants, providing an initial data container for position updates in subsequent iterations; The temporary ant position matrix is used to temporarily save the candidate positions of ants during the iteration process, calculate the movement probability or the intermediate state before pheromone update; Generate the starting position of each ant randomly according to the value range of each parameter in the position objective function .
4. The parameter optimization method of the voice coil motor PID controller based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that The moving probability is calculated as follows: Calculate the ant using the following formula and the adjacent ant for the heuristic value : ; Among them, is the ant at the current position of the objective function value, is the ant at the current position of the objective function value; Then, the movement probability is for the ant to move towards the ant The probability of movement, and its formula expression is: ; In the formula, is the amount of information at the position of the ant , is the information quantity weight, is the heuristic quantity weight, is the amount of information at the position of the ant , the heuristic quantity between the ant and the ant . For the ant , it is the ant adjacent to the ant , .
5. The parameter optimization method of the PID controller of the voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that The ant mentioned above for its next position is selected as follows: Generate a random number , , calculate the movement probability of each ant, calculate the cumulative sum of all non-zero movement probabilities, and select the position where the first cumulative sum is greater than as the next position .
6. The parameter optimization method of the PID controller of the voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that The new position of the ant The calculation formula is as follows: ; Among them, is the dimension of the position objective function, represents a random vector, is the interval reduction factor, is the current iteration number.
7. The method for optimizing the parameters of the PID controller of the voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that The current iteration count of the information increment The update formula is as follows: ; Wherein, is the ant at the objective function value of the current position, is the ant at the next position of the objective function value.
8. The method for optimizing the parameters of the PID controller of the voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 1, characterized in that, The amount of information The update formula is as follows: ; among them, is the pheromone volatilization factor, is the iteration information volume.
9. The method for optimizing the parameters of the PID controller of the voice coil motor based on the ant colony algorithm and fuzzy PID according to claim 2, characterized in that, The fuzzy PID control model includes: fuzzification, fuzzy logic inference, and defuzzification; Among them, the fuzzy PID control model uses the triangular membership function to divide the basic domain of the input variable into seven fuzzy levels from large to small: Negative large fuzzy level, negative medium fuzzy level, negative small fuzzy level, zero fuzzy level, positive small fuzzy level, positive medium fuzzy level, and positive large fuzzy level; Determine the level combination corresponding to the input variables, and finally generate the difference of the proportional gain coefficient through defuzzification by the weighted average method , the difference of the integral term gain coefficient and the difference of the derivative gain coefficient adjustment amount to achieve dynamic optimization of PID parameters.