Power quality disturbance classification and time positioning method based on deep learning
Through deep learning-based methods, the differential mutation point characteristics of the power quality disturbance signal are extracted and multi-channel feature extraction is combined with the original signal, which solves the complexity and inefficiency problems of traditional methods in the classification and time positioning of power quality disturbance signals, and achieves more accurate time positioning and classification effects.
Patent Information
- Application Number
- CN202510118333.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-23
AI Technical Summary
Traditional methods have complex steps and low efficiency in the classification and time positioning of electrical energy quality disturbance signals. Especially after large-scale access to new energy, the type identification and time positioning capabilities are greatly affected under the complexization of disturbance signals and noise interference.
Using a deep learning-based method, by obtaining the differential signal of the electrical energy quality perturbation signal, a deep learning encoder with multi-head self-attention extracts the characteristics of the perturbation differential mutation point, and combines the original signal with these features into multi-channel features. The characteristics are further extracted through the channel attention and time convolution network, and finally the improved cross entropy loss function training network is used to realize the classification and temporal positioning of electrical energy quality perturbation.
This method can obtain the sudden point information of the power mass disturbance signal more accurately without relying on the signal processing method, enhance the time positioning ability to disturb, and realize the classification and time positioning of the power mass disturbance signal.
Smart Images

Figure CN120030429A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power quality analysis, and in particular to a method for classifying and time-locating power quality disturbances based on deep learning. Background Art
[0002] Power quality is an important issue that needs to be paid attention to in power systems with a high proportion of renewable energy. Power quality disturbances may interfere with or even destroy the normal working state of power equipment, causing economic losses and safety risks to power grid operation and industrial production. The large-scale access of renewable energy has made power quality disturbance signals complex. Some typical features have become difficult to distinguish in these complex disturbances. In addition, the interference of various factors such as noise has greatly affected the type recognition and time positioning capabilities of traditional methods.
[0003] At present, in order to classify and detect power quality disturbances, the main method is to combine traditional signal processing methods with deep learning methods, use time-frequency domain algorithms to decompose the original disturbance signal, obtain information features related to the disturbance type and disturbance time, and then use simple classifiers or deep learning methods to obtain the disturbance type, and further calculate the start and end time of the disturbance. This method requires the combination of deep learning methods and signal processing methods to simultaneously realize the classification of disturbance types and the location of the start and end time of disturbances, so the classification method steps are relatively complicated. Summary of the invention
[0004] The purpose of the present invention is to provide a method for classifying and time-locating power quality disturbances based on deep learning, which can achieve the classification and time-locating of power quality disturbance signals without relying on signal processing methods.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is: a method for classifying and time locating power quality disturbances based on deep learning, comprising:
[0006] Obtain power quality disturbance signals;
[0007] Calculate the differential signal corresponding to the power quality disturbance signal;
[0008] A deep learning encoder based on multi-head self-attention is used to extract features from the differential signal to obtain the perturbation differential mutation point features;
[0009] Merge the original signal and the perturbation differential mutation point features into multi-channel features;
[0010] A multi-channel feature extraction module based on channel attention and temporal convolutional network is used to further extract features from multi-channel features;
[0011] The improved cross entropy loss function based on the feature labels of sampling points is used to train the network to achieve power quality disturbance classification and time location.
[0012] Furthermore, a deep learning encoder based on multi-head self-attention is used to extract features of the differential signal to obtain the disturbance differential mutation point features, and the implementation method is as follows:
[0013] For the input differential signal, the vectors q, k and v corresponding to the autonomous attention query matrix, key matrix and value matrix are obtained through feature normalization and feedforward neural network layer encoding; for the power quality disturbance signal x = [x 1 ,x 2 ,…,x L ], its normalized differential signal Δx std for:
[0014]
[0015] In the formula, x p Is the padding value of the padding operation, set to x L -x L-1 To maintain the sequence length to achieve time positioning; Δx m and Δx var Respectively represent the mean and variance of the differential data on the feature dimension;
[0016] The sampling feedforward neural network layer encodes the differential signal by increasing or decreasing the dimension, and enhances the learning ability of the self-attention mechanism. The processing process of the differential signal by the feedforward neural network layer is shown in the following formula:
[0017]
[0018] In the formula, ReLU(·) is the activation function, and are the weights and biases of the ith linear layer, Represents the residual connection operation; a one-dimensional convolution with unit step size is used instead of the fully connected layer, where kd f and d f are the convolution channel dimensions corresponding to the dimension increase and dimension reduction operations, B is the batch size, and L is the sequence length;
[0019] Using deep learning encoder based on multi-head self-attention As q, k, and v vectors, the network redistributes the attention scores at different positions in the sequence using a scoring function α(·) based on the scaled dot product:
[0020]
[0021] Where W (q) , W (k)and W (v) They are weight matrices of the three vectors respectively. The query matrices Q and K are obtained by inputting feature dimensions d f The scaled dot product is performed and activated by the Softmax function to obtain the attention score of each position in the sequence. In addition, in order to improve the learning ability of the model, the features of multiple heads are calculated in parallel.
[0022] By merging multiple heads, the input is a differential signal, and the output feature of the deep learning encoder after multi-head self-attention is the perturbation differential mutation point feature.
[0023] Furthermore, the multi-channel feature extraction module based on channel attention and temporal convolutional network includes multiple layers of temporal convolutional network, and a channel attention module is arranged between every two layers of temporal convolutional network.
[0024] Furthermore, the channel attention module first compresses the features, which is expressed as follows:
[0025]
[0026] In the formula, Represents a convolution operation after the i-th layer TCN, with the input being feature X i-1 , the output is the number of channels C i Features of U i ,in For U i The feature vector on the cth channel; F sq (·) represents the compression operation, using average pooling to calculate the reduced feature z (i) ; Then, the channel attention mechanism performs the excitation operation and calculates the channel weight s through two fully connected layers with activation functions of ReLU and Sigmoid respectively. (i) :
[0027]
[0028] In the formula, F ex (·) indicates the incentive operation, and So that the number of channels becomes C i / r and C i .
[0029] Furthermore, the channel weights are multiplied by the original features to obtain the input features of the next layer of temporal convolutional network.
[0030] Furthermore, the calculation formula of the improved cross entropy loss function is as follows:
[0031]
[0032] In the formula, and are the predicted value and true value of the kth sampling point of the ith sample, respectively; l and m are the number of sampling points and the number of samples, respectively; N c is the number of disturbance categories.
[0033] The present invention also provides a computer device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, and the above method is implemented when the computer program instructions are executed by the processor.
[0034] The present invention also provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.
[0035] Compared with the prior art, the present invention has the following beneficial effects: the present invention provides a method for classifying and time locating power quality disturbances based on deep learning. The method combines the original signal with its differential signal through a deep learning method, and can more accurately obtain the information of the learned signal's mutation points, thereby enhancing the ability to time locate the disturbance. On the basis of improving the cross entropy loss function, through the feature learning process of a multi-channel network, the classification and time location of power quality disturbance signals can be simultaneously achieved without relying on signal processing methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 The present invention is a flowchart of a method according to an embodiment of the present invention.
[0037] Figure 2 Schematic diagram of the implementation process of a deep learning encoder based on multi-head self-attention in an embodiment of the present invention.
[0038] Figure 3 This is a network architecture diagram of a multi-channel feature extraction module based on channel attention and temporal convolutional network in an embodiment of the present invention.
[0039] Figure 4 This is the result of extracting the features of the power quality disturbance mutation point in the embodiment of the present invention.
[0040] Figure 5 This is the result of time positioning of power quality disturbance in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0042] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0043] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular forms are also intended to include the plural forms. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they specify the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0044] As Figure 1 shown, this embodiment provides a method for classifying and time-locating power quality disturbances based on deep learning, including the following steps:
[0045] S1. Obtain the power quality disturbance signal.
[0046] S2. Calculate the differential signal corresponding to the power quality disturbance signal.
[0047] S3. Use a deep learning encoder based on multi-head self-attention to extract features from the differential signal to obtain disturbance differential mutation point features.
[0048] S4. Combine the original signal, that is, the power quality disturbance signal obtained in step S1, with the disturbance differential mutation point features into multi-channel features.
[0049] S5. Use a multi-channel feature extraction module based on channel attention and temporal convolutional network to further extract features from the multi-channel features.
[0050] S6. Use an improved cross-entropy loss function based on sampling point feature labels to train the network (the multi-channel feature extraction module based on channel attention and temporal convolutional network) to achieve power quality disturbance classification and time-location.
[0051] As Figure 2 shown, in this embodiment, a deep learning encoder based on multi-head self-attention is used to extract features from the differential signal to obtain disturbance differential mutation point features. The specific implementation method is as follows:
[0052] For the input differential signal, obtain the vectors q, k, and v corresponding to the self-attention query matrix, key matrix, and value matrix through feature normalization and feed-forward neural network layer encoding; for the power quality disturbance signal x = [x 1 , x 2 , …, x L , its normalized differential signal Δx std is:
[0053]
[0054] In the formula, x pIs the padding value of the padding operation, set to x L -x L-1 To maintain the sequence length to achieve time positioning; Δx m and Δx var They represent the mean and variance of the differential data on the feature dimension respectively.
[0055] The sampling feedforward neural network layer encodes the differential signal by increasing or decreasing the dimension, and enhances the learning ability of the self-attention mechanism. The processing process of the differential signal by the feedforward neural network layer is shown in the following formula:
[0056]
[0057] In the formula, ReLU(·) is the activation function, and are the weights and biases of the ith linear layer, Represents the residual connection operation. Considering the computational efficiency, a one-dimensional convolution with unit step size can be used instead of the fully connected layer, where kd f and d f They are the convolution channel dimensions corresponding to the dimension increase and dimension reduction operations, B is the batch size, and L is the sequence length.
[0058] Using deep learning encoder based on multi-head self-attention As q, k, and v vectors, the network redistributes the attention scores at different positions in the sequence using a scoring function α(·) based on the scaled dot product:
[0059]
[0060] Where W (q) , W (k) and W (v) They are weight matrices of the three vectors respectively. The query matrices Q and K are obtained by inputting feature dimensions d f By performing a scaled dot product and activating it with the Softmax function, we can get the attention score for each position in the sequence. In addition, in order to improve the learning ability of the model, the features of multiple heads can be calculated in parallel.
[0061] By merging multiple heads, the input is a differential signal, and the output feature of the deep learning encoder after multi-head self-attention has a significant enhancement effect on the mutation point, providing the perturbation differential mutation point feature for subsequent perturbations.
[0062] In this embodiment, the multi-channel feature extraction module based on channel attention and temporal convolutional network includes multiple layers of temporal convolutional network, and a channel attention module is arranged between every two layers of temporal convolutional network. Figure 3It is the network architecture diagram of the multi-channel feature extraction module based on channel attention and temporal convolutional network in this embodiment. As Figure 3 shown, the multi-channel feature extraction module based on channel attention and temporal convolutional network learns the combined features of the original signal and the differential mutation point features of the disturbance, and finally realizes disturbance classification and time localization through the fully connected layer.
[0063] The channel attention module first compresses the features, which is expressed as follows:
[0064]
[0065] In the formula, represents a convolutional operation after the i-th layer of TCN, with the input being the feature X i-1 , and the output being the feature U i with the number of channels being C i , where is the feature vector on the c-th channel of U i ; F sq (·) represents the compression operation, and the reduced-dimensional feature z (i) is calculated using average pooling; then, the channel attention mechanism performs an excitation operation, and through two fully connected layers with the activation functions ReLU and Sigmoid respectively, the channel weight s (i) can be calculated:
[0066]
[0067] In the formula, F ex (·) represents the excitation operation, and make the number of channels become C i / r and C i .
[0068] Multiply the channel weight by the original feature to obtain the input feature of the next layer of the temporal convolutional network.
[0069] In this embodiment, the calculation formula of the improved cross-entropy loss function is as follows:
[0070]
[0071] In the formula, and are the predicted value and the true value of the k-th sampling point of the i-th sample respectively; l and m are the number of sampling points and the number of samples respectively; N c is the number of disturbance categories.
[0072] Figure 4is the result of extracting the sudden change point feature of power quality disturbance in this embodiment. Among them, (a) is the interruption waveform, (b) is the temporary rise waveform, (c) is the interruption sudden change point feature, and (d) is the temporary rise sudden change point feature. Figure 4 As shown, the power quality disturbance mutation point feature extraction result of this embodiment retains the periodic characteristics of the signal, and has different values for different types of disturbance waveforms. For the interruption and temporary rise disturbances in this embodiment, the output feature heat map shows obvious stratification. During the interruption signal, the feature mean of the heat map is significantly weakened, while during the temporary rise, the feature is enhanced;
[0073] Figure 5 is the result of the time location of the power quality disturbance in this embodiment. Among them, (a) is the case where a temporary swell, harmonic and pulse disturbance are detected, (b) is the case where a temporary dip, harmonic, fluctuation and oscillation disturbance are detected, and (c) is the case where a temporary dip, harmonic, fluctuation and notch disturbance are detected. Figure 5 As shown, in the power quality disturbance time location result of this embodiment, the predicted label corresponding to each disturbance waveform is basically consistent with the real label. In this embodiment, the power quality disturbance classification and time location method based on deep learning has a good detection effect on triple and quadruple disturbances, and can more accurately detect transient disturbances such as pulses, gaps, oscillations, etc. that occur during multiple disturbances.
[0074] This embodiment further provides a computer device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, and when the computer program instructions are executed by the processor, the above method is implemented.
[0075] This embodiment further provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.
[0076] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0077] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0078] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0079] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0080] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
Claims
1. A method for classifying and locating power quality disturbances based on deep learning, characterized in that: include: Obtain power quality disturbance signals; Calculate the differential signal corresponding to the power quality disturbance signal; A deep learning encoder based on multi-head self-attention is used to extract features from the differential signal to obtain the perturbation differential mutation point features; Merge the original signal and the perturbation differential mutation point features into multi-channel features; A multi-channel feature extraction module based on channel attention and temporal convolutional network is used to further extract features from multi-channel features; The improved cross entropy loss function based on the feature labels of sampling points is used to train the network to achieve power quality disturbance classification and time location.
2. According to claim 1, a method for classifying and locating power quality disturbances based on deep learning is characterized in that: A deep learning encoder based on multi-head self-attention is used to extract features of the differential signal to obtain the disturbance differential mutation point features. The implementation method is as follows: For the input differential signal, the vectors q, k and v corresponding to the autonomous attention query matrix, key matrix and value matrix are obtained through feature normalization and feedforward neural network layer encoding; for the power quality disturbance signal x=[x1,x2,…,x L ], its normalized differential signal Δx std for: In the formula, x p Is the padding value of the padding operation, set to x L -x L-1 To maintain the sequence length to achieve time positioning; Δx m and Δx var Respectively represent the mean and variance of the differential data on the feature dimension; The sampling feedforward neural network layer encodes the differential signal by increasing or decreasing the dimension, and enhances the learning ability of the self-attention mechanism. The processing process of the differential signal by the feedforward neural network layer is shown in the following formula: In the formula, ReLU(·) is the activation function, and are the weights and biases of the ith linear layer, Represents the residual connection operation; a one-dimensional convolution with unit step size is used instead of the fully connected layer, where kd f and d f are the convolution channel dimensions corresponding to the dimension increase and dimension reduction operations, B is the batch size, and L is the sequence length; Using deep learning encoder based on multi-head self-attention As q, k, and v vectors, the network redistributes the attention scores at different positions in the sequence using a scoring function α(·) based on the scaled dot product: Where W (q) , W (k) and W (v) They are weight matrices of the three vectors respectively. The query matrices Q and K are obtained by inputting feature dimensions d f The scaled dot product is performed and activated by the Softmax function to obtain the attention score of each position in the sequence. In addition, in order to improve the learning ability of the model, the features of multiple heads are calculated in parallel. By merging multiple heads, the input is a differential signal, and the output feature of the deep learning encoder after multi-head self-attention is the perturbation differential mutation point feature.
3. According to a method for classifying and locating power quality disturbances based on deep learning according to claim 1, it is characterized in that: The multi-channel feature extraction module based on channel attention and temporal convolutional network includes multiple layers of temporal convolutional network, and a channel attention module is arranged between every two layers of temporal convolutional network.
4. The method for classifying and locating power quality disturbances based on deep learning according to claim 3 is characterized in that: The channel attention module first compresses the features, which is expressed as follows: In the formula, Represents a convolution operation after the i-th layer TCN, with the input being feature X i-1 , the output is the number of channels C i Features of U i ,in For U i The feature vector on the cth channel; F sq (·) represents the compression operation, using average pooling to calculate the reduced feature z (i) ; Then, the channel attention mechanism performs the excitation operation and calculates the channel weight s through two fully connected layers with activation functions of ReLU and Sigmoid respectively. (i) : In the formula, F ex (·) indicates the incentive operation, and So that the number of channels becomes C i / r and C i .
5. The method for classifying and time locating power quality disturbances based on deep learning according to claim 4, characterized in that: Multiply the channel weights by the original features to obtain the input features of the next layer of temporal convolutional network.
6. The method for classifying and locating power quality disturbances based on deep learning according to claim 1, characterized in that: The calculation formula of the improved cross entropy loss function is as follows: In the formula, and are the predicted value and true value of the kth sampling point of the ith sample, respectively; l and m are the number of sampling points and the number of samples, respectively; N c is the number of disturbance categories.
7. A computer device, characterized in that: include: At least one processor, at least one memory and computer program instructions stored in the memory, when the computer program instructions are executed by the processor, implement the method according to any one of claims 1 to 6.
8. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Sensor signal prediction method, system and equipment for humanoid robot
CN120995103A
Electric energy quality disturbance identification and positioning method based on artificial intelligence
CN121278664A