Electric energy quality disturbance classification method based on Gramb angle field and PCNN-MSA

By using Gram corner field and PCNN-MSA technology, one-dimensional power quality perturbation signals are converted into two-dimensional images. Combined with a multi-scale attention mechanism, the spatiotemporal correlation problem of power quality perturbation signals is solved, and more efficient classification and recognition are achieved.

CN122065102APending Publication Date: 2026-05-19JILIN POWER SUPPLY COMPANY STATE GRID JILIN ELECTRIC POWER +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JILIN POWER SUPPLY COMPANY STATE GRID JILIN ELECTRIC POWER
Filing Date
2025-12-29
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively capture the spatiotemporal correlation of power quality disturbance signals and process complex signal patterns, resulting in insufficient accuracy in power quality disturbance classification.

Method used

Gram corner field technology is used to convert one-dimensional perturbation signals into two-dimensional images, and PCNN-MSA method is combined to extract and enhance features. Multi-scale attention mechanism is used to assign feature weights to achieve accurate classification.

Benefits of technology

It improves the ability to quickly identify and classify power quality disturbance signals, enhances the robustness and classification accuracy of the model, and reduces the computational resource requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122065102A_ABST
    Figure CN122065102A_ABST
Patent Text Reader

Abstract

The invention relates to the field of power grid electric energy quality disturbance classification, in particular to an electric energy quality disturbance classification method based on a Gramb angle field and PCNN-MSA. Comprising the following steps: acquiring original disturbance waveform data; respectively importing the one-dimensional data into a Gramb angle sum field and a Gramb angle difference field; combining a convolutional neural network, extracting image features of a sum field and a difference field, and fusing the two types of data; and inputting the data into the multi-head self-attention mechanism model for feature weight distribution, and realizing disturbance classification through an output weight distribution result. According to the method, rapid identification and classification of the electric energy quality disturbance signals are improved, the classification accuracy and generalization ability are improved, and the difficulty and time cost of manual classification of the electric energy quality disturbance signals are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the classification of power quality disturbances in power grids, and proposes a power quality disturbance classification method based on Gram angle field PCNN-MSA. Background Technology

[0002] With the increasing penetration of distributed photovoltaic (PV) power in distribution networks, the impact of numerous power electronic devices on power quality is becoming increasingly significant. Accurate identification of power quality disturbances is crucial for ensuring the stable operation of the power system; it is not only the foundation for improving power quality but also key to reducing the negative impact of disturbance events. As one-dimensional signals, power quality disturbance signals present numerous challenges in feature extraction, particularly in capturing their spatiotemporal correlations and processing complex signal patterns. To more effectively analyze power quality disturbances, Gram corner field (PCNN) technology is introduced. This technology can convert one-dimensional signals into two-dimensional images, revealing the spatiotemporal relationships between signals and providing richer feature information for subsequent disturbance classification. Furthermore, the PCNN-MSA method is employed for feature extraction and classification. This method combines the efficiency of parallel convolutional neural networks with the flexibility of multi-scale attention mechanisms, enabling more accurate capture of key features in power quality disturbance signals and improving classification accuracy. In summary, this method, by combining Gram corner field and PCNN-MSA techniques, provides an effective solution for the classification of power quality disturbances. This not only helps improve the ability to quickly identify and classify power quality disturbance signals, but also provides strong technical support for the stable operation of the power system and the continuous improvement of power quality.

[0003] Application content

[0004] To address the aforementioned issues, this invention provides a power quality disturbance classification method based on Gram angle field and PCNN-MSA. This invention normalizes the one-dimensional disturbance signal and then converts it into a two-dimensional image using Gram angle field, highlighting the spatial characteristics of the signal and more comprehensively representing the features of the original signal. Based on the generated two-dimensional image, PCNN-MSA is used to extract and enhance the image's features, improving the accuracy of fault identification and power quality disturbance signal classification.

[0005] Obtain the raw disturbance waveform data;

[0006] Step 1: The original disturbance signal data is standardized using a linear normalization method, and then mapped so that the normalized data is between [-1, 1].

[0007] Import the one-dimensional data into the Gram angle sum field and the Gram angle difference field, respectively;

[0008] Step 1: Convert the original data to polar coordinate form using polar coordinate transformation. The transformation formula is as follows:

[0009]

[0010] In the formula: t i For timestamp; N is the constant factor of the regularized polar coordinate generation space; φ is the phase angle; r is the polar coordinate radius; X is the standardized and scaled value.

[0011] Step two, input the normalized data in parallel into the Gram angle sum field and the Gram angle difference field. Their expressions are as follows:

[0012]

[0013] Where, φ i φ j The unique inner product defined for each Gram corner matrix middle and The phase angle.

[0014] Step 3: Generate training and test sets.

[0015] The `imagesc` function in MATLAB is used to convert the two types of Gram matrices into two-dimensional images respectively; the `colormap` function is used to enhance the visualization of the two-dimensional images using jet color mapping; the coordinate axes and image borders are removed, and the image files with unchanged resolution are retained; after classifying the images, the `imgResized` function is used to modify the image resolution, and then the processed image files are output; the generated image data is divided into training and testing sets according to a certain ratio, and then fed into PCNN-MSA for training.

[0016] By combining convolutional neural networks, image features of sum and difference fields are extracted, and the two types of data are fused.

[0017] Convolutional layers are used to extract feature values ​​from images, and these feature values ​​are batch normalized. The normalized features are then activated using the non-linear activation function ReLU. Max pooling is introduced to reduce feature dimensionality and improve robustness. Downsampling is used to simplify the feature space.

[0018] The data is input into a multi-head self-attention mechanism model for feature weight allocation, and perturbation classification is achieved through the output weight allocation results.

[0019] Step 1: Perform a linear transformation on the collected feature space.

[0020] Through learnable weights w h q w hk w h v Convert to query q h , key k h Value v h (h is the index of the attention head).

[0021] Step 2: Calculate attention weights.

[0022] By calculating q h and k h The similarity between features is evaluated using the dot product, and then the attention score is standardized using the softmax function. When two features are highly similar, they will receive greater weight when calculating the output.

[0023]

[0024] In the formula: d k Let k be the key vector. i The dimension is used to control the size of the dot product result and avoid gradient problems.

[0025] Step 3: Adjust the attention weight α h Multiply by the value vector v h This yields the output result for each head, as shown in the following formula:

[0026] Head h =α h ν h h = 1, 2, ..., H (5)

[0027] Step 4: After obtaining the outputs of all heads, concatenate them and perform a linear transformation to obtain the final output features of the classification number, as shown in the following formula:

[0028] X′=Concat(head1,head2,...,head h W O (6)

[0029] In the formula: W O This is the learnable output weight matrix.

[0030] Beneficial effects

[0031] The `imresize` function was used to compress the original 875x665 two-dimensional image generated by the Gram angle sum field and Gram angle difference field to 227x227, achieving a compression efficiency of 91.14%. A three-channel format was adopted, which preserved the information of the original image, reduced the performance requirements of the memory, and improved the reading speed of the calculator. Then, the `classIndex` function was used to calculate the class index, and images were quickly and completely processed and generated by class. This step preprocessed the two-dimensional images generated by the traditional Gram angle field, making it easier to use these images as input for large models and saving the computation time required.

[0032] By combining MSA with PCNN neural network, the impact of noise and other redundant information on classification results caused by traditional neural network is avoided. At the same time, it enhances the attention to local sensitive features, which can significantly improve the model's recognition and classification ability and has good overall robustness. Attached Figure Description

[0033] The present invention will be further described below with reference to the accompanying drawings and specific embodiments:

[0034] Figure 1 These are schematic diagrams of eight single power quality disturbance waveforms according to an embodiment of the present invention;

[0035] Figure 2 This is a schematic diagram of the GAF encoding result according to an embodiment of the present invention;

[0036] Figure 3 This is a schematic diagram of the multi-head self-attention mechanism network structure according to an embodiment of the present invention;

[0037] Figure 4 This is a schematic diagram of the PCNN-MSA network structure according to an embodiment of the present invention;

[0038] Figure 5 The confusion matrix for the classification results;

[0039] Figure 6 The training curve results are from an embodiment of the present invention;

[0040] Figure 7 This is a flowchart of the classification method according to an embodiment of the present invention. Detailed Implementation

[0041] To further understand the content of this invention, please refer to the accompanying drawings. Figure 7 The present invention will be described in detail with flowcharts and embodiments.

[0042] 1. Obtain the raw disturbance waveform data;

[0043] Step 1: The original disturbance signal data is standardized using a linear normalization method, and then mapped so that the normalized data is between [-1, 1].

[0044] 2. Import the one-dimensional data into the Gram angle sum field and Gram angle difference field respectively;

[0045] Step 1: Convert the original data to polar coordinate form using polar coordinate transformation. The transformation formula is as follows:

[0046]

[0047] In the formula: t i For timestamp; N is the constant factor of the regularized polar coordinate generation space; φ is the phase angle; r is the polar coordinate radius; X is the standardized and scaled value.

[0048] Step two, input the normalized data in parallel into the Gram angle sum field and the Gram angle difference field. Their expressions are as follows:

[0049]

[0050] Where, φ i φ j The unique inner product defined for each Gram corner matrix middle and The phase angle.

[0051] Step 3: Generate training and test sets.

[0052] The `imagesc` function in MATLAB is used to convert the two types of Gram matrices into two-dimensional images respectively; the `colormap` function is used to enhance the visualization of the two-dimensional images using Jet color mapping; the coordinate axes and image borders are removed, and the image files with unchanged resolution are retained; the image category index is obtained, the images are labeled and categorized, and the `imgResized` function is used to modify the image resolution to 227x227, three-channel format, and then the processed image files are output; the generated image data is divided into training and test sets in a 7:3 ratio, and it is ensured that the two sets do not intersect, and the test set is not used for any model training.

[0053] 3. Combine convolutional neural networks to extract image features of sum and difference fields, and fuse the two types of data;

[0054] The data is input into PCNN-MSA, and feature values ​​are extracted from the image using convolutional layers. The feature values ​​are then batch normalized. The normalized features are activated using the non-linear activation function ReLU. Max pooling is introduced to reduce feature dimensionality and improve robustness. The feature space is simplified by downsampling.

[0055] 4. Input the data into the multi-head self-attention mechanism model to perform feature weight allocation, and achieve perturbation classification through the output weight allocation results.

[0056] Step 1: Perform a linear transformation on the collected feature space.

[0057] Through learnable weights w h q w h k w h v Convert to query q h , key k h Value v h h is the index of the attention head.

[0058] Step 2: Calculate attention weights.

[0059] By calculating q h and k h The similarity between features is evaluated using the dot product, and then the attention score is standardized using the softmax function. When two features are highly similar, they will receive greater weight when calculating the output.

[0060]

[0061] In the formula: d k Let k be the key vector. i The dimension is used to control the size of the dot product result and avoid gradient problems.

[0062] Step 3: Adjust the attention weight α h Multiply by the value vector v h This yields the output result for each head, as shown in the following formula:

[0063] Head h =α h ν h h = 1, 2, ..., H

[0064] Step 4: After obtaining the outputs of all heads, concatenate them and perform a linear transformation to obtain the final output features of the classification number, as shown in the following formula:

[0065] X′=Concat(head1,head2,...,head h W O

[0066] In the formula: W O This is the learnable output weight matrix.

[0067] Example 1:

[0068] This embodiment is based on the power quality disturbance classification method of Gram angle field and PCNN-MSA, and takes voltage oscillation, voltage flicker, voltage harmonics, voltage interruption, voltage sag, and voltage swell as classification objects. In order to simulate the real situation, 40dB and 50dB Gaussian white noise are superimposed on each type of signal.

[0069] like Figure 7 As shown, the specific steps in this embodiment are as follows:

[0070] Step 1: The PCNN-MSA network structure of this invention: PCNN consists of two convolutional layers, each with a kernel size of 7x7 and a total of 64 kernels; there are two max pooling layers with a pooling size of 3x3 and a stride of 2x2, padded with one pixel on each side; in both input branches, ReLU is used as the activation function after the convolutional layers; there are three fully connected layers, two of which are 128-neuron layers in the input branches, and one 8-neuron layer after the fusion and attention mechanisms; the output layer uses the softmax function for classification, followed by a classification layer to output the final category.

[0071] Step 2: Prepare sample data. Use MATLAB to simulate voltage oscillation, voltage flicker, voltage harmonics, voltage interruption, voltage sag, voltage swell, and voltage pulse disturbance signals. The fundamental frequency is 50Hz, and the sampling frequency is set to 1000Hz. Then, use the SNR_dB and noise functions to add 40dB of Gaussian white noise to various signals.

[0072] The sample is linearly normalized using the following formula:

[0073]

[0074] In the formula, X norm The data is normalized, and X is the original data. max X min These are the maximum and minimum values ​​of the original dataset, respectively. The normalized data is mapped to the range [-1, 1].

[0075]

[0076] In the formula, X scaledData Let max{·} and min{·} be the maximum and minimum value functions for the mapped variables.

[0077] Step 3: Convert the normalized data from rectangular coordinates to polar coordinates. Use polar coordinate transformation to convert the original data into polar coordinate form. The transformation formula is:

[0078]

[0079] In the formula: t i For timestamp; N is the constant factor of the regularized polar coordinate generation space; φ is the phase angle; r is the polar coordinate radius; X is the standardized and scaled value.

[0080] Step 4: Generate training and testing data.

[0081] The `imagesc` function in MATLAB is used to convert the two types of Gram matrices into two-dimensional images respectively; the `colormap` function is used to enhance the visualization of the two-dimensional images using Jet color mapping; the coordinate axes and image borders are removed, and the image files with unchanged resolution are retained; the image category index is obtained, the images are labeled and categorized, and the `imgResized` function is used to modify the image resolution to 227x227, three-channel format, and then the processed image files are output; the generated image data is divided into training and test sets in a 7:3 ratio, and it is ensured that the two sets do not intersect, and the test set is not used for any model training.

[0082] Step 5: Input the data generated in Step 4 into the PCNN-MSA network, extract feature values ​​from the image using two convolutional layers, and normalize the feature values ​​in batches; activate the normalized features using the non-linear activation function ReLU; introduce two max pooling operations to reduce feature dimensionality and improve robustness; and simplify the feature space through downsampling.

[0083] Step 6: Input the data into the multi-head self-attention mechanism model for feature weight allocation, and achieve perturbation classification through the output weight allocation results.

[0084] The collected feature space is then subjected to a linear transformation.

[0085] Through learnable weights w h q w h k w h v Convert to query q h , key k h Value v h h is the index of the attention head; attention weights are calculated.

[0086] By calculating q h and k h The similarity between features is evaluated using the dot product, and then the attention score is standardized using the softmax function. When two features are highly similar, they will receive greater weight when calculating the output.

[0087]

[0088] In the formula: d k Let k be the key vector. i The dimension is used to control the size of the dot product result and avoid gradient problems.

[0089] The attention weight α h Multiply by the value vector v h This yields the output result for each head, as shown in the following formula:

[0090] Head h =α h ν h h = 1, 2, ..., H

[0091] After obtaining the outputs of all heads, they are concatenated and subjected to a linear transformation to obtain the output features of the final classification number, as shown in the following formula:

[0092] X′=Concat(head1,head2,...,head h W O

[0093] In the formula: W O This is the learnable output weight matrix.

[0094] Step 7: Classify the samples based on the results output in step 6 to obtain the classification results.

[0095] First, the data is linearly normalized to the range [0,1]. Then, the normalized data is transformed from Cartesian coordinates to polar coordinates and input into a GAF matrix, converting it into a two-dimensional image. The image is then input into a PCNN-MSA network, passing through convolution, normalization, ReLU activation, pooling layers, and fully connected layers. The output data is then fed into a multi-head self-attention mechanism for further feature differentiation, recognition, and classification. Finally, the classification results and various metrics are output. This invention is verified through an embodiment using MATLAB simulation, obtaining classification accuracy under noise-free conditions and with 40dB Gaussian white noise added.

[0096] Those skilled in the art should understand that the above embodiments are merely illustrative of the content of this disclosure and do not limit its scope. The system capacity, voltage, line parameters, etc., shown may vary depending on the specific circumstances of the power electronic grid-connected generator set and its grid connection. Based on this disclosure, those skilled in the art can make other changes or adjustments, and these changes still fall within the scope of this disclosure.

Claims

1. A power quality perturbation classification method based on Gram angle field and PCNN-MSA, comprising: Step S1: Obtain the original disturbance waveform data; Step S2: Input the signal to be detected in parallel into the Gram angle sum field and the Gram angle difference field to convert the one-dimensional signal into a two-dimensional image; Step S3: Input the image into PCNN (Piecewise Convolutional Neural Network) to extract the image features of the sum field and difference field, thereby achieving feature fusion of the two types of high-dimensional images; Step S4: Input the image features into the MSA (Multi-Head Self-Attention) mechanism to perform feature weight allocation, thereby classifying the power quality disturbance signal.

2. The power quality perturbation classification method based on Gram angle field and PCNN-MSA according to claim 1, characterized in that, Step S1 includes: standardizing the original disturbance signal data using a linear normalization method, and then mapping it so that the normalized data is between [-1, 1].

3. The power quality perturbation classification method based on Gram angle field and PCNN-MSA according to claim 1, characterized in that, Step S2 includes: Step S2-1: Convert the original data to polar coordinate form using polar coordinate transformation. The transformation formula is as follows: In the formula: φ is the phase angle; X;t is the standardized and scaled value. i For timestamp; N is the constant factor of the regularized polar coordinate generation space; r is the polar coordinate radius; Step S2-2: Input the normalized data in parallel into the Gram angle sum field and the Gram angle difference field; the expressions are as follows: Where, φ i , φ j The unique inner product defined by the Gram corner matrix middle and The phase angle; Steps S2-3: Generate training and test sets: Use the imagesc function in MATLAB to convert the two types of Gram matrices into two-dimensional images; call the colormap function to enhance the visualization of the two-dimensional images using jet color mapping; remove the coordinate axes and image borders, and keep the image files with unchanged resolution; after classifying the images, call the imgResized function to modify the image resolution, and output the processed image files; divide the generated image data into training and test sets according to a certain ratio, and put them into PCNN-MSA for training.

4. The power quality perturbation classification method based on Gram angle field and PCNN-MSA according to claim 1, characterized in that, Step S3 includes: extracting feature values ​​from the image using convolutional layers and normalizing the feature values; activating the normalized features using the non-linear activation function ReLU; introducing max pooling to reduce feature dimensionality and improve robustness; and simplifying the feature space through downsampling.

5. The power quality perturbation classification method based on Gram angle field and PCNN-MSA according to claim 1, characterized in that, Step S4 includes: Step S4-1: Perform a linear transformation on the collected feature space: using learnable weights w h q w h k w h v Convert to query q h , key k h Value v h , where h is the index of the attention head; Step S4-2: Calculate attention weights: by calculating q h and k h The similarity between features is evaluated using the dot product, and the attention score is standardized using the softmax function. When two features are highly similar, they receive greater weight when calculating the output. In the formula: d k Let k be the key vector. i The dimension is used to control the size of the dot product result and avoid gradient problems; Step S4-3: Adjust the attention weight α h Multiply by the value vector v h This yields the output result for each head, as shown in the following formula: Head h =α h ν h ,h=1,2,...,H (5) Step S4-4: After obtaining the outputs of all heads, concatenate them and perform a linear transformation to obtain the output features of the final classification number, as shown in the following formula: X′=Concat(head1,head2,...,head h )W O (6) In the formula: W O This is the learnable output weight matrix.