Photovoltaic power generation capacity short-term prediction method based on optimized random forest
By optimizing the random forest algorithm, combined with influence factor screening and Bayesian optimization, the problems of high computational complexity and low accuracy in short-term prediction of photovoltaic power generation are solved, and efficient and accurate photovoltaic power generation prediction is achieved, which is suitable for photovoltaic power generation systems. dispatch planning.
Patent Information
- Application Number
- CN202410839459.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-10-01
AI Technical Summary
Existing short-term prediction methods for photovoltaic power generation have problems such as heavy workload and low prediction accuracy. In particular, the artificial intelligence algorithm considers fewer meteorological factors, resulting in slow operation speed and low prediction accuracy.
A short-term prediction method for photovoltaic power generation based on optimized random forest is adopted. The random forest algorithm is optimized through influencing factor screening and Bayesian optimization to reduce computational complexity and improve prediction accuracy. Specific steps include data preprocessing, influencing factor screening, establishing hyperparameter optimization-random forest model, model training and evaluation, and finally generating the optimal prediction model for prediction.
It improves the accuracy and calculation speed of photovoltaic power generation prediction, avoids errors caused by manual setting of parameters, enhances the accuracy and practicality of prediction, and is suitable for the dispatch planning of photovoltaic power generation systems.
Smart Images

Figure CN118735055A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic power generation, and in particular to a short-term prediction method for photovoltaic power generation based on optimized random forest. Background Art
[0002] Since photovoltaic power generation is affected by factors such as sunlight intensity and climate, it has strong volatility, randomness, and uncontrollability. Especially after being connected to the grid, it will directly affect the stability and security of the power grid. Accurate prediction of photovoltaic power generation is the key to achieving smooth grid connection of photovoltaic power stations.
[0003] The short-term forecast of photovoltaic power generation refers to the forecast for the next 1h to 7d from the prediction time. At present, the prediction methods of photovoltaic power generation mainly include physical methods, deep statistical methods, artificial intelligence algorithms and combined methods, and artificial intelligence algorithms include machine learning and deep learning. However, the existing physical methods and deep statistical methods have a large workload and low prediction accuracy; artificial intelligence prediction methods often consider fewer influencing factors such as meteorological factors, and some parameters need to be set manually, which is prone to problems such as slow operation speed and low prediction accuracy. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a short-term prediction method for photovoltaic power generation based on optimized random forest, which optimizes the random forest algorithm through influencing factor screening and Bayesian optimization, thereby shortening the operation time of the photovoltaic power generation prediction model and improving the prediction accuracy.
[0005] The present invention discloses a short-term prediction method for photovoltaic power generation based on optimized random forest, comprising:
[0006] Step 1: Determine the prediction step size, obtain the original data set, and preprocess the original data set to obtain the preprocessed data set;
[0007] Step 2: Screen the influencing factors in the preprocessed data set, remove unimportant influencing factors, and generate a feature data set;
[0008] Step 3: Establish a prediction model based on hyperparameter optimization-random forest algorithm;
[0009] Step 4: Divide the feature data set into a training set and a test set, and use the training set to train the prediction model;
[0010] Step 5: Perform regression analysis on the test set based on the trained prediction model, compare the difference between the output result and the real data and evaluate it. After the evaluation is passed, the optimal prediction model is obtained;
[0011] Step 6: Collect future data including meteorological data and input it into the optimal prediction model to obtain the predicted photovoltaic power generation.
[0012] As a further improvement of the present invention, in step 1, the prediction step is natural day or hour, and the original data set includes at least historical power generation data and meteorological data, and the meteorological data includes at least weather, light intensity, precipitation, temperature, humidity, wind direction, wind speed and cloud cover.
[0013] As a further improvement of the present invention, in step 1, the specific operations of preprocessing the original data set are: removing outliers and converting them into missing values; filling in missing values; and standardizing continuous variables.
[0014] As a further improvement of the present invention, in step 2, the method for screening influencing factors is: using variance analysis to capture the linear relationship between the influencing factors and the power generation, removing unimportant influencing factors according to the F value and the P value, and generating a characteristic data set.
[0015] As a further improvement of the present invention, the smaller the F value of a certain influencing factor and the larger the P value, the more inclined to remove the influencing factor.
[0016] As a further improvement of the present invention, in step 3, the hyperparameter optimization method is Bayesian optimization.
[0017] As a further improvement of the present invention, the optimization target of Bayesian optimization is the number of random forest decision trees and the number of features selected by the decision trees.
[0018] As a further improvement of the present invention, in step 4, the division ratio of the training set and the test set is 8:2, and the input of the model during training includes meteorological data, and the input of the model is power generation data.
[0019] As a further improvement of the present invention, in step 5, the evaluation index of the evaluation includes:
[0020] (1) Mean Square Error (MSE):
[0021]
[0022] (2) Root mean square error RMSE:
[0023]
[0024] (3) Mean absolute error (MAE):
[0025]
[0026] (4) Coefficient of determination R 2 :
[0027]
[0028] In the formula, y i is the true value, is the predicted value, is the average value.
[0029] As a further improvement of the present invention, when MSE, RMSE, and MAE are less than their respective preset thresholds, and R 2 When it is greater than the preset threshold and less than 1, the trained prediction model has passed the evaluation and is used as the optimal prediction model. The smaller the MSE, RMSE, and MAE, the closer the R2 is to 1, indicating that the model has a lower error, a higher stability, and a better degree of fit.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] The present invention takes into account the influence of multiple factors such as meteorological factors and time series, and reduces the dimension of the influencing factors, thereby reducing the calculation complexity, improving the calculation speed, and avoiding the errors that may be caused by manually specifying algorithm parameters. It has high prediction accuracy and strong practicality, which is conducive to the scheduling plan of photovoltaic power generation systems in advance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 The present invention discloses a flow chart of a method for short-term prediction of photovoltaic power generation based on optimized random forest. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] The present invention is further described in detail below in conjunction with the accompanying drawings:
[0035] like Figure 1 As shown, the present invention provides a short-term prediction method for photovoltaic power generation based on optimized random forest, comprising the following steps:
[0036] S1. Determine the prediction step size and obtain the original data set D N1 , and the original data set D N1 After preprocessing, we get the preprocessed data set D N2 ;in,
[0037] The prediction step is in natural days or hours.
[0038] Data samples are collected according to typical weather days, and the data samples should correspond to the prediction step size; typical weather days include at least sunny days, cloudy days, and rainy days. A data sample should include a power generation data and corresponding meteorological data, etc. Optionally, in order to consider as many meteorological conditions as possible and improve the accuracy of the prediction model, the power generation data for every natural day in the past year or every 1 hour in the past 3 months can be extracted. Meteorological data may include variables such as season, weather, radiation intensity, temperature, rainfall, wind direction, wind speed, board temperature, visibility, and cloud cover. Among them, discrete variables can be represented by different numbers according to the classification situation; for example, discrete variables such as season, weather, and wind direction can be represented by different numbers according to the classification situation. When the wind direction is divided into east, south, west, and north, numbers 1 to 4 can be used to represent it. When the wind direction is divided into east, west, south, north, southeast, northeast, southwest, and northwest, numbers 1 to 8 can be used to represent it. It should be noted that the above numbers only represent the classification type and are not real numbers. The value of a continuous variable is a real number within a certain range. The continuous variable can also be changed into a discrete variable according to the actual situation.
[0039] Original dataset D N1 The data samples in may contain abnormal values or missing values, so they need to be preprocessed first. The preprocessed data set is the preprocessed data set D N2 Among them, the data preprocessing methods include outlier removal, converting them into missing values, missing value filling, and continuous variable standardization. Furthermore, outlier removal can use methods such as the 3 sigma principle or box plots; missing value filling can use methods such as linear interpolation or cluster filling; standardization can use z-score standardization.
[0040] S2. Preprocess the data set D N2 The influencing factors in the dataset are screened and unimportant influencing factors are removed to generate the feature dataset D N3 ;in,
[0041] The linear relationship between the influencing factors and power generation is captured by variance analysis (F test), and unimportant influencing factors are removed according to the F value and P value. The smaller the F value of a certain influencing factor and the larger the P value, the more inclined to remove the influencing factor. Furthermore, the F test classification is performed on discrete variables, and the F test regression is performed on continuous variables.
[0042] S3. Establish a prediction model based on hyperparameter optimization-random forest algorithm; wherein,
[0043] The hyperparameter optimization method is Bayesian optimization, and the optimization target is the number of random forest decision trees and the number of features selected by the decision trees; further, the root mean square error is used as the control function to find the optimal combination of hyperparameters.
[0044] S4. The feature dataset DN3 The training set and the test set are divided, and the prediction model is trained using the training set; the division ratio of the training set and the test set is 8:2. During training, the input of the model includes meteorological data, and the input of the model is power generation data.
[0045] S5. Perform regression analysis on the test set based on the trained prediction model, compare the difference between the output result and the real data and evaluate it, so as to evaluate the prediction accuracy of the model. After the evaluation is passed, the optimal prediction model is obtained; among them,
[0046] Evaluation indicators generally include:
[0047] (1) Mean Square Error (MSE):
[0048]
[0049] (2) Root mean square error RMSE:
[0050]
[0051] (3) Mean absolute error (MAE):
[0052]
[0053] (4) Coefficient of determination R 2 :
[0054]
[0055] In the formula, y i is the true value, is the predicted value, is the average value.
[0056] When MSE, RMSE, and MAE are less than their respective preset thresholds, and R 2 When it is greater than the preset threshold and less than 1, the trained prediction model has passed the evaluation and is used as the optimal prediction model. The smaller the MSE, RMSE, and MAE, the closer the R2 is to 1, indicating that the model has a lower error, a higher stability, and a better degree of fit.
[0057] S6. Collect future data including meteorological data and input it into the optimal prediction model to obtain the predicted photovoltaic power generation; based on the predicted photovoltaic power generation, determine whether photovoltaic power generation can meet daily load demand and whether electricity storage is required.
[0058] The advantages of the present invention are:
[0059] The present invention takes into account the influence of multiple factors such as meteorological factors and time series, and reduces the dimension of the influencing factors, thereby reducing the calculation complexity, improving the calculation speed, and avoiding the errors that may be caused by manually specifying algorithm parameters. It has high prediction accuracy and strong practicality, which is conducive to the scheduling plan of photovoltaic power generation systems in advance.
[0060] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A short-term prediction method for photovoltaic power generation based on optimized random forest, characterized in that: include: Step 1: Determine the prediction step size, obtain the original data set, and preprocess the original data set to obtain the preprocessed data set; Step 2: Screen the influencing factors in the preprocessed data set, remove unimportant influencing factors, and generate a feature data set; Step 3: Establish a prediction model based on hyperparameter optimization-random forest algorithm; Step 4: Divide the feature data set into a training set and a test set, and use the training set to train the prediction model; Step 5: Perform regression analysis on the test set based on the trained prediction model, compare the difference between the output result and the real data and evaluate it. After the evaluation is passed, the optimal prediction model is obtained; Step 6: Collect future data including meteorological data and input it into the optimal prediction model to obtain the predicted photovoltaic power generation.
2. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 1 is characterized in that: In step 1, the prediction step is natural day or hour, and the original data set includes at least historical power generation data and meteorological data, and the meteorological data includes at least weather, light intensity, precipitation, temperature, humidity, wind direction, wind speed and cloud cover.
3. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 1 is characterized in that: In step 1, the specific operations of preprocessing the original data set are: removing outliers and converting them into missing values; filling in missing values; and standardizing continuous variables.
4. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 1 is characterized in that: In step 2, the method for screening influencing factors is: using variance analysis to capture the linear relationship between the influencing factors and the power generation, removing unimportant influencing factors according to the F value and P value, and generating a characteristic data set.
5. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 4 is characterized in that: The smaller the F value of a certain influencing factor and the larger the P value, the more inclined we are to remove the influencing factor.
6. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 1 is characterized in that: In step 3, the hyperparameter optimization method is Bayesian optimization.
7. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 6 is characterized in that: The optimization goal of Bayesian optimization is the number of random forest decision trees and the number of features selected by the decision trees.
8. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 1 is characterized in that: In step 4, the ratio of the training set to the test set is 8:
2. The input of the model during training includes meteorological data, and the input of the model is power generation data.
9. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 1 is characterized in that: In step 5, the evaluation indicators include: (1) Mean Square Error (MSE): (2) Root mean square error RMSE: (3) Mean absolute error (MAE): (4) Coefficient of determination R 2 : In the formula, y i is the true value, is the predicted value, is the average value.
10. The photovoltaic power generation short-term prediction method based on optimized random forest according to claim 9 is characterized in that: When MSE, RMSE, and MAE are less than their respective preset thresholds, and R 2 When it is greater than the preset threshold and less than 1, the trained prediction model has passed the evaluation and is used as the optimal prediction model. The smaller the MSE, RMSE, and MAE, the closer the R2 is to 1, indicating that the model has a lower error, a higher stability, and a better degree of fit.
Citation Information
Cited By
Garden biomass carbonization final temperature prediction method
CN118916699A
A method for predicting the final temperature of garden biomass carbonization
CN118916699B
Rain and sewage mixed connection rapid detection method
CN119397425A
A rapid detection method for rainwater and sewage mixing
CN119397425B
Prediction method and system for optimizing frequency modulation instruction of fused salt heat storage system
CN120377319A
