Energy consumption prediction method and system based on time sequence analysis and BP neural network
Through the energy consumption prediction method based on timing analysis and BP neural network, relevant features are screened, DeepAR neural network is trained, and combined with the ARIMA model, the problem of inaccurate energy consumption prediction in the existing technology is solved, and higher prediction accuracy is achieved. robustness.
Patent Information
- Application Number
- CN202411494738.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-24
AI Technical Summary
The prior art cannot accurately predict the energy consumption of equipment in energy consumption sites, especially when facing dynamic and complex actual environments, the prediction results are unstable and difficult to respond to external changes.
Using the energy consumption prediction method based on timing analysis and BP neural network, the DeepAR neural network is trained by screening the target features whose correlation coefficients exceed the threshold of load data, combining the ARIMA time series model to predict the equipment load data, and perform compensation processing to improve the prediction. Accuracy.
This method can effectively overcome the shortcomings of traditional prediction models, improve the accuracy and robustness of load data prediction, and can take into account both short-term and long-term prediction performance and respond to external changes.
Smart Images

Figure CN119476989A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of energy management, and in particular relates to an energy consumption prediction method and system based on time series analysis and BP neural network. Background Art
[0002] With the continuous expansion of enterprise production capacity, the increase in the number of equipment in energy-consuming sites and the improvement of operational complexity, energy consumption has shown an increasing trend year by year. This has brought greater energy consumption pressure to enterprises, not only increasing operating costs, but also affecting overall production efficiency. In the context of global energy shortages and increasingly stringent environmental protection requirements, how to effectively control and manage energy consumption has become a key issue for enterprises to enhance their competitiveness.
[0003] Existing energy consumption forecasting methods are mainly based on time series models and machine learning models, but each model has its limitations and shortcomings. Time series model: 1. Time series models perform well in short-term forecasts, but their accuracy often drops significantly when used for long-term forecasts. 2. Time series models can usually only handle the time changes of a single variable. When it is necessary to combine multi-dimensional data to predict energy consumption, it is difficult to cope with complex scenarios. 3. Time series models assume that data has a stable trend or seasonal pattern. For non-stationary data such as energy consumption that is easily affected by multiple external factors, the prediction accuracy is low.
[0004] Machine learning models: 1. Machine learning models can handle complex nonlinear relationships, but they are usually "black box" models that cannot explain the process of forming prediction results. 2. When the training data of machine learning models is unbalanced or the amount of data is insufficient, the prediction results are unstable and prone to overfitting or underfitting, which makes the model's generalization ability for new data insufficient and the prediction error is large. 3. The training effect of machine learning models is highly dependent on the quantity and quality of data. Missing data, noise, outliers, etc. will affect the performance of the model.
[0005] Therefore, when dealing with energy consumption data affected by external factors, existing prediction models have difficulty responding to external changes and do not perform well in dynamic and complex actual environments. Summary of the invention
[0006] The embodiment of the present invention provides an energy consumption prediction method and system based on time series analysis and BP neural network to solve the problem that the prior art cannot accurately predict the energy consumption of equipment in an energy consumption site.
[0007] In order to solve the above technical problems, the embodiments of the present invention disclose the following technical solutions:
[0008] One aspect of the present invention provides an energy consumption prediction method based on time series analysis and BP neural network, which is used to predict load data of equipment in an energy consumption site. The method comprises:
[0009] According to the historical characteristic data of the energy consumption site and the historical load data of all equipment in the energy consumption site, the target characteristics whose correlation coefficient with the load data exceeds the preset correlation threshold are screened out;
[0010] The BP back propagation algorithm is used to train the DeepAR neural network based on the historical feature data of the target features and the historical load data of the pre-selected target equipment to obtain an energy consumption prediction model for predicting equipment load data;
[0011] Input the data of any target feature in the previous T days into the ARIMA time series model to obtain the forecast data of any target feature on the T+1 day;
[0012] Input the data of all target features in the previous T days and the predicted data on the T+1 day, as well as the load data of all target devices in the previous T days into the energy consumption prediction model, and predict the load data of each target device on the T+1 day;
[0013] For each target equipment, the measured load data and predicted load data of the Tth day are used to compensate the predicted load data of the T+1th day.
[0014] Optionally, before executing the step of screening out target features having a correlation coefficient with load data exceeding a threshold value based on historical feature data of the energy consumption site and historical load data of all equipment in the energy consumption site, the method further includes:
[0015] Obtain historical load data of each device in the energy consumption site, where the load data is a load value collected at intervals of t1, where t1≤first set duration, and t1×n1=24 hours, and n1 is an integer representing the total number of time granularities of the load data in a day;
[0016] Obtain historical characteristic data of the energy consumption site, wherein the characteristic data is indoor and outdoor environment data, time data, information data and control parameters collected at intervals of t2, t2≤second set time, and t2×n2=24 hours, n2 is an integer representing the total number of time granularities of the characteristic data in a day;
[0017] Perform data cleaning on historical load data and historical characteristic data, including:
[0018] Calculate the missing value ratio of historical load data and historical characteristic data on a daily basis, and fill in the missing values using the corresponding preset filling method according to the preset ratio range to which the missing value ratio belongs;
[0019] Find the abnormal points of historical load data and historical characteristic data, and repair the data values of all abnormal points.
[0020] Optionally, the method of screening out target features whose correlation coefficient with load data exceeds a preset correlation threshold based on historical feature data of the energy consumption site and historical load data of all equipment in the energy consumption site includes:
[0021] The Pearson correlation coefficient algorithm is used to calculate the correlation coefficient value between each feature and all equipment load data;
[0022] Determine whether there is a feature whose absolute value of the correlation coefficient exceeds the preset correlation threshold value,
[0023] If so, the feature is used as the target feature.
[0024] Optionally, the method further includes selecting a target device in the following manner:
[0025] Perform cluster analysis on the historical load data of all equipment based on the K-Means clustering algorithm to obtain the centroid value of each cluster;
[0026] The device corresponding to the cluster with the largest centroid value is taken as the target device.
[0027] Optionally, the BP back propagation algorithm is used to train the DeepAR neural network based on the historical feature data of the target feature and the historical load data of the pre-selected target equipment to obtain an energy consumption prediction model for predicting equipment load data, including:
[0028] Using historical feature data of the target feature and historical load data of the target device as training data;
[0029] The DeepAR neural network is trained based on the training data using the BP back propagation algorithm, and the training is terminated when the prediction error does not exceed the error set threshold, thus obtaining an energy consumption prediction model for predicting equipment load data.
[0030] Optionally, the step of inputting the data of any target feature within the previous T days into the ARIMA time series model to obtain the forecast data of any target feature on the T+1 day includes:
[0031] For each target feature, the following method is used to obtain the forecast data on day T+1:
[0032] Get the data X of the target feature in the previous T days T_ALL ,
[0033]
[0034] Among them, x 1,1 is the data of the target feature at the first time granularity on the first day, is the data of the target feature at the n2th time granularity on the first day, and so on.
[0035] The data of the target feature at the n2th time granularity on the Tth day;
[0036] The data X of the target feature in the previous T days T_ALL Input the ARIMA time series model to obtain the forecast data of the target feature on day T+1
[0037]
[0038] in, Represents the predicted value of the target feature at the first time granularity data on the T+1 day, and so on. Represents the predicted value of the training feature at the n2th time granularity data on the T+1th day.
[0039] Optionally, the data of all target features in the previous T days and the predicted data on the T+1 day, as well as the load data of all target devices in the previous T days are input into the energy consumption prediction model to predict the load data of each target device on the T+1 day, including:
[0040] For each target device, the load data Y in the previous T days is obtained T_ALL ,
[0041]
[0042] Among them, y 1,1 is the load data of the target device at the first time granularity on the first day, is the load data of the target device at the n1th time granularity on the first day, and so on. is the load data of the target device at the n1th time granularity in the Tth day;
[0043] The data X of each target feature in the previous T days T_ALL and the forecast data on day T+1 And, the load data Y of each target device in the previous T days T_ALL Input the energy consumption prediction model to predict the load data of any target equipment on the T+1 day.
[0044] Optionally, for each target device, the measured load data and the predicted load data on the Tth day are used to compensate the predicted load data on the T+1th day, including:
[0045] Input the data of each target feature in the previous T days and the load data of each target device in the previous T-1 days into the energy consumption prediction model, and predict the load data of any target device on the T day;
[0046] For each target device, the predicted load data for the T+1 day is compensated in the following way:
[0047]
[0048] Among them, Y T+1 The compensated load data of the target device;
[0049] The predicted load data of the target equipment on day T+1 Expressed as:
[0050]
[0051] is the predicted value of the load data of the first time granularity of the target equipment on the T+1 day, and so on. is the predicted value of the load data of the n1th time granularity in the T+1th day;
[0052] The load data Y of the target equipment on day T obtained by actual measurement T Expressed as:
[0053]
[0054] y T,1 is the measured value of the load data of the first time granularity of the target equipment in the Tth day, and so on. is the measured value of the load data of the n1th time granularity in the Tth day;
[0055] The predicted load data of the target equipment on day T Expressed as:
[0056]
[0057] is the predicted value of the load data of the first time granularity of the target equipment in the Tth day, and so on. It is the predicted value of the load data at the n1th time granularity in the Tth day.
[0058] Optionally, the method further includes:
[0059] At the end of each day, the energy consumption prediction model is retrained based on the load data and characteristic data collected that day;
[0060] Use the retrained energy consumption prediction model to predict the load data of each target device on the next day;
[0061] Determine whether the number of target devices is less than or equal to N,
[0062] If so, treat all target devices as high-value devices;
[0063] If not, calculate the RFM value for each target device.
[0064] RFM=R*(-1)+F+M+100
[0065] Wherein, R represents that the target device was last operated R days before the current date; F represents the average number of operating days per month of the target device; M represents the total number of operating days of the target device in a year;
[0066] The first N target devices with the highest RFM values are regarded as high-value devices;
[0067] Based on the load data of any high-value equipment on the next day, a corresponding load forecast report is generated and provided to the user.
[0068] Another aspect of the present invention provides an energy consumption prediction system based on time series analysis and BP neural network, which is used to predict the load data of equipment in energy consumption sites. The system executes the energy consumption prediction method based on time series analysis and BP neural network provided in the above aspects.
[0069] The embodiment of the present invention discloses an energy consumption prediction method and system based on time series analysis and BP neural network, which adopts time series model and DeepAR neural network model, obtains historical load data of equipment in energy consumption sites and historical characteristic data of energy consumption sites, and establishes a load prediction hybrid model based on time series analysis and machine learning. The energy consumption prediction method and system disclosed in the embodiment of the present invention can take into account the long-term prediction performance of machine learning models and the short-term prediction performance of BP neural networks, effectively overcome the problems faced by traditional prediction models such as over-reliance on characteristic data, short prediction step length, and insufficient stability, and greatly improve the accuracy and robustness of load data prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 A schematic diagram of a flow chart of an energy consumption prediction method based on time series analysis and BP neural network provided in an embodiment of the present invention;
[0071] Figure 2 A schematic flow chart of another energy consumption prediction method based on time series analysis and BP neural network provided in an embodiment of the present invention;
[0072] Figure 3 An implementation provided for an embodiment of the present invention Figure 1 Schematic diagram of the process of step S100;
[0073] Figure 4 A schematic diagram of a process for selecting a target device provided by an embodiment of the present invention;
[0074] Figure 5 An implementation provided for an embodiment of the present invention Figure 1 Schematic diagram of the process of step S200;
[0075] Figure 6 A schematic flow chart of another energy consumption prediction method based on time series analysis and BP neural network provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0076] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0077] Figure 1 The present invention discloses a flow chart of an energy consumption prediction method based on time series analysis and BP neural network, which is used to predict the load data of equipment in energy consumption sites. Energy consumption sites are special buildings or spaces used by enterprises to house various equipment and systems, usually used to accommodate and maintain the core operating equipment of enterprises, such as communication equipment, power equipment, heating and cooling systems, etc. Figure 1 As shown, the method comprises the following steps:
[0078] Step S100: based on the historical characteristic data of the energy consumption site and the historical load data of all the equipment in the energy consumption site, select the target characteristics whose correlation coefficient with the load data exceeds a preset correlation threshold.
[0079] In one embodiment disclosed in the present invention, Figure 2 As shown, before executing step S100, the following steps are also included:
[0080] Step S010: Obtain historical load data of each device in the energy consumption site.
[0081] The load data is a load value collected at intervals of t1, where t1≤first set duration, and t1×n1=24 hours, and n1 is an integer representing the total number of time granularities of the load data in a day.
[0082] In a specific embodiment disclosed in the present invention, t1 is 10 minutes, that is, data is collected from each device in the energy consumption site once every 10 minutes, and n1 is 144, that is, in 24 hours a day, data can be collected 144 times for each device at a collection frequency of once every 10 minutes. The time granularity is associated with the collection sequence number in a day. For example, the data of the first time granularity is the data obtained at the first collection.
[0083] Step S020: Acquire historical characteristic data of energy consumption sites.
[0084] The characteristic data are indoor and outdoor environment data, time data, information data and control parameters collected at intervals of t2, t2≤second set time, and t2×n2=24 hours, n2 is an integer representing the total number of time granularities of the characteristic data in a day.
[0085] The characteristic data can be:
[0086] 1. Indoor environment data: indoor temperature and humidity;
[0087] 2. Outdoor environmental data: outdoor temperature, humidity, pressure, and weather type;
[0088] 3. Time data: date type (weekdays / weekends, holidays), day of the week, month;
[0089] 4. Information data: space volume, number of equipment, weighted equipment opening rate, total equipment power, load peak and valley periods;
[0090] 5. Control parameters: The power storage output control parameters and power output power corresponding to the power load power of each device in the energy consumption site.
[0091] The feature types disclosed in the present invention include but are not limited to the above contents.
[0092] In a specific embodiment disclosed in the present invention, t2 is 2 hours, that is, data is collected for each feature once every 2 hours, and n2 is 12, that is, in 24 hours a day, data can be collected 12 times for each feature at a frequency of once every 2 hours.
[0093] All collected data can be uploaded to the cloud for later data collation, analysis and application.
[0094] Step S030: Clean the historical load data and historical characteristic data.
[0095] Data cleaning includes missing value filling and outlier processing. In the embodiment disclosed in the present invention, the following sub-steps can be used to complete step S030.
[0096] Step S0301: Calculate the missing value ratio of historical load data and historical characteristic data on a daily basis, and fill in the missing values using a corresponding preset filling method according to the preset ratio range to which the missing value ratio belongs.
[0097] The missing value ratio of historical load data and historical feature data is calculated on a daily basis. The missing value ratio of load data of any device on any day is: the ratio of the total number of missing load data of the device on that day to the total number of all load data of the device collected on that day; the missing value ratio of data of any feature on any day is: the ratio of the total number of missing data of the feature on that day to the total number of all data of the feature collected on that day.
[0098] (I) For each device, the following methods are used to fill missing values in load data:
[0099] (1) Set the missing value ratio threshold to L1, L2, L1 <L2。
[0100] (2) When the proportion of missing values in the load data of the device on a certain day A is greater than L2 (the proportion of missing values is within the range of proportions greater than L2), that is, the ratio of the total number of missing load data of the device on day A to the total number of all load data of the device collected on that day is greater than L2, then all load data of the device on day A will be deleted.
[0101] (3) When the proportion of missing values in the load data of the equipment on a certain day A is greater than or equal to L1, but less than or equal to L2 (the proportion of missing values is within the ratio range of [L1, L2]), the load data of a similar period (within 30 minutes before and after t_lost corresponding to the missing value in similar day B, that is, similar period = [t_lost-30 minutes, t_lost+30 minutes], where t_lost is the time corresponding to a missing value in day A. When there are multiple missing values in day A, there are also multiple corresponding similar periods in day B) on a similar day B (the day with the smallest Euclidean distance between the load data of day A and the last two weeks) are used to fill in the missing values. For example, if the time corresponding to a missing data is 10:30, the 10:00-11:00 period in similar day B is used as its similar period.
[0102] Take a missing data in day A as an example:
[0103] Assume that the load values in a similar period on a similar day B are (a1, a2, …, a6).
[0104] First, determine whether there is data within 30 minutes before and after the time t_lost corresponding to the missing data on day A.
[0105] If there is data within this period, it is further processed as follows:
[0106] If there is only one data in the period, the data is represented by b1, and the missing data to be filled is represented by b2.
[0107] If there are multiple data in this period, for example, 3 data, these data are represented as (b1, b3, b5), then
[0108] If there is no data in this period,
[0109] (4) When the proportion of missing values in the load data of the equipment on a certain day A is less than L1 (the proportion of missing values is within the proportion range less than L1), the forward and backward interpolation method is used to fill in the missing data.
[0110] Take a missing data in day A as an example:
[0111] First, determine whether there is data within 30 minutes before and after the missing data corresponding to the time t_lost.
[0112] If there is data within this period, it is further processed as follows:
[0113] If there is only one data in the period, the missing data b2 to be filled is directly set to the data value;
[0114] If there are multiple data in this period, the missing data b2 to be filled is set to the mean of these values;
[0115] If there is no data in this period, the search range is expanded by 30 minutes, that is, continue to determine whether there is data within 60 minutes before and after the time t_lost corresponding to the missing data, and repeat the above steps until there is a value to fill the missing data.
[0116] (II) For each feature, the following methods are used to fill missing values in the data:
[0117] (1) Set the missing value ratio threshold to P1, P2, P1 <P2。
[0118] (2) When the missing value ratio of the feature on a certain day A is greater than P2 (the missing value ratio is within the range greater than P2), all data of the feature on that day are deleted.
[0119] (3) When the missing value ratio of the feature on day A is greater than or equal to P1 but less than or equal to P2 (the missing value ratio is within the ratio range of [P1, P2]), the feature is converted into an indicator variable, that is, a 0-1 variable. If the data of the feature is empty, the data of the feature is recorded as 0; otherwise, the data of the feature is updated to 1.
[0120] (4) When the missing value ratio of the feature on day A is less than P1 (the missing value ratio is within the ratio range less than P1), the forward and backward interpolation method is used to fill the missing data.
[0121] If the feature is numerical data, step (4) of the method for filling missing values in load data is used to fill the missing data of the feature with the mean of the previous and next data.
[0122] If the feature is non-numeric data, a method similar to step (4) in the method of filling missing values in load data is used to fill the missing values using the data that appears most frequently in the adjacent time period, that is, filling the missing values using the majority method.
[0123] Step S0302: Find abnormal points in historical load data and historical characteristic data, and repair the data values of all abnormal points.
[0124] (I) For each device, the following methods are used to process outliers in load data:
[0125] (1) Use the algorithm model to find the abnormal days of load data:
[0126] Set the threshold of the maximum abnormal number of days to D and the threshold of the total abnormal percentage to E.
[0127] The embodiment of the present invention determines whether the load data is abnormal in units of weeks, taking the most recent week as an example:
[0128] The historical load data of the most recent week is obtained, and the load data is divided into five peak and valley periods using the Fisher optimal segmentation model. The period obtained after the optimal segmentation is called the load peak and valley period, including the peak period and the valley period (for example, the load rising period (8:00-12:00), the load intermission period (12:00-14:00), the load stable period (14:00-20:00), the load falling period (20:00-00:00), and the load rest period (00:00-8:00), among which the load rising period and the load stable period are the peak periods).
[0129] The time point corresponding to the maximum value of the load data on day A is t m If two or more maximum values appear on the same day, the corresponding time point list is recorded as (t m_1 ,t m_2 ,…).
[0130] Get the number of days in the most recent week when all the time points corresponding to the maximum values are in the peak period. If the number of days is not less than the threshold D, it means that there is no abnormality in the most recent week. If the number of days is less than the threshold D, it is determined that an abnormality occurred in the most recent week. Continue to troubleshoot the abnormal days in the following way:
[0131] If the ratio of the total load value during the peak period of day A to the total load value for the whole day is greater than or equal to the threshold E, it is considered that there is no abnormality in the load data of day A; otherwise, day A is regarded as an abnormal day for the load data.
[0132] (2) Assuming that day A is an abnormal day for load data, the algorithm model is used to find the abnormal points of load values, as follows:
[0133] Set the abnormal amplitude threshold to A0, and record the load value collected at time t as y t , whose amplitude is
[0134] When A>A0, the amplitude at that moment is considered abnormal, and the moment is taken as the abnormal point of the load value. All abnormal points in the abnormal day A are found, the data corresponding to the abnormal points are cleared, and the method for filling missing values of the load data in the above embodiment is used to repair and fill.
[0135] (II) For each feature, the following methods are used to process outliers in the data:
[0136] (1) Find the abnormal day of characteristic data:
[0137] When a day is an abnormal load data day, the day is also an abnormal characteristic data day.
[0138] (2) Assuming that day A is an abnormal day for characteristic data, we continue to use the algorithm model to find the abnormal points of characteristic values, as follows:
[0139] If the characteristic data is numerical data, the characteristic value abnormal point is processed in a manner similar to step (2) in the method for processing abnormal values of load data;
[0140] If the feature data is non-numeric data, the Euclidean distance threshold B0 is set, and the feature value collected at time t is x t , its Euclidean distance relative to the previous and next values is
[0141]
[0142] When B>B0, the amplitude at that moment is considered abnormal, and the moment is taken as the abnormal point of the characteristic value. All abnormal points in the abnormal day A are found, the data corresponding to the abnormal points are cleared, and the missing value filling method of the characteristic data in the above embodiment is used to repair and fill.
[0143] In one embodiment disclosed in the present invention, Figure 3 As shown, step S100 can be implemented by the following sub-steps:
[0144] S101: Calculate the correlation coefficient value between each feature and all equipment load data using the Pearson correlation coefficient algorithm.
[0145] For each feature, the Pearson correlation coefficient algorithm is used to calculate the correlation coefficient value between its data and all equipment load data.
[0146] The Pearson Correlation Coefficient is used to measure the linear correlation between two variables. Its value range is between -1 and 1, where 1 indicates a perfect positive correlation (the two variables change in the same direction); -1 indicates a perfect negative correlation (the two variables change in opposite directions); 0 indicates no linear correlation (there is no obvious linear relationship between the two variables). The larger the absolute value, the stronger the correlation between the variables.
[0147] S102: Determine whether there is a feature whose absolute value of the feature correlation coefficient exceeds a preset correlation threshold.
[0148] A correlation threshold Cr is preset, and it is determined one by one whether the absolute value of the correlation coefficient value of each feature exceeds the preset correlation threshold.
[0149] When the absolute value of the correlation coefficient between a feature and the equipment load data is greater than Cr, it is considered that the two variables are correlated, that is, there is a correlation between the feature and the equipment load data, and the feature is used as the target feature.
[0150] If there is no feature whose absolute value of the correlation coefficient value exceeds the preset correlation threshold, the preset correlation threshold is adjusted according to the preset mode, and it is continued to be determined whether there is a feature whose absolute value of the feature correlation coefficient value exceeds the preset correlation threshold until there is a feature whose absolute value of the correlation coefficient value exceeds the preset correlation threshold.
[0151] Step S200: Using the BP back propagation algorithm, the DeepAR neural network is trained based on the historical feature data of the target feature and the historical load data of the pre-selected target equipment to obtain an energy consumption prediction model for predicting equipment load data.
[0152] In one embodiment disclosed in the present invention, Figure 4 As shown, you can select the target device in the following ways:
[0153] Step S040: Perform cluster analysis on the historical load data of all devices based on the K-Means clustering algorithm to obtain the centroid value of each cluster.
[0154] K-Means is an unsupervised clustering algorithm whose goal is to divide data points into K clusters so that the distance between each data point and the center point (centroid) of its cluster is minimized. The algorithm iteratively optimizes the distribution of clusters and the position of the centroid and ultimately finds the clustering structure.
[0155] The K-Means algorithm is used to cluster the historical load data of the most recent date to obtain the load category label of each device, and the groups are divided according to the load category of the equipment to obtain the clusters and equipment with the largest load. The details are as follows:
[0156] The square sum of load data errors is Where K is the number of clusters, m i is the i-th set c i The centroid (i.e., the average value) of , x represents the value of the sample point.
[0157] In order to obtain the optimal number of clusters, the error reduction coefficient is recorded as The silhouette coefficient is in Represents the sample point x i The similarity between a sample and other samples in its own cluster is equal to the average distance between the sample and all other points in the same cluster. Represents the sample point x i The similarity with samples in other clusters is equal to the average distance between the sample and all points in the next closest cluster. The average silhouette coefficient of cluster c is Where m is the number of samples in cluster c.
[0158] Given the maximum number of clusters K max , using the K-Means algorithm, starting from K = 2 and increasing to K = K max , clustering is performed in turn. Maximize the objective function α+β c , we get the optimal K value and the optimal cluster, which are denoted as K best and The centroid value of each cluster is
[0159] Step S050: taking the device corresponding to the cluster with the largest centroid value as the target device.
[0160] Find the cluster with the largest centroid value and use the devices contained in the cluster as the target devices.
[0161] In another embodiment disclosed by the present invention, all devices may also be used as pre-selected target devices.
[0162] In another embodiment disclosed in the present invention, the total load data of all equipment on the most recent date is recorded as (a'1, a'2, ..., a' q ), where q is the total number of devices, a′ qis the sum of the daily loads of the qth device. Based on the sum of the daily loads of the devices, each device can be labeled with an energy consumption label of "high", "medium" or "low" according to the preset grouping method. When predicting the energy consumption data of the devices in the future, the devices labeled "low" will not be predicted.
[0163] In one embodiment disclosed in the present invention, Figure 5 As shown, step S200 can be implemented in the following manner:
[0164] Step S201: historical feature data of target features and historical load data of pre-selected target equipment are used as training data.
[0165] The historical load data of the pre-selected target equipment and the historical characteristic data of the target characteristics are selected within the previous year (for example, from January 1, 2023 to December 31, 2023) of the energy consumption site.
[0166] When training the model, all target features are used as covariates. Starting from the current date (e.g. January 1, 2024), every 12 hours is used as a sliding window, and the training is iterated step by step until 24:00 of three consecutive full days (e.g. January 3, 2024) (only 12 time steps are predicted each time, unit: hour, a total of 48 batches are trained). During this period, the newly acquired target feature data and target equipment load data will be added to the training data to participate in the training of the model.
[0167] Step S202: Based on the training data, the DeepAR neural network is trained using the BP back propagation algorithm, and the training is terminated when the prediction error does not exceed the error setting threshold, thereby obtaining an energy consumption prediction model for predicting equipment load data.
[0168] DeepAR is a probability prediction model based on RNN (recurrent neural network). In the embodiment of the present invention, the back propagation (BP) algorithm is used to train it. The algorithm can adjust the model weights through optimization algorithms such as gradient descent to reduce the prediction error. When the prediction error of the model is lower than the preset error setting threshold, the training ends.
[0169] 1. Data preparation
[0170] The input of DeepAR is a multidimensional time series. The input data contains the historical feature data of the target features and the historical load data of the target equipment. The input data is time series data. During model training, the time series data is divided into multiple segments, and the model can learn local time dependencies from each segment.
[0171] 2. BP Back Propagation
[0172] DeepAR training uses the BP back-propagation algorithm to update the model weights through the gradient descent method. The back-propagation steps are as follows:
[0173] Gradient calculation:
[0174] Using the chain rule, the gradient of each layer weight is calculated in turn, calculating the gradient of each parameter from the output layer to the input layer.
[0175] For RNN, this process involves time backpropagation, because RNN is a neural network that processes sequence data, and its gradient depends not only on the current moment, but also on the state of the previous time step.
[0176] Weight update:
[0177] The calculated gradient is passed to the optimizer (such as SGD, Adam), which adjusts the weights according to the gradient, with the goal of minimizing the loss function. The step size of the update is determined by the learning rate.
[0178] 3. Training termination conditions
[0179] An error setting threshold is set in advance, and the prediction error R2 is calculated using the following formula:
[0180]
[0181] Where n is the number of samples; is the predicted value of the i-th sample; is the true value of the i-th sample.
[0182] When the prediction error of the model is lower than a preset error setting threshold, the training is terminated to obtain an energy consumption prediction model for predicting equipment load data.
[0183] If the prediction error of the model continues to exceed the preset threshold, the neural network model training parameters are adjusted or the training samples are increased according to the preset mode, and the model is retrained until the model prediction error (the gap between the true value and the predicted value) meets the preset target.
[0184] The energy consumption prediction model obtained in step S200 can be used to complete the prediction of load data through steps S300 and S400.
[0185] Step S300: Input the data of any target feature in the previous T days into the ARIMA time series model to obtain the forecast data of any target feature on the T+1 day.
[0186] The purpose of step S300 is to predict the target characteristic data of the T+1 day. In the subsequent embodiments, T+1 day is used as an example to represent tomorrow, that is, to predict tomorrow's load data.
[0187] In one embodiment disclosed in the present invention, step S300 may be completed in the following manner:
[0188] For each target feature, the following method is used to obtain the forecast data on day T+1:
[0189] Get the actual measured data X of the target feature in the previous T days T_ALL ,
[0190]
[0191] Among them, x 1,1 is the data of the target feature at the first time granularity on the first day, is the data of the target feature at the n2th time granularity on the first day, and so on. is the data of the target feature at the n2th time granularity on the Tth day.
[0192] The data X of the target feature in the previous T days T_ALL Input the ARIMA time series model to obtain the forecast data of the target feature on day T+1
[0193]
[0194] in, Represents the predicted value of the target feature at the first time granularity data on the T+1 day, and so on. Represents the predicted value of the training feature at the n2th time granularity data on the T+1th day.
[0195] The ARIMA time series model is a statistical model used for time series analysis and forecasting. It captures patterns such as trends and random fluctuations in time series to make short-term forecasts. The model can handle non-stationary time series, making them stationary through difference processing, and then modeling.
[0196] In a specific embodiment disclosed in the present invention, T=30, after completing the prediction of the target characteristics of tomorrow, that is, the 31st day, the target characteristic data of tomorrow is used to continue to execute step S400 to complete the prediction of tomorrow's load data.
[0197] Step S400: input the data of all target features in the previous T days and the predicted data on day T+1, as well as the load data of all target devices in the previous T days into the energy consumption prediction model, and predict the load data of each target device on day T+1.
[0198] After obtaining the forecast data for each target feature tomorrow (T+1 day), the measured data of all target features in the previous 30 days and the forecast data for tomorrow, as well as the measured load data of all target equipment in the previous 30 days are input into the energy consumption prediction model to predict the load data of each target equipment tomorrow (31 day).
[0199] When using the energy consumption prediction model to predict load data, the data of the target feature on the prediction date and before the prediction date, as well as the data of the target equipment before the prediction date, are required as input data to obtain the load data on the prediction date.
[0200] In one embodiment disclosed in the present invention, step S400 may be completed in the following manner:
[0201] For each target device, the load data Y actually measured in the previous T days is obtained T_ALL ,
[0202]
[0203] Among them, y 1,1 The load data of the target device at the first time granularity on the first day. is the load data of the target device at the n1th time granularity on the 1st day, and so on, y is the load data of the target device at the n1th time granularity on the Tth day.
[0204] The measured data X of each target feature in the previous T days T_ALL and the forecast data on day T+1 And, the load data Y of each target equipment measured in the previous T days T_ALL Input the energy consumption prediction model to predict the load data of any target equipment on the T+1 day.
[0205] Step S500: For each target device, the measured load data and the predicted load data of the Tth day are used to compensate the predicted load data of the T+1th day.
[0206] In the embodiment disclosed in the present invention, after the load data of any target device on the T+1 day is predicted, the predicted data needs to be compensated in the following manner to obtain more accurate predicted data:
[0207] (1) The measured data of each target feature in the previous T days and the measured load data of each target device in the previous T-1 days are input into the energy consumption prediction model to predict the load data of any target device on the T day.
[0208] For example, the data of each target feature in the previous 30 days and the load data of each target device in the previous 29 days are input into the energy consumption prediction model to predict the load data of any target device on the 30th day.
[0209] (2) For each target device, the predicted load data for the T+1 day is compensated in the following manner:
[0210]
[0211] Among them, Y T+1 The load data after compensation for the target equipment;
[0212] The predicted load data of the target equipment on day T+1 Expressed as:
[0213]
[0214] is the predicted value of the load data of the first time granularity of the target equipment on the T+1 day, and so on. is the predicted value of the load data of the n1th time granularity in the T+1th day;
[0215] The load data Y of the target equipment on day T obtained by actual measurement T Expressed as:
[0216]
[0217] y T,1 is the measured value of the load data of the first time granularity of the target equipment in the Tth day, and so on. is the measured value of the load data of the n1th time granularity in the Tth day;
[0218] The predicted load data of the target equipment on day T Expressed as:
[0219]
[0220] is the predicted value of the load data of the first time granularity of the target equipment in the Tth day, and so on. It is the predicted value of the load data at the n1th time granularity in the Tth day.
[0221] The energy consumption prediction method disclosed in the embodiment of the present invention is as follows: Figure 6 As shown, the following steps are also included:
[0222] Step S510: After the end of each day, the energy consumption prediction model is retrained based on the load data and characteristic data collected on that day.
[0223] After the end of each day, that is, in the early morning of the next day, the load data and characteristic data collected on that day are added to the training data set, and the energy consumption prediction model is retrained using the method in the above embodiment.
[0224] Step S520: using the retrained energy consumption prediction model to predict the load data of each target device on the next day.
[0225] The prediction method in the above-mentioned embodiment is adopted, and the retrained energy consumption prediction model is used to predict the load data of each target device on the next day.
[0226] Step S530: Determine whether the number of target devices is less than or equal to N.
[0227] An upper limit number N of key monitoring devices is preset, for example, N=10.
[0228] If the number of target devices is less than or equal to N, step S540 is executed.
[0229] Step S540: All target devices are regarded as high-value devices.
[0230] If the number of target devices is greater than N, execute step S550.
[0231] Step S550: Calculate the RFM value for each target device.
[0232] RFM=R*(-1)+F+M+100
[0233] Among them, R means that the target device was last run R days ago; F means the average usage frequency of the target device; M means the total usage time of the target device. The data of the above parameters can be obtained from the daily record table.
[0234] Step S560: The first N target devices with the highest RFM values are regarded as high-value devices.
[0235] After obtaining the RFM value of each target device, the top N target devices with the highest RFM values are regarded as high-value devices.
[0236] Step S570: Based on the load data of any high-value equipment on the next day, a corresponding load forecast report is generated and provided to the user.
[0237] Load forecasting reports enable users to focus on monitoring the load conditions of high-value equipment.
[0238] The energy consumption prediction method disclosed in the embodiment of the present invention also includes the following contents:
[0239] After obtaining the load forecast value of each target device for tomorrow, calculate whether the load forecast value of each time granularity for tomorrow is greater than the corresponding historical average energy consumption level. The historical average energy consumption level can be the average value of the time granularity load data in the past 30 days.
[0240] For time granularity greater than the historical average energy consumption level, according to the pre-designed optimization configuration strategy (for example, the optimization ratio parameters can be designed according to the load parameters of the historical peak load and the load parameters of the flat valley period), adjust and update the current power storage output control parameters, and predict and deduce the adjusted power output power according to the optimization configuration strategy. Re-predict the load data based on the newly adjusted features until the predicted value is less than the historical average energy consumption level. At the same time, generate an optimization report based on the optimization configuration strategy and provide it to the user.
[0241] The embodiment of the present invention also discloses an energy consumption prediction system based on time series analysis and BP neural network, which is used to predict the load data of equipment in an energy consumption site. The system executes the energy consumption prediction method based on time series analysis and BP neural network disclosed in the above embodiment.
[0242] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. An energy consumption prediction method based on time series analysis and BP neural network, used to predict the load data of equipment in energy consumption sites, characterized in that: The method comprises: According to the historical characteristic data of the energy consumption site and the historical load data of all equipment in the energy consumption site, the target characteristics whose correlation coefficient with the load data exceeds the preset correlation threshold are screened out; The BP back propagation algorithm is used to train the DeepAR neural network based on the historical feature data of the target features and the historical load data of the pre-selected target equipment to obtain an energy consumption prediction model for predicting equipment load data; Input the data of any target feature in the previous T days into the ARIMA time series model to obtain the forecast data of any target feature on the T+1 day; Input the data of all target features in the previous T days and the predicted data on the T+1 day, as well as the load data of all target devices in the previous T days into the energy consumption prediction model, and predict the load data of each target device on the T+1 day; For each target equipment, the measured load data and predicted load data of the Tth day are used to compensate the predicted load data of the T+1th day.
2. The energy consumption prediction method according to claim 1, characterized in that: Before executing the step of screening out target features whose correlation coefficient with load data exceeds a threshold value based on the historical feature data of the energy consumption site and the historical load data of all equipment in the energy consumption site, the method further includes: Obtain historical load data of each device in the energy consumption site, where the load data is a load value collected at intervals of t1, where t1≤first set duration, and t1×n1=24 hours, and n1 is an integer representing the total number of time granularities of the load data in a day; Obtain historical characteristic data of the energy consumption site, wherein the characteristic data is indoor and outdoor environment data, time data, information data and control parameters collected at intervals of t2, t2≤second set time, and t2×n2=24 hours, n2 is an integer representing the total number of time granularities of the characteristic data in a day; Perform data cleaning on historical load data and historical characteristic data, including: Calculate the missing value ratio of historical load data and historical characteristic data on a daily basis, and fill in the missing values using the corresponding preset filling method according to the preset ratio range to which the missing value ratio belongs; Find the abnormal points of historical load data and historical characteristic data, and repair the data values of all abnormal points.
3. The energy consumption prediction method according to claim 1, characterized in that: The target features whose correlation coefficient with the load data exceeds a preset correlation threshold are screened out based on the historical feature data of the energy consumption site and the historical load data of all equipment in the energy consumption site, including: The Pearson correlation coefficient algorithm is used to calculate the correlation coefficient value between each feature and all equipment load data; Determine whether there is a feature whose absolute value of the correlation coefficient exceeds the preset correlation threshold value, If so, the feature is used as the target feature.
4. The energy consumption prediction method according to claim 1, characterized in that: The method further includes selecting a target device in the following manner: Perform cluster analysis on the historical load data of all equipment based on the K-Means clustering algorithm to obtain the centroid value of each cluster; The device corresponding to the cluster with the largest centroid value is taken as the target device.
5. The energy consumption prediction method according to claim 1, characterized in that: The BP back propagation algorithm is used to train the DeepAR neural network based on the historical feature data of the target feature and the historical load data of the pre-selected target equipment to obtain an energy consumption prediction model for predicting equipment load data, including: Using historical feature data of the target feature and historical load data of the target device as training data; The DeepAR neural network is trained based on the training data using the BP back propagation algorithm, and the training is terminated when the prediction error does not exceed the error set threshold, thus obtaining an energy consumption prediction model for predicting equipment load data.
6. The energy consumption prediction method according to claim 2, characterized in that: The data of any target feature in the previous T days is input into the ARIMA time series model to obtain the forecast data of any target feature on the T+1 day, including: For each target feature, the following method is used to obtain the forecast data on day T+1: Get the data X of the target feature in the previous T days T_ALL , Among them, x 1,1 is the data of the target feature at the first time granularity on the first day, is the data of the target feature at the n2th time granularity on the first day, and so on. The data of the target feature at the n2th time granularity on the Tth day; The data X of the target feature in the previous T days T_ALL Input the ARIMA time series model to obtain the forecast data of the target feature on day T+1 in, Represents the predicted value of the target feature at the first time granularity data on the T+1 day, and so on. Represents the predicted value of the training feature at the n2th time granularity data on the T+1th day.
7. The energy consumption prediction method according to claim 6, characterized in that: The data of all target features in the previous T days and the predicted data on the T+1 day, as well as the load data of all target devices in the previous T days are input into the energy consumption prediction model, and the load data of each target device on the T+1 day is predicted, including: For each target device, the load data Y in the previous T days is obtained T_ALL , Among them, y 1,1 is the load data of the target device at the first time granularity on the first day, is the load data of the target device at the n1th time granularity on the first day, and so on. is the load data of the target device at the n1th time granularity in the Tth day; The data X of each target feature in the previous T days T_ALL and the forecast data on day T+1 And, the load data Y of each target device in the previous T days T_ALL Input the energy consumption prediction model to predict the load data of any target equipment on the T+1 day.
8. The energy consumption prediction method according to claim 7, characterized in that: For each target device, the measured load data and the predicted load data of the Tth day are used to compensate the predicted load data of the T+1th day, including: Input the data of each target feature in the previous T days and the load data of each target device in the previous T-1 days into the energy consumption prediction model, and predict the load data of any target device on the T day; For each target device, the predicted load data for the T+1 day is compensated in the following way: Among them, Y T+1 The compensated load data of the target device; The predicted load data of the target equipment on day T+1 Expressed as: is the predicted value of the load data of the first time granularity of the target equipment on the T+1 day, and so on. is the predicted value of the load data of the n1th time granularity in the T+1th day; The load data Y of the target equipment on day T obtained by actual measurement T Expressed as: y T,1 is the measured value of the load data of the first time granularity of the target equipment in the Tth day, and so on. is the measured value of the load data of the n1th time granularity in the Tth day; The predicted load data of the target equipment on day T Expressed as: is the predicted value of the load data of the first time granularity of the target equipment in the Tth day, and so on. It is the predicted value of the load data at the n1th time granularity in the Tth day.
9. The energy consumption prediction method according to claim 1, characterized in that: The method further comprises: At the end of each day, the energy consumption prediction model is retrained based on the load data and characteristic data collected that day; Use the retrained energy consumption prediction model to predict the load data of each target device on the next day; Determine whether the number of target devices is less than or equal to N, If so, treat all target devices as high-value devices; If not, calculate the RFM value for each target device. RFM=R*(-1)+F+M+100 Wherein, R represents that the target device was last operated R days before the current date; F represents the average number of operating days of the target device per month; M represents the total number of operating days of the target device in a year; The first N target devices with the highest RFM values are regarded as high-value devices; Based on the load data of any high-value equipment on the next day, a corresponding load forecast report is generated and provided to the user.
10. An energy consumption prediction system based on time series analysis and BP neural network, used to predict the load data of equipment in energy consumption sites, characterized in that: The system executes the energy consumption prediction method based on time series analysis and BP neural network as described in any one of claims 1-9.
Citation Information
Patent Citations
Building energy consumption prediction method based on sub-metering time sequence, system and building
CN106991504A
Medium and short term load prediction method and system, and storage medium
CN114091758A
Convolutional neural network-based time sequence load prediction method
CN114648156A
Prediction method based on periodic feature extraction and time sequence attention
CN116341712A
A system and method for electricity load prediction
IN201741028915A