A method for optimizing kennel environmental temperature control
By improving the Big Cane Rat algorithm and using the dominant convergence mutation strategy, adaptive dynamic factors and local optimization disturbance strategy, the PID controller of the kennel environment temperature control system is optimized, which solves the tedious parameter adjustment and local optimal problems of the traditional PID controller. , achieving faster and more precise temperature control effects.
Patent Information
- Application Number
- CN202410923965.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-07-11
AI Technical Summary
In the kennel environment temperature control, the traditional PID controller has cumbersome parameter adjustment and relies on experience. It is difficult to achieve rapid response and precise adjustment in complex environments, and it is easy to fall into the local optimal solution, resulting in low control accuracy.
Improve the Big Cane Rat algorithm by introducing the dominant convergence mutation strategy, adaptive dynamic factors and local optimization disturbance strategy to optimize the Kp, Ki and Kd parameters of the PID controller, improve the convergence speed and robustness of the algorithm, and avoid local optimality traps for faster and more accurate parameter tuning.
It significantly improves the response speed and robustness of the temperature control system, ensures the accuracy and stability of temperature adjustment, reduces the parameter setting time, and enhances the adaptability and accuracy of the control system.
Smart Images

Figure CN118466173B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of PID control optimization, and in particular relates to a kennel environmental temperature control optimization method. Background Art
[0002] The temperature control system plays an important role in the kennel environment. Too high or too low temperature in the kennel may affect the health of the dog. A better temperature control system aims to provide a stable and comfortable environment to ensure the health of the dog. The temperature is collected mainly through high-precision temperature sensors. These sensors can accurately monitor the environmental parameters in the kennel and transmit the data to the intelligent controller. The controller can automatically adjust the heating, cooling and ventilation equipment according to the preset program. Modern temperature control systems also have remote monitoring and control functions. Through the Internet or local area network, managers can adjust the system settings anytime and anywhere. In order to provide accurate and stable temperature regulation control, PID controllers are generally used to control the temperature control system. Thanks to the easy implementation, high accuracy and good stability of PID control, an efficient and reliable kennel temperature control system can be formed to ensure the health and comfort of the dog.
[0003] PID control combines three strategies: proportional control (P), integral control (I) and differential control (D). Proportional control adjusts the output according to the current error to provide immediate response; integral control accumulates errors to eliminate long-term steady-state errors; differential control predicts error trends and suppresses rapid changes. Through these three methods, PID controllers achieve fast response, precise adjustment and system stability, and are widely used in fields such as temperature control. The PID control algorithm is simple and efficient, easy to implement in modern microprocessors and controllers, and can automatically adjust and optimize to improve system adaptability and reliability. However, the performance of traditional PID controllers depends on the correct setting of proportional, integral and differential parameters. Manual adjustment of these parameters may require a lot of experience and experiments, especially when the system is complex or the environment is difficult to predict. The intelligent optimization algorithm can automatically search for the best PID parameter combination, avoiding the tedious process of manual parameter adjustment and significantly improving the performance and adaptability of the PID controller.
[0004] The Great Cane Rat Algorithm (GCRA) is a new meta-heuristic algorithm. The optimization process of GCRA is inspired by the intelligent foraging behavior of the great cane rat in the mating season and the non-mating season. The algorithm is designed to solve complex optimization problems by simulating the exploration and exploitation behavior of the great cane rat in the foraging process. With its advantages of being easy to implement, strong adaptability and efficient convergence speed, it performs well in a variety of optimization problems. However, like other meta-heuristic algorithms, GCRA also has some limitations, such as the possibility of falling into local optimality and parameter sensitivity. By improving the Great Cane Rat Algorithm, the performance of the algorithm can be improved, so as to better optimize the PID control parameters. Summary of the invention
[0005] The purpose of the present invention is to propose a kennel environmental temperature control optimization method, which optimizes the PID controller of the kennel environmental temperature control system by improving the big cane rat algorithm. The improved big cane rat algorithm has better optimization performance and can adjust the three parameters Kp, Ki, and Kd of the PID faster and more accurately, thereby increasing the robustness and adaptability of the kennel environmental temperature control system.
[0006] In order to achieve the above-mentioned purpose, the present invention adopts a kennel environmental temperature control optimization method, and the specific steps of the method are as follows.
[0007] S1. Construct a kennel environment temperature control system, wherein the control system includes an error calculation module, a PID controller module, an improved large cane rat algorithm module, a temperature signal control module, a temperature regulator module, and a temperature detection module.
[0008] S2. Improve the big cane rat algorithm. The specific improvement strategy is as follows:
[0009] S21: Propose a dominant convergence mutation strategy based on the dominant male in the population. The mathematical model of population variation is constructed based on the position of the population, and the position of the initial population is mutated through the mathematical model;
[0010] S22: The mathematical model of the exploration phase of the cane rat algorithm is improved by introducing an adaptive dynamic factor AF, which automatically adjusts the size according to the fitness of each search agent, thereby controlling the update of the search agent position;
[0011] S23: A local optimization perturbation strategy is used to improve the mathematical model of the development phase of the cane rat algorithm. The change in the fitness value of the local optimum selected each time is used to determine whether the algorithm's optimization has fallen into a local optimal solution. Different update strategies are called to perturb the position of the population to continue the optimization.
[0012] S3. Use the improved cane rat algorithm to adjust the parameters of the PID controller of the kennel environmental temperature control system, and obtain the optimal values of the three parameters Kp, Ki, and Kd through algorithm optimization.
[0013] S4: Apply the three PID parameters set in S3 to the kennel environment temperature control system to optimize the control effect of the system and achieve precise temperature regulation.
[0014] Preferably, in the kennel environmental temperature control system described in S1, the kennel target temperature is first input into the control system, and is input into the error calculation module together with the actual kennel temperature fed back by the temperature detection module to obtain a real-time error e(t). The error e(t) is input into the PID controller module and optimized by the improved large cane rat algorithm. The optimized control signal is transmitted to the temperature signal controller to control the temperature adjustment, and the target temperature is finally reached through the adjustment of the kennel environmental temperature control system.
[0015] Preferably, within the framework of the cane rat algorithm design, the individual whose position vector produces the best target value is called the dominant male individual. The dominant convergence mutation strategy is to perform mutation behavior on the initial population based on the optimal individual before the algorithm iteration as the leader, while ensuring the diversity of the population and increasing the convergence speed of the algorithm. The mathematical model of population mutation is:
[0016] (1);
[0017] In formula (1), represents the updated position of the jth dimension of the i-th search agent in the population, represents the position of the dominant male on the jth dimension, represents the i-th search agent in the population, the original position of the j-th dimension, γ represents the variation amplitude with a value of 0.5, β represents the random number generated by the normal distribution, ub is the upper limit of the search space, and lb is the lower limit of the search space.
[0018] Preferably, by updating the position of the initial population through the dominant convergence mutation strategy, the population quality before the algorithm iteration can be better guaranteed, the convergence speed of the algorithm can be increased, and the effect of the PID controller can quickly reach a more stable state, wherein the normally distributed random number β can ensure the diversity of the population after mutation, and the mutation amplitude γ can control the change in the distance difference between each search agent and the dominant male.
[0019] Preferably, the mathematical model of the exploration phase of the cane rat is improved by using the adaptability factor AF, and the improved mathematical model of the exploration phase is:
[0020] (2);
[0021] In formula (2), represents the updated position of the jth dimension of the i-th search agent in the population, represents the position of the dominant male on the jth dimension, represents the i-th search agent in the population, the original position of the j-th dimension, AF represents the adaptability factor, and its mathematical model is shown in formula (3), r represents the iteration factor, and its mathematical model is shown in formula (4):
[0022] (3);
[0023] In formula (3), represents the initial value of the adaptability factor, represents the maximum value of the fitness factor, current_fitness represents the fitness value of the current search agent, and best_fitness represents the optimal fitness value;
[0024] (4);
[0025] In formula (4), It represents the fitness value of the dominant male, iter represents the current iteration number, and Max_iter represents the maximum iteration number.
[0026] Preferably, the adaptability factor AF can adjust the update amplitude of the current position by the ratio of the fitness value of the current search agent to the optimal fitness value, thereby improving the adaptability of the algorithm in the exploration phase, so that the population can better approach the optimal position, and in some more complex control environments, the parameters can be adaptively adjusted according to the changes in fitness to achieve a more stable control effect.
[0027] Preferably, the standard sugarcane rat algorithm is prone to fall into the local optimal situation during the optimization process. The single update formula may make it difficult for the algorithm to jump out of the local optimal solution within a limited number of iterations, resulting in low control accuracy. To address this problem, a local optimization perturbation strategy is used to improve the mathematical model of the development stage of the sugarcane rat algorithm. During the algorithm optimization process, the algorithm fitness value update is checked in real time. If it falls into the local optimal situation, the update strategy is changed to perform perturbation. The improved mathematical model of the development stage of the sugarcane rat algorithm is:
[0028] (5);
[0029] In formula (5), represents the optimal fitness value of the last update, represents the optimal fitness value of the current update, represents the original position of the i-th search agent in the population, in the j-th dimension, represents the position of the dominant male on the jth dimension, represents the position of the jth dimension of the randomly selected mth search agent, and both C and μ represent random numbers between 0 and 1. , , α=π·rand, where rand represents a random number between 0 and 1.
[0030] Preferably, if the algorithm is optimized and If the difference is less than a value close to 0 (1E-6), it means that the algorithm has fallen into a local optimum. At this time, the corresponding update strategy in equation (5) is called to disturb the algorithm so that it can quickly jump out of the local optimum. Especially in the later stage of the development phase, quickly jumping out of the local optimum can increase the optimization accuracy of the algorithm and obtain a better solution with a limited number of iterations, thereby increasing the final control accuracy and robustness of the control system.
[0031] Preferably, the specific steps of using the improved cane rat algorithm to perform parameter tuning on the PID controller of the kennel environmental temperature control system and obtaining the optimal values of the three parameters Kp, Ki and Kd through algorithm optimization are as follows:
[0032] S31, simulating the working process of the kennel environment temperature control system and constructing the transfer function of the control system simulation model;
[0033] S32, setting a target temperature of the kennel environment temperature control system, and inputting the target temperature into the control system as an input signal;
[0034] S33, initialize the parameters of the improved cane rat algorithm module, population size N, problem dimension dim, search space upper limit ub, lower limit lb;
[0035] S34, encoding the three parameters Kp, Ki, and Kd of the PID controller module of the kennel temperature control system and converting them into three dimensions of the position solution of the improved large cane rat algorithm;
[0036] S35. Use ISE as the objective function of the improved cane rat algorithm. The formula of the objective function is as follows:
[0037] (6);
[0038] In formula (6), represents the fitness value of the improved cane rat algorithm, e(t) represents the error of the kennel temperature control system at the current running time t, that is, the difference between the target temperature and the actual temperature detected by the temperature detection module, and T represents the total running time of the system;
[0039] S36, initializing the initial position of the population according to the parameters, and calculating the fitness of the population, selecting the dominant male according to the principle that the smaller the fitness value, the better, and performing dominant convergence mutation on the initialized population through formula (1);
[0040] S37, updating the population position through the improved mathematical model of the cane rat algorithm, calculating the position solution obtained through the objective function to obtain the fitness value, selecting the optimal solution and the optimal fitness value under the current number of iterations, converting the optimal solution into the three parameters Kp, Ki, and Kd of the PID controller module of the kennel temperature control system, and transferring it to the temperature control system for control optimization;
[0041] S38, loop and execute S37 to determine whether the current number of iterations reaches the maximum number of iterations. If not, continue to search for the best solution. If it reaches the maximum number of iterations, exit the loop and output the optimal solution as the optimal Kp, Ki, and Kd parameters of the PID controller.
[0042] Preferably, the transfer function of the control simulation model constructed in S32 mainly simulates the actual operating state of the kennel temperature control system. According to various influencing factors in the kennel environment, a second-order nonlinear integral equation is designed to simulate the temperature change of the kennel, and it is converted into the transfer function G(s) of the simulation model through Laplace transform. The formula is as follows:
[0043] (7);
[0044] In formula (7), G(s) is the transfer function and s is the function variable.
[0045] Preferably, the specific steps of updating the population position of the mathematical model of the improved cane rat algorithm described in S37 are as follows:
[0046] Step 1: If the randomly selected value rand < 0.5, the exploration phase of the algorithm is executed, and an adaptive dynamic factor is used to improve the mathematical model of the exploration phase of the cane rat algorithm to update the population position. The mathematical model is shown in formula (2);
[0047] Step 2: If the randomly selected value rand>=0.5, the development phase of the algorithm is executed, and a local optimal perturbation strategy is used to improve the mathematical model of the development phase of the cane rat algorithm. The mathematical model is shown in formula (5);
[0048] Step 3: Calculate the fitness value based on the updated position information in the algorithm development or exploration phase. If the fitness value is optimized, keep the updated population position. If the fitness value is poor, re-update the position. The re-update formula is shown in formula (8):
[0049] (8);
[0050] In formula (8), represents the new position of the i-th search agent, C represents a random number between 0 and 1, represents the original position of the i-th search agent in the population, in the j-th dimension, represents the position of the dominant male on the jth dimension, , r is calculated by formula (4), rand is a random number between 0 and 1;
[0051] Step 4: Update the dominant male individual in the population and the optimal fitness value, determine whether the current iteration has reached the maximum iteration, and choose whether to continue optimizing.
[0052] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention optimizes the PID controller of the kennel temperature control system by improving the great cane rat algorithm, thereby realizing precise control of the temperature; mutates the initialized population by a dominant convergence mutation strategy, improves the quality of the initialized population by guiding the dominant male individual, increases the convergence speed of the algorithm, and significantly improves the response speed of the control system; introduces an adaptive dynamic factor, adaptively adjusts the position update of the population in the exploration phase of the algorithm, so that the population can better approach the optimal position, thereby increasing the robustness of the control system; improves the mathematical model of the development phase of the great cane rat algorithm by a local optimal perturbation strategy, and enables the algorithm to quickly jump out of the local optimal situation through the improvement, thereby increasing the optimization accuracy of the algorithm, and also increasing the control accuracy of the control system. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A step diagram of a method for optimizing kennel environmental temperature control.
[0054] Figure 2 This is a model diagram of the kennel environmental temperature control system.
[0055] Figure 3 Flowchart for parameter tuning of the PID controller of the kennel environmental temperature control system to improve the algorithm for the greater cane rat.
[0056] Figure 4 A comparison chart showing the effects of the improved cane rat algorithm and the standard cane rat algorithm on kennel temperature control by optimizing PID.
[0057] Figure 5 A comparison chart of the fitness values during the optimization process of the improved giant cane rat algorithm and the standard giant cane rat algorithm. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0059] The present invention provides a technical solution: a method for optimizing the temperature control of a kennel environment, which specifically comprises the following steps: Figure 1 shown.
[0060] S1, construct a kennel environment temperature control system, the control system includes an error calculation module, a PID controller module, an improved large cane rat algorithm module, a temperature signal control module, a temperature regulator module, and a temperature detection module. Figure 2 shown.
[0061] Furthermore, the kennel target temperature is first input into the control system, and then input into the error calculation module together with the actual kennel temperature fed back by the temperature detection module to obtain the real-time error e(t). The error e(t) is input into the PID controller module for optimization through the improved large cane rat algorithm, and the optimized control signal is transmitted to the temperature signal controller to control the temperature regulation, and finally the target temperature is reached through the adjustment of the kennel environmental temperature control system.
[0062] S2. Improve the big cane rat algorithm. The specific improvement strategy is as follows:
[0063] S21: Propose a dominant convergence mutation strategy based on the dominant male in the population. The mathematical model of population variation is constructed based on the position of the population, and the position of the initial population is mutated through the mathematical model;
[0064] S22: The mathematical model of the exploration phase of the cane rat algorithm is improved by introducing an adaptive dynamic factor AF, which automatically adjusts the size according to the fitness of each search agent, thereby controlling the update of the search agent position;
[0065] S23: A local optimization perturbation strategy is used to improve the mathematical model of the development phase of the cane rat algorithm. The change in the fitness value of the local optimum selected each time is used to determine whether the algorithm's optimization has fallen into a local optimal solution. Different update strategies are called to perturb the position of the population to continue the optimization.
[0066] Furthermore, within the framework of the cane rat algorithm design, the individual whose position vector produces the best target value is called the dominant male individual. The dominant convergence mutation strategy is to mutate the initial population based on the optimal individual before the algorithm iteration as the dominant one. By updating the position of the initial population through the dominant convergence mutation strategy, the population quality before the algorithm iteration can be better guaranteed, the convergence speed of the algorithm can be increased, and the effect of the PID controller can quickly reach a relatively stable state. The normally distributed random number β can ensure the diversity of the population after mutation, and the mutation amplitude γ can control the change in the distance difference between each search agent and the dominant male. The mathematical model of population mutation is:
[0067] (1);
[0068] In formula (1), represents the updated position of the jth dimension of the i-th search agent in the population, represents the position of the dominant male on the jth dimension, represents the i-th search agent in the population, the original position of the j-th dimension, γ represents the variation amplitude with a value of 0.5, β represents the random number generated by the normal distribution, ub is the upper limit of the search space, and lb is the lower limit of the search space.
[0069] Furthermore, the adaptive factor AF is used to improve the mathematical model of the exploration phase of the cane rat. The adaptive factor AF can adjust the update amplitude of the current position by the ratio of the fitness value of the current search agent to the optimal fitness value, thereby improving the adaptability of the algorithm in the exploration phase, so that the population can better approach the optimal position. In some more complex control environments, the parameters can be adaptively adjusted according to the change of fitness to achieve a more stable control effect. The improved mathematical model of the exploration phase is:
[0070] (2);
[0071] In formula (2), represents the updated position of the jth dimension of the i-th search agent in the population, represents the position of the dominant male on the jth dimension, represents the i-th search agent in the population, the original position of the j-th dimension, AF represents the adaptability factor, and its mathematical model is shown in formula (3), r represents the iteration factor, and its mathematical model is shown in formula (4):
[0072] (3);
[0073] In formula (3), represents the initial value of the adaptability factor, represents the maximum value of the fitness factor, current_fitness represents the fitness value of the current search agent, and best_fitness represents the optimal fitness value;
[0074] (4);
[0075] In formula (4), It represents the fitness value of the dominant male, iter represents the current iteration number, and Max_iter represents the maximum iteration number.
[0076] Furthermore, the standard sugarcane rat algorithm is prone to fall into the local optimal situation during the optimization process. The single update formula may make it difficult for the algorithm to jump out of the local optimal solution within a limited number of iterations, resulting in low control accuracy. To address this problem, a local optimization perturbation strategy is used to improve the mathematical model of the development stage of the sugarcane rat algorithm. During the algorithm optimization process, the algorithm fitness value update is checked in real time. If it falls into the local optimal situation, the update strategy is changed for perturbation. The improved mathematical model of the development stage of the sugarcane rat algorithm is:
[0077] (5);
[0078] In formula (5), represents the optimal fitness value of the last update, represents the optimal fitness value of the current update, represents the original position of the i-th search agent in the population, in the j-th dimension, represents the position of the dominant male on the jth dimension, represents the position of the jth dimension of the randomly selected mth search agent, and both C and μ represent random numbers between 0 and 1. , , α=π·rand, where rand represents a random number between 0 and 1.
[0079] Furthermore, if the algorithm is optimizing and If the difference is less than a value close to 0 (1E-6), it means that the algorithm has fallen into a local optimum. At this time, the corresponding update strategy in equation (5) is called to disturb the algorithm so that it can quickly jump out of the local optimum. Especially in the later stage of the development phase, quickly jumping out of the local optimum can increase the optimization accuracy of the algorithm and obtain a better solution with a limited number of iterations, thereby increasing the final control accuracy and robustness of the control system.
[0080] S3. Use the improved cane rat algorithm to adjust the parameters of the PID controller of the kennel environmental temperature control system, and obtain the best Kp, Ki, and Kd parameter values through algorithm optimization. The specific steps are as follows:
[0081] S31, simulating the working process of the kennel environment temperature control system and constructing the transfer function of the control system simulation model;
[0082] S32, setting a target temperature of the kennel environment temperature control system, and inputting the target temperature into the control system as an input signal;
[0083] S33, initialize the parameters of the improved cane rat algorithm module, population size N, problem dimension dim, search space upper limit ub, lower limit lb;
[0084] S34, encoding the three parameters Kp, Ki, and Kd of the PID controller module of the kennel temperature control system and converting them into three dimensions of the position solution of the improved large cane rat algorithm;
[0085] S35. Use ISE as the objective function of the improved cane rat algorithm. The formula of the objective function is as follows:
[0086] (6);
[0087] In formula (6), represents the fitness value of the improved cane rat algorithm, e(t) represents the error of the kennel temperature control system at the current running time t, that is, the difference between the target temperature and the actual temperature detected by the temperature detection module, and T represents the total running time of the system;
[0088] S36, initializing the initial position of the population according to the parameters, and calculating the fitness of the population, selecting the dominant male according to the principle that the smaller the fitness value, the better, and performing dominant convergence mutation on the initialized population through formula (1);
[0089] S37, updating the population position through the improved mathematical model of the cane rat algorithm, calculating the position solution obtained through the objective function to obtain the fitness value, selecting the optimal solution and the optimal fitness value under the current number of iterations, converting the optimal solution into the three parameters Kp, Ki, and Kd of the PID controller module of the kennel temperature control system, and transferring it to the temperature control system for control optimization;
[0090] S38, loop and execute S37 to determine whether the current number of iterations reaches the maximum number of iterations. If not, continue to search for the best solution. If it reaches the maximum number of iterations, exit the loop and output the optimal solution as the optimal Kp, Ki, and Kd parameters of the PID controller.
[0091] Furthermore, the transfer function of constructing the control system simulation model described in S31 is mainly to simulate the actual operating state of the kennel temperature control system. According to various influencing factors in the kennel environment, a second-order nonlinear integral equation is designed to simulate the temperature change of the kennel, and it is converted into the transfer function G(s) of the simulation model through Laplace transformation. The formula is as follows:
[0092] (7);
[0093] In formula (7), G(s) is the transfer function, and s is the function variable;
[0094] Further, the mathematical model of the improved cane rat algorithm described in S37 specifically includes the following steps for updating the population position: Figure 3 As shown;
[0095] Step 1: If the randomly selected value rand < 0.5, the exploration phase of the algorithm is executed, and an adaptive dynamic factor is used to improve the mathematical model of the exploration phase of the cane rat algorithm to update the population position. The mathematical model is shown in formula (2);
[0096] Step 2: If the randomly selected value rand>=0.5, the development phase of the algorithm is executed, and a local optimal perturbation strategy is used to improve the mathematical model of the development phase of the cane rat algorithm. The mathematical model is shown in formula (5);
[0097] Step 3: Calculate the fitness value based on the updated position information in the algorithm development or exploration phase. If the fitness value is optimized, keep the updated population position. If the fitness value is poor, re-update the position. The re-update formula is shown in formula (8):
[0098] (8);
[0099] In formula (8), represents the new position of the i-th search agent, C represents a random number between 0 and 1, represents the original position of the i-th search agent in the population, in the j-th dimension, represents the position of the dominant male on the jth dimension, , r is calculated by formula (4), rand is a random number between 0 and 1;
[0100] Step 4: Update the dominant male individual in the population and the optimal fitness value, determine whether the current iteration has reached the maximum iteration, and choose whether to continue optimizing.
[0101] S4: Apply the three PID parameters set in S3 to the kennel environment temperature control system to optimize the control effect of the system and achieve precise temperature regulation.
[0102] In order to verify the advantages of a kennel environmental temperature control optimization method proposed in the present invention compared with other methods, the present invention is specifically implemented by Matlab mathematical modeling software and Siimulink simulation to compare the improved large cane rat algorithm (IGCRA) optimized PID control and the standard large sweet potato algorithm (GCRA) optimized PID. The optimization of the algorithm can improve the parameter setting speed and accuracy of the PID controller in different environments, thereby improving the control performance of the entire control system. First, the improved large cane rat algorithm is written by Matlab, and the kennel environmental temperature control system is constructed by Siimulink simulation. The population size N of the improved large cane rat algorithm is set to 100, the problem dimension dim is 3, the maximum number of iterations is 50, the upper limit ub=[100,200,100] of the search space, the lower limit lb=[0,0,0], the target value control amount is 1 unit, and the code and simulation model are run to obtain the improved large cane rat algorithm and the standard large cane rat algorithm to optimize PID A comparison chart of the effects of kennel temperature control and a comparison chart of the fitness values during the optimization process of the improved cane rat algorithm and the standard cane rat algorithm.
[0103] Further, Figure 4 This is a comparison chart of the effects of the improved big cane rat algorithm and the standard big cane rat algorithm on optimizing PID for kennel temperature control. Compared with the use of the optimization algorithm, the control effect of the ordinary PID has a larger overshoot and a longer setting time, while the standard big cane rat algorithm and the improved big cane rat algorithm have a smaller overshoot and a faster response time for PID control optimization. The overshoot of the improved big cane rat algorithm is much smaller than that of the standard big cane rat algorithm, which shows that the improved big cane rat algorithm has better stability, and the improved big cane rat algorithm reaches a balanced state in about 2s. In summary, the improved big cane rat algorithm has a better PID control optimization effect on the kennel environmental temperature control system.
[0104] Further, Figure 5 A comparison chart of the fitness values of the improved big cane rat algorithm and the standard big cane rat algorithm during the optimization process. The fitness value of the improved big cane rat algorithm quickly reaches the optimal solution during the optimization process and jumps out of the local optimal situation in the later stage of the algorithm and continues to optimize. The advantage of the fast optimization of the improved big cane rat algorithm can reduce the impact of errors on the control system during the PID parameter tuning process.
Claims
1. A method for optimizing the temperature control of a kennel environment, characterized in that: The specific steps are: S1. Construct a kennel environment temperature control system, the control system includes an error calculation module, a PID controller module, an improved large cane rat algorithm module, a temperature signal control module, a temperature regulator module, and a temperature detection module. First, the kennel target temperature is input into the control system, and the kennel actual temperature fed back by the temperature detection module is input into the error calculation module to obtain a real-time error e(t). The error e(t) is input into the PID controller module for optimization through the improved large cane rat algorithm, and the optimized control signal is input into the temperature signal controller to control the temperature adjustment, and the target temperature is finally reached through the adjustment of the kennel environment temperature control system; S2. Improve the big cane rat algorithm. The specific improvement strategy is as follows: S21: A dominant convergence mutation strategy is proposed. Within the framework of the cane rat algorithm design, the individual whose position vector produces the best target value is called the dominant male individual. k The mathematical model of population variation is constructed based on the position of , and the position of the initialized population is mutated through the mathematical model. The mathematical model of population variation is: In formula (1), represents the updated position of the jth dimension of the i-th search agent in the population, X k,j represents the position of the dominant male in the jth dimension, X i,j represents the i-th search agent in the population, the original position of the j-th dimension, γ represents the variation amplitude with a value of 0.5, β represents the random number generated by the normal distribution, ub is the upper limit of the search space, and lb is the lower limit of the search space; S22: The mathematical model of the exploration phase of the cane rat algorithm is improved by introducing an adaptive dynamic factor AF. AF automatically adjusts the size according to the fitness of each search agent, thereby controlling the update of the search agent position. The improved mathematical model of the exploration phase is: In formula (2), represents the updated position of the jth dimension of the i-th search agent in the population, X k,j represents the position of the dominant male in the jth dimension, X i,j represents the i-th search agent in the population, the original position of the j-th dimension, AF represents the adaptability factor, and its mathematical model is shown in formula (3), r represents the iteration factor, and its mathematical model is shown in formula (4): In formula (3), a final represents the initial value of the adaptability factor, af initial represents the maximum value of the fitness factor, current_fitness represents the fitness value of the current search agent, and best_fitness represents the optimal fitness value; In formula (4), F k Indicates the fitness value of the dominant male, iter indicates the current iteration number, and Max_iter indicates the maximum iteration number; S23: A local optimization perturbation strategy is used to improve the mathematical model of the development phase of the sugarcane rat algorithm. The algorithm is judged whether it has fallen into a local optimal solution based on the change in the fitness value of the local optimum selected each time. The position of the population is disturbed by calling different update strategies to continue the optimization. The improved mathematical model of the development phase of the sugarcane rat algorithm is: In formula (5), represents the optimal fitness value of the last update, represents the optimal fitness value of the current update, X i,j represents the original position of the i-th search agent in the population, the j-th dimension, X k,j represents the position of the dominant male in the jth dimension, X m,i represents the position of the jth dimension of the randomly selected mth search agent, C and μ both represent random numbers between 0 and 1, L1 = X i,j -X k,j , L2 = rand·L1, α = π·rand, where rand represents a random number between 0 and 1; S3. Parameter tuning of the PID controller of the kennel environment temperature control system is performed using the improved large cane rat algorithm. The optimal values of the three parameters Kp, Ki, and Kd are obtained through algorithm optimization. The specific steps are as follows: S31, simulating the working process of the kennel environment temperature control system and constructing the transfer function of the control system simulation model; S32, setting a target temperature of the kennel environment temperature control system, and inputting the target temperature into the control system as an input signal; S33, initialize the parameters of the improved cane rat algorithm module, population size N, problem dimension dim, search space upper limit ub, lower limit 1b; S34, encoding the three parameters Kp, Ki, and Kd of the PID controller module of the kennel temperature control system and converting them into three dimensions of the position solution of the improved large cane rat algorithm; S35. Use ISE as the objective function of the improved cane rat algorithm. The formula of the objective function is as follows: In formula (6), J ISE represents the fitness value of the improved cane rat algorithm, e(t) represents the error of the kennel temperature control system at the current running time t, that is, the difference between the target temperature and the actual temperature detected by the temperature detection module, and T represents the total running time of the system; S36, initializing the initial position of the population according to the parameters, and calculating the fitness of the population, selecting the dominant male according to the principle that the smaller the fitness value, the better, and performing dominant convergence mutation on the initialized population through formula (1); S37, updating the population position through the improved mathematical model of the large cane rat algorithm, calculating the position solution obtained through the objective function to obtain the fitness value, selecting the optimal solution and the optimal fitness value under the current number of iterations, converting the optimal solution into three parameters Kp, Ki, and Kd of the PID controller module of the kennel temperature control system, and transmitting them to the temperature control system for control optimization; S38, execute S37 in a loop to determine whether the current number of iterations has reached the maximum number of iterations. If not, continue to optimize. If reached, exit the loop and output the optimal solution as the optimal Kp, Ki, and Kd parameters of the PID controller. S4, apply the three PID parameters adjusted in S3 to the kennel environmental temperature control system to optimize the control effect of the system and achieve precise temperature regulation.
2. A method for optimizing kennel environment temperature control according to claim 1, characterized in that: The transfer function of the control simulation model constructed in S31 simulates the actual operating state of the kennel temperature control system. According to various influencing factors in the kennel environment, a second-order nonlinear integral equation is designed to simulate the temperature change of the kennel, and it is converted into the transfer function G(s) of the simulation model through Laplace transformation. The formula is as follows: In formula (7), G(s) is the transfer function and s is the function variable.
3. A method for optimizing kennel environment temperature control according to claim 2, characterized in that: The specific steps of updating the population position by the mathematical model of the improved cane rat algorithm in S37 are: Step 1: If the randomly selected value rand < 0.5, the exploration phase of the algorithm is executed, and an adaptive dynamic factor is used to improve the mathematical model of the exploration phase of the cane rat algorithm to update the population position. The mathematical model is shown in formula (2); Step 2: If the randomly selected value rand>=0.5, the development phase of the algorithm is executed, and a local optimal perturbation strategy is used to improve the mathematical model of the development phase of the cane rat algorithm. The mathematical model is shown in formula (5); Step 3: Calculate the fitness value based on the updated position information in the algorithm development or exploration phase. If the fitness value is optimized, keep the updated population position. If the fitness value is poor, re-update the position. The re-update formula is shown in formula (8): X i =X i,j +C·(X i,j -a·X k,j ) (8); In formula (8), X i represents the new position of the i-th search agent, C represents a random number between 0 and 1, and X i,j represents the original position of the i-th search agent in the population, the j-th dimension, X k,j represents the position of the dominant male on the jth dimension, a = 2·r·rand-r, r is calculated by formula (4), and rand is a random number between 0 and 1; Step 4: Update the dominant male individual in the population and the optimal fitness value, determine whether the current iteration has reached the maximum iteration, and choose whether to continue optimizing.
