Power quality disturbance classification method based on Gram angle field and CNN-LSTM
Through the Gram angle field and CNN-LSTM, the power quality disturbance classification method is automatically extracted and time-dependent learning is carried out, which solves the problems of subjectivity, gradient vanishing and large storage space in the prior art, and realizes efficient and accurate power quality disturbance identification.
Patent Information
- Application Number
- CN202210812531.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2042-07-12
AI Technical Summary
The existing power quality disturbance identification methods have problems such as subjectivity of manual feature extraction, gradient vanishing and large storage space occupancy, making it difficult to adapt to complex disturbances of high-dimensional, time-varying, and nonlinearity.
The power quality disturbance classification method of Gram angle field and CNN-LSTM is adopted, and the one-dimensional data is converted into images through GAF. The three-layer CNN network automatically extracts features. The LSTM layer performs time correlation learning, and the probability layer calculates the probability of the output of the fully connected layer to realize automatic identification of power quality disturbance.
It avoids the subjectivity of artificial feature extraction, alleviates the problem of gradient vanishing, improves noise immunity and generalization, saves storage space, and improves recognition accuracy and computing efficiency.
Smart Images

Figure CN115115888B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power quality classification and recognition, and in particular to a power quality disturbance classification method based on Gram angle field and CNN-LSTM. Background Art
[0002] With the development of social economy, electric energy has become an indispensable part of production and life. The quality of electric energy affects all aspects of the national economic level and people's daily life. At present, with the rapid development of power electronics technology, a large number of nonlinear loads are increasing, making the quality of electric energy worse. At the same time, the large-scale access of distributed power sources such as wind power and photovoltaic power also makes the power grid vulnerable to randomness and volatility.
[0003] The quality of power will have a great impact on both the primary and secondary parts of the power system. For the primary system, poor power quality will deteriorate the operating conditions of the system and threaten the normal operation of the system. For the secondary system, power quality problems will reduce the service life of the equipment and even directly cause equipment failures, bringing immeasurable losses to the power system. In addition, power quality problems may also cause relay protection devices to malfunction or refuse to operate, which will have an adverse impact on the safe and stable operation of the power system. Therefore, the study of power quality is of great significance.
[0004] At present, there is a relatively mature idea for the study of power quality disturbance, which is to take two steps to achieve it, namely, feature extraction and signal classification. Common feature extraction methods include Fourier transform, wavelet transform, Hilbert-Huang transform, etc. Common signal classification methods include support vector machine, random forest, etc. These physical model methods have their own characteristics, which improve the accuracy of classification and recognition to a certain extent, but there are certain limitations in the analysis of uncertain factors, and it is difficult to adapt to complex disturbance phenomena with high dimensions, time variation, and nonlinearity.
[0005] There are also some power quality disturbance identification methods, such as support vector machines, probabilistic neural networks, etc. In general, these methods generally have the following problems:
[0006] Subjectivity of manually extracted features. The selection of feature elements is generally based on the experience of researchers. This method of manually intervened feature selection not only has a slow feature extraction speed, but is also easily affected by personal factors, resulting in too many feature elements being selected, some invalid features, or insufficient feature elements being selected, which cannot fully reflect the true characteristics of the data, thus affecting the accuracy of power quality disturbance identification.
[0007] There is a problem of gradient vanishing. The sigmoid activation function is usually used in traditional neural network training. The maximum derivative of the sigmoid activation function is 0.25, and most values are pushed to the saturation area on both sides. This causes most values to need to be multiplied by a gradient less than 0.25 after each sigmoid activation function, making the calculation result smaller. As the number of layers of the neural network increases, the gradient decays rapidly to 0, causing the gradient to vanish, and the network can no longer be trained and learned.
[0008] Requires a large storage space. In the process of classifying and identifying power quality disturbances, a large amount of data needs to be analyzed. Analyzing these data requires a large storage space, which makes the computer overwhelmed. At the same time, it takes a long time to read the data information, affecting the computing speed.
[0009] Deep learning is a data-driven technology. Its essence is to determine model parameters from a large amount of data and use the trained parameters for data processing, avoiding the limitations of physical property modeling. Deep learning has a wide range of applications in many fields such as language recognition, image processing, and data mining. It is divided into feedforward neural networks and feedback neural networks. Unlike traditional artificial neural networks, deep neural networks use a hierarchical training mechanism. Through unsupervised training, supervised fine-tuning, and the method of optimizing activation functions, multi-layer perceptrons are constructed to achieve layer-by-layer feature extraction of data. Summary of the invention
[0010] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and provide a power quality disturbance classification method based on Gram angle field and CNN-LSTM. The three-layer CNN network automatically extracts image features and avoids the subjective interference of manually extracted features.
[0011] To achieve the above object, the present invention adopts the following technical solutions:
[0012] The present invention provides a power quality disturbance classification method based on Gram angle field and CNN-LSTM, which is characterized by comprising the following steps:
[0013] S1. Obtain power quality disturbance data and preprocess the sample data;
[0014] S2, GAF converts the one-dimensional data from rectangular coordinates to polar coordinates, constructs the Gram matrix, converts it into an image, and then compresses the image;
[0015] S3, extracting features from the compressed image in S2 using a three-layer CNN network;
[0016] S4, the LSTM layer performs time correlation learning on the feature values extracted in S3;
[0017] S5, performing dimensionality reduction processing on the feature values output by S4 by a fully connected layer;
[0018] S6. The probability layer calculates the probability of each output of the fully connected layer, and then the classification layer determines the category of power quality.
[0019] Furthermore, in S1, the sample data is preprocessed by normalizing the sample data using a deviation normalization method so that the normalized data is between [-1, 1].
[0020] Furthermore, in S2, the step of converting data into an image is:
[0021] S201, GAF maps the one-dimensional power quality disturbance signal from the rectangular coordinate system to the polar coordinate system, and then constructs the Gram matrix. The conversion function and the Gram matrix are:
[0022]
[0023]
[0024] Among them, x * represents the normalized value; Represents the angle mapped to polar coordinates;
[0025] S202. Call the imagesc function in MATLAB to convert the Gram matrix into a two-dimensional image. Each element in the matrix corresponds to the color of a pixel in the image. The size of the original image is equal to the number of rows and columns of the matrix. Sample every 10 pixels in the horizontal and vertical directions of the original image. There are 3 sampling channels. Call the round function to round the sampling points to the nearest integer. Then, the processed sampling points are organized into a matrix in the sampling order. Call the imagesc function to convert it into an image to achieve image compression. The storage space required for the compressed image is 3.31% of the original image.
[0026] Furthermore, in S3, the feature extraction of the three-layer CNN network is as follows: the convolution layer automatically extracts the image feature value, the batch normalization layer performs normalization, the nonlinear activation function ReLU is activated, the maximum pooling layer performs the maximum pooling operation, and the extracted feature variables are simplified by downsampling.
[0027] Furthermore, in S6, the probability layer calculates the probability of each output of the fully connected layer as follows:
[0028]
[0029] Among them, x i represents the i-th output of the fully connected layer; y iRepresents the probability of the i-th output of the probability layer.
[0030] The beneficial effects of the present invention are as follows: the designed three-layer CNN network automatically extracts the features of the image, avoiding the subjective interference of manually extracting features. In addition, the ReLU nonlinear activation function is used in the CNN network to alleviate the problem of gradient disappearance to a certain extent. A probability layer is added between the fully connected layer and the classification layer to make the feature vector compact within the class and separable between classes. At the same time, an LSTM layer is added after the CNN network, so that the model has good noise resistance and generalization, and can be effectively applied to the classification and identification of power quality disturbances.
[0031] The present invention compresses the image while retaining the image information as much as possible, thereby saving a large amount of computer storage space and improving the reading rate of the image information.
[0032] The present invention adopts CNN network to automatically extract the features of the image, avoiding the subjectivity of the traditional method of manually extracting features, which affects the accuracy of power quality identification. The CNN network designed by the present invention is a three-layer structure, each layer includes a two-dimensional convolution layer, a batch normalization layer and a maximum pooling layer. The convolution kernel size in the two-dimensional convolution layer is small, which is suitable for power quality disturbance data with high data complexity and many sampling points. The ReLU nonlinear activation function used is a left saturation activation function, and the derivative is 1 when the horizontal axis is the positive half axis. Compared with the sigmoid function with saturation at both ends and a derivative of 0.25, it alleviates the gradient vanishing problem of the neural network to a certain extent.
[0033] The present invention adds an LSTM layer after the CNN network, which overcomes the shortcoming that the features extracted by the CNN network lack time dependence, and makes the model have good noise resistance performance.
[0034] The present invention proposes to add a probability layer between the fully connected layer and the classification layer, and use the formula of the probability layer to calculate the probability of each output of the fully connected layer, providing a basis for classification and recognition of the classification layer. Unlike the traditional softmax layer, the probability layer of the present invention ensures that the categories are separable while also ensuring that the feature vectors are compact within the class and separated between classes. This is very important for massive power quality data, and the softmax layer is not suitable for processing such huge data. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a block diagram of the power quality disturbance classification method of the Gram angle field and CNN-LSTM of the present invention;
[0036] Figure 2 This is the classification effect diagram of the noise-free environment;
[0037] Figure 3 This is the classification effect diagram when the signal-to-noise ratio is 10dB;
[0038] Figure 4 This is the classification effect diagram when the signal-to-noise ratio is 30dB;
[0039] Figure 5 This is the classification effect when the signal-to-noise ratio is 50dB. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0041] See also Figure 1 , the power quality disturbance classification method based on Gram angle field and CNN-LSTM includes the following steps:
[0042] S1. Obtain power quality disturbance data and preprocess the sample data;
[0043] S2, GAF converts the one-dimensional data from rectangular coordinates to polar coordinates, constructs the Gram matrix, converts it into an image, and then compresses the image;
[0044] S3, extracting features from the compressed image in S2 using a three-layer CNN network;
[0045] S4, the LSTM layer performs time correlation learning on the feature values extracted in S3;
[0046] S5, performing dimensionality reduction processing on the feature values output by S4 by a fully connected layer;
[0047] S6. The probability layer calculates the probability of each output of the fully connected layer, and then the classification layer determines the category of power quality.
[0048] In S1, the sample data is preprocessed by normalizing the sample data using a deviation normalization method so that the normalized data is between [-1, 1].
[0049] In S2, the steps of converting data into images are:
[0050] S201, GAF maps the one-dimensional power quality disturbance signal from the rectangular coordinate system to the polar coordinate system, and then constructs the Gram matrix. The conversion function and the Gram matrix are:
[0051]
[0052]
[0053] Among them, x *represents the normalized value; Represents the angle mapped to polar coordinates;
[0054] S202. Call the imagesc function in MATLAB to convert the Gram matrix into a two-dimensional image. Each element in the matrix corresponds to the color of a pixel in the image. The size of the original image is equal to the number of rows and columns of the matrix. Sample every 10 pixels in the horizontal and vertical directions of the original image. There are 3 sampling channels. Call the round function to round the sampling points to the nearest integer. Then, the processed sampling points are organized into a matrix in the sampling order. Call the imagesc function to convert it into an image to achieve image compression. The storage space required for the compressed image is 3.31% of the original image.
[0055] In S3, the feature extraction of the three-layer CNN network is as follows: the convolution layer automatically extracts the image feature value, the batch normalization layer performs normalization, the nonlinear activation function ReLU activates, the maximum pooling layer performs the maximum pooling operation, and the extracted feature variables are simplified by downsampling.
[0056] In S6, the probability layer calculates the probability of each output of the fully connected layer as follows:
[0057]
[0058] Among them, x i represents the i-th output of the fully connected layer; y i Represents the probability of the i-th output of the probability layer.
[0059] Embodiment 1:
[0060] This embodiment is based on the power quality disturbance classification method of GAF and CNN-LSTM, and takes voltage oscillation, voltage harmonics, voltage sag and voltage swell, which account for the largest proportion of disturbances in the power system, as classification objects.
[0061] like Figure 1 As shown, the specific steps of this embodiment are as follows:
[0062] (1) CNN-LSTM network structure: The CNN network consists of 3 two-dimensional convolutional layers, 3 maximum pooling layers, batch normalization layers, fully connected layers, probability layers, and classification layers. The convolution kernel size of the first convolutional layer is 3×3, and the number is 8; the convolution kernel size of the second convolutional layer is 3×3, and the number is 16; the convolution kernel size of the third convolutional layer is 3×3, and the number is 16; the size of the three maximum pooling layers is 2×2, and the sliding time window is 2; the batch normalization layer speeds up the training speed; the number of neurons in the LSTM layer is 64, and the activation function is the tanh function; the fully connected layer has 4 outputs; the activation function of the classification layer is the sigmoid function; the nonlinear activation function is the ReLU function, and all use zero padding.
[0063] (2) Configure training parameters: Divide the compressed images into training set and validation set at a ratio of 80%; the input layer image pixels are 224×340 and the number of channels is 3; the training method uses the adam optimizer; the maximum number of training rounds is set to 6 rounds, and each round has 25 iterations; set the dynamic learning rate, the initial learning rate is 0.001, and the learning rate is multiplied by 0.3 every 3 rounds; the verification frequency is once every 10 iterations; and the data is randomly shuffled before the start of each round of training and verification.
[0064] (3) Prepare sample data of power quality disturbance:
[0065] According to the mathematical models of voltage oscillation, voltage harmonics, voltage sag, and voltage swell in the IEEE 1159-2009 standard, MATLAB was used to simulate four types of power quality disturbance signals. The fundamental frequency was 50Hz, and white noise with signal-to-noise ratios of 10dB, 30dB, and 50dB was added to the signal. A total of 16,000 sample data were generated in this experiment, with 1,000 samples for each type of disturbance, three different noises, and a noise-free environment.
[0066] The sample data is normalized and the deviation normalization method is used to scale the sample data to between [-1,1]. The normalization formula is:
[0067]
[0068] Among them, x * is the standardized value; x i is the i-th sample data; max(X) is the maximum value in the sample data; min(X) is the minimum value in the sample data.
[0069] (4) Map the scaled values in step (3) from the rectangular coordinate system to the polar coordinate system, map the normalized values to angles, map the time to radius, and establish a Gram matrix according to the definition of GAF. Call the imagesc function in MATLAB to convert the Gram matrix into a two-dimensional image and calculate the size of the original image. Then sample every 10 pixels in both the horizontal and vertical directions of the original image, with 3 sampling channels. Call the round function to process the sampling points by rounding them off, then form a matrix of the processed sampling points in the sampling order, and call the imagesc function to convert it into an image to achieve image compression. Use image compression technology to compress the original image to save computer storage space and improve computing speed. The space occupied by the compressed image is only 3.31% of the space occupied by the original image.
[0070] (5) The result of step (4) is input into a three-layer CNN network. The convolution layer automatically extracts feature values, the batch normalization layer performs normalization, the nonlinear activation function ReLU is activated, and the maximum pooling layer performs pooling operations. The extracted feature variables are simplified by downsampling, and a total of three sets of convolution and pooling operations are performed.
[0071] (6) Input the result of step (5) into the LSTM layer for time correlation learning to improve the model's anti-noise ability. The learning process formula is:
[0072] f t =σ(W f [h t-1 , x t ]+b f )
[0073] i t =σ(W i [h t-1 , x t ]+b i )
[0074] o t =σ(W O [h t-1 , x t ]+b O )
[0075] C t =tanh(W c [h t-1 , x t ]+b c )
[0076] h t =o t tanh(C t )
[0077] Among them, C t Represents the carrier of this round of global information; h t represents the intermediate state output of this round; σ is the sigmoid function; W is the weight; b is the bias; f t is the forgetting threshold; i t is the input threshold; o t is the output threshold.
[0078] The LSTM network uses the global information carrier C t Build "long-term dependencies" and build "short-term dependencies" through intermediate states.
[0079] Forget Gate t and C t-1 Multiply point by point and output to the input gate of the next link, and t and g t The results of the point-by-point multiplication are added point-by-point, and finally the vector is copied at the output gate.
[0080] (7) The result of step (6) is input into the fully connected layer, which performs dimensionality reduction processing on the eigenvalues to reduce data complexity.
[0081] (8) The probability layer calculates the probability of each output of step (6) using the formula:
[0082]
[0083] (9) The classification layer classifies and identifies the samples according to the probability calculated in step (8) and outputs the classification results.
[0084] First, the original data is scaled to [-1,1] through the data processing layer, and then the normalized data is mapped from the rectangular coordinate system to the polar coordinate system through GAF, and the Gram matrix is constructed. Then, the imagesc function in MATLAB is called to convert the Gram matrix into a two-dimensional image, and the image is compressed to one tenth of the original image. The processed image is input into the three-layer CNN network, and the features are extracted by the convolution layer, normalized by the batch normalization layer, activated by the ReLU function, and pooled by the maximum pooling layer. Then, it enters the LSTM layer for time correlation learning of the features, and then input into the fully connected layer to reduce the dimensionality of the feature values. Then, the probability layer calculates the probability of each output of the fully connected layer, and then the classification layer identifies and classifies the power quality disturbance according to the probability, and finally outputs the classification result. The present invention is verified by an embodiment, and MATLAB is used for simulation. The classification accuracy in a noise-free environment and a noise environment with a signal-to-noise ratio of 10dB, 30dB, and 50dB is 100%, 97.25%, 99.13%, and 99.88%, respectively. The classification recognition situation is as follows Figure 2 , Figure 3, Figure 4 , Figure 5 shown.
[0085] The present invention compresses the image while retaining the original image information as much as possible. The storage space occupied by the compressed image is 39.3MB, which is 96.69% less than the storage space of 1.16GB required for the original image, greatly saving the computer storage space and improving the information reading rate. The convolutional neural network automatically extracts image features, avoiding the influence of the subjectivity of manually extracting features on the classification results, having a high accuracy rate, and adopting the left-end saturated nonlinear activation function ReLU function, which alleviates the problem of gradient disappearance to a certain extent compared with the two-stage saturated sigmoid function. At the same time, the addition of the LSTM layer overcomes the disadvantage that the features extracted by the CNN network lack time correlation, and improves the anti-noise ability of the model.
[0086] The above-mentioned embodiments only express the implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention should be based on the attached claims.
Claims
1. The power quality disturbance classification method based on Gram angle field and CNN-LSTM is characterized by: The following steps are involved: S1. Obtain power quality disturbance data and preprocess the sample data; S2, GAF converts the one-dimensional data from rectangular coordinates to polar coordinates, constructs the Gram matrix, converts it into an image, and then compresses the image; S3, extracting features from the compressed image in S2 using a three-layer CNN network; S4, the LSTM layer performs time correlation learning on the feature values extracted in S3; S5, performing dimensionality reduction processing on the feature values output by S4 by a fully connected layer; S6, the probability layer calculates the probability of each output of the fully connected layer, and then the classification layer determines the category of power quality; In S1, the sample data is preprocessed by normalizing the sample data using a deviation normalization method so that the normalized data is between [-1, 1]; In S2, the steps of converting data into images are: S201, GAF maps the one-dimensional power quality disturbance signal from the rectangular coordinate system to the polar coordinate system, and then constructs the Gram matrix. The conversion function and the Gram matrix are: ; ; in, represents the normalized value; Represents the angle mapped to polar coordinates; S202, calling the imagesc function in MATLAB to convert the Gram matrix into a two-dimensional image, where each element in the matrix corresponds to the color of a pixel in the image, and the size of the original image is equal to the number of rows and columns of the matrix; sampling is performed once every 10 pixels in both the horizontal and vertical directions of the original image, with 3 sampling channels, calling the round function to process the sampling points by rounding off, and then composing the processed sampling points into a matrix in the sampling order, and calling the imagesc function to convert it into an image to achieve image compression, and the storage space required for the compressed image is 3.31% of the original image; In S3, the feature extraction of the three-layer CNN network is as follows: the convolution layer automatically extracts the image feature value, the batch normalization layer performs normalization, the nonlinear activation function ReLU is activated, the maximum pooling layer performs the maximum pooling operation, and the extracted feature variables are simplified by downsampling; In S6, the probability layer calculates the probability of each output of the fully connected layer as follows: ; in, represents the first Sampling point output; Represents the probability layer The probability of the output of each sampling point.
Citation Information
Patent Citations
voltage sag disturbance classification method based on LSTM
CN109766853A
Rolling bearing fault diagnosis method based on GAF-DRSN
CN114595730A