A method for intelligent analysis and detection of abnormal electricity consumption in enterprises
By extracting and analyzing the enterprise electricity consumption data and combining daily time-sharing electricity consumption data, rapid screening and accurate analysis of electricity consumption abnormalities is achieved, and early warning of electricity consumption is carried out through the ARIMA model, which solves the problem of using the existing technology The problem of insufficient efficiency and accuracy of electrical data abnormal detection.
Patent Information
- Application Number
- CN202410510962.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-04-26
AI Technical Summary
It is difficult for the existing technology to quickly and accurately detect abnormal situations in enterprise power consumption data, such as enterprise entity changes, production line transformation and production suspension.
Feature extraction is performed through historical daily total electricity consumption data, combined with daily time-sharing electricity consumption data, and using rapid analysis algorithms and accurate analysis algorithms to realize initial screening and accurate analysis of electricity consumption abnormalities, and through abnormal period analysis and ARIMA model Electricity warning.
It realizes the rapid and accurate discovery of abnormal situations from enterprise electricity consumption data, and improves the efficiency and accuracy of electricity consumption data monitoring and early warning.
Smart Images

Figure CN118396223B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of enterprise electricity consumption detection and involves various enterprise data anomaly detection technologies. Background Art
[0002] With the development of smart grid in my country, as an important part of electricity consumption, smart meters can realize functions such as energy measurement, real-time monitoring, network communication, information storage, information interaction and automatic control, and can realize accurate load curve recording, so as to promote users to make more reasonable electricity consumption planning. In industrial parks, smart meters are used to collect data from electricity users, and technical means such as feature comparison, statistical analysis and data mining are used to realize electricity consumption monitoring and prediction, which is a typical application based on power data.
[0003] Through long-term power consumption data analysis, it can be found that the power consumption of a factory is stable. If the production content is changed midway, the power consumption required for production will change significantly. If the difference is too large, it can be compared with the original power consumption data, and a warning can be issued if the result is too different. According to the data characteristics and the detection time dimension, peak and trough detection, similarity detection and other machine learning methods based on high time dimensions can be used for detection. Summary of the invention
[0004] In order to solve the above problems, the present invention proposes a method for detecting abnormality in electricity consumption data.
[0005] An intelligent analysis and detection method for abnormal electricity consumption in an enterprise is provided to realize rapid and accurate discovery of abnormal conditions in the enterprise from the electricity consumption data of the enterprise. The abnormal conditions in the enterprise include: changes in the main body of the enterprise, transformation of the production line, and suspension of production. The steps are as follows:
[0006] S1: Extract features through historical daily total electricity consumption data, and obtain a fast analysis algorithm for abnormal electricity consumption based on the daily total electricity consumption data of the most recent statistical period to achieve initial screening of abnormalities;
[0007] S2: For the abnormal results that have been screened in the previous step, accurate analysis of power consumption anomalies is achieved by obtaining the company's daily time-of-day power consumption data (peak, flat, and valley);
[0008] S3: Through the historical daily total electricity consumption and historical daily time-based electricity consumption data, combined with the first and second steps, abnormal cycle analysis based on known electricity consumption data is realized.
[0009] Preferably, in step S1, the fast analysis algorithm based on the abnormal daily total power consumption includes data preprocessing, and the steps are as follows:
[0010] A1: After obtaining the electricity consumption data of the most recent statistical period, carefully check and correct any data that does not conform to the specifications. If there are some abnormal data with negative values, delete the data of these enterprises and do not issue subsequent abnormal warnings.
[0011] A2: The data includes the peak, average, off-peak and total electricity consumption of each enterprise. When the difference between the sum of the peak, average, off-peak and total electricity consumption is too large, it means that there are abnormal data in the data. These situations will be classified and collected to ensure that the abnormal data will not affect the analysis results.
[0012] A3: For enterprises with too little total electricity consumption, data will also be deleted because these data cannot provide meaningful analysis and judgment.
[0013] Preferably, in step S1, the fast analysis algorithm based on the abnormal daily total power consumption includes a box plot analysis. According to historical data, the relevant parameters of the box plot are as follows:
[0014] The lower quartile is located at: ,
[0015] The upper quartile is located at: ,
[0016] Lower quartile: ,
[0017] Upper quartile: ,
[0018] Interquartile range: ,
[0019] Lower Boundary: ,
[0020] Upper Boundary: ,
[0021] n is the number of data, num represents the data set. Since the establishment of the box plot will be affected by the data distribution, when there are continuous 0 values in the enterprise electricity consumption data, it is necessary to handle them according to different situations. For enterprises with continuous 0 values at the beginning or end of the data, they are regarded as not in operation or have stopped production. The continuous 0 value data in this part are not considered when calculating the box plot. When the middle part of the data is continuous 0 values, it is considered to be part of the normal electricity consumption pattern of the enterprise and no data processing is performed. When the total daily electricity consumption data exceeds 10% of the box plot boundary, it is judged as abnormal.
[0022] Preferably, in step S2, an accurate analysis algorithm based on the abnormal daily time-sharing power consumption is implemented, and the Pearson correlation coefficients of the peak, peak and valley power consumption and the total power consumption are calculated through the daily time-sharing power consumption data to perform similarity analysis. The relevant steps are as follows:
[0023] First, enterprises with a total electricity consumption of less than 60 kWh are excluded and no similarity analysis is performed;
[0024] For other enterprise data, the judgment is mainly based on two aspects. First, when the enterprise's historical daily time-sharing electricity consumption data is very similar to the total electricity consumption, there is a calculated Pearson correlation coefficient, but the recent data does not meet the above conditions and there is no Pearson correlation coefficient, it means that the enterprise's recent production electricity consumption has undergone major changes and an early warning is needed. Second, when the enterprise's historical data and new data both meet the conditions and there is a calculated Pearson correlation coefficient, the order of the Pearson correlation coefficients of each time-sharing data will be compared. If the order of the Pearson correlation coefficients of the historical data and the recent data in each time-sharing data is inconsistent, it means that the enterprise's production electricity consumption has undergone major changes and an early warning is needed.
[0025] Preferably, in step S3, an abnormal statistical cycle analysis algorithm based on known power consumption data is implemented, and the relevant steps are as follows:
[0026] B1. Use the min-max method to normalize the original load data to the interval [0,1]. The min-max normalization formula is as follows: ,
[0027] in, x is the original load data, min(x) is the minimum value in the original load data, max(x) is the maximum value, Represents the data sequence after min-max normalization;
[0028] B2, based on the boundary values calculated by the box plot, the data is divided into adaptive dynamic periods;
[0029] B3. Calculate the mean of each period data and compare their differences. If the mean difference is too large, issue an early warning. The mean calculation formula is as follows:
[0030] ;
[0031] Where N is the amount of data in each cycle, M is the number of cycles, For each data value, is the average value of the ith period.
[0032] Preferably, in step B2, the specific steps of adaptive dynamic period division analysis are as follows:
[0033] B2.1: Adaptive threshold calculation: sort the data, calculate the means of the first 25% and the last 25% of the data respectively, and determine the threshold by the difference between the two means, that is, the maximum allowed period mean difference. This method allows the algorithm to adaptively adjust the threshold according to the actual data situation to adapt to different data distributions;
[0034] B2.2: Dynamic cycle division. Since the cycle pattern of factory electricity consumption data is not clear, it is necessary to dynamically divide the cycle according to the peak and valley conditions of electricity consumption. First, the data is divided based on the boundary values calculated by the box plot. During the division process, it is necessary to ensure that it is as uniform as possible. Starting from the lower boundary of the box plot, find a value less than or equal to the lower boundary as the segmentation point for dynamic cycle division. In this process, it is necessary to ensure that the first third and the last third of the data have cycle grouping. If the segmentation point is not found, the lower boundary is moved up cyclically with a certain step size to find the segmentation point. If multiple upward movements cannot find a uniform segmentation point, it means that the data is abnormal and an early warning is required. If continuous segmentation points appear, they are merged.
[0035] Preferably, in step B3, after the mean is calculated, the difference between the current cycle and other cycles is calculated, and the result is saved in a matrix. Each row in the matrix represents the absolute value of the difference between the electricity consumption data of the ith cycle and other cycles. When the electricity consumption data of a certain enterprise exceeds the set threshold multiple times, it means that there is a difference in the scale of electricity consumption of the enterprise, and an early warning is needed. In addition, the maximum and minimum values of each row of data in the difference matrix are found. When the maximum value is significantly larger than the minimum value by multiple times, it is also considered that there is a large difference between the electricity consumption data of the enterprise between the two cycles, and an early warning is needed.
[0036] Preferably, in step S3, it also includes predicting electricity consumption through the ARIMA model, comparing the predicted value with the actual value of the enterprise's electricity consumption data, and if the difference is too large, it means that the enterprise's electricity consumption pattern has a large change, then an electricity consumption warning is issued. The ARIMA related parameter calculation steps are as follows:
[0037] C1: Determine d
[0038] If the time series has an unsteady trend, the time series is differentiated until a stationary series is obtained. Consider a time series Y t , where t is time, the difference Y t With Y t-1 Defined as:
[0039] ,
[0040] C2: Calculate the autocorrelation coefficient
[0041] In the AR model, the target variable is predicted mainly based on the combination of historical data of the target variable. A p-order autoregressive model can be expressed as follows:
[0042] ,
[0043] Here It is white noise. White noise is a special random process with the characteristics of disorder, constant mean, constant variance, and independence. is the time series data we are considering, are the parameters of the AR model, which are used to describe the relationship between the current value and the values at p time points in the past. c is a constant term. Assuming there is a time series , then for any lag k, the autocorrelation coefficient ρ(k) can be expressed as:
[0044] ,
[0045] in, is the variance of the observations at time point t and time point t+k, It is a time series The variance of the autocorrelation function ACF ranges from -1 to 1;
[0046] C3: Calculate partial correlation coefficient
[0047] In the MA model, historical forecast errors are used to build a regression model. The formula is as follows: ,
[0048] here is white noise, this model is called MA (q) model, that is, q-order moving average model, Each value of can be considered as a weighted moving average of historical forecast errors;
[0049] C4: Observe the ACF and PACF graphs to select the model type and find the appropriate p and q values;
[0050] C5: Model Evaluation
[0051] The representation of the ARIMA model is as follows:
[0052] ,
[0053] The predictor variables on the right side include The delayed value and the delayed error, where p is the autoregressive model order, d is the difference order, and q is the moving average model order, the AIC information criterion can be expressed as:
[0054] ,
[0055] Where L is the likelihood function of the data, k=1 when c≠0, and k=0 when c=0. For the ARIMA model, the corrected AIC value can be expressed as: ,
[0056] Add or subtract one to p or q of the current model and clear or add the constant c of the current model, then calculate the AICc value of the derived model, and repeat this step until no smaller AICc value appears. The model at this time is the best model. Then, perform residual analysis on the fitted ARIMA model. If the residual does not appear as white noise, then the model needs to be modified and the p and q values in the model need to be changed. If the residual looks like white noise, then the next model prediction can be performed.
[0057] C6: Model prediction
[0058] First, the concept of delay operator is introduced. Delay operator B is an important marker, which is used to represent the delay of time series: , then make a prediction, which can be obtained through the following steps:
[0059] ① Transform the ARIMA equation to on the left side of the equal sign and the other terms on the right side,
[0060] ②Replace t with T+h and rewrite the entire equation.
[0061] ③ On the right side of the equation, use the predicted value to replace the future observation value, use zero to replace the future prediction error, and use the corresponding residual to replace the historical error. Starting from h=1, continuously increase h, and repeat the above steps until all the predicted values are calculated. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This is a comparison chart of the box plot of the electricity consumption data of the enterprise with ID 224 before and after processing.
[0063] Figure 2 This is a box-line chart analysis of the electricity consumption data of the enterprise with ID 358.
[0064] Figure 3 Pearson correlation coefficient calculated from historical data for some companies.
[0065] Figure 4 for Figure 3 Pearson correlation coefficient calculated from electricity consumption data for the most recent statistical period.
[0066] Figure 5 This is the periodic mean analysis chart of the electricity consumption data of enterprise with ID 220.
[0067] Figure 6 This is the total daily electricity consumption data of the enterprise with ID 300.
[0068] Figure 7 This is a diagram of the electricity consumption prediction model for ID 300. DETAILED DESCRIPTION
[0069] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0070] An intelligent analysis and detection method for abnormal electricity consumption in enterprises can realize the rapid and accurate discovery of abnormal conditions such as enterprise entity changes, production line transformation, and production suspension from enterprise electricity consumption data. The steps are as follows:
[0071] S1: Extract features through historical daily total electricity consumption data, and obtain a fast analysis algorithm for abnormal electricity consumption based on the daily total electricity consumption data of the most recent statistical period to achieve initial screening of abnormalities;
[0072] S2: For the abnormal results that have been screened in the previous step, accurate analysis of power consumption anomalies is achieved by obtaining the company's daily time-of-day power consumption (peak, flat, and valley) data;
[0073] S3: Through the historical daily total electricity consumption and historical daily time-based electricity consumption data, combined with the first and second steps, abnormal cycle analysis based on known electricity consumption data is realized.
[0074] Details are as follows.
[0075] 1) Data preprocessing
[0076] In step S1, the fast analysis algorithm based on the abnormal daily total power consumption includes data preprocessing, and its steps are as follows:
[0077] A1: After obtaining the electricity consumption data of the most recent statistical period, carefully check and correct any data that does not conform to the specifications. If there are some abnormal data with negative values, delete the data of these enterprises and do not issue subsequent abnormal warnings.
[0078] A2: The data includes the peak, average, off-peak and total electricity consumption of each enterprise. When the difference between the sum of the peak, average, off-peak and total electricity consumption is too large, it means that there are abnormal data in the data. These situations will be classified and collected to ensure that the abnormal data will not affect the analysis results.
[0079] A3: For enterprises with too little total electricity consumption, data will also be deleted because these data cannot provide meaningful analysis and judgment.
[0080] The accuracy of data is easily affected by many factors, such as damage to data acquisition equipment, software failure or signal interference, which often leads to incomplete or even distorted load data. Therefore, it is necessary to pre-process abnormal data values according to the characteristics of the project data.
[0081] First, carefully check and correct the data that does not meet the standards. After obtaining the data, there are some abnormal data with negative values. Based on this, the data of these enterprises are deleted and no subsequent abnormal warnings are issued. Since the data includes the peak, peak, flat, valley electricity consumption and total electricity consumption of each enterprise, when the difference between the sum of the peak, peak, flat, valley electricity consumption and the total electricity consumption is too large, it means that there is abnormal data in the data. Therefore, these situations will be classified and collected to ensure that abnormal data will not affect the analysis results. Finally, for enterprises with too small total electricity consumption, data deletion will also be carried out because these data cannot provide meaningful analysis and judgment. Therefore, the data preprocessing step is to ensure that a reliable data set that conforms to the actual situation is obtained.
[0082] (2) Box plot detection
[0083] In step S1, the fast analysis algorithm based on the anomaly of the total daily power consumption includes a box plot analysis. In the box plot, the detection of abnormal data is mainly based on the upper quartile (Q3) and the lower quartile (Q1), as well as the box range (IQR) calculated by these two values. Since the detection of outliers is mainly based on the distribution of data, it is relatively robust to the upper and lower edges of the data set and is not affected by the extreme values of the overall data. According to historical data, its relevant parameters are as follows:
[0084] The lower quartile is located at: ,
[0085] The upper quartile is located at: ,
[0086] Lower quartile: ,
[0087] Upper quartile: ,
[0088] Interquartile range: ,
[0089] Lower Boundary: ,
[0090] Upper Boundary: ,
[0091] n is the number of data, num represents the data set. Since the establishment of the box plot will be affected by the data distribution, when there are continuous 0 values in the enterprise electricity consumption data, it is necessary to handle them according to different situations. For enterprises with continuous 0 values at the beginning or end of the data, they are regarded as not in operation or have stopped production. The continuous 0 value data in this part are not considered when calculating the box plot. When the middle part of the data is continuous 0 values, it is considered to be part of the normal electricity consumption pattern of the enterprise and no data processing is performed. When the total daily electricity consumption data exceeds 10% of the box plot boundary, it is judged as abnormal.
[0092] Traditional electricity consumption data monitoring mainly uses methods such as average, maximum, and minimum values to detect data. These methods are easily affected by extreme values in the data, resulting in unstable detection. For example, in actual applications, factory electricity consumption data may have too small values due to holiday shutdowns. Therefore, this project uses a more stable box plot method to quickly detect electricity consumption data.
[0093] The standard for judging outliers in box plots is based on quartiles and interquartile ranges. Quartiles have a certain degree of resistance, and up to 25% of the data can become arbitrarily far without greatly disturbing the quartiles, so extreme values will not affect the data shape of the box plot. Therefore, box plots are more stable when detecting outliers, and the results are more objective.
[0094] When there are continuous 0 values in the enterprise electricity consumption data, it is necessary to handle them according to different situations, because the establishment of the box plot will be affected by the data distribution. For enterprises with continuous 0 values at the beginning or end of the data, they are regarded as not in operation or have stopped production. Therefore, this part of the continuous 0 value data is not considered when calculating the box plot. When processing the box plot before continuous 0 values, a large amount of abnormal data will be detected. The box plot obtained after data correction will reduce the number of abnormal values detected. When the data in the middle part is continuous 0 values, it is considered to be part of the normal electricity consumption pattern of the enterprise and no data processing is performed. The comparison of data before and after processing is as follows: Figure 1 Through in-depth analysis of corporate electricity consumption data, typical abnormal electricity consumption behavior patterns are defined. For example, the presence of a large amount of pulse data may be a sign of concealed production of illegal products, such as Figure 2 shown.
[0095] (3) Similarity analysis
[0096] In step S2, an accurate analysis algorithm based on the abnormal daily time-of-day electricity consumption is implemented, and the Pearson correlation coefficients of the peak, peak, and valley electricity consumption and the total electricity consumption are calculated through the daily time-of-day electricity consumption data to perform similarity analysis. The Pearson Correlation coefficient (Pearson Correlation), also known as the Pearson Product-Moment Correlation Coefficient (PPMCC), is used to measure the linear correlation between two variables, and its value is between -1 and 1. Cosine similarity is only related to the direction of the vector and will be affected by the translation of the vector. In the angle cosine formula, if x is translated to x+1, the cosine value will change. The Pearson correlation coefficient will not be affected by this situation.
[0097] The relevant steps are as follows:
[0098] First, enterprises with a total electricity consumption of less than 60 kWh are excluded and no similarity analysis is performed.
[0099] For other enterprise data, the judgment is mainly based on two aspects. First, when the enterprise's historical daily time-sharing electricity consumption data is very similar to the total electricity consumption, there is a calculated Pearson correlation coefficient, and the recent data does not meet the above conditions and there is no Pearson correlation coefficient, it means that the enterprise's recent production electricity consumption has undergone a significant change and an early warning is needed. The absence of a Pearson correlation coefficient here means that the similarity coefficient between the current data and the total electricity consumption data has not been saved, that is, there is similarity data in the historical data, but the similarity of the current data does not meet the preservation conditions and is empty. The peaks and valleys of the historical data have a certain relationship with the total electricity consumption data, but the current data does not, so an early warning is issued. Second, when the enterprise's historical data and new data meet the conditions and there is a calculated Pearson correlation coefficient, the Pearson correlation coefficients of each time-sharing data will be compared in order. If the order of the Pearson correlation coefficients of the historical data and the recent data in each time-sharing data is inconsistent, it means that the enterprise's production electricity consumption has undergone a significant change and an early warning is needed.
[0100] The relationship between the power consumption patterns of different time periods in the same factory and the total power consumption data has a certain regularity. Therefore, the new data can be detected for anomalies based on the similarity calculation between the time-sharing data and the total power consumption data. When the factory changes production, its power consumption data will also change, thereby changing the similarity and causing anomaly warnings.
[0101] The judgment is mainly based on two aspects. First, when the company's historical data meets the above conditions and there is a calculated Pearson correlation coefficient, but the newly added data does not meet the above conditions and there is no Pearson correlation coefficient, it means that the company's recent production electricity consumption has undergone a significant change, so an early warning is needed. Second, when the company's historical data and newly added data both meet the conditions and there is a calculated Pearson correlation coefficient, the size order of each time-sharing data will be compared. If the size order of the Pearson correlation coefficients of the historical data and the newly added data in each time-sharing data is inconsistent, it means that the company's production electricity consumption has undergone a significant change and an early warning is needed.
[0102] according to Figure 3 From the Pearson correlation coefficient calculated from historical data, we can see that the peak period data of the enterprise 212 has the highest similarity with the total power consumption data, and the peak period has the lowest similarity. Based on this, the power consumption data is compared after the correlation coefficient is calculated. Normal power consumption data should also have the same correlation. The results obtained after calculation are as follows Figure 4 shown. Figure 4 Among them, the similarity between enterprise 212 and the total electricity consumption data is highest during the valley period, and lowest during the peak period. The correlation with the historical data is different, so a data warning is issued for enterprise 212.
[0103] (4) Cycle mean analysis
[0104] In step S3, an abnormal statistical cycle analysis algorithm based on known power consumption data is implemented. The relevant steps are as follows:
[0105] B1. Use the min-max method to normalize the original load data to the interval [0,1]. The min-max normalization formula is as follows: ,
[0106] in, x is the original load data, min(x) is the minimum value in the original load data, max(x) is the maximum value, Represents the data sequence after min-max normalization;
[0107] B2, based on the boundary values calculated by the box plot, the data is divided into adaptive dynamic periods;
[0108] B3. Calculate the mean of each period data and compare their differences. If the mean difference is too large, issue an early warning. The mean calculation formula is as follows:
[0109] ;
[0110] Where N is the amount of data in each cycle, M is the number of cycles, For each data value, is the average value of the ith period.
[0111] In step B2, the specific steps of adaptive dynamic period division analysis are as follows:
[0112] B2.1: Adaptive threshold calculation: sort the data, calculate the means of the first 25% and the last 25% of the data respectively, and determine the threshold by the difference between the two means, that is, the maximum allowed period mean difference. This method allows the algorithm to adaptively adjust the threshold according to the actual data situation to adapt to different data distributions;
[0113] B2.2: Dynamic cycle division. Since the cycle pattern of factory electricity consumption data is not clear, it is necessary to dynamically divide the cycle according to the peak and valley conditions of electricity consumption. First, the data is divided based on the boundary values calculated by the box plot. During the division process, it is necessary to ensure that it is as uniform as possible. Starting from the lower boundary of the box plot, find a value less than or equal to the lower boundary as the segmentation point for dynamic cycle division. In this process, it is necessary to ensure that the first third and the last third of the data have cycle grouping. If the segmentation point is not found, the lower boundary is moved up cyclically with a certain step size to find the segmentation point. If multiple upward movements cannot find a uniform segmentation point, it means that the data is abnormal and an early warning is required. If continuous segmentation points appear, they are merged.
[0114] In step B3, after the mean is calculated, the difference between the current cycle and other cycles is calculated, and the result is saved in a matrix. Each row in the matrix represents the absolute value of the difference between the electricity consumption data of the i-th cycle and other cycles. When the electricity consumption data of an enterprise exceeds the set threshold for multiple times, it means that there is a difference in the scale of electricity consumption of the enterprise, and an early warning is needed. In addition, the maximum and minimum values of each row of data in the difference matrix are found. When the maximum value is significantly greater than the minimum value by multiple times, it is also considered that there is a large difference between the electricity consumption data of the enterprise between the two cycles, and an early warning is needed.
[0115] The data is grouped based on the boundary values calculated by the box plot. Since the overall electricity consumption data fluctuates, the lower boundary of the box plot is used as the starting point to find values less than or equal to the lower boundary, and the data is grouped based on these values. Each group of data is dynamically defined as a cycle. Since the electricity consumption data of a certain enterprise is continuously below the lower boundary for many days, the grouping results will be incorrect. To solve this problem, these continuous values are merged into the same group. In addition, in order to ensure the rationality of the grouping, it is necessary to ensure that the first third and the last third of the data have periodic groupings, and if the lower boundary is moved up multiple times and there is still a part where the split point is not found, then this section of data is considered abnormal and given an early warning.
[0116] Finally, for each period data divided, the mean is calculated and their differences are compared. If the mean difference is too large, an early warning is issued.
[0117] First, sort the data, calculate the means of the first 25% and the last 25% of the data, and determine the threshold by the difference between the two means, that is, the maximum period mean difference allowed. This method allows the algorithm to adaptively adjust the threshold according to the actual data situation to adapt to different data distributions.
[0118] Since the cycle pattern of factory electricity consumption data is not clear, it is necessary to dynamically divide the cycle according to the peak and valley conditions of electricity consumption. First, the data is divided based on the boundary values calculated by the box plot. During the division process, it is necessary to ensure that it is as uniform as possible. Starting from the lower boundary of the box plot, find a value less than or equal to the lower boundary as the segmentation point for dynamic cycle division. In this process, it is necessary to ensure that there are cycle groups in the first third and the last third of the data. If the segmentation point is not found, the lower boundary is moved up cyclically with a certain step size to find the segmentation point. If a uniform segmentation point cannot be found after multiple upward movements, it means that the data is abnormal and an early warning is required. If continuous segmentation points appear, they are merged.
[0119] Based on the dynamic division of cycles, the data of each cycle is averaged. Then, the difference between the current cycle and other cycles is calculated and the result is saved in a matrix. Each row in the matrix represents the absolute value of the difference between the electricity consumption data of the ith cycle and other cycles. When the electricity consumption data of an enterprise exceeds the set threshold multiple times, it means that there is a difference in the scale of electricity consumption of the enterprise and an early warning is required.
[0120] In addition, find out the maximum and minimum values of each row of data in the difference matrix. When the maximum value is significantly larger than the minimum value by multiple times, it is considered that there is a large difference between the two periods in the enterprise's electricity consumption data, and an early warning is needed.
[0121] right Figure 5 By analyzing the data of the enterprises in the middle period, we can see that there is a significant difference between the data of enterprise 220 in the initial stage and the data in the middle and late stages. Therefore, the difference in the average values calculated by the relevant period grouping is large, indicating that the enterprise may have made production changes privately and needs to be warned.
[0122] (5) ARIMA early warning
[0123] In step S3, it also includes forecasting electricity consumption through the ARIMA model, comparing the predicted value with the actual value of the enterprise's electricity consumption data. If the difference is too large, it means that the enterprise's electricity consumption pattern has changed significantly, and then an electricity consumption warning is issued. The basic idea of the ARIMA model is to eliminate non-stationarity by differencing time series data, and then use a combination of autoregression and moving average to describe the correlation and randomness of the data. The ARIMA model has three key parameters: p, d and q, which represent the autoregression order, the difference order and the moving average order respectively. The steps for calculating ARIMA related parameters are as follows:
[0124] C1: Determine d
[0125] If the time series has an unsteady trend, the time series is differentiated until a stationary series is obtained. Consider a time series Y t , where t is time, the difference Y t With Y t-1 Defined as:
[0126] ,
[0127] C2: Calculate the autocorrelation coefficient
[0128] In the AR model, the target variable is predicted mainly based on the combination of historical data of the target variable. A p-order autoregressive model can be expressed as follows:
[0129] ,
[0130] Here It is white noise. White noise is a special random process with the characteristics of disorder, constant mean, constant variance, and independence. is the time series data we are considering, are the parameters of the AR model, which are used to describe the relationship between the current value and the values at p time points in the past. c is a constant term. Assuming there is a time series , then for any lag k, the autocorrelation coefficient ρ(k) can be expressed as:
[0131] ,
[0132] in, is the variance of the observations at time point t and time point t+k, It is a time series The variance of the autocorrelation function ACF ranges from -1 to 1;
[0133] C3: Calculate partial correlation coefficient
[0134] In the MA model, historical forecast errors are used to build a regression model. The formula is as follows: ,
[0135] here is white noise, this model is called MA (q) model, that is, q-order moving average model, Each value of can be considered as a weighted moving average of historical forecast errors;
[0136] C4: Observe the ACF and PACF graphs to select the model type and find the appropriate p and q values;
[0137] C5: Model Evaluation
[0138] The representation of the ARIMA model is as follows:
[0139] ,
[0140] The predictor variables on the right side include The delayed value and the delayed error, where p is the autoregressive model order, d is the difference order, and q is the moving average model order, the AIC information criterion can be expressed as:
[0141] ,
[0142] Where L is the likelihood function of the data, k=1 when c≠0, and k=0 when c=0. For the ARIMA model, the corrected AIC value can be expressed as: ,
[0143] Add or subtract one to p or q of the current model and clear or add the constant c of the current model, then calculate the AICc value of the derived model, and repeat this step until no smaller AICc value appears. The model at this time is the best model. Then, perform residual analysis on the fitted ARIMA model. If the residual does not appear as white noise, then the model needs to be modified and the p and q values in the model need to be changed. If the residual looks like white noise, then the next model prediction can be performed.
[0144] C6: Model prediction
[0145] First, the concept of delay operator is introduced. Delay operator B is an important marker, which is used to represent the delay of time series: , then make a prediction, which can be obtained through the following steps:
[0146] ① Transform the ARIMA equation to on the left side of the equal sign and the other terms on the right side,
[0147] ②Replace t with T+h and rewrite the entire equation.
[0148] ③ On the right side of the equation, use the predicted value to replace the future observation value, use zero to replace the future prediction error, and use the corresponding residual to replace the historical error. Starting from h=1, continuously increase h, and repeat the above steps until all the predicted values are calculated.
[0149] The Autoregressive Integral Moving Average (ARIMA) model is a commonly used time series analysis method used to predict future data points or model time series data. The ARIMA model combines the characteristics of the autoregressive (AR) model, the integrated model, and the moving average (MA) model to predict future data points by analyzing and modeling the historical data of the time series. This project uses the historical data of corporate electricity consumption to train the ARIMA model, and then compares the electricity consumption forecast value of the ARIMA model with the actual value of the corporate electricity consumption data. If the difference is too large, it means that the corporate electricity consumption pattern has changed significantly, and an electricity consumption warning is issued.
[0150] Use the company's historical electricity consumption data to train the ARIMA model, and then compare the electricity consumption forecast value of the ARIMA model with the actual value of the company's electricity consumption data. If the difference is too large, it means that the company's electricity consumption pattern has changed significantly, and an electricity consumption warning will be issued.
[0151] Figure 6 is the daily total electricity consumption data of the enterprise with ID 300. By training the ARIMA model with the data of the first 96 days as historical data, we can obtain the electricity consumption prediction model for enterprise 300, such as Figure 7 As shown. The blue line in the figure is the predicted electricity consumption value of the enterprise 10 days later, the dark blue part is the prediction with a confidence level of 80%, and the light blue part is the prediction with a confidence level of 95%. When the actual electricity consumption data of the enterprise is within the light blue range, the electricity consumption data is considered reasonable. If it exceeds the range, the electricity consumption data is considered abnormal. Due to the strong volatility of the data, it is set that an early warning will be issued only when there are more than 3 abnormal values. Because the test data of Enterprise 300 has increased significantly compared with the historical data, there are more than 3 abnormal values, so an early warning is required.
Claims
1. An intelligent analysis and detection method for abnormal electricity consumption in an enterprise, which can quickly and accurately discover abnormal conditions in the enterprise from the electricity consumption data of the enterprise, and the abnormal conditions in the enterprise include: Change of enterprise entity, production line transformation, and suspension of production, characterized by the following steps: S1: Extract features through historical daily total power consumption data, and obtain a fast analysis algorithm for power consumption anomalies based on the daily total power consumption data of the most recent statistical period to achieve initial screening of anomalies. The fast analysis algorithm includes box plot analysis; S2: For the abnormal results that have been screened out in the previous step, the daily time-based electricity consumption of the enterprise is obtained to achieve accurate analysis of the abnormal electricity consumption. The Pearson correlation coefficients of the peak, valley and total electricity consumption are calculated through the daily time-based electricity consumption data to perform similarity analysis. The relevant steps are as follows: First, enterprises with a total electricity consumption of less than 60 kWh are excluded and no similarity analysis is performed; For other enterprise data, judgment is made from two aspects. First, when the similarity between the enterprise's historical peak, peak and valley electricity consumption data and the total electricity consumption is very large, there is a calculated Pearson correlation coefficient, but the recent peak, peak and valley electricity consumption data and the total electricity consumption data do not have a Pearson correlation coefficient, it means that the enterprise's recent production electricity consumption has undergone a significant change, and an early warning is issued; second, when the enterprise's historical peak, peak and valley electricity consumption data and the recent peak, peak and valley electricity consumption and the total electricity consumption data have a calculated Pearson correlation coefficient, the size order of the Pearson correlation coefficients between the historical peak, peak and valley electricity consumption data and the total electricity consumption data is compared with the size order of the Pearson correlation coefficients between the recent peak, peak and valley electricity consumption data and the total electricity consumption data. If the size order of the Pearson correlation coefficients of the historical data and the recent data in the peak, peak and valley periods is inconsistent, it means that the enterprise's production electricity consumption has undergone a significant change, and an early warning is issued; S3: Through the historical daily total power consumption and historical daily time-based power consumption data, combined with the first and second steps, abnormal cycle analysis based on known power consumption data is realized. The relevant steps are as follows: B1. Use the min-max method to normalize the original load data to the interval [0,1]. The min-max normalization formula is as follows: , Among them, x is the original load data, min(x) is the minimum value in the original load data, max(x) is the maximum value, Represents the data sequence after min-max normalization; B2, based on the boundary values calculated by the box plot, the data is divided into adaptive dynamic periods; B3. For each divided period data, calculate the mean and compare their differences. If the mean difference is too large, issue an early warning. The mean calculation formula is as follows: , In step B2, the specific steps of adaptive dynamic period division analysis are as follows: B2.1: Adaptive threshold calculation: sort the data, calculate the means of the first 25% and the last 25% of the data respectively, and determine the threshold by the difference between the two means, that is, the maximum allowed period mean difference. This method allows the algorithm to adaptively adjust the threshold according to the actual data situation to adapt to different data distributions; B2.2: Dynamic cycle division. Since the cycle pattern of factory electricity consumption data is not clear, it is necessary to dynamically divide the cycle according to the peak and valley conditions of electricity consumption. First, the data is divided based on the boundary values calculated by the box plot. During the division process, it is necessary to ensure uniformity. Starting from the lower boundary of the box plot, find a value less than or equal to the lower boundary as the segmentation point for dynamic cycle division. In this process, it is necessary to ensure that the first third and the last third of the data have cycle grouping. If the segmentation point is not found, the lower boundary is moved up cyclically with a certain step size to find the segmentation point. If a uniform segmentation point cannot be found after multiple upward movements, it means that the data is abnormal and an early warning is required. If continuous segmentation points appear, they are merged. In step B3, after the mean is calculated, the difference between the current cycle and other cycles is calculated, and the result is saved in a matrix. Each row in the matrix represents the absolute value of the difference between the electricity consumption data of the i-th cycle and other cycles. When the electricity consumption data of an enterprise exceeds the set threshold for multiple times, it means that there is a difference in the scale of electricity consumption of the enterprise, and an early warning is needed. In addition, the maximum and minimum values of each row of data in the difference matrix are found. When the maximum value is significantly greater than the minimum value by multiple times, it is also considered that there is a large difference between the electricity consumption data of the enterprise between the two cycles, and an early warning is needed.
2. According to claim 1, a method for intelligent analysis and detection of abnormal electricity consumption in an enterprise is characterized by: In step S1, the fast analysis algorithm based on the abnormal daily total power consumption includes data preprocessing, and its steps are as follows: A1: After obtaining the electricity consumption data of the most recent statistical period, carefully check and correct any data that does not conform to the specifications. If there is abnormal data with negative values, delete the data of these enterprises and do not issue subsequent abnormal warnings. A2: The data includes the peak, average, off-peak and total electricity consumption of each enterprise. When the difference between the sum of the peak, average, off-peak and total electricity consumption is too large, it means that there are abnormal data in the data. These situations will be classified and collected to ensure that the abnormal data will not affect the analysis results. A3: For enterprises with too little total electricity consumption, data will also be deleted because these data cannot provide meaningful analysis and judgment.
3. The method for intelligent analysis and detection of abnormal electricity consumption in an enterprise according to claim 1, characterized in that: In step S1, the box plot analysis is performed. According to the historical data, the relevant parameters of the box plot are as follows: The lower quartile is located at: , The upper quartile is located at: , Lower quartile: , Upper quartile: , Interquartile range: , Lower Boundary: , Upper Boundary: , n is the number of data, num represents the data set. Since the establishment of the box plot will be affected by the data distribution, when there are continuous 0 values in the enterprise electricity consumption data, it is necessary to handle them according to different situations. For enterprises with continuous 0 values at the beginning or end of the data, they are regarded as not in operation or have stopped production. The continuous 0 value data in this part are not considered when calculating the box plot. When the middle part of the data is continuous 0 values, it is considered to be part of the normal electricity consumption pattern of the enterprise and no data processing is performed. When the total daily electricity consumption data exceeds 10% of the box plot boundary, it is judged as abnormal.
4. According to claim 1, a method for intelligent analysis and detection of abnormal electricity consumption in an enterprise is characterized by: In step S3, it also includes using the ARIMA model to predict electricity consumption, comparing the predicted value with the actual value of the enterprise's electricity consumption data. If the difference is too large, it means that the enterprise's electricity consumption pattern has a large change, and then an electricity consumption warning is issued. The steps for calculating the ARIMA related parameters are as follows: C1: Determine d If the time series has an unsteady trend, the time series is differentiated until a stationary series is obtained. Consider a time series Y t , where t is time, the difference Y t With Y t-1 Defined as: , C2: Calculate the autocorrelation coefficient In the AR model, the target variable is predicted based on the combination of historical data of the target variable. A p-order autoregressive model is expressed as follows: , Here It is white noise. White noise is a special random process with the characteristics of disorder, constant mean, constant variance, and independence. is the time series data under consideration, is the parameter of the AR model, which is used to describe the relationship between the current value and the value at the past p time points. c is a constant term. Suppose there is a time series , then for any lag k, the autocorrelation coefficient ρ(k) is expressed as: , in, is the variance of the observations at time point t and time point t+k, It is a time series The variance of the autocorrelation function ACF ranges from -1 to 1; C3: Calculate partial correlation coefficient In the MA model, historical forecast errors are used to build a regression model. The formula is as follows: , here is white noise, this model is called MA (q) model, that is, q-order moving average model, Each value of is considered as a weighted moving average of historical forecast errors; C4: Observe the ACF and PACF graphs to select the model type and find the appropriate p and q values; C5: Model Evaluation The representation of the ARIMA model is as follows: , The predictor variables on the right side include The delayed value and the delayed error, where p is the autoregressive model order, d is the difference order, and q is the moving average model order, the AIC information criterion can be expressed as: , Where L is the likelihood function of the data, k=1 when c≠0, and k=0 when c=0. For the ARIMA model, the corrected AIC value can be expressed as: , Add or subtract one to p or q of the current model and clear or add the constant c of the current model, then calculate the AICc value of the derived model, and repeat this step until no smaller AICc value appears. The model at this time is the best model. Then, perform residual analysis on the fitted ARIMA model. If the residual does not appear as white noise, then modify the model and change the p and q values in the model. If the residual looks like white noise, then the next model prediction can be performed. C6: Model prediction First, the concept of delay operator is introduced. Delay operator B is an important marker, which is used to represent the delay of time series: Next, the prediction can be obtained through the following steps: ① Transform the ARIMA equation to on the left side of the equal sign and the other terms on the right side, ②Replace t with T+h and rewrite the entire equation. ③ On the right side of the equation, use the predicted value to replace the future observation value, use zero to replace the future prediction error, and use the corresponding residual to replace the historical error. Starting from h=1, continuously increase h, and repeat the above steps until all the predicted values are calculated.
Citation Information
Patent Citations
Power consumption abnormity detection method and device and electronic equipment
CN115358336A
Enterprise daily electricity consumption anomaly detection method based on ARIMA
CN115470973A
Cited By
User-level electricity utilization transaction association system based on large model
CN121234082A