Disclosure of Invention
The invention aims to solve the technical problem of providing a microgrid alternating current-direct current section converter PID parameter optimization method based on a gray wolf algorithm, which can set PID controller parameters to an optimal value under a given target.
The technical scheme adopted by the invention is as follows: a microgrid alternating current-direct current section converter PID parameter optimization method based on a wolf algorithm comprises the following steps:
1) setting the number of wolfs in a wolf group, the maximum iteration times, the dimension of the problem and the value range of PID parameter variables, and initializing the position of the wolf group;
2) counting iteration times, and calculating a setting model objective function value corresponding to the position of each wolf, namely an objective function value of a micro-grid AC/DC section converter PID control effect;
3) dividing a wolf group into alpha, beta, delta and omega according to a set model objective function value, wherein the alpha wolf is a wolf with the optimal PID effect, the beta wolf is a wolf with the suboptimal PID effect, the delta wolf is a wolf with the third best PID effect, and the omega wolf is the rest wolf;
4) calculating an objective function value of a test model corresponding to the position of the alpha wolf, namely the objective function value of the PID control effect of the micro-grid AC/DC section converter after increasing disturbance;
5) judging whether the PID control effect of the test model is not improved for V times continuously, if so, stopping iteration, and executing the step 8), otherwise, executing the step 6), wherein V is more than or equal to 6;
6) updating the position of the wolf group representing the PID parameter;
7) judging whether the current iteration times reach the set maximum iteration times, if so, stopping iteration, executing the step 8), and if not, returning to the step 2);
8) and outputting the position of the alpha wolf, namely the global optimal PID parameter value of the microgrid alternating current-direct current section converter.
The setting model in the step 2) is a microgrid alternating current-direct current section converter, wherein a direct current side of the converter is a direct current power supply, and an alternating current side of the converter is connected to an alternating current side power supply through an LCL filter; the control module is divided into inner loop control and outer loop control and is provided with a first PID controller, a second PID controller, a third PID controller and a fourth PID controller in common; the first PID controller and the second PID controller form an outer loop control for controlling the voltage of an alternating current side and a direct current side, and the third PID controller and the fourth PID controller form an inner loop control for controlling the amplitude and the phase angle of the output capacitor voltage of the filter; the direct current voltage and the alternating current voltage respectively pass through a first PID controller and a second PID controller to obtain a capacitance voltage angle reference signal and a capacitance voltage amplitude signal reference; the measured capacitor voltage is subjected to Fourier transform and then is subjected to difference with a reference signal and then is input into a third PID controller and a fourth PID controller; and the output of the third PID controller and the fourth PID controller is output as a modulation signal after coordinate transformation to generate a converter trigger pulse to the converter.
The setting model objective function in step 2) is ITAE + ISE, i.e. J ═ t | e (t) | + e (t)2dt, where J is the set model objective function value, e (t) is the controlled variable deviation, and t is time.
And 4) the inspection model is to add a step disturbance signal in the output signal of the third PID controller (3) on the basis of the setting model.
The objective function of the test model in step 4) is ITAE + ISE, i.e. J ═ t | e (t) | + e (t)2dt, where J is the set model objective function value, e (t) is the controlled variable deviation, and t is time.
The updating in the step 6) comprises the following steps:
(1) the distance between each wolf and alpha, beta and delta wolf before updating is obtained, and the specific formula is as follows:
Dα(t)=C1Xα(t)-X(t)
Dβ(t)=C2Xβ(t)-X(t)
Dδ(t)=C3Xδ(t)-X(t)
C=diag(2r1)
wherein, Xα(t)、Xβ(t)、Xδ(t) is the position before updating alpha, beta, delta wolf, X (t) is the position before updating all wolfs, i.e. the current PID parameter value, Dα、Dβ、DδIn order to calculate the distance between the position of each wolf and the positions of alpha, beta and delta wolfs under the consideration of certain randomness, C is a random coefficient, r is a random coefficient1Are random variables subject to uniform distribution over 0 to 1;
(2) and updating the position according to the distance between each wolf and the alpha, the beta and the delta wolfs respectively, wherein the specific formula is as follows:
X1(t+1)=Xα(t)-A1Dα(t)
X2(t+1)=Xβ(t)-A2Dβ(t)
X3(t+1)=Xδ(t)-A3Dδ(t)
A=diag(2ar2-a)
wherein, X1、X2、X3For each updated position of wolf according to alpha, beta, delta wolf, A is a random coefficient, a is a constant decaying from 2 to 0 with iteration number, r2Is a random variable subject to uniform distribution over 0 to 1, X (t +1) is the position of the updated wolf, and a is a random coefficient.
The invention discloses a micro-grid alternating current-direct current section converter PID parameter optimization method based on a gray wolf algorithm, wherein the PID parameter is optimized by the gray wolf algorithm, so that the PID controller parameter can be adjusted to an optimal value under a given target. The invention realizes optimization by simulating the process of the wolf colony prey based on the wolf algorithm, has the advantages of simple structure, easy algorithm parameter setting, small memory amount, easy programming and stronger global search capability, and is proved to be stronger than a particle swarm algorithm and a differential evolution algorithm. Therefore, compared with other PID optimization, the PID controller parameter optimization method can better optimize the PID parameters, especially the PID controller parameters in a complex system, and obtain better control effect.
Detailed Description
The following describes in detail the optimization method of PID parameters of the microgrid ac/dc section converter based on the gray wolf algorithm in combination with embodiments and drawings.
As shown in fig. 5, the method for optimizing PID parameters of a microgrid ac/dc section converter based on the gray wolf algorithm of the present invention includes the following steps:
1) setting the number of wolfs in a wolf group, the maximum iteration times, the dimension of the problem and the value range of PID parameter variables, and initializing the position of the wolf group;
2) counting iteration times, and calculating a setting model objective function value corresponding to the position of each wolf, namely an objective function value of a micro-grid AC/DC section converter PID control effect;
the micro-grid AC/DC section converter comprises a DC side of the converter, and an AC side of the converter is connected to an AC side power supply through an LCL filter; the control module is divided into inner loop control and outer loop control, and is provided with a first PID controller 1, a second PID controller 2, a third PID controller 3 and a fourth PID controller 4 in total; the first PID controller 1 and the second PID controller 2 form an outer loop control for controlling the voltage of an alternating current side and a direct current side, and the third PID controller 3 and the fourth PID controller 4 form an inner loop control for controlling the amplitude and the phase angle of the voltage of the output capacitor of the filter; the direct current voltage and the alternating current voltage respectively pass through a first PID controller 1 and a second PID controller 2 to obtain a capacitance voltage angle reference signal and a capacitance voltage amplitude signal reference; the measured capacitor voltage is subjected to Fourier transform and then is subjected to difference with a reference signal and then is input into a third PID controller 3 and a fourth PID controller 4; the output of the third PID controller 3 and the fourth PID controller 4 is output as a modulation signal after coordinate transformation to generate a converter trigger pulse to the converter.
The tuning model objective function is ITAE + ISE, i.e. J ═ t | e (t) | e (t)2dt, where J is the set model objective function value, e (t) is the controlled variable deviation, and t is time.
The ITAE increases the time t for the deviation amount as the weight, reduces the consideration degree for the larger deviation at the initial moment, increases the consideration degree for the steady-state error, and is beneficial to making up the defect that the ISE is not enough to consider the small error after the ISE is stabilized. ISE increases the degree of consideration for large variations by the squared value of the variation, and is advantageous in suppressing the occurrence of large variations.
3) Dividing a wolf group into alpha, beta, delta and omega according to a set model objective function value, wherein the alpha wolf is a wolf with the optimal PID effect, the beta wolf is a wolf with the suboptimal PID effect, the delta wolf is a wolf with the third best PID effect, and the omega wolf is the rest wolf;
4) calculating an objective function value of a test model corresponding to the position of the alpha wolf, namely the objective function value of the PID control effect of the micro-grid AC/DC section converter after increasing disturbance;
the checking model is that a step disturbance signal is added to the output signal of the third PID controller 3 on the basis of the setting model.
The test model objective function is ITAE + ISE, i.e. J ═ t | e (t) | e (t) | + e (t)2dt, where J is the set model objective function value, e (t) is the controlled variable deviation, and t is time.
5) Judging whether the PID control effect of the test model is not improved for V times continuously, if so, stopping iteration, and executing the step 8), otherwise, executing the step 6), wherein V is more than or equal to 6;
6) updating the position of the wolf group representing the PID parameter; the method comprises the following steps:
(1) the distance between each wolf and alpha, beta and delta wolf before updating is obtained, and the specific formula is as follows:
Dα(t)=C1Xα(t)-X(t)
Dβ(t)=C2Xβ(t)-X(t)
Dδ(t)=C3Xδ(t)-X(t)
C=diag(2r1)
the existence of C leads the obtained distance between the gray wolves to have certain randomness from the bionics, and can better simulate the random obstacle encountered by the gray wolves when the gray wolves are close to the prey;
wherein, Xα(t)、Xβ(t)、Xδ(t) is the position before updating alpha, beta, delta wolf, X (t) is the position before updating all wolfs, i.e. the current PID parameter value, Dα、Dβ、DδIn order to calculate the distance between the position of each wolf and the positions of alpha, beta and delta wolfs under the consideration of certain randomness, C is a random coefficient, r is a random coefficient1Are random variables subject to uniform distribution over 0 to 1;
(2) and updating the position according to the distance between each wolf and the alpha, the beta and the delta wolfs respectively, wherein the specific formula is as follows:
X1(t+1)=Xα(t)-A1Dα(t)
X2(t+1)=Xβ(t)-A2Dβ(t)
X3(t+1)=Xδ(t)-A3Dδ(t)
A=diag(2ar2-a)
wherein, X1、X2、X3For each updated position of wolf according to alpha, beta, delta wolf, A is a random coefficient, a is a constant decaying from 2 to 0 with iteration number, r2Is a random variable subject to uniform distribution over 0 to 1, X (t +1) is the position of the updated wolf, a is a constant that decays from 2 to 0 with the number of iterations, r2Is a random variable subject to uniform distribution over 0 to 1, and a is a random coefficient.
The value range of the diagonal element in A is [ -2,2]. This is because, at the beginning of the algorithm, P (|2 ar)2-a|>1)>0, helping the wolf to get away from the prey, i.e. more inclined to global search; at the later stage of the algorithm, P (|2 ar)2-a|>1) 0, helps the gray wolf to approach the prey, i.e., is more prone to local search and convergence.
The position of the current prey is approximately expressed by the position of the alpha wolf, and the distance D between the position of each wolf and the position of the alpha wolf is calculated under the consideration of certain randomnessαThen, D multiplied by a random coefficient is added on the basis of the current position of each wolfαObtaining the position X of each wolf after the position update according to the alpha wolf1;
Similarly, according to the method, alpha wolf is changed into beta wolf and delta wolf, and the position X of each wolf after position updating is obtained according to the beta wolf and the delta wolf2、X3;
Finally, the updated position X (t +1) of each wolf is X1、X2、X3Is calculated as the arithmetic mean of (1).
7) Judging whether the current iteration times reach the set maximum iteration times, if so, stopping iteration, executing the step 8), and if not, returning to the step 2);
8) and outputting the position of the alpha wolf, namely the global optimal PID parameter value of the microgrid alternating current-direct current section converter.
An example is given below according to the system architecture shown in fig. 1:
example one: the control object is an AC/DC cross section converter, a circuit topological diagram of the AC/DC cross section converter is shown in figure 2, and a block diagram of a control module is shown in figure 3, and the AC side voltage is controlled.
The setting model of the embodiment is an AC/DC section converter PID controller, and the checking model is to add an interference signal on the output side of PID3 on the basis of the setting model.
The ratio of the method of the present invention to the PSO algorithm is shown in table 1 and fig. 6 and 7.
Table 1 gives K set by two methodsp、Ki、KdAnd comparing the system step response performance parameters;
TABLE 1
Wherein tf is the rising time, ts is the adjusting time, the deviation is plus or minus 2 percent, and sigma percent is the overshoot.
As can be seen from Table 1, the method (GWO) of the present invention has the same rise time and slightly worse overshoot than the Particle Swarm Optimization (PSO), but the adjustment time is significantly improved and reduced by 76.39%.
As can be seen from FIG. 6, the convergence rate of the method of the present invention is faster, and the final convergence result is also better than the particle swarm; the method of the invention achieves the generalization ability test convergence condition after iteration is carried out for 42 times, and the particle swarm achieves the generalization ability test convergence condition after 59 times;
fig. 7 also shows that the waveform optimized by the method of the present invention is much better than the waveform optimized by particle swarm, enters a steady state more quickly, and has good dynamic performance.
Example two: the control object selects an abstract fifth-order transfer function, and the transfer function is as follows:
the setting model of the example is an abstract fifth-order transfer function PID controller, and the checking model is to add an interference signal on the output side of the PID on the basis of the setting model.
A comparison of the method of the present invention with the PSO algorithm is shown in table 2 and fig. 8.
Table 2 gives K set by two methodsp、Ki、KdAnd comparing the system step response performance parameters;
TABLE 2
Wherein tf is the rising time, ts is the adjusting time, the deviation is plus or minus 2 percent, and sigma percent is the overshoot.
As can be seen from Table 2, the method (GWO) of the present invention has similar rise time compared with the Particle Swarm Optimization (PSO), but the adjustment time and the overshoot are both significantly improved, especially, the overshoot is reduced by 31.02%; as can be seen from fig. 7, the overall step response curve is also more excellent.
Example three: the control object selects a specific direct current motor model, and controls the rotating speed of the direct current motor as shown in fig. 4.
The setting model of the embodiment is a direct current motor PID controller, and the checking model is to add an interference signal on the load side of the direct current motor on the basis of the setting model.
The ratio of the inventive method to the PSO algorithm is shown in table 3 and fig. 9.
Table 3 gives K set by two methodsp、Ki、KdAnd comparing the system step response performance parameters;
TABLE 3
Wherein tf is the rising time, ts is the adjusting time, the deviation is plus or minus 2 percent, and sigma percent is the overshoot.
As can be seen from Table 3, the method of the present invention (GWO) has similar rise times as compared to the particle swarm method (PSO), but improved adjustment times and overshoot; as can be seen from fig. 8, the overall step response curve is also more excellent.
As can be seen from the above examples, the optimization effect of the invention is better, and the generalization capability is good.
The advantage of example three is less significant than the advantages of the two examples, since the dc motor is simpler in model, only a second order linear model.
When a simple model is processed, the traditional algorithms such as the gray wolf algorithm and the particle swarm do not have obvious advantages, but for a complex model, the advantages of the gray wolf algorithm are very obvious, the convergence speed is high, and the final convergence result is more excellent.
The method is not limited to the application in the example, can be used for optimizing the controller parameters under other conditions, has a good effect on optimizing the controller parameters of a complex system, and has a certain application prospect.