A power demand prediction method, apparatus, medium, and device
By acquiring historical power data, optimizing data using the mutual information method and the cosine similarity principle, and combining a two-layer structure model with a long short-term memory model, the problem of inaccurate short-term power demand forecasting in existing technologies is solved, accurate prediction of short-term power demand is achieved, and the dispatching efficiency and operational stability of the power system are improved.
Patent Information
- Application Number
- CN202411674251.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-11-21
AI Technical Summary
Existing technologies are unable to accurately predict short-term electricity demand, especially in special circumstances such as holidays and extreme weather, when electricity demand fluctuates violently. Existing methods ignore significant influencing factors such as real-time electricity prices and holiday types, and lack in-depth analysis and screening of input data.
By acquiring historical power data, optimizing the data using the mutual information method and the cosine similarity principle, and constructing a power demand forecasting index system, a two-layer structure model and a long short-term memory model are combined, and the improved particle swarm optimization algorithm is used to optimize the parameter weights to achieve accurate prediction of short-term power demand.
It improves the accuracy of short-term power demand forecasts and the dispatch efficiency of the power system, enhances operational stability, and provides more reliable data support.
Smart Images

Figure CN119599371B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power demand forecasting, and in particular to a power demand forecasting method, device, medium and equipment. Background Art
[0002] With the rapid development of the power market and the increasing demand for electricity, accurate forecasting of power demand is crucial for the stable operation of power systems and the optimal allocation of resources. Existing power demand forecasting methods primarily focus on long-term or medium-term trends in electricity consumption, while relatively little research has been conducted on short-term power demand forecasting. Short-term power demand forecasting is crucial for the real-time dispatch and operational management of power grids, especially during special circumstances such as holidays and extreme weather, when power demand fluctuates more dramatically and demands even higher forecast accuracy.
[0003] Existing electricity demand forecasting methods typically consider relatively limited factors, such as relying solely on historical electricity consumption data or simply incorporating meteorological factors. These methods often overlook factors that significantly impact electricity demand, such as real-time electricity prices and holiday types. Furthermore, existing methods are simplistic when processing forecast model samples and lack in-depth analysis and screening of input data, such as similar day analysis. These issues hinder the ability of existing technologies to accurately forecast short-term electricity demand. Summary of the Invention
[0004] The present invention provides a method, device, medium and equipment for predicting power demand, so as to solve the problem in the prior art that short-term power demand cannot be accurately predicted.
[0005] In a first aspect, the present application provides a method for predicting power demand, comprising:
[0006] Obtain historical power data and forecast days;
[0007] Optimizing the historical power data based on the mutual information method and the cosine similarity principle to obtain an indicator system for power demand forecasting;
[0008] Inputting historical power data into a preset first structural model so that the first structural model outputs an initial sample set for the day to be predicted of short-term power demand according to a preset relative error method;
[0009] Inputting the initial sample set into a preset second structural model, so that the second structural model outputs power data for the day to be predicted that meets the short-term power demand according to preset numerical similarity and shape similarity;
[0010] A first indicator system is selected based on the indicator system of the forecast day and the power demand forecast;
[0011] input the power data and the first index system into a long short-term memory model that has been trained, so that the long short-term memory model outputs power demand results of each period of the day to be predicted.
[0012] The application first obtains historical power data, optimizes the data by using the mutual information method and the cosine similarity principle, and thus obtains a power demand prediction index system. This step ensures that the selected index has a high correlation with the power demand, and provides a solid foundation for subsequent prediction. Then, combined with the historical power data and the preset double-layer structure model (including the first model and the second model), power data that meets the preset requirements is calculated, and this process further refines the data through a double-layer screening mechanism, thereby improving the prediction accuracy. Finally, the power data that meets the preset requirements and the index system are input into the long short-term memory model that has been trained, and the long short-term memory model can learn the long-term dependence relationship of the data, and output the power demand results of each period of the day to be predicted. Therefore, the application realizes accurate prediction of short-term power demand, improves the scheduling efficiency and operation stability of the power system, and solves the problem that the short-term power demand cannot be accurately predicted in the prior art.
[0013] As a preferred embodiment of the first aspect, the obtaining of the historical power data specifically comprises:
[0014] obtaining real-time electricity prices, meteorological factors, historical power demand and holiday types.
[0015] In this preferred embodiment, the application can comprehensively capture key factors affecting power demand by obtaining multi-dimensional historical power data such as real-time electricity prices, meteorological factors, historical power demand and holiday types. This comprehensive data collection provides a rich information base for subsequent data analysis and model training. Then, the mutual information method and the cosine similarity principle are used to optimize the data, which can filter out the most valuable indicators for prediction, and construct an index system for power demand prediction. This step ensures that the model can focus on the most influential factors, thereby improving the prediction accuracy.
[0016] As a preferred embodiment of the first aspect, the inputting of the historical power data into the preset first structure model, so that the first structure model outputs an initial sample set of the day to be predicted according to the preset relative error method, specifically comprises:
[0017] obtaining first historical power data;
[0018] constructing a power demand prediction correlation index matrix according to the first historical power data;
[0019] According to the preset relative error method, the power demand prediction correlation index matrix, and a preset sample correlation index matrix, a first structure model is constructed.
[0020] The historical power data is input into the first structure model, so that the first structure model outputs an initial sample set of the day to be predicted for short-term power demand.
[0021] In this preferred embodiment, the application first acquires first historical power data by inputting historical power data into a preset first structure model. These data contain key information that affects power demand. Then, the power demand prediction correlation index matrix is constructed using these data. This step enables the model to identify and quantify the impact of each factor on power demand. Then, according to the preset relative error method, the power demand prediction correlation index matrix, and the sample correlation index matrix, the first structure model is constructed. The design of this model aims to accurately evaluate and select similar historical samples to the day to be predicted by the relative error method. Finally, the historical power data is input into the first structure model, and the model outputs an initial sample set of the day to be predicted for short-term power demand. These sample sets are carefully selected and can represent the power demand characteristics of the day to be predicted. The application improves the accuracy and relevance of power demand prediction, provides high-quality input data for subsequent prediction models, and thus enhances the reliability and practicality of the entire prediction system.
[0022] As a preferred embodiment of the first aspect, the initial sample set is input into a preset second structure model, so that the second structure model outputs power data that meets the day to be predicted for short-term power demand according to a preset numerical similarity and shape similarity. Specifically:
[0023] The first historical power data and the initial sample set are obtained;
[0024] According to the preset numerical similarity and the first historical power data, a numerical difference matrix is calculated;
[0025] According to the preset shape similarity and the first historical power data, a slope difference matrix is calculated;
[0026] According to a preset proportion coefficient fusion method, the numerical difference matrix, and the slope difference matrix, a second structure model is constructed;
[0027] The initial sample set is input into the preset second structure model, so that the second structure model outputs power data that meets the day to be predicted for short-term power demand.
[0028] In this preferred embodiment, the present application inputs the initial sample set into a preset second structural model, and first calculates the numerical difference matrix based on the first historical power data. This step quantifies the numerical deviation between the day to be predicted and the historical data, and provides the model with a direct indicator for measuring changes in power demand. Next, the slope difference matrix is calculated. This step takes into account the trend and shape of changes in power demand, and supplements the information that the numerical difference matrix cannot cover. Then, using the preset proportional coefficient fusion method, the numerical difference matrix and the slope difference matrix are combined to construct a second structural model. This model combines the similarity of values and shapes, and can more comprehensively evaluate the similarity between the sample and the day to be predicted. Finally, the initial sample set is input into the second structural model, and the model outputs power data that matches the day to be predicted for short-term power demand. The present application improves the accuracy of power demand forecasting, ensures that the forecast results can more accurately reflect the changing trend of actual power demand, and thus provides more reliable data support for the scheduling and planning of the power system.
[0029] As a preferred embodiment of the first aspect, the power data that meets the preset requirements and the first indicator system are input into a trained long short-term memory model so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted, specifically:
[0030] The power data that meets the preset requirements and the first indicator system are input into a trained long short-term memory model, and the weights of the parameters of the long short-term memory model are optimized according to a preset improved particle swarm optimization algorithm, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted.
[0031] In this preferred embodiment, the present application inputs the power data and the first indicator system that meet the preset requirements into the trained long short-term memory (LSTM) model, and first uses the ability of the LSTM model to capture the long-term dependencies in the time series data, which is particularly important for predicting data with obvious time characteristics such as power demand. Then, the parameter weights of the LSTM network are optimized by the preset improved particle swarm optimization algorithm. This step further improves the prediction performance of the model, enabling the model to more accurately learn and simulate the changing laws of power demand. Ultimately, this method that combines time series analysis and parameter optimization enables the LSTM model to output the power demand results for each time period of the day to be predicted, thereby improving the accuracy and reliability of the prediction. The present application not only enhances the model's ability to process time series data, but also further improves the prediction accuracy through algorithm optimization, providing an efficient and accurate solution for power demand forecasting.
[0032] As a preferred embodiment of the first aspect, the weight of the parameter of the long short-term memory model is optimized according to a preset improved particle swarm optimization algorithm, specifically:
[0033] The improved particle swarm optimization algorithm is used to optimize the weight of the parameter of the long short-term memory model according to the principle of using a scaling factor, and the scaling factor is:
[0034]
[0035] In the formula, λ represents the scaling factor, C is a preset constant, C = c1 + c2, and C > 4;
[0036] The updating formula of the velocity and position of the scaling factor is:
[0037] In the formula, λ represents the scaling factor, c1 and c2 represent learning factors, Vt represents the flight speed of the tth generation particle, and rand represents a random number between (0, 1).
[0038] In this preferred embodiment, the parameter weight of the long short-term memory (LSTM) network is optimized by using the preset improved particle swarm optimization algorithm. First, the concept of a scaling factor is introduced, which is based on the nonlinear relationship between a preset constant and a learning factor, providing a dynamic optimization mechanism for parameter adjustment of the LSTM network. The introduction of the scaling factor makes the particle swarm algorithm more flexible to adapt to the search space, improving the convergence speed and optimization ability of the algorithm. Specifically, the velocity and position updating formula of the scaling factor considers the current speed of the particle and random factors, which allows the algorithm to effectively search for the optimal solution while maintaining diversity. Therefore, this improved particle swarm optimization algorithm can more accurately adjust the parameters of the LSTM network, thereby improving the fitting degree and prediction accuracy of the model for power demand time series data. In summary, the beneficial effects of the present application lie in that this optimization strategy enhances the performance of the LSTM model in the power demand prediction task, achieving more accurate capture and prediction of power demand changes, and providing strong technical support for efficient management and decision-making of the power system.
[0039] In the second aspect, the present application provides a power demand prediction device. The power demand prediction device comprises an acquisition module, an optimization module, a first input and output module, a selection module and a second input and output module;
[0040] The acquisition module is used to acquire historical power data;
[0041] The optimization module is used to optimize the historical power data according to the mutual information method and the cosine similarity principle to obtain an index system for power demand prediction;
[0042] The first input-output module is configured to input the historical power data into a preset first structure model, so that the first structure model outputs an initial sample set of a day to be predicted according to a preset relative error method;
[0043] The initial sample set is input into a preset second structure model, so that the second structure model outputs power data meeting the day to be predicted according to preset numerical similarity and shape similarity;
[0044] The selection module is configured to select a first index system according to the day to be predicted and an index system of power demand prediction;
[0045] The second input-output module is configured to input the power data meeting the preset requirement and the index system into a long short-term memory model that has been trained, so that the long short-term memory model outputs power demand results of each period of the day to be predicted.
[0046] The five modules of the device work in a division of labor and coordination manner, which can better predict the short-term power demand. The application first obtains historical power data, optimizes the data by using mutual information method and cosine similarity principle, and obtains a power demand prediction index system. This step ensures that the selected index has a high correlation with the power demand, and provides a solid foundation for subsequent prediction. Then, combined with the historical power data and the preset double-layer structure model (including the first model and the second model), power data meeting the preset requirement is calculated. This process further refines the data through a double-layer screening mechanism, and improves the prediction accuracy. Finally, the power data meeting the preset requirement and the index system are input into the long short-term memory model that has been trained. The long short-term memory model can learn the long-term dependence relationship of the data, and output the power demand results of each period of the day to be predicted. Therefore, the application realizes accurate prediction of the short-term power demand, improves the scheduling efficiency and operation stability of the power system, and solves the problem that the short-term power demand cannot be accurately predicted in the prior art.
[0047] As a preferred embodiment of the second aspect, the inputting the power data meeting the preset requirement and the first index system into the long short-term memory model that has been trained, and outputting the power demand results of each period of the day to be predicted by the long short-term memory model, specifically comprises:
[0048] The power data meeting the preset requirement and the first index system are input into the long short-term memory model that has been trained, and the weights of parameters of the long short-term memory model are optimized according to a preset improved particle swarm optimization algorithm, so that the long short-term memory model outputs the power demand results of each period of the day to be predicted.
[0049] In this preferred embodiment, the present application inputs the power data and the first indicator system that meet the preset requirements into the trained long short-term memory (LSTM) model, and first uses the ability of the LSTM model to capture the long-term dependencies in the time series data, which is particularly important for predicting data with obvious time characteristics such as power demand. Then, the parameter weights of the LSTM network are optimized by the preset improved particle swarm optimization algorithm. This step further improves the prediction performance of the model, enabling the model to more accurately learn and simulate the changing laws of power demand. Ultimately, this method that combines time series analysis and parameter optimization enables the LSTM model to output the power demand results for each time period of the day to be predicted, thereby improving the accuracy and reliability of the prediction. The present application not only enhances the model's ability to process time series data, but also further improves the prediction accuracy through algorithm optimization, providing an efficient and accurate solution for power demand forecasting.
[0050] In a third aspect, the present application provides a computer-readable storage medium, the computer-readable storage medium including a stored computer program. When the computer program is executed, the device containing the computer-readable storage medium is controlled to execute the power demand forecasting method described above. The beneficial effects thereof are the same as those of the power demand forecasting method provided in the first aspect of the present application.
[0051] In a fourth aspect, the present application provides a terminal device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements any one of the power demand forecasting methods described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 : A flow chart of an embodiment of the power demand forecasting method provided in this application;
[0053] Figure 2 : A structural diagram of an embodiment of the initial correlation index for power demand forecasting provided by this application;
[0054] Figure 3 : A structural diagram of an embodiment of the power demand forecasting device provided in this application. DETAILED DESCRIPTION
[0055] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0056] Example 1
[0057] Please refer to Figure 1 , which is a method for predicting power demand provided by an embodiment of the present invention.
[0058] In this embodiment, the process of the power demand forecasting method in this application is described in detail through steps S01-S06.
[0059] S01: Obtain historical power data and the day to be predicted.
[0060] As a preferred embodiment of the first embodiment, the acquisition of historical power data and the day to be predicted is specifically as follows:
[0061] Get real-time electricity prices, meteorological factors, historical electricity demand, and holiday types.
[0062] In this preferred embodiment, the present application can comprehensively capture the key factors affecting electricity demand by acquiring multi-dimensional historical electricity data such as real-time electricity prices, meteorological factors, historical electricity demand, and holiday types. This comprehensive data collection provides a rich information foundation for subsequent data analysis and model training. Next, using the mutual information method and cosine similarity principle to optimize this data, the most predictive indicators can be screened out and an indicator system for electricity demand forecasting can be constructed. This step ensures that the model can focus on the most influential factors, thereby improving the accuracy of the forecast.
[0063] S02: Optimizing the historical power data based on the mutual information method and the cosine similarity principle to obtain an indicator system for power demand forecasting.
[0064] As a preferred embodiment of the first embodiment, the historical power data is optimized based on the mutual information method and the cosine similarity principle to obtain an index system for power demand forecasting, specifically:
[0065] A short-term electricity demand forecast correlation index system is constructed, which comprehensively considers factors such as real-time electricity prices, meteorological factors, historical electricity demand and holiday types. The mutual information method is used to explore the intrinsic correlation of different correlation indicators in the short-term electricity demand forecast correlation index system. The weights of different correlation indicators are quantified according to the cosine similarity coefficient method, and the correlation index system is reasonably optimized.
[0066] 1) Seventeen short-term power demand forecast related indicators were selected from four aspects, namely real-time electricity prices, meteorological factors, historical power demand and holiday types, to construct a short-term power demand forecast related indicator system, and the maximum and minimum value methods were used for dimensionless processing.
[0067] There are many short-term power demand prediction correlation indicators, and it is necessary to consider the real-time electricity price and other key correlation indicators to improve the accuracy of power demand prediction. As shown in Fig. Figure 2
[0068] Because the correlation indicators are numerous and have different dimensions, to avoid the dimensional difference leading to reduced power demand prediction accuracy, the minimum and maximum values method is used to perform dimensionless processing on the original data. At the same time, considering the problems of abnormality and missing in the data collection process, the average interpolation method is used for data processing, and the dimensionless calculation formula is:
[0069]
[0070] In the formula, x i is the dimensionless value; is the original value, is the minimum value of the jth correlation indicator matrix; is the maximum value of the jth correlation indicator matrix.
[0071] 2) The mutual information method is used to calculate the mutual information value of the short-term power demand prediction correlation indicator system as the correlation coefficient, to mine the internal correlation of different correlation indicators, and to quantify the weight of different correlation indicators according to the cosine similarity coefficient method.
[0072] Mutual information as an information theory can reflect the amount of information contained in two random variables, and express the correlation between the two variables. Using the power demand correlation indicator set, the mutual information value of different correlation indicator sequences to the short-term power demand sequence is calculated:
[0073]
[0074] In the formula, I(h i , h v ) is the mutual information value of the short-term power demand correlation indicator and the short-term power demand; n is the number of correlation indicators; h im is the value of the ith correlation indicator at the mth moment; h vm is the value of the short-term power demand at the mth moment; p(h im ) and p(h vm ) are the marginal distributions of h im and h vm ; p(h im , h vm ) is the probability density function. h i and h v are expressed as:
[0075]
[0076] In order to reflect the degree of mapping of different correlation indicators to the power demand forecast results, the cosine similarity coefficient is used to weight the correlation coefficient of the correlation indicators and optimize the proportion of the correlation indicators. The specific formula for calculating the cosine similarity coefficient is:
[0077]
[0078] Where, ρ i Represents the cosine similarity coefficient value of the i-th association indicator.
[0079] The weighted calculation formula for correlation indicators is:
[0080]
[0081] Where, ω i represents the weight of the i-th associated index; ρ i Represents the cosine similarity coefficient value of the i-th association indicator.
[0082] S03: Inputting historical power data into a preset first structural model, so that the first structural model outputs an initial sample set of the day to be predicted for short-term power demand according to a preset relative error method.
[0083] As a preferred embodiment of the first embodiment, the historical power data is input into a preset first structural model so that the first structural model outputs an initial sample set for the day to be predicted of short-term power demand according to a preset relative error method, specifically:
[0084] Acquiring first historical power data;
[0085] According to the first historical power data, a power demand forecast correlation indicator matrix is constructed;
[0086] Constructing a first structural model according to a preset relative error method, the power demand forecast correlation index matrix and a preset sample correlation index matrix;
[0087] The historical power data is input into the first structural model so that the first structural model outputs an initial sample set for the day for which short-term power demand is to be predicted.
[0088] More specifically, a matrix of related indicators for short-term electricity demand forecasting is constructed, thresholds are set, samples are screened using the relative error method, a sample set similar to the day for short-term electricity demand forecasting is roughly selected, a rough set of similar days is established, and the preliminary screening of the forecasting model input is completed to obtain the initial sample set.
[0089] The steps for selecting the rough set of similar days for the short-term power demand forecasting day are as follows:
[0090] a) Power demand forecast correlation index matrix:
[0091] If the correlation index matrix of the forecast day is X a Indicates that each correlation indicator matrix of the sample is represented by X i Represented as:
[0092]
[0093] In the formula, p is the number of correlation indicators finally selected by mutual information, q is the dimension of all correlation indicators, X aj is the value at the jth moment of the day to be predicted, X ij is the value of the i-th correlation indicator at the j-th moment, i = 1, 2, ..., p, j = 1, 2, ..., q.
[0094] b) Rough set matrix of power demand forecast:
[0095] Construct the correlation index matrix of the predicted day and the sample correlation index matrix, and obtain the rough set matrix by calculating the relative error. The calculation formula is:
[0096]
[0097] Where δ(i,j) is the relative error between the j-th moment value of the forecast day and the j-th moment value of the i-th correlation indicator.
[0098] The selection criteria for the rough set of similar days for each indicator are:
[0099]
[0100] When all moments j of the i-th indicator satisfy the above formula, it means that the i-th indicator meets the selection conditions of the similar day rough set. The selection criteria are:
[0101]
[0102] When all indicators i satisfy the above formula, it means that this sample meets the similar daily rough set condition.
[0103] In this preferred embodiment, the present application first obtains the first historical power data by inputting the historical power data into a preset first structural model. These data contain key information that affects power demand. Then, the power demand forecast correlation index matrix is constructed using these data. This step enables the model to identify and quantify the impact of various factors on power demand. Then, according to the preset relative error method, the power demand forecast correlation index matrix and the sample correlation index matrix, a first structural model is constructed. The design of this model aims to accurately evaluate and select historical samples similar to the day to be predicted through the relative error method. Finally, the historical power data is input into the first structural model, and the model outputs the initial sample set of the day to be predicted for short-term power demand. These sample sets are carefully screened and can represent the power demand characteristics of the day to be predicted. The present application improves the accuracy and relevance of power demand forecasts, provides high-quality input data for subsequent forecast models, and thus enhances the reliability and practicality of the entire forecast system.
[0104] S04: Inputting the initial sample set into a preset second structural model, so that the second structural model outputs power data for the day to be predicted that meets the short-term power demand according to preset numerical similarity and shape similarity.
[0105] As a preferred embodiment of the first embodiment, the initial sample set is input into a preset second structural model so that the second structural model outputs power data for the day to be predicted that meets the short-term power demand based on preset numerical similarity and shape similarity, specifically:
[0106] Acquiring first historical power data and an initial sample set;
[0107] Calculating a numerical difference matrix based on a preset numerical similarity and the first historical power data;
[0108] Calculating a slope difference matrix based on a preset shape similarity and the first historical power data;
[0109] According to the preset proportional coefficient fusion method, numerical difference matrix and slope difference matrix, the second structural model is constructed;
[0110] The initial sample set is input into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand.
[0111] More specifically, based on the results of the rough set selection of similar days, from the two perspectives of value and shape, the improved grey correlation analysis method is used to calculate the numerical similarity and current situation similarity, quantify the similarity between the predicted day and the historical sample data, and perform a secondary selection of the rough set of similar days.
[0112] a) Numerical similarity:
[0113] Based on the absolute numerical difference between the correlation index matrix of the predicted day and the rough set matrix of similar days, the improved grey correlation analysis method is used to construct the numerical similarity and calculate the numerical difference matrix, which is specifically:
[0114] Δx1(i,j)=|X ij -X aj |;
[0115] Where Δx1(i,j) is the numerical difference between the value at the jth moment on the forecast day and the value at the jth moment of the i-th associated indicator.
[0116] Substitute the numerical difference matrix into the following formula to form the numerical similarity:
[0117]
[0118] Where γ1(i,j) is the numerical similarity represented by the numerical difference matrix.
[0119] b) Shape similarity:
[0120] Calculate the slope difference of each corresponding line segment between the sequences, and use the shape slope difference and improved grey correlation analysis method to construct the shape similarity. Calculate the slope value of the correlation index matrix of the predicted day and the rough set matrix of the similar day. The calculation formula is:
[0121] k(i,j)=|k ij -k i,j+1 |;
[0122] k(a,j)=|k aj -k a,j+1 |;
[0123] Where k aj is the slope value at the jth moment on the forecast day; k ij is the slope value of the i-th correlation indicator at the j-th moment.
[0124] The slope difference matrix is obtained by calculating the correlation index matrix of the predicted day and the rough set matrix of similar days. The calculation formula is:
[0125] Δx2(i,j)=|k(i,j)-k(a,j);
[0126] Where Δx2(i,j) is the slope difference between the value at the jth moment on the forecast day and the value at the jth moment of the i-th associated indicator.
[0127] Substitute the slope difference matrix into the following formula to form the shape similarity:
[0128]
[0129] Where γ2(i,j) is the shape similarity represented by the slope difference matrix.
[0130] The proportional coefficient is used to fuse the numerical similarity calculation results and the shape similarity calculation results to obtain the total similarity. The threshold is set to select sample data with a close similarity to the short-term power demand forecast day, and the first k days are selected in ascending order as part of the input of the long short-term memory prediction model.
[0131] More specifically, the numerical similarity and shape similarity are calculated between the similar day rough set matrix and the correlation index matrix of the day to be predicted. Based on this, the total similarity between the correlation index matrix of the day to be predicted and the similar day rough set matrix can be calculated. The calculation formula is as follows:
[0132]
[0133] Where, γ i is the total similarity of the i-th correlation index between the predicted day and the sample; ω i is the weight of the i-th correlation index between the predicted day and the sample; α and β are correlation coefficients, α+β=1, and the values of α and β depend on the importance of numerical similarity and shape similarity.
[0134] Following the above process, the total similarity between the predicted day and the rough set of similar days is calculated, and the similar day rough set is selected again. The samples with a total similarity threshold greater than 0.9 in the rough set of similar days are selected to form the similar day set, and the first k days are selected in ascending order as similar days.
[0135] In this preferred embodiment, the present application inputs the initial sample set into a preset second structural model, and first calculates the numerical difference matrix based on the first historical power data. This step quantifies the numerical deviation between the day to be predicted and the historical data, and provides the model with a direct indicator for measuring changes in power demand. Next, the slope difference matrix is calculated. This step takes into account the trend and shape of changes in power demand, and supplements the information that the numerical difference matrix cannot cover. Then, using the preset proportional coefficient fusion method, the numerical difference matrix and the slope difference matrix are combined to construct a second structural model. This model combines the similarity of values and shapes, and can more comprehensively evaluate the similarity between the sample and the day to be predicted. Finally, the initial sample set is input into the second structural model, and the model outputs power data that matches the day to be predicted for short-term power demand. The present application improves the accuracy of power demand forecasting, ensures that the forecast results can more accurately reflect the changing trend of actual power demand, and thus provides more reliable data support for the scheduling and planning of the power system.
[0136] S05: Select a first indicator system based on the indicator system of the forecast day and the power demand forecast.
[0137] S06: inputting the power data and the first index system into the long short-term memory model which has been trained to make the long short-term memory model output the power demand result of each period of the day to be predicted.
[0138] As a preferred embodiment of the first embodiment, the inputting the power data meeting the preset requirement and the first index system into the long short-term memory model which has been trained to make the long short-term memory model output the power demand result of each period of the day to be predicted is specifically:
[0139] The power data meeting the preset requirement and the first index system are inputted into the long short-term memory model which has been trained, and the weight of the parameter of the long short-term memory model is optimized according to the preset improved particle swarm optimization algorithm, so as to make the long short-term memory model output the power demand result of each period of the day to be predicted.
[0140] More specifically, the long short-term memory neural network is adopted to construct the short-term power demand prediction model, in order to avoid the poor robustness and reduced prediction accuracy caused by the high randomization degree of the key parameters of the prediction model, the improved particle swarm optimization algorithm is adopted to optimize the key parameters of the prediction model. The improved particle swarm optimization algorithm is specifically:
[0141] The improved particle swarm optimization algorithm can realize dynamic weight, mainly by adopting a scaling factor λ instead of a weight ω, the scaling factor utilizes the internal relationship between the weight and the learning factor, and uses the nonlinear mode of the learning factor to represent. The scaling factor acts on the flight speed update formula of the particle swarm to improve the optimization ability of the convergence speed of the particle swarm algorithm, and the specific calculation of the scaling factor is as follows.
[0142]
[0143] In the formula, λ represents the scaling factor; C is a constant, C=c1+c2, and C>4.
[0144] The speed and position update formula of the improved particle swarm optimization algorithm is as follows:
[0145]
[0146] In the formula, λ represents the scaling factor; c1 and c2 represent the learning factor; represents the flight speed of the tth generation particle; rand() represents a random number between (0, 1).
[0147] In this preferred embodiment, the present application inputs the power data and the first indicator system that meet the preset requirements into the trained long short-term memory (LSTM) model, and first uses the ability of the LSTM model to capture the long-term dependencies in the time series data, which is particularly important for predicting data with obvious time characteristics such as power demand. Then, the parameter weights of the LSTM network are optimized by the preset improved particle swarm optimization algorithm. This step further improves the prediction performance of the model, enabling the model to more accurately learn and simulate the changing laws of power demand. Ultimately, this method that combines time series analysis and parameter optimization enables the LSTM model to output the power demand results for each time period of the day to be predicted, thereby improving the accuracy and reliability of the prediction. The present application not only enhances the model's ability to process time series data, but also further improves the prediction accuracy through algorithm optimization, providing an efficient and accurate solution for power demand forecasting.
[0148] This application first obtains historical power data and optimizes these data using the mutual information method and the cosine similarity principle to obtain a power demand forecasting index system. This step ensures that the selected indicators are highly correlated with power demand, providing a solid foundation for subsequent forecasts. Then, by combining historical power data and a preset two-layer structure model (including a first model and a second model), power data that meets the preset requirements is calculated. This process further refines the data through a two-layer screening mechanism, thereby improving the accuracy of the forecast. Finally, these power data and index systems that meet the preset requirements are input into the trained long-short-term memory model. The long-short-term memory model can learn the long-term dependencies of these data and output the power demand results for each time period on the day to be predicted. Therefore, this application achieves accurate prediction of short-term power demand, improves the dispatching efficiency and operational stability of the power system, and solves the problem that the existing technology cannot accurately predict short-term power demand.
[0149] Example 2
[0150] Please refer to Figure 3 , is a power demand forecasting device provided in an embodiment of the present application.
[0151] In this embodiment, the power demand forecasting device includes an acquisition module 10 , an optimization module 20 , a first input-output module 30 , a selection module 40 , and a second input-output module 50 .
[0152] The acquisition module 10 is used to acquire historical power data and the day to be predicted.
[0153] As a preferred embodiment of the second embodiment, the acquisition of historical power data and the day to be predicted is specifically as follows:
[0154] Get real-time electricity prices, meteorological factors, historical electricity demand, and holiday types.
[0155] In this preferred embodiment, the present application can comprehensively capture the key factors affecting electricity demand by acquiring multi-dimensional historical electricity data such as real-time electricity prices, meteorological factors, historical electricity demand, and holiday types. This comprehensive data collection provides a rich information foundation for subsequent data analysis and model training. Next, using the mutual information method and cosine similarity principle to optimize this data, the most predictive indicators can be screened out and an indicator system for electricity demand forecasting can be constructed. This step ensures that the model can focus on the most influential factors, thereby improving the accuracy of the forecast.
[0156] The optimization module 20 is used to optimize the historical power data according to the mutual information method and the cosine similarity principle to obtain an index system for power demand prediction.
[0157] As a preferred embodiment of the second embodiment, the historical power data is optimized based on the mutual information method and the cosine similarity principle to obtain an index system for power demand forecasting, specifically:
[0158] A short-term electricity demand forecast correlation index system is constructed, which comprehensively considers factors such as real-time electricity prices, meteorological factors, historical electricity demand and holiday types. The mutual information method is used to explore the intrinsic correlation of different correlation indicators in the short-term electricity demand forecast correlation index system. The weights of different correlation indicators are quantified according to the cosine similarity coefficient method, and the correlation index system is reasonably optimized.
[0159] 1) Seventeen short-term power demand forecast related indicators were selected from four aspects, namely real-time electricity prices, meteorological factors, historical power demand and holiday types, to construct a short-term power demand forecast related indicator system, and the maximum and minimum value methods were used for dimensionless processing.
[0160] There are many related indicators for short-term power demand forecasting. It is necessary to incorporate other key related indicators into the related indicators while considering the real-time electricity price to improve the accuracy of power demand forecasting. Initially, 17 related indicators for short-term power demand forecasting were selected from four aspects: real-time electricity price, meteorological factors, historical power demand and holiday types, such as Figure 2 shown.
[0161] Since there are many related indicators and their dimensions are different, in order to avoid the reduction of power demand forecast accuracy due to dimension differences, the minimum and maximum value methods are used to non-dimensionalize the original data. At the same time, considering the problems of anomalies and missing values in the data collection process, the average interpolation method is used to process the data. The dimensionless calculation formula is:
[0162]
[0163] Where x i is the dimensionless value; is the original value, is the minimum value of the j-th correlation indicator matrix; is the maximum value of the j-th correlation indicator matrix.
[0164] 2) The mutual information method is used to calculate the mutual information values of different correlation indicators in the short-term power demand forecast correlation index system as the correlation coefficient, and the intrinsic correlation of different correlation indicators is explored. The weights of different correlation indicators are quantified according to the cosine similarity coefficient method.
[0165] Mutual information, as an information metric in information theory, can reflect the amount of information contained in two random variables and express the correlation between the two variables. Using the power demand correlation index set, the mutual information value of different correlation index sequences for the short-term power demand sequence is calculated:
[0166]
[0167] Where, I(h i , h v ) is the mutual information value of the short-term power demand correlation index and the short-term power demand; n is the number of correlation indicators; h im is the value of the i-th correlation index at the m-th moment; h vm is the value of short-term power demand at the mth moment; p(h im ) and p(h vm ) is h im and h vm The marginal distribution of p(h im ,h vm ) is the probability density function. h i and h v Expressed as:
[0168]
[0169] In order to reflect the degree of mapping of different correlation indicators to the power demand forecast results, the cosine similarity coefficient is used to weight the correlation coefficient of the correlation indicators and optimize the proportion of the correlation indicators. The specific formula for calculating the cosine similarity coefficient is:
[0170]
[0171] Where, ρ i Represents the cosine similarity coefficient value of the i-th association indicator.
[0172] The weighted calculation formula for correlation indicators is:
[0173]
[0174] wherein ω i represents the i-th correlation index weight value; p i represents the i-th correlation index cosine similarity coefficient value.
[0175] The first input and output module 30 is configured to input the historical power data into a preset first structure model, so that the first structure model outputs an initial sample set of the day to be predicted of the short-term power demand according to a preset relative error method.
[0176] As a preferred embodiment of the second embodiment, the inputting of the historical power data into the preset first structure model, so that the first structure model outputs the initial sample set of the day to be predicted of the short-term power demand according to the preset relative error method, specifically comprises:
[0177] obtaining first historical power data;
[0178] constructing a power demand prediction correlation index matrix according to the first historical power data;
[0179] constructing a first structure model according to the preset relative error method, the power demand prediction correlation index matrix and a preset sample correlation index matrix;
[0180] inputting the historical power data into the first structure model, so that the first structure model outputs the initial sample set of the day to be predicted of the short-term power demand.
[0181] More specifically, a short-term power demand prediction correlation index matrix is constructed, a threshold is set, samples are screened by a relative error method, a sample set similar to the day to be predicted of the short-term power demand is roughly selected, a similar day coarse set is established, preliminary screening of input of the prediction model is completed, and an initial sample set is obtained.
[0182] The similar day coarse set of the day to be predicted of the short-term power demand prediction is selected as follows:
[0183] a) the power demand prediction correlation index matrix:
[0184] If the correlation index matrix of the day to be predicted is represented by X a , and each correlation index matrix of the sample is represented by X i , then the correlation index matrix is:
[0185]
[0186] wherein p is the number of correlation indexes finally selected by mutual information, q is the dimension of all correlation indexes, X aj is the value of the j-th moment of the day to be predicted, and X ij is the value of the i-th correlation index of the j-th moment, i=1, 2,..., p, and j=1, 2,..., q.
[0187] b) Rough set matrix of power demand prediction:
[0188] The correlation index matrix of the day to be predicted and the sample correlation index matrix are constructed, and the rough set matrix is obtained by calculating the relative error, and the calculation formula is:
[0189]
[0190] In the formula, δ(i,j) is the relative error of the value at the jth time of the prediction day and the value at the jth time of the ith correlation index.
[0191] Rough set selection criteria for each index similar day:
[0192]
[0193] When all the times j of the ith index satisfy the above formula, it indicates that the ith index satisfies the rough set selection criteria of the similar day, and the selection criteria are:
[0194]
[0195] When all the indexes i satisfy the above formula, it indicates that the sample satisfies the rough set condition of the similar day.
[0196] In this preferred embodiment, the application first obtains the first historical power data by inputting the historical power data into the preset first structure model, which contains the key information affecting the power demand. Then, the power demand prediction correlation index matrix is constructed using these data, which enables the model to identify and quantify the influence of each factor on the power demand. Then, according to the preset relative error method, the power demand prediction correlation index matrix and the sample correlation index matrix, the first structure model is constructed, which is designed to accurately evaluate and select the historical samples similar to the day to be predicted by the relative error method. Finally, the historical power data is input into the first structure model, and the model outputs the initial sample set of the short-term power demand day to be predicted, which is carefully selected and can represent the power demand characteristics of the day to be predicted. The application improves the accuracy and relevance of power demand prediction, provides high-quality input data for subsequent prediction models, and enhances the reliability and practicality of the entire prediction system.
[0197] The first input-output module 30 is also used to input the initial sample set into the preset second structure model, so that the second structure model outputs the power data that satisfies the short-term power demand day to be predicted according to the preset numerical similarity and shape similarity.
[0198] As a preferred embodiment of the second embodiment, the initial sample set is input into a preset second structural model so that the second structural model outputs power data for the day to be predicted that meets the short-term power demand according to preset numerical similarity and shape similarity, specifically:
[0199] Acquiring first historical power data and an initial sample set;
[0200] Calculating a numerical difference matrix based on the preset numerical similarity and the first historical power data;
[0201] Calculating a slope difference matrix based on a preset shape similarity and the first historical power data;
[0202] According to the preset proportional coefficient fusion method, numerical difference matrix and slope difference matrix, the second structural model is constructed;
[0203] The initial sample set is input into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand.
[0204] More specifically, based on the results of the coarse set selection of similar days, from the two perspectives of value and shape, the improved grey correlation analysis method is used to calculate the numerical similarity and current situation similarity, quantify the similarity between the predicted day and the historical sample data, and perform a secondary selection of the coarse set of similar days.
[0205] a) Numerical similarity:
[0206] Based on the absolute numerical difference between the correlation index matrix of the predicted day and the rough set matrix of similar days, the improved grey correlation analysis method is used to construct the numerical similarity and calculate the numerical difference matrix, which is specifically:
[0207] Δx1(i,j)=|X ij -X aj |;
[0208] Where Δx1(i,j) is the numerical difference between the value at the jth moment on the forecast day and the value at the jth moment of the i-th associated indicator.
[0209] Substitute the numerical difference matrix into the following formula to form the numerical similarity:
[0210]
[0211] Where γ1(i,j) is the numerical similarity represented by the numerical difference matrix.
[0212] b) Shape similarity:
[0213] Calculate the slope difference of each corresponding line segment between the sequences, and use the shape slope difference and improved grey correlation analysis method to construct the shape similarity. Calculate the slope value of the correlation index matrix of the predicted day and the rough set matrix of the similar day. The calculation formula is:
[0214] k(i,j)=|k ij -k i,j+1 |;
[0215] k(a,j)=|k aj -k a,j+1 |;
[0216] Where k aj is the slope value at the jth moment on the forecast day; k ij is the slope value of the i-th correlation indicator at the j-th moment.
[0217] The slope difference matrix is obtained by calculating the correlation index matrix of the predicted day and the rough set matrix of similar days. The calculation formula is:
[0218] Δx2(i,j)=|k(i,j)-k(a,j);
[0219] Where Δx2(i,j) is the slope difference between the value at the jth moment on the forecast day and the value at the jth moment of the i-th associated indicator.
[0220] Substitute the slope difference matrix into the following formula to form the shape similarity:
[0221]
[0222] Where γ2(i,j) is the shape similarity represented by the slope difference matrix.
[0223] The proportional coefficient is used to fuse the numerical similarity calculation results and the shape similarity calculation results to obtain the total similarity. The threshold is set to select sample data with a close similarity to the short-term power demand forecast day, and the first k days are selected in ascending order as part of the input of the long short-term memory prediction model.
[0224] More specifically, the numerical similarity and shape similarity are calculated between the similar day rough set matrix and the correlation index matrix of the day to be predicted. Based on this, the total similarity between the correlation index matrix of the day to be predicted and the similar day rough set matrix can be calculated. The calculation formula is as follows:
[0225]
[0226] Where, γ i is the total similarity of the i-th correlation index between the predicted day and the sample; ω iis the weight of the i-th correlation index between the predicted day and the sample; α and β are correlation coefficients, α+β=1, and the values of α and β depend on the importance of numerical similarity and shape similarity.
[0227] Following the above process, the total similarity between the predicted day and the rough set of similar days is calculated, and the similar day rough set is selected again. The samples with a total similarity threshold greater than 0.9 in the rough set of similar days are selected to form the similar day set, and the first k days are selected in ascending order as similar days.
[0228] In this preferred embodiment, the present application inputs the initial sample set into a preset second structural model, and first calculates the numerical difference matrix based on the first historical power data. This step quantifies the numerical deviation between the day to be predicted and the historical data, and provides the model with a direct indicator for measuring changes in power demand. Next, the slope difference matrix is calculated. This step takes into account the trend and shape of changes in power demand, and supplements the information that the numerical difference matrix cannot cover. Then, using the preset proportional coefficient fusion method, the numerical difference matrix and the slope difference matrix are combined to construct a second structural model. This model combines the similarity of values and shapes, and can more comprehensively evaluate the similarity between the sample and the day to be predicted. Finally, the initial sample set is input into the second structural model, and the model outputs power data that matches the day to be predicted for short-term power demand. The present application improves the accuracy of power demand forecasting, ensures that the forecast results can more accurately reflect the changing trend of actual power demand, and thus provides more reliable data support for the scheduling and planning of the power system.
[0229] The selection module 40 is used to select a first indicator system according to the indicator system of the day to be predicted and the power demand forecast.
[0230] The second input-output module 50 is used to input the power data and the first indicator system into the trained long short-term memory model, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted.
[0231] As a preferred embodiment of the second embodiment, the power data that meets the preset requirements and the first indicator system are input into the trained long short-term memory model, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted, specifically:
[0232] The power data that meets the preset requirements and the first indicator system are input into a trained long short-term memory model, and the weights of the parameters of the long short-term memory model are optimized according to a preset improved particle swarm optimization algorithm, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted.
[0233] More specifically, a long short-term memory neural network is used to construct a short-term power demand prediction model. To avoid the poor robustness and reduced prediction accuracy caused by the high randomization of key parameters of the prediction model, an improved particle swarm optimization algorithm is used to optimize the key parameters of the prediction model. The improved particle swarm optimization algorithm is as follows:
[0234] The improved particle swarm optimization algorithm can realize dynamic weight. Mainly by using the scaling factor λ instead of the weight ω, the scaling factor utilizes the internal relationship between the weight and the learning factor, and uses the nonlinear mode of the learning factor to represent. The scaling factor acts on the flight speed update formula of the particle swarm to improve the optimization ability of the convergence speed of the particle swarm algorithm. The specific calculation of the scaling factor is as follows.
[0235]
[0236] In the formula, λ represents the scaling factor; C is a constant, C = c1 + c2, and C > 4.
[0237] The speed and position update formula of the improved particle swarm optimization algorithm is as follows:
[0238]
[0239] In the formula, λ represents the scaling factor; c1 and c2 represent the learning factor; represents the flight speed of the tth generation particle; rand() represents a random number between (0, 1).
[0240] In this preferred embodiment, the power data and the first index system that meet the preset requirements are input into the long short-term memory (LSTM) model that has been trained. First, the ability of the LSTM model is used to capture the long-term dependence relationship in the time series data, which is particularly important for predicting power demand data with obvious time characteristics. Then, the parameter weight of the LSTM network is optimized through the preset improved particle swarm optimization algorithm, which further improves the prediction performance of the model and enables the model to more accurately learn and simulate the change rule of power demand. Finally, this combination of time series analysis and parameter optimization enables the LSTM model to output the power demand results of each period of the day to be predicted, thereby improving the accuracy and reliability of the prediction. This application not only enhances the model's ability to process time series data, but also further improves the prediction accuracy through algorithm optimization, providing an efficient and accurate solution for power demand prediction.
[0241] This application first obtains historical power data and optimizes these data using the mutual information method and the cosine similarity principle to obtain a power demand forecasting index system. This step ensures that the selected indicators are highly correlated with power demand, providing a solid foundation for subsequent forecasts. Then, by combining historical power data and a preset two-layer structure model (including a first model and a second model), power data that meets the preset requirements is calculated. This process further refines the data through a two-layer screening mechanism, thereby improving the accuracy of the forecast. Finally, these power data and index systems that meet the preset requirements are input into the trained long-short-term memory model. The long-short-term memory model can learn the long-term dependencies of these data and output the power demand results for each time period on the day to be predicted. Therefore, this application achieves accurate prediction of short-term power demand, improves the dispatching efficiency and operational stability of the power system, and solves the problem that the existing technology cannot accurately predict short-term power demand.
[0242] Example 3:
[0243] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the power demand forecasting method described above;
[0244] Wherein, if the power demand forecasting method is implemented in the form of a software functional unit and used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0245] Example 4
[0246] The application provides a terminal device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor implements any one of the power demand prediction methods according to the embodiments when the computer program is executed.
[0247] The above-described specific embodiments further illustrate the purposes, technical solutions and beneficial effects of the application. It should be understood that the above-described specific embodiments are merely examples of the application and are not intended to limit the protection scope of the application. It is particularly pointed out that any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application should be included in the protection scope of the application.
Claims
1. A method for predicting power demand, characterized in that: include: Obtaining historical power data and the day to be predicted; wherein the historical power data includes real-time electricity prices, meteorological factors, historical power demand, and holiday types; Optimizing the historical power data based on the mutual information method and the cosine similarity principle to obtain an indicator system for power demand forecasting; Inputting historical power data into a preset first structural model so that the first structural model outputs an initial sample set for the day on which short-term power demand is to be predicted according to a preset relative error method; Inputting historical power data into a preset first structural model so that the first structural model outputs an initial sample set for the day on which short-term power demand is to be predicted according to a preset relative error method is specifically as follows: Acquiring first historical power data; According to the first historical power data, a power demand forecast correlation indicator matrix is constructed; Constructing a first structural model according to a preset relative error method, the power demand forecast correlation index matrix and a preset sample correlation index matrix; Inputting historical power data into the first structural model so that the first structural model outputs an initial sample set corresponding to the day for which short-term power demand is to be predicted; Inputting the initial sample set into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand based on preset numerical similarity and shape similarity; Inputting the initial sample set into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand based on preset numerical similarity and shape similarity, specifically: Acquiring first historical power data and an initial sample set; Calculating a numerical difference matrix based on a preset numerical similarity and the first historical power data; Calculating a slope difference matrix based on a preset shape similarity and the first historical power data; According to the preset proportional coefficient fusion method, numerical difference matrix and slope difference matrix, the second structural model is constructed; Inputting the initial sample set into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand; A first indicator system is selected based on the indicator system of the forecast day and the power demand forecast; The power data and the first indicator system are input into the trained long short-term memory model, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted, specifically: The power data and the first indicator system are input into a trained long short-term memory model, and the weights of the parameters of the long short-term memory model are optimized according to a preset improved particle swarm optimization algorithm, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted; the weights of the parameters of the long short-term memory model are optimized according to the preset improved particle swarm optimization algorithm, specifically as follows: The improved particle swarm optimization algorithm optimizes the weights of the parameters of the long short-term memory model based on the principle of using a scaling factor, and the scaling factor is: Where λ represents the scaling factor, C is a preset constant, C = c1 + c2, and C > 4; The update formula for the speed and position of the scaling factor is: Where λ represents the scaling factor, c1 and c2 represent the learning factors, represents the flying speed of the t-th generation particle, and rand represents a random number between (0,1).
2. A power demand forecasting device, characterized in that: It includes an acquisition module, an optimization module, a first input and output module, a selection module and a second input and output module; The acquisition module is used to obtain historical power data and the day to be predicted; wherein the historical power data includes real-time electricity prices, meteorological factors, historical power demand and holiday types; The optimization module is used to optimize the historical power data based on the mutual information method and the cosine similarity principle to obtain an indicator system for power demand forecasting; The first input-output module is used to input historical power data into a preset first structural model, so that the first structural model outputs an initial sample set for the day for which short-term power demand is to be predicted according to a preset relative error method; the inputting of historical power data into the preset first structural model, so that the first structural model outputs an initial sample set for the day for which short-term power demand is to be predicted according to the preset relative error method, is specifically as follows: Acquiring first historical power data; According to the first historical power data, a power demand forecast correlation indicator matrix is constructed; Constructing a first structural model according to a preset relative error method, the power demand forecast correlation index matrix and a preset sample correlation index matrix; Inputting historical power data into the first structural model so that the first structural model outputs an initial sample set corresponding to the day for which short-term power demand is to be predicted; Inputting the initial sample set into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand based on preset numerical similarity and shape similarity; Inputting the initial sample set into a preset second structural model so that the second structural model outputs power data for a day to be predicted that satisfies short-term power demand based on preset numerical similarity and shape similarity, specifically: Acquiring first historical power data and an initial sample set; Calculating a numerical difference matrix based on a preset numerical similarity and the first historical power data; Calculating a slope difference matrix based on a preset shape similarity and the first historical power data; According to the preset proportional coefficient fusion method, numerical difference matrix and slope difference matrix, the second structural model is constructed; Inputting the initial sample set into a preset second structural model so that the second structural model outputs power data for the to-be-predicted day that meets short-term power demand; The selection module is used to select a first indicator system according to the indicator system of the forecast day and the power demand forecast; The second input-output module is used to input the power data and the first indicator system into the trained long-short-term memory model, so that the long-short-term memory model outputs the power demand results for each time period of the day to be predicted, specifically: The power data and the first indicator system are input into a trained long short-term memory model, and the weights of the parameters of the long short-term memory model are optimized according to a preset improved particle swarm optimization algorithm, so that the long short-term memory model outputs the power demand results for each time period of the day to be predicted; the weights of the parameters of the long short-term memory model are optimized according to the preset improved particle swarm optimization algorithm, specifically as follows: The improved particle swarm optimization algorithm optimizes the weights of the parameters of the long short-term memory model based on the principle of using a scaling factor, and the scaling factor is: Where λ represents the scaling factor, C is a preset constant, C = c1 + c2, and C > 4; The update formula for the speed and position of the scaling factor is: Where λ represents the scaling factor, c1 and c2 represent the learning factors, represents the flying speed of the t-th generation particle, and rand represents a random number between (0,1).
3. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the power demand forecasting method according to claim 1.
4. A terminal device, characterized in that: The invention comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the power demand forecasting method according to claim 1 is implemented when the processor executes the computer program.
Citation Information
Patent Citations
Battery life prediction method based on particle swarm optimization long-short-term memory network
CN112001113A
Transmitting end transient overvoltage suppression method based on overshoot parameter LSTM neural network
CN118399422A