Real-time classification method for power quality disturbance of distributed photovoltaic transformer area

The power quality disturbance information of the distributed photovoltaic platform area is extracted through the depth spectrum characteristics and the deformable cross attention mechanism. Combined with the Transformer model and the fully connected layer, high-precision real-time identification of power quality disturbances is achieved, and the low efficiency in the existing technology is solved and high complexity problems are suitable for troubleshooting in distributed photovoltaic station areas.

CN119089311AInactive Publication Date: 2024-12-06国网(山东)电动汽车服务有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411570583.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2024-12-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art automatic identification method for power quality disturbances in distributed photovoltaic platform areas is inefficient, the algorithm based on artificial feature extraction is highly complex and is not suitable for microgrid composite disturbance identification, and the algorithm based on automatic feature extraction has a large calculation intensity and poor real-time performance. , it is difficult to achieve real-time identification.

Method used

The depth spectrum features are used to generate a two-dimensional spectrum map, and the distortion information is extracted using the deformable cross attention mechanism, and the timing information is fused through the Transformer model of the multi-head attention mechanism, combining the full connection layer and the softmax classifier to realize real-time identification of power mass disturbances. .

Benefits of technology

It realizes high-precision real-time identification of power quality disturbances, reduces the computational complexity, improves the real-time and robustness of the algorithm, and is suitable for fault processing and data analysis in distributed photovoltaic station areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119089311A_ABST
    Figure CN119089311A_ABST
Patent Text Reader

Abstract

The invention provides a distributed photovoltaic court electric energy quality disturbance real-time classification method, and belongs to the technical field of distributed photovoltaic power generation, and the method comprises the steps: S1, based on a collected one-dimensional disturbance signal, depth spectrum features are extracted to generate a two-dimensional spectrogram, and the two-dimensional spectrogram is a two-dimensional visual representation of time-varying spectrum features; s2, based on a deformable cross attention mechanism, extracting quality disturbance information in a single two-dimensional spectrogram; s3, a Transform model based on a multi-head attention mechanism is adopted, and time sequence information among the multiple two-dimensional spectrograms is fused; and S4, on the basis of a full connection layer and a softmax classifier, realizing identification and classification of power quality disturbance on the feature information after dimension reduction. The method can realize real-time identification and classification of power quality disturbance, has high identification accuracy, and can lay an important foundation for subsequent fault processing and data analysis of the distributed photovoltaic transformer area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of distributed photovoltaic power generation, and in particular relates to a real-time classification method for power quality disturbances in a distributed photovoltaic area. Background Art

[0002] The high reliability operation of distributed photovoltaic substations requires that the system power quality can be maintained in good condition under various working conditions, with almost no transient power quality disturbance. Power quality disturbance is defined as static and non-static distortion of voltage, current and frequency, which occurs in the generation, transmission and consumption of power: in the generation stage of power, when the light changes, the output of new energy such as rooftop photovoltaic will fluctuate, eventually causing the bus voltage of the substation to rise or fall temporarily; in the transmission stage of power, a large number of interface power electronic converters will generate a large amount of high-order harmonic interference, causing the power quality of the system to deteriorate; in the consumption stage of power, when nonlinear loads such as electric vehicles are switched on and off, it will cause transient oscillation of the bus voltage of the microgrid. In addition, unlike the traditional backbone power grid, in distributed substations, due to the coordinated operation of multiple distributed generation systems, disturbances will occur more frequently. And several power quality disturbances may occur at the same time, resulting in composite power quality disturbances.

[0003] The existing automatic identification methods of power quality disturbances can be divided into two categories according to the way of feature acquisition: algorithms based on manual feature extraction and algorithms based on automatic feature extraction. Among them, the algorithms based on manual feature extraction are highly dependent on the experience of engineers and scholars, manually constructing disturbance feature sets through various signal processing algorithms, and then using classifiers derived from machine learning to achieve disturbance identification.

[0004] However, for algorithms based on artificial feature extraction, there is currently no universal evaluation framework to objectively guide the artificial feature engineering, resulting in inefficiency in the process. The feature set often contains redundant and meaningless feature vectors, which increases the computational complexity of the classifier and the difficulty of design. Therefore, as the number of disturbance categories to be identified increases, the ability of this type of method to resist noise gradually decreases, and the algorithm complexity gradually increases. Therefore, algorithms based on artificial feature extraction are not suitable for the identification of composite power quality disturbances in microgrids.

[0005] The algorithm based on automatic feature extraction uses the idea of ​​closed-loop feedback to train the feature extractor and classifier in the same closed loop. Although the algorithm based on automatic feature extraction is superior to the traditional disturbance recognition algorithm based on artificial feature engineering in terms of robustness, recognition accuracy, and design complexity, they are more computationally intensive and can only be deployed on GPU cloud servers far away from the data acquisition device. As a result, the acquired grid voltage signal must be transmitted to the cloud server for centralized processing via a complex network route. In this process, if network congestion occurs, a large amount of data transmission delay will be added to the entire system, resulting in a decrease in the real-time performance of the algorithm. Summary of the invention

[0006] In order to solve the above problems existing in the prior art, a real-time classification method for power quality disturbances in a distributed photovoltaic area is provided.

[0007] The technical solution adopted by the present invention to solve its technical problem is: This technical solution proposes a real-time classification method for power quality disturbances in distributed photovoltaic areas, including the following steps: S1: Based on the collected one-dimensional disturbance signal, the deep spectrum features are extracted to generate a two-dimensional spectrogram, which is a two-dimensional visual representation of the time-varying spectrum features; S2: Extracting quality disturbance information from a single 2D spectrogram based on a deformable cross-attention mechanism; S3: Adopts the Transformer model based on the multi-head attention mechanism to fuse the temporal information between multiple two-dimensional spectrograms; S4: Based on the fully connected layer and softmax classifier, the feature information after dimensionality reduction is used to realize the recognition and classification of power quality disturbances.

[0008] Preferably, in S1, the two-dimensional spectrogram generation method comprises the following steps: S11: Select the corresponding Hamming window: window length n The value is 64, the window sliding step k The value is 32; S12: Construct a discrete Hamming window function using the set H =[ h 0, h 1, ..., h n-1 ] means that in the set, the formula is as follows: (1); In the formula, i The value range is 0, 1, ..., n -1; S13: Use the Hamming window function to add a window to the original disturbance signal. The formula is as follows: (2); In the formula, X is the original power quality disturbance data set, which contains 640 sampling points. Y j is the data set after windowing, including n sampling points, j The value range is 0, 1, ..., ; S14: Y j Convert to spectral features S j , the formula is as follows: (3); S15: Spectral features S j The splicing forms a two-dimensional spectrogram.

[0009] Preferably, in S2, given an input feature map x ∈ R H×W , q Represents a content feature Z q and a 2D reference point P q The calculation formula of the deformable cross-attention feature is as follows: (4); In the formula, m represents the attention head, k represents the number of sampling keys, K represents the total number of sampled keys, Δ P mqk and A mqk Respectively represent m The attention head k The sampling offset and attention weight of the sampling points, Δ P mqk ∈ R 2 is a two-dimensional real number with unconstrained range, A mqk In the range [0,1]; P q +Δ P mqk For fractional order, bilinear interpolation is used for calculation x ( P q +ΔP mqk ), Δ P mqk and A mqk To query features Z q The linear projection on is obtained.

[0010] Preferably, in S3, the input sequence is divided into n subsequences, each of which is self-attentioned through a different transformation matrix, and n Different output results are concatenated and subjected to a linear transformation to generate the final attention weight. The formula is as follows: (5); (6); In the formula, Q is the query vector, K is the key vector, V is a numerical vector, Concat is a cascade operation, head i For the i self-attention heads computed in parallel, W 0 is the output transformation matrix, W i Q , W i K , W i V Respectively i The transformation matrix of query, key, and value, Attention is the self-attention operation.

[0011] Preferably, the Transformer model includes layer normalization, MSA and feedforward networks, layer normalization is an operation performed on a specified dimension of a single data. After the feature is processed by layer normalization, the input MSA ; The feedforward network consists of a fully connected layer, a Dropout layer, and an activation function. The Dropout layer can randomly discard neurons, and after the Dropout layer, they are connected to the next layer in the form of residual connections.

[0012] Compared with the prior art, the present invention has the following advantages: This application converts a one-dimensional power quality disturbance signal into a two-dimensional spectrogram signal, realizes the transformation of data dimension, reduces data storage overhead, and then processes it with an advanced deep learning algorithm. At the same time, a deformable cross-attention mechanism is adopted to greatly reduce the computational complexity. Finally, the Transformer algorithm is used to reduce the dimensionality of the signal. Simulation results show that the method has high recognition accuracy and can realize real-time recognition of power quality disturbances, which can lay an important foundation for subsequent fault handling and data analysis in distributed photovoltaic areas.

[0013] This application adopts a deformable cross-attention mechanism and only focuses on a fixed number of key sampling points at offset positions based on the reference point, thereby alleviating the problem of poor convergence of the algorithm under high resolution. The computational complexity is reduced from increasing with the square of the number of pixels to increasing linearly, greatly reducing the amount of calculation, thereby effectively improving the real-time performance of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 It is the overall flow chart of the present invention; Figure 2 This is a schematic diagram of the loss results under different training times; Figure 3 This is a diagram of accuracy at different training times; Figure 4 It is a schematic diagram of the noise-free result of the test set; Figure 5 This is a schematic diagram of the test result when the signal-to-noise ratio of the set is 50dB; Figure 6 This is a schematic diagram of the test result when the signal-to-noise ratio of the set is 40dB; Figure 7 This is a schematic diagram of the test result when the signal-to-noise ratio of the set is 30dB; Figure 8 It is a schematic diagram of the assembly line operation of the method described in the present invention. DETAILED DESCRIPTION

[0015] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0016] like Figure 1-Figure 8 As shown, this embodiment proposes a real-time classification method for power quality disturbance in a distributed photovoltaic area, comprising the following steps: S1: Based on the collected one-dimensional disturbance signal, the deep spectrum features are extracted to generate a two-dimensional spectrogram, which is a two-dimensional visual representation of the time-varying spectrum features; S2: Extracting quality disturbance information from a single 2D spectrogram based on a deformable cross-attention mechanism; S3: Adopts the Transformer model based on the multi-head attention mechanism to fuse the temporal information between multiple two-dimensional spectrograms; S4: Based on the fully connected layer and softmax classifier, the feature information after dimensionality reduction is used to realize the recognition and classification of power quality disturbances.

[0017] There are 10 common single power quality disturbances in distributed photovoltaic areas and 6 common composite power quality disturbances. "Normal", "temporary sag", "temporary rise", "interruption", "harmonic", "temporary sag + harmonic", "temporary rise + harmonic", "interruption + harmonic", "fluctuation", "transient oscillation", "transient impact", "cycle gap", "cycle peak", "fluctuation + harmonic", "temporary sag + fluctuation", and "temporary rise + fluctuation" are defined as labels 0-15 respectively.

[0018] In S1, since the power quality composite disturbance signal is essentially the same as the speech signal, both are time series signals, the spectrogram method is used to extract the deep spectrum features from the disturbance signal to generate a two-dimensional spectrogram to achieve feature reconstruction of the disturbance. The two-dimensional spectrogram generation method includes the following steps: S11: Select the corresponding Hamming window: window length n The value is 64, the window sliding step k The value is 32; S12: Construct a discrete Hamming window function using the set H =[ h 0, h 1, ..., h n-1 ] means that in the set, the formula is as follows: (1); In the formula, i The value range is 0, 1, ..., n -1; S13: Use the Hamming window function to add a window to the original disturbance signal. The formula is as follows: (2); In the formula, X is the original power quality disturbance data set, which contains 640 sampling points. Y j is the data set after windowing, including n sampling points, jThe value range is 0, 1, ..., ; S14: Y j Convert to spectral features S j , the formula is as follows: (3); S15: Spectral features S j The splicing forms a two-dimensional spectrogram.

[0019] The two-dimensional spectrogram of the power quality composite disturbance generated by the above steps has a width of W =19, height H =32, containing a total of 608 pixels. The horizontal axis, vertical axis, and pixel value of the two-dimensional spectrogram represent time, frequency, and amplitude. Converting the original disturbance signal into a two-dimensional spectrogram not only realizes the transformation of data dimension, but also reduces the data storage overhead (from 640 to 608).

[0020] In S2, the traditional self-attention mechanism needs to calculate the attention of each pixel to all other pixels in the image, which has high computational complexity. In order to solve this problem, a deformable cross-attention mechanism is adopted, which only focuses on a fixed number of key sampling points at offset positions based on the reference point, thereby alleviating the problem of poor convergence of the algorithm under high resolution. The computational complexity is reduced from increasing with the square of the number of pixels to increasing linearly, which greatly reduces the amount of calculation, thereby effectively improving the real-time performance of the algorithm.

[0021] Given an input feature map x ∈ R H×W , q Represents a content feature Z q and a 2D reference point P q The calculation formula of the deformable cross-attention feature is as follows: (4); In the formula, m represents the attention head, k represents the number of sampling keys, K Indicates the total number of sampled keys ( K << HW ), Δ P mqk and A mqk Respectively represent m The attention head kThe sampling offset and attention weight of the sampling points, Δ P mqk ∈ R 2 is a two-dimensional real number with unconstrained range, A mqk In the range [0,1]; P q +Δ P mqk For fractional order, bilinear interpolation is used for calculation x ( P q +Δ P mqk ), Δ P mqk and A mqk To query features Z q The linear projection on is obtained.

[0022] In the implementation, the query feature Z q Feed to 3 MK The linear projection operator of the channel, where the first 2 MK Channel coding sampling offset Δ P mqk , the remaining MK The channel is fed to the softmax operator to obtain the attention weights A mqk , the deformable cross attention mechanism is used as a key element to process the convolutional feature map. N q is the number of query elements when using the cross attention mechanism, N q = N ( N is the number of queries for the object), the complexity becomes O ( NKC 2 ), and the size of the space HW Not relevant.

[0023] In S3, in order to fuse the time series information between multiple two-dimensional spectrograms, the Transformer model is introduced to integrate the single spectrogram after feature fusion and extraction in time series, so as to improve the recognition accuracy of power quality disturbance signals. Since the feature graphs that constitute the time series information are relatively small and the logical relationship between the spectrograms is relatively close, the Transformer model based on the self-attention mechanism is adopted, which queries ( Q ) and key ( K )'s attention converges to the value (V ) assigns attention weights to generate the final output.

[0024] Multi-head attention mechanism ( MSA ) is an improvement based on the self-attention mechanism, which divides the input sequence into n subsequences, each of which is self-attentioned through a different transformation matrix, and n Different output results are concatenated and a linear transformation is performed to generate the final attention weights.

[0025] The use of a multi-head attention mechanism enables the Transformer model to learn feature information from different subspaces and obtain multiple types of feature expressions, thereby improving the model's expressive power. At the same time, the multi-head attention mechanism can also calculate multiple subsequences in parallel to improve the model's training efficiency. The formula is as follows: (5); (6); In the formula, Q is the query vector, K is the key vector, V is a numerical vector, Concat is a cascade operation, head i For the i self-attention heads computed in parallel, W 0 is the output transformation matrix, W i Q , W i K , W i V Respectively i The transformation matrix of query, key, and value, Attention is the self-attention operation.

[0026] The Transformer model includes layer normalization, MSA and feedforward networks, layer normalization is an operation performed on the specified dimension of a single data, which can avoid the influence of small batch data distribution in the batch normalization layer and is more suitable for the Transformer algorithm. After the feature is processed by layer normalization, the input MSA , MSA The number of heads is set to 4, i.e. 4-head attention.

[0027] The feedforward network consists of a fully connected layer, a Dropout layer, and an activation function. The Dropout layer can randomly discard some neurons to give the model better generalization ability. In order to avoid gradient disappearance, the Dropout layer is connected to the next layer in the form of a residual connection. By superimposing two Transformer modules, the model's ability to extract global features is enhanced.

[0028] The effectiveness of the method is verified, and the training results are as follows Figure 2-Figure 3 As shown, Figure 2 This is a schematic diagram of the loss results under different training times. Figure 3 This is a diagram of the accuracy at different training times. To speed up the training, the learning rate is set to 1e-3 at the beginning of the training. When the loss of the model on the validation set continues for 10 cycles and no longer decreases, the learning rate is automatically multiplied by 0.1 to slow down the training speed and optimize the model more accurately. When the learning rate drops to 1e-4, the accuracy of the model on both the training set and the validation set is significantly improved, and only the best performing model is retained during training.

[0029] The trained model is evaluated on the test set, and the following is obtained: Figure 4-Figure 7 The results shown, where Figure 4 This is a schematic diagram of the noise-free result of the test set. Figure 5 This is a schematic diagram of the test result when the signal-to-noise ratio of the set is 50dB. Figure 6 This is a schematic diagram of the test result when the signal-to-noise ratio of the set is 40dB. Figure 7 This is a schematic diagram of the test results when the signal-to-noise ratio of the set is 30dB.

[0030] The rows and columns of the matrix represent the true category and predicted category of the sample, respectively. The value at the intersection of the row and column is the probability that the model predicts that a certain type of sample is a certain category. Therefore, the value of the diagonal in the matrix is ​​the probability that the model predicts the sample to be the actual category, that is, the accuracy rate.

[0031] Through calculation, it can be concluded that the average accuracy of the method on the test sets with no noise, 50dB SNR, 40dB SNR, and 30dB SNR is 99.8125%, 99.8125%, 99.4375%, and 98%, respectively. From these data, it can be seen that the method is almost not affected by noise and can ensure accurate identification of disturbances in a low SNR environment.

[0032] In real engineering applications, it is necessary to collect signals of 10 grid voltage fundamental wave cycles, and this process takes at least 0.2s. That is to say, if the disturbance recognition time is less than 0.2s, the sampling and recognition modules can be Figure 8 The pipeline runs in the following way: Figure 8This is a schematic diagram of the pipeline operation of the method described in the present invention, which can achieve uninterrupted real-time disturbance identification. The time taken by the method to predict a single sample using the built-in timing module in Python is accurately counted as 0.0976s. Therefore, the method described in the present invention can achieve real-time identification of power quality disturbances with high identification accuracy, which can lay an important foundation for subsequent fault handling and data analysis in distributed photovoltaic areas.

[0033] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A real-time classification method for power quality disturbance in distributed photovoltaic areas, characterized in that: The following steps are involved: S1: Based on the collected one-dimensional disturbance signal, the deep spectrum features are extracted to generate a two-dimensional spectrogram, which is a two-dimensional visual representation of the time-varying spectrum features; S2: Extracting quality disturbance information from a single 2D spectrogram based on a deformable cross-attention mechanism; S3: Adopts the Transformer model based on the multi-head attention mechanism to fuse the temporal information between multiple two-dimensional spectrograms; S4: Based on the fully connected layer and softmax classifier, the feature information after dimensionality reduction is used to realize the recognition and classification of power quality disturbances.

2. A real-time classification method for power quality disturbance in a distributed photovoltaic area according to claim 1, characterized in that: In S1, the two-dimensional spectrogram generation method comprises the following steps: S11: Select the corresponding Hamming window: window length n The value is 64, the window sliding step k The value is 32; S12: Construct a discrete Hamming window function using the set H =[ h 0, h 1, ..., h n-1 ] means that in the set, the formula is as follows: (1); In the formula, i The value range is 0, 1, ..., n -1; S13: Use the Hamming window function to add a window to the original disturbance signal. The formula is as follows: (2); In the formula, X is the original power quality disturbance data set, which contains 640 sampling points. Y j is the data set after windowing, including n sampling points, j The value range is 0, 1, ..., ; S14: Y j Convert to spectral features S j , the formula is as follows: (3); S15: Spectral features S j The splicing forms a two-dimensional spectrogram.

3. A real-time classification method for power quality disturbance in a distributed photovoltaic area according to claim 1, characterized in that: In S2, given an input feature map x ∈ R H×W , q Represents a content feature Z q and a 2D reference point P q The calculation formula of the deformable cross-attention feature is as follows: (4); In the formula, m represents the attention head, k represents the number of sampling keys, K represents the total number of sampled keys, Δ P mqk and A mqk Respectively represent m The attention head k The sampling offset and attention weight of the sampling points, Δ P mqk ∈ R 2 is a two-dimensional real number with unconstrained range, A mqk In the range [0,1]; P q +Δ P mqk For fractional order, bilinear interpolation is used for calculation x ( P q +Δ P mqk ), Δ P mqk and A mqk To query features Z q The linear projection on is obtained.

4. A real-time classification method for power quality disturbance in a distributed photovoltaic area according to claim 1, characterized in that: In S3, the input sequence is divided into n subsequences, each of which is self-attentioned through a different transformation matrix, and n Different output results are concatenated and subjected to a linear transformation to generate the final attention weight. The formula is as follows: (5); (6); In the formula, Q is the query vector, K is the key vector, V is a numerical vector, Concat is a cascade operation, head i For the i self-attention heads computed in parallel, W 0 is the output transformation matrix, W i Q , W i K , W i V Respectively i The transformation matrix of query, key, and value, Attention is the self-attention operation.

5. A real-time classification method for power quality disturbance in a distributed photovoltaic area according to claim 1, characterized in that: The Transformer model includes layer normalization, MSA and feedforward networks, layer normalization is an operation performed on a specified dimension of a single data. After the feature is processed by layer normalization, the input MSA ; The feedforward network consists of a fully connected layer, a Dropout layer, and an activation function. The Dropout layer can randomly discard neurons, and after the Dropout layer, they are connected to the next layer in the form of residual connections.

Citation Information

Patent Citations

  • Photovoltaic surface defect identification method and system based on end-to-end architecture

    CN115205233A

  • Bridging Transform-based small sample optimization bird sound identification method

    CN115762536A

  • YOLOv5-based semi-supervised power quality disturbance identification and classification method, system and device, and storage medium

    CN117034104A

  • Multi-modal emotion recognition method based on staged attention mechanism

    CN118378128A

  • Petrochemical industry electric energy quality disturbance identification method based on multi-scale TCN and multi-head self-attention mechanism

    CN118395244A