Power grid power load prediction method and device and electronic equipment
By performing principal component analysis on the power grid historical data, and combining with the improved recurrent neural network model for prediction, the problem of insufficient accuracy and stability in the power load prediction of the power grid is solved, achieving a more efficient and explainable prediction effect.
Patent Information
- Application Number
- CN202411657306.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-25
AI Technical Summary
The prior art has problems of insufficient accuracy and stability in power load prediction in power grids, especially when dealing with nonlinear relationships, high-dimensional inputs, and random fluctuations in time series.
Principal component analysis (PCA) is used to reduce the dimensions of historical data, and combined with recurrent neural network (RNN) to improve the model, short-term power load prediction is performed based on the data after dimensionality reduction. This improved model combines the Hidden Markov model based on the standard RNN model, enhancing the processing capability of time series data.
It improves the accuracy and stability of grid power load prediction, reduces the demand for computing resources, simplifies the deployment and maintenance of the model, and enhances the interpretability of the model.
Smart Images

Figure CN119695849A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the electric power field, and in particular to a method, a device and an electronic device for predicting electric power load of a power grid. Background Art
[0002] In the rapidly developing power industry, short-term power load forecasting plays a vital role, directly affecting the stable operation of the power system, the effective allocation of energy resources and the overall economic efficiency. In related technologies, statistical learning and machine learning methods are used to predict the power load of the power grid. Statistical learning methods cannot effectively handle nonlinear relationships, high-dimensional inputs and random fluctuations in power load time series; machine learning methods require a large amount of computing resources when processing high-dimensional data, resulting in low computing efficiency, and machine learning methods are highly complex and difficult to deploy and maintain in practice, resulting in insufficient accuracy and stability when predicting power loads in the power grid.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a method, device and electronic device for predicting power load of a power grid, so as to at least solve the technical problem that the prediction of power load of a power grid is not accurate and stable enough.
[0005] According to one aspect of an embodiment of the present invention, a method for predicting power load of a power grid is provided, comprising: collecting historical data of a target power grid, wherein the historical data comprises: historical power load data of an area where the target power grid is located, meteorological information of an area where the target power grid is located, personnel information of an area where the target power grid is located, and holiday activity information of an area where the target power grid is located; using a principal component analysis (PCA) method to reduce the dimension of the historical data to obtain the reduced-dimensional historical data; using an improved recurrent neural network (RNN) model to predict the power load of the target power grid in a short period of time in the future based on the reduced-dimensional historical data, wherein the improved recurrent neural network (RNN) model is a model formed by combining a standard RNN model with a hidden Markov model, and the duration of the short period is less than one day.
[0006] Optionally, before using the principal component analysis (PCA) method to reduce the dimension of the historical data to obtain the reduced-dimensional historical data, the method also includes: performing at least one of the following cleaning on the historical data: processing missing values, eliminating outliers, data type conversion, data normalization, and data merging.
[0007] Optionally, before using the principal component analysis (PCA) method to reduce the dimension of the historical data to obtain the historical data after dimension reduction, the method further includes: performing periodic conversion on the periodic information in the historical data to convert it into data that changes continuously with the period.
[0008] Optionally, the periodic conversion of the periodic information in the historical data into data that changes continuously with the period includes: when the historical data includes time series data, using the following sine function to periodically convert the time series data to obtain time series data that changes continuously with the period:
[0009]
[0010] Among them, Y sin is the sine value of the time point in the time series data after conversion, representing the periodic properties of the original time series data; Y is the periodic time series data to be converted, Y max is the maximum value of the time series data to be converted.
[0011] Optionally, the principal component analysis (PCA) method is used to reduce the dimension of the historical data to obtain the historical data after dimension reduction, including: standardizing the historical data so that the mean of the characteristics of the historical data is 1 and the standard deviation is 1, to obtain the standardized historical data; calculating the covariance matrix of the standardized historical data, wherein the covariance matrix represents the correlation between the various characteristics of the historical data; performing eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors, wherein the eigenvalues represent the importance of each principal component and the eigenvector represents the direction of the principal component; calculating the variance contribution rate of the principal component corresponding to each eigenvalue based on the eigenvalues and the corresponding eigenvectors; based on the variance contribution rate of the principal component corresponding to each eigenvalue and the target cumulative variance contribution rate, selecting one or more target principal components to obtain the historical data after dimension reduction.
[0012] Optionally, based on the variance contribution rates of the principal components corresponding to the individual eigenvalues and the target cumulative variance contribution rates, one or more target principal components are selected to obtain the historical data after dimensionality reduction, including: sorting the individual eigenvalues in descending order of eigenvalue to obtain sorted eigenvalues; selecting the first K eigenvalues whose cumulative variance contribution rates exceed the target cumulative variance contribution rates during the sorting as the one or more selected target principal components; and projecting the standardized historical data onto the selected one or more target principal components to obtain the historical data after dimensionality reduction.
[0013] Optionally, before adopting the improved recurrent neural network (RNN) model to predict the short-term power load of the target power grid in the future based on the historical data after dimensionality reduction, the method also includes: forming an initial model based on a standard RNN model and a hidden Markov model, wherein the initial model includes an input layer, multiple hidden layers and an output layer, wherein there is a first weight matrix between the input layer and the first hidden layer among the multiple hidden layers, the first weight matrix is used to weight the features input by the input layer and then input them into the first hidden layer, there is a second weight matrix between the multiple hidden layers, the second weight matrix is used to weight the data transmitted between each hidden layer until the last hidden layer, there is a third weight matrix between the last hidden layer and the output layer, the third weight matrix is used to weight the data of the last hidden layer and then input them into the output layer; obtaining sample data, wherein the sample data includes: data of the area where the target power grid is located in the last three hours before the target time, data at the same time in the past three days, and data at the same time in the past three weeks; using the sample data to train the initial model to obtain the improved RNN model.
[0014] According to another aspect of the present invention, there is provided a power grid power load forecasting device, comprising: a collection module, for collecting historical data of a target power grid, wherein the historical data comprises: historical power load data of an area where the target power grid is located, meteorological information of an area where the target power grid is located, personnel information of an area where the target power grid is located, and holiday activity information of an area where the target power grid is located; a dimension reduction module, for reducing the dimension of the historical data by adopting a principal component analysis (PCA) method to obtain the historical data after dimension reduction; and a prediction module, for predicting the power load of the target power grid in a short period of time in the future based on the historical data after dimension reduction by adopting an improved model of a recurrent neural network (RNN), wherein the improved model of the recurrent neural network (RNN) is a model formed by combining a hidden Markov model with a standard RNN model, and the duration of the short period is less than one day.
[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned power grid power load forecasting methods.
[0016] According to another aspect of the present invention, there is provided an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes any one of the above-mentioned methods for predicting power load on a power grid when running.
[0017] According to another aspect of the present invention, there is provided a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of any one of the methods for predicting power load in a power grid are implemented.
[0018] In an embodiment of the present invention, a Recurrent Neural Network (RNN) is used to improve the model for prediction, and the historical data is reduced in dimension through Principal Component Analysis (PCA), so as to achieve the purpose of accurately predicting the power load of the power grid, thereby achieving the technical effect of improving the accuracy and stability of the power load prediction of the power grid, and further solving the technical problem of inaccurate and unstable power load prediction of the power grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0020] Figure 1 is a flow chart of a method for predicting power load of a power grid according to an embodiment of the present invention;
[0021] Figure 2 is a schematic diagram of a short-term load prediction method based on PCA and RNN according to an optional implementation manner of the present invention;
[0022] Figure 3 is a schematic diagram of an improved RNN model according to an optional implementation manner of the present invention;
[0023] Figure 4 It is a structural block diagram of a power grid power load prediction device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:
[0027] Principal Component Analysis (PCA) is a statistical method used to identify linear relationships between variables in a data set and simplify the data by reducing its dimensionality while retaining the original information and variability of the data as much as possible.
[0028] Recurrent Neural Network (RNN): is a neural network model specially designed to process data with time series dependencies. Unlike traditional feedforward neural networks, RNN has cyclic connections that allow information to be passed in the time dimension, which makes RNN particularly effective in processing sequence data (such as text, speech, time series analysis).
[0029] Hidden Markov Model (HMM): A statistical model used to describe a Markov process with hidden unknown parameters. HMM is based on the Markov process, that is, at any given time point, the state of the system depends only on the state at the previous time point, and does not depend on any earlier state. This assumption simplifies the model, making it easy to model and analyze.
[0030] With the increase in global energy demand and the emergence of climate change issues, the green transformation of energy systems has become a global consensus. The reliability, efficiency and environmental friendliness of power systems have received increasing attention. Especially in the field of power grid load forecasting, accurate forecasting of power grid load plays a vital role in ensuring stable operation of the power grid, optimizing power resource allocation and reducing carbon emissions. Among them, short-term power load forecasting, especially hourly power load forecasting, has an important impact on the operation of the power market, daily dispatching and emergency management of the power grid.
[0031] Related power load forecasting methods mostly rely on statistical learning techniques, such as autoregressive models, moving average models, etc. These methods perform well when dealing with linear relationships and relatively stable data. However, they are usually unable to effectively handle nonlinear relationships, high-dimensional inputs, and random fluctuations in time series, which limits their application in actual complex environments. For example, factors such as holidays, emergencies, and sudden changes in weather conditions can lead to a significant decrease in forecast accuracy.
[0032] With the rapid development of machine learning technology, prediction methods based on machine learning have begun to be widely used. Support Vector Machine (SVM), Artificial Neural Network (ANN), and other more advanced deep learning models (such as Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), etc.) have been used to process complex nonlinear patterns and high-dimensional data. These methods show good prediction accuracy in some cases and can adapt to different types of load changes.
[0033] However, current prediction methods based on machine learning still have some shortcomings. First, many models require a lot of computing resources when processing high-dimensional data, resulting in low computational efficiency. Second, these methods often require a large amount of labeled data for training, but in practice it is often difficult to obtain large-scale high-quality data. In addition, most models fail to fully consider the long-term dependencies and cyclical changes in time series data, which may affect the generalization ability of the model and the accuracy of the prediction.
[0034] Although some related studies have attempted to improve prediction accuracy through hybrid models and multi-model integration methods, these methods are highly complex and difficult to deploy and maintain in practice. In addition, they also ignore the interpretability of the model, which is very important for the transparency and credibility of power grid operation and management decisions.
[0035] In order to solve this problem, an embodiment of the present invention provides a method for predicting power grid power load, which improves the computational efficiency and interpretability of the model while maintaining prediction accuracy, takes into account the availability and quality of data, and is not only more efficient and flexible, but also pays attention to the effect of short-term prediction of power grid power load.
[0036] According to an embodiment of the present invention, an embodiment of a power grid power load forecasting method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0037] Figure 1 is a flow chart of a method for predicting power load of a power grid according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0038] Step S102, collecting historical data of the target power grid, wherein the historical data includes: historical power load data of the area where the target power grid is located, meteorological information of the area where the target power grid is located, personnel information of the area where the target power grid is located, and holiday activity information of the area where the target power grid is located.
[0039] As an optional embodiment, the execution subject of the method of this embodiment can be a terminal or server for predicting the power load of the power grid. When applied to the terminal, it can easily realize the prediction of the power load of the power grid. When applied to the server, it can call the rich computing resources of the server, and can more accurately predict the power load of the power grid. Among them, the types of the above-mentioned terminals can be various, for example, it can be a mobile terminal with certain computing capabilities, or it can be a fixed computer device with recognition capabilities, etc. The types of the above-mentioned servers can also be various, for example, it can be a local server or a virtual cloud server. According to the computing power, it can be a single computer device or a computer cluster integrated with multiple computer devices.
[0040] As an optional embodiment, when collecting historical data of the target power grid, multiple types of historical data can be collected. For example, historical power load data of the area where the target power grid is located, meteorological information of the area where the target power grid is located, personnel information of the area where the target power grid is located, and holiday activity information of the area where the target power grid is located. Among them, historical power load data refers to the record of the amount of power consumed by each load point or the entire power grid in the power system over a period of time (such as the past few years or months), recording the change of power demand over time, and can be collected at time intervals of hours, minutes or even shorter. Meteorological information refers to the historical records of various meteorological factors that can directly affect power demand, which may include temperature, precipitation, wind speed and direction, humidity, air pressure, sunshine intensity and sunshine hours, other weather conditions (such as sunny days, cloudy days, cloud cover), etc. Personnel information refers to population data or user behavior information related to power consumption, which may include but is not limited to: population density, user type, population activity pattern, user behavior. Holiday activity information refers to the marking of specific time points or time periods. The social activity level and energy consumption pattern during the above special time are different from other times, so special power loads will be generated. By collecting various types of historical data, the changing patterns of electricity demand can be reflected from multiple perspectives. Comprehensive analysis of these data can enable the forecasting model to more comprehensively understand the various factors affecting power load, thereby improving the accuracy and reliability of the forecast.
[0041] Step S104, using the principal component analysis (PCA) method to reduce the dimension of the historical data to obtain the historical data after dimension reduction.
[0042] As an optional embodiment, before the principal component analysis PCA method is used to reduce the dimension of the above historical data and obtain the reduced historical data, the historical data can also be cleaned. Among them, the historical data can be cleaned in a variety of ways, for example, processing missing values, eliminating outliers, data type conversion, data normalization, and data merging. To process missing values, specific values can be used to fill the missing values in the historical data, and the filling method can be mean filling, median filling, interpolation filling, etc. Eliminating outliers refers to eliminating observations that significantly deviate from other data points in the historical data, which may be caused by measurement errors, data entry errors, or real abnormal phenomena. Statistical methods (such as standard deviation, quartile range, etc.), model-based methods (such as isolation forests, local anomaly factors, etc.), and visualization methods (such as box plots, scatter plots) can be used to identify and eliminate outliers. Data type conversion involves converting data from one type to another, which can include the conversion between numerical data and categorical data, as well as the type conversion of date and time. Data normalization is to adjust the data to a unified scale, including unifying the dimensions of the same data. Data merging is the process of combining data from different data sources or related data sets to build more comprehensive and richer historical data. By cleaning the above historical data, the quality of the above historical data can be improved, making it neater and more consistent, thereby improving the efficiency of model training and the accuracy of prediction.
[0043] As an optional embodiment, before using the principal component analysis PCA method to reduce the dimension of the above historical data and obtaining the historical data after dimension reduction, the periodic information in the above historical data can also be converted into data that changes continuously with the cycle. Among them, the periodic information in the above historical data can be a variety of information data with periodic attributes contained in the above historical data, such as time (month, week, hour, etc.) in a time series. By converting the periodic information in the above historical data into data that changes continuously with the cycle, the originally discrete periodic variables can be converted into smoothly changing continuous values, and the maximum and minimum values in the originally discrete periodic variables can be connected, so as to avoid the prediction model from having a leap-like understanding when processing the periodic information in the above historical data, and prevent large data mutations from having a negative impact on model predictions.
[0044] As an optional embodiment, when performing periodic conversion on the periodic information in the above historical data and converting it into data that changes continuously with the period, a variety of methods can be used. For example, sine or cosine conversion, fractional conversion, cyclic embedding, custom function conversion, etc. Among them, the sine conversion uses a sine function to perform periodic conversion on the periodic information in the above historical data to obtain time series data that changes continuously with the period. The sine conversion converts the periodic information in the above historical data into sine values, so that the prediction model can capture the volatility of the periodic data. In the case where the above historical data includes time series data, the following sine function is used to perform periodic conversion on the above time series data to obtain time series data that changes continuously with the period:
[0045]
[0046] Among them, Y sin is the sine value of the time point in the time series data after conversion, representing the periodic properties of the original time series data; Y is the periodic time series data to be converted, Y max is the maximum value of the time series data to be converted.
[0047] As an optional embodiment, when adopting the principal component analysis (PCA) method to reduce the dimension of the above-mentioned historical data to obtain the historical data after dimension reduction, the above-mentioned historical data can be first standardized so that the mean value of the characteristics of the above-mentioned historical data is 1 and the standard deviation is 1 to obtain the standardized historical data; the covariance matrix of the above-mentioned standardized historical data is calculated, wherein the above-mentioned covariance matrix represents the correlation between the various characteristics of the above-mentioned historical data; the above-mentioned covariance matrix is subjected to eigenvalue decomposition to obtain eigenvalues and corresponding eigenvectors, wherein the above-mentioned eigenvalues represent the importance of each principal component, and the above-mentioned eigenvector represents the direction of the principal component; based on the above-mentioned eigenvalues and the corresponding eigenvectors, the variance contribution rate of the principal component corresponding to each eigenvalue is calculated; based on the variance contribution rate of the principal component corresponding to each eigenvalue and the target cumulative variance contribution rate, one or more target principal components are selected to obtain the historical data after dimension reduction. Among them, when standardizing the historical data after dimensionality reduction, a variety of standardization methods can be used, for example, minimum-maximum standardization, by calculating the maximum and minimum values of each data, scaling the data according to the ratio, so that all data fluctuate within the same range; Z-Score standardization, converting the data into a standard normal distribution, that is, the mean is 0 and the standard deviation is 1, thereby eliminating the dimension effect of the data; decimal calibration normalization, scaling the data by moving the decimal point position, and finding a minimum interval so that the absolute values of all data are within the interval. By calculating the covariance matrix of the historical data after the above standardization and performing feature decomposition, the correlation between the various features of the historical data, the importance and direction of the various principal components of the historical data can be obtained, and then the variance contribution rate of the various principal components of the historical data can be obtained, that is, the contribution rate of each principal component to the historical data. Through PCA dimensionality reduction, not only the historical data is simplified, but also the data after dimensionality reduction is ensured to retain the main trend and pattern of the historical data, which can speed up the calculation and maintain the accuracy of the calculation results.
[0048] As an optional embodiment, when selecting one or more target principal components based on the variance contribution rate and target cumulative variance contribution rate of the principal components corresponding to the above-mentioned eigenvalues, and obtaining the above-mentioned historical data after dimensionality reduction, a variety of methods can be used. For example, a fixed cumulative variance contribution rate can be used for selection: sort the above-mentioned eigenvalues in order from large to small, and obtain the sorted eigenvalues; select the first K eigenvalues whose cumulative variance contribution rate exceeds the above-mentioned target cumulative variance contribution rate in the sorting as the above-mentioned one or more target principal components selected; project the standardized historical data onto the above-mentioned one or more target principal components selected to obtain the above-mentioned historical data after dimensionality reduction. For another example, the selection can be made directly according to the eigenvalue sorting, and the eigenvalues greater than the target eigenvalue threshold and the corresponding principal components can be selected. The variance contribution rate chart of the principal component, i.e., the elbow chart, can also be observed, and the principal component before the elbow of the curve (the point where the variance contribution rate begins to flatten). Among them, the selection method of fixed cumulative variance contribution rate can ensure that most of the information in the original data set is retained while removing data redundancy and noise. By setting the target cumulative variance contribution rate, the principal component that can explain most of the data variance can be selected, thereby enhancing the interpretability of the model.
[0049] Step S106, using the improved recurrent neural network RNN model, based on the above-mentioned historical data after dimensionality reduction, predict the future short-term power load of the above-mentioned target power grid, wherein the improved recurrent neural network RNN model is a model formed by combining the hidden Markov model on the basis of the standard RNN model, and the duration of the above-mentioned short-term is less than one day.
[0050] As an optional embodiment, before adopting the RNN improved model to predict the future short-term power load of the above-mentioned target power grid based on the above-mentioned historical data after dimensionality reduction, an initial model can be formed based on the standard RNN model and the hidden Markov model, wherein the above-mentioned initial model includes an input layer, multiple hidden layers and an output layer, wherein there is a first weight matrix between the above-mentioned input layer and the first hidden layer among the above-mentioned multiple hidden layers, and the above-mentioned first weight matrix is used to weight the features input by the above-mentioned input layer and then input them into the above-mentioned first hidden layer, and there is a second weight matrix between the above-mentioned multiple hidden layers, and the above-mentioned second weight matrix is used to weight the data transmitted between each hidden layer until the last hidden layer, and there is a third weight matrix between the above-mentioned last hidden layer and the above-mentioned output layer, and the above-mentioned third weight matrix is used to weight the data of the above-mentioned last hidden layer and then input it into the above-mentioned output layer; obtain sample data, wherein the above-mentioned sample data includes: data of the area where the above-mentioned target power grid is located in the last three hours before the target time, data at the same time in the past three days, and data at the same time in the past three weeks; use the above-mentioned sample data to train the above-mentioned initial model to obtain the above-mentioned RNN improved model. Therefore, the above-mentioned RNN improved model includes an input layer, multiple hidden layers and an output layer. There is a weight matrix between each layer, which is used to weight the output of the previous network layer and transmit it to the next network layer. Through the above-mentioned RNN improved model and the weight matrix contained in the RNN improved model, the importance of each input feature and how each input feature interacts with the hidden layer of the model can be quantified, so that the model can automatically learn which features are more important for the prediction target, thereby optimizing the prediction results. Among them, the hidden layer not only receives information from the input layer, but also receives the hidden state of the previous moment. Combining the current input and the state of the previous moment, it can capture the long-term dependency in the time series, and then process the impact of historical data on the current load.
[0051] As an optional embodiment, before using the RNN improved model to predict the short-term power load of the above-mentioned target power grid in the future based on the historical data after the above-mentioned dimension reduction, the RNN improved model can also be trained in a variety of ways. For example, the time series sliding window method is used to divide the historical data into a fixed-length input sequence and a corresponding output sequence to form multiple training samples; batch training, the data set is divided into multiple small batches, and the data of each batch is used to update the model parameters; random gradient descent, only one sample is used for parameter update each time to improve the calculation speed; regularization training, add regularization terms in the loss function, such as L1 or L2 regularization, to limit the size of the model parameters and prevent overfitting. One or more of the above-mentioned training methods can also be combined to train the RNN improved model together. For example, the data of the area where the above-mentioned target power grid is located in the last three hours before the target time, the data at the same time in the past three days, and the data at the same time in the past three weeks can be used as sample data to train the RNN improved model.
[0052] Through the above steps, when predicting the power load of the power grid, a variety of historical data are used as input, so that the prediction can comprehensively consider various factors affecting the power load and improve the accuracy and stability of the prediction; the PCA method is used to reduce the dimension of the historical data to ensure that the amount of retained information is sufficient to support the prediction accuracy while minimizing the computational burden and overfitting risk; the periodic transformation is also used to enhance the model's sensitivity to time series characteristics, making it more accurate in capturing load cycle fluctuations; finally, the RNN improved model combining RNN and hidden Markov model is used for prediction, which can combine the advantages of RNN to fully utilize past information and the advantages of hidden Markov model state transition, thereby improving the accuracy and stability of the prediction.
[0053] In combination with the above embodiments and optional embodiments, an optional implementation is provided. In this optional implementation, a short-term load prediction method based on PCA and RNN is provided. Its core technology is to use PCA to reduce the dimension of data and RNN to realize load prediction. This method can automatically and accurately predict the load of the reduced-dimensional input data, predict the load data by building an RNN model, and then optimize the neural network parameters through adaptive moment estimation (ADAM) to improve the prediction accuracy and generalization ability of the model. Figure 2 is a schematic diagram of a short-term load prediction method based on PCA and RNN according to an optional implementation mode of the present invention, such as Figure 2 As shown, the method includes the following processing.
[0054] S1, data acquisition and cleaning.
[0055] Before short-term load forecasting, it is necessary to first collect the required training data such as load data, meteorological data, and personnel data at the location of the load to be measured from multiple data sources, including historical load power data, temperature data, precipitation data, real-time population information at the location, and special information of the date, such as holidays and major events, and mark them. Then clean the collected data, such as processing missing values, removing outliers, converting data types, normalizing data, and merging data, to ensure high-quality training data, and provide a data basis for the subsequent principal component selection and model training.
[0056] S2, feature engineering.
[0057] After collecting data, in order to improve the prediction accuracy of the model and reduce the complexity of the model, the following steps are specifically included.
[0058] S21, data normalization operation. To ensure data consistency and reduce model bias, the minimum-maximum normalization is used for data normalization. The expression is as follows:
[0059]
[0060] Where X is the original data point; X min , X max are the maximum and minimum values in the original data respectively; X norm is the normalized data point.
[0061] Scaling all data points to between 0 and 1 helps maintain the relative relationship between the data. This process can also effectively avoid inefficient or unstable model training caused by large differences in variable scales.
[0062] S22, data periodic transformation. In order for the model to better understand and utilize the periodic characteristics in the data, it is necessary to perform periodic transformation on the periodic variables (such as hours and months) in the time series. This can be achieved using the sine function, as shown below:
[0063]
[0064] Where Y sin is the converted sine value of the data point, representing the periodic property of the original data; Y is the periodic data to be converted, such as time, month, etc.; Y max The maximum value of the data to be converted, such as 23h, 12 months, etc.
[0065] S23, data principal component selection. In order to reduce the data dimension, reduce the model complexity and the possibility of overfitting, PCA technology is used to reduce the data dimension. First, the data is standardized so that the mean of each feature is 1 and the standard deviation is 1. The expression is as follows:
[0066]
[0067] In the formula, Z i is the standardized eigenvalue; X i is the eigenvalue; μ is the mean of the original data; σ is the standard deviation of the original data.
[0068] After standardization, the covariance matrix of the data is calculated to understand the correlation between the various features. The mathematical expression for calculating the covariance matrix is as follows:
[0069]
[0070] In the formula, Z Cov is the covariance matrix to be determined; Z is the standardized data matrix; n is the number of samples.
[0071] Then perform eigenvalue decomposition on the covariance matrix to obtain the eigenvalues and corresponding eigenvectors. The eigenvalues represent the importance of each principal component, and the eigenvectors represent the direction of the principal component. The mathematical expressions are as follows:
[0072] Z Cov ·v=λ·v
[0073] Where v is the eigenvector to be determined, and λ is the eigenvalue to be determined.
[0074] After obtaining the eigenvalues and eigenvectors of the covariance matrix, they are sorted from large to small by eigenvalue. The eigenvalue reflects the variance that the corresponding eigenvector (principal component) can explain. The larger the eigenvalue, the greater the variability of the principal component in the data, and the greater its role. The mathematical expression for calculating the variance contribution rate of each principal component is as follows:
[0075]
[0076] Where V i is the variance contribution rate of principal component i; i is the eigenvalue of the ith principal component. The variance contribution rate indicates the proportion of each principal component in all principal components.
[0077] In order to select the appropriate number of principal components, the cumulative variance contribution rate can be calculated. The cumulative variance contribution rate refers to the sum of the variance contributions of the first k principal components, that is, the prefix sum of the variance contributions, and its mathematical expression is as follows:
[0078]
[0079] Where V Σ,k is the cumulative variance contribution of the first k principal components. This can help determine whether the selected principal components can explain enough data variability.
[0080] After calculating the principal components, the cumulative variance threshold can be used to select the principal components, that is, the first k principal components whose cumulative variance contribution rate reaches a certain threshold are selected. The threshold can be set to 80% or 90%. Then the standardized data is projected onto the selected principal components to obtain the reduced dimensionality data, which can be achieved through matrix multiplication. The mathematical expression is as follows:
[0081] Y=Z·W
[0082] Where Y is the data point after dimensionality reduction; W is the matrix composed of the eigenvectors corresponding to the selected principal components.
[0083] After the above linear transformation, the data is mapped from high-dimensional space to low-dimensional space, while retaining as much variability of the original data as possible.
[0084] S3, build RNN improved model.
[0085] Figure 3 is a schematic diagram of an improved RNN model according to an optional implementation mode of the present invention, such as Figure 3 As shown. First, the input data enters the network and is passed to the weight matrix W connecting the input layer and the hidden layer. ax .W ax The input matrix is weighted to help the network learn the relationship between the input features and the hidden layer state. At the same time, the activation state of the hidden neurons at the previous moment is also introduced, and the weight matrix W between the hidden layers is connected. aa The state information of the previous moment is passed to the current moment. The purpose of this is to enable the network to capture the historical information in the time series and give it a memory function. ax After weighted processing, the activation state of the hidden layer at the previous moment is W aa The weighted processing result and the bias parameter B of the hidden layer a It is sent to the addition operation node, which summarizes this information and outputs it to the tanh activation function, mapping the result to between -1 and 1, so that the hidden layer output has nonlinear expression ability. This step generates the hidden layer state at the current moment. Then, after the hidden layer state is activated by tanh, it is passed to the weight matrix W connecting the hidden layer and the output layer. ya , after weighting, we get a new value, which is combined with the bias parameter B of the output layer y They all enter an addition node and are summarized to get the input value of the output layer. Finally, the output result of the addition node is passed to the Sigmoid activation function and then output.
[0086] S4, use the built RNN improved model to learn the data processed by feature engineering.
[0087] S41, model initialization. First, define the basic structure of the model, including the input layer, RNN layer, and output layer. The number of nodes in the input layer should be the same as the number of features after dimensionality reduction. The RNN layer selects the standard RNN unit as the unit type, and sets the appropriate number of hidden layers and neurons to enhance the learning ability of the model.
[0088] S42, set hyperparameters. Select the hyperparameters of the model, including learning rate α, batch size, number of training rounds, etc. Set an initial reasonable learning rate through cross-validation.
[0089] S43, define the loss function. Select a suitable loss function to evaluate the prediction effect of the model. The mean square error (MSE) can be used as the loss function. The mathematical expression is as follows:
[0090]
[0091] Where: L is the loss function; y i , are the true value and predicted value of the sample respectively.
[0092] S44, set the optimization algorithm. Select the Adam optimization algorithm for model training. This is an adaptive learning rate optimization algorithm that combines the advantages of the momentum method and root mean square propagation. It can accelerate convergence and improve training results. The main idea is to dynamically adjust the learning rate of each parameter through the first-order moment (the average value of the gradient) and the second-order moment (the average value of the square of the gradient). First, initialize and set the initial learning rate a, the first-order momentum estimate b1, and the second-order momentum estimate b2. Then calculate the gradient of the loss function to the parameter to be optimized. After obtaining the gradient, the momentum is updated using the gradient value. The mathematical expression is as follows:
[0093]
[0094] Where: m t 、v t are the first-order moment and second-order moment calculated in the t-th round of iterations.
[0095] Then eliminate the deviation caused by momentum estimation and perform deviation correction. The mathematical expression is as follows:
[0096]
[0097] Where: They are the first-order moment and second-order moment corrected after the t-th iteration.
[0098] Then update the hyperparameters to be optimized, and its mathematical expression is as follows:
[0099]
[0100] In the formula, ε is a small positive constant, such as 1e-9, which prevents the fraction from being divided by 0.
[0101] S45, use the training data to train the model. First, divide the data into five groups of non-identical training sets and validation sets, perform 5-fold cross-validation, update the model parameters, and determine an initial parameter. Then continue to train the RNN to improve the model, and use Adam to optimize the model parameters. After each round of training, evaluate the performance of the model on the validation set, and record the loss value to monitor the training process and avoid overfitting. After the training is completed, use the test set data to evaluate the model performance and calculate the prediction accuracy indicators, such as the root mean square error (RMSE) and the mean absolute error (MAE). The mathematical expression is as follows:
[0102]
[0103] According to the optimal hyperparameters obtained by Adam optimization, the RNN is trained to improve the model, the prediction results of the model are compared with the true values, the prediction performance is analyzed, and the prediction model is obtained.
[0104] S5, predicting the data to be tested based on the trained RNN improved model. First, the independent variable data of the test point (such as meteorological data, load data of the previous period, etc.) is cleaned and feature-engineered, and then the above RNN improved model is used for prediction.
[0105] The accuracy and efficiency of power grid load forecasting are improved through advantages in data input, feature engineering and model construction. In terms of data input, by considering the influence of the load data in the first three hours, the data in the same hour in the first three days and the data in the same hour in the first three weeks, the forecasting model can correctly capture the diversity of time resolution. In terms of feature engineering, PCA significantly enhances the expressiveness of the forecasting model for input data. By extracting the main features in the load data, reducing the dimension of the data, removing noise and irrelevant features, the model complexity can be simplified and the computational efficiency can be improved. Especially when facing large-scale data, it can still maintain a high level of forecasting accuracy and stability. At the same time, simplifying the data can reduce the possibility of model overfitting and improve the generalization ability and forecasting accuracy of the model. In addition, the sensitivity of the model to time series characteristics can be enhanced through periodic transformation, making it more accurate in capturing load cycle fluctuations and suitable for the characteristics of power load forecasting data. In terms of model construction, RNN is combined with hidden Markov model to form an RNN improved model to improve the forecasting performance. The recursive structure effectively captures the time series characteristics of load data and enhances the adaptability of the model to historical load patterns. RNN can make full use of past information and gradually improve the accuracy of prediction results through iterative optimization, thereby achieving more precise power load forecasting. Hidden Markov model has the advantage of state transfer, which can not only improve the accuracy of prediction, but also significantly enhance the stability of power load forecasting, and provide efficient and reliable decision support for load forecasting of power systems. Through the innovative combination of feature engineering and model construction, the accuracy and efficiency of short-term load forecasting and resource scheduling in power systems can be effectively improved, which is suitable for load forecasting scenarios of power systems with large demand fluctuations and complex data. It can not only better cope with the needs of real-time load forecasting, but also show good application prospects in power demand optimization and resource scheduling configuration, providing comprehensive and stable decision support for power management systems.
[0106] According to an embodiment of the present invention, a power grid power load prediction device is provided. Figure 4 is a structural block diagram of a power grid power load prediction device according to an embodiment of the present invention. Figure 4 As shown, the device includes: a collection module 402, a dimension reduction module 404, and a prediction module 406. The device is described below.
[0107] An acquisition module 402 is used to acquire historical data of a target power grid, wherein the historical data includes: historical power load data of the area where the target power grid is located, meteorological information of the area where the target power grid is located, personnel information of the area where the target power grid is located, and holiday activity information of the area where the target power grid is located; a dimension reduction module 406 is connected to the acquisition module 402, and is used to reduce the dimension of the historical data using a principal component analysis (PCA) method to obtain the reduced-dimensional historical data; a prediction module 406 is connected to the dimension reduction module 406, and is used to use a recurrent neural network (RNN) improved model to predict the power load of the target power grid in the future for a short period of time based on the reduced-dimensional historical data, wherein the recurrent neural network (RNN) improved model is a model formed by combining a standard RNN model with a hidden Markov model, and the duration of the short period is less than one day.
[0108] It should be noted here that the above-mentioned acquisition module 402, dimensionality reduction module 404, and prediction module 406 correspond to steps S102 to S106 in the embodiment, and the instances and application scenarios implemented by multiple modules and corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiments.
[0109] As an optional embodiment, the device further includes: a cleaning module, wherein the cleaning module is used to perform at least one of the following cleaning operations on the historical data: processing missing values, removing abnormal values, data type conversion, data normalization, and data merging.
[0110] As an optional embodiment, the device further comprises: a conversion module, wherein the conversion module is used to perform periodic conversion on the periodic information in the historical data, and convert the periodic information into data that changes continuously with the period.
[0111] As an optional embodiment, the conversion module includes: a conversion unit. The conversion unit is used to use the following sine function to periodically convert the time series data when the historical data includes time series data, so as to obtain time series data that changes continuously with the period:
[0112]
[0113] Among them, Y sin is the sine value of the time point in the time series data after conversion, representing the periodic properties of the original time series data; Y is the periodic time series data to be converted, Y max is the maximum value of the time series data to be converted.
[0114] As an optional embodiment, the dimensionality reduction module 404 includes: a standardization unit, a first calculation unit, a decomposition unit, a second calculation unit and a selection unit. The standardization unit is used to standardize the historical data so that the mean value of the features of the historical data is 1 and the standard deviation is 1, thereby obtaining the standardized historical data; the first calculation unit is connected to the standardization unit and is used to calculate the covariance matrix of the standardized historical data, wherein the covariance matrix represents the correlation between the various features of the historical data; the decomposition unit is connected to the first calculation unit and is used to perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors, wherein the eigenvalues represent the importance of each principal component and the eigenvector represents the direction of the principal component; the second calculation unit is connected to the decomposition unit and is used to calculate the variance contribution rate of the principal component corresponding to each eigenvalue according to the eigenvalue and the corresponding eigenvector; the selection unit is connected to the second calculation unit and is used to select one or more target principal components based on the variance contribution rate of the principal component corresponding to each eigenvalue and the target cumulative variance contribution rate, thereby obtaining the historical data after dimensionality reduction.
[0115] As an optional embodiment, the selection unit includes: a sorting subunit, a selection subunit and a projection subunit. The sorting subunit is used to sort the eigenvalues in descending order to obtain the sorted eigenvalues; the selection subunit is connected to the sorting subunit to select the first K eigenvalues whose cumulative variance contribution rate exceeds the target cumulative variance contribution rate in the sorting as the selected one or more target principal components; the projection subunit is connected to the selection subunit to project the standardized historical data onto the selected one or more target principal components to obtain the reduced-dimensional historical data.
[0116] As an optional embodiment, the above-mentioned device also includes: a forming module, an acquiring module and a training module. The formation module is used to form an initial model based on a standard RNN model and a hidden Markov model, wherein the initial model includes an input layer, multiple hidden layers and an output layer, wherein a first weight matrix exists between the input layer and the first hidden layer among the multiple hidden layers, and the first weight matrix is used to weight the features input from the input layer and then input them into the first hidden layer, a second weight matrix exists between the multiple hidden layers, and the second weight matrix is used to weight the data transmitted between the hidden layers until the last hidden layer, and a third weight matrix exists between the last hidden layer and the output layer, and the third weight matrix is used to weight the data of the last hidden layer and then input them into the output layer; the acquisition module is connected to the formation module and is used to acquire sample data, wherein the sample data includes: data of the target power grid area in the last three hours before the target time, data at the same time in the past three days, and data at the same time in the past three weeks; the training module is connected to the acquisition module and is used to train the initial model using the sample data to obtain the RNN improved model.
[0117] According to an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned power grid power load forecasting methods.
[0118] According to an embodiment of the present invention, an electronic device is provided, comprising: a memory storing an executable program; and a processor for running the program, wherein when the program is running, any one of the above-mentioned methods for predicting power load on a power grid is executed.
[0119] According to an embodiment of the present invention, a computer program product is provided, including a computer program, wherein the computer program implements the steps of any one of the above methods when executed by a processor.
[0120] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0121] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0122] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0124] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or 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, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0126] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for predicting power load of a power grid, characterized in that: include: Collecting historical data of the target power grid, wherein the historical data includes: historical power load data of the area where the target power grid is located, meteorological information of the area where the target power grid is located, personnel information of the area where the target power grid is located, and holiday activity information of the area where the target power grid is located; Using a principal component analysis (PCA) method to reduce the dimension of the historical data, and obtain the historical data after dimension reduction; An improved recurrent neural network (RNN) model is used to predict the short-term power load of the target power grid in the future based on the reduced-dimensional historical data, wherein the improved recurrent neural network (RNN) model is a model formed by combining a hidden Markov model with a standard RNN model, and the short-term duration is less than one day.
2. The method according to claim 1, characterized in that Before the historical data is reduced in dimension by using the principal component analysis (PCA) method to obtain the reduced-dimensional historical data, the method further includes: The historical data is cleaned by at least one of the following: processing missing values, removing outliers, data type conversion, data normalization, and data merging.
3. The method according to claim 1, characterized in that Before the historical data is reduced in dimension by using the principal component analysis (PCA) method to obtain the reduced-dimensional historical data, the method further includes: The periodic information in the historical data is periodically converted into data that changes continuously with the period.
4. The method according to claim 3, characterized in that The periodic conversion of the periodic information in the historical data into data that changes continuously with the period includes: When the historical data includes time series data, the following sine function is used to perform periodic conversion on the time series data to obtain time series data that changes continuously with the period: Among them, Y sin is the sine value of the time point in the time series data after conversion, representing the periodic properties of the original time series data; Y is the periodic time series data to be converted, Y max is the maximum value of the time series data to be converted.
5. The method according to claim 1, characterized in that: The PCA method is used to reduce the dimension of the historical data to obtain the reduced-dimensional historical data, including: Standardizing the historical data so that the mean value of the characteristics of the historical data is 1 and the standard deviation is 1, thereby obtaining standardized historical data; Calculating a covariance matrix of the standardized historical data, wherein the covariance matrix represents the correlation between various features of the historical data; Performing eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors, wherein the eigenvalues represent the importance of each principal component, and the eigenvectors represent the directions of the principal components; According to the eigenvalues and the corresponding eigenvectors, the variance contribution rate of the principal component corresponding to each eigenvalue is calculated; Based on the variance contribution rate of the principal component corresponding to each eigenvalue and the target cumulative variance contribution rate, one or more target principal components are selected to obtain the historical data after dimensionality reduction.
6. The method according to claim 5, characterized in that The step of selecting one or more target principal components based on the variance contribution rates of the principal components corresponding to the respective eigenvalues and the target cumulative variance contribution rates to obtain the historical data after dimensionality reduction includes: Sorting the eigenvalues in descending order of eigenvalues to obtain sorted eigenvalues; In the selection sorting, the first K eigenvalues whose cumulative variance contribution rates exceed the target cumulative variance contribution rates are selected as the one or more target principal components; The standardized historical data is projected onto the selected one or more target principal components to obtain the historical data after dimensionality reduction.
7. The method according to claim 1, characterized in that Before adopting the recurrent neural network (RNN) improved model to predict the short-term power load of the target power grid in the future based on the historical data after dimension reduction, the method further includes: Based on the standard RNN model and the hidden Markov model, an initial model is formed, wherein the initial model includes an input layer, multiple hidden layers and an output layer, wherein there is a first weight matrix between the input layer and the first hidden layer among the multiple hidden layers, the first weight matrix is used to perform weighted processing on the features inputted by the input layer and then input them into the first hidden layer, there is a second weight matrix between the multiple hidden layers, the second weight matrix is used to perform weighted processing on the data transmitted between the various hidden layers until the last hidden layer, there is a third weight matrix between the last hidden layer and the output layer, the third weight matrix is used to perform weighted processing on the data of the last hidden layer and then input them into the output layer; Acquire sample data, wherein the sample data includes: data of the target power grid area in the latest three hours before the target time, data of the same time in the past three days, and data of the same time in the past three weeks; The sample data is used to train the initial model to obtain the RNN improved model.
8. A power grid load forecasting device, characterized in that: include: A collection module, used for collecting historical data of the target power grid, wherein the historical data includes: historical power load data of the area where the target power grid is located, meteorological information of the area where the target power grid is located, personnel information of the area where the target power grid is located, and holiday activity information of the area where the target power grid is located; A dimension reduction module is used to reduce the dimension of the historical data by using a principal component analysis (PCA) method to obtain the historical data after dimension reduction; A prediction module is used to use a recurrent neural network (RNN) improved model to predict the power load of the target power grid in the short term in the future based on the historical data after dimensionality reduction, wherein the recurrent neural network (RNN) improved model is a model formed by combining a hidden Markov model on the basis of a standard RNN model, and the duration of the short term is less than one day.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the power grid power load forecasting method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program, when running, executes the power grid power load forecasting method described in any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Time sequence load data enhanced generation method and device based on hidden Markov model
CN121598090A