Micro-grid electric energy quality disturbance identification method
Through the combination of a multi-level global convolutional neural network and a simplified Transformer model, the problem of low accuracy in identifying power quality disturbances in microgrids is solved, efficient identification and processing is achieved, and the ability to capture disturbance features is enhanced.
Patent Information
- Application Number
- CN202411186798.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing shallow machine learning methods are difficult to effectively identify power quality disturbances in microgrids from massive power data, resulting in low identification accuracy and low processing efficiency.
A multi-level global convolutional neural network and a simplified Transformer model are used to achieve detailed and comprehensive identification of power quality disturbance signals through preliminary feature extraction, feature enhancement, low-dimensional mapping and classifier processing.
The processing efficiency and identification accuracy of power quality disturbance identification are improved, the ability to capture the interdependence of disturbance features is enhanced, the model structure is simplified and the computational complexity is reduced.
Smart Images

Figure CN118690180A
Abstract
Description
Technical Field
[0001] The present invention relates to a power quality disturbance identification technology, in particular to a microgrid power quality disturbance identification method. Background Art
[0002] A microgrid is an independent, compact power system that includes a variety of distributed power sources, loads, energy storage, and control systems. It offers key advantages such as efficient resource utilization, fast setup, and wide applicability, making distributed power an attractive option for energy production and management. The widespread use of power electronics in microgrids results in the injection of a large number of harmonic signals into the grid. This can lead to a degradation of power quality, manifested as voltage waveform distortion, fluctuations, flicker, and three-phase imbalance. In addition, microgrids, which are usually independent nodes that can operate in connected and isolated modes, help optimize the use of distributed power. They can achieve local energy management, provide redundancy, enhance grid resilience, and reduce transmission losses. By balancing local generation and loads, microgrids mitigate the peak demand effects and voltage fluctuations of large grids, improving power supply reliability and overall grid efficiency. Given their important role, microgrids are at the forefront of global power system research and development. To fully realize the advantages of microgrids, fundamental problems of power systems must be solved. A key technology for microgrids is the rapid and accurate determination of power quality disturbances. Correctly identifying the types of disturbances (such as voltage sags, harmonics, and interruptions) is crucial, and it lays the foundation for effective management of power quality issues in the future.
[0003] At present, many scholars at home and abroad are committed to accurately identifying power quality disturbance signals, and the most commonly used method is the traditional shallow machine learning method. However, with the continuous development of smart grids, power data is also increasing rapidly, and traditional shallow machine learning is difficult to mine useful information from massive data. Therefore, a microgrid power quality disturbance identification method is needed to improve data processing efficiency and identification accuracy. Summary of the invention
[0004] The purpose of the invention is to provide a method for identifying power quality disturbances in a microgrid, which can enhance the meticulousness and comprehensiveness in capturing the interdependence of disturbance characteristics, and can also improve processing efficiency and identification accuracy.
[0005] Technical solution: The method for identifying power quality disturbances in a microgrid according to the present invention is characterized by comprising the following steps: Step 1, receiving a one-dimensional power quality disturbance signal, and using a multi-level global convolutional neural network to perform preliminary feature extraction on the received one-dimensional power quality disturbance signal to obtain a preliminary feature signal; Step 2: Input the obtained preliminary feature signal into the simplified Transformer model, and use the simplified Transformer model to perform effective feature addition on the preliminary feature signal to obtain an enhanced feature signal; Step 3: Input the obtained enhanced feature signal into the fully connected layer, and use the fully connected layer to map the high-dimensional feature space into a low-dimensional space to obtain a low-dimensional feature signal; Step 4: Input the obtained low-dimensional feature signal into the Softmax classifier, use the Softmax classifier to perform feature classification, and obtain the disturbance identification signal label.
[0006] Furthermore, in step 1, the multi-level global convolutional neural network is composed of multiple multi-level global convolutions in series, and the multi-level global convolution includes a one-dimensional convolution layer, a ReLU activation function layer, a GAM attention module, and a maximum pooling layer; the GAM attention module includes a channel attention layer and a sequence attention layer; the model expression of the multi-level global convolution is: ,in, is a one-dimensional convolutional layer, is the ReLU activation function layer, is the channel attention layer, is the sequence attention layer, is the maximum pooling layer, i Indicates i Multi-level global convolutions, MGC i Indicates i Layer global convolution module.
[0007] Furthermore, the specific steps of the channel attention layer for channel attention calculation are: First, assume that the input feature signal is ,in, b is the batch size, c is the number of channels, the one-dimensional signal c is 1, l is the sequence length, R represents the set of real numbers, represents a real matrix with dimensions b × c × l ; Then, the linear transformation layer is used to compress the channel dimension of the input feature signal. The number of output units of the linear transformation layer is , where int() is a function that converts data types to integers, rate is a preset hyperparameter used to control the compression ratio, and the algorithm expression for compression is: , where Z1 is the compressed characteristic signal, is the weight of the linear transformation layer, is the bias of the linear transformation layer; Then, the ReLU activation function is used to increase the nonlinear processing capability. The specific algorithm expression is: , where A is the result data after the activation function is processed, and ReLU() represents the ReLU activation function; Then, a linear layer is used to reduce the channel dimension from the compressed number of channels to Restore to the original number of channels c to complete the calculation of channel attention. The specific algorithm expression is: , where Z2 is the restored channel data, is the weight of the linear layer, is the bias of the linear layer; Then, through the sigmoid function Z 2 is scaled so that its range is limited to [0,1], indicating that the importance of each channel is: , where e is the base of the exponential function, is a natural constant, and CA represents the importance of the channel. Represents the sigmoid function; Finally, the importance CA is compared with the original input X Perform element-by-element multiplication to dynamically adjust the characteristic response of each channel, namely: ,in, represents the Hadamard product, S is the adjusted characteristic signal.
[0008] Furthermore, the specific implementation steps of the sequence attention layer are: First, set the characteristic signal output by the channel attention mechanism S The dimension is ,in, b is the batch size, c is the number of channels, l is the sequence length; Then, the convolution operation of the first convolutional layer is used to reduce the number of channels. The first convolutional layer uses a convolution kernel size of 7, a stride of 1, and an edge padding of 3. The number of output channels is , rate is a hyperparameter for controlling channel compression, and the algorithm expression of the first convolutional layer operation is: , where Y1 is the feature signal after convolution of the first convolutional layer, is the weight of the convolution kernel, is the bias of the convolution kernel, Represents the convolution operation; Then, the convolved feature signal Y1 is processed by the batch normalization layer and the ReLU activation function. The specific algorithm is expressed as: , where Y2 is the feature signal after normalization and activation function processing, and BN represents the batch normalization operation; Then, the second convolutional layer is used to convert the number of channels of Y2 from the number of channels output by the first convolutional layer Increase to the final number of output channels , the convolution kernel size of the second convolution layer is 7, the edge padding is 3, and the specific algorithm expression is: , where Y3 is the feature signal after convolution of the second convolutional layer, is the weight of the convolution kernel, is the bias of the convolution kernel; Then, Y3 is processed by the batch normalization layer to obtain the final sequence attention feature signal. The specific algorithm expression is: , where Y4 is the sequence attention feature signal; Then, the sequence attention feature signal Y4 is processed by the Sigmoid activation function to output the importance weight of each position, ranging between [0,1]. The importance expression of each sequence position is: , where SA represents the importance of the sequence position, Represents the Sigmoid function; Finally, the importance of each sequence position SA is multiplied element by element by the input S to obtain the feature signal adjusted by the sequence attention mechanism: , where G represents the feature signal after the sequence attention mechanism is adjusted, Denotes the Hadamard product.
[0009] Furthermore, in step 2, the simplified Transformer model is composed of multiple stacked Transformer basic modules; each Transformer basic module is composed of an MSA module, an MLP module, two residual modules and two normalization modules; the two residual modules are used to directly add the inputs of the MSA module and the MLP module to the corresponding outputs respectively; the two normalization layers standardize the inputs of the MSA module and the MLP module respectively so that the input mean is 0 and the variance is 1; the output of the MSA module after processing by the residual module is used as the input of the MLP module.
[0010] Furthermore, the algorithm formula of the MSA module is: , where MultiHead(Q,K,V) represents the operation of the multi-head attention mechanism, Q represents the query vector, K represents the key vector, V represents the numerical vector, and Concat() represents the connection of multiple independent attention heads. Represents the weight matrix of the linear transformation after the concatenation of all head outputs. head1 represents the first head in the multi-head attention mechanism. head h Indicates the first h Size; The calculation of each head is as follows: , where head i is the first in the multi-head attention mechanism i Attention() represents the attention mechanism operation, and softmax() is used to calculate the attention weight. , as well as are the weight matrices of the query, key, and value corresponding to the header, respectively. is the weight matrix for linear transformation after concatenation of all head outputs, It is the dimension of the key vector, which is used to scale the dot product to prevent the internal dot product from being too large and affecting the gradient of softmax.
[0011] Furthermore, the expression of the MLP module is: , where MLP( x ) is a multi-layer perceptron module, W1 and W2 are weight matrices of the linear layer, b1 and b2 are bias terms, and ReLU is a nonlinear activation function used to increase nonlinear processing capabilities, indicating the nonlinear transformation after the activation function.
[0012] Furthermore, the expression of the residual module is: , where LayerOutput is the output of the residual module, and LayerInput is the input of the residual module. is the output of the MSA module or the MLP module.
[0013] Furthermore, the expression of the normalization module is: , where LayerNorm(x) represents the normalized result, is the mean of the data to be normalized, is the standard deviation of the data to be normalized, and is a learnable parameter used to restore the original distribution of normalized data.
[0014] Compared with the prior art, the present invention has the following beneficial effects: a multi-level global convolutional neural network and a Transformer model are effectively connected, rich temporal and spatial features in the disturbance signal can be obtained through the multi-level global convolutional neural network, and the multi-head attention layer in the Transformer model allows parallel processing of signals in multiple subspaces, which enhances the meticulousness and comprehensiveness of the model in capturing the interdependence of disturbance features, not only combining the advantages of each individual technology, but also further improving the processing efficiency and recognition accuracy through collaborative work; a simplified Transformer model is used to omit the encoding layer on the basis of the multi-level global convolutional neural network, which not only simplifies the model structure, but also reduces the computational complexity, while still maintaining good performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a flow chart of the method of the present invention; Figure 2 It is a schematic diagram of the framework structure of the method of the present invention; Figure 3 Schematic diagram of the structure of the GAM attention module of the present invention; Figure 4 It is a schematic diagram of the structure of a multi-level global convolutional neural network of the present invention; Figure 5 This is a schematic diagram of the basic module structure of the Transformer of the present invention; Figure 6 It is a diagram of the recognition accuracy Acc and loss value Loss of the training set and the test set in the training process of the present invention; Figure 7 This is a graph of the recognition accuracy of 29 disturbance types under different networks of the present invention; Figure 8 It is a diagram of the comprehensive recognition rate of disturbances under different networks of the present invention; Fig. 9} are the recognition results of the real data set of the present invention. DETAILED DESCRIPTION
[0016] The technical solution of the present invention is described in detail below with reference to the accompanying drawings, but the protection scope of the present invention is not limited to the embodiments.
[0017] like Figure 1-Figure 5 As shown, the microgrid power quality disturbance identification method disclosed in the present invention includes the following steps: Step 1, receiving a one-dimensional power quality disturbance signal, and using a multi-level global convolutional neural network to perform preliminary feature extraction on the received one-dimensional power quality disturbance signal to obtain a preliminary feature signal; Step 2: Input the obtained preliminary feature signal into the simplified Transformer model, and use the simplified Transformer model to perform effective feature addition on the preliminary feature signal to obtain an enhanced feature signal; Step 3: Input the obtained enhanced feature signal into the fully connected layer, and use the fully connected layer to map the high-dimensional feature space into a low-dimensional space to obtain a low-dimensional feature signal; Step 4: Input the obtained low-dimensional feature signal into the Softmax classifier, use the Softmax classifier to perform feature classification, and obtain the disturbance identification signal label.
[0018] By effectively connecting the multi-level global convolutional neural network and the Transformer model, the rich temporal and spatial features of the disturbance signal can be obtained through the multi-level global convolutional neural network. The multi-head attention layer in the Transformer model allows parallel processing of signals in multiple subspaces, which enhances the model's meticulousness and comprehensiveness in capturing the interdependence of disturbance features. It not only combines the advantages of each individual technology, but also further improves processing efficiency and recognition accuracy through collaborative work. The simplified Transformer model omits the encoding layer on the basis of the multi-level global convolutional neural network, which not only simplifies the model structure, but also reduces the computational complexity while still maintaining good performance.
[0019] Furthermore, in step 1, the multi-level global convolutional neural network (MGCNN) is composed of multiple multi-level global convolutions in series, and the multi-level global convolution includes a one-dimensional convolution layer, a ReLU activation function layer, a GAM attention module, and a maximum pooling layer; the GAM attention module includes a channel attention layer and a sequential attention layer, such as Figure 3 As shown in Figure 2, the structure of the GAM attention module is a one-dimensional global attention mechanism (1D-GAM); the model expression of the multi-level global convolution is: , where is a one-dimensional convolutional layer, is a ReLU activation function layer, is a channel attention layer, is a sequence attention layer, is a maximum pooling layer, i Indicates i Multi-level global convolutions, MGC i Indicates i Layer global convolution module, such as Figure 4As shown, the multi-level global convolution uses 4 (i.e., i=1, 2, 3, 4) layers of convolution blocks with different depths to perform multi-level convolution operations on the input one-dimensional power quality disturbance signal.
[0020] Furthermore, a one-dimensional convolutional layer is used to convert a single-channel input signal into a feature representation with a higher dimension. The specific expression is: , where is the output characteristic signal, and are the weight and bias of the i-th convolutional layer, X is the input feature signal, Represents a convolution operation.
[0021] Furthermore, the maximum pooling layer (MaxPool1d) is used for downsampling, reducing the size of the feature signal and increasing the receptive field of the feature signal. The specific parameters are shown in Table 1.
[0022] Table 1- Specific parameters of the multi-level global convolutional neural network (MGCNN) model
[0023] Furthermore, the specific steps of the channel attention layer for channel attention calculation are: First, assume that the input feature signal is ,in, b is the batch size, c is the number of channels, the one-dimensional signal c is 1, l is the sequence length, R represents the set of real numbers, represents a real matrix with dimensions b × c × l ; Then, the linear transformation layer is used to compress the channel dimension of the input feature signal. The number of output units of the linear transformation layer is , where int() is a function that converts data types to integers, and rate is a preset hyperparameter used to control the compression ratio. The purpose is to reduce the number of parameters and reduce the computational complexity while retaining enough information. The algorithm expression for compression is: , where Z1 is the compressed characteristic signal, is the weight of the linear transformation layer, is the bias of the linear transformation layer; Then, the ReLU activation function is used to increase the nonlinear processing capability, which helps to capture complex feature dependencies. The specific algorithm expression is: , where A is the result data after the activation function is processed, and ReLU() represents the ReLU activation function; Then, a linear layer is used to reduce the channel dimension from the compressed number of channels to Restoring the original number of channels c to complete the calculation of channel attention can capture and strengthen important channel features while suppressing unimportant channels. The specific algorithm expression is: , where Z2 is the restored channel data, is the weight of the linear layer, is the bias of the linear layer; Then, through the sigmoid function Z 2 is scaled so that its range is limited to [0,1], indicating that the importance of each channel is: , where e is the base of the exponential function, is a natural constant, and CA represents the importance of the channel. Represents the sigmoid function; Finally, the importance CA is compared with the original input X Perform element-by-element multiplication (Hadamard Product) to dynamically adjust the characteristic response of each channel, namely: ,in, represents the Hadamard product, S For the adjusted feature signals, important feature channels are strengthened and other channels are suppressed, which helps the subsequent model learning and decision-making process.
[0024] Furthermore, the specific implementation steps of the sequence attention layer are: First, set the characteristic signal output by the channel attention mechanism S The dimension is ,in, b is the batch size, c is the number of channels, l is the sequence length; Then, the convolution operation of the first convolutional layer is used to reduce the number of channels. The first convolutional layer uses a convolution kernel size of 7, a step size of 1, and an edge padding of 3. The purpose is to reduce the number of channels through convolution operations without changing the sequence length. The number of channels of the output is , rate is a hyperparameter for controlling channel compression, and the algorithm expression of the first convolutional layer operation is: , where Y1 is the feature signal after convolution of the first convolutional layer, is the weight of the convolution kernel, is the bias of the convolution kernel, Represents the convolution operation; Then, the convolved feature signal Y1 is processed by the batch normalization layer and the ReLU activation function to stabilize the training process and introduce nonlinearity to enhance the model's ability to capture complex patterns. The specific algorithm is expressed as: , where Y2 is the feature signal after normalization and activation function processing, and BN represents the batch normalization operation; Then, the second convolutional layer is used to convert the number of channels of Y2 from the number of channels output by the first convolutional layer Increase to the final number of output channels , the convolution kernel size of the second convolution layer is 7, and the edge padding is 3 to keep the sequence length unchanged. The specific algorithm expression is: , where Y3 is the feature signal after convolution of the second convolutional layer, is the weight of the convolution kernel, is the bias of the convolution kernel; Then, Y3 is processed by the batch normalization layer to obtain the final sequence attention feature signal. The specific algorithm expression is: , where Y4 is the sequence attention feature signal; Then, the sequence attention feature signal Y4 is processed by the Sigmoid activation function to output the importance weight of each position, ranging between [0,1]. The importance expression of each sequence position is: , where SA represents the importance of the sequence position, Represents the Sigmoid function; Finally, the importance of each sequence position SA is multiplied element by element by the input S to obtain the feature signal adjusted by the sequence attention mechanism: , where G represents the feature signal after the sequence attention mechanism is adjusted, Denotes the Hadamard product.
[0025] This mechanism of using sequence attention layer effectively strengthens the feature response of important positions in the sequence, improves the model's ability to capture key information, and helps to improve the overall performance of the model.
[0026] Furthermore, in step 2, the simplified Transformer model is composed of multiple stacked Transformer basic modules; each Transformer basic module is composed of an MSA module, an MLP module, two residual modules and two normalization modules, such as Figure 5As shown in the figure; the two residual modules are used to directly add the inputs of the MSA module and the MLP module to the corresponding outputs. This structural design helps to avoid the gradient vanishing problem that may occur in the training process of deep networks; the two normalization layers standardize the inputs of the MSA module and the MLP module respectively, so that the input mean is 0 and the variance is 1, which helps the stability and convergence speed of the model training; the output of the MSA module after processing by the residual module is used as the input of the MLP module.
[0027] Furthermore, the MSA module is a multi-head self-attention mechanism module. The MSA module is the core of the Transformer model. By distributing the self-attention mechanism to multiple heads, the model allows the model to process information in parallel in different subspaces, thereby capturing complex patterns and relationships in the data. Each head independently captures different aspects of the input data, and then combines this information to form a comprehensive output representation. For a given query (Q), key (K), and value (V), the algorithm formula of the MSA module is: , where MultiHead(Q,K,V) represents the operation of the multi-head attention mechanism, Q represents the query vector, K represents the key vector, V represents the numerical vector, and Concat() represents the connection of multiple independent attention heads. Represents the weight matrix of the linear transformation after the concatenation of all head outputs. head1 represents the first head in the multi-head attention mechanism. head h Indicates the first h Size; The calculation of each head is as follows: , where head i is the first in the multi-head attention mechanism i Attention() represents the attention mechanism operation, and softmax() is used to calculate the attention weight. , as well as are the weight matrices of the query, key, and value corresponding to the header, respectively. It is the dimension of the key vector, which is used to scale the dot product to prevent the internal dot product from being too large and affecting the gradient of softmax.
[0028] Furthermore, the MLP module is a multi-layer perceptron module, which usually contains two linear layers and an activation function. The MLP module is a small feedforward network responsible for processing the output of the MSA and introducing nonlinear transformations to enhance the expressive power of the module. The expression of the MLP module is: , where MLP( x) is a multi-layer perceptron module, W1 and W2 are weight matrices of the linear layer, b1 and b2 are bias terms, and ReLU is a nonlinear activation function used to increase nonlinear processing capabilities. Represents the nonlinear transformation after the activation function. The MLP module adds Dropout layers in multiple layers, especially in the multi-head self-attention mechanism and multi-layer perceptron, which effectively reduces the risk of overfitting.
[0029] Furthermore, the expression of the residual module is: , where LayerOutput is the output of the residual module, and LayerInput is the input of the residual module. The residual module is the output of the MSA module or the MLP module. By adding the input directly to the output, the residual module enables the deep network to learn the identity mapping, thereby maintaining the network performance while preventing the gradient problem.
[0030] Furthermore, the expression of the normalization module is: , where LayerNorm(x) represents the normalized result, is the mean of the data to be normalized, is the standard deviation of the data to be normalized, and is a learnable parameter used to restore the original distribution of normalized data.
[0031] In order to verify the effectiveness of the microgrid power quality disturbance identification method disclosed in the present invention, a simulation analysis is carried out as follows: First, a PQD data set is generated. According to the standard of "IEEE (Institute of Electrical and Electronics Engineers) Power Quality Monitoring Recommended Practice", 29 mathematical models of power quality disturbances are established, including 10 single disturbances, 15 double disturbances and 4 triple disturbances. The unique hot encoding mode is adopted, and each disturbance type is numbered separately, as shown in Table 2. When training the MGCNN-Transformer model proposed by the recognition method of the present invention, the normal signal is counted as a special disturbance, totaling 29 power quality disturbance signals. The fundamental frequency is set to 50Hz, the sampling frequency is set to 5.12kHz, the sampling time is 10 fundamental cycles, and a total of 1024 sampling points. VSCode randomly generates 29 PQDs in noise-free, signal-to-noise ratio 50dB, 30dB and 20dB environments. The disturbance signal amplitude and the disturbance occurrence time are random, and the disturbance signals under the four environments are added together to form a data set with mixed noise. There are 1200 groups of disturbance signals for each type, and they are divided into training set, validation set and test set according to 7:1:2. There is no intersection between the training set, validation set and test set. The training set is used as input for model training, while the validation set and test set do not participate in model training and are only used to verify and test the generalization performance of the model.
[0032] Table 2-PQD Category Table
[0033] Next, perform model training: Set the number of module layers in the MGCNN network to 4, the number of Transformer basic modules to depth = 2, and the number of attention heads of the MSA module to h = 4. Select the cross entropy function commonly used in classification problems as the loss function during training, and the expression is as follows: , where B is the training batch size, Q is the number of PQDs categories, and are the true label and predicted probability of the pth input in the qth PQDs. The recognition accuracy Acc and loss value Loss of the training set and test set during model training are as follows: Figure 6 As shown, the horizontal axis is the number of iterations, and the vertical axis is the accuracy. Figure 6 The model proposed in the present invention can achieve an accuracy of more than 95% after 20 iterations, and maintains a high accuracy and low loss. The model converges quickly without overfitting. The recognition accuracy of various disturbances at different noise levels is shown in Table 3.
[0034] Table 3 - Class recognition accuracy table
[0035] Table 3 shows the detection accuracy of various power quality disturbances (such as normal signals, voltage swells, voltage sags, etc.) under different noise levels (no noise, 50db, 30db, and 20db). Overall, the recognition method of the present invention shows good robustness in the face of different noise environments. Although the accuracy rate slightly decreases from 99.64% under no noise to 98.85% under 20db noise conditions as the noise level increases, it still remains at a high level.
[0036] It is particularly noteworthy that some categories such as C2 (voltage sag), C3 (voltage harmonics), C7 (voltage oscillation), etc., maintain 100% accuracy at all noise levels, indicating that these types of power quality disturbances can be detected with high accuracy in different noise environments. This emphasizes the efficiency and accuracy of the MGCNN-Transformer model proposed in the identification method of the present invention in identifying these power quality disturbances. However, there are also some categories that show performance degradation when facing higher noise levels. The most notable example is C20 (flicker + interruption), where the accuracy drops to 93.26% under 20db noise conditions. This decline may point out the limitations of the MGCNN-Transformer model in dealing with complex power quality disturbances (i.e., those containing multiple abnormal features) in a high noise background.
[0037] In order to study the accuracy of different preprocessing methods for power quality disturbance signals, the experiment selected four preprocessing methods: original data, empirical mode decomposition (EMD), wavelet packet transform (WPD), and discrete wavelet transform (DWT) for comparison under the premise that the model parameters remain unchanged. The results reveal the specific impact of each preprocessing method on the model recognition accuracy under different noise environments (no noise, 50db, 30db and 20db).
[0038] Table 4-Model recognition accuracy comparison table
[0039] Table 4 shows that different preprocessing methods have their own advantages and performance in terms of model recognition accuracy. In a noise-free environment, all methods showed high accuracy, but as the noise level increased, the performance of each method diverged. The empirical mode decomposition (EMD) had relatively low accuracy under all noise conditions, while the wavelet packet transform (WPD) and discrete wavelet transform (DWT) showed high accuracy under various noise environments, especially DWT, which had high recognition accuracy under various noise conditions. Although the accuracy of DWT and the original data was very different, the original data did not need to go through complex preprocessing, which could reduce the time and resource consumption of data processing. Therefore, the final choice was to directly input the original data into the MGCNN-Transformer model.
[0040] In order to study the impact of different levels of convolution modules on the MGCNN-Transformer model, the experiment selected multi-level convolution blocks (MC) with 2, 3, 4 layers of MGC and without 1D-GAM, and compared the recognition accuracy, training time and parameter quantity in a 30db noise environment while keeping the parameters unchanged.
[0041] Table 5-Comparison of global convolution modules at different levels
[0042] As shown in Table 5, the accuracy of the MGC module is generally higher than that of the MC module under various layer settings, which clearly demonstrates the effectiveness of the global attention mechanism in improving model accuracy. In particular, under the 4-layer configuration, the accuracy of the MGC module reached 99.41%, which is significantly higher than the MC module with the same number of layers. In addition, as the number of layers increases, the accuracy of both modules shows an upward trend, but the speed of improvement slows down with the increase in the number of layers, indicating that increasing the number of layers can effectively improve model performance, but the effect has a decreasing trend.
[0043] In terms of training time, the training time of the MC module does not increase linearly with the number of layers, reflecting the possible balance between model complexity and training efficiency. The structural characteristics of the model, computational complexity, efficiency of the optimization algorithm, and data processing flow will all have an impact on the training time. The longest training time under the MGC=2 configuration may be the result of the combined effect of the above factors. In contrast, the training time of the MGC module gradually increases with the number of layers, which shows that the addition of the global attention mechanism significantly increases the computational burden of the model. In fact, the training time of the MGC model with the introduction of the global attention mechanism is higher than that of the MC model at all levels, reflecting the higher computational complexity.
[0044] In terms of parameter quantity, the MGC module generally has more parameters than the MC module, which indicates that the introduction of the global attention mechanism not only enhances the performance of the model, but also leads to more parameter requirements, which may be because the global attention layer requires additional parameters to learn the attention weights. At the same time, whether it is MC or MGC modules, the number of parameters increases significantly with the increase in the number of layers, which is consistent with expectations, because more layers mean more convolution kernels and connections, which in turn leads to an increase in model complexity.
[0045] In summary, the multi-level global convolution module (MGC) significantly improves the accuracy of the model by adding a global attention mechanism, while maintaining a moderate increase in the number of parameters, compared to the traditional multi-level convolution module (MC), but this also brings a longer training time. This shows that when designing a deep learning model, it is necessary to balance the accuracy of the model, training efficiency, and the number of parameters, so the number of global convolution module layers when MGC=4 is finally selected.
[0046] In this invention, when the multi-head attention mechanism is set to 4 heads, different Transformer network depths (the number of Transformer base layers is 2, 4, and 6 layers) are investigated for the PQDs recognition accuracy under different noise levels (no noise, 50db, 30db, and 20db) and the model training time. By comparison, the influence of different network depths on the recognition accuracy and training time can be observed, as shown in Table 6.
[0047] Table 6-Comparison of different Transformer network depths
[0048] From the data in Table 6, it can be seen that in a noise-free environment, the recognition accuracy of all network configurations is relatively high, among which the configuration of the 2-layer encoder achieves the highest accuracy (99.64%), while the configuration of the 6-layer encoder has the lowest accuracy (98.91%), which may be due to the overfitting phenomenon caused by the increase in the number of network layers. Since MGC also occupies a part of the parameters in the MGCNN-Transformer model, and the original power quality disturbance signal to be recognized has a small amount of data, the Transformer selects the 2 shallowest layers to achieve the best recognition effect.
[0049] Then, the number of layers is selected as 2 and other parameters remain unchanged. The impact of changing the number of multi-head attention (2, 4, 8 heads) on the accuracy and training time of the model in identifying power quality disturbances (PQDs) under different noise levels (no noise, 50db, 30db, 20db) is shown in Table 7.
[0050] Table 7-Comparison of the number of multi-head attention in Transformer network
[0051] The results show that under the condition of a fixed encoder layer of 2, with the increase of the number of multi-head attention, the recognition accuracy of the recognition method of the present invention at various noise levels shows a trend of gradual improvement. In particular, in a noise-free environment, from 2 heads to 8 heads, the accuracy rate increases from 99.48% to 99.78%, indicating that increasing the number of heads of the attention mechanism can effectively improve the recognition ability of the recognition method of the present invention for PQDs, especially in a clearer signal environment, but the comprehensive recognition accuracy is best when there are 4 heads. In addition, the training time also increases slightly with the increase of the number of multi-head attention, from 1105 seconds for 2 heads to 1149 seconds for 8 heads. This increase is relatively small, indicating that the impact of increasing the number of heads in the multi-head attention mechanism on the training time is relatively limited. Therefore, in the Transformer model, appropriately increasing the number of multi-head attention can significantly improve the PQDs recognition accuracy of the model in different noise environments without significantly increasing the training time.
[0052] In order to further compare the influence and classification effect of different deep learning methods on PQDs disturbance classification, the present invention compares 5 different model methods including 1D-CNN model, CNN-Bilstm model, Transformer model, LSTM model and CNN-LSTM model with the MGCNN-Transformer method of the present invention, and uses the original data set in the same 50db noise environment to train the model for 100 rounds, and then uses the test set to compare the recognition accuracy (%) and comprehensive recognition rate (%) of 29 disturbance types. Figure 7 and Figure 8 shown.
[0053] from Figure 7 and Figure 8In the figure, it can be seen that the CNN-BiLSTM model has achieved an accuracy of 98.14%, which demonstrates the ability of the bidirectional long short-term memory network (BiLSTM) to capture forward and backward dependencies in time series data. However, despite the excellent performance of the Transformer model and LSTM in other tasks, their performance in the PQDs recognition task can only reach 80.09% and 80.2% accuracy. This may suggest that when processing this type of signal data, the model needs a more specialized structure to extract relevant features. On the other hand, the 1D-CNN model has demonstrated its strong ability in feature extraction with an accuracy of 97.17%, especially when processing data with strong spatial characteristics. The CNN-LSTM model achieved an accuracy of 98.95% by combining the feature extraction ability of CNN and the sequence processing advantages of LSTM, indicating the effectiveness of this hybrid architecture in processing complex signals. The recognition method proposed in this paper leads other models with an accuracy rate of 99.55%. The high accuracy of MGCNN-Transformer may be due to its ability to effectively combine multi-dimensional information, such as time domain and frequency domain features and long-distance dependencies of time series, thereby providing more accurate recognition.
[0054] In order to further verify the performance of the recognition method proposed in this paper, the MGCNN-Transformer model was compared with several current advanced technologies. These technologies cover various machine learning and deep learning-based methods, including FDST+DT, DWT+PNN, CS+DCNN, GCNN+AFEN, 1D-VGG, DAE, MCF-TST, DL-WMV, etc. Each technology was tested on the power quality disturbance (PQD) recognition task at different signal-to-noise ratio levels, ranging from 20dB to 50dB, as shown in Table 8.
[0055] Table 8- Comparison of recognition rates of different models
[0056] As can be seen from Table 8, deep learning has more advantages than machine learning methods in terms of recognition accuracy and categories. The MGCNN-Transformer model proposed in the recognition method of the present invention shows excellent performance in the accuracy of each signal-to-noise ratio level, especially at a signal-to-noise ratio of 50dB, reaching an accuracy of 99.55%, which is significantly higher than other methods. In addition, in the lower signal-to-noise ratio environments of 20dB and 30dB, the MGCNN-Transformer model also achieved accuracies of 98.85% and 99.41%, respectively, which shows that the MGCNN-Transformer model is not only robust to noise, but also able to maintain a high level of performance in different signal-to-noise environments.
[0057] In order to further verify the feasibility of the identification method of the present invention, a set of real power quality disturbance signals is used as input to verify the MGCNN-Transformer model. The data set is provided by the Kaggle public database and includes five types of power quality signals, namely normal signals, voltage interruptions, pulses, third harmonics, and fifth harmonics. 200 samples of each signal type are selected as the test set for verification. The results are shown in Table 9 and Fig. 9 shown.
[0058] Table 9-Recognition results of real data sets
[0059] Analyze Table 9 and Fig. 9 It can be seen that the average recognition rate of the MGCNN-Transformer model of the recognition method proposed in the present invention reached 99.7% recognition accuracy, which strongly verified the recognition ability of the MGCNN-Transformer model for real power quality disturbance signals. The high accuracy of the MGCNN-Transformer model shows that it has extremely high reliability and practicality in practical applications, especially in situations where accurate monitoring and diagnosis of power quality problems are required.
[0060] In summary, the microgrid power quality disturbance identification method proposed in this invention has the following conclusions: (1) The proposed one-dimensional global attention mechanism (1D-GAM) for signal processing effectively enhances the model's recognition ability for one-dimensional power quality disturbance signals by fusing channel attention and sequence hybrid attention mechanisms; (2) A multi-level global convolutional neural network (MGCNN) is designed to effectively capture local details and global trends in power quality disturbance signals, providing in-depth time series analysis and spatial feature mapping. This network uses varying convolution kernel sizes at different levels, which not only enhances the sensitivity to small changes in the signal, but also captures the overall pattern changes, thus providing a rich and complex information background for disturbance identification. (3) In terms of recognition model, the MGCNN-Transformer model effectively connects the MGCNN and Transformer models. In this model, the multi-head attention layer of the Transformer can process signals in parallel in multiple subspaces, which greatly enhances the model's meticulousness and comprehensiveness in identifying and analyzing the interdependence of power quality disturbance characteristics. In addition, this model structure not only integrates the advantages of each technology, but its collaborative working mechanism also significantly improves the overall processing efficiency and recognition accuracy. (4) Through various comparative experiments, the model with optimal parameters was determined to identify 29 power quality disturbance signals. The recognition accuracy reached 99.64% in the noise-free condition and 98.85% in the environment with a signal-to-noise ratio of 20 dB, showing good noise resistance. In the real data experiment, the model had good recognition effect on 5 disturbance signals, proving that the MGCNN-Transformer model proposed in this invention has good generalization performance.
[0061] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes in form and details may be made without departing from the spirit and scope of the present invention as defined in the appended claims.
Claims
1. A method for identifying power quality disturbances in a microgrid, characterized in that: The steps include: Step 1, receiving a one-dimensional power quality disturbance signal, and using a multi-level global convolutional neural network to perform preliminary feature extraction on the received one-dimensional power quality disturbance signal to obtain a preliminary feature signal; Step 2: Input the obtained preliminary feature signal into the simplified Transformer model, and use the simplified Transformer model to perform effective feature addition on the preliminary feature signal to obtain an enhanced feature signal; Step 3: Input the obtained enhanced feature signal into the fully connected layer, and use the fully connected layer to map the high-dimensional feature space into a low-dimensional space to obtain a low-dimensional feature signal; Step 4: Input the obtained low-dimensional feature signal into the Softmax classifier, use the Softmax classifier to perform feature classification, and obtain the disturbance identification signal label.
2. The method for identifying power quality disturbances in a microgrid according to claim 1, characterized in that: In step 1, the multi-level global convolutional neural network is composed of multiple multi-level global convolutions in series. The multi-level global convolution includes a one-dimensional convolution layer, a ReLU activation function layer, a GAM attention module, and a maximum pooling layer; the GAM attention module includes a channel attention layer and a sequence attention layer; the model expression of the multi-level global convolution is: ,in, is a one-dimensional convolutional layer, is the ReLU activation function layer, is the channel attention layer, is the sequence attention layer, is the maximum pooling layer, i Indicates i Multi-level global convolution, MGC i Indicates i Layer global convolution module.
3. The method for identifying power quality disturbances in a microgrid according to claim 2, characterized in that: The specific steps of the channel attention layer for channel attention calculation are: First, assume that the input feature signal is ,in, b is the batch size, c is the number of channels, the one-dimensional signal c is 1, l is the sequence length, R represents the set of real numbers, R b×c×l represents a real matrix with dimensions b×c× l ; Then, the linear transformation layer is used to compress the channel dimension of the input feature signal. The number of output units of the linear transformation layer is , where int() is a function that converts data types to integers, rate is a preset hyperparameter used to control the compression ratio, and the algorithm expression for compression is: , where Z1 is the compressed characteristic signal, is the weight of the linear transformation layer, is the bias of the linear transformation layer; Then, the ReLU activation function is used to increase the nonlinear processing capability. The specific algorithm expression is: , where A is the result data after the activation function is processed, and ReLU() represents the ReLU activation function; Then, a linear layer is used to reduce the channel dimension from the compressed number of channels to Restore to the original number of channels c to complete the calculation of channel attention. The specific algorithm expression is: , where Z2 is the restored channel data, is the weight of the linear layer, is the bias of the linear layer; Then, through the sigmoid function Z 2 is scaled so that its range is limited to [0,1], indicating that the importance of each channel is: , where e is the base of the exponential function, is a natural constant, and CA represents the importance of the channel. Represents the sigmoid function; Finally, the importance CA is compared with the original input X Perform element-by-element multiplication to dynamically adjust the characteristic response of each channel, namely: ,in, represents the Hadamard product, S is the adjusted characteristic signal.
4. The method for identifying power quality disturbances in a microgrid according to claim 2, characterized in that: The specific implementation steps of the sequence attention layer are: First, set the characteristic signal output by the channel attention mechanism S The dimension is ,in, b is the batch size, c is the number of channels, l is the sequence length; Then, the convolution operation of the first convolutional layer is used to reduce the number of channels. The first convolutional layer uses a convolution kernel size of 7, a stride of 1, and an edge padding of 3. The number of output channels is , rate is a hyperparameter for controlling channel compression, and the algorithm expression of the first convolutional layer operation is: , where Y1 is the feature signal after convolution of the first convolutional layer, is the weight of the convolution kernel, is the bias of the convolution kernel, Represents the convolution operation; Then, the convolved feature signal Y1 is processed by the batch normalization layer and the ReLU activation function. The specific algorithm is expressed as: , where Y2 is the feature signal after normalization and activation function processing, and BN represents the batch normalization operation; Then, the second convolutional layer is used to convert the number of channels of Y2 from the number of channels output by the first convolutional layer Increase to the final number of output channels , the convolution kernel size of the second convolution layer is 7, the edge padding is 3, and the specific algorithm expression is: , where Y3 is the feature signal after convolution of the second convolutional layer, is the weight of the convolution kernel, is the bias of the convolution kernel; Then, Y3 is processed by the batch normalization layer to obtain the final sequence attention feature signal. The specific algorithm expression is: , where Y4 is the sequence attention feature signal; Then, the sequence attention feature signal Y4 is processed by the Sigmoid activation function to output the importance weight of each position, ranging between [0,1]. The importance expression of each sequence position is: , where SA represents the importance of the sequence position, Represents the Sigmoid function; Finally, the importance of each sequence position SA is multiplied element by element by the input S to obtain the feature signal adjusted by the sequence attention mechanism: , where G represents the feature signal after the sequence attention mechanism is adjusted, Denotes the Hadamard product.
5. The method for identifying power quality disturbances in a microgrid according to claim 1, characterized in that: In step 2, the simplified Transformer model is composed of multiple stacked Transformer basic modules; each Transformer basic module is composed of an MSA module, an MLP module, two residual modules and two normalization modules; the two residual modules are used to directly add the inputs of the MSA module and the MLP module to the corresponding outputs respectively; the two normalization layers standardize the inputs of the MSA module and the MLP module respectively so that the input mean is 0 and the variance is 1; the output of the MSA module after processing by the residual module is used as the input of the MLP module.
6. The method for identifying power quality disturbances in a microgrid according to claim 5, characterized in that: The algorithm formula of the MSA module is: , where MultiHead(Q,K,V) represents the operation of the multi-head attention mechanism, Q represents the query vector, K represents the key vector, V represents the numerical vector, Concat() represents the connection of multiple independent attention heads, and W O Represents the weight matrix of the linear transformation after the concatenation of all head outputs. head1 represents the first head in the multi-head attention mechanism. head h Indicates the first h Size; The calculation of each head is as follows: , where head i is the calculation of the i-th head in the multi-head attention mechanism. Attention() represents the attention mechanism operation, and softmax() is used to calculate the attention weight. , as well as are the weight matrices of the query, key, and value corresponding to the header, respectively. is the weight matrix for linear transformation after concatenation of all head outputs, It is the dimension of the key vector, which is used to scale the dot product to prevent the internal dot product from being too large and affecting the gradient of softmax.
7. The method for identifying power quality disturbances in a microgrid according to claim 5, characterized in that: The expression of the MLP module is: , where MLP(x) is a multi-layer perceptron module, W1 and W2 are weight matrices of the linear layer, b1 and b2 are bias terms, and ReLU is a nonlinear activation function used to increase nonlinear processing capabilities, indicating the nonlinear transformation after the activation function.
8. The method for identifying power quality disturbances in a microgrid according to claim 5, characterized in that: The expression of the residual module is: , where LayerOutput is the output of the residual module, and LayerInput is the input of the residual module. is the output of the MSA module or the MLP module.
9. The method for identifying power quality disturbance in a microgrid according to claim 5, characterized in that: The expression of the normalization module is: , where LayerNorm(x) represents the normalized result, is the mean of the data to be normalized, is the standard deviation of the data to be normalized, and is a learnable parameter used to restore the original distribution of normalized data.
Citation Information
Patent Citations
Power quality disturbance detection method and device
CN114325197A
Sub-daylight photovoltaic power generation prediction method and system based on seasonal decomposition and convolutional network
CN116014722A
Power grid frequency stability intelligent enhancement discrimination method based on model-data fusion driving
CN118281900A
Cited By
Real-time classification method for power quality disturbance of distributed photovoltaic transformer area
CN119089311A
Self-adaptive voltage regulation method and system for micro-grid with multi-source power generation characteristic
CN119419953A
Adaptive Voltage Regulation Method and System for Microgrid with Multi-source Power Generation Characteristics
CN119419953B
