A photovoltaic power prediction method and system based on an improved optimization particle algorithm
By improving and optimizing the particle algorithm (IDBO) and combining data preprocessing and multi-model fusion, the problem of imbalance between global search and local search in photovoltaic power prediction was solved, and high-precision and high-stability photovoltaic power prediction was achieved.
Patent Information
- Application Number
- CN202511245008.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-09-02
AI Technical Summary
Existing photovoltaic power prediction methods are insufficient to meet the requirements of high accuracy and high stability. Traditional intelligent optimization algorithms suffer from insufficient balance between global and local search, and single models are difficult to adapt to complex photovoltaic power variation patterns.
An improved optimization particle algorithm (IDBO) is adopted, combined with data preprocessing and multi-model fusion strategies. Through adaptive step size, global optimal position guiding term and boundary truncation strategy, the particle position is optimized, and random forest, gradient boosting and stacked ensemble prediction model are constructed to balance global and local search capabilities and improve prediction accuracy.
It improves the accuracy and stability of photovoltaic power prediction, reduces prediction errors, adapts to different weather scenarios, and enhances the model's adaptability and predictive ability.
Smart Images

Figure CN120728598B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of new energy power generation technology and artificial intelligence algorithms, specifically involving a photovoltaic power prediction method and system based on an improved and optimized particle algorithm, which is particularly suitable for short-term and ultra-short-term photovoltaic power prediction scenarios for photovoltaic power plants. Background Technology
[0002] As the global energy structure shifts towards cleaner and lower-carbon energy, solar energy, as a core component of renewable energy, is experiencing rapid and continuous growth in installed capacity. The output power of photovoltaic power plants is significantly affected by meteorological factors such as solar radiation, temperature, relative humidity, and air pressure, exhibiting strong intermittency, volatility, and randomness.
[0003] Currently, the mainstream photovoltaic power prediction methods in the industry are mainly divided into two categories: traditional statistical methods and machine learning methods. However, both have significant technical shortcomings and are difficult to meet the requirements for high-precision prediction. In recent years, machine learning models such as random forests and gradient boosting decision trees have been gradually applied to photovoltaic power prediction due to their strong nonlinear fitting capabilities. Some existing technologies use a single model for prediction, which has varying adaptability to different meteorological scenarios (e.g., random forest models are less robust to extreme weather data, and gradient boosting decision tree models are prone to overfitting to small sample data). Relying on a single model is insufficient to cover the complex patterns of photovoltaic power variation, resulting in limited prediction accuracy.
[0004] Meanwhile, to address the low efficiency of hyperparameter optimization in machine learning models, some studies have attempted to introduce intelligent optimization algorithms (such as particle swarm optimization and fruit fly optimization) into the hyperparameter optimization process. However, traditional intelligent optimization algorithms share a common problem of "insufficient balance between global and local search," easily getting trapped in local optima in the later stages of iteration, making it difficult to escape the local solution space and find better hyperparameters.
[0005] Therefore, there is an urgent need for an improved optimization algorithm that can balance global and local search capabilities and adapt to joint optimization of hyperparameters of multiple models. This algorithm should combine efficient data preprocessing methods with multi-model fusion strategies to break through the accuracy bottleneck of existing photovoltaic power prediction technologies and meet the grid's requirements for high accuracy and high stability in photovoltaic power prediction. Summary of the Invention
[0006] To address one or more of the aforementioned shortcomings, this invention proposes a photovoltaic power prediction method based on an improved optimized particle algorithm, comprising the following steps:
[0007] S1) Data acquisition and fusion,
[0008] S11) Data Acquisition: Collect historical photovoltaic power data of photovoltaic power plants. and the corresponding timestamp; collected meteorological data and the timestamps corresponding to the meteorological data; meteorological data The corresponding meteorological characteristics include: solar radiation, temperature, relative humidity, and air pressure data;
[0009] S12) Data Fusion: Based on Timestamps Data fusion is performed using an inner join approach, retaining only records where the timestamps of the photovoltaic power data and meteorological data completely match, and discarding invalid data with mismatched timestamps.
[0010] ;
[0011] in For the merged data set, Indicated by timestamp For inner join operations with associative keys;
[0012] S2) Data preprocessing,
[0013] S21) Outlier handling:
[0014] S211) The 3σ principle is used to identify and process fused data. middle Meteorological data, numerical values of a certain meteorological characteristic satisfy:
[0015] ;
[0016] in, This is the mean value of this meteorological characteristic. This represents the standard deviation of the meteorological characteristic.
[0017] The data point is then identified as an outlier and replaced with the mean. ;
[0018] S212) Processed using the method of S211). Photovoltaic power data in the data;
[0019] S123) After processing, output a dataset without outliers. ;
[0020] S22) Missing value imputation:
[0021] S221) The KNN interpolation method is used to fill in the dataset. For missing values in meteorological data, first select for each sample containing missing values. The nearest non-missing value sample is taken as the nearest neighbor. The weight is inversely proportional to the distance between the samples; the closer the distance, the greater the weight. The weight of each nearest neighbor is calculated. Calculate missing values fill value :
[0022] ;
[0023] S222) Fill the dataset using the method in S221). Missing values in the photovoltaic power data;
[0024] S223) Output the complete dataset with no missing values. ;
[0025] S23) Select feature units:
[0026] S231) with dataset The input dataset consists of the actual power output of the photovoltaic system. Based on this, calculate various meteorological characteristics. With target variable correlation coefficient ;
[0027] ;
[0028] in, Features With target variable covariance, For a certain feature standard deviation For target variable Standard deviation;
[0029] S232) Select Meteorological characteristics were used as key features, and samples with correlation coefficients less than [value missing] were removed. Redundant meteorological features are used to form a dataset after feature filtering. ;
[0030] S24) Normalization:
[0031] Receive dataset The Min-Max normalization method is used to map the values of all meteorological features to the [0,1] interval to avoid interference with model training due to differences in feature magnitude. After normalization, the feature values are... :
[0032] ;
[0033] in, For a certain meteorological feature The minimum value, This meteorological feature The maximum value, after normalization, output the dataset. ;
[0034] S25) Dataset partitioning units: Dataset partitioning based on time series characteristics To ensure the temporal continuity between the training and test sets, the partitioning formula is as follows:
[0035] ;
[0036] ;
[0037] in The start time of the training set. This is the end time of the training set;
[0038] S3): Improved optimization algorithm
[0039] With training set Basic data, including:
[0040] S31) Initialization: Determine the search space dimension based on the number of hyperparameters or parameters to be optimized in the random forest model, gradient boosting model, and stacked ensemble prediction model; and this search space is between the upper and lower boundaries of the initial hyperparameters or parameter values, and is randomly initialized within the search space. The position coordinates of each optimized particle ( , To optimize the number of particles, the position coordinates of each optimized particle correspond to a set of hyperparameter combinations or parameter combinations of the prediction model to be optimized;
[0041] S32) Adaptive step size: Introducing an iterative decay factor to adjust the search step size, balancing the algorithm's global and local search capabilities:
[0042] ;
[0043] in, This is the step size decay coefficient. This represents the current iteration number. To represent the maximum number of iterations, in the above formula, the initial iteration... Larger values are used to achieve global search, in later iterations. Decrease the value to improve local search accuracy;
[0044] S33) Position Update: Introducing a globally optimal position guiding term to update and optimize particle positions accelerates algorithm convergence and ensures the search direction moves closer to the optimal hyperparameter combination or the optimal parameter combination.
[0045] ;
[0046] ;
[0047] in, For the first Only optimize the particle's position coordinates. , These are the position coordinates corresponding to the globally optimal hyperparameter combination in the current iteration. The random step size is within the interval [-1, 1]. These are user-defined parameters, with values ranging from 0 to 1.
[0048] S34) Boundary Truncation: A boundary truncation strategy is used to handle position out-of-bounds issues, ensuring that the optimized particle position always remains within the range of hyperparameter values.
[0049] ;
[0050] ;
[0051] in, , These represent the upper and lower boundaries of the hyperparameter values, where the initial hyperparameter values are preset based on the photovoltaic power prediction scenario and model characteristics.
[0052] Repeat S31)-S34) until the maximum number of iterations is reached, and output the hyperparameter combination or parameter combination corresponding to the global optimal position coordinates as the optimal hyperparameter or parameter for subsequent prediction model construction;
[0053] S4) Prediction model construction and training,
[0054] S41) Random Forest Model Training: Using the optimized hyperparameters from S3), on the training set... above construction 1. Decision trees; average the predictions of each decision tree for the input features to obtain the predicted values of the random forest model. :
[0055] ;
[0056] in, For the first Each decision tree has input features The prediction results These are the predicted values from the random forest model;
[0057] S42) Gradient boosting model training: Using the optimized hyperparameters from S3), on the training set... The above implements iterative training based on gradient boosting decision trees; the first... During round iteration, a new decision tree is constructed. Before revision The prediction error of the first round is obtained. Predicted value of the wheel :
[0058] ;
[0059] in, For the first The predicted value of each iteration, For the ( The predicted value of each iteration, For the first Each decision tree has input features The prediction results are then iterated to a preset number of iterations, where the number of preset iterations is the number of optimized trees. The final prediction value of the gradient boosting model is then output. ;
[0060] S43) Stacked ensemble prediction model training: using the prediction results of the random forest model and the gradient boosting model ( , () as input features in the training set The parameters of the training stacked ensemble prediction model described in S3 above include weight coefficients. , and bias terms And ultimately achieve photovoltaic power prediction. :
[0061] ;
[0062] in, This refers to the predicted values of the stacked integration prediction model, i.e., the photovoltaic power prediction results;
[0063] S5) Predictive Assessment
[0064] S51) The test set output by the data preprocessing module Input the stacked ensemble prediction model to obtain the predicted values for the test set. The mean absolute error (MAE), root mean square error (RMSE), and coefficient of determination (MRSE) were used. Three metrics are used to evaluate model performance:
[0065] ;
[0066] ;
[0067] ;
[0068] This represents the number of samples in the test set.
[0069] To test the actual photovoltaic power values;
[0070] This represents the average value of the actual photovoltaic power in the test set.
[0071] S52) When MAE ≤ 2.5, RMSE ≤ 5.0, When the value is ≥0.95, the performance of the stacked integration prediction model in S43) is deemed to meet the standard;
[0072] S53) If any indicator in S52) fails to meet the requirements, adjust the hyperparameter combination and / or parameter combination involved in S31)-S34) and re-execute the hyperparameter and / or parameter optimization until S52) meets the requirements;
[0073] S6) Prediction results output,
[0074] S61) Process the future weather forecast data sequentially according to S21), S22), S24), and S25) to obtain the dataset. ;
[0075] S62) Based on the qualified prediction model in S5), output the predicted value of future photovoltaic power by the random forest model according to S41) and S42). ; and gradient boosting model predictions ;
[0076] S63) Based on the qualified model predicted in S5), output the predicted photovoltaic power according to S43). :
[0077] .
[0078] As a preferred embodiment, the missing value imputation in S22) employs the KNN interpolation method when the data is fused. When the percentage of missing values in the middle is greater than 10%, A value of 3 indicates that the percentage of missing values is ≤10%. The value is 5;
[0079] In S23), Features with values ranging from 0.1 to 0.6 were selected as key meteorological features. After removing redundant meteorological features, a dataset was formed. .
[0080] As a preferred embodiment, in step S31), the number of particles is optimized. The value can be between 30 and 50;
[0081] In S32), The value ranges from 50 to 100, in the initial stage of iteration. Values ≥ 0.7 are used to achieve global search in later iterations. A value ≤ 0.3 is used to improve local search accuracy;
[0082] In S33), The value ranges from 0.1 to 0.9.
[0083] As a preferred option, when the sample size is <5000, When the sample size is ≥5000, N=50.
[0084] A photovoltaic power prediction method based on an improved and optimized particle algorithm includes: a data acquisition and fusion module, a data preprocessing module, an improved and optimized algorithm (IDBO algorithm) module, a prediction model construction and training module, a prediction evaluation module, and a prediction result output module.
[0085] An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, complete the steps of a photovoltaic power prediction method based on an improved optimized particle algorithm.
[0086] A computer-readable storage medium is characterized in that it is used to store computer instructions, which, when executed by a processor, complete the steps of a photovoltaic power prediction method based on an improved and optimized particle algorithm.
[0087] The advantages of this invention are:
[0088] 1) In the data preprocessing stage, abnormal data processing, missing value insertion, and key meteorological feature selection are carried out to provide high-quality input data for subsequent model training, thereby reducing prediction errors from the source.
[0089] 2) Construct a coupled and stacked model of random forest and gradient boosting to give full play to the technical advantages of different models (the random forest model has strong anti-overfitting ability and can handle nonlinear relationships of multiple features; the gradient boosting model has high iteration efficiency and excellent error correction ability for small sample data); the prediction results of the two are weighted and fused by the meta-model, which can make up for the lack of adaptability of the single model in extreme weather scenarios (such as sudden cloud cover and sudden temperature change), so that the final prediction value is closer to the actual power change law.
[0090] 3) By using adaptive step size (iterative decay factor to balance global / local search), global optimal position guiding term (to speed up convergence), and boundary truncation strategy, the problems of "low efficiency and easy to get trapped in local optima" of traditional optimization algorithms (such as grid search and original fruit fly optimization algorithm) are solved. Attached Figure Description
[0091] Figure 1 This is a flowchart of a photovoltaic power prediction method based on an improved and optimized particle algorithm, as described in Embodiment 1 of the present invention.
[0092] Figure 2 The meteorological factor characteristic correlation matrix of Embodiment 2 of the present invention
[0093] Figure 3 The prediction results for four time intervals with a correlation coefficient ≥ 0.1 in Embodiment 2 of the present invention. Detailed Implementation
[0094] Example 1: See Figure 1 A photovoltaic power prediction method based on an improved optimized particle algorithm includes the following steps:
[0095] S1) Data acquisition and fusion,
[0096] S11) Data Acquisition: Collect historical photovoltaic power data of photovoltaic power plants. and the corresponding timestamp; collected meteorological data and the timestamps corresponding to the meteorological data; meteorological data The corresponding meteorological characteristics include: solar radiation, temperature, relative humidity, and air pressure data;
[0097] S12) Data Fusion: Based on Timestamps Data fusion is performed using an inner join approach, retaining only records where the timestamps of the photovoltaic power data and meteorological data completely match, and discarding invalid data with mismatched timestamps.
[0098] ;
[0099] in For the merged data set, Indicated by timestamp For inner join operations with associative keys;
[0100] S2) Data preprocessing,
[0101] S21) Outlier handling:
[0102] S211) The 3σ principle is used to identify and process fused data. middle Meteorological data, numerical values of a certain meteorological characteristic satisfy:
[0103] ;
[0104] in, This is the mean value of this meteorological characteristic. This represents the standard deviation of the meteorological characteristic.
[0105] The data point is then identified as an outlier and replaced with the mean. ;
[0106] S212) Processed using the method of S211). Photovoltaic power data in the data;
[0107] S123) After processing, output a dataset without outliers. ;
[0108] S22) Missing value imputation:
[0109] S221) Dataset For missing values in meteorological data, first select for each sample containing missing values. The nearest non-missing value sample is taken as the nearest neighbor. The weight is inversely proportional to the distance between the samples; the closer the distance, the greater the weight. The weight of each nearest neighbor is calculated. Calculate missing values fill value :
[0110] ;
[0111] S222) Fill the dataset using the method in S221). Missing values in photovoltaic power data
[0112] S223) Output the complete dataset with no missing values. ;
[0113] S23) Select feature units:
[0114] S231) with dataset The input dataset consists of the actual power output of the photovoltaic system. Based on this, calculate various meteorological characteristics. Correlation coefficient with target variable y ;
[0115] ;
[0116] in, Features With target variable covariance, For a certain feature standard deviation For target variable Standard deviation;
[0117] S232) Select Meteorological characteristics were used as key features, and samples with correlation coefficients less than [value missing] were removed. Redundant meteorological features are used to form a dataset after feature filtering. ;
[0118] S24) Normalization:
[0119] Receive dataset The Min-Max normalization method is used to map the values of all meteorological features to the [0,1] interval to avoid interference with model training due to differences in feature magnitude. After normalization, the feature values are... :
[0120] ;
[0121] in, For a certain meteorological feature The minimum value, This meteorological feature The maximum value, after normalization, output the dataset. ;
[0122] S25) Dataset partitioning units: Dataset partitioning based on time series characteristics To ensure the temporal continuity between the training and test sets, the partitioning formula is as follows:
[0123] ;
[0124] ;
[0125] in The start time of the training set. This is the end time of the training set;
[0126] S3): Improved optimization algorithm
[0127] The improved optimization algorithm involved in this embodiment 3) is the IDBO algorithm, also known as the Improved Dung Beetle Optimizer. It is a metaheuristic optimization algorithm that is improved on the basis of the standard Dung Beetle Optimizer (DBO). It aims to solve the problems of insufficient global exploration capability, easy getting trapped in local optima, and unsatisfactory convergence accuracy of DBO.
[0128] With training set Basic data, including:
[0129] S31) Initialization: Determine the search space dimension based on the number of hyperparameters or parameters to be optimized in the random forest model, gradient boosting model, and stacked ensemble prediction model; and this search space is between the upper and lower boundaries of the initial hyperparameters or parameter values, and is randomly initialized within the search space. The position coordinates of each optimized particle ( , To optimize the number of particles, the position coordinates of each optimized particle correspond to a set of hyperparameters or parameter combinations of the prediction model to be optimized.
[0130] S32) Adaptive step size: Introducing an iterative decay factor to adjust the search step size, balancing the algorithm's global and local search capabilities:
[0131] ;
[0132] in, This is the step size decay coefficient. This represents the current iteration number. To represent the maximum number of iterations, in the above formula, the initial iteration... Larger values are used to achieve global search, in later iterations. Decrease the value to improve local search accuracy;
[0133] S33) Position Update: Introducing a globally optimal position guiding term to update and optimize particle positions accelerates algorithm convergence and ensures the search direction moves closer to the optimal hyperparameter combination or optimal parameter combination.
[0134] ;
[0135] ;
[0136] in, For the first Only optimize the particle's position coordinates. , These are the position coordinates corresponding to the globally optimal hyperparameter combination or the globally optimal parameter combination in the current iteration. The random step size is within the interval [-1, 1]. These are user-defined parameters, with values ranging from 0 to 1.
[0137] S34) Boundary Truncation: A boundary truncation strategy is used to handle position out-of-bounds issues, ensuring that the optimized particle position always remains within the range of hyperparameters or parameters.
[0138] ;
[0139] ;
[0140] in, , These are the upper and lower boundaries of the hyperparameters or parameter values, where the initial hyperparameters or parameter values are preset based on the photovoltaic power prediction scenario and model characteristics;
[0141] Random forest model: The hyperparameters to be optimized include the number of trees (n_estimators), the maximum depth (max_depth), and the minimum number of split samples (min_samples_split), a total of 3 independent hyperparameters;
[0142] Gradient boosting model: The hyperparameters to be optimized include the number of trees (n_estimators), learning rate (learning_rate), and maximum depth (max_depth), a total of 3 independent hyperparameters;
[0143] Stacked ensemble prediction model: The parameters to be optimized are the weight coefficients (w1, w2) and the bias term (b), a total of 3 independent parameters.
[0144] The initial hyperparameters or their ranges are not randomly set, but are determined by combining the photovoltaic scenario (such as power plant scale and data volume) and model characteristics (such as the normal effective range of hyperparameters for gradient boosting), including:
[0145] Initial hyperparameters for the random forest model: n_estimators (lower bound: 50, upper bound: 200), max_depth (lower bound: 10, upper bound: 30), min_samples_split (lower bound: 2, upper bound: 10).
[0146] Initial hyperparameters for the gradient boosting model: n_estimators (lower bound: 50, upper bound: 200), learning_rate (lower bound: 0.01, upper bound: 0.1), max_depth (lower bound: 3, upper bound: 10).
[0147] Initial parameters of the stacked ensemble prediction model: weight coefficients w1 (lower boundary: 0, upper boundary: 1), w2 (lower boundary: 0, upper boundary: 1), bias term b (lower boundary: -10, upper boundary: 10).
[0148] Repeat S31)-S34) until the maximum number of iterations is reached, and output the hyperparameter combination or parameter combination corresponding to the global optimal position coordinates (repeatedly executed with mean squared error (MSE) as the loss function), as the optimal hyperparameter or parameter for subsequent prediction model construction;
[0149] S4) Prediction model construction and training,
[0150] S41) Random Forest Model Training: Using the optimized hyperparameters from S3), on the training set... above construction 1. Decision trees; average the predictions of each decision tree for the input features to obtain the predicted values of the random forest model. :
[0151] ;
[0152] in, For the first Each decision tree has input features The prediction results These are the predicted values from the random forest model;
[0153] S42) Gradient boosting model training: Using the optimized hyperparameters or parameters from S3), on the training set... The above implements iterative training based on gradient boosting decision trees; the first... During round iteration, a new decision tree is constructed. Before revision The prediction error of the first round is obtained. Predicted value of the wheel :
[0154] ;
[0155] in, For the first The predicted value of each iteration, For the ( The predicted value of each iteration, For the first Each decision tree has input features The prediction results are then iterated to a preset number of iterations, where the number of preset iterations is the number of optimized trees. The final prediction value of the gradient boosting model is then output. ;
[0156] S43) Stacked ensemble prediction model training: using the prediction results of the random forest model and the gradient boosting model ( , () as input features in the training set The parameters of the training stacked ensemble prediction model described in S3 above include weight coefficients. , and bias terms And ultimately achieve photovoltaic power prediction. :
[0157] ;
[0158] in, This refers to the predicted values of the stacked integration prediction model, i.e., the photovoltaic power prediction results;
[0159] S5) Predictive Assessment
[0160] S51) The test set output by the data preprocessing module Input the stacked ensemble prediction model to obtain the predicted values for the test set. The mean absolute error (MAE), root mean square error (RMSE), and coefficient of determination (MRSE) were used. Three metrics are used to evaluate model performance:
[0161] ;
[0162] ;
[0163] ;
[0164] This represents the number of samples in the test set.
[0165] To test the actual photovoltaic power values;
[0166] This represents the average value of the actual photovoltaic power in the test set.
[0167] S52) When MAE ≤ 2.5, RMSE ≤ 5.0, When the value is ≥0.95, the performance of the stacked integration prediction model in S43) is deemed to meet the standard;
[0168] S53) If any indicator in S52) fails to meet the requirements, adjust the hyperparameter combination and / or parameter combination involved in S31)-S34) and re-execute the hyperparameter and / or parameter optimization until S52) meets the requirements;
[0169] S6) Prediction results output,
[0170] S61) Process the future weather forecast data sequentially according to S21), S22), S24), and S25) to obtain the dataset. ;
[0171] The meteorological characteristics of the future weather forecast data are completely consistent with those of the historical data (both include solar radiation, temperature, etc.), and key features have already been screened through S23 in the previous stage, so there is no need to repeat the process; if new features are added to the future data (such as wind speed), S23 needs to be executed to remove redundant features.
[0172] S62) Based on the qualified prediction model in S5), output the predicted value of future photovoltaic power by the random forest model according to S41) and S42). ; and gradient boosting model predictions ;
[0173] S63) Based on the qualified model predicted in S5), output the predicted photovoltaic power according to S43). :
[0174] .
[0175] S62) Based on the qualified prediction model in S5), output the intermediate prediction value y of future photovoltaic power by the random forest model according to S41) and S42). rf ; and the intermediate predicted value y of the gradient boosting model lf ;
[0176] S63) Based on the qualified model predicted in S5), output the predicted photovoltaic power according to S43). :
[0177] .
[0178] In this embodiment: missing value imputation uses the KNN interpolation method when fusing data. When the percentage of missing values for a certain meteorological feature is greater than 10%, A value of 3 indicates that when the percentage of missing values for a certain meteorological feature is ≤10%, The value is 5;
[0179] The value ranges from 0.1 to 0.6, with 0.1 to 0.3 for scenarios with large fluctuations in meteorological data (such as rainy areas) and 0.4 to 0.6 for scenarios with smaller fluctuations (such as arid areas). In this embodiment, features with a value of 0.1 are used as key features, and redundant features are removed to form the dataset. .
[0180] Optimize the number of particles The value is between 30 and 50; specifically, in this embodiment, when the sample size is <5000, When the sample size is ≥5000, N=50; in this invention, unless otherwise specified, the sample size refers to the training set. A specific meteorological feature point (input feature) The corresponding sample size;
[0181] The value ranges from 50 to 100, and in this specific embodiment, it is set to 75 during the initial iteration. Values ≥ 0.7 are used to achieve global search in later iterations. A value ≤ 0.3 is used to improve local search accuracy;
[0182] The value ranges from 0.1 to 0.9; specifically, in this embodiment, the value is 0.9.
[0183] Example 2:
[0184] See Figure 2 and Figure 3The data originates from the actual operation and monitoring of a 100kW photovoltaic power station in a certain region from January 2021 to December 2022. The specific data collection method is as follows:
[0185] (1) Photovoltaic power data
[0186] Data acquisition equipment: Real-time data is collected through the intelligent monitoring system (SCADA system) of the photovoltaic power station. The sampling equipment includes the inverter's built-in power sensor, combiner box metering device, etc., with a sampling accuracy error of ≤0.5%.
[0187] Time resolution: A sampling frequency of 15 minutes / time is adopted, that is, from 00:00 to 23:45 every day, the actual output power (unit: kW) of the photovoltaic array is recorded once every 15 minutes, including parameters such as active power and reactive power. Finally, active power is extracted as the core target variable.
[0188] (2) Sources of meteorological data
[0189] Meteorological data serves as a key input feature for photovoltaic power forecasting, and its sources and acquisition details are as follows:
[0190] Data collection points: Monitoring data from meteorological stations located around the project site to ensure that meteorological parameters accurately reflect the environmental conditions of the photovoltaic modules. This includes:
[0191] Solar radiation intensity: including total radiation (Q1), direct normal radiation (Q2), and diffuse horizontal radiation (Q3), collected using a secondary standard radiometer (accuracy ±5%), with units of W / m²;
[0192] Environmental parameters: Air temperature (Q4, unit: ℃) is measured using a platinum resistance temperature sensor (accuracy ±0.2℃), atmospheric pressure (Q5, unit: hpa) is measured using a capacitive pressure sensor (accuracy ±0.5hpa), and relative humidity (Q6, unit: %) is measured using an integrated temperature and humidity sensor (accuracy ±3%).
[0193] Sampling frequency: Synchronized with photovoltaic power data, a sampling frequency of 15 minutes / time is adopted to ensure complete timestamp matching.
[0194] Data validity verification: Abnormal data under some extreme weather conditions (such as rainstorms and sandstorms) are verified by comparing them with official records from local meteorological stations to ensure data representativeness.
[0195] (3) Data fusion and matching
[0196] To achieve correlation analysis between photovoltaic power and meteorological factors, a fusion strategy based on precise timestamp matching is adopted:
[0197] Timestamp standardization: The timestamps of photovoltaic power data and meteorological data are uniformly converted into the format "yyyy-MM-ddHH:mm:ss", accurate to the minute, eliminating time differences caused by time zones and equipment clock deviations;
[0198] Inner join fusion: Perform an inner join operation based on the timestamp field, retaining only records with completely identical timestamps, ensuring that each photovoltaic power data can correspond to a unique combination of meteorological conditions;
[0199] Redundant data processing: After fusion, duplicate records (approximately 0.3%) are removed through time series continuity checks, resulting in a complete dataset containing 8 fields (timestamp + 1 power index + 6 meteorological indicators).
[0200] Data integrity processing: Among the 70,176 valid records in the original data, there were invalid records due to equipment failure and communication interruption (such as negative values and outliers exceeding the physical range). By processing outliers, KNN interpolation to fill missing values, correlation coefficients to select features, normalization, and dividing the data into training and test sets, 33,203 records from 2021 and 33,140 records from 2022 were finally retained.
[0201] After model training and data normalization, the meteorological feature correlation matrix is shown in the table below.
[0202]
[0203]
[0204] Correlation analysis between meteorological factors and photovoltaic power shows that:
[0205] Key influencing factors: Total radiation (Q1) is the core factor determining photovoltaic power, with a correlation coefficient significantly higher than other meteorological parameters, directly affecting the photoelectric conversion efficiency of photovoltaic cells.
[0206] Secondary influencing factors: Direct normal radiation (Q2), scattered horizontal radiation (Q3), and air temperature (Q4) have a certain impact on prediction accuracy. Among them, radiation parameters have a stronger positive correlation with power, while temperature indirectly affects output power by influencing battery efficiency.
[0207] Weakly correlated factors: Relative humidity (Q6) has a limited impact on the results, and atmospheric pressure (Q5) is basically an uncorrelated factor, indicating that the impact of air pressure fluctuations in this region on photovoltaic power generation is negligible.
[0208] Based on the meteorological characteristics of 2022, four time intervals were selected: March 10-16, May 21-27, August 12-18, and December 1-7. The trends of total radiation (Q1) and air temperature (Q4) are shown in the table below. These intervals all cover abrupt climate changes (including typical subsequent intervals that are affected by multiple solar power generation events such as cloudy and rainy weather) and encompass different temperature ranges. The predicted parameters of the integrated stacking model under the conditions of correlation coefficient ≥0.1 and correlation coefficient ≥0.6, as described in Example 1, are shown in the table below.
[0209]
[0210]
[0211] For the integrated stacked model, the prediction evaluation for correlation coefficients ≥ 0.1 is shown in the figure. Figure 3 .
[0212] Subsequent data predictions will be made with reference to Example 1; parameters not described in Example 2 will be selected in accordance with Example 1.
[0213] Example 3:
[0214] A photovoltaic power prediction system based on an improved and optimized particle algorithm implements the steps involved in Example 1, including: a data acquisition and fusion module, a data preprocessing module, an improved and optimized algorithm (IDBO algorithm) module, a prediction model construction and training module, a prediction evaluation module, and a prediction result output module.
[0215] Example 4:
[0216] An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor. When the computer instructions are executed by the processor, they complete the steps of a photovoltaic power prediction method based on an improved optimized particle algorithm, as described in Embodiment 1.
[0217] Example 5:
[0218] A computer-readable storage medium for storing computer instructions, which, when executed by a processor, complete the steps of a photovoltaic power prediction method based on an improved optimized particle algorithm as described in Embodiment 1.
Claims
1. A photovoltaic power prediction method based on an improved optimized particle algorithm, comprising the following steps: S1) Data acquisition and fusion, S11) Data Acquisition: Collect historical photovoltaic power data of photovoltaic power plants. and the corresponding timestamp; collected meteorological data and the timestamps corresponding to the meteorological data; meteorological data The corresponding meteorological characteristics include: solar radiation, temperature, relative humidity, and air pressure data; S12) Data Fusion: Based on Timestamps Data fusion is performed using an inner join approach, retaining only records where the timestamps of the photovoltaic power data and meteorological data completely match, and discarding invalid data with mismatched timestamps. ; in For the merged data set, Indicated by timestamp For inner join operations with associative keys; S2) Data preprocessing, S21) Outlier handling: S22) Missing value imputation: S23) Select feature units: S24) Normalization: S25) Dataset partitioning unit: Based on the characteristics of the time series, the normalized output dataset is partitioned. To ensure the temporal continuity between the training and test sets, the partitioning formula is as follows: ; ; in The start time of the training set. This is the end time of the training set; S3): Improved optimization algorithm With training set Basic data, including: S31) Initialization: Determine the search space dimension based on the number of hyperparameters or parameters to be optimized in the random forest model, gradient boosting model, and stacked ensemble prediction model; and this search space is the initial hyperparameters or the area between the upper and lower boundaries of the initial parameter values, and randomly initialize within the search space. The position coordinates of each optimized particle ( , To optimize the number of particles, the position coordinates of each optimized particle correspond to a set of hyperparameters or parameter combinations of the prediction model to be optimized. S32) Adaptive step size: Introducing an iterative decay factor to adjust the search step size, balancing the algorithm's global and local search capabilities: ; in, This is the step size decay coefficient. This represents the current iteration number. This represents the maximum number of iterations. S33) Position Update: Introducing a globally optimal position guiding term to update and optimize particle positions accelerates algorithm convergence and ensures the search direction moves closer to the optimal hyperparameter combination or optimal parameter combination. ; ; in, For the first Only optimize the particle's position coordinates. , These are the position coordinates corresponding to the globally optimal hyperparameter combination or the globally optimal parameter combination in the current iteration. The random step size is within the interval [-1, 1]. These are user-defined parameters, with values ranging from 0 to 1. S34) Boundary Truncation: A boundary truncation strategy is used to handle position out-of-bounds issues, ensuring that the optimized particle position always remains within the range of hyperparameters or parameters. ; ; in, , These are the upper and lower boundaries of the hyperparameters or parameter values, where the initial hyperparameters or initial parameter values are preset based on the photovoltaic power prediction scenario and model characteristics; Repeat S31)-S34) until the maximum number of iterations is reached, and output the hyperparameter combination or parameter combination corresponding to the global optimal position coordinates as the optimal hyperparameter or parameter for subsequent prediction model construction; S4) Prediction model construction and training, S41) Random Forest Model Training: Using the optimized hyperparameters from S3), on the training set... above construction 1. Decision trees; average the predictions of each decision tree for the input features to obtain the predicted values of the random forest model. : ; in, For the first Each decision tree has input features The prediction results These are the predicted values from the random forest model; S42) Gradient boosting model training: Using the optimized hyperparameters from S3), on the training set... The above implements iterative training based on gradient boosting decision trees; the first... During round iteration, a new decision tree is constructed. Before revision The prediction error of the first round is obtained. Predicted value of the wheel : ; in, For the first The predicted value of each iteration, For the ( The predicted value of each iteration, For the first Each decision tree has input features The prediction results are then iterated to a preset number of iterations, where the number of preset iterations is the number of optimized trees. The final prediction value of the gradient boosting model is then output. ; S43) Stacked ensemble prediction model training: using the prediction results of the random forest model and the gradient boosting model ( , ) as input features in the training set (S3) The parameters of the stacked ensemble prediction model include weight coefficients. , and bias terms And ultimately achieve photovoltaic power prediction. : ; in, This refers to the predicted value of the stacked integrated prediction model, i.e., the photovoltaic power prediction result.
2. The photovoltaic power prediction method based on the improved optimized particle algorithm according to claim 1, characterized in that: The missing value imputation in S22) uses the KNN interpolation method when the data is fused. When the percentage of missing values in the middle is greater than 10%, A value of 3 indicates that the percentage of missing values is ≤10%. The value is 5; In S23), Features with values ranging from 0.1 to 0.6 were selected as key meteorological features. After removing redundant meteorological features, a dataset was formed. .
3. The photovoltaic power prediction method based on the improved optimized particle algorithm according to claim 2, characterized in that, In S31), the number of optimized particles The value can be between 30 and 50; In S32) The value ranges from 50 to 100, in the initial stage of iteration. Values ≥ 0.7 are used to achieve global search in later iterations. A value ≤ 0.3 is used to improve local search accuracy; S33) The value ranges from 0.1 to 0.
9.
4. The photovoltaic power prediction method based on the improved optimized particle algorithm according to claim 3, when the sample size is <5000, When the sample size is ≥5000, N=50.
5. A photovoltaic power prediction system based on an improved optimized particle algorithm, executing the photovoltaic power prediction method based on an improved optimized particle algorithm as described in any one of claims 1-4, characterized in that, include: The system includes a data acquisition and fusion module, a data preprocessing module, an improved and optimized algorithm module, a prediction model construction and training module, a prediction evaluation module, and a prediction result output module.
6. An electronic device, characterized in that, It includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, complete the steps of the photovoltaic power prediction method based on an improved optimized particle algorithm as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, complete the steps of a photovoltaic power prediction method based on an improved optimized particle algorithm as described in any one of claims 1-4.
Citation Information
Patent Citations
Power grid system emergency resource demand prediction method based on machine learning
CN119027275A
Photovoltaic power generation power prediction method based on ICSO-SVM model
CN119093323A