Line loss identification model training method and device, line loss detection method and device and storage medium
By preprocessing and clustering the electrical parameters of electrical equipment in the power grid, extracting line loss features and training support vector machine models, the accuracy and efficiency problems of power grid line loss analysis are solved, and more efficient power grid operation and energy consumption are achieved. reduce.
Patent Information
- Application Number
- CN202411491010.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-01-24
AI Technical Summary
There are problems such as data noise and data loss in the power grid, which leads to a reduction in the accuracy of the analysis results. The existing algorithms are large in calculations and slow in processing speed, and low efficiency and accuracy.
By pre -processing the original electrical parameters related to the electrical equipment specified in the power grid, the cluster of the cluster of the cluster of the cluster of multiple signs is excavated, and the line loss mode is extracted from the cluster Features, according to these features, support vector machine training as a line loss recognition model.
Effectively improve the efficiency and accuracy of the analysis of power grid line loss, optimize the operation of the grid and reduce energy consumption.
Smart Images

Figure CN119357798A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of power grid line loss analysis, and in particular to a line loss identification model training, a line loss detection method, a device and a storage medium. Background Art
[0002] In the power grid, line loss refers to the loss of electric energy during transmission due to resistance and other reasons, which affects the economic benefits of power companies and the stable operation of the power grid. With the gradual opening of the power market and the intensification of competition, improving the accurate analysis of power grid line loss has become one of the important issues that the power industry needs to solve urgently.
[0003] At present, the line loss analysis in the power grid relies on a large amount of high-quality historical data and real-time data. However, there are problems such as noise and data loss in the data collection of the power grid, which reduces the accuracy of the analysis results. In order to improve the accuracy of line loss analysis, complex algorithms are used. When processing large-scale power grids, the calculation amount is large and the processing speed is slow, resulting in low efficiency and accuracy of line loss analysis. Summary of the invention
[0004] The present invention provides a line loss identification model training, a line loss detection method, a device and a storage medium, which are used to improve the efficiency and accuracy of power grid line loss analysis.
[0005] In a first aspect, an embodiment of the present invention provides a line loss identification model training method, comprising:
[0006] Collect original electrical parameters related to line loss for designated electrical equipment in the power grid;
[0007] Preprocessing the original electrical parameters to obtain target electrical parameters;
[0008] Clustering the target electrical parameters to mine multiple clusters representing line loss patterns;
[0009] In the cluster, extracting electrical features of the line loss pattern being normal and / or abnormal from the target electrical parameters of the electrical device;
[0010] A preset support vector machine is trained as a line loss recognition model according to the electrical characteristics of the cluster.
[0011] In a second aspect, an embodiment of the present invention further provides a line loss detection method, including:
[0012] Collect original electrical parameters related to line loss for designated electrical equipment in the power grid;
[0013] Preprocessing the original electrical parameters to obtain target electrical parameters;
[0014] extracting electrical features from the target electrical parameters of the electrical device;
[0015] The electrical feature is input into a line loss identification model trained according to the line loss identification model training method provided in the first aspect to identify whether the line loss pattern of the electrical device is normal or abnormal.
[0016] In a third aspect, an embodiment of the present invention further provides a line loss identification model training device, comprising:
[0017] The parameter collection module is used to collect the original electrical parameters related to line loss of the specified electrical equipment in the power grid;
[0018] A parameter preprocessing module, used for preprocessing the original electrical parameters to obtain target electrical parameters;
[0019] A parameter clustering module, used for clustering the target electrical parameters to mine multiple clusters representing line loss patterns;
[0020] a feature extraction module, configured to extract, in the cluster, electrical features indicating that the line loss mode is normal and / or abnormal from the target electrical parameters of the electrical equipment;
[0021] A model training module is used to train a preset support vector machine into a line loss recognition model according to the electrical characteristics of the cluster.
[0022] In a fourth aspect, an embodiment of the present invention further provides a line loss detection device, including:
[0023] The original electrical parameter acquisition module is used to collect the original electrical parameters related to line loss of the specified electrical equipment in the power grid;
[0024] A target electrical parameter acquisition module, used for preprocessing the original electrical parameters to obtain target electrical parameters;
[0025] An electrical feature extraction module, used to extract electrical features from the target electrical parameters of the electrical device;
[0026] The line loss pattern recognition module is used to input the electrical characteristics into the line loss recognition model trained according to the line loss recognition model training method provided in the first aspect to identify whether the line loss pattern of the electrical equipment is normal or abnormal.
[0027] In a fifth aspect, an embodiment of the present invention further provides a computer device, including:
[0028] one or more processors;
[0029] A storage device for storing one or more programs;
[0030] When the one or more programs are executed by the one or more processors, the one or more processors implement the line loss identification model training method provided in the first aspect of the present invention, or the line loss detection method provided in the second aspect of the present invention.
[0031] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a line loss identification model training method as provided in the first aspect of the present invention, or a line loss detection method as provided in the second aspect of the present invention.
[0032] In a seventh aspect, an embodiment of the present invention further provides a computer program product, comprising a computer program, and when the computer program is executed by a processor, it implements the line loss identification model training method provided in the first aspect of the present invention, or the line loss detection method provided in the second aspect of the present invention.
[0033] In an embodiment of the present invention, original electrical parameters related to line loss are collected from designated electrical equipment in a power grid, the original electrical parameters are preprocessed to obtain target electrical parameters, and the target electrical parameters are clustered to mine multiple clusters that characterize line loss patterns. In the clusters, electrical features of normal and / or abnormal line loss patterns are extracted from the target electrical parameters of the electrical equipment, and a preset support vector machine is trained as a line loss recognition model based on the electrical features of the clusters. By collecting original electrical parameters related to line loss from designated electrical equipment in a power grid, and performing preprocessing and clustering, different line loss patterns can be effectively mined, normal and abnormal electrical features can be extracted, and a clear classification basis is provided for the training of the support vector machine model, and the support vector machine model is trained as a line loss recognition model, thereby improving the efficiency and accuracy of power grid line loss analysis. On the other hand, original electrical parameters related to line loss are collected from designated electrical equipment in the power grid, and the original electrical parameters are preprocessed to obtain target electrical parameters. Electrical features are extracted from the target electrical parameters of the electrical equipment, and the electrical features are input into the line loss identification model to identify whether the line loss mode of the electrical equipment is normal or abnormal, optimize the operation of the power grid, reduce energy consumption, and improve the efficiency and accuracy of the power grid line loss analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A flow chart of a line loss identification model training method provided in Embodiment 1 of the present invention;
[0035] Figure 2 A flow chart of a line loss detection method provided in Embodiment 2 of the present invention;
[0036] Figure 3 A structural block diagram of a line loss identification model training device provided in Embodiment 3 of the present invention;
[0037] Figure 4 A structural block diagram of a line loss detection device provided in Embodiment 4 of the present invention;
[0038] Figure 5 A schematic diagram of the structure of a computer device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can cover sequential implementations other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] Embodiment 1
[0042] See also Figure 1 , shows a flow chart of a line loss identification model training method provided by the first embodiment of the present invention, the method can be executed by a line loss identification model training device, the line loss identification model training device can be implemented in the form of hardware and / or software, and the line loss identification model training device can be configured in a computer device. Figure 1 As shown, the method includes:
[0043] Step 101: Collect original electrical parameters related to line loss from designated electrical equipment in the power grid.
[0044] The power grid refers to the power transmission and distribution system consisting of power plants, substations, transmission lines and distribution systems. It is responsible for transmitting electrical energy from the power generation source to consumers, ensuring a stable supply of electricity. The power grid is divided into different voltage levels, including high voltage, low voltage, etc., to ensure that the power needs of different users can be met.
[0045] Line loss in the power grid refers to the loss of electric energy due to resistance, thermal effects, etc. during the transmission process. It usually manifests itself as the conversion of electricity into heat energy in the transmission line and cannot be effectively used. Line loss not only increases the operating costs of power companies, but also affects the efficiency of the power grid. Therefore, reducing line loss is one of the keys to improving the efficiency of the power grid.
[0046] In this embodiment, the electrical equipment includes smart meters and sensor networks, and the historical original electrical parameters related to line loss are collected for these designated electrical equipment. The original electrical parameters include voltage, current, power factor and other parameters. Each smart meter is installed at different nodes of the low-voltage distribution network to capture the power consumption information of these nodes. Each node in the sensor network digitizes the collected signal.
[0047] For example, in the process of collecting the original electrical parameters related to line loss for the specified electrical equipment in the power grid, it usually involves sampling and digital processing of AC voltage and current signals. The sampling frequency is set to fs. According to the Nyquist sampling theorem, the sampling frequency fs must be at least twice the highest frequency of the collected signal f. Usually, fs is selected to be above 50kHz to ensure accurate capture of high-frequency harmonics. The formula for collecting the original electrical parameter signal is as follows:
[0048]
[0049] Among them, x i [n] is the original electrical parameter signal collected, X is the amplitude, f is the frequency of the original electrical parameter signal collected, t is the sampling time, For phase.
[0050] After sampling is completed, the collected data is quantized and converted into digital signals through an analog-to-digital converter. Assuming that there are a total of N original electrical parameters (i.e., sampling points) in the power grid, the spectrum of the sampled original electrical parameter signal can be calculated by fast Fourier transform (FFT). The specific formula for calculating the spectrum of the original electrical parameter signal is as follows:
[0051]
[0052] Wherein, X(k) represents the frequency spectrum of the original electrical parameter, N represents the number of the original electrical parameters, k represents the frequency, x[n] represents the nth original electrical parameter, and j represents the imaginary unit.
[0053] By analyzing the spectrum of the original electrical parameters calculated, the effective value and phase information of voltage and current can be extracted, and the power factor PF can be further calculated:
[0054]
[0055] Among them, PF represents power factor, P represents active power, and Q represents reactive power.
[0056] For example, at a certain moment, the effective value of the voltage signal collected is 220V, the effective value of the current signal is 10A, and the power factor is 0.9, from which the active power P of the node can be calculated as 1980W and the reactive power Q as 960VAR. These calculation results will be used as the original electrical parameters for subsequent line loss analysis.
[0057] Step 102: pre-process the original electrical parameters to obtain target electrical parameters.
[0058] In this embodiment, the collected original electrical parameters are preprocessed to obtain target electrical parameters, thereby improving the accuracy and availability of the target electrical parameters, which helps to more accurately analyze the performance of electrical equipment and monitor the operating status of the power grid, thereby optimizing the operating efficiency and safety of the power grid.
[0059] Exemplarily, the preprocessing of the original electrical parameters may be performed by performing the following steps:
[0060] Step 1021: Clean abnormal values from the original electrical parameters.
[0061] In this embodiment, outliers are usually caused by measurement errors, equipment failures, or external interference, which can distort the original electrical parameter distribution and lead to inaccurate analysis results. By identifying and removing these outliers in the original electrical parameters, the quality of the original electrical parameters can be improved, so that subsequent analysis can more truly reflect the actual situation of the power grid.
[0062] Specifically, the standard deviation method is used to calculate the mean and standard deviation of all original electrical parameters, and the absolute value of the difference between each original electrical parameter and the mean value is taken to obtain the deviation value, and the deviation value is compared with the abnormal threshold, where the abnormal threshold is the product of the preset abnormal coefficient and the standard deviation; if the deviation value is greater than the abnormal threshold, the original electrical parameter is determined to be an abnormal value, and the average value of the neighborhood value is used to replace or interpolate the abnormal value to complete the cleaning of the abnormal value, and the neighborhood value is the original electrical parameter adjacent to the abnormal value. The conditions for judging whether the original electrical parameter is an abnormal value are as follows:
[0063] |v i -u v |>k·σ v ;
[0064] Among them, v i is the original electrical parameter, u v is the average value of the original electrical parameters, |v i -u v | is the deviation value, k is the abnormal coefficient, ranging from 2 to 3, σv is the standard deviation of the original electrical parameters.
[0065] Step 1022: If the cleaning is completed, the original electrical parameters are normalized using the minimum-maximum scaling method to obtain the target electrical parameters.
[0066] In this embodiment, if the original electrical parameters have been cleaned of abnormal values, the minimum-maximum scaling method is used to perform a normalization operation on the original electrical parameters, which can effectively eliminate the dimensional influence between different features of the original electrical parameters, reduce the analysis deviation caused by the range difference of the original electrical parameters, and provide a reliable basis for subsequent line loss analysis. For example, if the current data in the original electrical parameters of a certain node is 5A, 10A, 15A, then after normalization, it is 0, 0.5, 1. In addition, by handling special cases, such as when the maximum value is equal to the minimum value, the correctness of the original electrical parameter processing can be ensured to obtain the target electrical parameters.
[0067] The original electrical parameters are normalized using the minimum and maximum scaling method, as shown below:
[0068]
[0069] Wherein, x represents the original electrical parameter, x′ represents the target electrical parameter, max(x) represents the maximum value of the original electrical parameter, and min(x) represents the minimum value of the original electrical parameter.
[0070] Step 103: cluster the target electrical parameters to mine multiple clusters representing line loss patterns.
[0071] In this embodiment, the k-means algorithm is used to cluster the target electrical parameters to mine multiple clusters that characterize the line loss pattern, which can better understand and identify different line loss behaviors in the power grid. This process can classify target electrical parameters with similar characteristics into one category, helping to distinguish normal and abnormal states in the line loss pattern.
[0072] The k-means algorithm is simple to implement, easy to understand, and has a fast calculation speed, making it particularly suitable for processing large-scale data sets. Since the k-means algorithm is based on mean calculation, it can obtain relatively reasonable clustering results in a relatively short period of time. In addition, k-means can be easily combined with other algorithms and technologies, making it easy to expand and apply.
[0073] In one embodiment of the present invention, step 103 may include the following steps:
[0074] Step 1031, determine the k value.
[0075] In this embodiment, selecting an appropriate k value can ensure that the target electrical parameters are effectively divided into clusters with similar characteristics, so that the clustering model can more accurately reflect the intrinsic structure of the target electrical parameters. If the k value is too small, it may cause information loss and fail to capture the complexity of the target electrical parameters; if the k value is too large, it may cause overfitting, increase noise and unnecessary complexity. Therefore, a reasonable selection of the k value can improve the interpretability and practicality of the clustering results, which is helpful for subsequent analysis.
[0076] In one embodiment of the present invention, step 1031 may include the following steps:
[0077] S10311. Set the objective function.
[0078] In this embodiment, an objective function is set to quantify the total square distance between the target electrical parameters of the electrical equipment in the cluster and the center point, and the clustering effect is optimized by minimizing this distance. A smaller objective function value indicates a better clustering effect, which can effectively measure the clustering quality under different k values. In addition, the objective function provides a clear direction for optimizing the k-means clustering algorithm, which helps to select a suitable k value and ultimately improve the quality of the clustering results.
[0079] The objective function is as follows:
[0080]
[0081] Among them, J represents the objective function value, k represents the k value, μ i Represents cluster C i The center point in j Represents cluster C i Target electrical parameters of electrical equipment in C i represents the i-th cluster.
[0082] S10312. With the optimization of the objective function as the goal, use the elbow rule to determine multiple k values.
[0083] The elbow rule is a method for selecting the best k value in k-means clustering. The elbow rule plots the objective function value for different k values and observes the change in the curve. As the k value increases, the objective function value usually decreases, but after a certain point, the decline slows down, forming a shape similar to an "elbow". This position usually indicates that increasing the number of clusters will have limited improvement on the objective function value, and the k value here is the potential optimal number of clusters.
[0084] In this embodiment, with the optimization of the objective function as the goal, the elbow rule is used to effectively avoid selecting a k value that is too small or too large, and multiple potential k values are determined, so that multiple potential k values are analyzed and the optimal k value is selected to ensure that the clustering results can effectively capture the intrinsic structure of the data without overfitting, thereby improving the accuracy and interpretability of the clustering.
[0085] S10313. Calculate the silhouette coefficient for each k value.
[0086] In this embodiment, the silhouette coefficient of multiple k values determined using the elbow rule is calculated. The silhouette coefficient measures the difference between the similarity of each target electrical parameter with other target electrical parameters in its cluster and the similarity of the target electrical parameters in the nearest cluster. The value range is from -1 to 1. The closer the value is to 1, the better the clustering effect. Calculating the silhouette coefficient at different k values can help identify the best k value, so as to select one that can fully express the internal structure of the target electrical parameter and improve the accuracy and reliability of clustering. The formula for calculating the silhouette coefficient of each k value is as follows:
[0087]
[0088] Where S represents the silhouette coefficient, a(i) represents the average distance between the i-th target electrical parameter of the cluster and other electrical parameters in the same cluster, b(i) represents the average distance between the i-th target electrical parameter of the cluster and the nearest other clusters, and max represents the maximum value.
[0089] S10314. Select the k value with the highest silhouette coefficient.
[0090] In this embodiment, the result of the elbow rule and the size of the silhouette coefficient are combined to select the k value with the highest corresponding silhouette coefficient among multiple k values as the final optimal cluster number. This k value can effectively reduce the distance within the cluster and ensure the rationality and interpretability of the clustering results.
[0091] Step 1032: Initialize k clusters.
[0092] In this embodiment, after the k value is determined, k clusters are randomly initialized, each cluster having a center point, thereby ensuring the diversity and randomness of the clustering process and reducing local optimal solutions.
[0093] Specifically, the target electrical parameter of an electrical device is randomly selected as the center point of the cluster, and the square of the distance between the target electrical parameters of other electrical devices except the center point and the center point is calculated as the distribution distance. The purpose of this step is to measure the relative position of each target electrical parameter to the center point of the current cluster.
[0094] After obtaining the distribution distance, the distribution distance is normalized to obtain the probability distribution information. The normalization process divides each distribution distance value by the sum of all distribution distance values to obtain a proportional value ranging from 0 to 1. These proportional values represent the relative likelihood of each target electrical parameter being selected as the new center point, thus forming a probability distribution. According to the probability distribution information, one of the target electrical parameters of an electrical device is randomly selected as the center point of the cluster. This selection process makes the target electrical parameters farther away from the current center point more likely to be selected as the new center point, thereby avoiding excessive concentration of the center point.
[0095] After the center point is selected, it is determined whether the number of center points is k; if so, it is determined that the initialization of k clusters is completed; if not, it returns to calculate the square of the distance between the target electrical parameters of other electrical equipment except the center point and the center point as the distribution distance. This cyclic mechanism ensures the effectiveness and reliability of the clustering results.
[0096] Step 1033: For the same electrical equipment, calculate the distance between the target electrical parameter and each center point.
[0097] In this embodiment, for each electrical device, the distance between the target electrical parameter and each center point is calculated, and the similarity between each electrical device and different clusters is accurately evaluated, thereby achieving reasonable classification and attribution.
[0098] Specifically, for the same electrical equipment, the weights configured for each target electrical parameter are queried. The weights can be determined through historical data analysis, expert experience, or line loss sensitivity testing. For example, features such as current and voltage are usually given higher weights to reflect their greater impact on line loss. After the weight query is completed, for each center point, the square root of the sum of the products of the weight and the feature deviation is taken to obtain the distance between the target electrical parameter and each center point; the feature deviation is the square of the difference between the target electrical parameter and the center point in the same dimension.
[0099] The same dimension refers to the corresponding feature dimension in the feature space of the target electrical parameter and the center point. For example, the target electrical parameters of electrical equipment may include multiple features such as current, voltage, and power factor. These parameters each occupy a dimension in the feature space. When calculating the feature deviation between the target electrical parameter and the center point, the difference between each specific feature (such as current or voltage) is calculated and squared. In this way, the dimensions corresponding to the feature deviation are consistent, ensuring that the distance calculation accurately reflects the differences in the electrical equipment in each feature dimension. This allows for more accurate classification in the clustering process. The specific distance calculation formula is as follows:
[0100]
[0101] Among them, d w (x j ,u i ) represents the distance, x jm represents the target electrical parameter, u im Indicates that at the center point, w m represents the weight of the target electrical parameter configuration, and M represents the total number of features in the target electrical parameter.
[0102] Step 1034: Allocate the electrical device to the cluster with the smallest distance.
[0103] In this embodiment, the purpose of clustering the target electrical parameters is to identify and mine different line loss patterns, and the electrical equipment is assigned to the cluster with the smallest distance because the center point of the cluster with the smallest distance can best represent the characteristic state of the equipment. In this way, electrical equipment with similar characteristics can be effectively classified into the same category, thereby ensuring that each cluster can accurately reflect a specific line loss pattern.
[0104] Step 1035: If all target electrical parameters have been assigned, the center point is updated in each cluster.
[0105] In this embodiment, if all target electrical parameters are assigned, the center point is updated in each cluster to reflect the characteristic state of the electrical equipment in the current cluster, ensuring that the center point more accurately represents the overall characteristics of the cluster. This process is one of the important steps of the iterative clustering algorithm, which aims to improve the representativeness and accuracy of the cluster, so that the final cluster can more effectively characterize the line loss mode and provide more reliable basic data for subsequent analysis.
[0106] Specifically, in each cluster, the weighted eigenvalue and weighted amount are calculated in the same dimension. In the same dimension, the ratio between the weighted eigenvalue and the weighted amount is assigned to the center point. The weighted eigenvalue is the sum of the product between the weight and the target electrical parameter, and the weighted amount is the sum of the weight. The formula for updating the center point in each cluster is as follows:
[0107]
[0108] Among them, μ im represents the new center point of the i-th cluster, C i represents all target electrical parameters in the ith cluster, w m represents the weight of the target electrical parameter configuration, x jm represents the target electrical parameter, x j represents a target electrical parameter in this cluster, represents the weighted eigenvalue, Represents the weighted amount.
[0109] Step 1036, determine whether the center point meets the preset convergence condition; if so, execute step 1037; if not, return to execute step 1033.
[0110] In this embodiment, judging whether the center point meets the preset convergence condition is to evaluate the stability and effectiveness of the clustering process. If the center point does not change significantly in multiple iterations, it means that the clustering has converged, reflecting the stable mode of the data. At this time, it can be determined that the cluster represents the line loss mode; on the contrary, if the center point is still changing, it means that the current cluster division may not be accurate or stable enough, so it is necessary to recalculate the distance between the target electrical parameter and the center point to further optimize the clustering results. This judgment link ensures the effectiveness and reliability of the clustering algorithm, thereby obtaining more accurate analysis results.
[0111] Step 1037: Determine the cluster characterization line loss mode.
[0112] In this embodiment, if the center point does not change significantly in multiple iterations, it means that the clustering has converged, reflecting the stable mode of the target electrical parameter. At this time, it can be determined that the cluster represents the line loss mode, and subsequent analysis can be performed.
[0113] Step 104: In the cluster, extract electrical features of normal and / or abnormal line loss patterns from target electrical parameters of the electrical equipment.
[0114] In this embodiment, after clustering the target electrical parameters, normal and / or abnormal electrical features of the line loss pattern are extracted from the target electrical parameters of the electrical equipment, which helps to identify and analyze different states in the operation of the power grid. By extracting these electrical features, the behavior of the electrical equipment in normal operation and abnormal conditions can be better understood, thereby providing a data basis for the subsequent training of the line loss identification model.
[0115] Exemplarily, LASSO (least absolute shrinkage and selection algorithm) can be used to extract electrical features of normal and / or abnormal line loss patterns from target electrical parameters of electrical equipment. LASSO is a linear regression method that introduces L1 regularization for feature selection and model optimization. Specifically, LASSO can effectively identify important features related to line loss while suppressing those irrelevant or redundant features, thereby improving the interpretability and predictive performance of the model. This method is particularly suitable for high-dimensional data sets because it can handle collinearity problems between features and avoid overfitting.
[0116] Step 105: training a preset support vector machine into a line loss recognition model according to the electrical characteristics of the cluster.
[0117] In this embodiment, based on the extracted electrical features, the preset support vector machine is trained as a line loss recognition model, and the recognition ability of the line loss recognition model is enhanced by using normal and / or abnormal features, so that it can effectively distinguish different line loss states and improve the accuracy and reliability of line loss monitoring and management.
[0118] Exemplarily, the training goal of a support vector machine (SVM) is to find a hyperplane that maximizes the interval (or boundary) between different categories. This means that the SVM tries to find the best position to separate data points of different categories so that the distance from the point closest to the hyperplane (support vector) to the hyperplane is as large as possible. The reason for this is that maximizing the interval helps to improve the robustness and accuracy of the classification, reduce the error of the model on unseen electrical features, and thus enhance the performance and reliability of the model in practical applications. During the training process of the support vector machine, a decision boundary is also defined to separate normal electrical features from potentially abnormal electrical features. The decision function is as follows:
[0119] y = sin(w·x+b);
[0120] Among them, the y value is used to determine whether the input electrical characteristics are normal or abnormal, w represents the weight, x represents the input electrical characteristics, and b represents the bias; if the y value is positive, it means that the electrical characteristics are normal; if it is negative, it means that the electrical characteristics may be abnormal.
[0121] In an embodiment of the present invention, original electrical parameters related to line loss are collected from designated electrical equipment in a power grid, the original electrical parameters are preprocessed to obtain target electrical parameters, and the target electrical parameters are clustered to mine multiple clusters that characterize line loss patterns. In the clusters, electrical features of normal and / or abnormal line loss patterns are extracted from the target electrical parameters of the electrical equipment, and a preset support vector machine is trained as a line loss recognition model based on the electrical features of the clusters. By collecting original electrical parameters related to line loss from designated electrical equipment in a power grid, and performing preprocessing and clustering, different line loss patterns can be effectively mined, normal and abnormal electrical features can be extracted, and a clear classification basis is provided for the training of the support vector machine model, and the support vector machine is trained as a line loss recognition model, thereby improving the efficiency and accuracy of power grid line loss analysis.
[0122] Embodiment 2
[0123] See also Figure 2 , shows a flow chart of a line loss detection method provided by the second embodiment of the present invention, the method can be executed by a line loss detection device, the line loss detection device can be implemented in the form of hardware and / or software, and the line loss detection device can be configured in a computer device. Figure 2 As shown, the method includes:
[0124] Step 201: Collect original electrical parameters related to line loss from designated electrical equipment in the power grid.
[0125] In this embodiment, the original electrical parameters related to line loss are collected in real time for the specified electrical equipment in the power grid, providing basic data for subsequent analysis. By real-time monitoring and recording of parameters such as current, voltage, and power factor, the operating status and line loss of the electrical equipment can be deeply understood.
[0126] Step 202: pre-process the original electrical parameters to obtain target electrical parameters.
[0127] In one embodiment of the present invention, outliers are cleaned from the original electrical parameters; if the cleaning is completed, a minimum-maximum scaling method is used to perform a normalization operation on the original electrical parameters to obtain target electrical parameters.
[0128] Among them, cleaning abnormal values in the original electrical parameters includes: statistically calculating the mean value and standard deviation in all original electrical parameters, taking the absolute value of the difference between each original electrical parameter and the mean value, and obtaining the deviation value; if the deviation value is greater than the abnormal threshold, the original electrical parameter is determined to be an abnormal value; the abnormal threshold is the product of a preset abnormal coefficient and the standard deviation; using the average value of the neighborhood value to replace or interpolate the abnormal value to complete the cleaning of the abnormal value; the neighborhood value is the original electrical parameter adjacent to the abnormal value.
[0129] Step 203: extract electrical features from target electrical parameters of the electrical device.
[0130] In this embodiment, electrical features are extracted from the target electrical parameters of the electrical equipment to provide effective information for subsequent line loss identification. By applying various feature extraction techniques, such as statistical analysis, signal processing, and machine learning algorithms, electrical features related to line loss, such as current, voltage fluctuations, power factor, etc., can be identified. These extracted electrical features can effectively reflect the operating status of the electrical equipment, help distinguish normal and abnormal line loss patterns, and provide high-quality data support for the input of the subsequent line loss identification model, thereby improving the accuracy and reliability of line loss identification.
[0131] Step 204: Input the electrical characteristics into a line loss identification model to identify whether the line loss pattern of the electrical device is normal or abnormal.
[0132] In this embodiment, the electrical features extracted from the electrical equipment are input into the line loss identification model trained according to the method provided in the first embodiment. The line loss identification model can analyze the input electrical features, determine the line loss situation of the electrical equipment during operation, and thus identify whether the line loss pattern of the electrical equipment is normal or abnormal.
[0133] In an embodiment of the present invention, original electrical parameters related to line loss are collected from designated electrical equipment in a power grid, the original electrical parameters are preprocessed to obtain target electrical parameters, electrical features are extracted from the target electrical parameters of the electrical equipment, and the electrical features are input into a line loss identification model to identify whether the line loss mode of the electrical equipment is normal or abnormal, thereby optimizing power grid operation, reducing energy consumption, and improving the efficiency and accuracy of power grid line loss analysis.
[0134] Embodiment 3
[0135] Figure 3 A schematic diagram of the structure of a line loss identification model training device provided in the third embodiment of the present invention is shown in FIG. Figure 3 As shown, the device comprises:
[0136] The parameter collection module 301 is used to collect original electrical parameters related to line loss from the specified electrical equipment in the power grid;
[0137] A parameter preprocessing module 302 is used to preprocess the original electrical parameters to obtain target electrical parameters;
[0138] A parameter clustering module 303, used to cluster the target electrical parameters to mine multiple clusters representing line loss patterns;
[0139] A feature extraction module 304 is used to extract electrical features of the line loss mode being normal and / or abnormal from the target electrical parameters of the electrical equipment in the cluster;
[0140] The model training module 305 is used to train a preset support vector machine into a line loss recognition model according to the electrical characteristics of the cluster.
[0141] In one embodiment of the present invention, the parameter preprocessing module 302 includes:
[0142] An outlier cleaning module, used for cleaning outliers in the original electrical parameters;
[0143] The parameter normalization module is used to perform a normalization operation on the original electrical parameters using a minimum-maximum scaling method to obtain target electrical parameters if the cleaning is completed.
[0144] In one embodiment of the present invention, the outlier cleaning module includes:
[0145] A mean value and standard deviation statistics module, used for calculating the mean value and standard deviation of all the original electrical parameters;
[0146] A deviation value acquisition module, used for taking an absolute value of a difference between each of the original electrical parameters and the average value to obtain a deviation value;
[0147] An abnormal value determination module, used for determining that the original electrical parameter is an abnormal value if the deviation value is greater than an abnormal threshold; the abnormal threshold is the product of a preset abnormal coefficient and the standard deviation;
[0148] The average value using module is used to replace or interpolate the abnormal value with the average value of the neighborhood value to complete the cleaning of the abnormal value; the neighborhood value is the original electrical parameter adjacent to the abnormal value.
[0149] In one embodiment of the present invention, the parameter clustering module 303 includes:
[0150] A k value determination module, used to determine the k value;
[0151] k cluster initialization modules, used to initialize k clusters; each of the clusters has a center point;
[0152] A distance calculation module, used for calculating the distance between the target electrical parameter and each of the center points for the same electrical device;
[0153] An electrical device allocation module, configured to allocate the electrical device to the cluster with the smallest distance;
[0154] A center point updating module, configured to update the center point in each of the clusters if all the target electrical parameters have been assigned;
[0155] A condition judgment module, used to judge whether the center point meets the preset convergence condition; if so, execute the line loss mode determination module; if not, return to execute the distance calculation module;
[0156] The line loss mode determination module is used to determine the cluster characterization line loss mode.
[0157] In one embodiment of the present invention, the k value determination module includes:
[0158] An objective function setting module, used to set an objective function; the objective function represents the total square distance between the target electrical parameter of the electrical equipment in the cluster and the center point;
[0159] An objective function optimization module, used to determine multiple k values using the elbow rule with the goal of optimizing the objective function;
[0160] A silhouette coefficient calculation module, used to calculate the silhouette coefficient of each k value;
[0161] The k value selection module is used to select the k value with the highest silhouette coefficient.
[0162] In one embodiment of the present invention, the k cluster initialization modules include:
[0163] A center point random selection module, used for randomly selecting one of the target electrical parameters of the electrical equipment as the center point of a cluster;
[0164] A distribution distance calculation module, used for calculating the square of the distance between the target electrical parameters of the other electrical devices except the central point and the central point as the distribution distance;
[0165] A probability distribution information acquisition module is used to normalize the distribution distance to obtain probability distribution information;
[0166] A center point determination module, configured to randomly select one of the target electrical parameters of the electrical device as the center point of a cluster according to the probability distribution information;
[0167] A center point number determination module is used to determine whether the number of the center points is k; if so, the cluster completion initialization module is executed; if not, the distribution distance calculation module is returned to execute;
[0168] The cluster initialization completion module is used to determine the completion of initialization of k clusters.
[0169] In one embodiment of the present invention, the distance calculation module includes:
[0170] A weight query module, used for querying the weights configured for each target electrical parameter for the same electrical device;
[0171] The distance acquisition module is used to obtain the distance between the target electrical parameter and each of the center points by taking the square root of the sum of the products of the weight and the characteristic deviation for each of the center points; the characteristic deviation is the square of the difference between the target electrical parameter and the center point in the same dimension.
[0172] In one embodiment of the present invention, the central point updating module includes:
[0173] A weighted eigenvalue and weighted amount calculation module, used to calculate the weighted eigenvalue and weighted amount in each cluster under the same dimension; the weighted eigenvalue is the sum of the products of the weight and the target electrical parameter, and the weighted amount is the sum of the weights;
[0174] A ratio assignment module is used to assign the ratio between the weighted feature value and the weighted amount to the center point in the same dimension.
[0175] The line loss identification model training device provided in the embodiment of the present invention can execute the line loss identification model training method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the line loss identification model training method.
[0176] Embodiment 4
[0177] Figure 4 A schematic diagram of the structure of a line loss detection device provided in Embodiment 4 of the present invention is shown in FIG. Figure 4 As shown, the device comprises:
[0178] The original electrical parameter collection module 401 is used to collect the original electrical parameters related to line loss from the specified electrical equipment in the power grid;
[0179] A target electrical parameter acquisition module 402 is used to pre-process the original electrical parameters to obtain target electrical parameters;
[0180] An electrical feature extraction module 403, used to extract electrical features from the target electrical parameters of the electrical device;
[0181] The line loss pattern recognition module 404 is used to input the electrical characteristics into the line loss recognition model trained according to the method provided in the first embodiment of the present invention to recognize whether the line loss pattern of the electrical device is normal or abnormal.
[0182] In one embodiment of the present invention, the target electrical parameter acquisition module 402 includes:
[0183] A cleaning module, used for cleaning abnormal values in the original electrical parameters;
[0184] The normalization module is used to perform a normalization operation on the original electrical parameters using a minimum-maximum scaling method to obtain target electrical parameters if the cleaning is completed.
[0185] In one embodiment of the present invention, the cleaning module comprises:
[0186] A statistical module, used for calculating the average value and standard deviation of all the original electrical parameters;
[0187] A deviation value calculation module, used for taking the absolute value of the difference between each of the original electrical parameters and the average value to obtain a deviation value;
[0188] A deviation value comparison module, used for determining that the original electrical parameter is an abnormal value if the deviation value is greater than an abnormal threshold value; the abnormal threshold value is the product of a preset abnormal coefficient and the standard deviation;
[0189] The cleaning completion module is used to replace or interpolate the abnormal value with the average value of the neighborhood value to complete the cleaning of the abnormal value; the neighborhood value is the original electrical parameter adjacent to the abnormal value.
[0190] The line loss detection device provided in the embodiment of the present invention can execute the line loss detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the line loss detection method.
[0191] Embodiment 5
[0192] See also Figure 5 , showing a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. The computer device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, blade servers, mainframe computers, and other suitable computers. The computer device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0193] like Figure 5 As shown, the computer device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the computer device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0194] A number of components in the computer device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the computer device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0195] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the line loss identification model training method, or the line loss detection method.
[0196] In some embodiments, the line loss identification model training method, or the line loss detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the computer device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the line loss identification model training method, or the line loss detection method described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the line loss identification model training method, or the line loss detection method, in any other appropriate manner (e.g., by means of firmware).
[0197] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0198] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0199] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0200] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0201] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0202] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0203] Embodiment 6
[0204] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the line loss identification model training method or the line loss detection method provided in any embodiment of the present invention.
[0205] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0206] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0207] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A line loss identification model training method, characterized in that: include: Collect original electrical parameters related to line loss for designated electrical equipment in the power grid; Preprocessing the original electrical parameters to obtain target electrical parameters; Clustering the target electrical parameters to mine multiple clusters representing line loss patterns; In the cluster, extracting electrical features of the line loss pattern being normal and / or abnormal from the target electrical parameters of the electrical device; A preset support vector machine is trained as a line loss recognition model according to the electrical characteristics of the cluster.
2. The method according to claim 1, characterized in that: The preprocessing of the original electrical parameters to obtain target electrical parameters includes: cleaning abnormal values in the raw electrical parameters; If the cleaning is completed, the original electrical parameters are normalized using the minimum-maximum scaling method to obtain the target electrical parameters.
3. The method according to claim 2, characterized in that The step of cleaning abnormal values from the original electrical parameters comprises: Calculate the mean value and standard deviation of all the raw electrical parameters; Taking the absolute value of the difference between each of the original electrical parameters and the average value to obtain a deviation value; If the deviation value is greater than the abnormal threshold, the original electrical parameter is determined to be an abnormal value; the abnormal threshold is the product of a preset abnormal coefficient and the standard deviation; The outlier is replaced or interpolated using an average value of neighborhood values to complete the cleaning of the outlier; the neighborhood values are the original electrical parameters adjacent to the outlier.
4. The method according to any one of claims 1 to 3, characterized in that The clustering of the target electrical parameters to mine multiple clusters representing line loss patterns includes: Determine the k value; Initialize k clusters; each of the clusters has a center point; For the same electrical equipment, calculating the distance between the target electrical parameter and each of the center points; assigning the electrical device to the cluster having the smallest distance; If all the target electrical parameters have been assigned, updating the center point in each of the clusters; Determine whether the center point meets a preset convergence condition; if so, determine the cluster representation line loss mode; if not, return to execute the calculation of the distance between the target electrical parameter and each center point for the same electrical device.
5. The method according to claim 4, characterized in that The step of determining the k value comprises: Setting an objective function; the objective function represents the total square distance between the target electrical parameters of the electrical devices in the cluster and the center point; To optimize the objective function, a plurality of k values are determined using the elbow rule; Calculate the silhouette coefficient for each of the k values; The value of k for which the silhouette coefficient is highest is selected.
6. The method according to claim 4, characterized in that The initializing k clusters comprises: Randomly selecting one of the target electrical parameters of the electrical device as the center point of a cluster; Calculating the square of the distance between the target electrical parameters of the other electrical devices except the central point and the central point as the distribution distance; Normalizing the distribution distance to obtain probability distribution information; Randomly select one of the target electrical parameters of the electrical equipment as the center point of a cluster according to the probability distribution information; Determine whether the number of the center points is k; if so, determine that the initialization of the k clusters is completed; if not, return to execute the calculation of the square of the distance between the target electrical parameters of the other electrical devices except the center point and the center point as the distribution distance.
7. The method according to claim 6, characterized in that The step of calculating the distance between the target electrical parameter and each of the central points for the same electrical device includes: For the same electrical device, query the weights configured for each target electrical parameter; For each of the center points, the square root of the sum of the products of the weight and the characteristic deviation is taken to obtain the distance between the target electrical parameter and each of the center points; the characteristic deviation is the square of the difference between the target electrical parameter and the center point in the same dimension; The updating of the center point in each of the clusters includes: In each of the clusters, a weighted eigenvalue and a weighted amount are respectively calculated in the same dimension; the weighted eigenvalue is the sum of the products of the weight and the target electrical parameter, and the weighted amount is the sum of the weights; In the same dimension, the ratio between the weighted feature value and the weighted amount is assigned to the center point.
8. A line loss detection method, characterized in that: include: Collect original electrical parameters related to line loss for designated electrical equipment in the power grid; Preprocessing the original electrical parameters to obtain target electrical parameters; extracting electrical features from the target electrical parameters of the electrical device; The electrical characteristics are input into a line loss identification model trained according to the method of any one of claims 1 to 7 to identify whether the line loss pattern of the electrical device is normal or abnormal.
9. A computer device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the line loss identification model training method as described in any one of claims 1 to 7, or the line loss detection method as described in claim 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the line loss identification model training method as described in any one of claims 1 to 7 is implemented, or the line loss detection method as described in claim 8 is implemented.