Electric energy quality disturbance identification method
Through the improved S-transform and CNN-DSA-XGBoost methods, the problems of low diagnostic accuracy and difficult separation of multiple disturbance signals in power quality disturbance detection are solved, efficient and accurate identification and classification of power quality disturbances are achieved, and the detection efficiency is improved. Efficiency and explainability.
Patent Information
- Application Number
- CN202410884605.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-10-15
AI Technical Summary
Existing power quality disturbance detection methods have shortcomings such as low diagnostic accuracy, difficulty in accurately separating multiple composite power quality disturbance signals, and poor interpretability, making it difficult to efficiently and accurately identify power quality disturbances.
The improved S transform (IST) is used to map the one-dimensional time signal to the two-dimensional time-frequency domain, combined with CNN for automatic feature extraction, and the XGBoost model parameters are optimized through DSA. Finally, the optimized XGBoost model is used to identify the power quality disturbance signal. Classification.
The accuracy and efficiency of power quality disturbance detection are improved, efficient and accurate power quality disturbance identification is achieved, the trial and error cost of manual parameter adjustment is reduced, and the identification ability and robustness of the model are enhanced.
Smart Images

Figure CN118779759A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for identifying power quality disturbances, in particular to a method for identifying power quality disturbances based on improved S transform and CNN--DSA--XGBoost. Background Art
[0002] With the rapid development of smart grids and the advancement of science and technology, the stable operation of power systems has become a very important part of social and economic activities. Ensuring the efficient and stable operation of power grid systems will help promote high-quality economic and environmental development. However, due to the connection of a large number of nonlinear loads, the popularization of new energy charging piles, and the influence of natural factors on distributed power generation technologies such as photovoltaic power generation and wind power generation, power quality disturbances such as harmonics, voltage flicker, and transient pulses have become one of the key factors affecting the stable operation of power systems. Therefore, in order to ensure the stable operation of the social economy and the friendly development of the environment, efficient and accurate identification of power quality disturbances has become a vision that needs to be achieved urgently.
[0003] Accurate time-frequency analysis is the key to signal processing of power quality disturbances. Classic signal processing techniques include Fourier transform, short-time Fourier transform, wavelet transform, Hilbert-Huang transform, S transform, etc. Fourier transform has orthogonality and completeness; however, it lacks local time-frequency information and is not suitable for the analysis of non-stationary dynamic disturbance signals. The short-time Fourier transform developed from it can map one-dimensional time information into two-dimensional time-frequency information, which fixes the defect of Fourier transform lacking local time-frequency information, but its window type is fixed and the time-frequency resolution is insufficient. Wavelet transform can realize multi-resolution analysis of disturbance signals by virtue of the translation and scaling of its mother wavelet, but the selection of parameters such as scale factor, time shift factor, sampling frequency and number of decomposition layers requires relatively high professionalism, and wavelet transform is greatly affected by noise and lacks phase correction. In order to optimize time-frequency analysis, signal processing technology is constantly being updated. The advent of S transform has fixed the defects of wavelet transform without phase correction and short-time Fourier transform window being unadjustable. However, its characteristic of providing better time resolution at high frequencies and better frequency resolution at low frequencies is contrary to the processing requirements of power quality disturbance signals.
[0004] Therefore, how to solve the shortcomings of current power quality disturbance detection methods, such as low diagnostic accuracy, difficulty in accurately separating multiple composite power quality disturbance signals, and poor interpretability, has become a technical problem that needs to be urgently solved in the industry. Summary of the invention
[0005] The purpose of the present invention is to provide a method for identifying power quality disturbances. The method provides an efficient, accurate, and highly transparent method for detecting power quality disturbances, which makes up for the shortcomings of existing methods in terms of low diagnostic accuracy, difficulty in separating multiple composite disturbance signals, and low interpretability, and improves the accuracy and efficiency of power quality disturbance detection.
[0006] The technical solution of the present invention is a method for identifying power quality disturbances, which specifically includes the following steps:
[0007] S1: Use IST to map the one-dimensional time signal to the two-dimensional time-frequency domain to generate a two-dimensional time-frequency image;
[0008] S2: resize the 2D time-frequency image, store the batch normalized data into a cell array and add labels;
[0009] S3: Use CNN to automatically extract features from the constructed dataset;
[0010] S4: DSA optimizes XGBoost model parameter selection;
[0011] S5: After training with the optimized XGBoost model, the power quality disturbance signal is identified and classified to obtain the power quality disturbance classification result.
[0012] In the aforementioned power quality disturbance identification method, S1 is specifically as follows: IST takes a one-dimensional time domain signal as input and uses a Gaussian window as a window function. It obtains local spectrum information by dividing the original signal into multiple overlapping windows and applying Fourier transform to the signal segments in each window. As time goes by, the window is moved and the window type is adjusted. All local spectrum results are collected and combined to finally generate a complete two-dimensional time-frequency image, showing the changes in the time-frequency characteristics of the signal.
[0013] In the above-mentioned method for identifying power quality disturbance, S1 is specifically:
[0014] Assuming that the existing one-dimensional continuous power quality disturbance signal is x(t), the one-dimensional continuous IST expression can be obtained by using the convolution theorem, Fourier transform and its inverse transform, see formula (1):
[0015]
[0016] Where: τ is the time shift factor; t is the time variable; f is the frequency variable. λ1 is the parameter used to adjust the resolution change rate; λ2 is the parameter used to adjust the frequency resolution at a fixed frequency; the selection of the two control parameters λ1 and λ2 refers to formula (2):
[0017]
[0018] Where: f0 is the fundamental frequency; f s is the sampling frequency; The frequency point representing the fundamental frequency;
[0019] Now x(t) is discretized by uniform sampling, and the discretization expression of IST is shown in formula (3):
[0020]
[0021] Where: N is the sampling length; T s is the sampling time interval; in addition, τ=mT s , t = nT s , Among them, m, n = 0, 1, ..., N-1 are time series; k = 0, 1, ..., N-1 is a frequency series;
[0022] Specifically, IST time-frequency analysis is performed in the following steps:
[0023] Step S11: sampling the continuous signal x(t) to be measured;
[0024] Step S12: Frequency will sequence Frequency shift construction
[0025] Step S13: frequency shift sequence Spectrum vector with window function Perform Hadamard product operation;
[0026] Step S14: Perform inverse Fourier transform on the product sequence of the Hadamard operation in step S13; obtain the frequency The time domain information of the signal;
[0027] Step S15: Eliminate insensitive frequency points, select fundamental and harmonic frequency points and repeat steps S12 to S14 to obtain a two-dimensional time-frequency matrix of the signal.
[0028] In the aforementioned power quality disturbance identification method, S2 is specifically: looping through the sorted image files and reading image data; adjusting the image size to 64×64, normalizing the image and matching the label at the same time; storing the batch normalized data information into a Matlab (*.Mat) file.
[0029] In the aforementioned power quality disturbance identification method, S3 specifically includes: preparing a training set and a test set; defining a CNN architecture; setting the training algorithm to adam, setting the maximum number of training rounds, and setting the learning rate and L2 regularization training parameters; training the neural network using preset training data and corresponding labels, and using the trained neural network for automatic feature extraction.
[0030] In the aforementioned method for identifying power quality disturbances, S3 is specifically: taking the first 70% of the number of samples of each disturbance type as a test set, and the remaining 30% as a test set; defining a deep learning network structure, which is a hierarchical structure consisting of an input layer, a convolution layer, a batch normalization layer, an activation function layer, a pooling layer, a discard layer, a fully connected layer, and an output layer;
[0031] Among them, the input layer is responsible for processing the received image files; the two-dimensional convolution layer is responsible for scanning the image from the input layer and using convolution to learn specific image features; each convolution kernel can detect a specific feature in the image when performing convolution operations and generate a corresponding feature map; the activation function layer will perform nonlinear mapping on the data in the feature map to increase the nonlinear expression ability of the model; the batch normalization layer reduces the internal coordinated movement by normalizing each small batch; the pooling layer can reduce the dimension of the feature map; the fully connected layer is used to integrate the features extracted previously, and map the obtained feature map to one dimension to form a one-dimensional feature vector; finally, the feature vector containing the deep feature information of the processed image is sent to the classifier via the output layer.
[0032] In the aforementioned power quality disturbance identification method, S4 specifically includes: initializing parameters, setting optimization objective function and parameter boundaries, using DSA to optimize the four parameters of XGBoost, namely, the number of iterations of XGBoost, the depth of the tree, the minimum sample weight of the leaf nodes, and the learning rate, and updating the four parameters of XGBoost according to the optimal position returned by DSA.
[0033] In the aforementioned power quality disturbance identification method, S4 is specifically: using a heuristic global optimization method, the duck flock algorithm, to optimize the four parameters of XGBoost, namely, the number of iterations, the depth of the tree, the minimum sample weight of the leaf node, and the learning rate; the parameter optimization process of the duck flock algorithm is divided into three stages:
[0034] (1) Population initialization: When the upper limit is L b , the lower limit is U b In the D-dimensional search space, the initial position randomly generated by the duck swarm algorithm is shown in formula (4):
[0035] X i =L b +(U b -Lb )·ο (4)
[0036] In the formula, X i represents the spatial position of the ith duck ((i=1,2,3,...,npop) in the duck flock; npop is the population size; o is a random number matrix between (0,1);
[0037] (2) Exploration stage: When the ducks start to line up due to the increase in food abundance, the individuals will gradually disperse and start to search for food according to formula (5):
[0038]
[0039] Where P is the conversion probability; CF1 and CF2 are the cooperation coefficient and competition coefficient of the duck group in the search phase respectively; is the best duck position of the current history value in the t-th iteration; is the tth iteration, The surrounding duck group searches for food; sign (r-0.5) affects the food search process and can be set to -1 or 1; μ is the control parameter of the global search, and its calculation is shown in formula (6):
[0040] μ=(sin(2·rand)+1)·(1-t / t max ) (6)
[0041] In the formula, rand is a random number between (0,1);
[0042] (3) Development stage: In the process of searching for sufficient food, the position adaptability of each duck is crucial, and its definition is shown in formula (7):
[0043]
[0044] Where KF1 and KF2 are the cooperation and competition coefficients of the duck group in the development stage; and All are duck groups of the tth iteration The positions of nearby ducks, where k≠j;
[0045] In addition, CF1, CF2, KF1, and KF2 must be constants between (0, 2). The calculation refers to formula (8):
[0046]
[0047] In the aforementioned power quality disturbance identification method, S5 is specifically as follows: the XGBoost model effectively constructs and combines multiple low-bias decision trees by learning the characteristic data of the labeled power quality disturbance signal transmitted by CNN to identify different disturbance types; the classification model trained with optimized parameters can receive unknown power quality disturbance signals in the input test set; the XGBoost model automatically classifies according to the trained model; assuming that there is an existing data set D = {(x i ,y i )}, which contains p samples and q features; then its XGBoost classification result is shown in formula (9):
[0048]
[0049] In the formula, is the predicted label of the i-th sample at the k-th boost; K is the total decision tree; x i is the i-th sample of the input; y i is the label of the i-th sample; the value obtained by using the k-th tree to predict the i-th sample is f k (x i );G is the function space composed of classification trees.
[0050] The beneficial effects of the present invention are as follows: compared with the prior art, the present invention uses an improved S-transform (IST) to convert a one-dimensional time disturbance signal into a two-dimensional time-frequency image and add a label; reads image data, resizes and standardizes the image, and stores the reconstructed image data in a cell array; uses a convolutional neural network (CNN) to extract features of the disturbance signal stored in the cell array; in order to make the selection of parameters more reasonable, uses a duck swarm algorithm (DSA) to optimize the depth, learning rate and other parameters of an extreme gradient boosting tree (XGBoost); finally, uses an XGBoost model optimized by DSA to classify power quality disturbance signals, so that the disturbance detection method has high efficiency and explainability.
[0051] The method of the present invention has the following advantages:
[0052] (1) Using the IST algorithm to generate a time-frequency diagram, the intrinsic properties of the original signal can be deeply mined through the means of window function and Fourier transform. This step helps to increase the readability of the signal and facilitates subsequent feature extraction and classification.
[0053] (2) This method resizes and batch normalizes the generated time-frequency graphs, which helps to subsequently construct a convenient and robust dataset.
[0054] (3) Using 2-D CNN to automatically extract features can, on the one hand, avoid the subjectivity of manual feature extraction and avoid the phenomenon of redundant or missing extracted features due to different experiences; on the other hand, by defining a well-defined network framework and using advanced training algorithms and parameters, the model can fully extract useful information from the training data, which facilitates deep mining of the inherent laws of the data in the feature space.
[0055] (4) By setting the objective function and using the optimal parameters found by DSA, the training and prediction performance of XGBoost can be significantly improved, reducing the trial and error cost of manual parameter adjustment.
[0056] (5) The optimized XGBoost model enhances the recognition ability and robustness of the model by constructing and combining multiple low-bias decision trees. It performs well in the recognition and classification of power quality disturbance signals and can more accurately classify unknown power quality disturbance signals. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Attached Figure 1 is a flow chart of the method of the present invention;
[0058] Attached Figure 2 It is the time domain waveform of standard voltage signal and 24 disturbance signals;
[0059] Attached Figure 3 It is the three-dimensional time-frequency diagram of the standard voltage signal and seven single disturbance signals;
[0060] Attached Figure 4 It is the two-dimensional time-frequency diagram of the standard voltage signal and seven single disturbance signals;
[0061] Attached Figure 5 is the sample distribution diagram after pattern recognition;
[0062] Attached Figure 6 It is the confusion matrix of the power quality disturbance classification result of the method of the present invention. DETAILED DESCRIPTION
[0063] The present invention is further described below in conjunction with the accompanying drawings and embodiments, but they are not intended to limit the present invention.
[0064] Embodiments of the present invention: In order to solve the shortcomings of existing power quality disturbance identification methods, such as low recognition accuracy, difficulty in accurately separating disturbance signals, and poor interpretability, the present invention provides a power quality disturbance identification method based on improved S transform and CNN--DSA--XGBoost. The method of the present invention uses the IST algorithm to perform time-frequency analysis on the one-dimensional time signal of the power quality disturbance to obtain the location information and frequency information of the disturbance, so as to more accurately describe the power quality disturbance signal; then, the two-dimensional time-frequency graph is standardized, and a data set is constructed to comprehensively analyze the characteristics of the disturbance signal; CNN is used to realize automatic feature extraction; and finally, the DSA--XGBoost model is used to identify and classify the power quality disturbance signal. The present invention is described in detail below in conjunction with the accompanying drawings and specific implementation examples.
[0065] refer to Figure 1 As shown, the method of the present invention comprises the following steps:
[0066] Step S1: IST maps the one-dimensional time signal to the two-dimensional time-frequency domain to generate a two-dimensional time-frequency image. This makes it easier to understand how the signal changes simultaneously in the time domain and the frequency domain, and ensures that the time resolution and frequency resolution can be adaptively adjusted as the detection frequency changes.
[0067] IST combines the advantages of time-frequency analysis, the principle of locality, and the complex exponential function to gradually transform a one-dimensional time signal into a two-dimensional time-frequency signal with time and frequency information in a continuous manner. This process first introduces a complex exponential function to transform the time domain signal into a spectrum signal, and then localizes it in the frequency domain through a window function on this basis, so that the ideal signal has good time-frequency localization properties. By processing each frequency point, the one-dimensional time domain signal is finally completely transformed into a two-dimensional time-frequency signal, ensuring that the frequency information of the signal can be obtained at any time point.
[0068] IST takes a one-dimensional time domain signal as input and uses a Gaussian window as the window function. It obtains local spectrum information by dividing the original signal into multiple overlapping windows and applying Fourier transform to the signal fragments within each window. As time goes by, the window is moved and the window type is adjusted, all local spectrum results are collected and combined, and finally a complete two-dimensional time-frequency image is generated, showing the changes in the time-frequency characteristics of the signal.
[0069] Assuming that the existing one-dimensional continuous power quality disturbance signal is x(t), the one-dimensional continuous IST expression can be obtained by using the convolution theorem, Fourier transform and its inverse transform, see formula (1):
[0070]
[0071] Where: τ is the time shift factor; t is the time variable; f is the frequency variable. λ1 is the parameter used to adjust the resolution change rate; λ2 is the parameter used to adjust the frequency resolution at a fixed frequency; the selection of the two control parameters λ1 and λ2 refers to formula (2):
[0072]
[0073] Where: f0 is the fundamental frequency; f s is the sampling frequency; The frequency point representing the fundamental frequency.
[0074] In order to facilitate the time-frequency analysis of one-dimensional continuous power quality disturbance signals with the help of computers, x(t) is now discretized by uniform sampling. The discretization expression of IST is shown in formula (3):
[0075]
[0076] Where: N is the sampling length; T s is the sampling time interval; in addition, τ=mT s , t = nT s , Among them, m, n = 0, 1, ..., N-1 are time series; k = 0, 1, ..., N-1 is a frequency series.
[0077] Specifically, IST time-frequency analysis is performed in the following steps:
[0078] Step S11: sampling the continuous signal x(t) to be measured;
[0079] Step S12: Frequency will sequence Frequency shift construction
[0080] Step S13: frequency shift sequence Spectrum vector with window function Perform Hadamard product operation;
[0081] Step S14: Perform inverse Fourier transform on the product sequence of the Hadamard operation in step S13; obtain the frequency The time domain information of the signal;
[0082] Step S15: Eliminate insensitive frequency points, select fundamental and harmonic frequency points and repeat steps S12 to S14 to obtain a two-dimensional time-frequency matrix of the signal.
[0083] The sampling length N is set to 800, the sampling frequency f s=2000Hz; for disturbance signals with obvious low-frequency characteristics, set λ1=0.001, λ2=0.018; for disturbance signals with obvious high-frequency characteristics, set λ1=0.0001, λ2=0.03. Use Matlab to batch generate 7200 sets of sample data sets; a total of 24 types of disturbances, each type of disturbance sample 300 groups. Figure 2 It is the time domain waveform of standard voltage signal and 24 disturbance signals; Figure 3 It is the three-dimensional time-frequency diagram of the standard voltage signal and seven single disturbance signals; Figure 4 It is a two-dimensional time-frequency diagram of the standard voltage signal and 7 single disturbance signals; Table 1 lists 7 single mathematical models of power quality disturbance signals, and the remaining 17 composite disturbance signals are: voltage flicker + harmonics, voltage sag + harmonics, voltage interruption + transient pulse, voltage sag + transient pulse, voltage swell + transient pulse, voltage flicker + transient pulse, voltage flicker + voltage sag, voltage flicker + voltage swell, voltage flicker + voltage interruption, voltage sag + harmonics + voltage flicker, voltage interruption + harmonics + transient oscillation, voltage sag + harmonics + voltage flicker + transient pulse, voltage interruption + harmonics + voltage flicker + transient pulse, voltage flicker + transient oscillation, voltage sag + harmonics + transient oscillation, voltage flicker + harmonics + transient oscillation, voltage interruption + harmonics + voltage flicker + transient pulse, voltage flicker + transient oscillation, voltage sag + harmonics + transient oscillation, voltage flicker + harmonics + transient oscillation, voltage interruption + harmonics + voltage flicker + transient oscillation.
[0084] Table 1 Mathematical models of seven single power quality disturbance signals
[0085]
[0086]
[0087] Step S2: Adjust the image size, store the batch normalized data into a cell array and add labels.
[0088] (1) Load the "Lable.mat" file and extract the label column in the file. Obtain all .jpg format image files from the folder where the image files are stored, extract the digital part from them, and sort the image files according to the numbers;
[0089] (2) Traverse each image file and resize the image to the specified size (64x64);
[0090] (3) The adjusted image is normalized to limit the range of image data to between 0 and 1. This process avoids the occurrence of values that are too large or too small during the calculation process, and also allows the gradient descent algorithm to converge faster;
[0091] (4) Finally, the processed image and the corresponding labels are stored in a Matlab (*.Mat) file, and the image processing is completed.
[0092] Step S3: 2-D CNN for automatic feature extraction. The use of CNN for automatic feature selection is that it can automatically extract hierarchical features from the input data step by step in an end-to-end manner by combining the principle of local receptive field, the idea of weight sharing and the stacking structure.
[0093] First, by setting a small convolution kernel, CNN can effectively capture the local information of the input data and increase the nonlinear expression ability of the network through the activation function. Secondly, in the same convolution layer, all feature maps share the same convolution kernel, ensuring that the same features can be detected globally, which is conducive to improving the generalization ability and computational efficiency of the features. In addition, through stacked convolution layers and pooling layers, CNN can extract effective features step by step and combine more advanced features. Finally, the extracted features can be summarized through the fully connected layer. The benefit of using CNN for automatic feature extraction is that it avoids the subjectivity of feature selection and the drawbacks of relying on professional experience; in addition, the global sharing of convolution kernels makes the model have good spatial invariance, which is conducive to improving the generalization ability of the model.
[0094] The first 70% of the number of samples of each perturbation type is used as a test set, and the remaining 30% is used as a test set. Define a deep learning network structure, which is a hierarchical structure consisting of an input layer, a convolution layer, a batch normalization layer, an activation function layer, a pooling layer, a discard layer, a fully connected layer, and an output layer.
[0095] Among them, the input layer is responsible for processing the received image files. The two-dimensional convolution layer is responsible for scanning the image from the input layer and using convolution to learn specific image features; each convolution kernel can detect a specific feature in the image when performing convolution operations and generate a corresponding feature map. The activation function layer will perform nonlinear mapping on the data in the feature map to increase the nonlinear expression ability of the model so that it can better capture and describe the complex relationships in the data. The batch normalization layer reduces the internal coordinated movement by normalizing each small batch; this layer greatly speeds up the training speed and improves the accuracy and stability of the network. The pooling layer can reduce the dimension of the feature map, reducing the amount of calculation while retaining the main information of important features, and also reducing the risk of overfitting. The fully connected layer is used to integrate the previously extracted features and map the obtained feature map to one dimension to form a one-dimensional feature vector. Finally, the feature vector containing the deep feature information of the processed image is sent to the classifier via the output layer. Through pattern recognition, the sample distribution after feature extraction is as follows Figure 5 shown.
[0096] S4: DSA optimizes XGBoost model parameter selection.
[0097] A heuristic global optimization method, the duck swarm algorithm, is used to optimize the four parameters of XGBoost: the number of iterations, the depth of the tree, the minimum sample weight of the leaf nodes, and the learning rate. The parameter optimization process of the duck swarm algorithm is divided into three stages:
[0098] (1) Population initialization: When the upper limit is L b , the lower limit is U b In the D-dimensional search space, the initial position randomly generated by the duck swarm algorithm is shown in formula (4):
[0099] X i =L b +(U b -L b )·ο (4)
[0100] In the formula, X i represents the spatial position of the i-th duck (i=1,2,3,...,npop) in the duck flock; npop is the population size; o is a random number matrix between (0,1).
[0101] (2) Exploration stage: When the ducks start to line up due to the increase in food abundance, the individuals will gradually disperse and start to search for food according to formula (5):
[0102]
[0103] Where P is the conversion probability; CF1 and CF2 are the cooperation coefficient and competition coefficient of the duck group in the search phase respectively; is the best duck position of the current history value in the t-th iteration; is the tth iteration, The surrounding duck group searches for food; sign (r-0.5) affects the food search process and can be set to -1 or 1; μ is the control parameter of the global search, and its calculation is shown in formula (6):
[0104] μ=(sin(2·rand)+1)·(1-t / t max ) (6)
[0105] In the formula, rand is a random number between (0,1).
[0106] (3) Development stage: In the process of searching for sufficient food, the position adaptability of each duck is crucial, and its definition is shown in formula (7):
[0107]
[0108] Where KF1 and KF2 are the cooperation and competition coefficients of the duck group in the development stage; and All are duck groups of the tth iteration The positions of nearby ducks, where k≠j.
[0109] In addition, CF1, CF2, KF1, and KF2 must be constants between (0, 2). The calculation refers to formula (8):
[0110]
[0111] S5: Use the optimized XGBoost model for training to identify and classify power quality disturbance signals.
[0112] The XGBoost model builds an integrated learning model of multiple negative gradient boosting decision trees by training labeled power quality disturbance signal data. Each decision tree independently learns the power quality disturbance signal, and then determines the final diagnosis result by weighted average. After the unknown disturbance signal is input, the XGBoost model can automatically classify it and realize automatic and efficient judgment of the power grid disturbance signal. At the same time, the regularization strategy and pruning technology introduced by the XGBoost model can effectively prevent the overfitting of the model and improve the generalization ability and prediction effect of the model.
[0113] The XGBoost classifier is constructed using the one-dimensional feature vector and corresponding label output by the training set after CNN processing, as well as the four parameters of the number of iterations, tree depth, minimum sample weight of leaf nodes, and learning rate generated by DSA optimization.
[0114] XGBoost is an algorithm based on gradient boosting trees. Based on the theory of classification and regression, XGBoost can build an overall model with better prediction performance by combining a weak learning model (usually a simple decision tree model) without changing the previous classifier.
[0115] Assume that there is a data set D = {(x i ,y i )}, which contains p samples and q features; then its XGBoost classification result is shown in formula (9):
[0116]
[0117] In the formula, is the predicted label of the i-th sample at the k-th boost; K is the total decision tree; x i is the i-th sample of the input; y i is the label of the i-th sample; the value obtained by using the k-th tree to predict the i-th sample is f k (x i );G is the function space composed of classification trees.
[0118] The trained XGBoost model can identify and classify unknown disturbances. In an embodiment, the test set samples are input into the trained XGBoost model, and the classification results obtained are as follows: Figure 6 As shown, the classification accuracy is as high as 99.375%.
[0119] The method of the present invention introduces an improved S-transform (IST). IST can provide a higher time resolution for disturbances with obvious fundamental amplitude characteristics such as voltage flicker, interruption, and temporary rise, so as to ensure the dynamic amplitude detection accuracy; it can provide a better frequency resolution for disturbances with obvious characteristics at higher frequencies such as harmonics and transient oscillations, so as to ensure the frequency detection accuracy. The algorithm reduces the computational complexity of the S-transform, can accurately detect the amplitude and phase information of the disturbance signal, and is conducive to determining the time and intensity of the disturbance.
[0120] Feature selection is the key to achieve high-precision classification of multiple disturbance types. However, the current feature extraction of disturbance signals relies on experience and statistics, which often causes the original feature set to be redundant or insufficient, making feature extraction cumbersome and time-consuming. To solve this problem, this method introduces a two-dimensional convolutional neural network (2-D CNN) to automatically extract features from batch-normalized time-frequency data. Its local connection and weight sharing strategies reduce computational complexity and improve training efficiency; translation invariance enables it to effectively detect features at any position in the image; in addition, by stacking different levels to automatically learn and extract features of different complexities, the processing and classification of complex samples can be optimized. CNN is suitable for analyzing large-scale images and videos.
[0121] Although deep learning is favored by many scholars in various classification tasks, its lack of interpretability limits its application in life and production. To effectively circumvent this problem, the academic community is more willing to use algorithms with strong interpretability to handle classification tasks. The XGBoost model introduced in this method has attracted widespread attention for its high accuracy, high robustness, built-in feature selection, and anti-overfitting capabilities.
Claims
1. A method for identifying power quality disturbances, characterized in that: The specific implementation includes the following steps: S1: Use IST to map the one-dimensional time signal to the two-dimensional time-frequency domain to generate a two-dimensional time-frequency image; S2: resize the 2D time-frequency image, store the batch normalized data into a cell array and add labels; S3: Use CNN to automatically extract features from the constructed dataset; S4: DSA optimizes XGBoost model parameter selection; S5: After training using the optimized XGBoost model, the power quality disturbance signal is identified and classified to obtain the power quality disturbance classification result.
2. A method for identifying power quality disturbances according to claim 1, characterized in that: Specifically, S1 is as follows: IST takes a one-dimensional time domain signal as input and uses a Gaussian window as a window function. It obtains local spectrum information by dividing the original signal into multiple overlapping windows and applying Fourier transform to the signal segments in each window. As time goes by, the window is moved and the window type is adjusted. All local spectrum results are collected and combined to finally generate a complete two-dimensional time-frequency image, showing the changes in the time-frequency characteristics of the signal.
3. A method for identifying power quality disturbances according to claim 2, characterized in that: The S1 is specifically: Assuming that the existing one-dimensional continuous power quality disturbance signal is x(t), the one-dimensional continuous IST expression can be obtained by using the convolution theorem, Fourier transform and its inverse transform, see formula (1): Where: τ is the time shift factor; t is the time variable; f is the frequency variable. λ1 is the parameter used to adjust the resolution change rate; λ2 is the parameter used to adjust the frequency resolution at a fixed frequency; the selection of the two control parameters λ1 and λ2 refers to formula (2): Where: f0 is the fundamental frequency; f s is the sampling frequency; The frequency point representing the fundamental frequency; Now x(t) is discretized by uniform sampling, and the discretization expression of IST is shown in formula (3): Where: N is the sampling length; T s is the sampling time interval; in addition, τ=mT s , t = nT s , Among them, m, n = 0, 1, ..., N-1 are time series; k = 0, 1, ..., N-1 is a frequency series; Specifically, IST time-frequency analysis is performed in the following steps: Step S11: sampling the continuous signal x(t) to be measured; Step S12: Frequency will sequence Frequency shift construction Step S13: frequency shift sequence Spectrum vector with window function Perform Hadamard product operation; Step S14: Perform inverse Fourier transform on the product sequence of the Hadamard operation in step S13; obtain the frequency The time domain information of the signal; Step S15: Eliminate insensitive frequency points, select fundamental and harmonic frequency points and repeat steps S12 to S14 to obtain a two-dimensional time-frequency matrix of the signal.
4. The method for identifying power quality disturbance according to claim 1, characterized in that: The S2 is specifically as follows: looping through the sorted image files and reading image data; adjusting the image size to 64×64, normalizing the image and matching labels at the same time; and storing the batch normalized data information into a Matlab (*.Mat) file.
5. The method for identifying power quality disturbance according to claim 1, characterized in that: The S3 specifically includes: preparing training sets and test sets; defining CNN architecture; Set the training algorithm to adam, set the maximum number of training rounds, and set the learning rate and L2 regularization training parameters; use the preset training data and corresponding labels to train the neural network, and use the trained neural network for automatic feature extraction.
6. A method for identifying power quality disturbances according to claim 5, characterized in that: Specifically, S3 includes: taking the first 70% of the number of samples of each disturbance type as a test set, and the remaining 30% as a test set; defining a deep learning network structure, which is a hierarchical structure consisting of an input layer, a convolution layer, a batch normalization layer, an activation function layer, a pooling layer, a dropout layer, a fully connected layer, and an output layer; Among them, the input layer is responsible for processing the received image files; the two-dimensional convolution layer is responsible for scanning the image from the input layer and using convolution to learn specific image features; each convolution kernel can detect a specific feature in the image when performing convolution operations and generate a corresponding feature map; the activation function layer will perform nonlinear mapping on the data in the feature map to increase the nonlinear expression ability of the model; the batch normalization layer reduces the internal coordinated movement by normalizing each small batch; the pooling layer can reduce the dimension of the feature map; the fully connected layer is used to integrate the features extracted previously, and map the obtained feature map to one dimension to form a one-dimensional feature vector; finally, the feature vector containing the deep feature information of the processed image is sent to the classifier via the output layer.
7. A method for identifying power quality disturbances according to claim 1, characterized in that: The S4 is specifically as follows: initializing parameters, setting optimization objective function and parameter boundaries, using DSA to optimize four parameters of XGBoost, namely, number of iterations, tree depth, minimum sample weight of leaf nodes, and learning rate, and updating the four parameters of XGBoost according to the optimal position returned by DSA.
8. A method for identifying power quality disturbances according to claim 7, characterized in that: S4 is specifically: using a heuristic global optimization method, the duck swarm algorithm, to optimize four parameters of XGBoost, namely, the number of iterations, the depth of the tree, the minimum sample weight of the leaf nodes, and the learning rate; the parameter optimization process of the duck swarm algorithm is divided into three stages: (1) Population initialization: When the upper limit is L b , the lower limit is U b In the D-dimensional search space, the initial position randomly generated by the duck swarm algorithm is shown in formula (4): X i =L b +(U b -L b )·ο (4) In the formula, X i represents the spatial position of the ith duck ((i=1,2,3,...,npop) in the duck flock; npop is the population size; o is a random number matrix between (0,1); (2) Exploration stage: When the ducks start to line up due to the increase in food abundance, the individuals will gradually disperse and start to search for food according to formula (5): Where P is the conversion probability; CF1 and CF2 are the cooperation coefficient and competition coefficient of the duck group in the search phase respectively; is the best duck position of the current history value in the t-th iteration; is the tth iteration, The surrounding duck group searches for food; sign (r-0.5) affects the food search process and can be set to -1 or 1; μ is the control parameter of the global search, and its calculation is shown in formula (6): μ=(sin(2·rand)+1)·(1-t / t max ) (6) In the formula, rand is a random number between (0,1); (3) Development stage: In the process of searching for sufficient food, the position adaptability of each duck is crucial, and its definition is shown in formula (7): Where KF1 and KF2 are the cooperation and competition coefficients of the duck group in the development stage; and All are duck groups of the tth iteration The positions of nearby ducks, where k≠j; In addition, CF1, CF2, KF1, and KF2 must be constants between (0, 2). The calculation refers to formula (8):
9. The method for identifying power quality disturbance according to claim 1, characterized in that: Specifically, S5 is as follows: the XGBoost model learns the characteristic data of the labeled power quality disturbance signal transmitted by the CNN, effectively constructs and combines multiple low-bias decision trees, and identifies different disturbance types; The classification model trained with optimized parameters can receive unknown power quality disturbance signals in the input test set; the XGBoost model automatically classifies according to the trained model; Assume that there is a data set D = {(x i ,y i )}, which contains p samples and q features; then its XGBoost classification result is shown in formula (9): In the formula, is the predicted label of the i-th sample at the k-th boost; K is the total decision tree; x i is the i-th sample of the input; y i is the label of the i-th sample; the value obtained by using the k-th tree to predict the i-th sample is f k (x i );G is the function space composed of classification trees.
Citation Information
Patent Citations
Parameter optimization based time frequency analysis method for improved generalized S-transform
CN105373708A
Cited By
Power quality disturbance detection method based on improved adaptive S transformation
CN120044330A
