Wavelet denoising optimal threshold setting method based on whale optimization algorithm

文档序号:8338 发布日期:2021-09-17 浏览:24次 中文

1. A wavelet denoising threshold parameter setting method based on a whale optimization algorithm is characterized by comprising the following steps:

step 1, carrying out noise processing on detected power grid original signals, and then carrying out multi-resolution analysis on the signals by using wavelet transformation to obtain wavelet coefficients of each layer;

step 2, setting the population scale of the whales to be N, so that the positions of N whales can be generated; then initializing various parameters of the algorithm and setting the maximum iteration number t of the algorithmmax

Step3, taking the initial whale position as a threshold function value, carrying out thresholding treatment on the wavelet coefficient to obtain a new wavelet coefficient, and carrying out inverse transformation to obtain a denoised power grid signal; wherein the threshold function is as follows:

in the formula, lambda is a wavelet coefficient threshold, y is a wavelet coefficient decomposed from a power grid signal, and beta is a positive integer;

step 4, performing minimum mean square error processing on the new power grid signal and the original power grid signal, and taking the processed signals as a target function; the objective function is:

in the formula (I), the compound is shown in the specification,the estimation signal is an estimation signal after the noise-containing signal is processed by a threshold method, and s is a power grid initial signal;

step 5, calculating the fitness value of each whale in the initial state through an objective function, sequencing the fitness values, determining the proper whale position as the initial optimal solution of the algorithm, and defining the position as X*

Step 6, entering a main algorithm loop, judging the next behavior of the whales according to a flow set by the whale optimization algorithm, and selectively updating the positions of the whale individuals;

7, after the position is updated, calculating the target fitness value of all whale individuals again, comparing the calculated target fitness value with the previous initial optimal solution, and if the calculated target fitness value is better than the X value*Then to X*Replacing the information;

and 8, judging whether the maximum iteration times is reached, if so, terminating iteration and outputting the current optimal solution, otherwise, turning to the step3 to continue iteration.

2. The wavelet denoising threshold parameter setting method based on the whale optimization algorithm as claimed in claim 1, wherein the step 6 specifically is:

entering an algorithm main loop, judging the value of p, if p is less than 0.5 and | A | is less than 1, carrying out contraction and surrounding on a prey by whale individuals according to a formula (1.3), and updating the current position, otherwise carrying out global proxy updating on the position according to a formula (2.1); if p is more than or equal to 0.5, updating the position of the whale individual in a spiral motion mode according to the formula (1.7);

the algorithm loop comprises:

first wrapping predation

At this stage, the position of each whale individual represents a potential solution of the optimization problem in the search space, and N whale individuals are randomly generated in the search space to form an initial population on the assumption that the dimension of the search space is d; because the global optimal solution of the optimization problem is not known a priori in the searching process, the global optimal solution with the lowest population fitness is taken as the current global optimal solution; after a complete local optimal solution is defined, other whale individuals can swim to the optimal individual direction, namely, the position of the whale individual is updated and iterated, and the mathematical model is as follows:

X(t+1)=X*(t)-A·D (1.3)

where t represents the number of iterations of the algorithm, X*(t) is the optimal position of whale in the t iteration, X (t) is the position of whale individual in the t iteration, D is the position of whale individual, namely the distance between the solved individual and the optimal solution, the constant A is a convergence factor, C is a swing factor, and the calculation is respectively carried out by the following two formulas:

A=2a×r1-a (1.4)

C=2×r2 (1.5)

in the formula, r1And r2Is the random number in (0,1), the value of a decreases linearly from 2 to 0 with the increase of the iteration number;

do a thing to prey on bubbles

According to the hunting behavior of the whale, which walks spirally upward while contracting the prey enclosure for forming the bubble net attack, the contraction mechanism is realized by linear reduction of a, and the mathematical model of the spiral walking path is:

X(t+1)=X*(t)+Dp·ebl·cos(2πl) (1.7)

Dp=|X*(t)-X(t)| (1.8)

in the formula, DpRepresenting the distance between individual whales and optimal individual; b is a spiral constant which has the function of limiting the shape of the search individual to perform spiral motion; l is [ -1,1 [ ]]A random value in between;

when the convergence factor | A | is less than 1 in the algorithm, when whales simultaneously contract and encircle and spirally walk in the predation process, in order to simulate the behavior, a selection probability p needs to be introduced into the algorithm, and the mathematical model of the selection probability p is as follows:

wherein p is uniformly distributed over [0,1 ];

from equation (1.9), the whale optimization algorithm selects the contraction enclosure and the spiral motion with the same probability to update the whale's position at the next moment;

searching for prey

When the convergence factor | A | is greater than 1 in the algorithm, whales will swim outside the contraction enclosure, and the whales at this time do not follow the best whale position any more but randomly search for a prey in a larger range, namely, global search, so as to avoid trapping in local optimality, wherein the position update formula at this time is as follows:

D=|CXrand-X(t)| (2.0)

X(t+1)=Xrand-A·D (2.1)

in the formula, XrandThe position of a random whale in the current population is shown.

Background

The on-line monitoring of the partial discharge of the power equipment has important significance for guaranteeing the safe operation of the equipment, and due to the fact that the sensitivity and the precision of the on-line monitoring of the partial discharge are seriously influenced by on-site radio interference, white noise, pulse interference and the like, various anti-interference circuits and digital denoising methods are applied to the on-line monitoring of the partial discharge. And the detail part in the observation data of the unsteady-state signal contains a large amount of characteristic information, and particularly in the traveling wave fault location, the noise can influence the extraction of the traveling wave head, so when the noise-containing signal is denoised, people hope to better retain the detail of the noise-containing signal while filtering the noise.

The wavelet threshold denoising algorithm achieves the purpose of denoising by setting a proper threshold and modifying the wavelet decomposition coefficient of a signal according to a selected threshold function. The literature proposes an approximate function of a mean square error function, an optimal value in the mean square error sense can be obtained through the function, and a great deal of research work is performed around an optimal threshold value, so that the wavelet threshold value filtering method tends to be perfect. In recent years, other scholars do a lot of work on the aspects of constructing a threshold function, determining an optimal threshold and the like, and the optimal denoising effect in the mean square error sense is obtained through various methods. The traditional Fourier transform plays a great role in denoising steady-state signals, but cannot depict local information of unsteady-state signals, so that the traditional Fourier transform is not suitable for denoising the signals. The wavelet basis function has a local analysis function relative to a sine basis function used for Fourier transform, and can well depict the detailed characteristics of signals. And the optimal selection of the wavelet threshold has important significance for extracting effective partial discharge signals.

The selection of the wavelet threshold can cause the distortion of a de-noised signal and possibly cause the false identification of a traveling wave head, so the selection of the threshold is one of the key problems of the good and bad de-noising effect of the wavelet.

Disclosure of Invention

Aiming at the problems that iteration is difficult to converge and the calculation time is long when the optimal threshold wavelet algorithm is denoised, and the optimal threshold wavelet algorithm is difficult to be practically applied to a power equipment real-time monitoring system, and the problem that the traveling wave head is difficult to extract through wavelet transformation under the noise-containing state in the traveling wave ranging, a Whale Optimization Algorithm (WOA) is introduced to carry out parameter setting on the optimal threshold solution of the wavelet threshold method. The whale optimization algorithm has the advantages of simple principle, easy realization of the process, high optimization speed and the like, can perform global parallel random search on the target function in a solution space, enables the threshold to be obtained quickly and accurately, and has great significance for the wavelet denoising algorithm.

The invention adopts the following technical scheme:

and Step 1, carrying out noise processing on the detected power grid original signal, and then carrying out multi-resolution analysis on the signal by using wavelet transformation to obtain wavelet coefficients of each layer.

Step 2 sets the population size of whales to be N, so that the positions of N whales are generated. Then initializing various parameters of the algorithm and setting the maximum iteration number t of the algorithmmax

Step3, taking the initial whale position as a threshold function value, carrying out thresholding treatment on the wavelet coefficient to obtain a new wavelet coefficient, and carrying out inverse transformation to obtain a denoised power grid signal. Wherein the threshold function is as follows:

in the formula, λ is a wavelet coefficient threshold, y is a wavelet coefficient decomposed from the power grid signal, β is a positive integer, and β may be 2.

And Step 4, carrying out minimum mean square error processing on the new power grid signal and the original power grid signal, and taking the processed signals as an objective function. The objective function is:

in the formula (I), the compound is shown in the specification,the estimation signal is the estimation signal after the noise-containing signal is processed by a threshold value method, and s is the initial signal of the power grid.

Step 5, calculating the fitness value of each whale in the initial state through an objective function, sequencing and determiningDefining proper whale position as initial optimal solution of algorithm, and defining X*

Step 6 enters the algorithm main loop, the value of p is judged, if p is less than 0.5 and | A | is less than 1, the whale individual contracts and surrounds the prey according to the formula (1.3), the current position is updated, and otherwise, the position is updated through global proxy according to the formula (2.1). If p is more than or equal to 0.5, the whale individual updates the position in a spiral motion mode according to the formula (1.7).

Further illustrating the principles of algorithm loops

First wrapping predation

At this stage, the position of each individual of the whale represents a potential solution of the optimization problem in the search space, and assuming that the dimension of the search space is d, the N individual whale individuals randomly generated in the search space form an initial population. Since the global optimal solution of the optimization problem is not known a priori during the search process, the lowest population fitness is taken as the current global optimal solution. After a complete local optimal solution is defined, other whale individuals can swim to the optimal individual direction, namely, the position of the whale individual is updated and iterated, and the mathematical model is as follows:

X(t+1)=X*(t)-A·D (1.3)

where t represents the number of iterations of the algorithm, X*(t) is the optimal position of whale in the t iteration, X (t) is the position of whale individual in the t iteration, D is the position of whale individual, namely the distance between the solved individual and the optimal solution, the constant A is a convergence factor, C is a swing factor, and the calculation is respectively carried out by the following two formulas:

A=2a×r1-a (1.4)

C=2×r2 (1.5)

in the formula, r1And r2Is a random number in (0,1), and the value of a decreases linearly from 2 to 0 as the number of iterations increases.

Do a thing to prey on bubbles

According to the hunting behavior of the whale, which walks spirally upward while contracting the prey enclosure for forming the bubble net attack, the contraction mechanism is realized by linear reduction of a, and the mathematical model of the spiral walking path is:

X(t+1)=X*(t)+Dp·ebl·cos(2πl) (1.7)

Dp=|X*(t)-X(t)| (1.8)

in the formula, DpRepresenting the distance between individual whales and optimal individual; b is a spiral constant which has the function of limiting the shape of the search individual to perform spiral motion; l is [ -1,1 [ ]]A random value in between.

When the convergence factor | A | is less than 1 in the algorithm, when whales simultaneously contract and encircle and spirally walk in the predation process, in order to simulate the behavior, a selection probability p needs to be introduced into the algorithm, and the mathematical model of the selection probability p is as follows:

wherein p is uniformly distributed over [0,1 ].

From equation (1.9), it can be seen that the whale optimization algorithm selects the contracting bounding and spiral motion with the same probability to update the whale's position next moment.

Searching for prey

When the convergence factor | A | is greater than 1 in the algorithm, whales will swim outside the contraction enclosure, and the whales at this time do not follow the best whale position any more but randomly search for a prey in a larger range, namely, global search, so as to avoid trapping in local optimality, wherein the position update formula at this time is as follows:

D=|CXrand-X(t)| (2.0)

X(t+1)=Xrand-A·D (2.1)

in the formula, XrandThe position of a random whale in the current population is shown.

Step 7 position update at this timeAfter finishing, calculating target fitness values of all whale individuals again, comparing the calculated target fitness values with the previous initial optimal solution, and if the calculated target fitness values are better than the X value*Then to X*The information is replaced.

And Step 8, judging whether the maximum iteration number is reached, if so, terminating iteration and outputting the current optimal solution, otherwise, turning to Step3 to continue iteration.

The invention has the beneficial effects that:

by introducing the whale optimization algorithm, the parameter setting is carried out on the optimal threshold solution of the optimal threshold wavelet denoising. The whale optimization algorithm has the advantages of simple principle, easy realization of process, high optimization speed and the like, can perform global parallel random search on a target function in a solution space, enables the threshold to be obtained quickly and accurately, greatly reduces the calculation time and cost, and has great significance for the practical application of wavelet denoising in an online monitoring system.

Drawings

FIG. 1 is a flow chart of setting of an optimal threshold of a wavelet threshold method based on a whale optimization algorithm;

FIG. 2 is a comparison graph of wavelet coefficients of initial current signals of a power grid after wavelet decomposition and after noise addition and wavelet coefficients processed by a wavelet threshold method of a whale optimization algorithm

FIG. 3 is a comparison diagram of the power grid signals before and after denoising

FIG. 4 is a detail comparison diagram of a power grid signal before denoising and a denoised power grid signal

Detailed Description

The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

As shown in fig. 1 to 4, an embodiment of the invention discloses a wavelet denoising threshold parameter setting method based on a whale optimization algorithm, which comprises the following steps:

the method comprises the steps of conducting noise adding processing on detected original fault signals of a power grid, then conducting multi-resolution analysis on the signals through wavelet transformation, and obtaining wavelet coefficients of all layers.

And the population scale of the whale is set to be N, so that the positions of the N whales can be generated. Then initializing various parameters of the algorithm and setting the maximum iteration number t of the algorithmmax

Thirdly, taking the initial whale position as a threshold function value, thresholding the wavelet coefficient to obtain a new wavelet coefficient, and performing inverse transformation to obtain the denoised power grid signal. Wherein the threshold function is as follows:

in the formula, λ is a wavelet coefficient threshold, y is a wavelet coefficient decomposed from the power grid signal, β is a positive integer, and β may be 2.

And fourthly, performing minimum mean square error processing on the new power grid signal and the original power grid signal to serve as an objective function. The objective function is:

in the formula (I), the compound is shown in the specification,the estimation signal is the estimation signal after the noise-containing signal is processed by a threshold value method, and s is the initial signal of the power grid.

Calculating the fitness value of each whale in the initial state through the objective function, sequencing, determining the proper position of the whale as the initial optimal solution of the algorithm, and defining the position as X*

Sixthly, entering an algorithm main loop, judging the value of p, if p is less than 0.5 and | A | is less than 1, enabling whale individuals to contract and surround prey according to a formula (1.3), and updating the current position, otherwise, performing global proxy updating on the position according to a formula (2.1). If p is more than or equal to 0.5, the whale individual updates the position in a spiral motion mode according to the formula (1.7).

Further illustrating the principles of algorithm loops

(ii) surround predation

At this stage, the position of each individual of the whale represents a potential solution of the optimization problem in the search space, and assuming that the dimension of the search space is d, the N individual whale individuals randomly generated in the search space form an initial population. Since the global optimal solution of the optimization problem is not known a priori during the search process, the lowest population fitness is taken as the current global optimal solution. After a complete local optimal solution is defined, other whale individuals can swim to the optimal individual direction, namely, the position of the whale individual is updated and iterated, and the mathematical model is as follows:

X(t+1)=X*(t)-A·D (1.3)

where t represents the number of iterations of the algorithm, X*(t) is the optimal position of whale in the t iteration, X (t) is the position of whale individual in the t iteration, D is the position of whale individual, namely the distance between the solved individual and the optimal solution, the constant A is a convergence factor, C is a swing factor, and the calculation is respectively carried out by the following two formulas:

A=2a×r1-a (1.4)

C=2×r2 (1.5)

in the formula, r1And r2Is a random number in (0,1), and the value of a decreases linearly from 2 to 0 as the number of iterations increases.

② air bubble predation

According to the hunting behavior of the whale, which walks spirally upward while contracting the prey enclosure for forming the bubble net attack, the contraction mechanism is realized by linear reduction of a, and the mathematical model of the spiral walking path is:

X(t+1)=X*(t)+Dp·ebl·cos(2πl) (1.7)

Dp=|X*(t)-X(t)| (1.8)

in the formula, DpRepresentsDistance between individual whale and optimal individual; b is a spiral constant which has the function of limiting the shape of the search individual to perform spiral motion; l is [ -1,1 [ ]]A random value in between.

When the convergence factor | A | is less than 1 in the algorithm, the whale performs contraction enclosure and spiral migration simultaneously in the predation process, and in order to simulate the behavior, a selection probability p needs to be introduced into the algorithm, and the mathematical model of the selection probability p is as follows:

wherein p is uniformly distributed over [0,1 ].

From equation (1.9), it can be seen that the whale optimization algorithm selects the contracting bounding and spiral motion with the same probability to update the whale's position next moment.

Searching for prey

When the convergence factor | A | is greater than 1 in the algorithm, whales will swim outside the contraction enclosure, and the whales at this time do not follow the best whale position any more but randomly search for a prey in a larger range, namely, global search, so as to avoid trapping in local optimality, wherein the position update formula at this time is as follows:

D=|CXrand-X(t)| (2.0)

X(t+1)=Xrand-A·D (2.1)

in the formula, XrandThe position of a random whale in the current population is shown.

After the position is updated, calculating target fitness values of all whale individuals again, comparing the calculated target fitness values with the previous initial optimal solution, and if the calculated target fitness values are better than X*Then to X*The information is replaced.

And judging whether the maximum iteration times is reached, if so, terminating the iteration and outputting the current optimal solution, otherwise, turning to Step3 to continue the iteration.

In the example, a 350kv power grid single-phase short-circuit fault is selected, ATP/EMTP electromagnetic simulation software is adopted, and A-phase fault current is collected as an analysis object. Through the graphs 2-4, it can be seen that the optimal threshold parameter can be effectively set after a whale optimization algorithm is introduced, traveling wave head information can be obviously reserved, and the front and back comparison of the denoising effect is obvious.

Finally, only specific embodiments of the present invention have been described in detail above. The invention is not limited to the specific embodiments described above. Equivalent modifications and substitutions by those skilled in the art are also within the scope of the present invention. Accordingly, equivalent alterations and modifications are intended to be included within the scope of the invention, without departing from the spirit and scope of the invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:目标聚档方法、电子设备和计算机存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!