Electricity consumption prediction method and device, electronic equipment and storage medium
By using the power consumption prediction method based on the iTransformer model, the problem of insufficient accuracy of power consumption prediction in the prior art is solved, and higher prediction accuracy and stability are achieved, and it is suitable for power systems facing complex power consumption patterns and changing trends.
Patent Information
- Application Number
- CN202411797316.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, the power consumption prediction results are not accurate enough, and it is difficult to capture nonlinear relationships and non-stationary load fluctuations.
The power consumption prediction model is adopted based on the iTransformer model architecture. By pre-processing the historical power consumption sequence and predicting the sub-sequence in the neural network architecture, the future power consumption prediction results are integrated and calculated, and the results are corrected through the correction module.
It improves the accuracy and stability of power consumption prediction, can capture complex load fluctuations and seasonal changes more accurately, and provides more accurate prediction results.
Smart Images

Figure CN119886406A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device and storage medium for predicting power consumption. Background Art
[0002] Electricity consumption forecasting is an important part of power system operation and planning. On the one hand, with population growth, economic development and technological progress, electricity demand continues to grow. In order to meet the growing electricity demand, the power system needs to make accurate load forecasts in order to rationally plan and dispatch power resources. On the other hand, the operation of the power market requires accurate load forecasts. Power market participants need to formulate power purchase plans, pricing strategies and risk management strategies based on load forecasts to achieve economic benefits and market balance. Therefore, accurate load forecasts can help power system operators optimize resource scheduling, help improve market efficiency, reduce costs, ensure supply and demand balance and promote sustainable development.
[0003] With the accumulation of massive data in the power grid and the continuous development of big data technology, more and more artificial intelligence algorithms are applied to electricity consumption forecasting. The existing methods for electricity consumption forecasting also use artificial intelligence algorithms for forecasting. Existing technologies usually use traditional statistical models for forecasting, such as linear regression models and moving average models. This type of model algorithm can use historical electricity consumption series and related variables (such as weather data, holidays, etc.) to establish a linear regression model for forecasting. The advantage of this model algorithm is that it is simple and easy to implement, and is suitable for short-term stable load data forecasting, but the disadvantage is that it cannot capture nonlinear relationships and non-stationary load fluctuations. Although electricity consumption data has periodic fluctuations, it is a non-stationary series as a whole, which is exactly the nonlinear characteristics in the series that traditional statistical models cannot capture. Therefore, the forecast results output by the existing electricity consumption forecasting method are not accurate enough. Summary of the invention
[0004] The present invention provides a method, device, electronic device and storage medium for predicting power consumption, which are used to solve the problem that power consumption prediction results in the prior art are not accurate enough.
[0005] In a first aspect, the present invention provides a method for predicting power consumption, comprising: Obtain the historical social electricity consumption series in the target area; Based on the historical electricity consumption sequence, the electricity consumption prediction model is trained to obtain the social electricity consumption prediction result in the future period; the electricity consumption prediction model is built based on the iTransformer model architecture; The social electricity consumption forecast result is corrected to obtain a corrected social electricity consumption forecast result.
[0006] In one embodiment, the power consumption prediction model is trained based on the historical power consumption sequence to obtain the social power consumption prediction result for a period of time in the future, including: Performing data preprocessing on the historical power consumption sequence to obtain a target input sequence; The target input sequence is input into the electricity consumption prediction model to obtain the social electricity consumption prediction result for a period of time in the future output by the electricity consumption prediction model.
[0007] In one embodiment, the step of inputting the target input sequence into the power consumption prediction model to obtain the social power consumption prediction result for a period of time in the future outputted by the power consumption prediction model includes: inputting the target input sequence into a power consumption prediction model; Splitting the target input sequence into multiple unrelated subsequences using the electricity consumption prediction model; Inputting each of the subsequences into a neural network framework for prediction through the power consumption prediction model, and obtaining a local prediction result of each of the subsequences output by the neural network framework; The local prediction results are integrated and calculated through the electricity consumption prediction model to output the social electricity consumption prediction result in the future period.
[0008] In one embodiment, the step of correcting the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result includes: Obtain the forecast data of the lowest temperature in the target area within the future period; According to the minimum temperature forecast data, the forecast result of the residents' heating electricity consumption in the future period is calculated by a first regression formula; the first regression formula is used to fit the relationship between the minimum temperature and the residents' heating electricity consumption; According to the predicted result of the residents' heating electricity consumption, the predicted result of the social electricity consumption is corrected to obtain a corrected predicted result of the social electricity consumption.
[0009] In one embodiment, the first regression formula is obtained by: Obtaining historical predicted electricity consumption data of the target area within a historical time period and its corresponding historical actual electricity consumption data; According to the lowest temperature in the historical time period, determining the abnormal fluctuation range caused by the lowest temperature between the historical predicted power consumption data and the historical actual power consumption data; Determine the historical real electricity consumption data before the abnormal fluctuation range as the benchmark data; The historical real electricity consumption data at each time point in the abnormal fluctuation range is calculated by difference with the benchmark data to obtain the heating electricity consumption of residents at each time point; Regression analysis was used to fit the relationship between the minimum temperature and residents' heating electricity consumption, and the first regression formula was generated.
[0010] In one embodiment, the step of correcting the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result further includes: Get the holiday dates within the future period; According to the holiday date, a local prediction result of social electricity consumption during the holiday period in the future is calculated by a second regression formula; the second regression formula is used to fit the relationship between holidays and social electricity consumption; According to the local prediction result of social electricity consumption, the prediction result of social electricity consumption is corrected to obtain a corrected prediction result of social electricity consumption.
[0011] In one embodiment, the second regression formula is obtained by: Obtaining historical social electricity consumption data of the target area within a historical time period including holidays; Analyze the fluctuation pattern of the historical social electricity consumption data before and after the holidays; Regression analysis is used to fit the relationship between holidays and social electricity consumption, and a second regression formula is generated.
[0012] In a second aspect, the present invention further provides a power consumption prediction device, comprising: An acquisition module is used to obtain the historical social electricity consumption sequence in the target area; A social electricity consumption prediction module is used to obtain social electricity consumption prediction results for a period of time in the future by training an electricity consumption prediction model based on the historical electricity consumption sequence; the electricity consumption prediction model is built based on the iTransformer model architecture; The correction module is used to correct the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result.
[0013] In a third aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned power consumption prediction methods are implemented.
[0014] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above-mentioned power consumption prediction methods are implemented.
[0015] The electricity consumption prediction method, device, electronic device and storage medium provided by the present invention obtain the historical social electricity consumption sequence of the target area and train it using the electricity consumption prediction model built based on the iTransformer model. Since the model has powerful nonlinear modeling capabilities, it can effectively capture the non-stationary characteristics in the historical electricity consumption sequence, such as complex load fluctuations and seasonality, so as to accurately predict the social electricity consumption in the future period of time. Then, by correcting the prediction results, the accuracy and stability of the prediction are further improved, so that the model can provide more accurate prediction results when facing complex electricity consumption patterns and changing trends. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flow chart of the power consumption prediction method provided by the present invention.
[0018] Figure 2 It is a schematic diagram of the fluctuation of total social electricity consumption in a provincial area provided by the present invention.
[0019] Figure 3 It is a schematic diagram of the overall structure of iTransformer provided by the present invention.
[0020] Figure 4 This is a graph showing the forecast results of total social electricity consumption in provincial areas provided by the present invention.
[0021] Figure 5 This is a comparison chart of the lowest temperatures in December provided by the present invention.
[0022] Figure 6 This is a comparison chart of electricity consumption of urban and rural residents in December provided by the present invention.
[0023] Figure 7 This is a display diagram of the model prediction results after temperature correction provided by the present invention.
[0024] Figure 8 It is a fitting curve diagram of the minimum temperature and the electricity consumption of residents for heating provided by the present invention.
[0025] Fig. 9 It is a schematic diagram of the fluctuation of electricity consumption in provincial areas around holidays provided by the present invention.
[0026] Fig.10 This is a graph showing the forecast results of the total electricity consumption during holidays provided by the present invention.
[0027] Fig.11 It is a fitting curve diagram of holidays and social electricity consumption provided by the present invention.
[0028] Fig.12 It is a structural schematic diagram of the power consumption prediction device provided by the present invention.
[0029] Fig.13 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein.
[0032] Combine the following Figure 1-Figure 13 The present invention describes a method, device, electronic device and storage medium for predicting power consumption.
[0033] It should be noted that the power consumption prediction method provided in the embodiment of the present invention is implemented based on the power consumption prediction device. The embodiment of the present invention takes the power consumption prediction device as an example to describe the power consumption prediction method.
[0034] Combination Figure 1 , Figure 1 It is a flow chart of the power consumption prediction method provided by the present invention.
[0035] like Figure 1 As shown, the method includes the following: Step 101, obtaining the historical social electricity consumption sequence in the target area; Step 102: Based on the historical electricity consumption sequence, a power consumption prediction model is trained to obtain a social electricity consumption prediction result for a period of time in the future; Step 103: correct the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result.
[0036] Specifically, the historical social electricity consumption sequence of the target area in the past period of time can be obtained from multiple data sources such as the power system or the power statistics bureau. Among them, the target area can be a provincial area or a prefecture-level city area, of course, it is not limited to this. The embodiment of the present invention uses the provincial area for subsequent examples. The historical social electricity consumption sequence in the target area is actually the social electricity consumption in the historical time series. The social electricity consumption includes not only the electricity consumption of residents' lives, but also the electricity consumption in all fields such as industry, commerce, agriculture, and public services. By predicting the social electricity consumption in a certain area, it can help the power system operator optimize the power resource scheduling in this area.
[0037] It should be noted that if Figure 2 As shown, Figure 2 It is a schematic diagram of the fluctuation of the total social electricity consumption in the provincial region provided by the present invention. Taking the total social electricity consumption of provincial region A in 2023 as an example, the electricity consumption data has a periodic fluctuation law, but it is a non-stationary sequence as a whole. Traditional models used for prediction include statistical models, time series models and machine learning models.
[0038] Statistical models: such as linear regression models and moving average models. This type of method uses historical load data and related variables (such as weather data, holidays, etc.) to establish a linear regression model for prediction. The advantage is that it is simple and easy to implement and is suitable for short-term stable load data prediction. The disadvantage is that it cannot capture nonlinear relationships and non-stationary load fluctuations.
[0039] Time series model: The most commonly used time series model is the autoregressive integrated moving average model. Differential operation is introduced on the basis of the autoregressive integrated moving average model to process non-stationary time series data. The advantage is that it is suitable for non-stationary linear load data and can capture long-term trends. The disadvantage is that it has limited effect on data with complex seasonality and nonlinear trends.
[0040] Machine learning models: including classification and regression models such as support vector machines (SVM). This type of model maps the input space to a high-dimensional feature space by constructing a nonlinear mapping function, and uses support vectors for classification or regression prediction. The advantage is that it can handle nonlinear relationships and high-dimensional data, and is suitable for medium- and long-term predictions. The disadvantage is that it takes a long time to train large-scale data and is more sensitive to the factors of the input model.
[0041] The above three traditional prediction models are all difficult to capture the non-stationary characteristics of social electricity consumption in the embodiment of the present invention. To address this problem, a neural network model is introduced to realize social electricity consumption prediction.
[0042] A neural network is a computational model that mimics the structure and function of the human brain's nervous system. It consists of many basic units called neurons, which transmit and process information through connections. Neural networks can be applied to a variety of tasks, such as image classification, text generation, speech recognition, natural language processing, future data prediction, etc. The neural network model has strong nonlinear modeling capabilities and can handle complex load fluctuations and seasonality. Its flexibility and strong nonlinear modeling capabilities make neural networks perform well in handling complex data relationships and pattern recognition tasks. As data accumulates, the fitting effect of the neural network will become better and better, so it can also have good application results on electricity consumption data.
[0043] A horizontal comparison was made between iTransformer, TimesNet, Informer and other neural network algorithms, and the error rate, time complexity, and number of input parameters of each algorithm were comprehensively compared. Finally, iTransformer was selected as the neural network algorithm of the embodiment of the present invention.
[0044] Therefore, a power consumption prediction model is built based on the iTransformer model architecture and pre-trained so that the power consumption prediction model can learn the characteristics of the input sequence to accurately predict future data.
[0045] First, the historical social electricity consumption sequence in the target area is preprocessed to obtain the target input sequence after data preprocessing, that is, the input sequence is converted into a format that is easy for the model to understand and analyze.
[0046] Furthermore, the target input sequence that is easy to process is input into the electricity consumption prediction model constructed by the iTransformer model architecture, and the electricity consumption prediction model is used to analyze and process the sequence, and output the social electricity consumption prediction results for a period of time in the future.
[0047] Although the electricity consumption model can extract the global characteristics of the time series, capture the overall trend and change pattern in the data, and predict the future time series from the trend change. However, in reality, social environmental factors will have a certain impact on social electricity consumption, causing abnormal fluctuations in electricity consumption. At this time, there may be a large prediction error, which needs to be corrected. The result correction can be achieved through statistical means. From the perspective of electricity consumption behavior habits, the social environmental factors that cause abnormal fluctuations in electricity consumption are mainly weather and temperature factors and holiday factors. When the weather temperature is low, residents need to adopt certain heating measures, which will increase a lot of electricity consumption. When holidays are on holiday, most industrial factories stop using equipment, which will greatly reduce electricity consumption.
[0048] Therefore, it can be understood that the social electricity consumption forecast result is corrected according to weather temperature factors and / or holiday factors to obtain a corrected social electricity consumption forecast result.
[0049] The electricity consumption prediction method provided by the present invention obtains the historical social electricity consumption sequence of the target area and trains it using the electricity consumption prediction model built based on the iTransformer model. Since the model has powerful nonlinear modeling capabilities, it can effectively capture the non-stationary characteristics in the historical electricity consumption sequence, such as complex load fluctuations and seasonality, so as to accurately predict the social electricity consumption in the future period of time. Then, by correcting the prediction results, the accuracy and stability of the prediction are further improved, so that the model can provide more accurate prediction results when facing complex electricity consumption patterns and changing trends.
[0050] In some embodiments, based on step 102, the power consumption prediction model is trained based on the historical power consumption sequence to obtain a social power consumption prediction result for a period of time in the future, including: Performing data preprocessing on the historical power consumption sequence to obtain a target input sequence; The target input sequence is input into the electricity consumption prediction model to obtain the social electricity consumption prediction result for a period of time in the future output by the electricity consumption prediction model.
[0051] Specifically, the historical electricity consumption sequence is preprocessed to obtain the target input sequence. Generally, the data preprocessing process includes data cleaning (such as removing outliers and filling missing values), data standardization / normalization (such as scaling the data to a fixed range), data feature process (such as extracting time features such as periodic features and trend features), etc. The data preprocessing method is now very mature, and you can set which preprocessing methods need to be executed according to the actual situation.
[0052] Furthermore, the target input sequence is input into the electricity consumption prediction model to obtain the social electricity consumption prediction result for a period of time in the future output by the electricity consumption prediction model.
[0053] The embodiment of the present invention can ensure the quality of the input sequence by performing data preprocessing on the historical social electricity consumption sequence, making the input data more suitable for model learning, thereby more effectively capturing the trends and patterns of electricity consumption, improving the model analysis efficiency and prediction accuracy, and providing reliable data support for model prediction.
[0054] According to the above content, the target input sequence is input into the power consumption prediction model to obtain the social power consumption prediction result for a period of time in the future output by the power consumption prediction model, including: inputting the target input sequence into a power consumption prediction model; Splitting the target input sequence into multiple unrelated subsequences using the electricity consumption prediction model; Inputting each of the subsequences into a neural network framework for prediction through the power consumption prediction model, and obtaining a local prediction result of each of the subsequences output by the neural network framework; The local prediction results are integrated and calculated through the electricity consumption prediction model to output the social electricity consumption prediction result in the future period.
[0055] The embodiment of the present invention adopts the architecture of the iTransformer model to construct the power consumption prediction model. The iTransformer model is first introduced below.
[0056] iTransformer is a sequence transformation model based on the self-attention mechanism, which combines the ideas of the traditional Transformer model and the independent recurrent neural network IndRNN (Independently Recurrent Neural Network) model.
[0057] Combination Figure 3 , Figure 3 : is a schematic diagram of the overall structure of iTransformer provided by the present invention. iTransformer follows the same modular arrangement as the Transformer encoder. (a) The original sequences of different variables are embedded as tags independently. (b) Self-attention is applied to these embedded variable tags to enhance interpretability and reveal correlations between multiple variables. (c) A feedforward network activates and reshapes the sequence representation of each tag. (d) Layer normalization is used to reduce the differences between variables.
[0058] iTransformer consists of an embedding layer, a Transformer block, and a projection layer.
[0059] Embedding layer: First, the input sequence is embedded as tokens independently. This is like an extreme case of patching, where the model does not tokenize a subsequence of the input, but the entire input sequence.
[0060] Transformer blocks: Transformer blocks mainly contain three small components, namely: multivariate attention, feedforward neural network (FFN) and normalization (layerNorm). 1. Multivariate attention: When the sequence embedding is sent to the attention layer, it will learn the correlation between multivariate variables. The INVERTED model treats each feature as an independent process. Therefore, the attention mechanism can learn the correlation between feature pairs, making iTransformer particularly suitable for multivariate prediction tasks. The attention module uses linear mapping to obtain the query Query, key Key and value Value. Each time series token is standardized in its feature dimension. The attention score can show the correlation of multivariate variables to a certain extent. Highly correlated variables will receive greater weights. 2. Normalization: Layer normalization is to increase the convergence and training stability of deep networks. In the INVERTED model framework, standardization is applied to the sequence representation of individual variables. In addition, since all series are standardized to Gaussian distribution as (variable) labels, the differences caused by inconsistent measurements can be reduced. Normalization is done across timestamps. It helps the model handle non-stationary sequences and reduce noise in the sequence. 3. Feedforward Neural Network: The feedforward network (FFN) learns the deep representation of the incoming token. Similarly, because the shape is inverted, the multilayer perceptron (MLP) can learn different temporal properties, such as periodicity and amplitude. FFN contains 2 linear layers, and the activation function in the middle is ReLu. The addition of FFN introduces nonlinearity (ReLu activation function), transforms the space of the attention output, and thus increases the expressiveness of the model.
[0061] Projection layer: From here, it is just a matter of stacking many blocks consisting of attention layers, layer normalization, feed-forward networks, layer normalization, each block learns a different representation of the input sequence. The output is then linearly projected to obtain the final prediction.
[0062] According to the above introduction to the overall structure of iTransformer, the iTransformer algorithm can split ordinary sequences into unrelated sequences as much as possible, and then input the split sequences into the neural network architecture for prediction, and finally comprehensively calculate the prediction results of each sequence to output the final prediction result of the model.
[0063] Specifically, the target input sequence is input into the electricity consumption prediction model.
[0064] Furthermore, the target input sequence is split into multiple unrelated subsequences through the electricity consumption prediction model.
[0065] Furthermore, each subsequence is input into the neural network architecture for prediction through the electricity consumption prediction model, and the local prediction results of each subsequence output by the neural network architecture are obtained.
[0066] Furthermore, the local prediction results are integrated and calculated through the electricity consumption prediction model to output the social electricity consumption prediction results for a period of time in the future.
[0067] Compared with other neural network algorithms, iTransformer has the following advantages: 1. It can better capture the long-term dependencies in the sequence data, so that the model can perform better when processing sequence tasks with long-distance temporal dependencies such as electricity consumption, and enable the model to more accurately capture long-term patterns such as trends, periodicity and seasonality in the data when processing electricity data.
[0068] 2. The self-attention mechanism allows the model to adaptively focus on the correlation between different time steps when processing power time series data. This is very important for the changing patterns of different time periods in power data. The model can autonomously learn the important time steps related to the prediction target and build a suitable model accordingly.
[0069] 3. The parallel computing characteristics of the self-attention mechanism enable iTransformer to have efficient computing capabilities when processing large-scale power time series data. This can speed up the training and inference of the model, making data analysis and prediction tasks more real-time and efficient.
[0070] 4. Through the average pooling layer, iTransformer can extract the global features of the sequence, which helps to capture the overall trend and change pattern in the data. Assuming that there are individual missing values or outliers in the electricity consumption sequence, it will not affect the model results.
[0071] 5. iTransformer has an encoder-decoder structure that can be easily extended and modified. This allows the model to be adjusted as needed in practical applications, adding additional layers or adjusting hyperparameters to suit specific power time series forecasting tasks.
[0072] In one embodiment, when the electricity consumption model is pre-trained, 1824 data are divided into a training set, a validation set, and a test set in proportion. The model output results of the test set are compared with the actual results, and the mean absolute percentage error (MAPE) is used as the model error rate. The specific calculation formula is as follows: Among them, y is the true value, is the predicted value, and n is the sample size of the test set.
[0073] After calculating the error rate of the test set data under various parameters, the key optimal hyperparameters of the input model are as follows: features=M, indicating multiple regression; seq_len=365, which means using the data of the last 365 days to predict future data; label_len=7, which means increasing the weight of the data from the last 7 days; pred_len=1, indicating that the output prediction sequence length is 1 day; enc_in=7, dec_in=7, c_out=7, indicating that the number of sequences to be predicted is 7; d_model=256, d_ff=128, indicating the key parameters of the neural network; train_epochs=200, indicating the maximum number of model iterations; Combining real data with forecast data, the average error rate of the model in the past 18 days is 2.59%. From the trend of change, the forecast results of the electricity consumption forecast model built by the iTransformer model architecture are almost consistent with the real results.
[0074] The embodiment of the present invention uses the electricity consumption prediction model to effectively split and parallelize the target input sequence, uses the neural network architecture to accurately predict the subsequences, and finally obtains the social electricity consumption prediction results for a period of time in the future through integrated calculation. This not only improves the accuracy and efficiency of the prediction, but also enhances the model's ability to process complex data sequences.
[0075] In some embodiments, based on step 103, the social power consumption forecast result is corrected to obtain a corrected social power consumption forecast result, including: Obtain the forecast data of the lowest temperature in the target area within the future period; According to the minimum temperature forecast data, the forecast result of the residents' heating electricity consumption in the future period is calculated by a first regression formula; the first regression formula is used to fit the relationship between the minimum temperature and the residents' heating electricity consumption; According to the predicted result of the residents' heating electricity consumption, the predicted result of the social electricity consumption is corrected to obtain a corrected predicted result of the social electricity consumption.
[0076] Combination Figure 4-Figure 7 , Figure 4 This is a graph showing the forecast results of the total social electricity consumption in the provincial region provided by the present invention. Figure 5 This is a comparison chart of the lowest temperatures in December provided by the present invention. Figure 6 This is a comparison chart of urban and rural residents' electricity consumption in December provided by the present invention. Figure 7 This is a display diagram of the model prediction results after temperature correction provided by the present invention.
[0077] Figure 4 Taking the total electricity consumption of provincial region A in December 2023 as an example, the uncorrected model prediction results are as follows: Figure 4 As shown in Figure 2, the temperature fluctuations between December 2022 and December 2023 are as follows: Figure 5 shown.
[0078] from Figure 4 It can be seen that the fluctuation trend of the uncorrected model prediction results within the natural week is basically consistent with the actual data. However, when the weather and temperature factors have a greater impact and cause abnormal fluctuations in electricity consumption, the model cannot predict this part of the abnormal fluctuations. Figure 5 , Figure 6 It can be seen that starting from December 19, 2023, the temperature has dropped significantly compared with last year, and residents have adopted various heating methods that require electricity, resulting in a significant increase in residents' electricity consumption.
[0079] Therefore, it is necessary to correct some of the forecast results with abnormal fluctuations. A regression formula that fits the relationship between the minimum temperature and the heating electricity consumption of residents can be constructed. A comprehensive judgment and calculation is performed based on the weather forecast data. The calculated heating electricity consumption is added to the electricity consumption forecast result to achieve temperature correction. The final forecast result after adding the temperature correction is as follows: Figure 7 shown.
[0080] Specifically, since the first regression formula is used to fit the relationship between the minimum temperature and the residents' heating electricity consumption, the minimum temperature forecast data of the target area in the future period can be obtained, and the residents' heating electricity consumption forecast results in the future period can be predicted by the first regression formula.
[0081] Furthermore, the predicted data of the lowest temperature in the future period is substituted into the first regression formula for calculation to obtain the predicted results of the residents' heating electricity consumption in the future period.
[0082] Furthermore, based on the prediction results of residents' heating electricity consumption, the abnormal fluctuation range caused by the minimum temperature in the prediction results of social electricity consumption is corrected to obtain the corrected prediction results of social electricity consumption.
[0083] The embodiment of the present invention takes into account that weather temperature will cause an increase in residents' heating electricity consumption, resulting in large fluctuations in the overall social electricity consumption. The first regression formula is used to predict the residents' heating electricity consumption in the future. The social electricity consumption prediction result output by the original model is corrected based on the formula, thereby providing a more accurate prediction result.
[0084] According to the above content, the first regression formula is obtained by the following method: Obtaining historical predicted electricity consumption data of the target area within a historical time period and its corresponding historical actual electricity consumption data; According to the lowest temperature in the historical time period, determining the abnormal fluctuation range caused by the lowest temperature between the historical predicted power consumption data and the historical actual power consumption data; Determine the historical real electricity consumption data before the abnormal fluctuation range as the benchmark data; The historical real electricity consumption data at each time point in the abnormal fluctuation range is calculated by difference with the benchmark data to obtain the heating electricity consumption of residents at each time point; Regression analysis was used to fit the relationship between the minimum temperature and residents' heating electricity consumption, and the first regression formula was generated.
[0085] Specifically, the historical predicted electricity consumption data of the target area in the historical time period and its corresponding historical actual electricity consumption data are obtained, and according to the lowest temperature in the historical time period, the abnormal fluctuation range caused by the lowest temperature between the historical predicted electricity consumption data and the historical actual electricity consumption data is determined.
[0086] Furthermore, the historical real electricity consumption data before the abnormal fluctuation interval is determined as the benchmark data, and the difference between the benchmark data and the data within the abnormal fluctuation interval can be considered as the residents' heating electricity consumption. Therefore, the historical real electricity consumption data at each time point in the abnormal fluctuation interval is differentially calculated with the benchmark data to obtain the residents' heating electricity consumption at each time point.
[0087] Furthermore, regression analysis was used to fit the relationship between the minimum temperature and residents’ heating electricity consumption to generate the first regression formula.
[0088] In one embodiment, in combination Figure 8 , Figure 8 This is a fitting curve diagram of the minimum temperature and the heating power consumption of residents provided by the present invention. Figure 8 It can be seen that when the minimum temperature is lower than 10℃, the minimum temperature is negatively correlated with the electricity consumption for heating. The R-square of the fitting curve is 0.94, indicating that the regression formula has a good fitting effect.
[0089] The embodiment of the present invention analyzes historical predictions and actual electricity consumption data, combines the influence of the minimum temperature, identifies the abnormal fluctuation range caused by the temperature, and then calculates the residents' heating electricity consumption, and uses regression analysis to establish the relationship between the minimum temperature and heating electricity consumption. The generated first regression formula can effectively predict the residents' heating electricity consumption in the future period of time, provide effective data support for the correction model prediction results, thereby improving the accuracy of electricity consumption prediction.
[0090] In some embodiments, based on step 103, the social power consumption forecast result is corrected to obtain a corrected social power consumption forecast result, further comprising: Get the holiday dates within the future period; According to the holiday date, a local prediction result of social electricity consumption during the holiday period in the future is calculated by a second regression formula; the second regression formula is used to fit the relationship between holidays and social electricity consumption; According to the local prediction result of social electricity consumption, the prediction result of social electricity consumption is corrected to obtain a corrected prediction result of social electricity consumption.
[0091] Combination Figure 9-10 , Fig. 9 It is a schematic diagram of the fluctuation of electricity consumption in provincial areas around holidays provided by the present invention. Fig.10 This is a graph showing the forecast results of the total electricity consumption during holidays provided by the present invention.
[0092] Depend on Fig. 9 As shown in the figure, taking the fluctuation of electricity consumption around the Spring Festival holiday from 2019 to 2023 as an example, the fluctuation trend in 2020 is significantly different from that in other years due to special environmental factors, the extension of the Spring Festival holiday, and the delay in the resumption of work in factories. Therefore, except for 2020, the fluctuation patterns in other years are basically the same. During the Spring Festival holiday, since factories are not in operation, many equipment do not need electricity, resulting in a significant reduction in equipment electricity consumption.
[0093] Therefore, it is necessary to correct some of the forecast results during holidays. A regression formula that fits the relationship between holidays and social electricity consumption can be constructed. The electricity consumption during holidays in the future can be calculated through the regression formula. The forecast results can be as follows: Fig.10As shown, the predicted holiday electricity consumption is added to the electricity consumption forecast result to achieve holiday correction.
[0094] Specifically, since the second regression formula is used to fit the relationship between holidays and social electricity consumption, the holiday dates in the future can be obtained, and the local prediction results of social electricity consumption during the holidays in the future can be predicted by the second regression formula.
[0095] Furthermore, the holiday dates are substituted into the second regression formula for calculation to obtain the local prediction results of social electricity consumption during the holidays in the future.
[0096] Furthermore, according to the local forecast results of social electricity consumption, the forecast results of social electricity consumption are corrected during holidays to obtain the corrected forecast results of social electricity consumption.
[0097] The embodiment of the present invention takes into account the large fluctuations in electricity consumption during holidays, and predicts the local prediction results of social electricity consumption during holidays in the future through the second regression formula. The social electricity consumption prediction results output by the original model are corrected based on the formula, so as to provide more accurate prediction results.
[0098] According to the above content, the second regression formula is obtained by the following method: Obtaining historical social electricity consumption data of the target area within a historical time period including holidays; Analyze the fluctuation pattern of the historical social electricity consumption data before and after the holidays; Regression analysis is used to fit the relationship between holidays and social electricity consumption, and a second regression formula is generated.
[0099] Specifically, the historical social electricity consumption data of the target area in the historical time period including holidays is obtained.
[0100] Furthermore, the fluctuation patterns of historical social electricity consumption data before and after the holidays are analyzed, specifically, the changes in electricity consumption before, during and after the holidays are analyzed to identify the upward or downward trend of electricity consumption.
[0101] Furthermore, regression analysis is used to fit the relationship between holidays and social electricity consumption to generate a second regression formula.
[0102] In one embodiment, in combination Fig.11 , Fig.11 This is a fitting curve diagram of holidays and social electricity consumption provided by the present invention. Fig.11 It can be seen that the R-square of the regression curve is 0.99, indicating that the regression formula has a strong fitting effect.
[0103] The embodiment of the present invention analyzes the fluctuation pattern of historical social electricity consumption data before and after the holidays, and uses regression analysis to establish the relationship between holidays and social electricity consumption. The generated second regression formula can effectively predict the local prediction results of social electricity consumption during holidays in the future period, provide effective data support for correcting the model prediction results, thereby improving the accuracy of electricity consumption prediction.
[0104] The power consumption prediction device provided by the present invention is described below. The power consumption prediction device described below and the power consumption prediction method described above can be referenced to each other.
[0105] Reference Fig.12 , Fig.12 It is a structural schematic diagram of the power consumption prediction device provided by the present invention.
[0106] The power consumption prediction device comprises: The acquisition module 1210 is used to acquire the historical social electricity consumption sequence in the target area.
[0107] The social electricity consumption prediction module 1220 is used to obtain the social electricity consumption prediction result in the future period based on the historical electricity consumption sequence through training of the electricity consumption prediction model; the electricity consumption prediction model is built based on the iTransformer model architecture.
[0108] The correction module 1230 is used to correct the social electricity consumption prediction result to obtain a corrected social electricity consumption prediction result.
[0109] The electricity consumption prediction device provided by the present invention obtains the historical social electricity consumption sequence of the target area and trains it using the electricity consumption prediction model built based on the iTransformer model. Since the model has powerful nonlinear modeling capabilities, it can effectively capture the non-stationary characteristics in the historical electricity consumption sequence, such as complex load fluctuations and seasonality, so as to accurately predict the social electricity consumption in the future period of time, and then further improve the accuracy and stability of the prediction by correcting the prediction results, so that the model can provide more accurate prediction results when facing complex electricity consumption patterns and changing trends.
[0110] Furthermore, the social electricity consumption prediction module 1220 is also used for: Performing data preprocessing on the historical power consumption sequence to obtain a target input sequence; The target input sequence is input into the electricity consumption prediction model to obtain the social electricity consumption prediction result for a period of time in the future output by the electricity consumption prediction model.
[0111] Furthermore, the social electricity consumption prediction module 1220 is also used for: inputting the target input sequence into a power consumption prediction model; Splitting the target input sequence into multiple unrelated subsequences using the electricity consumption prediction model; Inputting each of the subsequences into a neural network framework for prediction through the power consumption prediction model, and obtaining a local prediction result of each of the subsequences output by the neural network framework; The local prediction results are integrated and calculated through the electricity consumption prediction model to output the social electricity consumption prediction result in the future period.
[0112] Furthermore, the correction module 1230 is also used for: Obtain the forecast data of the lowest temperature in the target area within the future period; According to the minimum temperature forecast data, the forecast result of the residents' heating electricity consumption in the future period is calculated by a first regression formula; the first regression formula is used to fit the relationship between the minimum temperature and the residents' heating electricity consumption; According to the predicted result of the residents' heating electricity consumption, the predicted result of the social electricity consumption is corrected to obtain a corrected predicted result of the social electricity consumption.
[0113] Furthermore, the power consumption prediction device is also used for: Obtaining historical predicted electricity consumption data of the target area within a historical time period and its corresponding historical actual electricity consumption data; According to the lowest temperature in the historical time period, determining the abnormal fluctuation range caused by the lowest temperature between the historical predicted power consumption data and the historical actual power consumption data; Determine the historical real electricity consumption data before the abnormal fluctuation range as the benchmark data; The historical real electricity consumption data at each time point in the abnormal fluctuation range is calculated by difference with the benchmark data to obtain the heating electricity consumption of residents at each time point; Regression analysis was used to fit the relationship between the minimum temperature and residents' heating electricity consumption, and the first regression formula was generated.
[0114] Furthermore, the correction module 1230 is also used for: Get the holiday dates within the future period; According to the holiday date, a local prediction result of social electricity consumption during the holiday period in the future is calculated by a second regression formula; the second regression formula is used to fit the relationship between holidays and social electricity consumption; According to the local prediction result of social electricity consumption, the prediction result of social electricity consumption is corrected to obtain a corrected prediction result of social electricity consumption.
[0115] Furthermore, the power consumption prediction device is also used for: Obtaining historical social electricity consumption data of the target area within a historical time period including holidays; Analyze the fluctuation pattern of the historical social electricity consumption data before and after the holidays; Regression analysis is used to fit the relationship between holidays and social electricity consumption, and a second regression formula is generated.
[0116] It should be noted that the power consumption prediction device provided by the present invention can execute the power consumption prediction method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0117] Fig.13 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Fig.13 As shown, the electronic device may include: a processor 1310, a communication interface 1320, a memory 1330 and a communication bus 1340, wherein the processor 1310, the communication interface 1320 and the memory 1330 communicate with each other through the communication bus 1340. The processor 1310 may call the logic instructions in the memory 1330 to execute the power consumption prediction method, which includes: obtaining the historical social power consumption sequence in the target area; based on the historical power consumption sequence, training through the power consumption prediction model to obtain the social power consumption prediction result in the future period; the power consumption prediction model is obtained based on the iTransformer model architecture; the social power consumption prediction result is corrected to obtain the corrected social power consumption prediction result.
[0118] In addition, the logic instructions in the above-mentioned memory 1330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0119] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the electricity consumption prediction method provided by the above-mentioned embodiments, and the method includes: obtaining a historical social electricity consumption sequence in a target area; based on the historical electricity consumption sequence, training a power consumption prediction model to obtain a social electricity consumption prediction result for a period of time in the future; the power consumption prediction model is obtained based on the iTransformer model architecture; and the social electricity consumption prediction result is corrected to obtain a corrected social electricity consumption prediction result.
[0120] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the electricity consumption prediction method provided in the above-mentioned embodiments, the method comprising: obtaining a historical social electricity consumption sequence in a target area; based on the historical electricity consumption sequence, training a power consumption prediction model to obtain a social electricity consumption prediction result for a period of time in the future; the power consumption prediction model is obtained based on the iTransformer model architecture; and the social electricity consumption prediction result is corrected to obtain a corrected social electricity consumption prediction result.
[0121] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0122] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for predicting power consumption, characterized in that: include: Obtain the historical social electricity consumption series in the target area; Based on the historical electricity consumption sequence, the electricity consumption prediction model is trained to obtain the social electricity consumption prediction result in the future period; the electricity consumption prediction model is built based on the iTransformer model architecture; The social electricity consumption forecast result is corrected to obtain a corrected social electricity consumption forecast result.
2. The power consumption prediction method according to claim 1, characterized in that: The power consumption prediction model is trained based on the historical power consumption sequence to obtain the social power consumption prediction result in the future period, including: Performing data preprocessing on the historical power consumption sequence to obtain a target input sequence; The target input sequence is input into the electricity consumption prediction model to obtain the social electricity consumption prediction result for a period of time in the future output by the electricity consumption prediction model.
3. The power consumption prediction method according to claim 2, characterized in that: The step of inputting the target input sequence into the power consumption prediction model to obtain the social power consumption prediction result for a period of time in the future outputted by the power consumption prediction model includes: inputting the target input sequence into a power consumption prediction model; Splitting the target input sequence into multiple unrelated subsequences using the electricity consumption prediction model; Inputting each of the subsequences into a neural network framework for prediction through the power consumption prediction model, and obtaining a local prediction result of each of the subsequences output by the neural network framework; The local prediction results are integrated and calculated through the electricity consumption prediction model to output the social electricity consumption prediction result in the future period.
4. The power consumption prediction method according to claim 1, characterized in that: The step of correcting the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result includes: Obtain the forecast data of the lowest temperature in the target area within the future period; According to the minimum temperature forecast data, the forecast result of the residents' heating electricity consumption in the future period is calculated by a first regression formula; the first regression formula is used to fit the relationship between the minimum temperature and the residents' heating electricity consumption; According to the predicted result of the residents' heating electricity consumption, the predicted result of the social electricity consumption is corrected to obtain a corrected predicted result of the social electricity consumption.
5. The method for predicting power consumption according to claim 4, characterized in that: The first regression formula is obtained in the following way: Obtaining historical predicted electricity consumption data of the target area within a historical time period and its corresponding historical actual electricity consumption data; According to the lowest temperature in the historical time period, determining the abnormal fluctuation range caused by the lowest temperature between the historical predicted power consumption data and the historical actual power consumption data; Determine the historical real electricity consumption data before the abnormal fluctuation range as the benchmark data; The historical real electricity consumption data at each time point in the abnormal fluctuation range is calculated by difference with the benchmark data to obtain the heating electricity consumption of residents at each time point; Regression analysis was used to fit the relationship between the minimum temperature and residents' heating electricity consumption, and the first regression formula was generated.
6. The method for predicting power consumption according to claim 1, characterized in that: The step of correcting the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result further includes: Get the holiday dates within the future period; According to the holiday date, a local prediction result of social electricity consumption during the holiday period in the future is calculated by a second regression formula; the second regression formula is used to fit the relationship between holidays and social electricity consumption; According to the local prediction result of social electricity consumption, the prediction result of social electricity consumption is corrected to obtain a corrected prediction result of social electricity consumption.
7. The method for predicting power consumption according to claim 6, characterized in that: The second regression formula is obtained in the following way: Obtaining historical social electricity consumption data of the target area within a historical time period including holidays; Analyze the fluctuation pattern of the historical social electricity consumption data before and after the holidays; Regression analysis is used to fit the relationship between holidays and social electricity consumption, and a second regression formula is generated.
8. A power consumption prediction device, characterized in that: include: An acquisition module is used to obtain the historical social electricity consumption sequence in the target area; A social electricity consumption prediction module is used to obtain social electricity consumption prediction results for a period of time in the future by training an electricity consumption prediction model based on the historical electricity consumption sequence; the electricity consumption prediction model is built based on the iTransformer model architecture; The correction module is used to correct the social electricity consumption forecast result to obtain a corrected social electricity consumption forecast result.
9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the power consumption prediction method according to any one of claims 1 to 7 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the power consumption prediction method according to any one of claims 1 to 7 are implemented.