Electricity safety hazard diagnosis method, device, equipment and storage medium

Through the combination of DTW algorithm and random forest algorithm, the problem of insufficient sample size is solved, in-depth diagnosis of potential electrical safety hazards is achieved, and the accuracy and efficiency of identifying potential electrical safety hazards are improved.

CN115146715BActive Publication Date: 2024-09-13STATE GRID NINGXIA ELECTRIC POWER CO LTD MARKETING SERVICE CENT STATE GRID NINGXIA ELECTRIC POWER CO LTD METERING CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210708775.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2024-09-13
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

The existing technology has insufficient sample size in diagnosing potential electrical safety hazards, resulting in incomplete analysis results and inability to deeply unearth factors that may cause potential electrical safety hazards.

Method used

The DTW algorithm is used to perform cluster analysis of user-side power consumption characteristic curves, and a diagnostic model is built using the random forest algorithm to diagnose whether there are potential safety hazards in user power equipment by considering multiple indicators.

Benefits of technology

Through the combination of clustering and random forest algorithms, possible electrical safety hazards can be identified more deeply, improving the accuracy and efficiency of diagnosis and reducing manual inspection costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115146715B
    Figure CN115146715B
Patent Text Reader

Abstract

The present invention provides a method for diagnosing hidden dangers in power safety, which belongs to the field of power grid safety technology. The method includes: collecting a sample set C of 96 historical load curves of users; calculating the distance DISTDTW(x, y) between any two curves in the sample set C based on the Euclidean distance and DTW distance algorithms; using the distance DISTDTW(x, y) as a similarity measurement basis, clustering the curves of the sample set C to obtain M curve clusters; calculating M typical power consumption characteristic curves of the users according to each of the curve clusters; preliminarily selecting a hidden danger index in power safety; using the hidden danger index in power safety as a feature, using one of the curve clusters as a diagnostic sample set, using the typical power consumption characteristic curve of the user corresponding to the curve cluster as a reference object, and generating a hidden danger diagnosis model in power safety with typical power consumption characteristics based on a random forest algorithm; diagnosing whether the power equipment of users with the same typical power consumption characteristics has hidden dangers in power safety according to the hidden danger diagnosis model in power safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of power grid safety technology, and in particular to a method, device, equipment and storage medium for diagnosing hidden dangers of power safety. Background Art

[0002] my country's electricity industry has developed rapidly, and the electrification process has significantly improved people's lives. However, power accidents caused by many factors occur from time to time, which have a direct impact on power safety, economic construction and power market development. Therefore, the inspection of safe electricity use is very important. However, in daily work, electricity inspections often have the characteristics of a wide range and a large number of people, and it is necessary to informatize and automate the work of troubleshooting safety hazards in electricity use.

[0003] The traditional method is usually to analyze the user's electricity consumption data. Based on the historical user load curve, the user's electricity consumption habits can be simply obtained, and the user may have electricity safety hazards. However, when analyzing the user's electricity safety hazards, only using the user's historical data as a reference object will result in insufficient sample size and incomplete analysis results. Statistical analysis from the perspective of big data can better and deeply explore the factors that may cause electricity safety hazards. Summary of the invention

[0004] In view of this, the present invention provides a method, device, equipment and storage medium for diagnosing electricity safety hazards, which uses a DTW algorithm to cluster and analyze typical electricity consumption characteristic curves on the user side, and a random forest algorithm to build a diagnostic model, providing a solution for diagnosing whether the user's power equipment has electricity safety hazards by considering multiple types of indicators.

[0005] The technical solution adopted by the embodiment of the present invention to solve the technical problem is:

[0006] A method for diagnosing hidden dangers of electrical safety, comprising:

[0007] Step S1, collect a sample set C of 96 points of the user's historical load curve on the user side, C = {C1, C2, ..., C N};

[0008] Step S2, calculating the distance DISTDTW(x,y) between any two curves in the sample set C based on the Euclidean distance and DTW distance algorithm;

[0009] Step S3, using the distance DISTDTW(x, y) as a similarity measurement basis, clustering the curves of the sample set C to obtain M curve clusters;

[0010] Step S4, using the mean method, calculate the typical power consumption characteristic curve of the user according to each of the curve clusters to obtain M typical power consumption characteristic curves of the user.

[0011] Step S5, preliminarily selecting power safety hazard indicators, the power safety hazard indicators include but are not limited to current imbalance rate, voltage imbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, active power, the electrical equipment information includes but is not limited to equipment manufacturer, equipment price, equipment commissioning date, wherein the reference object of the year-on-year power consumption and the month-on-month power consumption is the typical power consumption characteristic curve of the user;

[0012] Step S6, using the power safety hazard indicator as a feature, one of the curve clusters as a diagnostic sample set, and the user's typical power consumption characteristic curve corresponding to the curve cluster as a reference object, generating a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm;

[0013] Step S7: diagnose whether user power equipment with the same typical power usage characteristics has power safety hazards based on the power safety hazard diagnosis model.

[0014] Preferably, the step S2 of calculating the distance DISTDTW(x,y) between any two curves in the sample set C based on the Euclidean distance and the DTW distance algorithm comprises:

[0015] Step S21, constructing a time series D corresponding to curve x, a time series T corresponding to curve y, and a Euclidean distance calculation formula:

[0016] D=[d1,d2,d3…d n ]

[0017] T=[t1,t2,t3…t n ]

[0018]

[0019] Among them, d x is an element in the time series D, ty is an element in the time series T, DTW(d x ,t y ) means d x to y The Euclidean distance between

[0020] Step S22, calculating the distance DISTDTW(x,y):

[0021] DISTDTW(x,y)=DTW(d x ,t y )+min{DISTDTW(x-1,y),DISTDTW(x,y-1),DISTDTW(x-1,y-1)}

[0022] Preferably, the step S3 uses the distance DISTDTW(x, y) as a similarity measurement basis to perform curve clustering of the sample set C, and obtains M curve clusters including:

[0023] Step S31, processing the sample set C into a minimum spanning tree, and setting a fuzzy splitting number q-1;

[0024] Step S32, dividing the minimum spanning tree into q subtrees according to maxDISTDTW(x,y);

[0025] Step S33, selecting an initial cluster number n according to the number of elements corresponding to the q subtrees;

[0026] Step S34, sorting by the number of elements, treating the first n subtrees as the initial n clusters, and calculating the initial cluster center of each cluster;

[0027] Step S35, using the evaluation function I to determine whether to perform a merging operation between clusters:

[0028]

[0029]

[0030] Among them, A i represents the i-th cluster among the n clusters, and p is the A i The sample points in m i For the A i The cluster center value of , t is the number of iterations;

[0031] Step S36: if dete>ε, it is determined that a cluster merge operation is currently required, and the process returns to step S33 and selects a cluster smaller than n. t-1 The number n t , and repeat steps S33-S35; if dete≤ε, it is determined that there is no need to perform a merging operation between clusters, the curve clustering operation is terminated, and M curve clusters are obtained, where ε is a constant.

[0032] Preferably, the step S4 calculates the typical power consumption characteristic curve of the user according to each of the curve clusters using the mean method, and obtains M typical power consumption characteristic curves of the user including:

[0033] Each of the curve clusters is regarded as the sample set with typical power consumption characteristics, and the average of the ordinate at each time point is calculated according to all 96 user historical load curves in the sample set with typical power consumption characteristics to obtain the user's typical power consumption characteristic curve;

[0034] Calculation is performed according to each of the curve clusters, and finally M typical power consumption characteristic curves of the user with different typical power consumption characteristics are obtained.

[0035] Preferably, the step S6 uses the power safety hazard indicator as a feature, uses one of the curve clusters as a diagnostic sample set, uses the user's typical power consumption characteristic curve corresponding to the curve cluster as a reference object, and generates a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm, including:

[0036] Dividing the diagnostic sample set into a training set and a test set;

[0037] Based on the training set, the power safety hazard indicator given in step S5 is trained using a random forest model;

[0038] The number of important indicators S is set, and a grid search method is used to search and find S important indicators, wherein when the equipment manufacturer becomes the important indicator, it means that the electric meter of the equipment manufacturer is very easy to be modified, has a high risk of electricity theft and a high safety hazard;

[0039] Generate the power safety hazard diagnosis model based on the S important indicators;

[0040] Testing the electricity safety hazard diagnosis model through the test set;

[0041] If the accuracy of the test result exceeds the threshold, the power safety hazard diagnosis model does not need to be adjusted;

[0042] If the accuracy of the test results is lower than the threshold, the training set and the test set are re-divided and the model is re-trained until the accuracy of the test results of the power safety hazard diagnosis model exceeds the threshold.

[0043] Furthermore, the present invention also provides a device for diagnosing hidden dangers of electrical safety, comprising:

[0044] The collection module is used to collect a sample set C of 96 points of the user's historical load curve, where C = {C1, C2, ..., C N};

[0045] A calculation module, used for calculating the distance DISTDTW(x,y) between any two curves in the sample set C based on the Euclidean distance and DTW distance algorithm, where x∈C and y∈C;

[0046] A clustering module, used to cluster the curves of the sample set C using the distance DISTDTW(x, y) as a similarity measurement basis to obtain M curve clusters;

[0047] A user typical power consumption characteristic curve calculation module, used to calculate the user typical power consumption characteristic curve according to each of the curve clusters by using the mean method, and obtain M typical power consumption characteristic curves of the user;

[0048] An indicator selection module is used to preliminarily select power safety hazard indicators, wherein the power safety hazard indicators include but are not limited to current imbalance rate, voltage imbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, and active power. The electrical equipment information includes but is not limited to equipment manufacturer, equipment price, and equipment commissioning date. The reference object of the year-on-year power consumption and the month-on-month power consumption is the typical power consumption characteristic curve of the user;

[0049] A power safety hazard diagnostic model establishment module is used to use the power safety hazard indicator as a feature, one of the curve clusters as a diagnostic sample set, and the user's typical power consumption characteristic curve corresponding to the curve cluster as a reference object to generate a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm;

[0050] The diagnosis module is used to diagnose whether there are power safety hazards in user power equipment with the same typical power usage characteristics based on the power safety hazard diagnosis model.

[0051] Preferably, the clustering module is used to process the sample set C into a minimum spanning tree, set a fuzzy split number q-1; divide the minimum spanning tree into q subtrees according to maxDISTDTW(x,y); select the initial cluster number n according to the number of elements corresponding to the q subtrees; sort according to the number of elements, regard the first n subtrees as the initial n clusters, and calculate the initial cluster center of each cluster; use the evaluation function I to determine whether to perform a merging operation between clusters:

[0052]

[0053]

[0054] Among them, A i represents the i-th cluster among the n clusters, and p is the A i The sample points in m i For the A i The cluster center value, t is the number of iterations; if dete>ε, it is determined that a cluster merger operation is currently required, and a cluster less than n is selected. t -1 The number n t, and repeatedly calculate dete; if dete≤ε, it is determined that there is no need to perform a merging operation between clusters at present, the curve clustering operation is terminated, and M curve clusters are obtained, where ε is a constant.

[0055] Preferably, the user typical power consumption characteristic curve calculation module is used to regard each of the curve clusters as the sample set with typical power consumption characteristics, calculate the average of the ordinate at each time point according to all 96 user historical load curves in the sample set with typical power consumption characteristics, and obtain the user typical power consumption characteristic curve; and perform calculations according to each of the curve clusters to finally obtain M typical power consumption characteristic curves of the user with different typical power consumption characteristics;

[0056] The power safety hazard diagnosis model establishment module is used to divide the diagnosis sample set into a training set and a test set; it is also used to train the power safety hazard indicators given in the step S5 using a random forest model based on the training set; set the number of important indicators S, search through the grid search method, and find S important indicators, wherein when the equipment manufacturer becomes the important indicator, the electric meter representing the equipment manufacturer is extremely easy to be modified, has a high risk of electricity theft and high safety hazards; generate the power safety hazard diagnosis model based on the S important indicators; test the power safety hazard diagnosis model through the test set; if the test result accuracy exceeds the threshold, the power safety hazard diagnosis model does not need to be adjusted; if the test result accuracy is lower than the threshold, the training set and the test set are re-divided, and the model is retrained until the test result accuracy of the power safety hazard diagnosis model exceeds the threshold.

[0057] Furthermore, the present invention also provides an electronic device for diagnosing electrical safety hazards, including: a memory and a processor, the processor and the memory communicate with each other through a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method as described above.

[0058] Furthermore, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the aforementioned method when executed by a processor.

[0059] It can be seen from the above technical scheme that the power safety hazard diagnosis method provided by the embodiment of the present invention first collects a sample set C of 96 user historical load curves; based on the Euclidean distance and DTW distance algorithm, calculates the distance DISTDTW(x, y) between any two curves in the sample set C; uses the distance DISTDTW(x, y) as a similarity measurement basis to cluster the curves of the sample set C to obtain M curve clusters; calculates M typical power consumption characteristic curves of the user according to each of the curve clusters; preliminarily selects a power safety hazard indicator; uses the power safety hazard indicator as a feature, uses one of the curve clusters as a diagnostic sample set, uses the typical power consumption characteristic curve of the user corresponding to the curve cluster as a reference object, and generates a power safety hazard diagnosis model with typical power consumption characteristics based on a random forest algorithm; according to the power safety hazard diagnosis model, it can be diagnosed whether the user's power equipment with the same typical power consumption characteristics has power safety hazards. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 The present invention is a flow chart of the method for diagnosing hidden dangers in electrical safety.

[0061] Figure 2 It is a structural diagram of the power safety hazard diagnosis device of the present invention.

[0062] Figure 3 A schematic diagram of an electronic device for diagnosing electrical safety hazards of the present invention. DETAILED DESCRIPTION

[0063] The technical scheme and technical effects of the present invention are further elaborated in detail below in conjunction with the accompanying drawings of the present invention.

[0064] The present invention analyzes the causes of faults based on status monitoring data, historical data, the number of safety hazards, and maintenance data, and proposes a method for diagnosing power safety hazards based on the DTW clustering algorithm and the random forest algorithm. Through training and testing, the power safety hazard status of each device can be intelligently identified. First, the clustering algorithm is used to carry out power load monitoring and analysis of user power consumption behavior characteristics to master typical load characteristics; then the random forest algorithm is used to perform comprehensive diagnosis in the corresponding class to achieve early warning of the safe operation of power equipment.

[0065] like Figure 1 As shown, the present invention provides a method for diagnosing hidden dangers of electrical safety, the steps comprising:

[0066] Step S1, collect a sample set C of 96 points of user historical load curves, C = {C1, C2, ..., C N}; The data in sample set C needs to be preprocessed to clean invalid data and fill in missing data;

[0067] Step S2, based on the Euclidean distance and DTW distance algorithm, calculate the distance DISTDTW(x,y) between any two curves in the sample set C;

[0068] Step S3, using the distance DISTDTW(x,y) as a similarity measurement basis, clustering the curves of the sample set C to obtain M curve clusters;

[0069] Step S4, using the mean method, calculate the typical power consumption characteristic curve of the user according to each curve cluster, and obtain M typical power consumption characteristic curves of the user;

[0070] Step S5, preliminarily selecting power safety hazard indicators, which include but are not limited to current imbalance rate, voltage imbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, and active power. The electrical equipment information includes but is not limited to equipment manufacturer, equipment price, and equipment commissioning date. The reference object of year-on-year power consumption and month-on-month power consumption is the user's typical power consumption characteristic curve;

[0071] Step S6, using the power safety hazard index as a feature, a curve cluster as a diagnostic sample set, and the user's typical power consumption characteristic curve corresponding to the curve cluster as a reference object, and generating a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm;

[0072] Step S7, diagnose whether the user's power equipment with the same typical power usage characteristics has power safety hazards based on the power safety hazard diagnosis model.

[0073] Specifically, the specific implementation of step S2 to calculate the distance DISTDTW(x,y) between any two curves in the sample set C based on the Euclidean distance and DTW distance algorithm is as follows:

[0074] Step S21, constructing a time series D corresponding to curve x, a time series T corresponding to curve y, and a Euclidean distance calculation formula:

[0075] D=[d1,d2,d3…d n ] (1)

[0076] T=[t1,t2,t3…t n ] (2)

[0077]

[0078] Among them, d x is an element in the time series D, ty is an element in the time series T, DTW(d x ,t y ) means d x to yThe Euclidean distance between

[0079] Step S22, calculate the distance DISTDTW(x,y):

[0080] DISTDTW(x,y)=DTW(d x ,t y )+min{DISTDTW(x-1,y),DISTDTW(x,y-1),DISTDTW(x-1,y-1)} (4)

[0081] Step S3 uses a combination of "grid search + data observation" to first measure whether the clustering results generated by the clustering algorithm meet the optimal standards through clustering effectiveness evaluation indicators (Silhouette Coefficient, Calinski-Harabasz), and at the same time, scientifically adjust the observation effect of data category characteristics, and then clarify the number of clusters n. According to the n clustering categories obtained from the clustering analysis results, analyze the load curve characteristics of each category and find the typical curve of the user's electrical equipment. Specifically, step S3 uses the distance DISTDTW (x, y) as the similarity measurement basis to cluster the curves of the sample set C, and the specific implementation of obtaining M curve clusters is as follows:

[0082] Step S31, processing the sample set C into a minimum spanning tree, setting the fuzzy split number q-1;

[0083] Step S32, dividing the minimum spanning tree into q subtrees according to maxDISTDTW(x,y), where maxDISTDTW(x,y) refers to the maximum value of the distance;

[0084] Step S33, selecting the initial number of clusters n according to the number of elements corresponding to the q subtrees;

[0085] Step S34, sorting by the number of elements, treating the first n subtrees as the initial n clusters, and calculating the initial cluster center of each cluster;

[0086] Step S35, using the evaluation function I to determine whether to perform a merging operation between clusters:

[0087]

[0088]

[0089] Among them, A i represents the i-th cluster among n clusters, and p is A i The sample points in m i A i The cluster center value of

[0090] Step S36: if dete>ε, it is determined that a cluster merge operation is currently required, and the process returns to step S33 and selects a cluster smaller than n. t-1 The number n t , and repeat steps S33-S35; if dete≤ε, it is determined that there is no need to perform a merging operation between clusters at present, the curve clustering operation is terminated, and M curve clusters are obtained, where ε is a very small constant.

[0091] Preferably, step S4 uses the mean method to calculate the typical power consumption characteristic curve of the user according to each curve cluster, and obtains M typical power consumption characteristic curves of the user including:

[0092] Step S41, treating each curve cluster as a sample set with typical power consumption characteristics, calculating the average of the ordinate at each time point based on all 96 user historical load curves in the sample set with typical power consumption characteristics, and obtaining the user's typical power consumption characteristic curve;

[0093] Step S42, performing calculations according to each curve cluster, and finally obtaining M typical power consumption characteristic curves of users with different typical power consumption characteristics.

[0094] When a user's electrical equipment has a hidden danger of power safety, the values ​​of its related electrical parameter indicators will change abnormally. By comparing and analyzing the similarity of power equipment status monitoring data, historical data, number of failures, and maintenance data, users with hidden dangers of power equipment safety can be screened out. The present invention constructs a power safety hazard identification model based on the random forest algorithm.

[0095] As mentioned in the above step S5, the initially selected power safety hazard indicators include but are not limited to current imbalance rate, voltage imbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, and active power. Among them:

[0096] The current unbalance rate of three-phase users is:

[0097]

[0098] Among them, I PRmax is the value of the maximum current term, I PRmin is the value of the minimum term of the current;

[0099] The current unbalance rate of single-phase users is:

[0100]

[0101] Among them, I a is the live wire current, I n is the neutral current;

[0102] The voltage unbalance rate is:

[0103]

[0104] Among them, U PRmax is the value of the maximum voltage term, U PRmin is the value of the voltage minimum term;

[0105] The rated voltage deviation is the deviation between the voltage and the rated voltage, which can reflect whether there are safety hazards in the equipment;

[0106] The year-on-year electricity consumption reflects the fluctuation of electricity consumption in different time periods. In the present invention, the reference objects of the year-on-year and month-on-month electricity consumption are the typical electricity consumption characteristic curves of users;

[0107] The above indicators are generally used in the form of exceeding or not exceeding;

[0108] Electrical equipment information includes but is not limited to equipment manufacturer, production batch, equipment price, and equipment commissioning date; the usage of electrical equipment information is "yes" or "no", the price is higher or lower, and the date is earlier or later.

[0109] Furthermore, electricity safety hazard indicators can also be selected from the following ranges: for example, marketing business characteristics (frequency of metering failures, number of theft records), electricity processing characteristics (peak-to-valley difference, load rate, current balance rate, power factor fluctuation rate), abnormal events (opening events, unpacking time, abnormal phase sequence, abnormal power-off events), number of terminal alarms, etc.

[0110] After importing the above indicators, step S6 uses the power safety hazard indicators as features, a curve cluster as a diagnostic sample set, and the typical power consumption characteristic curve of the user corresponding to the curve cluster as a reference object. The specific implementation of generating a power safety hazard diagnostic model with typical power consumption characteristics based on the random forest algorithm includes:

[0111] Step S61, dividing the diagnostic sample set into a training set and a test set with a ratio of 7:3, wherein the training set is used for model training and the test set is used for model verification;

[0112] Step S62, based on the training set, using a random forest model to train the power safety hazard indicator given in step S5;

[0113] Step S63, set the number of important indicators S, search through the grid search method, and find S important indicators. This step uses the random forest algorithm to further analyze the importance of each feature to the identification of equipment safety hazards, select the top S important feature sets with greater influence, re-optimize the prediction model, and improve the accuracy and generalization ability of the model. For example, when the equipment manufacturer becomes an important indicator, the electric meter representing the equipment manufacturer is very easy to be modified, has a high risk of electricity theft and high safety hazards;

[0114] Step S64, generating a power safety hazard diagnosis model based on S important indicators;

[0115] Step S65, testing the power safety hazard diagnosis model through the test set; using methods such as MAPE, MAE, RMSE, etc. to evaluate the accuracy of the prediction model:

[0116] Using the MAPE method, the mean absolute percentage error calculation value range is [0, +∞). The closer the MAPE value is to 0, the better the model effect is, and vice versa. The specific calculation logic is as follows:

[0117]

[0118] Using the MAE method, the range of mean absolute error calculation is [0, +∞). When the predicted value is closer to the true value, the MAE value is closer to 0, and the model effect is better, and vice versa. The specific calculation logic is as follows:

[0119]

[0120] Using the RMSE method, the root mean square error calculation value range is [0, +∞). When the predicted value is closer to the true value, the RMSE value is closer to 0, and the model effect is better, and vice versa. The specific calculation logic is as follows:

[0121]

[0122] Step S66, if the accuracy of the test results exceeds the threshold, the power safety hazard diagnosis model does not need to be adjusted; if the accuracy of the test results is lower than the threshold, the training set and the test set are re-divided and the model is retrained until the accuracy of the test results of the power safety hazard diagnosis model exceeds the threshold.

[0123] Furthermore, if Figure 2 As shown, the present invention also provides a device for diagnosing hidden dangers of electrical safety, comprising:

[0124] The collection module 21 is used to collect a sample set C of 96 points of the user's historical load curve, where C = {C1, C2, ..., C N};

[0125] The calculation module 22 is used to calculate the distance DISTDTW (C) between any two curves in the sample set C based on the Euclidean distance and DTW distance algorithm. x ,C y ), x∈C, y∈C;

[0126] The clustering module 23 is used to classify the distance DISTDTW (C x ,C y ) is used as the similarity measurement basis to cluster the curves of the sample set C and obtain M curve clusters;

[0127] A user typical power consumption characteristic curve calculation module 24 is used to calculate the user typical power consumption characteristic curve according to each curve cluster by using the mean method to obtain M user typical power consumption characteristic curves;

[0128] The indicator selection module 25 is used to preliminarily select the power safety hazard indicators, which include but are not limited to the current unbalance rate, voltage unbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, and active power. The electrical equipment information includes but is not limited to the equipment manufacturer, equipment price, and equipment commissioning date. The reference objects of year-on-year power consumption and month-on-month power consumption are the typical power consumption characteristic curves of users;

[0129] A power safety hazard diagnosis model establishment module 26 is used to generate a power safety hazard diagnosis model with typical power consumption characteristics based on a random forest algorithm, using power safety hazard indicators as features, a curve cluster as a diagnostic sample set, and a typical power consumption characteristic curve of a user corresponding to the curve cluster as a reference object;

[0130] The diagnosis module 27 is used to diagnose whether there are power safety hazards in user power equipment with the same typical power usage characteristics according to the power safety hazard diagnosis model.

[0131] Preferably, the clustering module 23 is used to process the sample set C into a minimum spanning tree, set a fuzzy split number q-1; divide the minimum spanning tree into q subtrees according to maxDISTDTW(x,y); select the initial cluster number n according to the number of elements corresponding to the q subtrees; sort by the number of elements, regard the first n subtrees as the initial n clusters, and calculate the initial cluster center of each cluster; according to the above formulas (1)-(6), use the evaluation function I to determine whether to merge the clusters; if dete>ε, determine that the merge operation between clusters is currently required, and reselect a cluster with a size less than n. t-1 The number n t , and repeatedly calculate dete; if dete≤ε, it is determined that there is no need to perform a merging operation between clusters at present, the curve clustering operation is terminated, and M curve clusters are obtained.

[0132] Preferably, the user typical power consumption characteristic curve calculation module 24 is used to regard each curve cluster as a sample set with typical power consumption characteristics, calculate the average of the ordinate at each time point according to all 96 user historical load curves in the sample set with typical power consumption characteristics, and obtain the user's typical power consumption characteristic curve; and perform calculations according to each curve cluster to finally obtain M user typical power consumption characteristic curves with different typical power consumption characteristics;

[0133] The power safety hazard diagnosis model establishment module 25 is used to divide the diagnosis sample set into a training set and a test set; it is also used to train the power safety hazard indicators given in step S5 using a random forest model based on the training set; set the number of important indicators S, search through the grid search method, and find S important indicators, among which, when the equipment manufacturer becomes an important indicator, the electric meter representing the equipment manufacturer is extremely easy to be modified, has a high risk of electricity theft and high safety hazards; generate a power safety hazard diagnosis model based on the S important indicators; test the power safety hazard diagnosis model through the test set; if the test result accuracy exceeds the threshold, the power safety hazard diagnosis model does not need to be adjusted; if the test result accuracy is lower than the threshold, the training set and the test set are re-divided, and the model is retrained until the test result accuracy of the power safety hazard diagnosis model exceeds the threshold.

[0134] The present invention proposes a fault diagnosis based on DTW hierarchical clustering and integration algorithm, which organically combines unsupervised learning method and supervised learning method. First, the DTW algorithm is used to improve the measurement method of similarity, and then cluster analysis is performed to grasp the different load characteristic categories of electrical equipment. Then, supervised learning modeling is performed separately based on the output data categories of unsupervised learning, and a random forest model is constructed to realize the automatic output of equipment with electrical safety hazards.

[0135] The present invention is used for intelligent identification of safety hazards of electrical equipment on the client side. It can be based on the terminal connection, data collection, and data storage of the client-side Internet of Things service platform, and perform big data simulation calculations through artificial intelligence technologies such as cluster analysis and random forests. By building a power safety hazard diagnosis model based on user equipment, intelligent identification of the power safety hazard status on the client side can be achieved. Research is carried out based on power consumption big data, which reduces the cost of manual investigation and improves identification efficiency.

[0136] Furthermore, if Figure 3 As shown, the present invention also provides an electronic device for diagnosing electrical safety hazards, the device comprising: a processor 301, a memory 302 and a bus 303; wherein the processor 301 and the memory 302 communicate with each other via the bus 303; the processor 301 is used to call the program instructions in the memory 302 to execute the methods provided by the above-mentioned method embodiments.

[0137] An embodiment of the present invention provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions enable a computer to execute the methods provided by the above method embodiments.

[0138] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0139] The embodiments of the apparatus and devices described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for diagnosing hidden dangers of electrical safety, characterized in that: include: Step S1, collect a sample set C of 96 points of the user's historical load curve on the user side, C = {C1, C2, ..., C N }; Step S2, based on the Euclidean distance and DTW distance algorithm, calculate the distance DISTDTW(x,y) between any two curves in the sample set C, x∈C, y∈C; Step S3, using the distance DISTDTW(x, y) as a similarity measurement basis, clustering the curves of the sample set C to obtain M curve clusters; Step S4, using the mean method, calculating the typical power consumption characteristic curve of the user according to each of the curve clusters, and obtaining M typical power consumption characteristic curves of the user; Step S5, preliminarily selecting power safety hazard indicators, the power safety hazard indicators include but are not limited to current imbalance rate, voltage imbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, active power, the electrical equipment information includes but is not limited to equipment manufacturer, equipment price, equipment commissioning date, wherein the reference object of the year-on-year power consumption and the month-on-month power consumption is the typical power consumption characteristic curve of the user; Step S6, using the power safety hazard indicator as a feature, one of the curve clusters as a diagnostic sample set, and the user's typical power consumption characteristic curve corresponding to the curve cluster as a reference object, generating a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm; Step S7, diagnosing whether the user's power equipment with the same typical power usage characteristics has power safety hazards according to the power safety hazard diagnosis model; The step S2 calculates the distance DISTDTW(x,y) between any two curves in the sample set C based on the Euclidean distance and the DTW distance algorithm, including: Step S21, constructing a time series D corresponding to curve x, a time series T corresponding to curve y, and a Euclidean distance calculation formula: <h2 style=";text-align:left;direction:ltr">D = [d1,d2,d3…d<h2 style=";text-align:left;direction:ltr"> n <h2 style=";text-align:left;direction:ltr"> ] T=[t1,t2,t3…t n ] Among them, d x is an element in the time series D, t y is an element in the time series T, DTW(d x ,t y ) means d x to d y The Euclidean distance between Step S22, calculating the distance DISTDTW(x,y): DISTDTW(x,y)=DTW(d x ,t y )+min{DISTDTW(x-1,y),DISTDTW(x,y-1),DISTDTW(x-1,y-1)} The step S3 uses the distance DISTDTW(x, y) as a similarity measurement basis to cluster the curves of the sample set C, and obtains M curve clusters including: Step S31, processing the sample set C into a minimum spanning tree, and setting a fuzzy splitting number q-1; Step S32, dividing the minimum spanning tree into q subtrees according to maxDISTDTW(x,y); Step S33, selecting an initial cluster number n according to the number of elements corresponding to the q subtrees; Step S34, sorting by the number of elements, treating the first n subtrees as the initial n clusters, and calculating the initial cluster center of each cluster; Step S35, using the evaluation function I to determine whether to perform a merging operation between clusters: Among them, A i represents the i-th cluster among the n clusters, and p is the A i The sample points in m i For the A i The cluster center value of , t is the number of iterations; Step S36: if dete>ε, it is determined that a cluster merge operation is currently required, and the process returns to step S33 and selects a cluster smaller than n. t-1 The number n t , and repeat steps S33-S35; if dete≤ε, it is determined that there is no need to perform a merging operation between clusters, the curve clustering operation is terminated, and M curve clusters are obtained, where ε is a constant.

2. The method for diagnosing electrical safety hazards according to claim 1, characterized in that: The step S4 uses the mean value method to calculate the typical power consumption characteristic curve of the user according to each of the curve clusters, and obtains M typical power consumption characteristic curves of the user, including: Step S41, treating each of the curve clusters as the sample set with typical power consumption characteristics, calculating the average of the ordinates at each time point according to all 96 user historical load curves in the sample set with typical power consumption characteristics, and obtaining the typical power consumption characteristic curve of the user; Step S42, performing calculations according to each of the curve clusters, and finally obtaining M typical power consumption characteristic curves of the user with different typical power consumption characteristics.

3. The method for diagnosing hidden dangers of electrical safety according to claim 2, characterized in that: The step S6 uses the power safety hazard indicator as a feature, uses one of the curve clusters as a diagnostic sample set, uses the typical power consumption characteristic curve of the user corresponding to the curve cluster as a reference object, and generates a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm, including: Step S61, dividing the diagnostic sample set into a training set and a test set; Step S62, based on the training set, using a random forest model to train the power safety hazard indicator given in step S5; Step S63, setting the number of important indicators S, searching by grid search method, and finding S important indicators, wherein when the equipment manufacturer becomes the important indicator, it means that the electric meter of the equipment manufacturer is very easy to be modified, has a high risk of electricity theft and a high safety hazard; Step S64, generating the power safety hazard diagnosis model based on the S important indicators; Step S65, testing the power safety hazard diagnosis model through the test set; Step S66, if the accuracy of the test results exceeds the threshold, the power safety hazard diagnosis model does not need to be adjusted; if the accuracy of the test results is lower than the threshold, the training set and the test set are re-divided, and the model is retrained until the accuracy of the test results of the power safety hazard diagnosis model exceeds the threshold.

4. A device for diagnosing hidden dangers of electrical safety, characterized in that: The method for implementing any one of claims 1 to 3 comprises: The collection module is used to collect a sample set C of 96 historical user load curves on the user side, where C = {C1, C2, …, C N }; A calculation module, used for calculating the distance DISTDTW(x,y) between any two curves in the sample set C based on the Euclidean distance and DTW distance algorithm, where x∈C and y∈C; A clustering module, used to cluster the curves of the sample set C using the distance DISTDTW(x, y) as a similarity measurement basis to obtain M curve clusters; A user typical power consumption characteristic curve calculation module, used to calculate the user typical power consumption characteristic curve according to each of the curve clusters by using the mean method, and obtain M typical power consumption characteristic curves of the user; An indicator selection module is used to preliminarily select power safety hazard indicators, wherein the power safety hazard indicators include but are not limited to current imbalance rate, voltage imbalance rate, rated voltage deviation, year-on-year power consumption, month-on-month power consumption, electrical equipment information, time-sharing power, voltage, current, and active power. The electrical equipment information includes but is not limited to equipment manufacturer, equipment price, and equipment commissioning date. The reference object of the year-on-year power consumption and the month-on-month power consumption is the typical power consumption characteristic curve of the user; A power safety hazard diagnostic model establishment module is used to use the power safety hazard indicator as a feature, one of the curve clusters as a diagnostic sample set, and the user's typical power consumption characteristic curve corresponding to the curve cluster as a reference object to generate a power safety hazard diagnostic model with typical power consumption characteristics based on a random forest algorithm; The diagnosis module is used to diagnose whether there are power safety hazards in user power equipment with the same typical power usage characteristics based on the power safety hazard diagnosis model.

5. An electronic device for diagnosing electrical safety hazards, characterized in that: include: A memory and a processor, wherein the processor and the memory communicate with each other via a bus; The memory stores program instructions executable by the processor, and the processor can execute the method according to any one of claims 1 to 3 by calling the program instructions.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.