CN110705030B - Genetic algorithm-based PID controller parameter optimization method and motor - Google Patents

Genetic algorithm-based PID controller parameter optimization method and motor Download PDF

Info

Publication number
CN110705030B
CN110705030B CN201910840873.6A CN201910840873A CN110705030B CN 110705030 B CN110705030 B CN 110705030B CN 201910840873 A CN201910840873 A CN 201910840873A CN 110705030 B CN110705030 B CN 110705030B
Authority
CN
China
Prior art keywords
individuals
individual
fitness
population
pid controller
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910840873.6A
Other languages
Chinese (zh)
Other versions
CN110705030A (en
Inventor
夏亮
李晋宏
周彬
齐云霞
杨宝军
魏章保
陈吉奎
郑登华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Huashu Robot Co ltd
Chongqing Robotics Institute
Original Assignee
Chongqing Huashu Robot Co ltd
Chongqing Robotics Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Huashu Robot Co ltd, Chongqing Robotics Institute filed Critical Chongqing Huashu Robot Co ltd
Priority to CN201910840873.6A priority Critical patent/CN110705030B/en
Publication of CN110705030A publication Critical patent/CN110705030A/en
Application granted granted Critical
Publication of CN110705030B publication Critical patent/CN110705030B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention relates to a PID controller parameter optimization method and a motor based on a genetic algorithm, wherein two PID controllers are controlled in a cascade mode, kp1, ki1, kd1, kp2, ki2 and Kd2 are combined into a plurality of different individuals after binary coding by setting different control parameters, an initial population is formed, the fitness of each individual in the initial population is confirmed, corresponding individuals are selected according to the fitness to carry out copying, crossing and variation operations in sequence to form a next generation population, S2 and S3 are carried out on the next generation population in an iteration mode, when the iteration process is finished, the individual with the maximum fitness in the generated population is finally used as an optimal solution individual, and K of the optimal solution individual is used as K p1 、K i1 、K d1 、K p2 、K i2 、K d2 The controlled object is controlled by the optimal control parameter, the optimization efficiency is high, the calculation accuracy is high, and after the method is applied to the motor, the torque and the speed of the motor can be quickly adjusted to the optimal state.

Description

Genetic algorithm-based PID controller parameter optimization method and motor
Technical Field
The invention relates to the field of PID controllers, in particular to a PID controller parameter optimization method based on a genetic algorithm and a motor.
Background
A PID controller is a feedback loop component commonly used in industrial control and is controlled in a linear combination of Proportional (Proportional), integral (Integral) and Derivative (Derivative) of deviation. The PID controller has been used as the earliest practical controller for nearly one hundred years, and is still the most widely used controller at present due to the characteristics of simple structure, good stability, no need of accurate system model in use and other prerequisites.
At present, the main method for optimizing the parameters of the PID controller is a manual setting method, a user needs to have skilled skills, time is consumed, the parameter precision is not high, particularly when the characteristics of a controlled object change, the PID regulator cannot optimize the change in real time, the parameters need to be optimized again, and therefore, the efficiency and the precision of the existing parameter optimization process of the PID controller are low.
Disclosure of Invention
The invention aims to solve the technical problem of the prior art and provides a parameter optimization method of a PID controller based on a genetic algorithm and a motor.
The technical scheme of the PID controller parameter optimization method based on the genetic algorithm is as follows:
s1, cascade control is carried out on two PID controllers, and K is controlled by setting different control parameters p1 、K i1 、K d1 、K p2 、K i2 、K d2 Binary coding is carried out, and then the binary coding is combined into a plurality of different individuals to form an initial population;
s2, confirming the fitness of each individual in the initial population;
s3, selecting corresponding individuals according to the fitness to perform copying, crossing and mutation operations in sequence to form a next generation population;
s4, performing iteration S2 and S3 on the next generation population, and when the iteration process is finished, taking the individual with the maximum fitness in the generated population as an optimal solution individual, wherein the optimal solution individualK of body p1 、K i1 、K d1 、K p2 、K i2 、K d2 As an optimal control parameter;
wherein, K p1 、K i1 、K d1 Respectively representing a proportional control parameter, an integral control parameter, a differential control parameter, K, of the first PID controller p2 、K i2 、K d2 Respectively representing a proportional control parameter, an integral control parameter and a differential control parameter of the second PID controller.
The invention has the beneficial effects that: two PID controllers are adopted for cascade control, and K is controlled by setting different control parameters p1 、K i1 、K d1 、K p2 、K i2 、K d2 Binary coding is carried out and then combined into a plurality of different individuals, an initial population is formed, the fitness of each individual in the initial population is calculated, corresponding individuals are selected according to the fitness to carry out copying, crossing and mutation operations in sequence, the process is executed in an iteration mode, each control parameter of two PID controllers is continuously optimized, after the iteration process is finished, the control parameter of the individual with the optimal solution is selected as the optimal control parameter, the controlled object is controlled by the optimal control parameter, the optimization efficiency and the precision are high, when the characteristic of the controlled object changes, the calculation can be carried out according to the process again, and a new set of optimal control parameters are obtained.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, the expression for calculating the fitness F is:
Figure BDA0002193671220000021
wherein the content of the first and second substances,
Figure BDA0002193671220000022
wherein, P ov To representPenalty factor, e n Representing the tracking error, T representing the error observation time, n ∈ [0]。
The beneficial effect of adopting the further scheme is that: when tracking error e n When the fitness F is calculated when the fitness F is larger than 0, a penalty factor P is introduced ov And the method is used for properly reducing the adaptability to prevent the controlled object from generating abnormal phenomena.
Further, comparing the fitness of the individual with a given step response target value, and if the fitness of the individual is smaller than the step response target value, deleting the individual, namely the individual does not participate in the iterative process any more; if not, the individual continues to participate in the iterative process.
The beneficial effect of adopting the further scheme is that: by comparing the given step response target value with the individual fitness, the individual with the fitness lower than the step response target value is directly deleted, so that the individual does not participate in the iterative process any more, on one hand, the calculation precision of the optimal control parameter is ensured, on the other hand, the operation speed is improved, and the efficiency is high.
Further, the copy operation in S3 specifically includes: sequencing the individuals according to the fitness of the individuals from big to small; selecting the previous Ne individuals, and directly copying the individuals to the next generation population; where Ne represents the number of a given elite individual.
The beneficial effect of adopting the further scheme is that: according to the fitness of each individual, the individuals are sequenced from large to small, the first Ne individuals are selected, namely the elite individuals are selected and directly copied to the next generation population, on one hand, the calculation precision of the optimal control parameters is further ensured, on the other hand, the calculation speed is further improved, and the efficiency is high.
Further, the crossing operation in S3 specifically includes:
randomly selecting two groups of individuals from the initial population, wherein the number of the individuals in each group is two;
confirming the fitness of all individuals in each group, and selecting the individual with high fitness in each group to perform the cross operation;
randomly generating a crossWeight K c ,K c ∈(0,1);
The following calculations were performed:
K′ 1 =K 1 *K C +K 2 *(1-K C )
K′ 2 =K 1 *(1-K C )+K 2 *K C
then to K' 1 And K' 2 Carrying out amplitude limiting processing;
wherein, K 1 Denotes the individuals of the first group with high fitness, K 2 Denotes the individual of the second group with high fitness, K' 1 ,K′ 2 Representing the next generation of individuals resulting from the crossover operation.
The beneficial effect of adopting the further scheme is that: by randomly selecting two groups of individuals, then respectively competing the two groups of individuals in the groups, and selecting the individuals with high fitness in each group to carry out the cross operation, on one hand, the calculation precision of the optimal control parameters is further ensured, on the other hand, the calculation speed is further improved, and the efficiency is high.
Further, before the crossover operation, randomly generating a first random number by a genetic algorithm, if the first random number is greater than a given crossover rate, not performing the crossover operation, and if not, performing the crossover operation.
The beneficial effect of adopting the above further scheme is: the randomness of the crossover operation is enhanced by comparing the first random number randomly generated by the genetic algorithm with a given crossover rate to improve the accuracy of the genetic algorithm.
Further, to K' 1 And K' 2 Performing the mutation operation specifically as follows:
will K p1 、K i1 、K d1 、K p2 、K i2 、K d2 Forming an individual parameter matrix K n The expression is as follows:
K n =(K p1 K i1 K d1 K p2 K i2 K d2 )
randomly generating six variant weights K' m Forming a variance weight matrix K m ,K m Is a matrix with one row and six columns, wherein K' m ∈(-1,1);
The following calculation is then performed:
K" 1 =K′ 1 +K m ⊙(K max -K min )
K" 2 =K′ 2 +K m ⊙(K max -K min )
wherein, K max 、K min Represents K n Maximum and minimum values of; an indicator of a Hadamard product operator; k ″) 1 Is represented by K' 1 Individuals formed after performing the mutation operation; k ″) 2 Is represented by K' 2 Individuals formed after the mutation operation is performed;
to K ″) 1 And K ″) 2 And merging the obtained product into the next generation population after the amplitude limiting treatment is carried out.
The beneficial effect of adopting the further scheme is that: k 'of progeny individuals resulting from crossover operations' 1 And K' 2 Performing mutation operations, i.e. using the individual parameter matrix K n And a variance weight matrix K m To K therein p1 、K il 、K d1 、K p2 、K i2 、K d2 The parameters are subjected to variation operation respectively to ensure the calculation accuracy of the optimal control parameters.
Further, P 'of individuals in each generation of population in the populations generated by three consecutive iterations is detected' 1 、P′ 2 、P 3 、P 4 、P 5 、P 6 Whether the corresponding difference values are smaller than a set threshold value or not, if so, increasing the variation rate; if not, the variation rate is reduced.
Further, P 'of individuals in each generation of population in the populations generated by three consecutive iterations is detected' 1 、P′ 2 、P′ 3 、P′ 4 、P′ 5 、P′ 6 Whether the corresponding difference values are smaller than a set threshold value or not, if so, increasing the variation rate; if not, the variation rate is reduced.
Adopt the above stepThe beneficial effects of the scheme are: if P 'of individuals in each generation of population' 1 、P′ 2 、P′ 3 、P′ 4 、P′ 5 、P′ 6 The difference value corresponding to each is smaller than the set threshold value, which indicates that each individual is too similar at the moment, and the variation rate needs to be increased at the moment, so as to prevent the genetic algorithm from premature convergence, and ensure the calculation accuracy of the optimal control parameter.
Further, before the mutation operation, a second random number is randomly generated by a genetic algorithm, if the second random number is larger than a given mutation rate, the mutation operation is not performed on the individuals after the crossover operation, and if not, the mutation operation is performed on the individuals after the crossover operation.
The beneficial effect of adopting the above further scheme is: the second random number randomly generated by the genetic algorithm is compared with a given variation rate, so that the randomness of variation operation is enhanced, and the accuracy of the genetic algorithm is improved.
Further, the ending of the iterative process in S4 specifically includes: and (5) setting iteration times W, and finishing the iteration process after iterating and executing S2 and S3W times.
The beneficial effect of adopting the further scheme is that: and controlling the iteration times of S2 and S3 by setting the iteration time W.
An electric machine utilizing any of the above methods of PID controller parameter optimization based on genetic algorithm, wherein a first PID controller is used to control the torque loop of the electric machine and a second PID controller is used to control the speed loop of the electric machine.
The motor has the advantages that: the optimal control parameters of the first PID controller and the second PID controller are calculated by the method, so that the torque and the speed of the motor can be quickly adjusted to the optimal state.
Drawings
FIG. 1 is a block diagram of the PID controller parameter optimization method based on genetic algorithm of the invention;
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the scope of the invention.
As shown in fig. 1, the method for optimizing PID controller parameters based on genetic algorithm provided in this embodiment includes the following steps:
s1, cascade control is carried out on two PID controllers, and K is controlled by setting different control parameters p1 、K i1 、K d1 、K p2 、K i2 、K d2 Binary coding is carried out, and then the binary coding is combined into a plurality of different individuals to form an initial population;
s2, confirming the fitness of each individual in the initial population;
s3, selecting corresponding individuals according to the fitness to perform copying, crossing and mutation operations in sequence to form a next generation population;
s4, performing iteration on the next generation population by S2 and S3, and when the iteration process is finished, taking the individual with the maximum fitness in the generated population as an optimal solution individual, wherein K of the optimal solution individual p1 、K il 、K d1 、K p2 、K i2 、K d2 As an optimal control parameter;
wherein, K p1 、K i1 、K d1 Respectively representing a proportional control parameter, an integral control parameter, a differential control parameter, K, of the first PID controller p2 、K i2 、K d2 Respectively representing a proportional control parameter, an integral control parameter and a differential control parameter of the second PID controller.
Two PID controllers are adopted for cascade control, and K is controlled by setting different control parameters p1 、K i1 、K d1 、K p2 、K i2 、K d2 Binary coding is carried out, the binary coding is combined into a plurality of different individuals, an initial population is formed, the fitness of each individual in the initial population is calculated, then corresponding individuals are selected according to the fitness to carry out copying, crossing and mutation operations in sequence, the process is executed in an iteration mode, each control parameter of two PID controllers is continuously optimized, after the iteration process is finished, the control parameter of the individual with the optimal solution is selected as the optimal control parameter, the controlled object is controlled by the optimal control parameter, the optimization efficiency is high, and the controlled object is controlled accuratelyAnd moreover, when the characteristics of the controlled object change, the calculation can be carried out according to the process to obtain a group of new optimal control parameters, so that the parameter optimization method of the PID controller based on the genetic algorithm is realized, and the optimization efficiency and the accuracy are high.
Preferably, in the above technical solution, the expression for calculating the fitness F is:
Figure BDA0002193671220000071
wherein the content of the first and second substances,
Figure BDA0002193671220000072
wherein, P ov Denotes a penalty factor, e n Representing the tracking error, T representing the error observation time, n ∈ [0]。
When tracking error e n When the fitness F is calculated when the fitness F is larger than 0, a penalty factor P is introduced ov And the method is used for properly reducing the adaptability to prevent the controlled object from generating abnormal phenomena.
Wherein the tracking error e n And a penalty factor P ov The following explanation can be made: for example, when the controlled object is a motor, a tracking error e may be defined n Tracking error of motor speed and monitoring the tracking error at any moment in error observation time in real time; when the tracking error of the motor speed is larger than 0, a penalty factor P is introduced ov Is used for properly reducing the fitness to prevent the motor from generating abnormal phenomena, such as overheating and shaking phenomena generated when the motor overshoots, and a penalty factor P ov The value of (B) can be improved according to the actual situation, if the overheating of the motor is too large, the penalty factor P is increased appropriately ov The value of (c).
When the controlled object is different or the controlled part of the controlled object is changed, such as from controlling the motor speed and motor torque, to controlling the motor, the transformer transforms the voltage and the motor torque or the motor speed, in the above expression, the error e is tracked n And a penalty factor P ov The two parameters have different values, that is, the tracking error e is reserved in the above expression n And a penalty factor P ov The positions of the two parameters can be brought into different values according to different actual conditions.
Moreover, the above-mentioned "tracking error e n A.. Times ", where 0 may be set as another threshold.
Preferably, in the above technical solution, the fitness of the individual is compared with a given target value of step response, and if the fitness of the individual is smaller than the target value of step response, the individual is deleted, that is, the individual does not participate in the iterative process any more; if not, the individual continues to participate in the iterative process. By comparing the given step response target value with the individual fitness, the individual with the fitness lower than the step response target value is directly deleted, so that the individual does not participate in the iterative process any more, on one hand, the calculation precision of the optimal control parameter is ensured, on the other hand, the operation speed is improved, and the efficiency is high.
Wherein, the target value of the step response may be given by the user, for example, the target value of the step response is set to 0.6, when the calculated fitness of a certain individual is 0.5, because the fitness of the individual is smaller than the target value of the step response given by the user, the individual is deleted, that is, the individual does not participate in the iterative process any more; when the calculated fitness of a certain individual is 0.7, the individual continues to participate in the iterative process because the fitness of the individual is greater than the step response target value given by the user.
Preferably, in the above technical solution, the copy operation in S3 specifically includes: sequencing the individuals according to the fitness of the individuals from big to small; selecting the first Ne individuals and directly copying the individuals to the next generation population; where Ne represents the number of a given elite individual. And sequencing the individuals according to the fitness of the individuals from large to small, selecting the first Ne individuals, namely selecting the elite individuals, and directly copying the elite individuals to the next generation population.
The number Ne of elite individuals can be given by the user, for example, the value Ne is 3, after the individuals are sorted according to the fitness of the individuals from large to small, the first 3 individuals are taken and directly copied to the next generation population.
Preferably, in the above technical solution, the crossing operation in S3 specifically includes:
randomly selecting two groups of individuals from the initial population, wherein the number of the individuals in each group is two;
confirming the fitness of all individuals in each group, and selecting the individual with high fitness in each group to perform the cross operation;
randomly generating a cross weight K c ,K c ∈(0,1);
The following calculations were performed:
K′ 1 =K 1 *K C +K 2 *(1-K C )
K′ 2 =K 1 *(1-K C )+K 2 *K C
then to K' 1 And K' 2 Carrying out amplitude limiting processing;
wherein, K 1 Denotes individuals of high fitness in the first group, K 2 Denotes the individual with high fitness in the second group, K' 1 ,K′ 2 Representing the next generation of individuals resulting from the crossover operation.
By randomly selecting two groups of individuals, then respectively competing the two groups of individuals in the groups, and selecting the individuals with high fitness in each group to carry out the cross operation, on one hand, the calculation precision of the optimal control parameters is further ensured, on the other hand, the calculation speed is further improved, and the efficiency is high. And randomly generating a cross weight K c According to the cross-over weight K c And calculating to enhance the randomness of the cross operation so as to improve the accuracy of the genetic algorithm.
Preferably, in the above technical solution, before the crossover operation, a first random number is randomly generated by a genetic algorithm, and if the first random number is greater than a given crossover rate, the crossover operation is not performed, and if not, the crossover operation is performed. The randomness of the crossover operation is enhanced by comparing the first random number randomly generated by the genetic algorithm with a given crossover rate to improve the accuracy of the genetic algorithm.
Preferably, in the above technical scheme, K is 1 And K 2 Performing the mutation operation specifically as follows:
will K p1 、K i1 、K d1 、K p2 、K i2 、K d2 Forming an individual parameter matrix K n The expression is as follows:
K n =(K p1 K i1 K d1 K p2 K i2 K d2 )
randomly generating six variant weights K' m Forming a variance weight matrix K m ,K m Is a matrix with one row and six columns, wherein K' m ∈(-1,1);
The following calculation is then performed:
K" 1 =K′ 1 +K m ⊙(K max -K min )
K" 2 =K′ 2 +K m ⊙(K max -K min )
wherein, K max 、K min Represents K n Maximum and minimum values of; an indicator of a Hadamard product operator; k ″) 1 Is represented by K' 1 Individuals formed after performing the mutation operation; k ″) 2 Is represented by K' 2 Individuals formed after the mutation operation is performed;
to K " 1 And K' 2 And merging the obtained product into the next generation population after the amplitude limiting treatment is carried out.
K 'of progeny individuals resulting from crossover operations' 1 And K' 2 Performing mutation operations, i.e. using the individual parameter matrix K n And the variance weight matrix K m To K therein p1 、K i1 、K d1 、K p2 、K i2 、K d2 The parameters are subjected to variation operation respectively, so that the calculation accuracy of the optimal control parameters is further ensured.
As can be seen from the above, the next generation population is formed by: 1. selecting the first Ne individuals, directly copying the first Ne individuals to the next generation population, and combining the individuals formed after the cross operation and the mutation operation in sequence into the next generation population.
Preferably, in the above technical solution, P 'of individuals in each generation of population in the population generated by three successive iterations is detected' 1 、P′ 2 、P′ 3 、P′ 4 、P′ 5 、P′ 6 Whether the corresponding difference values are smaller than a set threshold value or not, if so, increasing the variation rate; if not, the variation rate is reduced. If P 'of individuals in each generation of population' 1 、P′ 2 、P′ 3 、P′ 4 、P′ 5 、P′ 6 The difference value corresponding to each is smaller than the set threshold value, which indicates that each individual is too similar at the moment, and the variation rate needs to be increased at the moment, so as to prevent the genetic algorithm from premature convergence, and ensure the calculation accuracy of the optimal control parameter.
For example, the threshold value is set to 0.001, the mutation rate is set to 0.1, and the individual P 'in each generation of population' 1 、P′ 2 、P′ 3 、P′ 4 、P′ 5 、P′ 6 If the difference between the two is 0.0005, the variation rate can be increased, for example, the variation rate is multiplied by 3, or fine tuning can be performed according to actual conditions, which is not described herein.
Preferably, in the above technical solution, before the mutation operation, a second random number is randomly generated by a genetic algorithm, and if the second random number is greater than a given mutation rate, the mutation operation is not performed on the individuals after the crossover operation, and if not, the mutation operation is performed on the individuals after the crossover operation. The second random number randomly generated by the genetic algorithm is compared with a given variation rate, so that the randomness of variation operation is enhanced, and the accuracy of the genetic algorithm is improved.
Preferably, in the above technical solution, the ending of the iteration process in S4 specifically includes: and (5) setting iteration times W, and finishing the iteration process after performing S2 and S3W times of iteration. And controlling the iteration times of S2 and S3 by setting the iteration time W.
For example, when the customer has low demand on the calculation accuracy of the optimal control parameter, the number of iterations W may be set to a small value, such as W =5, 6, 7, etc., and when the customer has high demand on the calculation accuracy of the optimal control parameter, the number of iterations W may be set to 100, 1000, 10000, etc.
A motor utilizes any one of the above PID controller parameter optimization methods based on genetic algorithm, wherein a first PID controller is used for controlling a torque loop of the motor, and a second PID controller is used for controlling a speed loop of the motor. The optimal control parameters of the first PID controller and the second PID controller are calculated through the method, and the torque and the speed of the motor can be rapidly adjusted to be in the optimal state. In which the tracking error e n And a penalty factor P ov For reference, the details are not described herein, and the motor may be a permanent magnet synchronous brushless dc motor, a permanent magnet synchronous brushed dc motor, etc., and other devices such as a refrigerator, a washing machine, etc. may also utilize any of the above PID controller parameter optimization methods based on the genetic algorithm, which is also within the protection scope of the present invention.
Taking the case that the motor is a permanent magnet synchronous brush direct current motor as an example, the detailed explanation is carried out:
the following settings were made for each parameter:
the number of iterations W =30;
the initial population size is 30, wherein the initial population size refers to the number of individuals required to be generated in each generation, and the setting of the initial population size as 30 means that: setting different control parameters to K p1 、K i1 、K d1 、K p2 、K i2 、K d2 After binary coding, combining the binary coded data into a plurality of different individuals to form an initial population, namely the number of individuals in a preset first generation population;
the number Ne =2 of elite individuals;
error observation time T =0.3 second;
the crossing rate is 0.8;
the variation rate is 0.20;
penalty factor P ov =0.10;
K max =(2.5 0.008 0.0 10.0 0.016 20.0)
K min =(0.0 0.0 0.0 0.0 0.0 0.0)
Moreover, the input and output of the PID controller are standardized to (-1.0), the torque loop control frequency is 10kHZ, and the speed loop control frequency is 5kHZ;
calculating according to the steps in the PID controller parameter optimization method based on the genetic algorithm, and after iteration is completed, storing the optimized result to an individual parameter matrix K n According to the actual control system of the permanent magnet synchronous brush direct current motor, the optimization result is as follows:
K n =(1.85 0.00117 0.0 9.37 0.00898 14.8)
that is, when K p1 =1.85,K i1 =0.00117,K d1 =0.0,K p2 =9.37,K i2 =0.00898,K d2 And when the torque and the speed of the permanent magnet synchronous brush direct current motor are adjusted to be in the optimal state when the torque and the speed are not less than 14.8.
It should also be understood that, in the embodiments of the present invention, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (7)

1. A PID controller parameter optimization method based on genetic algorithm is characterized by comprising the following steps:
s1, cascade control is carried out on two PID controllers, and K is controlled by setting different control parameters p1 、K i1 、K d1 、K p2 、K i2 、K d2 Binary coding is carried out, and then the binary coding is combined into a plurality of different individuals to form an initial population;
s2, confirming the fitness of each individual in the initial population;
s3, selecting corresponding individuals according to the fitness to perform copying, crossing and mutation operations in sequence to form a next generation population;
s4, performing iteration on the next generation population by S2 and S3, and when the iteration process is finished, taking the individual with the maximum fitness in the generated population as an optimal solution individual, wherein K of the optimal solution individual p1 、K i1 、K d1 、K p2 、K i2 、K d2 As an optimal control parameter;
wherein, K p1 、K i1 、K d1 Respectively representing a proportional control parameter, an integral control parameter, a differential control parameter, K, of the first PID controller p2 、K i2 、K d2 Respectively representing a proportional control parameter, an integral control parameter and a differential control parameter of a second PID controller;
calculating the fitness
Figure DEST_PATH_IMAGE001
The expression of (a) is:
Figure DEST_PATH_IMAGE003
wherein, the first and the second end of the pipe are connected with each other,
Figure 963017DEST_PATH_IMAGE004
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE005
a penalty factor is represented which is a function of,
Figure 670073DEST_PATH_IMAGE006
indicating the tracking error, T the error observation time,
Figure DEST_PATH_IMAGE007
the crossover operation in S3 specifically includes:
randomly selecting two groups of individuals from the initial population, wherein the number of the individuals in each group is two;
confirming the fitness of all individuals in each group, and selecting the individual with high fitness in each group to perform the cross operation;
randomly generating a cross weight
Figure 651368DEST_PATH_IMAGE008
Figure DEST_PATH_IMAGE009
The following calculations were performed:
Figure DEST_PATH_IMAGE011
Figure DEST_PATH_IMAGE013
then to
Figure 74259DEST_PATH_IMAGE014
And
Figure DEST_PATH_IMAGE015
carrying out amplitude limiting processing;
wherein the content of the first and second substances,
Figure 149793DEST_PATH_IMAGE016
representing individuals of the first group with a high fitness,
Figure DEST_PATH_IMAGE017
representing individuals of the second group with a high fitness,
Figure 457278DEST_PATH_IMAGE014
Figure 879032DEST_PATH_IMAGE015
representing the next generation of individuals resulting from the crossover operation;
to pair
Figure 597458DEST_PATH_IMAGE014
And
Figure 471873DEST_PATH_IMAGE015
performing the mutation operation specifically as follows:
will K p1 、K i1 、K d1 、K p2 、K i2 、K d2 Forming an individual parameter matrix K n The expression is as follows:
Figure DEST_PATH_IMAGE019
randomly generating six variant weights
Figure 583049DEST_PATH_IMAGE020
Forming a variance weight matrix
Figure DEST_PATH_IMAGE021
Figure 279216DEST_PATH_IMAGE021
A row-by-six column matrix is formed, wherein,
Figure 653697DEST_PATH_IMAGE022
the following calculations were then performed:
Figure 280987DEST_PATH_IMAGE024
Figure 648383DEST_PATH_IMAGE026
wherein, the first and the second end of the pipe are connected with each other,
Figure DEST_PATH_IMAGE027
Figure 451254DEST_PATH_IMAGE028
represents K n The maximum value and the minimum value of (c),
Figure DEST_PATH_IMAGE029
representing a Hadamard product operator;
Figure 278527DEST_PATH_IMAGE030
show that
Figure 393114DEST_PATH_IMAGE014
Individuals formed after performing the mutation operation;
Figure DEST_PATH_IMAGE031
show that
Figure 580513DEST_PATH_IMAGE015
Individuals formed after the mutation operation is performed;
to pair
Figure 221578DEST_PATH_IMAGE030
And
Figure 62495DEST_PATH_IMAGE031
and merging the obtained product into the next generation population after the amplitude limiting treatment is carried out.
2. The method according to claim 1, wherein the fitness of the individual is compared with a given target value of the step response, and if the fitness of the individual is smaller than the target value of the step response, the individual is deleted, that is, the individual does not participate in the iterative process any more; if not, the individual continues to participate in the iterative process.
3. The method for optimizing the parameters of the PID controller based on the genetic algorithm according to claim 1, wherein the copy operation in S3 is specifically:
sequencing the individuals according to the fitness of the individuals from big to small;
selecting the first Ne individuals and directly copying the individuals to the next generation population;
where Ne represents the number of a given elite individual.
4. The method of claim 1, wherein prior to the crossover operation, a first random number is randomly generated by the genetic algorithm, and if the first random number is greater than a given crossover rate, the crossover operation is not performed, and if not, the crossover operation is performed.
5. The method of claim 4, wherein K is detected for each individual in each generation of population in the population generated by three consecutive iterations p1 、K i1 、K d1 、K p2 、K i2 、K d2 Whether the corresponding difference values are smaller than a set threshold value or not, if so, increasing the variation rate; if not, the variation rate is reduced.
6. The method as claimed in claim 4, wherein before the mutation operation, a second random number is randomly generated by the genetic algorithm, and if the second random number is greater than a given mutation rate, the mutation operation is not performed on the individuals after the crossover operation, and if not, the mutation operation is performed on the individuals after the crossover operation.
7. An electrical machine, characterized in that it utilizes a method for the optimization of the parameters of a PID controller based on a genetic algorithm according to any of claims 1 to 6, wherein a first PID controller is used to control the torque loop of the electrical machine and a second PID controller is used to control the speed loop of the electrical machine.
CN201910840873.6A 2019-09-06 2019-09-06 Genetic algorithm-based PID controller parameter optimization method and motor Active CN110705030B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910840873.6A CN110705030B (en) 2019-09-06 2019-09-06 Genetic algorithm-based PID controller parameter optimization method and motor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910840873.6A CN110705030B (en) 2019-09-06 2019-09-06 Genetic algorithm-based PID controller parameter optimization method and motor

Publications (2)

Publication Number Publication Date
CN110705030A CN110705030A (en) 2020-01-17
CN110705030B true CN110705030B (en) 2023-03-24

Family

ID=69194362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910840873.6A Active CN110705030B (en) 2019-09-06 2019-09-06 Genetic algorithm-based PID controller parameter optimization method and motor

Country Status (1)

Country Link
CN (1) CN110705030B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112230545A (en) * 2020-10-13 2021-01-15 西北工业大学 AUV course angle control method based on PPGA adaptive optimization PID parameter
CN113914055A (en) * 2021-11-18 2022-01-11 珠海格力电器股份有限公司 Washing parameter optimization method and device and clothes treatment device
CN114002946B (en) * 2021-12-31 2022-05-03 浙江中控技术股份有限公司 Self-adaptive PID parameter setting method, system, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102298328A (en) * 2011-07-13 2011-12-28 上海电力建设启动调整试验所 Binary ant colony algorithm-based optimization design and setting method for adaptive PID controller
CN104808494A (en) * 2015-04-23 2015-07-29 西安外事学院 PID parameter setting method based on self-adaptation ant colony genetic hybrid algorithm
CN105487496A (en) * 2015-08-10 2016-04-13 河北省电力建设调整试验所 Optimization method for heat-engine plant thermal on-line process identification and control algorithm based on dual-objective parallel ISLAND-HFC mixed model genetic programming algorithm
CN105807607A (en) * 2016-05-11 2016-07-27 杭州电子科技大学 Method for optimizing predictive fuzzy-PID coking furnace temperature control through genetic algorithm
CN107272403A (en) * 2017-06-14 2017-10-20 浙江师范大学 A kind of PID controller parameter setting algorithm based on improvement particle cluster algorithm
CN107703749A (en) * 2017-10-10 2018-02-16 常州大学 A kind of pid parameter optimization method based on self-adapted genetic algorithm
CN108490965A (en) * 2018-04-19 2018-09-04 东华大学 Rotor craft attitude control method based on Genetic Algorithm Optimized Neural Network

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102298328A (en) * 2011-07-13 2011-12-28 上海电力建设启动调整试验所 Binary ant colony algorithm-based optimization design and setting method for adaptive PID controller
CN104808494A (en) * 2015-04-23 2015-07-29 西安外事学院 PID parameter setting method based on self-adaptation ant colony genetic hybrid algorithm
CN105487496A (en) * 2015-08-10 2016-04-13 河北省电力建设调整试验所 Optimization method for heat-engine plant thermal on-line process identification and control algorithm based on dual-objective parallel ISLAND-HFC mixed model genetic programming algorithm
CN105807607A (en) * 2016-05-11 2016-07-27 杭州电子科技大学 Method for optimizing predictive fuzzy-PID coking furnace temperature control through genetic algorithm
CN107272403A (en) * 2017-06-14 2017-10-20 浙江师范大学 A kind of PID controller parameter setting algorithm based on improvement particle cluster algorithm
CN107703749A (en) * 2017-10-10 2018-02-16 常州大学 A kind of pid parameter optimization method based on self-adapted genetic algorithm
CN108490965A (en) * 2018-04-19 2018-09-04 东华大学 Rotor craft attitude control method based on Genetic Algorithm Optimized Neural Network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于自适应遗传算法的改进PID参数优化;刘明等;《计算机测量与控制》;20150325(第03期);第133-135页 *

Also Published As

Publication number Publication date
CN110705030A (en) 2020-01-17

Similar Documents

Publication Publication Date Title
CN110705030B (en) Genetic algorithm-based PID controller parameter optimization method and motor
Saad et al. Implementation of PID controller tuning using differential evolution and genetic algorithms
Alfi et al. System identification and control using adaptive particle swarm optimization
Öztürk et al. Speed control of permanent magnet synchronous motors using fuzzy controller based on genetic algorithms
Gong et al. Adaptive strategy selection in differential evolution
CN111628687A (en) Entropy weight method based permanent magnet synchronous motor multi-target parameter optimization method
Elsayed et al. Differential evolution with automatic parameter configuration for solving the CEC2013 competition on real-parameter optimization
Panda et al. Comparative evaluation of optimization algorithms at training of genetic programming for tensile strength prediction of FDM processed part
Puangdownreong Fractional order PID controller design for DC motor speed control system via flower pollination algorithm
Ma’arif et al. Application of intelligent search algorithms in proportional-integral-derivative control of direct-current motor system
Chiha et al. Tuning PID controller with multi-objective differential evolution
El-Telbany Tuning PID controller for DC motor: An artificial bees optimization approach
Wang et al. Adaptive backtracking search optimization algorithm with pattern search for numerical optimization
Wazir et al. A penalty function based differential evolution algorithm for constrained optimization
Nekoui et al. Optimal fractional order PID controllers design based on genetic algorithm for time delay systems
Fang et al. Interval multi-objective evolutionary optimization for disassembly line balancing with uncertain task time
Aishwarya et al. Design of fuzzy-PID controller for a genetic algorithm based reduced order model
CN110888323A (en) Control method for intelligent optimization of switching system
Prabu et al. Genetic algorithm tuned PID controller for rotor position control of BLDC motor
Sajedi et al. Application of particle swarm optimization and genetic algorithm methods for vector control of induction motor
Antić et al. Optimal fuzzy sliding mode control with a time-varying sliding surface
Kishnani et al. Comparison of different performance index factor for GA-PID Controller
Zheng et al. Evaluating a hybrid DE and BBO with self adaptation on ICSI 2014 benchmark problems
CN117709167B (en) Finite element model-based motor design optimization method, storage medium and equipment
Tidke et al. Disturbance rejection pid controller optimized using genetic algorithm for time delay systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant