Automatic diagnosis method of short-circuit fault of power measuring instrument based on CNN
Through automatic diagnosis methods based on CNN and LSTM, combined with wavelet packet decomposition and attention mechanism, the accuracy and efficiency of short-circuit fault diagnosis of power measurement instruments in the prior art are solved, and high accuracy and real-time fault diagnosis are achieved.
Patent Information
- Application Number
- CN202510121189.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-01-26
AI Technical Summary
The prior art relies on qualitative analysis in fault diagnosis, lacks accuracy, and has problems such as time-consuming, high cost and error-prone, making it difficult to realize automated diagnosis of short-circuit faults of power measuring instruments.
Automatic diagnostic methods based on CNN and LSTM are adopted to extract the characteristics of the operating data through wavelet packet decomposition technology, and optimize model parameters are optimized by attention mechanism and optimization algorithms (such as Sparrow Search and Adam), so as to achieve accurate identification of short-circuit faults of power measurement instruments.
It realizes accurate diagnosis of short-circuit faults of power measuring instruments, reduces misjudgment and misjudgment, improves diagnosis speed and accuracy, meets real-time monitoring needs, and reduces dependence on professional and technical personnel.
Smart Images

Figure CN119577586B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of fault diagnosis, and in particular to a method for automatically diagnosing short-circuit faults of power measuring instruments based on CNN. Background Art
[0002] As a key front-end acquisition component of the digital power grid, power measurement instruments are responsible for providing the data required for tasks such as power parameter measurement, power quality monitoring, and electrical equipment control. However, due to factors such as the surrounding magnetic field environment and equipment aging, these instruments often suffer from short-circuit failures, resulting in abnormal power data, which in turn affects the power sector's grid allocation decisions. Existing fault diagnosis methods mainly rely on qualitative analysis and lack accuracy. Traditional methods also rely on manual detection and qualitative analysis, which are time-consuming, costly, and error-prone. Therefore, it is particularly important to develop new methods for automatically diagnosing power measurement instrument faults.
[0003] The Chinese invention application with publication number CN115718266A provides a battery short circuit fault diagnosis method and device, including obtaining the voltage and current of all battery cells in the battery pack at the current moment; selecting the battery cells with the maximum voltage and the minimum voltage as the first and second battery cells, respectively calculating the SOC of the first and second battery cells; calculating the current short circuit current and the current short circuit resistance according to the voltage and current; comparing the current short circuit current with the preset short circuit current threshold, if the current short circuit current is greater than or equal to the preset short circuit current threshold, then taking the current short circuit resistance as the short circuit resistance of the battery pack; if the current short circuit current is less than the preset short circuit current threshold and the time difference between the current moment and the start moment reaches the preset time threshold, using the SOC difference between the first and second battery cells to calculate the short circuit resistance of the battery pack; determining the fault type of the battery pack according to the magnitude of the short circuit resistance. However, the document uses the Pearson correlation coefficient as the feature quantity, which can amplify the small fluctuations of the voltage signal, but only extracts features from the voltage perspective, and does not fully consider other information that may be related to the fault.
[0004] In addition, the Chinese invention application with publication number CN118091463A discloses a method for diagnosing micro-short circuit faults of lithium battery packs, including extracting the Pearson correlation coefficient between the voltages of each single cell from the original data of the battery pack voltage as a characteristic quantity for fault diagnosis; using the KPCA algorithm to analyze the extracted characteristic quantity to obtain the square prediction error statistic and the control threshold; obtaining the square prediction error statistic during the actual operation of the battery pack and comparing it with the control threshold to determine whether the battery pack has a short circuit fault; if there is a fault, then calculating the contribution rate of each Pearson correlation coefficient to the SPE statistic to locate the fault of the battery pack. However, this document performs fault diagnosis based on specific battery models and parameters. When the characteristics of the battery change or are applied to different types of batteries, it may be necessary to readjust the model parameters or establish a new model. Based on this, a new technical solution is needed. Summary of the invention
[0005] In view of this, an embodiment of the present specification provides a method for automatically diagnosing short-circuit faults of a power measuring instrument based on CNN.
[0006] The embodiments of this specification provide the following technical solutions:
[0007] Step S1, preset a collection cycle and a collection duration, collect the operation data of the power measuring instrument in real time, the operation data includes the current value and the voltage value of the sampling point of each line in the power measuring instrument, collect the operation data of multiple sampling points in one collection cycle to form a group of operation data, and pre-process the operation data;
[0008] Step S2, determining the optimal number of decomposition layers based on information entropy, and dynamically selecting the optimal wavelet basis function according to the signal characteristics, decomposing the preprocessed operating data using the wavelet packet decomposition technology based on the optimal number of decomposition layers and the optimal wavelet basis function to obtain a series of sub-generation coefficients, wherein the sub-generation coefficients represent the energy distribution of the data in different frequency bands and time scales, calculating and comparing the energy and variance of each sub-generation coefficient, and selecting the sub-generation coefficient containing the fault feature information;
[0009] Step S3, constructing a feature vector using the selected offspring coefficient as a feature, the feature vector contains important information of the operating data at different frequency bands and time scales, dividing the feature vector into multiple data segments according to a preset time series window, each data segment as a sub-feature vector, and converting each sub-feature vector into a two-dimensional matrix, wherein the rows of the two-dimensional matrix represent different time points in the time series window, and the columns represent different frequency band coefficients;
[0010] Step S4, normalize the converted two-dimensional matrix, divide the multiple two-dimensional matrices into a training set and a test set, build an automatic diagnosis model based on the training set in combination with CNN and LSTM, introduce an attention mechanism in the process of building the automatic diagnosis model, and use the sparrow search algorithm and Adam optimization algorithm to optimize the model parameters of the automatic diagnosis model, evaluate the performance of the automatic diagnosis model through the test set, and analyze the diagnosis results of the automatic diagnosis model.
[0011] Preferably, determining the optimal number of decomposition layers based on information entropy includes the following steps:
[0012] Preset the maximum number of decomposition layers, perform a wavelet packet decomposition on the original running data, obtain the approximate coefficients and detail coefficients after the first decomposition, perform the next layer decomposition on the approximate coefficients and detail coefficients, repeat this step until the preset maximum number of decomposition layers is reached, and record the approximate coefficients and detail coefficients of all sub-bands for each layer of decomposition;
[0013] For each sub-frequency band obtained by decomposition of each layer, the corresponding information entropy value is calculated, and the information entropy values of all sub-frequency bands are added to obtain the total information entropy value of the corresponding decomposition layer. With the number of decomposition layers as the horizontal axis and the total information entropy value as the vertical axis, a curve of the total information entropy value changing with the number of decomposition layers is plotted, and the optimal number of decomposition layers is determined based on the change curve.
[0014] Preferably, determining the optimal number of decomposition layers based on the change curve comprises the following steps:
[0015] For each layer of decomposition, the change rate of the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve, and the first threshold is set based on the historical experimental results. When the change rate is less than the first threshold, the current decomposition layer number is used as the backup decomposition layer number;
[0016] For each layer of decomposition, the total information entropy difference between the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve, and the difference change rate between the total information entropy difference of the current layer and the total information entropy difference of the previous layer is also calculated, and a second threshold is set based on historical experimental results. When the difference change rate is greater than the second threshold, the current number of decomposition layers is used as the backup number of decomposition layers;
[0017] For each layer of decomposition, the total information entropy difference between the total information entropy and the total information entropy of the previous layer is recorded, and for multiple total information entropy differences, the number of decomposition layers corresponding to the minimum total information entropy difference is obtained as the number of standby decomposition layers;
[0018] The majority of the three standby decomposition level numbers is obtained, and the majority is used as the optimal decomposition level number.
[0019] Preferably, dynamically selecting the optimal wavelet basis function according to the signal characteristics comprises the following steps:
[0020] Signal characteristics refer to the characteristics of a set of collected operating data. A set of operating data is also called a signal. The characteristics of the signal are extracted, and the time domain characteristics, frequency domain characteristics and other related characteristics of the signal are analyzed. Signals with different characteristics are classified, and multiple different candidate wavelet basis functions are selected for different types of signals to perform wavelet packet decomposition. The corresponding evaluation index is calculated for the decomposed signal, and different weight coefficients are set for different evaluation indexes. Based on the evaluation index and the corresponding weight coefficient, the respective comprehensive evaluation values of the candidate wavelet basis functions are calculated, and the wavelet basis function with the highest comprehensive evaluation value is used as the optimal wavelet basis function of the corresponding type.
[0021] Preferably, calculating the corresponding evaluation index for the decomposed signal includes the following steps:
[0022] Calculate the decomposition error between the original signal and the decomposed signal, calculate the ratio between the original signal energy and the decomposed signal energy, calculate the information entropy value of the decomposed signal, calculate the time domain resolution and frequency domain resolution of the wavelet basis function used, and also calculate the computational amount of the wavelet basis function decomposition process.
[0023] Preferably, an automatic diagnosis model is constructed based on the training set in combination with CNN and LSTM, comprising the following steps:
[0024] Divide the plurality of two-dimensional matrices into a training set and a test set, input the training set into a CNN model, use a plurality of convolution kernels of different sizes in a convolution layer to scan the input two-dimensional matrix, perform an inner product operation to extract local features, use stride and padding to control the size of an output feature map, use ReLU as an activation function to introduce nonlinear factors, select an optimal pooling kernel and stride in a pooling layer to downsample the feature map output by the convolution layer and extract main features, repeatedly stack multiple convolution layers and pooling layers to extract a high-level feature map;
[0025] The two-dimensional feature map extracted by the CNN model is converted into a one-dimensional feature vector and input into the LSTM layer for processing. The number of LSTM units is set to determine the memory capacity of the model. The feature vector is processed using the tanh activation function and the sigmoid activation function. The bidirectional LSTM is used to capture past and future information at the same time. The Dropout layer is added after the LSTM to randomly discard some neural units to prevent the model from overfitting. The feature vector output by the LSTM layer is connected to the output layer using a fully connected layer. The number of neurons in the output layer is set to be equal to the number of fault types. The output result is converted into a probability distribution using the Softmax activation function.
[0026] Preferably, an attention mechanism is introduced in the process of building an automatic diagnosis model, including the following steps:
[0027] Perform global average pooling and global maximum pooling on the feature maps extracted from multiple convolutional layers of the CNN model to obtain the global average features and global maximum features of the channel dimension, concatenate the global evaluation features and the global maximum features to obtain the fused features, input the fused features into two fully connected layers, generate channel attention weights, and multiply the generated attention weights with the feature maps to obtain the weighted feature maps;
[0028] The temporal attention mechanism is introduced into LSTM to calculate the similarity between the hidden state and the context vector at each time step to obtain the attention score. The attention score is normalized by softmax to obtain the attention weight. The attention weight is multiplied by the hidden state, and the weighted sum is taken for all time steps to obtain the context vector. The context vector is combined with the hidden state of the current time step to obtain the final output.
[0029] Preferably, the model parameters of the automatic diagnosis model are optimized using the sparrow search algorithm and the Adam algorithm, including the following steps:
[0030] Step S41, initializing the sparrow search algorithm parameters, Adam algorithm parameters and switching conditions, randomly initializing the population position, each position corresponds to a set of model parameters, initializing the fitness value of each sparrow, initializing the parameter vector, first-order moment estimation and second-order moment estimation;
[0031] Step S42, update the position of each sparrow according to the position update formula of the sparrow search algorithm, calculate the fitness value of each sparrow after the update, update the global optimal solution, and determine whether the termination condition is met. If so, end this step, and determine whether to switch to the Adam algorithm according to the first switching condition. If so, proceed to step S43, if not, repeat this step;
[0032] Step S43, calculate the gradient of the parameter vector, update the first-order moment estimate and the second-order moment estimate, calculate the corrected first-order moment estimate and the second-order moment estimate, update the parameter vector, and determine whether the termination condition is met. If so, end this step, and determine whether to switch back to the sparrow search algorithm based on the second switching condition. If so, return to step S42, if not, repeat this step.
[0033] Preferably, the termination condition refers to that the number of iterations of the sparrow search algorithm and Adam alternating is greater than a preset maximum number of iterations.
[0034] Compared with the prior art, the beneficial effects that can be achieved by at least one of the above technical solutions adopted in the embodiments of this specification include at least:
[0035] The present invention utilizes wavelet packet decomposition to deeply mine data features, then learns fault modes through CNN and LSTM models, introduces an attention mechanism to focus on key information, thereby accurately identifying faults and reducing misjudgments and missed judgments; optimizes the deep learning model structure and combines the sparrow search algorithm with the Adam algorithm to efficiently optimize parameters, speeds up model training and diagnosis, and meets real-time monitoring needs; based on a large amount of data training, the model can automatically adapt to different equipment and working conditions without frequent parameter adjustment, and optimizes the selection of wavelet basis functions based on multiple evaluation indicators, thereby enhancing the robustness of the model to data changes; realizes automated diagnosis processes, reduces dependence on professional and technical personnel, and timely and accurate fault diagnosis ensures stable operation of the power system, reduces the risk of production interruption, and improves production efficiency and economic benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 It is a flowchart of the steps of the CNN-based automatic diagnosis method for short-circuit fault of a power measuring instrument in an embodiment of the present application;
[0038] Figure 2 It is a total information entropy change diagram drawn based on the calculation result table in the embodiment of the present application. DETAILED DESCRIPTION
[0039] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0040] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0041] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present application, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspect described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0042] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. The drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0043] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the examples can be practiced without these specific details.
[0044] For ease of understanding, the following describes the automatic diagnosis method for short-circuit fault of a power measuring instrument based on CNN in an embodiment of the present application. Figure 1 In the embodiment of the present application, a CNN-based automatic diagnosis method for short-circuit fault of a power measuring instrument is implemented by the following steps:
[0045] Step S1, preset a collection cycle and collection duration, collect the operating data of the power measuring instrument in real time, the operating data includes the current value and voltage value of the sampling point of each line in the power measuring instrument, collect the operating data of multiple sampling points in one collection cycle to form a group of operating data, and pre-process the operating data.
[0046] Specifically, in the power system, the real-time operation data provided by the power measuring instrument is crucial. The collected data mainly includes the current and voltage of the power measuring instrument. These data are sampled through digital signals. For example, the real-time operation data can include the voltage value u(n) and the current value i(n) of each line, where n represents the sampling point. In a sampling cycle, there will be multiple such sampling points to form a set of data for subsequent analysis and processing. After that, the collected real-time operation data is pre-processed, such as removing noise and normalization, to ensure the quality and consistency of the data. Normalization is to scale the data to a specific range (usually 0 to 1) for better subsequent processing.
[0047] Step S2, determine the optimal number of decomposition layers based on information entropy, and dynamically select the optimal wavelet basis function according to the signal characteristics. Based on the optimal number of decomposition layers and the optimal wavelet basis function, use the wavelet packet decomposition technology to decompose the preprocessed operating data to obtain a series of sub-generation coefficients. The sub-generation coefficients represent the energy distribution of the data in different frequency bands and time scales. Calculate and compare the energy and variance of each sub-generation coefficient, and select the sub-generation coefficient containing fault feature information.
[0048] Specifically, in order to improve the performance of feature extraction and the accuracy of fault diagnosis, wavelet packet separation technology is used to extract features from the preprocessed operating data. In order to improve the accuracy of feature extraction and avoid over-decomposition or under-decomposition, the information entropy under different decomposition levels is calculated, and the level with a stable information entropy value change region is selected as the optimal decomposition level. Since different wavelet basis functions have different time-frequency characteristics, selecting a suitable wavelet basis function can more effectively extract feature data. Therefore, the optimal wavelet basis function is dynamically selected according to the characteristics of the operating data, such as using a genetic algorithm or a particle swarm optimization algorithm to improve the accuracy and robustness of feature extraction. Finally, based on the optimal decomposition level and the optimal wavelet basis function, feature extraction is performed on the preprocessed operating data.
[0049] Step S3, using the selected offspring coefficient as a feature to construct a feature vector, the feature vector contains important information of the operating data in different frequency bands and time scales, and divides the feature vector into multiple data segments according to a preset time series window, each data segment is used as a sub-feature vector, and each sub-feature vector is converted into a two-dimensional matrix, the rows of the two-dimensional matrix represent different time points in the time series window, and the columns represent different frequency band coefficients.
[0050] Specifically, wavelet packet decomposition is a method for localized analysis of signals at different frequencies and times. In each decomposition process, the signal is divided into two sub-bands, high frequency and low frequency. This process can be recursively applied to each sub-band. After wavelet packet decomposition, a series of sub-generation coefficients will be obtained. These coefficients represent the energy distribution of the signal at different frequency bands and time scales. By analyzing the energy distribution of these sub-generation coefficients, the sub-generation coefficients containing fault feature information are selected, which usually involves calculating and comparing the energy, variance or other statistics of each sub-generation coefficient. The selected sub-generation coefficients are used as features to construct feature vectors. This feature vector contains the signal at different frequency bands and time scales. In order to convert the one-dimensional feature vector into a two-dimensional matrix to adapt to the input of the deep learning model, the feature vector needs to be reshaped. Usually, this involves dividing the feature vector into multiple small segments according to a certain time series window (for example, using a sliding window method), each segment as a feature vector, and then converting each feature vector into a two-dimensional matrix, where the rows of the matrix represent different time points within the time series window, and the columns represent different frequency band coefficients. Through the above steps, the original one-dimensional signal is converted into a two-dimensional matrix form suitable for processing by the deep learning model, so that the subsequent diagnostic model can automatically learn and identify the characteristics of the short-circuit fault from the signal.
[0051] Step S4, normalize the converted two-dimensional matrix, divide the multiple two-dimensional matrices into training sets and test sets, build an automatic diagnosis model based on the training set combined with CNN and LSTM, use the sparrow search algorithm to optimize the model parameters of the automatic diagnosis model, evaluate the performance of the automatic diagnosis model through the test set, and analyze the diagnosis results of the automatic diagnosis model.
[0052] Specifically, the converted two-dimensional matrix is normalized so that the data has a uniform scale, which helps to improve the efficiency and performance of model training. CNN and LSTM are combined to build an automatic diagnosis model. CNN is used for fault identification, and LSTM is used to process time series data. The sparrow search algorithm is used to optimize the model parameters to improve the diagnostic accuracy and generation ability of the model. The diagnostic results of the model are analyzed and compared with the actual values to verify the effectiveness of feature extraction and the accuracy of the model. The model is applied to the actual short-circuit fault diagnosis of power measuring instruments to improve the accuracy and productivity of fault detection.
[0053] Through the above steps, short-circuit faults in power measuring instruments can be automatically diagnosed, reducing the time and cost of manual detection and qualitative analysis, while improving the accuracy of fault detection and the operational safety of the power system.
[0054] Furthermore, determining the optimal number of decomposition layers based on information entropy includes the following steps:
[0055] The maximum number of decomposition layers is preset, and the original running data is decomposed by wavelet packets once, and the approximate coefficients and detail coefficients after the first decomposition are obtained, and the approximate coefficients and detail coefficients are decomposed to the next layer, and this step is repeated until the preset maximum number of decomposition layers is reached, and the approximate coefficients and detail coefficients of all sub-bands are recorded for each layer of decomposition;
[0056] For each sub-band obtained from each layer of decomposition, the corresponding information entropy value is calculated, and the information entropy values of all sub-bands are added together to obtain the total information entropy value of the corresponding decomposition layer. With the number of decomposition layers as the horizontal axis and the total information entropy value as the vertical axis, a curve of the total information entropy value changing with the number of decomposition layers is plotted, and the optimal number of decomposition layers is determined based on the change curve.
[0057] Specifically, information entropy is an indicator to measure signal uncertainty. In wavelet packet decomposition, the changing trend of information entropy can be used to determine the optimal number of decomposition layers. The maximum number of decomposition layers is preset (for example, the maximum number of decomposition layers is 5), and the original operating data is decomposed by wavelet packet once to obtain the approximate coefficients and detail coefficients after the first decomposition. The approximate coefficients and detail coefficients are decomposed into the next layer, and this step is repeated until the preset maximum number of decomposition layers is reached. The approximate coefficients and detail coefficients of all sub-bands are recorded for each layer of decomposition. For each sub-band obtained by each layer of decomposition, the corresponding information entropy value is calculated. Commonly used information entropy types include Shannon entropy, logarithmic energy entropy, and threshold entropy. The appropriate information entropy type can be selected according to signal characteristics and application requirements. The information entropy values of all sub-bands are added to obtain the total information entropy value of the corresponding decomposition layer. With the number of decomposition layers as the horizontal axis and the total information entropy value as the vertical axis, a curve of the total information entropy value changing with the number of decomposition layers is plotted, and the optimal number of decomposition layers is determined based on the change curve. The specific method for determining the optimal number of decomposition layers based on the change curve will be explained in detail later.
[0058] Further, determining the optimal number of decomposition layers based on the change curve includes the following steps:
[0059] For each layer of decomposition, the change rate of the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve, and the first threshold is set based on historical experimental results. When the change rate is less than the first threshold, the current decomposition layer number is used as the backup decomposition layer number.
[0060] For each layer of decomposition, the total information entropy difference between the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve, and the difference change rate of the total information entropy difference of the current layer and the total information entropy difference of the previous layer is also calculated. The second threshold is set based on historical experimental results. When the difference change rate is greater than the second threshold, the current decomposition layer number is used as the backup decomposition layer number.
[0061] For each layer of decomposition, record the total information entropy difference between the total information entropy and the total information entropy of the previous layer. For multiple total information entropy differences, obtain the decomposition layer number corresponding to the minimum total information entropy difference as the standby decomposition layer number;
[0062] Obtain the majority of the three alternative decomposition levels and take the majority as the optimal decomposition level.
[0063] Specifically, because the first few layers of decomposition can effectively remove redundant information in the signal, and the subsequent decomposition has little effect on the information entropy, as the number of decomposition layers increases, the information entropy value usually decreases rapidly first, and then tends to stabilize or decreases slowly. Table 1 shows the calculation results of the total information entropy of each layer after wavelet packet decomposition. Figure 2 This is a total information entropy change graph based on the calculation result table. It can be seen from the figure that the information entropy value tends to be stable when the decomposition number reaches 4. In order to calculate a more accurate and optimal number of decomposition levels, for each layer of decomposition, the change rate of the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve. The first threshold (for example, 5%) is set based on historical experimental results. When the change rate is less than the first threshold, the current number of decomposition levels is used as the backup number of decomposition levels.
[0064] Table 1 Calculation results of total information entropy of each layer after wavelet packet decomposition
[0065]
[0066] As the number of decomposition layers increases, the changing trend of the total information entropy tends to be flat. By analyzing the changing trend of the total information entropy, the number of decomposition layers at which the total information entropy tends to be stable can be determined. For each layer of decomposition, the total information entropy difference between the total information entropy value and the total information entropy value of the previous layer is calculated. The difference change rate between the total information entropy difference of the current layer and the total information entropy difference of the previous layer is also calculated. The second threshold is set based on historical experimental results. When the difference change rate is greater than the second threshold (assuming it is 0.8), the current number of decomposition layers is used as the backup number of decomposition layers.
[0067] For each layer of decomposition, record the total information entropy difference between the total information entropy and the total information entropy of the previous layer. For multiple total information entropy differences, obtain the decomposition layer number corresponding to the minimum total information entropy difference as the backup decomposition layer number, obtain the mode of the three backup decomposition layer numbers, and take the mode as the optimal decomposition layer number. Since the backup decomposition layer numbers obtained by the above three methods have their own advantages and disadvantages, the three methods are comprehensively judged by considering multiple factors to improve the accuracy of the judgment results and reduce the errors caused by a single method.
[0068] Furthermore, the optimal wavelet basis function is dynamically selected according to the signal characteristics, including the following steps:
[0069] Signal characteristics refer to the characteristics of a set of collected operating data. A set of operating data is also called a signal. The characteristics of the signal are extracted, and the time domain characteristics, frequency domain characteristics and other related characteristics of the signal are analyzed. Signals with different characteristics are classified, and multiple different candidate wavelet basis functions are selected for different types of signals to perform wavelet packet decomposition. The corresponding evaluation index is calculated for the decomposed signal, and different weight coefficients are set for different evaluation indexes. Based on the evaluation index and the corresponding weight coefficient, the respective comprehensive evaluation values of the candidate wavelet basis functions are calculated, and the wavelet basis function with the highest comprehensive evaluation value is used as the optimal wavelet basis function of the corresponding type.
[0070] Specifically, wavelet basis function is the core of wavelet transform and wavelet packet decomposition, and its selection has a crucial impact on the signal processing results. Different wavelet basis functions have different time-frequency characteristics and are suitable for different signal types and application scenarios. In order to select the optimal wavelet basis function, the optimal wavelet basis function is dynamically selected based on the signal characteristics, and the time domain characteristics of the signal are analyzed, including analyzing whether the signal is periodic and the length of the period, judging whether the signal is a stationary signal, that is, whether its statistical characteristics change with time, detecting whether there are transient changes, mutations or shocks in the signal, calculating the autocorrelation function of the signal, analyzing its self-similarity, and analyzing the frequency domain characteristics of the signal, including Fourier transform of the signal, analyzing its frequency components and spectral distribution, determining the main frequency components of the signal and its energy distribution, analyzing the bandwidth of the signal, and the ratio of high-frequency and low-frequency components. Other characteristics of the signal are also analyzed, such as analyzing the type of noise and noise in the signal. Sound level, whether there are nonlinear features in the detection signal, etc., classify signals with different characteristics, establish a signal feature library, for example, divide the signals into stationary signals, non-stationary signals, transient signals, etc., and record the typical characteristics of each type of signal, select multiple different candidate wavelet basis functions for the same type of signal for wavelet packet decomposition, different wavelet basis functions include db4, sym4 and coif3, in order to be able to select the optimal wavelet basis function according to the signal characteristics, define some evaluation indicators to measure the processing effects of different candidate wavelet basis functions on the signal, calculate the corresponding evaluation indicators for the decomposed signal, and the specific method for calculating the comprehensive evaluation value will be explained in detail later, and the corresponding weight coefficients are set for different evaluation indicators based on historical experimental data, and the corresponding comprehensive evaluation values are calculated for the candidate wavelet basis functions based on the evaluation indicators and the corresponding weight coefficients, and the wavelet basis function with the highest comprehensive evaluation value is used as the optimal wavelet basis function of the corresponding type.
[0071] Furthermore, the corresponding evaluation index is calculated for the decomposed signal, including the following steps:
[0072] Calculate the decomposition error between the original signal and the decomposed signal, calculate the ratio between the original signal energy and the decomposed signal energy, calculate the information entropy value of the decomposed signal, calculate the time domain resolution and frequency domain resolution of the wavelet basis function used, and also calculate the computational amount of the wavelet basis function decomposition process.
[0073] Specifically, in order to select the optimal wavelet basis function according to the signal characteristics, it is necessary to define some evaluation indicators to measure the processing effect of the wavelet basis function on the signal and calculate the decomposition error E between the original signal and the decomposed signal. r The specific calculation formula is: , where x is the original signal, is the signal after decomposing the original signal. is the norm of the vector. The decomposition error can reflect the ability of the wavelet basis function to decompose the signal. The smaller the decomposition error, the more suitable the wavelet basis function is. The following formula is used Calculate the ratio E between the original signal power and the decomposed signal energy e The ratio can reflect the degree of retention of signal energy by the wavelet basis function. The higher the energy retention rate, the more suitable the wavelet basis function is. The information entropy value Es of the decomposed signal is also calculated. Common entropy types include Shannon entropy, logarithmic energy entropy and threshold entropy. The smaller the information entropy value of the decomposed signal is, the more concentrated the information of the signal after decomposition by the wavelet basis function is, and the more conducive to feature extraction is the time domain resolution E. t It can reflect the ability of wavelet basis function to capture transient changes of signals, and the frequency domain resolution E f It can reflect the ability of the wavelet basis function to distinguish the frequency components of the signal, and also calculate the computational cost E of the decomposition process using the wavelet basis function. c The lower the amount of calculation, the more suitable the wavelet basis function is. For different evaluation indicators, corresponding weight coefficients are set based on historical experimental data. For example, w1, w2, w3, w4, w5 and w6 are used to calculate the comprehensive evaluation value based on each evaluation indicator. The comprehensive evaluation value E=w1*(1 / E r )+w2*E e +w3*(1 / E s )+w4*E t +w5*E f +w6*(1 / E c ), where the smaller the decomposition error, entropy value and calculation amount are, the higher the corresponding evaluation index is. Therefore, the corresponding reciprocal is multiplied when calculating the comprehensive evaluation value.
[0074] Furthermore, an automatic diagnosis model is constructed based on the training set combined with CNN and LSTM, including the following steps:
[0075] Multiple two-dimensional matrices are divided into training sets and test sets, and the training set is input into the CNN model. In the convolution layer, multiple convolution kernels of different sizes are used to scan the input two-dimensional matrix, and inner product operations are performed to extract local features. The size of the output feature map is controlled by stride and padding. ReLU is used as the activation function to introduce nonlinear factors. In the pooling layer, the optimal pooling kernel and stride are selected to downsample the feature map output by the convolution layer and extract the main features. Multiple convolution layers and pooling layers are repeatedly stacked to extract high-level feature maps.
[0076] Specifically, convolution kernels of different sizes (such as 3x3, 5x5, 7x7) are used to capture features of different scales. The stride is usually set to 1 to retain the resolution of the feature map. The padding method selects "SAME" to keep the spatial size of the input and output feature maps consistent. Max Pooling is selected as the pooling operation because it can effectively extract the main features in the feature map. The common pooling kernel size is 2x2 and the stride is 2. The feature map output by the convolution layer is downsampled to reduce the amount of data while retaining important features. Multiple convolutional layers and pooling layers are repeatedly stacked to extract higher-level features. As the number of stacked layers increases, the size of the feature map gradually decreases, while the depth (number of channels) of the feature map gradually increases.
[0077] The two-dimensional feature map extracted by the CNN model is converted into a one-dimensional feature vector and input into the LSTM layer for processing. The number of LSTM units is set to determine the memory capacity of the model. The feature vector is processed using the tanh activation function and the sigmoid activation function. The bidirectional LSTM is used to capture past and future information at the same time. The Dropout layer is added after the LSTM to randomly discard some neural units to prevent the model from overfitting. The feature vector output by the LSTM layer is connected to the output layer using a fully connected layer. The number of neurons in the output layer is set to be equal to the number of fault types. The output result is converted into a probability distribution using the Softmax activation function.
[0078] Use the Flatten layer to convert the two-dimensional feature map extracted by the CNN model into a one-dimensional feature vector (or use a global pooling layer (such as Global Average Pooling) to compress each feature map into a single value) so that it can be input into the LSTM layer for processing. Select the appropriate number of LSTM units (for example, 64, 128, 256) according to the complexity of the problem and the amount of data. Use the tanh activation function inside the LSTM to process the cell state and hidden state. The LSTM gating mechanism uses the sigmoid activation function to control the flow of information. Use a bidirectional LSTM (Bi-LSTM) to capture past and future information at the same time to improve the model's ability to understand time series data. Add a Dropout layer after the LSTM to randomly discard some neural units to prevent the model from overfitting and improve generalization ability. Use a fully connected layer to connect the feature vector output by the LSTM layer to the output layer. Set the number of neurons in the output layer to be equal to the number of fault types. Use the Softmax activation function to convert the output result into a probability distribution.
[0079] The above method combines the advantages of CNN and LSTM, and can simultaneously extract the local features and timing features of the signal to achieve accurate identification of complex fault modes. For example, for intermittent short circuit faults, the model can identify subtle changes and abnormal patterns in the signal, thereby improving diagnostic accuracy.
[0080] Furthermore, the attention mechanism is introduced in the process of building the automatic diagnosis model, which includes the following steps:
[0081] Perform global average pooling and global maximum pooling on the feature maps extracted from multiple convolutional layers of the CNN model to obtain the global average features and global maximum features of the channel dimension. Concatenate the global evaluation features and the global maximum features to obtain the fused features. The fused features are input into two fully connected layers to generate channel attention weights. The generated attention weights are multiplied by the feature map to obtain the weighted feature map.
[0082] Specifically, in order to further improve the diagnostic performance of the model, the channel attention mechanism and the temporal attention mechanism are introduced in the CNN feature extraction and LSTM sequence processing stages respectively. Multiple convolutional layers (each convolutional layer contains a different number of convolution kernels) are used to extract multi-level feature maps from the input two-dimensional matrix. After these convolutional layers, a set of feature maps are obtained. In order to capture the global information of the feature maps in different channels, global average pooling (GAP) and global maximum pooling (GMP) are performed on each feature map respectively. The average value of all spatial positions on each channel is calculated to obtain a vector whose length is the number of channels. The maximum value of all spatial positions on each channel is calculated to obtain a vector whose length is also the number of channels. The feature vectors obtained by GAP and GMP are concatenated to obtain To a fused feature vector, the length of the concatenated feature vector is twice the number of channels. In order to adaptively adjust the weights of different channel features, the channel attention mechanism is introduced. The fused feature vector is input into a fully connected layer, and ReLU is used as the activation function. The output of the fully connected layer is input into another fully connected layer, and Sigmoid is used as the activation function. The output value is scaled to the range of [0,1] to obtain the channel attention weight. The attention weight is multiplied by the original feature map to obtain the weighted feature map. The attention weight is transformed through an appropriate dimension to match the shape of the original feature map. The weighted feature map is input into the subsequent convolutional layer or pooling layer to continue feature extraction and dimensionality reduction. The extracted feature map is flattened and input into the LSTM layer for sequence processing.
[0083] The temporal attention mechanism is introduced into LSTM to calculate the similarity between the hidden state and the context vector at each time step to obtain the attention score. The attention score is normalized by softmax to obtain the attention weight. The attention weight is multiplied by the hidden state, and the weighted sum is taken for all time steps to obtain the context vector. The context vector is combined with the hidden state of the current time step to obtain the final output.
[0084] Specifically, the LSTM layer is used to process time series data. The output of each time step is the hidden state. A context vector c is initialized to represent global information. A zero vector can be used as the initialized context vector c, or the average of all hidden states can be calculated and the average value can be used as the initialized context vector c. The similarity between the hidden state and the context vector c of each time step is calculated using methods such as dot product and cosine similarity. The attention scores of all time steps are Softmax normalized to obtain the attention weights. The attention weights are multiplied by the hidden states, and the weighted sum is performed on all time steps to obtain a new context vector. The new context vector can replace the previous context vector c or be fused with c. The new context vector can be combined with the hidden state of the current time step using methods such as connection and addition to obtain the final output. The output of the LSTM layer is input into the fully connected layer or the output layer for final fault type classification.
[0085] By introducing the attention mechanism into CNN and LSTM, the model's feature extraction and sequence processing capabilities can be significantly improved, thereby achieving more accurate and efficient short-circuit fault diagnosis of power measurement instruments. This improved model not only has higher diagnostic accuracy, but also has better interpretability and adaptability, providing a more reliable technical guarantee for the safe and stable operation of the power system.
[0086] Furthermore, the model parameters of the automatic diagnosis model are optimized using the sparrow search algorithm and the Adam algorithm, including the following steps:
[0087] Step S41, initializing the sparrow search algorithm parameters, Adam algorithm parameters and switching conditions, randomly initializing the population position, each position corresponds to a set of model parameters, initializing the fitness value of each sparrow, initializing the parameter vector, first-order moment estimation and second-order moment estimation;
[0088] Step S42, update the position of each sparrow according to the position update formula of the sparrow search algorithm, calculate the fitness value of each sparrow after the update, update the global optimal solution, and determine whether the termination condition is met. If so, end this step, and determine whether to switch to the Adam algorithm according to the first switching condition. If so, proceed to step S43, if not, repeat this step;
[0089] Step S43, calculate the gradient of the parameter vector, update the first-order moment estimate and the second-order moment estimate, calculate the corrected first-order moment estimate and the second-order moment estimate, update the parameter vector, and determine whether the termination condition is met. If so, end this step, and determine whether to switch back to the sparrow search algorithm based on the second switching condition. If so, return to step S42, if not, repeat this step.
[0090] Specifically, the parameters of the sparrow search algorithm include the population size N, the ratio of discoverers, joiners and guards, the perception radius R, the maximum number of iterations T max The parameters of the Adam algorithm include the learning rate r, the exponential decay rate β of the first-order moment estimate, and the step size factor. 1 , the exponential decay rate of the second-order moment estimate β 2 , numerical stability constant D and initial parameter vector θ 0 , initialize the population and parameter vector, sparrow search algorithm: randomly initialize the population position X i (i=1,2,…,N), each position corresponds to a set of model parameters, and the fitness value f(X i ), initialize the parameter vector θ 0 As the optimal solution in the initial population of the sparrow search algorithm, initialize the first-order moment estimate m 0 = 0 and the second moment estimate v 0 =0, preset maximum number of iterations T max , according to the position update formula of the sparrow search algorithm, update the position of each sparrow, the update formula is , where ɑ, β are step size factors, Levy(λ) is the Levy flight function used to simulate the random search behavior of sparrows, Q is a random number, X best (t) is the current global optimal solution, X j (t), X k (t) is the position of two randomly selected sparrows, X i (t) represents the position of each sparrow in the current iteration, X i (t+1) represents the position of each sparrow in the next iteration, t represents the number of iterations, t=1,2,…T max , calculate the fitness value f(X i (t+1)), update the global optimal solution X best (t+1), determine whether the termination condition is met. If so, end this step. If not, decide whether to switch to the Adam algorithm based on the first switching condition. The first switching condition is that the change in fitness value is less than the preset third threshold. If the switching condition is not met, repeat the current step and continue to use the sparrow search algorithm for the next iteration. If the switching condition is met, enter step S43.
[0091] Use the Adam algorithm to perform local search and calculate the current parameter vector Gradient , use the following formula to update the first-order moment estimate , It is The first-order moment estimate at the iteration, It is The first-order moment estimate at the iteration is updated using the following formula , It is The first-order moment estimate at the iteration, It is The first-order moment estimate at the iteration is also used Compute the corrected first moment estimate , yes of Power, use Compute the corrected second moment estimate , yes of Second, with increase, and will gradually decrease, and the magnitude of the deviation correction will also decrease. When it is big enough, and Approaching 0, and Approaching and , that is, no further correction is needed. Based on the corrected first-order moment estimate and second-order moment estimate, the parameter vector is updated using the following formula ,in, is the learning rate, is a numerical stability constant, It is The parameter vector at the iteration, It is The parameter vector of the iteration is updated, and it is determined whether the termination condition is met after the parameter vector is updated. If yes, this step is terminated. If not, based on the second switching condition, it is determined whether to switch back to the sparrow search algorithm. The second switching condition refers to that the fitness value change of the parameter vector of the Adam algorithm is less than the preset fourth threshold value. If the second switching condition is not met, the Adam algorithm is continued to be used for the next iteration. If the switching condition is met, it returns to step S42.
[0092] The above method uses the sparrow search algorithm for global search to prevent the algorithm from falling into local optimality, and uses the Adam algorithm for local search to speed up convergence and improve local search accuracy. According to the iteration process and search status, the search strategy is dynamically switched to explore the search space more effectively. The advantages of the two algorithms are complementary to improve optimization efficiency and speed up model training.
[0093] Furthermore, the termination condition refers to that the number of iterations of the sparrow search algorithm and Adam alternating is greater than a preset maximum number of iterations.
[0094] In summary, a CNN-based automatic diagnosis method for short-circuit faults of power measuring instruments of the present invention comprises the following steps: presetting an acquisition cycle and duration, collecting and preprocessing the operation data of the power measuring instrument in real time, determining the optimal number of decomposition layers based on information entropy, dynamically selecting the optimal wavelet basis function, performing wavelet packet decomposition on the preprocessed data, calculating and comparing the energy and variance of each sub-generation coefficient, selecting the sub-generation coefficient containing the fault feature to construct a feature vector, dividing the feature vector into sub-feature vectors and converting them into a two-dimensional matrix, dividing them into a training set and a test set after normalization, constructing an automatic diagnosis model in combination with CNN and LSTM, introducing an attention mechanism, optimizing the model parameters with a sparrow search algorithm and an Adam optimization algorithm, evaluating the model performance through a test set, analyzing the diagnosis results, and realizing accurate diagnosis of power measuring instrument faults. The present application can improve the accuracy and real-time performance of power measuring instrument fault diagnosis.
[0095] In this specification, the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments described later, the description is relatively simple, and the relevant parts can be referred to the partial description of the previous embodiments.
[0096] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A CNN-based automatic diagnosis method for short-circuit faults in power measuring instruments, characterized in that: The steps include: Step S1, preset a collection cycle and a collection duration, collect the operation data of the power measuring instrument in real time, the operation data includes the current value and the voltage value of the sampling point of each line in the power measuring instrument, collect the operation data of multiple sampling points in one collection cycle to form a group of operation data, and pre-process the operation data; Step S2, determining the optimal number of decomposition layers based on information entropy, and dynamically selecting the optimal wavelet basis function according to the signal characteristics, decomposing the preprocessed operating data using the wavelet packet decomposition technology based on the optimal number of decomposition layers and the optimal wavelet basis function to obtain a series of sub-generation coefficients, wherein the sub-generation coefficients represent the energy distribution of the data in different frequency bands and time scales, calculating and comparing the energy and variance of each sub-generation coefficient, and selecting the sub-generation coefficient containing the fault feature information; Step S3, constructing a feature vector using the selected offspring coefficient as a feature, the feature vector contains important information of the operating data at different frequency bands and time scales, dividing the feature vector into multiple data segments according to a preset time series window, each data segment as a sub-feature vector, and converting each sub-feature vector into a two-dimensional matrix, wherein the rows of the two-dimensional matrix represent different time points in the time series window, and the columns represent different frequency band coefficients; Step S4, normalize the converted two-dimensional matrix, divide the multiple two-dimensional matrices into a training set and a test set, build an automatic diagnosis model based on the training set in combination with CNN and LSTM, introduce an attention mechanism in the process of building the automatic diagnosis model, and use the sparrow search algorithm and Adam optimization algorithm to optimize the model parameters of the automatic diagnosis model, evaluate the performance of the automatic diagnosis model through the test set, and analyze the diagnosis results of the automatic diagnosis model.
2. The method according to claim 1, characterized in that Determining the optimal number of decomposition layers based on information entropy includes the following steps: Preset the maximum number of decomposition layers, perform a wavelet packet decomposition on the original running data, obtain the approximate coefficients and detail coefficients after the first decomposition, perform the next layer decomposition on the approximate coefficients and detail coefficients, repeat this step until the preset maximum number of decomposition layers is reached, and record the approximate coefficients and detail coefficients of all sub-bands for each layer of decomposition; For each sub-frequency band obtained by decomposition of each layer, the corresponding information entropy value is calculated, and the information entropy values of all sub-frequency bands are added to obtain the total information entropy value of the corresponding decomposition layer. With the number of decomposition layers as the horizontal axis and the total information entropy value as the vertical axis, a curve of the total information entropy value changing with the number of decomposition layers is plotted, and the optimal number of decomposition layers is determined based on the change curve.
3. The method according to claim 2, characterized in that Determining the optimal number of decomposition layers based on the change curve includes the following steps: For each layer of decomposition, the change rate of the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve, and the first threshold is set based on the historical experimental results. When the change rate is less than the first threshold, the current decomposition layer number is used as the backup decomposition layer number; For each layer of decomposition, the total information entropy difference between the total information entropy value and the total information entropy value of the previous layer is calculated based on the change curve, and the difference change rate between the total information entropy difference of the current layer and the total information entropy difference of the previous layer is also calculated, and a second threshold is set based on historical experimental results. When the difference change rate is greater than the second threshold, the current number of decomposition layers is used as the backup number of decomposition layers; For each layer of decomposition, the total information entropy difference between the total information entropy and the total information entropy of the previous layer is recorded, and for multiple total information entropy differences, the number of decomposition layers corresponding to the minimum total information entropy difference is obtained as the number of standby decomposition layers; The majority of the three standby decomposition level numbers is obtained, and the majority is used as the optimal decomposition level number.
4. The method according to claim 1, characterized in that: Dynamically select the optimal wavelet basis function according to the signal characteristics, including the following steps: Signal characteristics refer to the characteristics of a set of collected operating data. A set of operating data is also called a signal. The characteristics of the signal are extracted, and the time domain characteristics, frequency domain characteristics and other related characteristics of the signal are analyzed. Signals with different characteristics are classified, and multiple different candidate wavelet basis functions are selected for different types of signals to perform wavelet packet decomposition. The corresponding evaluation index is calculated for the decomposed signal, and different weight coefficients are set for different evaluation indexes. Based on the evaluation index and the corresponding weight coefficient, the respective comprehensive evaluation values of the candidate wavelet basis functions are calculated, and the wavelet basis function with the highest comprehensive evaluation value is used as the optimal wavelet basis function of the corresponding type.
5. The method according to claim 4, characterized in that Calculating the corresponding evaluation index for the decomposed signal includes the following steps: Calculate the decomposition error between the original signal and the decomposed signal, calculate the ratio between the original signal energy and the decomposed signal energy, calculate the information entropy value of the decomposed signal, calculate the time domain resolution and frequency domain resolution of the wavelet basis function used, and also calculate the computational amount of the wavelet basis function decomposition process.
6. The method according to claim 1, characterized in that Based on the training set, CNN and LSTM are combined to build an automatic diagnosis model, including the following steps: Divide the plurality of two-dimensional matrices into a training set and a test set, input the training set into a CNN model, use a plurality of convolution kernels of different sizes in a convolution layer to scan the input two-dimensional matrix, perform an inner product operation to extract local features, use stride and padding to control the size of an output feature map, use ReLU as an activation function to introduce nonlinear factors, select an optimal pooling kernel and stride in a pooling layer to downsample the feature map output by the convolution layer and extract main features, repeatedly stack multiple convolution layers and pooling layers to extract a high-level feature map; The two-dimensional feature map extracted by the CNN model is converted into a one-dimensional feature vector and input into the LSTM layer for processing. The number of LSTM units is set to determine the memory capacity of the model. The feature vector is processed using the tanh activation function and the sigmoid activation function. The bidirectional LSTM is used to capture past and future information at the same time. The Dropout layer is added after the LSTM to randomly discard some neural units to prevent the model from overfitting. The feature vector output by the LSTM layer is connected to the output layer using a fully connected layer. The number of neurons in the output layer is set to be equal to the number of fault types. The output result is converted into a probability distribution using the Softmax activation function.
7. The method according to claim 1, characterized in that The attention mechanism is introduced in the process of building an automatic diagnosis model, which includes the following steps: Perform global average pooling and global maximum pooling on the feature maps extracted from multiple convolutional layers of the CNN model to obtain the global average features and global maximum features of the channel dimension, concatenate the global evaluation features and the global maximum features to obtain the fused features, input the fused features into two fully connected layers, generate channel attention weights, and multiply the generated attention weights with the feature maps to obtain the weighted feature maps; The temporal attention mechanism is introduced into LSTM to calculate the similarity between the hidden state and the context vector at each time step to obtain the attention score. The attention score is normalized by softmax to obtain the attention weight. The attention weight is multiplied by the hidden state, and the weighted sum is taken for all time steps to obtain the context vector. The context vector is combined with the hidden state of the current time step to obtain the final output.
8. The method according to claim 1, characterized in that The sparrow search algorithm and Adam algorithm are also used to optimize the model parameters of the automatic diagnosis model, including the following steps: Step S41, initializing the sparrow search algorithm parameters, Adam algorithm parameters and switching conditions, randomly initializing the population position, each position corresponds to a set of model parameters, initializing the fitness value of each sparrow, initializing the parameter vector, first-order moment estimation and second-order moment estimation; Step S42, update the position of each sparrow according to the position update formula of the sparrow search algorithm, calculate the fitness value of each sparrow after the update, update the global optimal solution, and determine whether the termination condition is met. If so, end this step, and determine whether to switch to the Adam algorithm according to the first switching condition. If so, proceed to step S43, if not, repeat this step; Step S43, calculate the gradient of the parameter vector, update the first-order moment estimate and the second-order moment estimate, calculate the corrected first-order moment estimate and the second-order moment estimate, update the parameter vector, and determine whether the termination condition is met. If so, end this step, and determine whether to switch back to the sparrow search algorithm based on the second switching condition. If so, return to step S42, if not, repeat this step.
9. The method according to claim 8, characterized in that The termination condition means that the number of iterations of the sparrow search algorithm and Adam alternating is greater than the preset maximum number of iterations.
Citation Information
Patent Citations
Battery short circuit fault diagnosis method and device
CN115718266A
Lithium battery pack micro short circuit fault diagnosis method
CN118091463A
Analog circuit fault diagnosis method based on WOA and GMKL-SVM
CN111239588A
Method for diagnosing short-circuit fault of AC transmission line of AC-DC hybrid power grid based on CNN
CN115327437A