Power system fault diagnosis method and system, computer equipment and medium
By optimizing the BP neural network using the feature attention mechanism and the gray wolf optimization algorithm, the problems of single research object and easy model getting trapped in local optima in power system fault diagnosis are solved. This enables rapid and accurate diagnosis of multiple types of faults in power systems, improving diagnostic accuracy and energy utilization efficiency.
Patent Information
- Application Number
- CN202511790048.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-01
- Publication Date
- 2026-03-03
AI Technical Summary
Existing power system fault diagnosis methods have limited research focus and incomplete data coverage. Furthermore, traditional BP neural networks are prone to getting trapped in local optima, resulting in low diagnostic accuracy and difficulty in quickly and accurately locating multiple types of core faults.
The Feature Attention (FAM) mechanism is used to weight and fuse time-domain, frequency-domain, transient, and fault-related fluctuation features. The Grey Wolf Optimization (GWO) algorithm is combined to optimize the parameters of the BP neural network, forming a multi-scale fused feature vector. The BP model is then optimized to improve diagnostic accuracy.
It enables rapid and accurate location of multiple core faults in power systems, avoiding missed or false diagnoses, reducing energy waste, and is practical and applicable, improving the accuracy of fault diagnosis and the speed of iterative convergence.
Smart Images

Figure CN121598307A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power system fault diagnosis, and specifically relates to a power system fault diagnosis method, system, computer equipment and medium. Background Technology
[0002] With the rapid development of modern science and technology, buildings are becoming increasingly intelligent, building equipment is becoming more sophisticated, the demand for electricity is growing, and building power systems are becoming more complex. This leads to various types of faults, and power system failures can cause large-scale power outages, and even fires resulting in casualties and property damage. Therefore, we need to adopt building energy-saving technologies. By monitoring equipment operating status in real time and using fault detection technology, we can promptly detect equipment faults and abnormal operating conditions, avoiding high-energy-consuming operation due to equipment failures, thus preventing energy waste and production interruptions, and ensuring the safe and stable operation of equipment in buildings.
[0003] Many researchers have applied machine learning algorithms to fault diagnosis in power systems, gradually realizing intelligent fault diagnosis. However, many studies employ simplistic methodologies and focus on a single subject, either solely on transmission lines and short-circuit faults or diagnosing localized faults. While power system faults are classified, specific fault types are not identified. Summary of the Invention
[0004] To address the background issues, the present invention provides a method, system, computer equipment, and medium for diagnosing power system faults.
[0005] To achieve the above objectives, the present invention provides a power system fault diagnosis method, comprising: Real-time acquisition of raw electrical data of equipment and lines under the operating status of the target power system.
[0006] Time-domain features, frequency-domain features, transient features, and fluctuation features related to fault type are extracted from the original electrical data; the different features are weighted and fused using a feature attention mechanism (FAM) to form a multi-scale fused feature vector.
[0007] The pre-defined BP neural network parameters are optimized using the Grey Wolf Optimization (GWO) algorithm. The multi-scale fused feature vector is input into the pre-defined BP neural network to obtain the predicted fault diagnosis type. The error between the predicted fault diagnosis type and the actual fault type is calculated. The pre-defined BP neural network parameters are iteratively trained using the error. When the average error in the iteration is less than the preset value, the iteration is stopped, and the optimized GWO-BP model is obtained.
[0008] The GWO-BP model is used to diagnose fault types in the target power system.
[0009] Preferably, after collecting the raw electrical data, the method further includes preprocessing the raw electrical data; specifically including: data cleaning, data standardization, and data partitioning; the data cleaning involves removing outliers and filling in missing values; the data standardization involves mapping the raw electrical data to a preset range; the data partitioning involves dividing the preprocessed raw electrical data into a training set and a test set, the training set being used to optimize the parameters of the BP neural network using GWO, and the test set being used to finally verify the generalization performance of the optimized GWO-BP neural network.
[0010] Preferably, the time-domain features include the mean, variance, peak value, and peak factor of the original electrical data; the frequency-domain features are extracted by performing Fourier transform or wavelet transform on the original electrical data, including frequency component amplitude, frequency peak value, and spectral energy; the transient features include the abrupt change time, abrupt change amplitude, and abrupt change duration of the original electrical data; and the fluctuation features related to the fault type include voltage fluctuation amplitude, current fluctuation frequency, and power fluctuation period.
[0011] Preferably, the specific process of optimizing the preset BP neural network parameters using the Grey Wolf Optimization Algorithm (GWO) is as follows: A BP neural network is constructed with multi-scale fused feature vectors as input and fault diagnosis type as output; based on the Grey Wolf Optimization Algorithm (GWO), a wolf population is initialized, and each individual in the wolf population represents a candidate parameter value for a BP neural network. The parameters corresponding to each individual wolf are fed into the BP neural network. The BP neural network completes one forward propagation by using multi-scale fusion feature vectors and outputs the predicted fault diagnosis result. The error between the predicted fault diagnosis result and the actual fault type is calculated. The error value is calculated for all wolves in the wolf pack. The three wolves with the smallest error values are selected as the guide wolves, and the remaining wolves are all Omega wolves. The algorithm calculates the distance between the Omega wolf and the guide wolf, updates the parameters of the Omega wolf based on the distance, and moves the Omega wolf toward the guide wolf. When all errors are less than the preset value, the iteration stops, and the optimal parameters of the wolf pack are obtained. The optimal parameters of the wolf pack are decoded into the optimal weights and thresholds of the BP neural network, resulting in the optimized GWO-BP neural network.
[0012] Preferably, the specific process of using the Feature Attention Mechanism (FAM) to weightedly fuse the different features to form a multi-scale fused feature vector is as follows: the time-domain features, frequency-domain features, transient features, and fluctuation features are multiplied by their corresponding attention weights, and then the weighted feature vectors are concatenated or summed element by element to obtain the multi-scale fused feature vector; the correlation coefficient is calculated by Pearson correlation analysis or mutual information entropy and is used to characterize the correlation strength between various feature vectors and power system fault types.
[0013] Preferably, the fault diagnosis types include: voltage fault, short circuit fault, open circuit fault, overload fault, frequency abnormality, phase loss fault, and no fault state.
[0014] Preferably, the raw electrical data includes voltage, current, frequency, load power, and timestamp.
[0015] The present invention also provides a power system fault diagnosis system, comprising: The data acquisition module is used to collect raw electrical data of equipment and lines in the target power system in real time.
[0016] The feature extraction module is used to extract time-domain features, frequency-domain features, transient features, and fluctuation features related to fault type from the original electrical data; the feature attention mechanism (FAM) is used to weight and fuse the different features to form a multi-scale fused feature vector.
[0017] The GWO-BP neural network training module is used to optimize the preset BP neural network parameters using the Grey Wolf Optimization Algorithm (GWO); input the multi-scale fused feature vector into the preset BP neural network to obtain the predicted fault diagnosis type; calculate the error between the predicted fault diagnosis type and the actual fault type; use the error to iteratively train the preset BP neural network parameters; when the average error in the iteration is less than a preset value, the iteration stops, and the optimized GWO-BP model is obtained; the GWO-BP model is used to diagnose the fault type of the target power system.
[0018] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any of the steps in the power system fault diagnosis method.
[0019] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can execute any of the steps in the power system fault diagnosis method.
[0020] The power system fault diagnosis method provided by this invention has the following beneficial effects: This technical solution comprehensively captures the overall operating status of a building's power system by real-time acquisition of multi-dimensional raw electrical data, including voltage, current, frequency, load power, and timestamps, addressing the pain points of existing technologies that focus on a single research object and lack comprehensive data coverage. Furthermore, it extracts time-domain, frequency-domain, transient, and fault-related fluctuation features, and combines them with a Feature Attention (FAM) mechanism for weighted fusion to form a multi-scale fusion feature vector. This effectively eliminates redundant information, strengthens key fault features, and improves feature utilization efficiency to avoid noise interference with the model. Simultaneously, it utilizes the Grey Wolf Optimization (GWO) algorithm to optimize the parameters of the BP neural network, overcoming the bottleneck of traditional BP models easily getting trapped in local optima. Combined with the nonlinear mapping capability of the BP neural network, it significantly improves fault diagnosis accuracy and iterative convergence speed, ensuring the model's stability meets accuracy requirements. Finally, the optimized GWO-BP model can fully cover multiple core faults, including voltage faults and short-circuit faults, enabling rapid and accurate problem location and avoiding power outages, equipment damage, and safety risks caused by missed or misdiagnosed faults. It also reduces energy waste under fault conditions to align with building energy conservation goals. Moreover, the entire process requires no complex hardware modifications, is easily integrated into existing operation and maintenance platforms, and possesses strong practicality and feasibility. Attached Figure Description
[0021] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of a power system fault diagnosis method according to an embodiment of the present invention.
[0023] Figure 2 This diagram illustrates the data acquisition method according to an embodiment of the present invention. Figure 3 This is a diagram of the BP neural network structure according to an embodiment of the present invention; Figure 4 This is a diagram illustrating the social hierarchy of a wolf pack according to an embodiment of the present invention; Figure 5 This is a flowchart of a fault diagnosis process based on GWO-BP according to an embodiment of the present invention; Figure 6 This is a diagram illustrating the fitness curve of GWO-BP in an embodiment of the present invention. Figure 7 This is a diagram illustrating the prediction results of the training set in an embodiment of the present invention. Figure 8 This is a diagram illustrating the prediction results for the test set in an embodiment of the present invention. Figure 9 This is a diagram illustrating the confusion matrix of the training set in an embodiment of the present invention. Figure 10 This is a diagram illustrating the confusion matrix of the test set in an embodiment of the present invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0025] Power system fault diagnosis specifically involves the analysis of building power system faults. Building power systems comprise numerous devices and lines used for power generation, transmission, transformation, distribution, and consumption. With increasing building electricity demand, power systems are becoming increasingly complex, and common faults include voltage faults, short-circuit faults, open-circuit faults, overload faults, frequency anomalies, and phase loss faults. The occurrence of any of these faults will lead to abnormal power system operation. To facilitate proper model output, seven power system states are digitally coded, as shown in Table 1.
[0026] Table 1 Power System Fault Types Based on this, the present invention provides a power system fault diagnosis method, specifically as follows: Figure 1 As shown, it includes: S1. Real-time acquisition of raw electrical data of equipment and lines under the operating status of the target power system.
[0027] Data Acquisition. Power system fault diagnosis involves analyzing equipment failures and line anomalies to determine the occurrence of faults. When a fault occurs, the system generates error messages and triggers alarms. Fault diagnosis relies on extensive data for optimization and training. Therefore, it is necessary to extract historical monitoring data to build models and employ training algorithms to improve the accuracy of fault prediction.
[0028] The power system data used in this invention originates from an IoT data acquisition system for a low-voltage distribution cabinet. This system installs smart meters on the low-voltage distribution cabinet via panel mounting, enabling data acquisition of the low-voltage power system's operating status. It monitors and collects key parameters of the power system in real time, and can collect various electrical quantities and switch status data from field equipment. The system also collects smart meter data through a gateway device and transmits it to an intelligent management platform. On the platform, different big data dashboards can be flexibly created to analyze and display data from different dimensions, allowing for real-time perception of system operating status. The system performs statistical analysis and querying of the collected data and stores important information in a database. In case of anomalies, the system provides alarm functions for abnormal information such as switch changes and parameter limit violations, and automatically sends timely control commands to operating equipment or alerts on-duty personnel to troubleshoot the fault. Through data acquisition, the operating status of the power system can be monitored in real time, providing data support for system operation and maintenance. The data acquisition method of this system is as follows: Figure 2 As shown in the figure. The information collected is shown in Table 2.
[0029] Table 2 Data Collection S2. Extract time-domain features, frequency-domain features, transient features, and fluctuation features related to the fault type from the original electrical data; use the Feature Attention (FAM) mechanism to weight and fuse the different features to form a multi-scale fused feature vector.
[0030] Data preprocessing and feature extraction. A JSON file containing equipment operation data is obtained from the system. The content is parsed to extract key information, such as electrical quantities like current, voltage, power, and frequency, as well as their corresponding timestamps. Timestamps effectively record and track changes in various data within the power system, helping to accurately pinpoint the time of fault occurrence. In power system fault diagnosis, timestamps serve as important data markers, linking equipment operating states to time series, facilitating subsequent fault analysis. After parsing the raw JSON data, feature engineering is performed. Twelve data types from the power system are used as input features, and seven states are used as outputs. Due to significant differences in parameters within the sample data, preprocessing is necessary, including data cleaning, removal of missing and redundant values, and summarizing the processed data into a table. To ensure model accuracy and convergence speed, the dataset is divided into training and test sets in a 7:3 ratio. Table 3 shows the distribution of sample sizes in the training and test sets.
[0031] Table 3 shows the distribution of sample size in the training and test sets. When optimizing a backpropagation (BP) neural network using the GWO algorithm, data normalization is necessary. Scaling the processed data within a certain range can improve model convergence speed. Typically, the data is shrunk to the integer range [0,1] for better training and optimization. Min-max normalization is used to normalize the data; the normalization formula is as follows:
[0032] ; Where x is the normalized data and x is the original data. The maximum value in the dataset. This represents the minimum value in the dataset. During prediction, the input is normalized, and the output is denormalized. The corresponding denormalization formula is:
[0033] ; After data preprocessing, feature extraction is performed. Power system fault feature extraction is a crucial step in fault diagnosis. Its purpose is to extract key information accurately reflecting the fault state from complex signals, transforming raw monitoring data into feature information that effectively represents the system fault state. This includes extracting time-domain features, frequency-domain features, transient features, and fault-type-related features from electrical quantity data. These features provide the foundation for subsequent fault identification, classification, and location. In power systems, faults may be caused by equipment damage, uneven load, external interference, or other factors, and different types of faults will cause different changes in electrical quantities (such as voltage, current, and power). Through effective feature extraction, power system faults can be accurately diagnosed and predicted. By analyzing the changes in these electrical quantity characteristics, the occurrence of faults can be effectively identified, thus providing a basis for fault diagnosis.
[0034] Feature Attention (FAM) is used in real power systems to address the large amount of monitoring data generated during faults. This data contains various features, such as the changing characteristics of different electrical quantities and the time and frequency domain characteristics of signals. However, not all features are equally important for fault diagnosis. For example, in some fault scenarios, sudden voltage changes may be crucial for determining the fault type, while small current fluctuations may be relatively less important. Therefore, FAM is introduced to dynamically allocate feature weights.
[0035] By combining channel and spatial attention mechanisms, FAM enhances the expressive power of features and achieves efficient feature fusion. By dynamically allocating feature weights, it allows the network to focus on information that is more valuable for fault diagnosis, fundamentally improving the efficiency and quality of feature extraction. This makes it a key improvement module for GWO-BP to adapt to power fault diagnosis scenarios, forming multi-scale fusion features.
[0036] 1) Feature mapping Power fault data covers electrical quantities such as current, voltage, power, and frequency. The heterogeneous data is transformed into a unified feature vector through a feature mapping layer. Finally, all features are merged into a unified 65-dimensional feature vector, laying the foundation for subsequent weight calculation.
[0037] 2) Calculate the weights This is the core component of FAM (Focus Attention), which outputs attention weights for each feature dimension based on the correlation between features and fault types through a "weight calculation layer." Specifically, it adopts a structure of "two fully connected layers + Softmax activation" to ensure that the sum of the weights is 1, making it easier for the network to focus on key features.
[0038] The first fully connected layer maps the 65-dimensional feature vector to a 32-dimensional intermediate vector, and enhances the non-linear expressive power through the ReLU activation function, as shown in the formula: Where X is the input feature vector. , H represents the learnable parameters, and H is the intermediate vector.
[0039] The second fully connected layer maps the 32-dimensional intermediate vector back to the 65-dimensional weight vector, using the following formula: ; in, Here, S is a learnable parameter, and S is the unnormalized weight score.
[0040] Softmax activation is used to normalize the weight scores, resulting in the final attention weight α, as shown in the formula: ; in, Let be the weight of the i-th feature dimension, with a value range of [0,1], and 3) Weighting Application The calculated attention weights are multiplied element-wise by the original feature vector to obtain the attention-weighted feature vector, as shown in the formula: ; Here, ⊙ represents element-wise multiplication. This is the feature vector that is ultimately input into the hidden layer of the GWO-BP network.
[0041] Through this step, key features (such as weights) The contribution of features (such as weights) is amplified, while redundant / interference features (such as weights) are also amplified. The influence of (characteristics) is weakened.
[0042] By incorporating the attention weights of the Feature Analysis Module (FAM) into the optimization objective function of the Global Memory Module (GWO), a dual optimization system of "feature weights - network parameters" is formed, further improving feature extraction efficiency and diagnostic accuracy. The FAM module weights the features of the input data. First, it performs a linear transformation on the input data to obtain a query vector, a key vector, and a value vector. By calculating the similarity between the query vector and the key vector, attention weights are generated, representing the importance of each feature for fault diagnosis. Then, the attention weights and value vectors are weighted and summed to obtain the feature representation processed by the attention mechanism. This new feature representation contains more prominent key fault features and is then input into the hidden layer of the Backpropagation (BP) neural network. The hidden and output layer structures of the BP neural network remain unchanged. Hidden layer neurons further extract features and perform nonlinear transformations on the input features using a nonlinear activation function (Sigmoid function). The output layer outputs the fault diagnosis results, such as fault type and fault location, based on the output of the hidden layer through a linear transformation. This fused model structure allows the BP neural network to focus more on features that significantly influence fault diagnosis when handling power system fault diagnosis tasks, thereby improving the accuracy of fault diagnosis.
[0043] S3. The preset BP neural network parameters are optimized using the Grey Wolf Optimization (GWO) algorithm. A multi-scale fusion feature vector is input into the preset BP neural network to obtain the predicted fault diagnosis type. The error between the predicted fault diagnosis type and the actual fault type is calculated. The preset BP neural network parameters are iteratively trained using the error. When the average error during iteration is less than a preset value, the iteration is stopped, resulting in the optimized GWO-BP model. The GWO-BP model is used to diagnose the fault type of the target power system.
[0044] The Grey Wolf optimization algorithm optimizes backpropagation (BP) neural networks. A BP neural network is a multi-layer feedforward neural network trained using the backpropagation algorithm. It consists of an input layer, one or more hidden layers, and an output layer, possessing powerful nonlinear mapping capabilities. It comprises two main processes: forward propagation of the signal and backward propagation of the error. During forward propagation, the input signal is processed layer by layer from the input layer through the hidden layers, with the output of each layer becoming the input of the next, until the final layer produces the network's output. If the output layer does not produce the expected output, the error is calculated, and backpropagation begins. Based on the prediction error, the network weights and thresholds are adjusted, allowing the BP neural network's predicted output to continuously approach the expected output. These gradients are used to update the network's weights and biases until a stopping condition is met, such as reaching a predetermined number of iterations or the error falling below a certain threshold, thus calculating the optimal parameters in the neural network. While BP neural networks perform well in some fields, they also have limitations, such as requiring large amounts of data, slow training speed, and a tendency to get trapped in local minima.
[0045] Figure 3 middle, These are the input values of the BP neural network. It is the predicted value of the BP neural network. and These are the weights of the BP neural network. Figure 3 As can be seen, a BP neural network can be viewed as a nonlinear function, with the network input and predicted values being the independent and dependent variables of this function, respectively. When the number of input nodes is n and the number of output nodes is m, the BP neural network expresses a functional mapping relationship from n independent variables to m dependent variables.
[0046] The Grey Wolf Optimization (GWO) algorithm was proposed in 2014 by Mirjalili et al. from Griffith University, Australia. This algorithm exhibits strong convergence performance, requires few parameters, and is easy to implement.
[0047] Grey wolves have a very strict social hierarchy, such as Figure 4 As shown. Among them. It is the alpha wolf in the pack, responsible for the pack's hunting, sleeping, and other activities; It is second only to Below, the wolf assist Wolves, when The wolf died. The wolf then became a candidate for alpha wolf; Wolves are obedient. and He was ordered to keep watch and stand guard. Although wolves occupy the bottom of the pyramid, they play an important mediating role within the wolf pack, maintaining the internal balance of the pack.
[0048] in, 、 、 These represent the three optimal solutions of the GWO optimization algorithm. Hunting optimization is achieved by searching for prey, surrounding prey, and attacking prey, ultimately yielding the optimal solution.
[0049] 1) Encircling prey: Gray wolves first surround their prey when hunting. ; ; Where t represents the current iteration number; A and C are coefficients; X p Let A represent the prey's location; X represent the gray wolf's location; X(t) represent the gray wolf's location in generation t. The calculation methods for A and C are as follows.
[0050] 2) Encirclement and capture of prey Gray wolves can locate their prey and surround them for hunt. This encirclement and pursuit is usually carried out by... The wolf came to command. wolves and Wolves also occasionally participate in hunting. The mathematical model for an individual gray wolf tracking its prey is described below:
[0051] ; ; ; in, They represent Wolf, wolves and The distance between wolves and other individuals; They represent Wolf, wolves and The wolf's current location; It is a random number, and X is the current position of the individual gray wolf.
[0052] ; ; ; Equations (10), (11), and (12) define the characteristics of a wolf pack. Individual orientation Wolf, wolves and The wolf's stride length and direction of movement, among which, They represent the recipients respectively Wolf, wolves and The influence of wolves The wolf's adjusted position. Here we take the average value, i.e.:
[0053] ;; Equation (13) defines The final position.
[0054] 3) Attacking prey A decrease in the value of 'a' will also cause a change in the value of 'A'. The value of 'A' varies within the interval [-a, a]. At that time, the wolf pack attacked its prey and got stuck in a local optimum.
[0055] 4) Searching for prey when At that time, the gray wolf seeks the global optimum. In the GWO algorithm, C can also be used for optimization. As can be seen from equation (6), the range of C is between [0,2]. The randomness of C can effectively avoid local optima and help to find the global optimum.
[0056] A power system fault diagnosis model based on GWO-BP. Power system fault diagnosis mainly involves extracting fault features and identifying fault modes to determine the occurrence of faults. Due to the complex structure of building power systems, there are many factors that can lead to power system faults, making fault diagnosis a typical classification problem. Therefore, it is necessary to monitor the operating status of equipment in real time and analyze changes in parameters such as current, voltage, power, frequency, and energy to determine whether a fault has occurred. When a system fault occurs, a large number of alarm messages are generated; therefore, it is essential to accurately identify the fault from these alarm messages and take timely measures to address it.
[0057] This invention employs a GWO-BP-based method for fault diagnosis of building power systems. The Grey Wolf Optimization (GWO) algorithm is a heuristic optimization algorithm based on the social behavior of grey wolves in nature. It simulates the social behavior and hierarchical structure of a grey wolf pack to solve optimization problems. Backpropagation (BP) neural networks are commonly used artificial neural network models for classification and prediction. In multidimensional classification and prediction problems, it is often necessary to classify and predict large amounts of input data. However, traditional BP neural networks suffer from slow training speeds and a tendency to get trapped in local minima when processing large-scale data. Therefore, the GWO algorithm is used to optimize the weights and thresholds of the BP neural network, improving its performance in multidimensional classification and prediction problems.
[0058] The GWO-BP algorithm steps are as follows: 1) Data preprocessing: Divide the collected experimental data into training samples, validation samples, and test samples according to a certain ratio. 2) Initialize gray wolf parameters, including gray wolf population size, gray wolf location information, and the gray wolf individual position representing the weights and thresholds of the BP neural network. 3) Calculate fitness: Use the BP algorithm to calculate the fitness of individual gray wolves; fitness represents the classification prediction accuracy. 4) Update gray wolf positions: Update the gray wolf individual positions and update the weights and thresholds of the BP neural network based on the gray wolf individual positions. 5) Determine the number of iterations: Continue until the maximum number of iterations is reached or the classification prediction accuracy meets the condition.
[0059] The specific implementation steps and procedures for GWO-BP are as follows: Figure 5 As shown, the power system fault diagnosis process starts from the startup. First, the data is preprocessed to determine the neural network topology and initialize its weights and thresholds. Then, the model is optimized through the sub-process of the Grey Wolf Optimization Algorithm (GWO), which initializes the wolf population (each individual corresponds to a set of neural network parameters), updates the gray wolf positions, calculates the fitness (based on the fault diagnosis error), and determines whether the maximum number of iterations has been reached. If not, the position update and fitness calculation are repeated. If the maximum number of iterations has been reached, the optimal parameters are output to build the GWO-BP model. Finally, the trained model is called to carry out power system fault diagnosis and output the test results.
[0060] Fault diagnosis model results. The convergence curve of the BP neural network using the gray wolf optimization algorithm to find the optimal parameters is shown below. Figure 6 As shown.
[0061] The iteration ends when the fitness value no longer changes with the number of iterations. The fault diagnosis model gradually stabilizes after 10 iterations. The wolf pack size is 5, and the training iterations are 1000. The results of applying the GWO-BP model to power system fault diagnosis are as follows: Figure 7 , 8 As shown in Figures 9 and 9.
[0062] Figure 7 and Figure 8 In the diagram, the horizontal axis represents the number of predicted samples (7 states in total), and the vertical axis represents the prediction result. From... Figure 7 As can be seen, there is one error in the prediction results for label 6, while the rest are correct. Figure 8 Only one prediction was made for label 4, and one prediction was made for label 6; the rest of the predictions were correct. Figure 9 and Figure 10 The results are the confusion matrices for the training and prediction sets. The prediction accuracy for the training set is 99.6032%, and the prediction accuracy for the training set is 98.0952%, close to 100%, indicating a low error rate and high prediction accuracy.
[0063] The fault diagnosis results of BP neural network are compared with those of GWO-BP, and the results are shown in Table 4: Table 4 Comparison of diagnostic results between the two models This invention is primarily applied in building applications. Power system faults are numerous and complex. This invention presents a low-voltage power system fault diagnosis model based on a BP neural network algorithm optimized by the Grey Wolf Optimization Algorithm. This diagnostic model effectively combines the advantages of both the Grey Wolf Optimization Algorithm and neural network algorithms. The Grey Wolf Optimization Algorithm is used to optimize the weights and thresholds of the BP neural network, performing global optimization to establish a power system fault diagnosis model based on the Grey Wolf Optimization Algorithm-optimized BP neural network. A Feature Attention (FAM) mechanism is introduced. The FAM module processes the input data during the feature extraction stage, calculating attention weights to highlight key fault features and suppress redundant or unimportant features. The features processed by the FAM module are then input into the hidden layer of the BP neural network. The hidden layer of the BP neural network performs a deep nonlinear transformation on these attention-filtered and enhanced features, further extracting more abstract and representative fault features. The prediction rate of the GWO-BP model is significantly higher than that of the BP neural network, effectively improving the fault diagnosis accuracy. The results demonstrate that a low-voltage power system fault diagnosis model based on a BP neural network optimized by the Grey Wolf Optimization Algorithm effectively improves the accuracy of power fault diagnosis, verifying the feasibility of this algorithm in power system fault diagnosis.
[0064] This invention takes a holistic approach to building power systems, acquiring fault characteristics through data collected during system operation. It designs a fault diagnosis method for building power systems based on a Grey Wolf Optimization (GWO-BP) algorithm optimized from a Backpropagation (BP) neural network. This method enables fault classification, prediction, and diagnosis, improving fault diagnosis accuracy, ensuring normal power system operation, increasing energy efficiency, and reducing building energy consumption. Furthermore, it employs a Feature Attention (FAM) mechanism to enhance feature extraction efficiency, fully leveraging the global search capability of the GWO algorithm, the self-learning and nonlinear mapping capabilities of the BP neural network, and the FAM's ability to focus on key features, thereby achieving more accurate and efficient fault diagnosis in power systems.
[0065] This invention proposes a data-driven fault diagnosis model, GWO-BP, based on historical power system operating data and an optimized BP neural network algorithm using the Grey Wolf Optimization (GWO) algorithm, thereby improving the efficiency of power system fault diagnosis. Starting from the overall power system, historical operating data is collected to extract fault features. Compared to traditional fault diagnosis, the data-driven fault diagnosis model improves the diagnostic rate of power system faults. A GWO-BP-based power system fault diagnosis model is proposed, and its diagnostic efficiency is significantly improved compared to the BP neural network. Feature extraction efficiency is further enhanced by introducing a Feature Attention (FAM) mechanism.
[0066] Based on the same inventive concept, the present invention also provides a power system fault diagnosis system, comprising: The data acquisition module is used to collect raw electrical data of equipment and lines in the target power system in real time.
[0067] The feature extraction module is used to extract time-domain features, frequency-domain features, transient features, and fluctuation features related to fault type from the original electrical data; the feature attention mechanism (FAM) is used to weight and fuse the different features to form a multi-scale fused feature vector.
[0068] The GWO-BP neural network training module is used to optimize the preset BP neural network parameters using the Grey Wolf Optimization Algorithm (GWO); input the multi-scale fused feature vector into the preset BP neural network to obtain the predicted fault diagnosis type; calculate the error between the predicted fault diagnosis type and the actual fault type; use the error to iteratively train the preset BP neural network parameters; when the average error in the iteration is less than a preset value, the iteration stops, and the optimized GWO-BP model is obtained; the GWO-BP model is used to diagnose the fault type of the target power system.
[0069] This invention also provides a computer device. At the hardware level, the computer device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware required for various operations. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the power system fault diagnosis method provided above.
[0070] The present invention also provides a computer-readable storage medium storing a computer program that can be used to execute the power system fault diagnosis method provided above.
[0071] Specific limitations regarding the computational system for power system fault diagnosis methods can be found in the limitations section above, and will not be repeated here. Each module in the aforementioned power system fault diagnosis system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.
[0072] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. Furthermore, the above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for diagnosing faults in a power system, characterized in that, include: Real-time acquisition of raw electrical data of equipment and lines under the operating status of the target power system; Extract time-domain features, frequency-domain features, transient features, and fluctuation features related to fault type from the original electrical data; The different features are weighted and fused using a Feature Attention (FAM) mechanism to form a multi-scale fused feature vector. The pre-defined BP neural network parameters are optimized using the Grey Wolf Optimization (GWO) algorithm. The multi-scale fused feature vector is input into the pre-defined BP neural network to obtain the predicted fault diagnosis type. The error between the predicted fault diagnosis type and the actual fault type is calculated. The pre-defined BP neural network parameters are iteratively trained using the error. When the average error in the iteration is less than the preset value, the iteration is stopped to obtain the optimized GWO-BP model. The GWO-BP model is used to diagnose fault types in the target power system.
2. The power system fault diagnosis method according to claim 1, characterized in that, After collecting the raw electrical data, the process also includes preprocessing the raw electrical data; specifically, this includes: data cleaning, data standardization, and data partitioning; the data cleaning involves removing outliers and filling in missing values; the data standardization involves mapping the raw electrical data to a preset range; the data partitioning involves dividing the preprocessed raw electrical data into a training set and a test set, the training set being used to optimize the parameters of the BP neural network using GWO, and the test set being used to finally verify the generalization performance of the optimized GWO-BP neural network.
3. The power system fault diagnosis method according to claim 1, characterized in that, The time-domain features include the mean, variance, peak value, and peak factor of the original electrical data; the frequency-domain features are extracted by performing Fourier transform or wavelet transform on the original electrical data, including frequency component amplitude, frequency peak value, and spectral energy; the transient features include the abrupt change time, abrupt change amplitude, and abrupt change duration of the original electrical data. The fluctuation characteristics related to the fault type include voltage fluctuation amplitude, current fluctuation frequency, and power fluctuation period.
4. The power system fault diagnosis method according to claim 1, characterized in that, The specific process of optimizing the preset BP neural network parameters using the Grey Wolf Optimization Algorithm (GWO) is as follows: A BP neural network is constructed with multi-scale fused feature vectors as input and fault diagnosis type as output; based on the Grey Wolf Optimization Algorithm (GWO), a wolf population is initialized, and each individual in the wolf population represents a candidate parameter value for a BP neural network. The parameters corresponding to each individual wolf are fed into the BP neural network. The BP neural network completes one forward propagation by using multi-scale fusion feature vectors and outputs the predicted fault diagnosis result. The error between the predicted fault diagnosis result and the actual fault type is calculated. The error value is calculated for all wolves in the wolf pack. The three wolves with the smallest error values are selected as the guide wolves, and the remaining wolves are all Omega wolves. The algorithm calculates the distance between the Omega wolf and the guide wolf, updates the parameters of the Omega wolf based on the distance, and moves the Omega wolf toward the guide wolf. When all errors are less than the preset value, the iteration stops, and the optimal parameters of the wolf pack are obtained. The optimal parameters of the wolf pack are decoded into the optimal weights and thresholds of the BP neural network, resulting in the optimized GWO-BP neural network.
5. A power system fault diagnosis method according to claim 1, characterized in that, The specific process of using the Feature Attention Mechanism (FAM) to weight and fuse different features to form a multi-scale fused feature vector is as follows: the time-domain features, frequency-domain features, transient features, and fluctuation features are multiplied by their corresponding attention weights, and then the weighted feature vectors are concatenated or summed element by element to obtain the multi-scale fused feature vector; the correlation coefficient is calculated by Pearson correlation analysis or mutual information entropy to characterize the correlation strength between various feature vectors and power system fault types.
6. The power system fault diagnosis method according to claim 1, characterized in that, The fault diagnosis types include: voltage fault, short circuit fault, open circuit fault, overload fault, frequency abnormality, phase loss fault, and no fault state.
7. A power system fault diagnosis method according to claim 1, characterized in that, The raw electrical data includes voltage, current, frequency, load power, and timestamp.
8. A power system fault diagnosis system, characterized in that, include: The data acquisition module is used to collect raw electrical data of equipment and lines under the operating status of the target power system in real time; The feature extraction module is used to extract time-domain features, frequency-domain features, transient features, and fluctuation features related to fault type from the original electrical data; The different features are weighted and fused using a Feature Attention (FAM) mechanism to form a multi-scale fused feature vector. The GWO-BP neural network training module is used to optimize the preset BP neural network parameters using the Grey Wolf Optimization Algorithm (GWO); input the multi-scale fused feature vector into the preset BP neural network to obtain the predicted fault diagnosis type; calculate the error between the predicted fault diagnosis type and the actual fault type; use the error to iteratively train the preset BP neural network parameters; when the average error in the iteration is less than a preset value, the iteration stops, and the optimized GWO-BP model is obtained; the GWO-BP model is used to diagnose the fault type of the target power system.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is able to perform the steps of the method according to any one of claims 1 to 7.