Wavelet transform and LSTM (Long Short Term Memory) combined electricity consumption prediction method and device

By combining wavelet transformation and LSTM model, the problem that the prior art is difficult to capture nonlinear features and complex patterns when predicting power consumption is solved, and more accurate and reliable power consumption prediction is achieved.

CN119515598AInactive Publication Date: 2025-02-25FUDAN UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411630627.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is difficult to effectively capture the nonlinear characteristics and complex patterns of load data when predicting power consumption, and the prediction accuracy is low under high noise conditions, making it difficult to guide downstream decisions.

Method used

The power consumption prediction is carried out by combining wavelet transform and long and short-term memory network (LSTM), and the reference power consumption of multiple time scales and time intervals is obtained through wavelet transform noise reduction processing, and the LSTM model is used for prediction.

Benefits of technology

Improve the accuracy of power consumption prediction, and can more effectively learn and capture the periodicity and non-stationarity of power consumption, thereby providing more reliable prediction results under high noise conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119515598A_ABST
    Figure CN119515598A_ABST
Patent Text Reader

Abstract

The invention discloses an electricity consumption prediction method and device in combination with wavelet transform and LSTM, and the method comprises the steps: determining a target time period in which the electricity consumption needs to be predicted, and determining a plurality of reference time periods before the target time period in a plurality of time periods contained in a preset historical period; electricity consumption characteristics of the target time period and each reference time period are obtained, the electricity consumption characteristics of each time period comprise reference electricity consumption of a plurality of time scales and a plurality of time intervals before the time period, and the reference electricity consumption is obtained by performing wavelet transform processing on original electricity consumption of each time period included in a historical period; and processing the electricity consumption characteristics of the target time period and the electricity consumption characteristics of each reference time period according to a pre-constructed electricity consumption prediction model to obtain predicted electricity consumption of the target time period, the electricity consumption prediction model being a deep learning model based on a long short-term memory network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electricity consumption prediction, and in particular to an electricity consumption prediction method and device combining wavelet transform and LSTM. Background Art

[0002] In the power system, since electricity cannot be stored, it is necessary to predict in advance the electricity consumption of different users in a certain period of time in the future in order to scientifically plan the operation of the generator set, thereby achieving real-time balance between supply and demand.

[0003] The existing power load forecasting methods for predicting power consumption mainly include statistical methods, machine learning methods and deep learning methods. Although statistical methods such as time series analysis and regression analysis are simple to implement, they often have difficulty in capturing the nonlinear characteristics and complex patterns of load data, and their applicability relies on strong mathematical assumptions. The confidence interval is too large in power load data with high noise, and the results are difficult to guide downstream decision-making. Machine learning methods, such as support vector machines (SVM) and random forests, have improved the prediction accuracy to a certain extent, but there are still problems such as limited processing capabilities for large amounts of data and difficulty in processing time series data, especially poor performance in the regression problem of continuous dependent variables. Deep learning methods have certain advantages in processing large amounts of time series data, but power consumption data has multi-period characteristics (such as daily cycles, weekly cycles, seasonal cycles, etc.), high noise characteristics and non-stationary characteristics (manifested as statistical characteristics changing over time), which makes it difficult to directly apply deep learning models for prediction. Summary of the invention

[0004] To this end, this application discloses the following technical solutions:

[0005] The first aspect of the present application provides a method for predicting power consumption by combining wavelet transform and LSTM, comprising:

[0006] Determine a target time period for which electricity consumption needs to be predicted, and determine a plurality of reference time periods before the target time period from a plurality of time periods included in a preset historical cycle;

[0007] Obtaining the power consumption characteristics of the target time period and each reference time period, wherein the power consumption characteristics of each time period include reference power consumption at multiple time scales and multiple time intervals before the time period, and the reference power consumption is obtained by wavelet transforming the original power consumption of each time period contained in the historical cycle;

[0008] The power consumption characteristics of the target time period and the power consumption characteristics of each reference time period are processed according to a pre-built power consumption prediction model to obtain the predicted power consumption of the target time period. The power consumption prediction model is a deep learning model based on a long short-term memory network.

[0009] Optionally, the method of obtaining the reference power consumption by processing the original power consumption of each time period contained in the historical period by wavelet transform includes:

[0010] Cleaning the data of the original electricity consumption in each time period contained in the historical period;

[0011] Performing wavelet transformation on the power consumption of each time period contained in the historical period after data cleaning to obtain reference power consumption of each time period contained in the historical period;

[0012] The data cleaning of the original power consumption in each time period contained in the historical period includes:

[0013] Filter out the first time period in the historical period where the original power consumption is missing, and fill the missing value of the first time period according to the original power consumption of multiple time periods with the same timestamp before and after the first time period;

[0014] A second time period in which the corresponding original power consumption meets the abnormal condition is screened out, and according to the original power consumption of multiple time periods with the same timestamp before and after the second time period, the original power consumption of the second time period is replaced with an abnormal value based on the spline interpolation method.

[0015] Optionally, the method for obtaining the power consumption characteristics of any reference time period includes:

[0016] Select a time period that is one week apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0017] Select a time period that is 24 hours apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0018] Determine a first interval between 2 hours and 24 hours from the reference time period, accumulate the reference power consumption per hour in the first interval in units of hours, and add the sum of the reference power consumption per hour to the power consumption characteristics of the reference time period;

[0019] A second interval that is within 2 hours of the reference time period is determined, and the reference power consumption of each time period in the second interval is added to the power consumption characteristics of the reference time period.

[0020] Optionally, the power consumption characteristics of the target time period include reference power consumption at multiple time scales and multiple time intervals before the target time period, and target data related to power consumption in the target time period;

[0021] The target data for the target time period includes at least one of the following:

[0022] Temperature data for the target time period;

[0023] first indication data of the target time period, the first indication data indicating whether the target time period belongs to a working day;

[0024] The second indication data of the target time period represents the day of the week to which the target time period belongs and the hour of the day to which the target time period belongs.

[0025] Optionally, processing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to a pre-built power consumption prediction model to obtain the predicted power consumption of the target time period includes:

[0026] Standardizing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period to obtain standard characteristics of the target time period and standard characteristics of each reference time period;

[0027] Processing the standard features of the target time period and the standard features of each reference time period according to a pre-built power consumption prediction model to obtain a standard prediction value for the target time period;

[0028] The standard prediction value is de-normalized to obtain the predicted power consumption in the target time period.

[0029] Optionally, the method for constructing the power consumption prediction model includes:

[0030] Determine a plurality of training samples according to the reference power consumption of each time period in the historical period, each of the training samples including the reference power consumption of any time period in the historical period as a label value and a plurality of sample power consumption features corresponding to the label value;

[0031] Processing the sample power consumption characteristics of the training samples according to the initial deep learning model based on the long short-term memory network to obtain the predicted value corresponding to the training samples;

[0032] The model loss of the initial deep learning model is determined according to the mean square error between the label value and the predicted value, and the initial deep learning model is trained according to the model loss to obtain the power consumption prediction model.

[0033] The second aspect of the present application provides a power consumption prediction device combining wavelet transform and LSTM, comprising:

[0034] A determination unit, configured to determine a target time period for which power consumption needs to be predicted, and determine a plurality of reference time periods before the target time period from a plurality of time periods included in a preset historical cycle;

[0035] An obtaining unit, used to obtain the power consumption characteristics of the target time period and each reference time period, wherein the power consumption characteristics of each time period include reference power consumption at multiple time scales and multiple time intervals before the time period, and the reference power consumption is obtained by wavelet transforming the original power consumption of each time period contained in the historical cycle;

[0036] A processing unit is used to process the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to a pre-constructed power consumption prediction model to obtain the predicted power consumption of the target time period, wherein the power consumption prediction model is a deep learning model based on a long short-term memory network.

[0037] Optionally, when the obtaining unit obtains the original power consumption of each time period contained in the historical cycle and processes it through wavelet transform to obtain the reference power consumption, it is used to:

[0038] Cleaning the data of the original electricity consumption in each time period contained in the historical period;

[0039] Performing wavelet transformation on the power consumption of each time period contained in the historical period after data cleaning to obtain reference power consumption of each time period contained in the historical period;

[0040] Wherein, when the obtaining unit performs data cleaning on the original power consumption of each time period contained in the historical period, it is used to:

[0041] Filter out the first time period in the historical period where the original power consumption is missing, and fill the missing value of the first time period according to the original power consumption of multiple time periods with the same timestamp before and after the first time period;

[0042] A second time period in which the corresponding original power consumption meets the abnormal condition is screened out, and according to the original power consumption of multiple time periods with the same timestamp before and after the second time period, the original power consumption of the second time period is replaced with an abnormal value based on a spline interpolation device.

[0043] Optionally, when the obtaining unit obtains the power consumption characteristics of any reference time period, it is used to:

[0044] Select a time period that is one week apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0045] Select a time period that is 24 hours apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0046] Determine a first interval between 2 hours and 24 hours from the reference time period, accumulate the reference power consumption per hour in the first interval in units of hours, and add the sum of the reference power consumption per hour to the power consumption characteristics of the reference time period;

[0047] A second interval that is within 2 hours of the reference time period is determined, and the reference power consumption of each time period in the second interval is added to the power consumption characteristics of the reference time period.

[0048] Optionally, when the processing unit processes the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to the pre-built power consumption prediction model to obtain the predicted power consumption of the target time period, it is used to:

[0049] Standardizing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period to obtain standard characteristics of the target time period and standard characteristics of each reference time period;

[0050] Processing the standard features of the target time period and the standard features of each reference time period according to a pre-built power consumption prediction model to obtain a standard prediction value for the target time period;

[0051] The standard prediction value is de-normalized to obtain the predicted power consumption in the target time period.

[0052] The beneficial effects of the present application are as follows: on the one hand, when obtaining the electricity consumption characteristics for predicting electricity consumption, the present scheme performs noise reduction processing on the original electricity consumption data by means of wavelet transform, thereby reducing the noise of the data input into the electricity consumption prediction model and avoiding the high noise characteristics of electricity consumption from interfering with the model prediction; on the other hand, the present scheme uses an electricity consumption prediction model based on a long short-term memory network for prediction, and refers to electricity consumption at multiple time scales and multiple time intervals when obtaining the electricity consumption characteristics, so that the electricity consumption prediction model can learn the periodicity and non-stationarity of electricity consumption. Therefore, the present scheme can obtain more accurate prediction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0054] Figure 1 It is a flowchart of a method for predicting power consumption by combining wavelet transform and LSTM provided in an embodiment of the present application;

[0055] Figure 2 is a flow chart of a wavelet transform provided in an embodiment of the present application;

[0056] Figure 3 It is a structural schematic diagram of a power consumption prediction model provided in an embodiment of the present application;

[0057] Figure 4 This is a schematic diagram of a residential user's electricity consumption prediction result provided in an embodiment of the present application;

[0058] Figure 5 This is a schematic diagram of a commercial building electricity consumption prediction result provided by an embodiment of the present application;

[0059] Figure 6 is a schematic diagram of model error comparison provided in an embodiment of the present application;

[0060] Figure 7 It is a structural diagram of a power consumption prediction device combining wavelet transform and LSTM provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0062] This application embodiment provides a method for predicting power consumption by combining wavelet transform and LSTM. Figure 1 , is a flow chart of the method, and the method may include the following steps.

[0063] S101, determining a target time period for which electricity consumption needs to be predicted, and determining a plurality of reference time periods before the target time period from a plurality of time periods included in a preset historical cycle.

[0064] S102, obtaining the electricity consumption characteristics of the target time period and each reference time period, wherein the electricity consumption characteristics of each time period include reference electricity consumption at multiple time scales and multiple time intervals before the time period, and the reference electricity consumption is obtained by wavelet transforming the original electricity consumption of each time period contained in the historical cycle.

[0065] S103, processing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to a pre-built power consumption prediction model to obtain the predicted power consumption of the target time period, wherein the power consumption prediction model is a deep learning model based on a long short-term memory network.

[0066] The long short-term memory network used in this embodiment can be a long short-term memory network (Temporal Pattern Attention-Long Short-Term Memory, TPA-LSTM) based on the TPA attention mechanism, or a long short-term memory network of other structures, without limitation.

[0067] The beneficial effects of this embodiment are as follows: on the one hand, when obtaining the power consumption characteristics for predicting power consumption, this scheme performs noise reduction processing on the original power consumption data by means of wavelet transform, thereby reducing the noise of the data input into the power consumption prediction model and avoiding the high noise characteristics of power consumption interfering with the model prediction; on the other hand, this scheme uses the power consumption prediction model based on the long short-term memory network for prediction, and refers to the power consumption at multiple time scales and multiple time intervals when obtaining the power consumption characteristics, so that the power consumption prediction model can learn the periodicity and non-stationarity of power consumption. Therefore, this scheme can obtain more accurate prediction results.

[0068] In step S101, the target time period may be a time period of a target duration after the current time. For example, if the current time is T0 and the target duration is 15 minutes, the target time period may be a time period from T0 to T0+15 minutes. The target duration is not limited to 15 minutes and may be adjusted as needed, such as 10 minutes, 20 minutes, 30 minutes, etc.

[0069] The preset historical period can be a specific period before the target time period, such as one week before the target time period, 30 days before the target time period, one year before the target time period, three years before the target time period, etc. The specific period can be set as needed without limitation.

[0070] The multiple reference time periods may be multiple consecutive time periods in the above historical period up to the current moment, each of which is a time period of the target duration, for example, each time period is a period of 15 minutes.

[0071] The number of reference time periods may be preset without limitation. For example, 10 reference time periods, 20 reference time periods, etc. may be determined.

[0072] For example, the current time is 6:00:00, then the four reference time periods closest to the current time are reference time period 1, 5:00:00 to 5:15:00; reference time period 2, 5:15:00 to 5:30:00; reference time period 3, 5:30:00 to 5:45:00; and reference time period 4, 5:45:00 to 6:00:00.

[0073] In step S102, reference power consumption of multiple time periods in a historical period may be obtained, and then, for each reference time period, power consumption characteristics of the reference time period may be determined based on the reference power consumption of the multiple time periods.

[0074] In this embodiment, the original power consumption of multiple time periods in the historical period can be processed by wavelet transformation to obtain the reference power consumption of multiple time periods. Specifically, the reference power consumption of multiple time periods can be obtained as follows:

[0075] Clean the data of the original electricity consumption in each time period included in the historical cycle;

[0076] The power consumption of each time period in the historical period after data cleaning is processed by wavelet transformation to obtain the reference power consumption of each time period in the historical period;

[0077] Among them, the data cleaning of the original electricity consumption in each time period contained in the historical cycle includes:

[0078] Filter out the first time period in the historical period where the original power consumption is missing, and fill the missing value of the first time period according to the original power consumption of multiple time periods with the same timestamp before and after the first time period;

[0079] The second time period whose corresponding original power consumption meets the abnormal condition is screened out, and the original power consumption of the second time period is replaced with an abnormal value based on the spline interpolation method according to the original power consumption of multiple time periods with the same timestamp before and after the second time period.

[0080] As an example, when filling missing values, please refer to formula (1). Assuming that the original power consumption of the mth time period on day t is missing, the average value of the same period in the 7 days before and after day t (that is, the mth time period of each day) can be used as the original power consumption of the mth time period on day t.

[0081]

[0082] In this embodiment, outliers can be identified and replaced in the following three ways.

[0083] First, for each time period, the mean of the original electricity consumption of each time period within the date to which the time period belongs can be determined. If the original electricity consumption of a time period exceeds 4 times the mean corresponding to the date to which it belongs, the original electricity consumption of the time period is determined to be an outlier. In this case, the data of the same time period in the previous and next 7 days can be used for cubic spline interpolation, and the result is used to replace the outlier of the time period.

[0084] Second, the raw electricity consumption in the 15-minute interval grouping in a day that exceeds the upper quartile value (Q3) by 2 interquartile ranges (IQR = Q3-Q1) and is lower than the lower quartile value (Q1) by 2 interquartile ranges can be identified as outliers, and cubic spline interpolation is performed using the data of the same period of 30 days before and after, and the results are used to replace the outliers.

[0085] Third, the raw electricity consumption that is 1.5 IQR higher than Q3 of the day and 1.5 IQR lower than Q1 of the day in the data of each day can be identified as an outlier, and spline interpolation is performed using the data of 10 15-minute intervals before and after the day, and the result is used to replace the outlier.

[0086] The original power consumption of each time period refers to the power consumption of the user end actually detected in the time period. Optionally, the original power consumption obtained can be the original power consumption of residential users, for example, in the time period from 5:30:00 to 5:45:00, the residential users' power consumption is 20 kWh; the original power consumption obtained can be the original power consumption of commercial buildings, for example, in the time period from 5:30:00 to 5:45:00, the commercial buildings' power consumption is 2000 kWh.

[0087] If the original electricity consumption of residential users is obtained, the electricity consumption of residential users within the target time period can be predicted by the method of this embodiment. If the original electricity consumption of commercial buildings is obtained, the electricity consumption of commercial buildings within the target time period can be predicted by the method of this embodiment.

[0088] After the data of the original power consumption of multiple time periods in the historical period are cleaned in the above manner, the cleaned original power consumption data can be processed by wavelet transformation in the following manner to obtain the reference power consumption of each time period.

[0089] The wavelet transform method used in this embodiment may be Daubechies wavelet transform or other wavelet transforms.

[0090] The following uses Daubechies wavelet transform, Daubechies D4 filter and first-order decomposition as an example to illustrate the specific processing process. In other embodiments, other filters and other decomposition levels can also be selected for wavelet transform processing, not limited to the above selections.

[0091] See also Figure 2 First, the original power consumption of multiple time periods in the historical period can be divided into multiple sequences of equal length. Each sequence includes the original power consumption of multiple time periods in the historical period. Each sequence is equivalent to a pre-transformation data that needs to be processed by wavelet transform.

[0092] For example, a day may include 96 15-minute time periods, and correspondingly may include 96 raw power consumptions, which are sequentially recorded as x1 to x 96 In this embodiment, the 96 original power consumptions of one day in the historical period can be used as a pre-transformation data x, that is, x padded =[x1, x2, x3, … x 96 ].

[0093] For each pre-transformed data, since the coefficient length of the Daubechies D4 filter is 4, it is necessary to perform boundary processing on the pre-transformed data to avoid boundary effects. In this embodiment, the zero-filling method can be used to perform boundary processing on the converter data, that is, to fill 0 data at both ends of the pre-transformed data to obtain the filled data x padded , that is, x padded =[0, 0, x1, x2, x3,...x 96 , 0, 0]. Thus, a padded data with a length of 100 can be obtained.

[0094] The low-pass filter coefficient and the high-pass filter coefficient are applied respectively to process the padded data, wherein the low-pass filter coefficient h of the Daubechies D4 filter can be: h = [0.482963, 0.836516, 0.224144, -0.129410], and the high-pass filter coefficient g of the Daubechies D4 filter can be: g = [-0.129420, -0.224144, 0.836516, -0.482963].

[0095] According to the low-pass filter coefficient, the padded data is calculated using the following formula (2) to obtain the approximate coefficient a[n].

[0096]

[0097] According to the high-pass filter coefficient, the padded data is calculated using the following formula (3) to obtain the detail coefficient d[n].

[0098]

[0099] Optionally, when multi-level decomposition is required, the above-mentioned approximate coefficients a[n] and detail coefficients d[n] can be used as converter data to repeat the above-mentioned filling and filtering processes. For example, if a 2-level decomposition is performed, it is repeated once, and if a 3-level decomposition is performed, it is repeated twice, thereby obtaining the approximate coefficients and detail coefficients of the required decomposition level.

[0100] After obtaining the detail coefficient, the detail coefficient d[n] can be subjected to soft threshold denoising according to the following formulas (4) and (5).

[0101]

[0102] Where σ is the standard deviation of detail coefficient d[n], N=96, d new [n] is the detail coefficient after soft threshold denoising.

[0103] The detail coefficients and approximate coefficients after soft threshold denoising can be upsampled respectively to obtain the upsampled detail coefficients and the upsampled approximate coefficients. In this embodiment, upsampling can be achieved by inserting a zero between each coefficient. The processing process can be expressed by the following formulas (6) to (9).

[0104] a upsampled [2n]=a[n],n=0,…,48 (6)

[0105] a upsampled [2n+1]=0,n=0,…,48 (7)

[0106] d new,upsampled [2n] = d new [n],n=0,…,48 (8)

[0107] d new,upsampled [2n+1]=0,n=0,…,48 (9)

[0108] Thus, among them, d new,upsampled [n] represents the detail coefficient after upsampling, a upsampled [n] represents the approximate coefficient after upsampling. It can be seen that after upsampling, the length of the detail coefficient and the approximate coefficient will become 98 points.

[0109] After obtaining the upsampled detail coefficients and approximation coefficients, the inverse filter coefficients of the Daubechies D4 filter can be used to synthesize the two. The inverse filter coefficients are the transposition and conjugation of the original filter coefficients (for real coefficients, only the transposition is sufficient). The inverse low-pass filter coefficients are represented by h' and the inverse high-pass filter coefficients are represented by g', as shown below.

[0110] h'=[h[3],h[2],h[1],h[0]]

[0111] g'=[g[3],g[2],g[1],g[0]]

[0112] Taking the inverse low-pass filter coefficients as an example, the first term of h' is equal to the fourth term of h[3], the second term of h' is equal to the third term of h[2], the third term of h' is equal to the second term of h[1], and the fourth term of h' is equal to the first term of h[0]. The inverse high-pass filter coefficients are the same and will not be repeated here.

[0113] Based on the inverse low-pass filter coefficients and the inverse high-pass filter coefficients, the upsampled detail coefficients and approximate coefficients can be fused according to the following formula (10) to obtain the reconstructed data x'.

[0114]

[0115] Here, the range of n is 0 to 97, that is, the reconstructed data x'=[x'[0], x'[1]...x'

[96] , x'

[97] ], a total of 98 items.

[0116] Finally, since the boundary filling was performed during the decomposition process, the reconstructed data now needs to be processed to remove the boundary effect, that is, to remove the filled zeros from the reconstructed data, that is, to delete the first and last items in the above reconstructed data, thereby obtaining the transformed data x final , that is, x final ==[x'[1], x'[2]...x'

[95] , x'

[96] ], a total of 96 items, each of which is equivalent to the reference power consumption in the corresponding time period of the day.

[0117] For example, the original power consumption of 96 time periods on the mth day is used to form the aforementioned pre-transformation data x, and after the above wavelet transformation processing, the transformed data x is obtained. final , where the first item x'[1] is equivalent to the first time period of the mth day, that is, the reference power consumption from 00:00:00 to 00:15:00 on the mth day; the second item x'[2] is equivalent to the second time period of the mth day, that is, the reference power consumption from 00:15:00 to 00:30:00 on the mth day, and so on.

[0118] After obtaining the reference power consumption of each time period in the historical period, for any reference time period, the power consumption characteristics of the reference time period can be obtained in the following manner.

[0119] First, for ease of explanation, it is assumed that t-1 reference time periods are selected in step S101, and they are recorded as reference time period 1 to reference time period t-1 in order according to the length of time from the current moment, where reference time period 1 is the farthest from the current moment and reference time period t-1 is the closest to the current moment. For example, reference time period t-1 can be the most recent 15-minute time period up to the current moment, and the target time period for which power consumption needs to be predicted after the current moment is recorded as target time period t.

[0120] For any reference time period k, where k is any integer between 1 and t-1, its power consumption characteristic can be recorded as P k , P k The way to obtain is as follows:

[0121] Select a time period that is one week apart from the reference time period k and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0122] As an example, assuming that the reference time period k is 12:00-12:15 on January 1, 2024, then the time period 12:00-12:15 a week ago can be selected, that is, the reference power consumption from 12:00-12:15 on December 25, 2023 can be selected as the first data item P of the power consumption feature of the reference time period k [1], that is, P k [1] = Reference electricity consumption from 12:00 to 12:15 on December 25, 2023.

[0123] Select a time period that is 24 hours apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0124] As an example, assuming that the reference time period k is 12:00-12:15 on January 1, 2024, then the time period 12:00-12:15 24 hours ago can be selected, that is, the reference power consumption from 12:00-12:15 on December 31, 2023 can be selected as the second data item P of the power consumption feature of the reference time period k [2], that is, P k [2] = Reference electricity consumption from 12:00 to 12:15 on December 31, 2023.

[0125] Determine a first interval between 2 hours and 24 hours from the reference time period, accumulate the reference power consumption per hour in the first interval in units of hours, and add the sum of the reference power consumption per hour to the power consumption characteristics of the reference time period;

[0126] In other words, the 60-minute electricity consumption data between one day and two hours before the reference time period k can be selected to be added to the electricity consumption characteristics of the reference time period k;

[0127] For example, assuming that the reference time period k is 12:00-12:15 on January 1, 2024, the reference power consumption for each hour between 12:00 on December 31, 2023 and 10:00 on January 1, 2024 can be selected, and a total of 22 reference power consumptions corresponding to 22 hours can be selected as the third to 24th items of data in the power consumption characteristics of the reference time period k, that is, P k [3] = Reference power consumption from 12:00 to 13:00 on December 31, 2023, P k [4] = Reference electricity consumption from 13:00 to 14:00 on December 31, 2023...P k

[24] = the reference electricity consumption from 9:00 to 10:00 on January 1, 2024, where the reference electricity consumption for each hour can be equal to the sum of the reference electricity consumption for each time period within the hour. For example, if each time period is 15 minutes long, then the reference electricity consumption from 12:00 to 13:00 on December 31, 2023 can be equal to the sum of the reference electricity consumption for four 15-minute periods within the period from 12:00 to 13:00 on December 31, 2023.

[0128] Determine a second interval within 2 hours of the reference time period, and add the reference power consumption of each time period in the second interval to the power consumption characteristics of the reference time period, that is, add the reference power consumption of each time period within 2 hours before the start time of the reference time period k to the power consumption characteristics of the reference time period k;

[0129] For example, assuming that the reference time period k is 12:00-12:15 on January 1, 2024, the reference power consumption every 15 minutes in the first 2 hours, that is, 10:00-12:00 on January 1, 2024, can be added to the power consumption characteristics of the reference time period k as the 25th to 32nd data in the power consumption characteristics of the reference time period k, that is, P k

[25] = Reference power consumption from 10:00 to 10:15 on January 1, 2024, P k

[26] = reference power consumption from 10:15 to 10:30 on January 1, 2024, ... P k

[32] = Reference electricity consumption from 11:45 to 12:00 on January 1, 2024.

[0130] At this point, the power consumption characteristics of a reference time period can be obtained, which are composed of reference power consumption at multiple time scales (e.g., 15 minutes, 60 minutes) and multiple time intervals (e.g., one week ago, 24 hours ago, within 2 hours) before a reference time period.

[0131] After obtaining the power consumption characteristics P in the target time period t On the one hand, the 15-minute and 60-minute reference power consumptions one week before, 24 hours before, between 2 hours and 24 hours, and within 2 hours before the target time period can be obtained in the same manner as described above to obtain the power consumption characteristics of the reference time period, and these reference power consumptions can be used as items 1 to 32 of the power consumption characteristics of the target time period.

[0132] Furthermore, target data related to the target time period and the electricity consumption can be obtained and added to the electricity consumption characteristics of the target time period. In other words, the electricity consumption characteristics of the target time period can include reference electricity consumption at multiple time scales and multiple time intervals before the target time period, and can include target data related to the target time period and the electricity consumption.

[0133] The target data for the target time period includes, but is not limited to, any one or more of the following data. In some embodiments, the target data for the target time period may include each of the following:

[0134] Temperature data for the target time period;

[0135] First indication data of the target time period, the first indication data indicating whether the target time period belongs to a working day;

[0136] The second indication data of the target time period represents the day of the week and the hour of the day to which the target time period belongs.

[0137] The temperature data of the target time period can be the temperature data measured at the current time. For example, the current time is 12:00 on January 1, 2024, and the target time period is 15 minutes after the current time, that is, 12:00-12:15 on January 1, 2024. Since the room temperature generally does not change significantly within 15 minutes, the temperature data measured at 12:00 on January 1, 2024 can be added to the power consumption characteristics of the target time period, for example, as P t The 33rd item, namely P t

[33] = Temperature data measured at 12:00 on January 1, 2024.

[0138] Alternatively, the recent temperature change trend can be analyzed based on the temperature data of multiple consecutive time periods between the target time periods, and the temperature data of the target time period can be predicted based on the temperature change trend and the temperature data measured at the current moment, and the predicted temperature data can be used as the temperature data of the target time period.

[0139] The first indicator data of the target time period can be recorded as Holiday t , the data can be equal to 1 or 0. If it is equal to 1, it means that the target time period belongs to a non-working day (including holidays and weekends). If it is equal to 0, it means that the target time period belongs to a working day. For example, if the target time period is 12:00-12:15 on January 1, 2024, the first indication data can be 1, indicating that January 1, 2024 is a non-working day. If the target time period is 12:00-12:15 on January 4, 2024, the first indication data can be 0, indicating that January 4, 2024 is a working day. The first indication data can be used as the 34th item of the power consumption feature of the target time period, that is, P t

[34] = Holiday t .

[0140] The second indication data of the target time period may include Day t and Hour t The former can be any integer from 1 to 7, and its value represents the day of the week to which the target time period belongs, such as Day t =1 means the target time period is Monday, Day t =7 means the target time period is Sunday; the latter can be any integer from 1 to 24, and its value indicates the hour of the target time period. For example, if the target time period is 12:00-12:15 on January 4, 2024, then Hour t =15, indicating that the target time period belongs to the 12th hour of January 4, and the target time period is 9:45-10:00 on January 4, 2024, then Hourt=9, indicating that the target time period belongs to the 9th hour of January 4,.

[0141] The second indication data can be used as the 35th and 36th items of the power consumption characteristics in the target time period, that is, P t

[35] = Day t , P t

[36] ==Hour t .

[0142] In some embodiments, the second indication data may also be composed of two vectors, one of which is a 7-dimensional vector Day[d], where d is an integer from 1 to 7, corresponding to Monday to Sunday. The value of the variable corresponding to the date of the target time period in the vector is 1, and the other values ​​are 0, thereby representing the day of the week to which the target time period belongs. For example, if the target time period belongs to Thursday, then Day[4]=1, and Day[1] to Day[3], and Day[5] to Day[7] are all 0. The other vector may be a 24-dimensional vector Hour[h], where h is an integer from 1 to 24, corresponding to the 24 hours of a day. The value of the variable corresponding to the hour to which the target time period belongs in the vector is 1, and the other values ​​are 0, thereby representing the hour of the day to which the target time period belongs. For example, if the target time period is 9:45-10:00 on January 4, 2024, then Hour[9]=1, and other dimensions where h is not equal to 9 have Hour[h]=0. In this case, P t

[35] =(Day[1], Day[2]...Day[7]), P t

[36] =(Hour[1], Hour[2]...Hour

[24] ).

[0143] When predicting electricity consumption, related technologies are often based on a single time series, ignoring the various factors that affect electricity consumption, such as the nonlinear effects of weather, temperature, holidays and other factors. However, this embodiment introduces the above-mentioned target data into the electricity consumption characteristics of the target time period, and can combine these influencing factors to more accurately predict the electricity consumption of the target time period.

[0144] After obtaining the power consumption characteristics of the above target time period and reference time period, the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period can be processed according to the pre-built power consumption prediction model to obtain the predicted power consumption of the target time period.

[0145] The power consumption prediction model used in this embodiment can be a TPA-LSTM model, which is a deep learning model that combines the time attention mechanism and LSTM (Long Short-Term Memory Network), which can capture the importance of different time points in time series data, thereby improving the prediction effect. The main structure of the model includes an input layer, a hidden layer, and an output layer.

[0146] The input layer is used to receive the power consumption characteristics of the target time period and each reference time period, that is, to receive Figure 3 P1 to P t The hidden layer contains TPA-LSTM units, each of which has a temporal attention mechanism. The output layer can be a fully connected layer (i.e. Figure 3 The output layer is used to receive the output of the hidden layer and determine the predicted power consumption y for the target time period based on the output of the hidden layer.t '.

[0147] In this embodiment, a TPA-LSTM unit may include an LSTM unit and a temporal attention (TPA) mechanism.

[0148] Among them, the LSTM unit is used to learn dependencies in long time series by designing a special gating mechanism, and to avoid the problem of gradient disappearance while capturing useful information in the time series.

[0149] The LSTM unit may include a forget gate, an input gate, a candidate memory cell state, and an output gate. The working principle of LSTM is as follows.

[0150] For the kth TPA-LSTM unit (k is an integer from 1 to t) in the power consumption prediction model, the forget gate f k Used to determine the hidden state h of the previous moment k-1 How much information needs to be retained? The processing process of the forget gate is shown in formula (11).

[0151] f k =σ(W f ·[h k-1 ,P k ]+b f ) (11)

[0152] Among them, f k represents the output of the forget gate of the kth TPA-LSTM unit, P k is the power consumption characteristics of the kth time period in multiple consecutive reference time periods and target time periods, W f is the weight matrix of the forget gate, b f is the bias term of the forget gate, σ represents the activation function of the forget gate (such as the sigmoid function), and if k is equal to 1, h can be set directly k-1 =0.

[0153] Input Gate i k The input P used to determine the current time k How much information needs to be stored in the memory cell? The processing of the input gate can be expressed by formula (12).

[0154] i k =σ(W i ·[h k-1 ,P k ]+b i ) (12)

[0155] Among them, i k represents the output of the input gate of the kth TPA-LSTM unit, W iis the weight matrix of the input gate, b i is the bias term of the input gate, and σ represents the activation function of the input gate (such as the sigmoid function).

[0156] The candidate memory cell state is denoted as c k ', which can be calculated according to the following formula (13).

[0157] c k '=tanh(W c ·[h k-1 ,P k ]+b c ) (13)

[0158] Where W c is the weight matrix of the memory cell state, b c is the bias term of the memory cell state, and tanh is the hyperbolic tangent function.

[0159] In the LSTM unit, the output of the input gate and the forget gate can be used to update the candidate memory cell state to obtain the updated memory cell state c k , the updating process can be expressed by the following formula (14).

[0160] c k =f k ⊙c k-1 +i k ⊙c k ' (14)

[0161] Where ⊙ represents element-by-element multiplication, c k-1 is the updated memory cell state of the previous TPA-LSTM unit.

[0162] The output gate can be used with o k Indicates that the output gate is used to determine the current memory cell state c k How much information in will be passed to the next hidden state? The working principle of the output gate can be expressed by the following formula (15).

[0163] o k =σ(W o ·[h k-1 ,P k ]+b o ) (15)

[0164] Among them, k represents the output of the output gate of the kth TPA-LSTM unit, W o is the weight matrix of the output gate, b o is the bias term of the output gate, and σ represents the activation function of the output gate (such as the sigmoid function).

[0165] After obtaining the output of the output gate, the output of the output gate can be used to determine the output h of the LSTM unit in the kth TPA-LSTM unit. k , the specific process is shown in formula (16).

[0166] h k =o k ⊙tanh(c k ) (16)

[0167] The goal of the temporal attention (TPA) mechanism is to assign an attention weight to each time step in the time series, thereby capturing the importance of different moments. Assume that at time t, the hidden state sequence composed of the hidden states of multiple LSTMs is (h1, h2, ... h t-1 ,h t ), the temporal attention mechanism can generate attention weights based on these hidden states and calculate a weighted global representation h t '.

[0168] In this embodiment, the power consumption prediction model can process the power consumption characteristics of each reference time period in turn according to the above formulas (11) to (16), and finally process the power consumption characteristics of the target time period, thereby obtaining the above hidden state sequence containing hidden states corresponding to t time periods.

[0169] The main steps of the temporal attention mechanism are as follows:

[0170] The hidden state h of each LSTM unit output is calculated according to formula (17): k Attention score Alpha k .

[0171] Alpha k =softmax(W a ·h k ) (17)

[0172] Among them, W a is the attention weight matrix, the softmax function (equivalent to Figure 3 The normalization layer shown in Figure 3 ensures that the attention scores are normalized to a probability distribution.

[0173] Then, the weighted representation h of the global hidden state is calculated based on the attention score t ', the calculation process is shown in formula (18).

[0174]

[0175] That is, each hidden state h k Multiply by the corresponding attention weight Alpha k, and then perform weighted summation to obtain a weighted representation of the global hidden state.

[0176] Finally, the MLP determines the predicted power consumption y for the target time period t based on the weighted representation of the global hidden state t ', as shown in formula (19).

[0177] y t '=MLP(h t ') (19)

[0178] In some optional embodiments, data standardization may be performed before inputting the electricity consumption characteristics of each time period into the electricity consumption prediction model. After obtaining the output of the electricity consumption prediction model, the output may be de-standardized to obtain the predicted electricity consumption for the target time period.

[0179] That is, processing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to the pre-built power consumption prediction model to obtain the predicted power consumption of the target time period may include:

[0180] S1, standardizing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period to obtain the standard characteristics of the target time period and the standard characteristics of each reference time period;

[0181] S2, processing the standard features of the target time period and the standard features of each reference time period according to the pre-built power consumption prediction model to obtain a standard prediction value for the target time period;

[0182] S3, performing de-standardization processing on the standard prediction value to obtain the predicted power consumption in the target time period.

[0183] In step S1, for each power consumption feature P k The power consumption feature can be standardized according to the following formula (20) to obtain the corresponding standard feature P k '.

[0184]

[0185] Among them, P k [n] represents the nth item of the power consumption characteristic, the standard characteristic P k '[n] represents the nth item of the standard feature, min(P k [n]) represents the minimum value of the nth item in all power consumption characteristics (including the power consumption characteristics of the t-1 reference time period and the tth target time period, a total of t power consumption characteristics), max(P k [n]) represents the maximum value of the nth item in all power consumption characteristics.

[0186] It should be noted that the above-mentioned standardization process may be performed only on the features determined by reference to the power consumption in each power consumption feature, and the target data contained in the power consumption features of the target time period may not be standardized.

[0187] The execution process of step S2 can refer to the above formulas (11) to (19). It is only necessary to replace the power consumption characteristic P in the formula k Replaced by the corresponding standard feature P k ', correspondingly, when the power consumption prediction model is used in the above manner, the result of the MLP output of the power consumption prediction model can be replaced by the standard prediction value y of the power consumption in the target time period ts '.

[0188] In step S3, the standard prediction value output by the model can be de-standardized to obtain the predicted power consumption y for the target time period. t ', the de-standardization process can be expressed by the following formula (21).

[0189] y t '=y ts '×(max(y)-min(y))+min(y) (21)

[0190] Among them, max(y) can represent the maximum value of the reference power consumption of each time period with the same timestamp in the historical period and the target time period, and min(y) can represent the minimum value of the reference power consumption of each time period with the same timestamp in the historical period and the target time period.

[0191] Exemplarily, the target time period is 12:00-12:15 on January 4, 2024, then max(y) can represent the maximum value of the reference power consumption from 12:00 to 12:15 several days before January 4, 2024 (for example, every day in the previous year or a month), and min(y) represents the minimum value therein.

[0192] The power consumption prediction model of this embodiment can be constructed as follows:

[0193] S4, determining a plurality of training samples according to the reference power consumption in each time period in the historical period, each training sample including the reference power consumption in any time period in the historical period as a label value and a plurality of sample power consumption features corresponding to the label value;

[0194] S5, processing the sample power consumption characteristics of the training samples according to the initial deep learning model based on the long short-term memory network to obtain the prediction value corresponding to the training samples;

[0195] S6, determining the model loss of the initial deep learning model according to the mean square error between the label value and the predicted value, and training the initial deep learning model according to the model loss to obtain the power consumption prediction model.

[0196] In step S4, each training sample can be constructed as follows:

[0197] Select any time period in the historical period, regard the selected time period as the target time period t, determine the power consumption characteristics of the target time period and the power consumption characteristics of t-1 reference time periods before the target time period in the manner of the aforementioned embodiment, and use the reference power consumption of the time period as the label value of the training sample to obtain a training sample containing the label value and t power consumption characteristics.

[0198] In step S5, for each training sample, the initial deep learning model can be used to process the t power consumption features contained in the training sample one by one according to the aforementioned formulas (11) to (19), and then the data output after processing by the initial deep learning model is used as the predicted value of the training sample, which represents the power consumption predicted by the model in the target time period of the training sample.

[0199] In step S6, the mean square error between the label value and the predicted value of each training sample can be calculated according to the following formula (22) to obtain the model loss Loss.

[0200]

[0201] Where N represents the total number of training samples, y i,1 represents the label value of the i-th training sample, y i,2 Represents the predicted value of the i-th training sample.

[0202] After the model loss is calculated, if the model loss does not meet the convergence condition, the Adam optimizer can be used to update the parameters of the initial deep learning model based on the model loss. After the update, steps S2 and S3 are repeated to obtain a new prediction value and a new model loss until the model loss obtained at a certain time meets the convergence condition. The convergence condition can be set to the model loss being less than the loss threshold or to other conditions, without limitation.

[0203] Optionally, in this embodiment, according to the electricity consumption in each time period in the historical period, 80% of the data can be used to construct a training set, the training set includes multiple training samples, 10% of the data can be used to construct a validation set, the validation set includes multiple validation samples, and 10% of the data can be used to construct a test set, the test set includes multiple test samples. The method for constructing the validation sample and the test sample refers to the above-mentioned training sample and will not be repeated here.

[0204] Then you can use the training set to train the model. After the training converges, you can use the validation set and test set for verification and testing respectively.

[0205] During training, the hyperparameters of the model can be set, specifically, the number of epochs and the batch size can be set. When the method of this embodiment is used to predict residential users, the number of epochs is set to 14 generations and the batch size is set to 128 samples; when used to predict commercial buildings, the number of epochs is set to 5 generations and the batch size is set to 256 samples. Optionally, other hyperparameters can also be set, such as the number of LSTM units, the learning rate, etc.

[0206] The above hyperparameters can be selected by cross-validation.

[0207] In this embodiment, the mean absolute percentage error MAPE and the root mean square error RMSE can be used to evaluate the accuracy of the trained electricity consumption prediction model. The calculation methods of the two errors can be referred to the relevant existing technologies and will not be described in detail.

[0208] To illustrate the accuracy of the method of this embodiment, see Figure 4 and Figure 5 ,in Figure 4 This is a schematic diagram of the comparison between the predicted data and the expected data when the method of this embodiment is applied to the prediction of residential users. When applied to the training set of residential user data, the mean absolute percentage error (MAPE) of the method of this embodiment can reach 7.9097%, when applied to the validation set, the MAPE is 5.1376%, and when applied to the test set, the MAPE is 7.0911%.

[0209] Figure 5 This is a schematic diagram of the comparison between the predicted data and the expected data when the method of this embodiment is applied to the prediction of commercial buildings. When applied to the training set of commercial building data, the MAPE is 6.9352%, when applied to the validation set, the MAPE is 2.4504%, and when applied to the test set, the MAPE is 2.8901%.

[0210] In summary, the errors in the model output results are mostly concentrated around 0, indicating that the prediction effect is good.

[0211] See also Figure 6, which is a schematic diagram comparing the method of this embodiment with an existing model (such as an ARIMA model). It can be seen that compared with the existing model, the power consumption prediction model used by the method of this embodiment has a better prediction effect on out-of-sample data, showing stronger generalization ability and adaptability. Although ARIMA's prediction also has a certain effect, the confidence interval is too large and cannot be used in actual business. This method can give a more accurate single-point prediction and can directly link various downstream tasks of demand-side management.

[0212] The present application also provides a power consumption prediction device combining wavelet transform and LSTM, see Figure 7 , is a schematic diagram of the device, and the device may include the following units.

[0213] The determination unit 701 is used to determine a target time period for which power consumption needs to be predicted, and to determine a plurality of reference time periods before the target time period from a plurality of time periods included in a preset historical cycle;

[0214] The obtaining unit 702 is used to obtain the power consumption characteristics of the target time period and each reference time period. The power consumption characteristics of each time period include the reference power consumption of multiple time scales and multiple time intervals before the time period. The reference power consumption is obtained by wavelet transforming the original power consumption of each time period contained in the historical cycle;

[0215] The processing unit 703 is used to process the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to a pre-built power consumption prediction model to obtain the predicted power consumption of the target time period. The power consumption prediction model is a deep learning model based on a long short-term memory network.

[0216] Optionally, when the obtaining unit 702 obtains the original power consumption of each time period contained in the historical cycle and processes it through wavelet transform to obtain the reference power consumption, it is used to:

[0217] Clean the data of the original electricity consumption in each time period included in the historical cycle;

[0218] The power consumption of each time period in the historical period after data cleaning is processed by wavelet transformation to obtain the reference power consumption of each time period in the historical period;

[0219] Wherein, when the obtaining unit 702 performs data cleaning on the original power consumption of each time period contained in the historical cycle, it is used to:

[0220] Filter out the first time period in the historical period where the original power consumption is missing, and fill the missing value of the first time period according to the original power consumption of multiple time periods with the same timestamp before and after the first time period;

[0221] A second time period in which the corresponding original power consumption meets the abnormal condition is screened out, and the original power consumption of the second time period is replaced with an abnormal value based on a spline interpolation device according to the original power consumption of multiple time periods with the same timestamp before and after the second time period.

[0222] Optionally, when the obtaining unit 702 obtains the power consumption characteristics of any reference time period, it is used to:

[0223] Select a time period that is one week apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0224] Select a time period that is 24 hours apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period;

[0225] Determine a first interval between 2 hours and 24 hours from the reference time period, accumulate the reference power consumption per hour in the first interval in units of hours, and add the sum of the reference power consumption per hour to the power consumption characteristics of the reference time period;

[0226] A second interval that is within 2 hours of the reference time period is determined, and the reference power consumption of each time period in the second interval is added to the power consumption characteristics of the reference time period.

[0227] Optionally, when the processing unit 703 processes the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to the pre-built power consumption prediction model to obtain the predicted power consumption of the target time period, it is used to:

[0228] The power consumption characteristics of the target time period and the power consumption characteristics of each reference time period are standardized to obtain the standard characteristics of the target time period and the standard characteristics of each reference time period;

[0229] Processing the standard features of the target time period and the standard features of each reference time period according to the pre-built power consumption forecasting model to obtain a standard forecast value for the target time period;

[0230] The standard forecast value is de-standardized to obtain the forecasted power consumption in the target time period.

[0231] Optionally, the power consumption characteristics of the target time period include reference power consumption at multiple time scales and multiple time intervals before the target time period, and target data related to power consumption during the target time period;

[0232] The target data for the target time period includes at least one of the following:

[0233] Temperature data for the target time period;

[0234] First indication data of the target time period, the first indication data indicating whether the target time period belongs to a working day;

[0235] The second indication data of the target time period represents the day of the week and the hour of the day to which the target time period belongs.

[0236] Optionally, the device further includes a construction unit 704, which is used to construct a power consumption prediction model, specifically for:

[0237] Determine multiple training samples based on the reference power consumption in each time period in the historical period, each training sample includes the reference power consumption in any time period in the historical period as a label value and multiple sample power consumption features corresponding to the label value;

[0238] Processing the sample power consumption characteristics of the training samples according to the initial deep learning model based on the long short-term memory network to obtain the prediction values ​​corresponding to the training samples;

[0239] The model loss of the initial deep learning model is determined according to the mean square error between the label value and the predicted value, and the initial deep learning model is trained according to the model loss to obtain the electricity consumption prediction model.

[0240] The working principle of the power consumption prediction device combining wavelet transform and LSTM provided in this embodiment can be found in the relevant steps of the power consumption prediction method combining wavelet transform and LSTM provided in this embodiment, which will not be traced back.

[0241] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0242] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0243] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0244] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0245] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for predicting electricity consumption by combining wavelet transform and LSTM, characterized in that: include: Determine a target time period for which electricity consumption needs to be predicted, and determine a plurality of reference time periods before the target time period from a plurality of time periods included in a preset historical cycle; Obtaining the power consumption characteristics of the target time period and each reference time period, wherein the power consumption characteristics of each time period include reference power consumption at multiple time scales and multiple time intervals before the time period, and the reference power consumption is obtained by wavelet transforming the original power consumption of each time period contained in the historical cycle; The power consumption characteristics of the target time period and the power consumption characteristics of each reference time period are processed according to a pre-built power consumption prediction model to obtain the predicted power consumption of the target time period. The power consumption prediction model is a deep learning model based on a long short-term memory network.

2. The method according to claim 1, characterized in that The method of obtaining the reference power consumption by wavelet transforming the original power consumption in each time period contained in the historical cycle includes: Cleaning the data of the original electricity consumption in each time period contained in the historical period; Performing wavelet transformation on the power consumption of each time period contained in the historical period after data cleaning to obtain reference power consumption of each time period contained in the historical period; The data cleaning of the original power consumption in each time period contained in the historical period includes: Filter out the first time period in the historical period where the original power consumption is missing, and fill the missing value of the first time period according to the original power consumption of multiple time periods with the same timestamp before and after the first time period; A second time period in which the corresponding original power consumption meets the abnormal condition is screened out, and according to the original power consumption of multiple time periods with the same timestamp before and after the second time period, the original power consumption of the second time period is replaced with an abnormal value based on the spline interpolation method.

3. The method according to claim 1, characterized in that The method for obtaining the power consumption characteristics of any reference time period includes: Select a time period that is one week apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period; Select a time period that is 24 hours apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period; Determine a first interval between 2 hours and 24 hours from the reference time period, accumulate the reference power consumption per hour in the first interval in units of hours, and add the sum of the reference power consumption per hour to the power consumption characteristics of the reference time period; A second interval that is within 2 hours of the reference time period is determined, and the reference power consumption of each time period in the second interval is added to the power consumption characteristics of the reference time period.

4. The method according to claim 1, characterized in that The power consumption characteristics of the target time period include reference power consumption at multiple time scales and multiple time intervals before the target time period, and target data related to power consumption during the target time period; The target data for the target time period includes at least one of the following: Temperature data for the target time period; first indication data of the target time period, the first indication data indicating whether the target time period belongs to a working day; The second indication data of the target time period represents the day of the week to which the target time period belongs and the hour of the day to which the target time period belongs.

5. The method according to claim 1, characterized in that The step of processing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to the pre-built power consumption prediction model to obtain the predicted power consumption of the target time period includes: Standardizing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period to obtain standard characteristics of the target time period and standard characteristics of each reference time period; Processing the standard features of the target time period and the standard features of each reference time period according to a pre-built power consumption prediction model to obtain a standard prediction value for the target time period; The standard prediction value is de-normalized to obtain the predicted power consumption in the target time period.

6. The method according to claim 1, characterized in that The method for constructing the power consumption prediction model includes: Determine a plurality of training samples according to the reference power consumption of each time period in the historical period, each of the training samples including the reference power consumption of any time period in the historical period as a label value and a plurality of sample power consumption features corresponding to the label value; Processing the sample power consumption characteristics of the training samples according to the initial deep learning model based on the long short-term memory network to obtain the predicted value corresponding to the training samples; The model loss of the initial deep learning model is determined according to the mean square error between the label value and the predicted value, and the initial deep learning model is trained according to the model loss to obtain the power consumption prediction model.

7. A power consumption prediction device combining wavelet transform and LSTM, characterized in that: include: A determination unit, configured to determine a target time period for which power consumption needs to be predicted, and to determine a plurality of reference time periods before the target time period from a plurality of time periods included in a preset historical cycle; An obtaining unit, used to obtain the power consumption characteristics of the target time period and each reference time period, wherein the power consumption characteristics of each time period include reference power consumption at multiple time scales and multiple time intervals before the time period, and the reference power consumption is obtained by wavelet transforming the original power consumption of each time period contained in the historical cycle; A processing unit is used to process the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to a pre-constructed power consumption prediction model to obtain the predicted power consumption of the target time period, wherein the power consumption prediction model is a deep learning model based on a long short-term memory network.

8. The device according to claim 7, characterized in that When the obtaining unit obtains the original power consumption of each time period contained in the historical cycle and processes it through wavelet transform to obtain the reference power consumption, it is used to: Cleaning the data of the original electricity consumption in each time period contained in the historical period; Performing wavelet transformation on the power consumption of each time period contained in the historical period after data cleaning to obtain reference power consumption of each time period contained in the historical period; Wherein, when the obtaining unit performs data cleaning on the original power consumption of each time period contained in the historical period, it is used to: Filter out the first time period in the historical period where the original power consumption is missing, and fill the missing value of the first time period according to the original power consumption of multiple time periods with the same timestamp before and after the first time period; A second time period in which the corresponding original power consumption meets the abnormal condition is screened out, and according to the original power consumption of multiple time periods with the same timestamp before and after the second time period, the original power consumption of the second time period is replaced with an abnormal value based on a spline interpolation device.

9. The device according to claim 7, characterized in that When the obtaining unit obtains the power consumption characteristics of any reference time period, it is used to: Select a time period that is one week apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period; Select a time period that is 24 hours apart from the reference time period and has the same timestamp as the reference time period, and add the reference power consumption of the selected time period to the power consumption characteristics of the reference time period; Determine a first interval between 2 hours and 24 hours from the reference time period, accumulate the reference power consumption per hour in the first interval in units of hours, and add the sum of the reference power consumption per hour to the power consumption characteristics of the reference time period; A second interval that is within 2 hours of the reference time period is determined, and the reference power consumption of each time period in the second interval is added to the power consumption characteristics of the reference time period.

10. The device according to claim 7, characterized in that When the processing unit processes the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period according to the pre-built power consumption prediction model to obtain the predicted power consumption of the target time period, it is used to: Standardizing the power consumption characteristics of the target time period and the power consumption characteristics of each reference time period to obtain standard characteristics of the target time period and standard characteristics of each reference time period; Processing the standard features of the target time period and the standard features of each reference time period according to a pre-built power consumption prediction model to obtain a standard prediction value for the target time period; The standard prediction value is de-normalized to obtain the predicted power consumption in the target time period.

Citation Information

Patent Citations

  • Method and device for predicting electricity consumption, electronic device and computer readable medium

    CN110210672A

  • Electricity consumption prediction method and system

    CN111709588A

  • Roof photovoltaic power generation power cooperative control method and system

    CN115333100A

  • User electricity consumption prediction method and system

    CN116777049A