Method and storage medium for detecting mining behavior based on power data
By setting benchmarks for mining machine power consumption and power assessment factors R1, R2, and R3, and combining them with a twin neural network model, the problem of difficulty in detecting small-scale mining activities was solved, enabling accurate identification and risk assessment of mining activities by small workshops and residents.
Patent Information
- Application Number
- CN202211439604.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-11-17
AI Technical Summary
Existing technologies are insufficient to effectively detect small-scale mining activities, especially those of small workshops and residents. Traditional methods for detecting abnormal electricity consumption cannot identify the characteristics of their electricity consumption fluctuations.
By calculating the benchmark power consumption of mining machines and combining it with power consumption assessment factors R1, R2, and R3, the power data is used to analyze power consumption volatility, power plant deviation, and power consumption ratio similarity. A twin neural network model is then used to identify abnormal power consumption behavior.
It achieves accurate detection of both large-scale and small-scale mining activities, has strong applicability, and can identify abnormal power consumption and determine the mining risk level.
Smart Images

Figure CN115760400B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of mining behavior detection, and in particular to a mining behavior detection method based on power data and a storage medium. BACKGROUND
[0002] Rectifying the virtual currency "mining" activity is of great significance to promoting the optimization of China's industrial structure, promoting energy saving and emission reduction, and achieving the carbon peak and carbon neutralization targets on schedule. The energy consumption and carbon emissions of the virtual currency "mining" behavior are very large, which is contrary to the "double carbon" strategic goal, aggravates the degree of local power shortage, and is easy to be used for illegal transactions such as money laundering, fraud, gambling, etc. At present, the industry mainly uses power consumption anomaly detection to identify mining behavior, specifically setting a normal power consumption threshold applicable to all subjects in society, if it is detected that the power consumption of a subject exceeds the power consumption threshold, it is determined that the subject has abnormal power consumption, which may exist mining behavior, and then on-site investigation is carried out to confirm whether there is mining behavior. But this detection method is only suitable for large-scale centralized professional mining machine mining behavior detection, the power consumption of small workshops, residents and other small-scale mining behavior usually does not exceed the normal power consumption threshold, and the above method cannot detect it. SUMMARY
[0003] The technical problem to be solved by the present application is to provide a mining behavior detection method based on power data and a computer readable storage medium storing a computer program which is executed to implement the method, which is suitable for both large-scale centralized professional mining machine mining behavior detection and small workshop, resident and other small-scale mining behavior detection, and has strong applicability.
[0004] In order to solve the above technical problem, in a first aspect, the present application provides a mining behavior detection method based on power data, comprising the following steps:
[0005] A. Calculate the daily power consumption of the mining machine with the smallest power, and use the power consumption as the mining power consumption reference;
[0006] B. For each power consumer whose daily power consumption is greater than the mining power consumption reference, perform the following power consumption evaluation factor R1 marking step: obtain the power consumption sequence of the power consumer for n days, if it is judged that the fluctuation of the power consumption sequence is less than the preset fluctuation degree, mark the power consumption evaluation factor R1 of the power consumer as abnormal;
[0007] C. Perform the following power consumption evaluation factor R2 marking step on each power consumer:
[0008] C1. Obtain the data of the basic parameters of a plurality of power plants, and perform cluster analysis on the power plants according to the basic parameter data of each power plant to divide them into a plurality of categories;
[0009] C2. Calculate the deviation degree L = |A-X| / A of the power generation of each power plant from the grid-connected power, wherein A is the monthly grid-connected power of the power plant, and X is the theoretical monthly power generation of the power plant;
[0010] C3. Obtain the grid-connected power time series data of each power plant and the central grid-connected power time series data of each category, and calculate the similarity between the grid-connected power time series data of each power plant and the central grid-connected power time series data of the category to which the power plant belongs;
[0011] C4. For each power consumer, if the deviation degree L of the power plant associated with the power consumer exceeds the preset normal range and the similarity between the grid-connected power time series data of the power plant and the central grid-connected power time series data of the category to which the power plant belongs is lower than a first preset degree, mark the power consumption evaluation factor R2 of the power consumer as abnormal;
[0012] D. Obtain the data of the user basic parameters of each power consumer, perform cluster analysis on the power consumers according to the user basic parameter data of each power consumer to divide the power consumers into multiple categories, and then perform the following power consumption evaluation factor R3 marking step on each power consumer:
[0013] D1. Calculate the power consumption proportion P of each power consumer in the peak, valley and flat power consumption periods according to the power consumption of the power consumer in the three power consumption periods;
[0014] D2. Calculate the similarity between the power consumption and the power consumption proportion P of each power consumer in the peak, valley and flat power consumption periods and the central power consumption and the central power consumption proportion P of the category to which the power consumer belongs in the peak, valley and flat power consumption periods, respectively, and if the similarity is lower than a second preset degree, mark the power consumption evaluation factor R3 of the power consumer to be identified as abnormal;
[0015] E. Determine the mining risk level of each power consumer according to the abnormality of the power consumption evaluation factors R1, R2 and R3 of the power consumer.
[0016] Further, the step of determining whether the fluctuation of the power consumption sequence is less than the preset fluctuation degree in step B is specifically as follows:
[0017] B1. For the power consumption sequence, take m days as the length of the sliding window and 1 day as the sliding step, and perform linear fitting on the power consumption array in each sliding window to obtain the linear slope k, wherein 8≤m<n;
[0018] B2. Calculate the variance of each slope k obtained by fitting;
[0019] B3. If the variance is less than the preset fluctuation threshold, the fluctuation of the power consumption sequence is less than the preset fluctuation degree.
[0020] Further, the method determines the preset normal range in step C4 by using the interquartile range method on the array composed of the deviation degrees of all power plants.
[0021] Further, the method determines the preset normal range in step C4 by using the interquartile range method on the array composed of the deviation degrees of all power plants.
[0022] C41. The deviation degrees L of each power plant are sorted in descending order to obtain a deviation degree array;
[0023] C42. The upper quartile Q1 and the lower quartile Q3 of the deviation degree array are determined, and the interquartile range IQR of the deviation degree sequence is calculated as Q3-Q1, and (Q1-1.5*IQR, Q3+1.5*IQR) is taken as the preset normal range.
[0024] Further, in step B1, m is 11.
[0025] Further, step E is specifically:
[0026] If the electricity consumption evaluation factors R1, R2 and R3 of the electricity user are all abnormal, the mining risk level of the electricity user is level one;
[0027] If only the electricity consumption evaluation factors R1 and R3 of the electricity user are abnormal, the mining risk level of the electricity user is level two;
[0028] If only the electricity consumption evaluation factors R1 and R2 of the electricity user are abnormal, the mining risk level of the electricity user is level three; if only the electricity consumption evaluation factor R1 of the electricity user is abnormal, the mining risk level of the electricity user is level four;
[0029] Wherein, the smaller the mining risk level value is, the higher the risk is.
[0030] Further, step C1 and / or step D use the K-prototype clustering algorithm for category division.
[0031] Further, the power plant in step C is specifically a hydropower plant.
[0032] Further, steps C3 and D2 both use a twin neural network model to calculate the similarity.
[0033] In a second aspect, the present application provides a computer readable storage medium having a computer program stored thereon, which computer program is executable to implement the mining behavior detection method based on power data as described above.
[0034] Firstly, the electricity consumption of the mining electricity consumer usually does not fluctuate greatly, and the electricity consumption during holidays is equivalent to that during weekdays, while the electricity consumption of normal electricity consumers such as enterprises during holidays is usually less than that during weekdays, and there is obvious fluctuation, so the mining behavior detection method based on power data provided by the present application calculates whether the electricity consumption trend of the electricity consumer fluctuates through step B, and uses the electricity evaluation factor R1 to represent the electricity consumption trend fluctuation of the electricity consumer.
[0035] Secondly, the electricity traded between the power plant and the mining electricity consumer is usually a private transaction, not grid-connected electricity, so the grid-connected electricity of the power plant associated with the mining electricity consumer is not the actual power generation, which is less than the grid-connected electricity of the similar scale / type normal power plant, therefore, the mining behavior detection method based on power data provided by the present application identifies abnormal power plants through step C, and uses the electricity evaluation factor R2 to represent whether the power plant associated with the electricity consumer is abnormal.
[0036] Further, the electricity consumption of the mining electricity consumer is usually much larger than that of the similar scale / type normal electricity consumer, and the electricity consumption proportion of the mining electricity consumer during peak, valley and flat periods is usually relatively uniform and stable, while the electricity consumption proportion of the similar scale / type normal electricity consumer during peak, valley and flat periods usually fluctuates, and the electricity consumption proportion of the mining electricity consumer during the above three electricity consumption periods is obviously different from that of the similar scale / type normal electricity consumer, therefore, the mining behavior detection method based on power data provided by the present application judges whether the electricity consumption and the electricity consumption proportion fluctuation of the electricity consumer during peak, valley and flat periods are different from those of the similar type electricity consumer through step D, and uses the electricity evaluation factor R3 to represent the judgment result.
[0037] Whether it is large-scale centralized professional mining machine mining behavior or small-scale mining behavior such as small workshops and residents, it can be identified through the above three electricity evaluation factors R1, R2 and R3, and the mining behavior detection method based on power data provided by the present application is suitable for both large-scale centralized professional mining machine mining behavior detection and small-scale mining behavior detection such as small workshops and residents, and has strong applicability. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 is a flowchart of the mining behavior detection method based on power data provided by the present application.
[0039] Figure 2 is a structure diagram of the twin neural network model adopted by the present application. DETAILED DESCRIPTION
[0040] The present application will be further described in detail in combination with specific embodiments.
[0041] As Figure 1As shown, the power data-based mining behavior detection method provided by the present application includes the following steps:
[0042] A. Calculate the daily power consumption of the mining machine with the minimum power, and use the daily power consumption as the mining power consumption reference.
[0043] In this embodiment, the mining machine with the minimum power is used as the comparison reference, and the daily power consumption q of the mining machine with the minimum power is calculated as q=Pe*24, q is the daily power consumption of a mining machine, Pe is the power of the mining machine, the unit is kilowatt-hour, and 24 is the number of hours in a day. In this embodiment, the daily power consumption is used as the mining power consumption reference. Since the mining machine usually works 24 hours a day and night, if the daily average power consumption of the power consumer is lower than the daily power consumption, the possibility of being a mining power consumer is extremely low. The power consumer whose daily average power consumption is higher than the daily power consumption meets the minimum requirement of the mining power consumer. In this embodiment, the power consumer with a higher mining suspicion is identified from the power consumers whose daily average power consumption is higher than the daily power consumption by the following steps.
[0044] B. Perform the following power consumption evaluation factor R1 marking step on each power consumer whose daily average power consumption is greater than the mining power consumption reference:
[0045] B1. For the power consumption sequence of the power consumer for n days, use m days as the length of the sliding window, 1 day as the sliding step, and perform linear fitting on the power consumption array in each sliding window to obtain the linear slope k, wherein 8≤m<n;
[0046] B2. Calculate the variance of each slope k obtained by fitting;
[0047] B3. If the above variance is less than the preset fluctuation threshold, mark the power consumption evaluation factor R1 of the power consumer as abnormal.
[0048] The power consumption of the mining power consumer usually does not fluctuate too much, and the holiday power consumption is equivalent to the working day power consumption. The holiday power consumption of a normal power consumer such as an enterprise is usually less than the working day power consumption, and there is a relatively obvious fluctuation. Therefore, in this embodiment, a power consumption evaluation factor R1 is designed for the power consumer to represent the fluctuation of the power consumption trend of the power consumer. The fluctuation is judged in the following manner:
[0049] The power consumption sequence of the power consumer P in 30 days is X p ={X p,b1 , X p,b2 , …, X p,b30}, X p,b1 is the power consumption of the first day, X p,b2For the next day's electricity consumption, and so on. This embodiment takes 11 days as the length of the sliding window and 1 day as the sliding step, and sequentially performs linear fitting on the electricity consumption array in each sliding window to obtain the linear slope k i , and the fitting calculation formula is as follows:
[0050]
[0051] , where i is the day corresponding to the median of the electricity consumption array in the sliding window, If the electricity consumption sequence of the electricity user P has fluctuations, the slope k i of each sliding window has obvious fluctuations, and this embodiment calculates the variance of each slope k i and determines whether the slope k i has obvious fluctuations by the size of the variance. This embodiment sets the preset fluctuation threshold to 0.1, if the variance of each slope k i is greater than or equal to 0.1, it is determined that the electricity consumption trend of the electricity user P has fluctuations, so the electricity consumption evaluation factor R1 of the electricity user P is marked as 0 (0 represents normal); if the variance of each slope k i is less than 0.1, it is determined that the electricity consumption trend of the electricity user P has no obvious fluctuations, so the electricity consumption evaluation factor R1 of the electricity user P is marked as 1 (1 represents abnormal).
[0052] This embodiment sequentially refers to the above-mentioned manner to determine the fluctuation of the electricity consumption trend of each electricity user and mark the electricity consumption evaluation factor R1 as the corresponding value.
[0053] C. For each electricity user, the following electricity consumption evaluation factor R2 marking step is performed:
[0054] C1. Obtain the data of power plant basic parameters of a plurality of power plants, the power plant basic parameters including one or more of the following: region, total installed capacity, power generation type, total unit rated current voltage, and theoretical monthly power generation capacity; use each of the above-mentioned power plant basic parameters as a classification factor, and divide the power plants into a plurality of categories according to the power plant basic parameter data of each power plant;
[0055] C2. Calculate the deviation degree L = |A-X| / A of the power generation capacity and the grid-connected power of each power plant, where A is the grid-connected power of the power plant, and X is the theoretical monthly power generation capacity of the power plant; if the deviation degree L of the power plant is not within the preset range, mark the abnormal factor I1 thereof as abnormal;
[0056] C3. For each power plant category, taking the grid-connected power time-series data of the central power plant of the category as the benchmark grid-connected power time-series data, respectively performing power generation anomaly identification steps on the remaining power plants in the category: inputting the benchmark grid-connected power time-series data and the grid-connected power time-series data of the current power plant to be identified into the trained first twin neural network model, thereby outputting the similarity of the two sets of data using the twin neural network model, and if the similarity output by the twin neural network model is lower than the first preset degree, marking the anomaly factor I2 of the current power plant to be identified as abnormal;
[0057] C4. For each power consumer, if the anomaly factors I1 and I2 of the power plant associated with the power consumer are both abnormal, marking the power consumption evaluation factor R2 of the power consumer as abnormal.
[0058] The electricity transactions between mining power consumers and power plants are mostly private transactions, and the electricity traded is not grid-connected electricity, so the grid-connected electricity of the power plant associated with the mining power consumer is usually not the actual power generation, which is much less than the theoretical power generation and much less than the grid-connected electricity of similar scale / type normal power plants. The power plant in this case is referred to as an abnormal power plant in this embodiment. In addition to private electricity transactions with mining power consumers, abnormal power plants may also conduct grid-connected electricity transactions with mining power consumers. Among all power consumers conducting electricity transactions on the grid-connected electricity transaction system, power consumers conducting electricity transactions with abnormal power plants have a higher mining suspicion than power consumers conducting electricity transactions with normal power plants. Therefore, this embodiment takes whether a power consumer has electricity transactions with an abnormal power plant as an evaluation index for evaluating the mining suspicion of the power consumer, specifically, a power consumption evaluation factor R2 is designed for each power consumer to represent whether the power consumer has electricity transactions with an abnormal power plant, with R2=0 representing normal and R2=1 representing abnormal. To determine the value of the power consumption evaluation factor R2 of the power consumer, the abnormal power plant needs to be determined first. This embodiment identifies the abnormal power plant as follows:
[0059] First, determine whether the grid-connected electricity deviation L of the power plant is abnormal
[0060] Since the price of hydropower is relatively low, the mining electricity consumer needs to consume a large amount of electricity, in order to save cost, the mining electricity consumer mostly purchases electricity from the hydropower plant, therefore, the embodiment only performs abnormality identification on the hydropower plant. The embodiment first collects the monthly grid-connected electricity quantity A of each hydropower plant and the power generation parameters of the generator set thereof, calculates the theoretical monthly power generation quantity X of each hydropower plant according to the power generation parameters of the generator set, and then calculates the grid-connected electricity quantity deviation L of each hydropower plant according to the deviation calculation formula L == |A-X| / A. In order to reduce the calculation error of the deviation L, the monthly average grid-connected electricity quantity can be calculated by collecting the monthly grid-connected electricity quantity A for several months, and the above formula is used for calculation. The quartile range method is used to find the grid-connected electricity quantity deviation L abnormality of each hydropower plant, specifically, the deviation L of each hydropower plant is sorted from large to small to obtain a deviation array, the upper quartile Q1 and the lower quartile Q3 of the deviation array are determined, the quartile range IQR of the deviation sequence is calculated, and (Q1-1.5*IQR, Q3+1.5*IQR) is used as a preset range. If the grid-connected electricity quantity deviation L of the hydropower plant is not within the range, the abnormality factor I1 of the hydropower plant is marked as 1 (1 represents abnormality).
[0061] Second step, judge whether the grid-connected electricity quantity of the hydropower plant is different from that of the similar scale / type of hydropower plant
[0062] The embodiment collects the parameter data of each hydropower plant from the power grid enterprise, including the region, the total installed capacity (i.e. the total capacity of the hydro-generator set), the power generation type (since the embodiment only performs abnormality identification on the hydropower plant, the power generation type is all hydropower), the total unit rated current voltage, and the related power generation parameters of the generator set, such as the water turbine efficiency, the generator efficiency, the reservoir flow rate, the reservoir tidal range, and the like. The embodiment calculates the theoretical monthly power generation quantity of the hydropower plant according to the related power generation parameters of the generator set thereof, and the calculation process is as follows:
[0063] The calculation formula of the output of the hydropower plant per unit time is:
[0064] P = 9.81 * ηt * ηg * Q * H
[0065] Wherein, P is the output of the hydropower plant per unit time T, ηt is the water turbine efficiency, ηg is the generator efficiency, Q is the flow rate through the water turbine per unit time T, and H is the tidal range of the reservoir of the hydropower plant per unit time T.
[0066] After calculating the output of the hydropower plant per unit time T according to the above formula, the power generation quantity E of the hydropower plant per unit time T is calculated according to E = P * T, and then the theoretical monthly power generation quantity of the hydropower plant is calculated.
[0067] The basic parameters of the power plant, such as the region, total installed capacity, power generation type, total unit rated current voltage, and theoretical monthly power generation, are used as classification factors, and each hydropower plant is taken as a sample, and the specific data of each basic parameter of each hydropower plant is taken as the sample observation value of the corresponding classification factor, to construct the basic data set X. For example, the region is a classification factor in the basic data set X, and the region of a hydropower plant numbered 0001 is Yunnan Nujiang, which is the observation value of the hydropower plant sample numbered 0001 under the classification factor of the region in the basic data set X. In this embodiment, the K-prototype clustering algorithm is used to perform clustering analysis on each hydropower plant according to the sample observation values of each hydropower plant in the basic data set X under each classification factor, and to divide them into multiple categories. The observation values of each hydropower plant in each category under each classification factor are very close, that is, the scales of each hydropower plant in each category are similar. Alternatively, the classification factors can be changed to include only one or several of the region, total installed capacity, power generation type, total unit rated current voltage, and theoretical monthly power generation.
[0068] The grid-connected power data of hydropower plants with similar scales are usually similar. If the grid-connected power of one hydropower plant in multiple hydropower plants with similar scales is significantly lower than that of the remaining hydropower plants, the hydropower plant is likely to have a private transaction with a mining electricity user. Therefore, the similarity between the grid-connected power data of hydropower plants in the same category can be used to identify abnormal hydropower plants. As shown in Figure 2 The twin neural network model is usually used to compare the similarity of two samples. In order to identify abnormal hydropower plants in the same category, the twin neural network model is used to identify the similarity between the grid-connected power time series data of two hydropower plants. As shown in Figure 2 The grid-connected power time series data pair (X i , X j ) is input into the sub-network Network, and the hidden layer mapping obtains Net(w, X i ) and Net(w, X j ), where w is the parameter matrix shared by the sub-network.
[0069] Suppose the neural network has K layers, if the input is X i , x i,b1 , x i,b1 …x i,bm are the characteristic values of the neural network, the Kth layer has p k neurons (k = 1, 2, …, N), and the output of the Kth layer is:
[0070] Z k = s(w k *z k-1 +b k )
[0071] where w k is a p k *bm matrix, b k is a bias vector of length p k , and s is a nonlinear activation function, DICE activation function. In this example, Z k = (z 1 , z 2 ,..., z k ) is defined, and for each element in the output vector Z k of the kth layer, a nonlinear mapping is performed by the activation parameter.
[0072] The DICE activation function is denoted as f(z k ), and has: f(z k ) = p(z k )*z k + (1-p(z k ))*a*z k , where a is a self-defined hyperparameter for controlling the curvature of the activation function; p(z k ) is as follows:
[0073]
[0074] where ε is a self-defined parameter to prevent the denominator from being zero, E(Z k ), Var(Z k ) are the mean and variance of the output Z k of a certain layer.
[0075] The above DICE activation function can automatically shift the sensitive area of the activation function according to the different data distribution of each layer, and move the sensitive area of the activation function to the position of most data distribution in the output of each neural network.
[0076] In this example, the similarity measure function E w (X i , X j ) between the outputs Net(w, X i ) and New(w, X j ) of the twin neural network model is taken as the similarity of the time series data X i , X j of the parallel grid electricity. In this embodiment, the L2 norm is selected as the measure function E w (X i , X j ), as follows:
[0077] E w (X i , X j) = ||Net(w, X i ) - Net(w, X j )||2
[0078] To improve the intra-class similarity measure and expand the inter-class distance, the twin neural network model needs to be trained to minimize the loss, in this case, the loss function is defined as follows:
[0079]
[0080] In the formula, the hyperparameter m represents a margin, and only when the distance of E w (X i , X j ) is within the radius, the loss function will be affected by the input of different classes of time series data, and the weight will be updated; Y is a class factor, which is 0 when the two input data belong to the same cluster, and 1 when the two input data belong to different clusters.
[0081] To minimize the loss, random gradient descent is used to update the weight value. Taking a grid-connected power time series data pair (X i , X j ) as an example, the loss function has the following two cases:
[0082] (1) Y = 0, the loss function is as follows:
[0083]
[0084] The update process of parameters w k and b k is as follows (where u is the learning rate):
[0085]
[0086] (2) Y = 1, the loss function is as follows:
[0087]
[0088] When E w > m, max(0, m - E w ) = 0, the gradient of L D is 0, and w k and b k do not need to be adjusted.
[0089] When E w < m, the update process of parameters w k and b k is as follows (where u is the learning rate):
[0090]
[0091] The overall goal of the twin neural network model is to minimize the loss function L(w,(Y,X i ,X j )). When the time series pairs (i.e., the grid-connected power time series data pairs) input into the network are in the same cluster, according to the property of the L2 norm, the E w (X i , X j ) between the time series pairs will necessarily be smaller, and the overall loss function L(w,(Y,X i ,X j )) at this time is determined by L s (w,X i ,X j ). When the time series pairs input into the network are in different clusters, according to the property of the L2 norm, the E w (X i , X j ) between the time series pairs will necessarily be larger, and the overall loss function L(w,(Y,X i ,X j )) at this time is determined by L D (w,X i ,X j ). According to whether the time series pairs are in the same cluster or not, the corresponding loss function is selected in this embodiment, and in the process of minimizing the loss function using gradient descent, adjusting the network parameters can make the time series pairs in the same cluster more similar and the time series pairs in different clusters less similar.
[0092] The embodiment takes the grid-connected power time series data of two hydropower plants and the cluster to which the two hydropower plants belong as a set of training samples, randomly extracts multiple training samples from all the hydropower plants above, and in particular, in order to optimize the training effect, the extracted training samples should be normal hydropower plants. The grid-connected power time series data of normal hydropower plants is usually highly similar to normal hydropower plants in the same cluster and lowly similar to normal hydropower plants in different clusters. Therefore, when extracting samples, the embodiment needs to preliminarily judge the similarity of the grid-connected power time series data between the two hydropower plants currently extracted. The embodiment considers that although the cosine similarity calculation formula cannot judge the similarity of the time trend of the time series pair, it can judge the numerical similarity of the time series pair and can be used for rough judgment of the similarity of the time series pair. Therefore, the embodiment uses the cosine similarity calculation formula to preliminarily judge the similarity of the grid-connected power time series data between the two hydropower plants currently extracted. For two hydropower plants from the same cluster, only when the cosine similarity of the grid-connected power time series data of the two hydropower plants is greater than 0.7, the two hydropower plants and the cluster to which the two hydropower plants belong are taken as a set of training samples. For two hydropower plants from different clusters, only when the cosine similarity of the grid-connected power time series data of the two hydropower plants is less than 0.3, the two hydropower plants and the cluster to which the two hydropower plants belong are taken as a set of training samples. After the training samples are extracted, the embodiment uses multiple different training samples to train the model until the loss function of the twin neural network model is less than a target threshold value (the numerical value of the target threshold value is set according to the actual situation). At this time, the twin neural network model has been trained. Next, the trained twin neural network model can be used to identify whether the grid-connected power time series data of a hydropower plant is different from that of a similar hydropower plant. The specific operation process is as follows:
[0093] The center grid-connected power time series data of each hydropower plant category is the average value of the grid-connected power time series data of all hydropower plants in the category, denoted as X j = {x j,b1 ,x j,b1 …x j,bn, C}, where C is the category label of the category. The embodiment takes the center grid-connected power time series data X j = {x j,b1 ,x j,b1 …x j,bn, C} of each hydropower plant category as the comparison reference data, and compares the grid-connected power time series data X i = {x i,b1 ,x i,b1 …x i,bm ,C} of the hydropower plant to be identified with the center grid-connected power time series data X j = {x j,b1 ,x j,b1 …xj,bn, C} as input data into the trained twin neural network model, so as to output the similarity of the grid-connected power time series data of the two hydropower plants using the twin neural network model. If the similarity output by the twin neural network model is lower than a first preset degree (for example, 80%), it means that the grid-connected power time series data of the hydropower plant is different from that of the same type of hydropower plant, and then the abnormal factor I2 of the hydropower plant to be identified is marked as 1 (1 represents abnormality), otherwise, it is marked as 0 (0 represents normality).
[0094] The hydropower plant with both abnormal factors I1 and I2 being 1 is marked as an abnormal hydropower plant. The grid-connected power transaction is conducted by the grid enterprise, so after identifying the abnormal hydropower plant, the power consumption evaluation factor R2 of each power consumer with daily average power consumption greater than the mining power consumption benchmark is marked as follows: the power plant information of the power purchased by the power consumer is collected from the grid-connected power transaction data of the grid enterprise, and if the power plant is the abnormal hydropower plant marked above, the power consumption evaluation factor R2 of the power consumer is marked as 1 (1 represents abnormality), otherwise, it is marked as 0 (0 represents normality).
[0095] D.
[0096] For each of the power consumers, the data of the user basic parameters of the power consumer is obtained, the user basic parameters including user type, industry type, contract capacity, running capacity, voltage level and temporary power consumption identifier, and each of the user basic parameters is used as a classification factor to divide the power consumers into multiple categories according to the user basic parameter data of each power consumer; the following power consumption evaluation factor R3 marking step is performed on each of the power consumers:
[0097] D1. The power consumption proportion P = X / Z of each of the power consumers in the peak, valley and flat power consumption periods is calculated, where Z is the total power consumption and X is the power consumption in the power consumption period type;
[0098] D2. For each power consumer category, the power consumption and power consumption proportion P of the central power consumer of the category in the peak, valley and flat power consumption periods are used as the reference power consumption data, and the power consumption anomaly identification step is performed on the remaining power consumers in the category respectively: the reference power consumption data and the power consumption and power consumption proportion P of the power consumer to be identified in the peak, valley and flat power consumption periods are input into the trained second twin neural network model, so as to output the similarity of the two groups of data using the twin neural network model, and if the similarity output by the twin neural network model is lower than a second preset degree, the power consumption evaluation factor R3 of the power consumer to be identified is marked as abnormal.
[0099] The electricity consumption of a mining electricity consumer is usually much larger than that of a normal electricity consumer of similar size / type, and the electricity consumption of the mining electricity consumer is usually evenly distributed among the peak, valley and flat electricity periods, while the electricity consumption of a normal electricity consumer of similar size / type is usually fluctuating among the peak, valley and flat electricity periods. The electricity consumption of a mining electricity consumer is obviously different from that of a normal electricity consumer of similar size / type. If the electricity consumption and the electricity consumption ratio of an electricity consumer among the peak, valley and flat electricity periods are different from those of a normal electricity consumer of similar size / type, the electricity consumer is suspected of mining, which is referred to as an abnormal electricity consumer in the embodiment. Whether the electricity consumption and the electricity consumption ratio of an electricity consumer among the peak, valley and flat electricity periods are different from those of a normal electricity consumer of similar size / type is used as an evaluation index for evaluating the mining suspicion of an electricity consumer, specifically, an electricity evaluation factor R3 is designed for each electricity consumer to represent whether the electricity consumption and the electricity consumption ratio of the electricity consumer among the peak, valley and flat electricity periods are different from those of a normal electricity consumer of similar size / type, with R3=0 representing normal and R3=1 representing abnormal. The abnormal electricity consumer identification in the embodiment is performed in the following manner:
[0100] The embodiment collects user basic parameters of electricity consumers with daily electricity consumption greater than the mining electricity consumption benchmark from the power grid enterprise, and the user basic parameters include user type, industry type, contract capacity, running capacity, voltage level and temporary electricity identification. The electricity consumers are classified into three categories, i.e. residential users, residential small workshop users and enterprise users, according to the user basic parameters. The user basic parameter standards of the residential users, the residential small workshop users and the enterprise users are pre-set, and the electricity consumers meeting the parameter standards of the corresponding categories are classified into the corresponding categories through automatic comparison realized by codes. Preferably, the K-prototype clustering algorithm can be used to classify the electricity consumers into categories in the manner of classifying the hydropower plants as described above.
[0101] Non-preferably, the user basic parameters can be changed to include only one or several of the user type, the industry type, the contract capacity, the running capacity, the voltage level and the temporary electricity identification.
[0102] The embodiment obtains the electricity consumption of each electricity consumer among the peak, valley and flat electricity periods from the power grid enterprise, and calculates the electricity consumption ratio of each electricity consumer among the peak, valley and flat electricity periods according to the following formula:
[0103]
[0104] wherein, P id is the electricity period electricity consumption ratio, Z id is the total electricity consumption, X is the electricity consumption of the electricity period type (the electricity period type has three types: peak electricity period, valley electricity period and flat electricity period), and id is the user id.
[0105] The center of each category in the peak, valley, and flat power consumption periods is the average of the power consumption of all power consumers in the three power consumption periods. The power consumption ratio of each category in the three power consumption periods is calculated accordingly. In this embodiment, the similarity of the power consumption and power consumption ratio of the power consumer to be identified in the peak, valley, and flat power consumption periods is compared with the center of the category to which the power consumer belongs in the peak, valley, and flat power consumption periods. If the similarity is lower than a second preset degree (for example, 80%), it means that the power consumption and power consumption ratio of the power consumer to be identified in the peak, valley, and flat power consumption periods are different from those of the same category, and the power consumption evaluation factor R3 of the power consumer to be identified is marked as 1 (1 represents abnormality), otherwise, it is marked as 0 (0 represents normality). Figure 2 A twin neural network model (hereinafter referred to as a second twin neural network model, and the twin neural network model mentioned above is referred to as a first twin neural network model for distinction) as shown in FIG. 6 is constructed to compare and analyze the power consumption and power consumption ratio of two power consumers in the peak, valley, and flat power consumption periods. In order to enable the twin neural network model to have this comparison and analysis capability, the power consumption and power consumption ratio of two power consumers in the peak, valley, and flat power consumption periods are used as a set of training samples, and a plurality of different training samples are randomly used to train the model until the loss function of the twin neural network model is less than a target threshold value, at which time the twin neural network model is trained. Next, the trained second twin neural network model can be used to identify whether the power consumption and power consumption ratio of a power consumer in the peak, valley, and flat power consumption periods are different from those of the same category. The specific operation process is as follows:
[0106] In this embodiment, the center (i.e., the cluster center) of each power consumer category in the peak, valley, and flat power consumption periods is used as the comparison reference data, which is the average of the power consumption and power consumption ratio of all power consumers in the peak, valley, and flat power consumption periods. In this embodiment, the power consumption and power consumption ratio of the power consumer to be identified in the peak, valley, and flat power consumption periods and the center of the category to which the power consumer belongs in the peak, valley, and flat power consumption periods are used as a set of input data, which is input into the trained second twin neural network model, so that the similarity of the power consumption and power consumption ratio of the two power consumers in the peak, valley, and flat power consumption periods is output by the twin neural network model. If the similarity output by the second twin neural network model is lower than a second preset degree (for example, 80%), it means that the power consumption and power consumption ratio of the power consumer to be identified in the peak, valley, and flat power consumption periods are different from those of the same category, and the power consumption evaluation factor R3 of the power consumer to be identified is marked as 1 (1 represents abnormality), otherwise, it is marked as 0 (0 represents normality).
[0107] E. The mining risk level of each power consumer is determined according to the abnormality of the power consumption evaluation factors R1, R2, and R3 of the power consumer.
[0108] After the above steps B, C, D are performed on all electricity users with daily electricity consumption greater than the electricity consumption benchmark for mining, the electricity evaluation factors R1, R2, R3 of each electricity user have been marked with corresponding values, and the mining risk level of each electricity user can be determined according to the values of the electricity evaluation factors R1, R2, R3 of the electricity user. Specifically, if the electricity evaluation factors R1, R2, and R3 of the electricity user are all 1, i.e., R1, R2, and R3 are all abnormal, the mining risk level of the electricity user is level one, with the highest risk; if the electricity evaluation factors R1 and R3 of the electricity user are both 1 and R2 is 0, the mining risk level of the electricity user is level two, with the second highest risk; if the electricity evaluation factors R1 and R2 of the electricity user are both 1 and R3 is 0, the mining risk level of the electricity user is level three, with a medium-high risk; if the electricity evaluation factor R1 of the electricity user is 1, the mining risk level of the electricity user is level four, with a medium-low risk. Since the electricity evaluation factor R1 of a normal electricity user is almost impossible to be 1, but R2 and R3 may be 1, for an electricity user with only the electricity evaluation factor R2 and / or R3 being 1, it is classified as a normal electricity user without mining risk.
[0109] The above mining behavior detection method based on power data is implemented by a computer program stored in a computer readable storage medium and executed by a computer processor.
[0110] The above is only an embodiment of the present application, and does not limit the scope of patent protection. Those skilled in the art can make non-substantial changes or substitutions based on the present application, and still fall within the scope of patent protection.
Claims
1. A mining behavior detection method based on power data, characterized by: The following steps are involved: A. Calculate the daily power consumption of the lowest-power mining machine and use this as the benchmark for mining power consumption. B. For each electricity user whose average daily electricity consumption exceeds the mining electricity consumption benchmark, perform the following electricity consumption assessment factor R1 marking step: obtain the electricity consumption sequence of the electricity user for n days, and if it is determined that the volatility of the electricity consumption sequence is less than the preset volatility level, mark the electricity consumption assessment factor R1 of the electricity user as abnormal; C. Perform the following electricity consumption assessment factor R2 marking step for each electricity user: C1. Obtain basic parameter data of multiple power plants, and perform cluster analysis on these power plants based on the basic parameter data of each power plant to divide them into multiple categories; C2. Calculate the deviation between each power plant's power generation and grid-connected power generation: L = |AX| / A, where A is the power plant's monthly grid-connected power generation and X is the power plant's theoretical monthly power generation. C3. Obtain the grid-connected power time series data of each power plant and the central grid-connected power time series data of each category, and calculate the similarity between the grid-connected power time series data of each power plant and the central grid-connected power time series data of the category to which it belongs; C4. For each electricity user, if the deviation L of the power plant associated with the electricity user exceeds the preset normal range and its similarity with the central grid-connected power time series data of the corresponding category is lower than a first preset degree, then the electricity consumption assessment factor R2 of the electricity user is marked as abnormal; D. Obtaining basic user parameter data for each electricity user, performing cluster analysis on these electricity users based on their basic user parameter data to divide them into multiple categories, and then performing the following electricity consumption evaluation factor R3 marking step on each electricity user: D1. Calculate the proportion of electricity consumption P for each electricity user during the three peak, off-peak, and average periods based on their electricity consumption during these three periods. D2. Calculate the similarity between each user's electricity consumption and electricity consumption ratio P during peak, off-peak, and average periods and the electricity consumption and electricity consumption ratio P of the center of the category to which it belongs during peak, off-peak, and average periods. If the similarity is lower than a second predetermined level, mark the electricity consumption assessment factor R3 of the current user as abnormal. E. Determine the mining risk level of each electricity user based on the abnormality of the electricity consumption assessment factors R1, R2, and R3.
2. The mining behavior detection method based on power data according to claim 1 is characterized in that: The steps of determining whether the volatility of the power consumption sequence is less than the preset volatility in step B are as follows: B1. For the electricity consumption sequence, use m days as the sliding window length and 1 day as the sliding step length. Perform a straight line fit on the electricity consumption array within each sliding window to obtain the linear slope k, where 8≤m<n; B2. Calculate the variance of each of the slopes k obtained by fitting; B3. If the above variance is less than the preset fluctuation threshold, then the volatility of the electricity consumption series is less than the preset fluctuation level.
3. The mining behavior detection method based on power data according to claim 1 is characterized in that: The interquartile range method is used to determine the preset normal range in step C4 for the array consisting of the deviations of all power plants.
4. The mining behavior detection method based on power data according to claim 3 is characterized in that: The steps for determining the preset normal range using the interquartile range method are as follows: C41. Sort the deviation L of each power plant from largest to smallest to obtain a deviation array; C42. Determine the upper quartile Q1 and the lower quartile Q3 of the deviation array, calculate the interquartile range IQR = Q3 - Q1 of the deviation sequence, and use (Q1 - 1.5*IQR, Q3 + 1.5*IQR) as the preset normal range.
5. The mining behavior detection method based on power data according to claim 2 is characterized in that: In step B1, the value of m is 11.
6. The mining behavior detection method based on power data according to claim 1 is characterized in that: Step E specifically: If the electricity user's electricity consumption assessment factors R1, R2, and R3 are all abnormal, the mining risk level of the electricity user is level one; If only the electricity consumption assessment factors R1 and R3 are abnormal, the mining risk level of the electricity user is level 2; If only the electricity consumption assessment factors R1 and R2 are abnormal, the mining risk level of the electricity user is level three; If only the electricity consumption assessment factor R1 is abnormal, the mining risk level of the electricity user is level 4; Among them, the smaller the mining risk level value, the higher the risk.
7. The mining behavior detection method based on power data according to claim 1 is characterized in that: Step C1 and / or step D uses a K-prototype clustering algorithm to perform category division.
8. The mining behavior detection method based on power data according to claim 1 is characterized in that: The power plant in step C is specifically a hydropower plant.
9. The mining behavior detection method based on power data according to claim 1 is characterized in that: Both step C3 and step D2 use the twin neural network model to perform similarity calculation.
10. A computer-readable storage medium having an executable computer program stored thereon, characterized in that: When the computer program is executed, the mining behavior detection method based on power data as described in any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Residential electricity consumption behavior analysis method based on user electricity consumption information
CN105608639A
Abnormal power consumption behavior detection method and device, computer equipment and storage medium
CN113723861A