Photovoltaic output prediction method and system based on QPSO-LSTM
By optimizing the photovoltaic power output prediction using the QPSO-LSTM model, the problem of insufficient accuracy in photovoltaic power output prediction in existing technologies is solved, and high-precision and stable photovoltaic power output prediction is achieved, which meets the real-time requirements of grid dispatch.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-04-10
AI Technical Summary
Existing photovoltaic power output prediction methods, under the background of high proportion of new energy access, are difficult to balance data quality improvement, model structure optimization and parameter adaptive optimization, resulting in insufficient prediction accuracy and poor robustness, and failing to meet the real-time and accuracy requirements of power grid dispatch.
A photovoltaic power output prediction method based on QPSO-LSTM is adopted. By collecting and preprocessing historical photovoltaic data and combining it with meteorological data to construct training samples, the hyperparameters of LSTM are optimized using the QPSO algorithm to construct a QPSO-LSTM distributed photovoltaic power output prediction model, thereby achieving accurate prediction of future periods.
It improves the accuracy and stability of photovoltaic power output prediction, has good engineering applicability and robustness, meets the real-time requirements of power grid dispatch, and adapts to the changes in photovoltaic power output characteristics in different regions and seasons.
Smart Images

Figure CN121840565A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of photovoltaic power generation prediction, and particularly relates to a photovoltaic output prediction method and system based on QPSO-LSTM. BACKGROUND
[0002] With the deepening of the "double carbon" strategy, the penetration rate of distributed photovoltaics in the distribution network continues to rise, and the randomness, intermittency and volatility of its output pose a serious challenge to power balance and safe operation of the power grid. Accurate photovoltaic output prediction is a key technology for optimizing power grid dispatching plans and improving new energy consumption capacity, and is of great significance to ensuring the stable and economic operation of the power system.
[0003] Currently, photovoltaic output prediction methods mainly include physical model method, traditional statistical learning method and deep learning-based method. The physical model method relies on accurate meteorological data and photovoltaic component parameters, and is easily affected by model errors and local environmental changes in actual application; traditional time series methods (such as ARIMA) and regression models have limited fitting ability for nonlinear and non-stationary sequences, and are difficult to effectively depict output fluctuations under complex weather conditions such as cloudiness and rain. In recent years, long short-term memory networks have been widely used in photovoltaic prediction because they can capture the long-term dependence of time series. However, the prediction performance of the LSTM model is highly dependent on the setting of hyperparameters (such as the number of hidden layer neurons, learning rate, training times, etc.), which currently relies on experience or grid search, which is not only time-consuming and laborious, but also easily falls into local optimization, resulting in insufficient model generalization ability.
[0004] To further improve prediction accuracy, some studies attempt to combine optimization algorithms with LSTM, such as using particle swarm optimization to optimize network parameters. However, the traditional PSO algorithm is prone to premature convergence in the later iteration period, and has limited global search ability, making it difficult to stably obtain the optimal parameter combination of LSTM, which restricts the further optimization of the prediction model. In addition, existing methods pay insufficient attention to the quality of input data, and there are often outliers and missing values in photovoltaic historical data, which directly affects the stability of model training and the reliability of prediction results.
[0005] Therefore, there is still no distributed photovoltaic output prediction method in the prior art that can balance data quality improvement, model structure optimization and parameter self-adaptive optimization, and there is an urgent need for a prediction scheme with higher precision and stronger robustness to meet the real-time and accuracy requirements of short-term photovoltaic output prediction for power grid dispatching under the background of high proportion of new energy access. SUMMARY
[0006] To solve the above problems, the present application provides a photovoltaic output prediction method and system based on QPSO-LSTM.
[0007] In order to achieve the above object, the present application is realized by the following technical scheme:
[0008] The photovoltaic output prediction method based on QPSO-LSTM has the characteristics that it comprises:
[0009] The original distributed photovoltaic output historical data and related meteorological data of a target area are collected, and after preprocessing, a training sample data set is generated;
[0010] QPSO and LSTM are fused to construct a QPSO-LSTM distributed photovoltaic output prediction model, and the training sample data set is input; the network structure parameters of the LSTM and the particle swarm parameters of the QPSO are initialized; the hyperparameters of the LSTM are optimized based on the QPSO, and an optimized QPSO-LSTM distributed photovoltaic output prediction model is obtained;
[0011] Real-time observation data of the target area is input into the QPSO-LSTM distributed photovoltaic output prediction model, and distributed photovoltaic output prediction data of a future period is output.
[0012] As a preferred scheme of the present application, the preprocessing process comprises:
[0013] S1, the photovoltaic power time series is decomposed into trend, seasonality and residual part through STL decomposition, based on the residual part, the local density deviation of each data point of the photovoltaic power time series is calculated through the local anomaly factor algorithm, and the abnormal data is identified;
[0014] S2, based on the identified abnormal data, the K nearest neighbor method is used for filling, and the expression is:
[0015] ;
[0016] In the formula, is the mth data point to be filled, is the number of neighbors, is the first data of the mth data point, is the last data of the mth data point;
[0017] S3, the maximum-minimum data normalization processing is adopted for the model input data.
[0018] As a preferred scheme of the present application, in the constructed QPSO-LSTM distributed photovoltaic output prediction model, the LSTM maintains the memory of the unit state at , through the forget gate and the input gate Adjusting; the training sample data set is sequentially processed through the forgetting gate, the input gate and the output gate, and the predicted data is output, and the information is stored for a long time by updating the internal state, and the expression is:
[0019] ;
[0020] ;
[0021] ;
[0022] ;
[0023] In the formula, is the current time, is the output gate, is the input of the current time, is the external state of the last time, , respectively are the weight matrix of the input gate, the forgetting gate, the output gate and the candidate cell state for processing the current input, , respectively are the weight matrix of the input gate, the forgetting gate, the output gate and the candidate cell state for processing the last hidden state, , respectively are the bias vectors of the input gate, the forgetting gate, the output gate and the candidate cell state, is the long-term memory information of the time sequence, and the activation function and respectively map the output to the interval and the interval .
[0024] In the constructed QPSO-LSTM distributed photovoltaic output prediction model, the QPSO is optimized by simulating the behavior of particles in a quantum potential well, and the expression is:
[0025] ;
[0026] ;
[0027] In the formula, is a random value uniformly distributed in the interval , is the attractor of the i-th particle in the j-th evolution iteration, respectively are the current optimal value and the global optimal value of the i-th particle in the j-th evolution iteration, is the i-th particle in the j-th evolution iteration, is the i-th particle in the j-th evolution iteration, is the i-th particle in the j-th evolution iteration, is the i-th particle in the j-th evolution iteration, is the i-th particle in the j-th evolution iteration, The particle in the first Position in the next evolutionary iteration. In the first Particles in the next iteration In the The width of a one-dimensional quantum potential well.
[0028] As a preferred embodiment of the present invention, the hyperparameters of the LSTM are optimized based on the QPSO, including:
[0029] Based on the continuous iterative update of the hyperparameters of LSTM using QPSO, the optimal values of the number of hidden layer neurons, the number of training iterations, and the learning rate of LSTM are obtained, thus acquiring the optimized QPSO-LSTM distributed photovoltaic power output prediction model.
[0030] In the QPSO, the hyperparameters of the LSTM are evaluated using fitness functions, which include: root mean square error (RMSE), mean absolute error (MAE), mean relative percentage error (MAPE), and coefficient of determination. The corresponding calculation formula is:
[0031] ;
[0032] ;
[0033] ;
[0034] ;
[0035] In the formula, N represents the number of tests. Indicates the first The true value of this test This represents the model output value in the j-th test. Indicates the first The average value of the output of the model in each test.
[0036] As a preferred embodiment of the present invention, the QPSO-LSTM distributed photovoltaic power output prediction model is equipped with a model update mechanism. When the average absolute error of multiple consecutive prediction cycles exceeds a set threshold, the model is automatically retrained and the parameters are re-optimized.
[0037] As a preferred embodiment of the present invention, the relevant meteorological data includes: solar radiation intensity, wind speed, temperature, humidity and cloud cover.
[0038] A photovoltaic power output prediction system based on QPSO-LSTM includes:
[0039] Data acquisition module: used to collect historical data on the original distributed photovoltaic power output and related meteorological data of the target area;
[0040] A preprocessing module: preprocessing the collected data to generate a training sample data set;
[0041] A QPSO-LSTM original prediction module: combining QPSO and LSTM to construct a QPSO-LSTM prediction model and input the training sample data set;
[0042] A QPSO-LSTM distributed photovoltaic output prediction module: initializing the network parameters of the LSTM and the particle swarm parameters of the QPSO, optimizing the hyperparameters of the LSTM based on the QPSO, and obtaining an optimized QPSO-LSTM distributed photovoltaic output prediction model;
[0043] A prediction data output module: inputting real-time observation data of a target area into the QPSO-LSTM distributed photovoltaic output prediction model and outputting distributed photovoltaic output prediction data of a future period.
[0044] The beneficial effects of the present application are: in the actual working process, first, the historical output data of the target area distributed photovoltaic is systematically collected, and the related meteorological data is combined to construct a training sample set which comprehensively reflects the photovoltaic output characteristics; through the preprocessing steps such as outlier detection, outlier processing and data normalization, the data quality and the stability of the model input are guaranteed. Subsequently, a prediction model with long short-term memory network as the core is constructed to effectively capture the long-range time sequence dependence relationship in the photovoltaic output sequence, in order to overcome the inherent defects of the LSTM model hyperparameter setting depending on experience and being easy to fall into local optimum, the quantum particle swarm optimization algorithm is innovatively introduced to perform global adaptive optimization search on the hyperparameters of the LSTM, so as to determine the best network structure and training configuration of the model. Finally, the optimized QPSO-LSTM model is used to realize accurate and stable prediction of the distributed photovoltaic output in the future period. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. Among them: Figure 1 A flow chart of the photovoltaic output prediction method based on QPSO-LSTM in the embodiment of the present application; Figure 2 A flow chart of constructing the photovoltaic output prediction model based on QPSO-LSTM in the embodiment of the present application; Figure 3A structure diagram of a photovoltaic output prediction system based on QPSO-LSTM in an embodiment of the present application is shown. Figure 4 A comparison diagram of prediction results of a photovoltaic output prediction model based on QPSO-LSTM in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0046] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the embodiments of the present application will be described below in detail with reference to the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the described embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.
[0047] As shown in Figures 1-2 , one embodiment of the present application provides a distributed photovoltaic output prediction method based on QPSO-LSTM, which comprises the following steps:
[0048] S1, collecting original distributed photovoltaic output historical data and related meteorological data of a target area, and generating a training sample data set after preprocessing;
[0049] From the distributed photovoltaic power station monitoring system or the supervisory control and data acquisition system (SCADA) of the target area, historical power data of a long time sequence (such as the past 1-2 years) are collected, and the data time resolution is set according to the prediction requirement, such as 15 minutes or 1 hour a point; from the meteorological observation station, the numerical weather prediction model or the commercial meteorological service provider of the area, historical related meteorological data highly synchronized with the photovoltaic output and of the same time scale are obtained; the key variables include solar radiation intensity (irradiance), ambient temperature, wind speed, relative humidity and cloud cover. The collected photovoltaic output data and five kinds of meteorological factor data are strictly aligned according to the time stamp, and are combined into a complete, multivariate time series data table, each row representing a time, and each column corresponding to the photovoltaic power value and each meteorological factor value.
[0050] The photovoltaic power time series is decomposed using STL (Statistical Transformation of Time) functions in statistical software or programming libraries (such as Python's statsmodels). The series is divided into three parts: a trend term (reflecting long-term changes), a seasonal term (reflecting intraday, weekly, or other periodic patterns), and a residual term (the remaining part after removing the trend and seasonal components, containing noise and outliers). The residual term is analyzed because the residual series has already removed the main regularities; large fluctuations are more likely to be real anomalies caused by equipment failures, communication errors, etc. The LOF (LocalOutlierFactor) algorithm (such as sklearn's LocalOutlierFactor) is used to calculate the "local outlier factor" score for each data point in the residual term. This score measures the density deviation between the point and its neighbors. A threshold (e.g., a score greater than 2) is set; data points with scores exceeding the threshold are identified as outliers, and their corresponding positions in the original photovoltaic power series are also marked. For the outlier data points identified in the previous step (or missing values originally present in the dataset), the K-nearest neighbor method is used for repair. Take samples from both the beginning and end of its time series. Normal data points that were not marked as abnormal; for example, if If the value is 3, then take the following 6 points (2k points in total): X(i-3), X(i-2), X(i-1), X(i+1), X(i+2), and X(i+3). Calculate the arithmetic mean of the values of these 2k neighboring points, and use the resulting average as the new value to replace the original outlier. This completes the smooth repair and reconstruction of abnormal data; the formula is:
[0051] ;
[0052] In the formula, For the m-th data point to be filled, The nearest neighbor number, For the m-th data point One data point, For the m-th data point One data point;
[0053] For each column (each feature) of the integrated dataset (including the repaired photovoltaic power column and five meteorological data columns), normalization is performed independently: for a given column (such as the "temperature" column), the maximum value of that column in the original sample data set of the entire training dataset is first found. and the minimum value in the original sample data set Then for each column Original data values of each sample Applied to the formula:
[0054] ;
[0055] In the formula, is the normalized value of the pth sample data, is the original data value of the pth sample, is the maximum value in the original sample data set, is the minimum value in the original sample data set. After calculation, all data in the column are linearly scaled to the interval [0, 1].
[0056] This eliminates the influence of dimensional differences (such as power in kilowatts and temperature in degrees Celsius) and numerical range differences between different features, making the model training more stable and efficient; the normalized, cleaned, and multivariate aligned data table is the final generated training sample data set.
[0057] S2, QPSO is combined with LSTM to build a QPSO-LSTM original prediction model, and the training sample data set is input; the network structure parameters of the LSTM and the particle swarm parameters of the QPSO are initialized; the hyperparameters of the LSTM are optimized based on the QPSO to obtain an optimized QPSO-LSTM distributed photovoltaic output prediction model;
[0058] The combination of QPSO and LSTM aims to use the global optimization ability of the outer QPSO to automatically find the optimal hyperparameter configuration for the inner LSTM network, which is explained in S22 and S23.
[0059] S21, the network structure of LSTM (Long Short-Term Memory Network) includes: forget gate, input gate, and output gate; the LSTM network maintains the memory of the cell state at time t, and adjusts it through the forget gate and the input gate; the function of the forget gate is to let the cell remember or forget the previous state, and the function of the input gate is to allow or prevent the incoming signal to update the cell state; the function of the output gate is to control the output and transmission of the cell state to the next cell; after the normalized training set sample data are sequentially processed through the forget gate, the input gate, and the output gate, the prediction data of the current data are output; the LSTM network structure is composed of multiple unit structures, which can store information for a long time by updating the internal state, according to the formula:
[0060] ;
[0061] ;
[0062] ;
[0063] ;
[0064] ;
[0065] wherein, is the current time, is the output gate, is the input of the current time, is the external state of the previous time, , are the weight matrices of the input gate, the forget gate, the output gate and the candidate cell state for processing the current input, , are the weight matrices of the input gate, the forget gate, the output gate and the candidate cell state for processing the previous hidden state, , are the bias vectors of the input gate, the forget gate, the output gate and the candidate cell state, is the long-term memory information of the time series, and the activation function and map the output to the interval and the interval , respectively.
[0066] Since the "body" and "learning ability" of the above-mentioned LSTM skeleton are indefinite, they are determined by several key hyperparameters, including: the number of hidden layer neurons (how many memory units the LSTM layer has) determines the capacity and complexity of the network, the number of training times (how many times the entire training data set is repeatedly learned) and the learning rate (the step size of each parameter adjustment) determine the speed and depth of network learning; regarding these hyperparameters as a combination to be optimized, this combination is the "optimal solution" that needs to be searched by the QPSO algorithm.
[0067] S22, QPSO (quantum particle swarm optimization algorithm) is based on the traditional particle swarm optimization algorithm, discards the concept of "velocity" and "deterministic trajectory" in classical mechanics, introduces the ideas of "quantum state" and "probability collapse" in quantum mechanics, and optimizes by simulating the behavior of particles in a quantum potential well. In the QPSO algorithm, a particle represents a potential solution, and the position vector of the particle (such as x1, x2, x3) is designed to encode the LSTM hyperparameters, for example: x1 encodes the number of neurons (such as 50-200), x2 encodes the learning rate (such as 0.0001-0.01), and x3 encodes the number of training rounds (such as 155); at each evaluation, the position vector of the particle is decoded into a set of specific and usable LSTM hyperparameters, and an instance of a specific LSTM network is instantiated with this set of parameters. In this way, the movement and evolution of each particle in QPSO corresponds to the exploration of different configurations of LSTM structures.
[0068] S23, the fusion process is implemented through a main loop, QPSO in the outer layer guide, LSTM in the inner layer to perform and evaluate:
[0069] a, QPSO initialization: randomly generate a group of particles (such as 50), each particle carries a random initial position (that is, a set of random LSTM hyperparameters);
[0070] b, decoding and modeling: take out the current particle position, decode to get the hyperparameters, and use this set of parameters to build a new LSTM network instance;
[0071] c, training and prediction: input the preprocessed training sample dataset into this newly constructed LSTM network for training, and after training, use a reserved validation set to let the network make predictions;
[0072] d, performance evaluation: use four evaluation indicators as fitness function: root mean square error RMSE, mean absolute error MAE, mean relative percentage error MAPE and determination coefficient R 2 , calculate the prediction error of the LSTM model on the validation set, the formula is:
[0073] ;
[0074] ;
[0075] ;
[0076] ;
[0077] In the formula, N represents the number of tests, represents the true value of the jth test, represents the model output value of the jth test, represents the average value of the model output of the jth test; this error value (usually expressed in RMSE or comprehensive score) is the "fitness" of the current particle (that is, the current set of hyperparameters). The smaller the fitness value, the more accurate the model prediction corresponding to this set of parameters, and the better the particle; e, information recording: record the historical best fitness of the current particle itself and its corresponding position, and at the same time, find and update the global best fitness and its position among all particles.
[0078] e, information recording: record the historical best fitness of the current particle itself and its corresponding position, and at the same time, find and update the global best fitness and its position among all particles.
[0079] S24, after the evaluation of all particles in the above-mentioned round, the QPSO starts to play its core optimization role, guiding the particle swarm to evolve towards a better area; for each particle, its "attractor" is calculated according to the formula, which is a random weighted point between the individual optimal and the global optimal, representing the main attractive direction of the current particle; the formula is:
[0080]
[0081] In the formula, is a random value uniformly distributed in the interval , represents the attractor of the i-th particle in the j-th evolution iteration, respectively represent the current optimal value and the global optimal value of the i-th particle in the j-th evolution iteration. According to the following formula, the particle updates its position in a "quantum jump" manner with a certain probability (determined by the random number ) to the positions on both sides of the attractor, obtaining a new position This process simulates the probability collapse in quantum mechanics, giving the QPSO stronger global exploration and the ability to jump out of local optimum, and the formula is:
[0082]
[0083]
[0084] In the formula, is the position of the i-th particle in the j-th evolution iteration, represents the width of the quantum potential well of the i-th dimension of the particle in the j-th iteration. The updated particle position (i.e. the new hyperparameter combination) is returned to S23 to start the next round of "decoding-modeling-training-evaluation" cycle.
[0085]
[0086] S25, the above-mentioned "QPSO optimization cycle" will continue until the maximum number of iterations is reached or the fitness is no longer significantly improved; after optimization, the global optimal particle The carried position vector, that is, corresponding to a set of optimal LSTM hyperparameters (such as: 128 network hidden layer neurons, learning rate 0.005, training times 155); using this set of optimal hyperparameters, the last time an LSTM network is constructed and fully trained, using all the training set + validation set data, and finally a QPSO-LSTM distributed photovoltaic power output prediction model is obtained. It not only has the core ability of LSTM to capture complex time series dependence, but also obtains the optimal network structure and training configuration through the global optimization of QPSO.
[0087] S3, input the real-time observation data of the target area into the QPSO-LSTM distributed photovoltaic power output prediction model, and output the distributed photovoltaic power output prediction data of the future period.
[0088] Obtain the solar radiation intensity, wind speed, temperature, humidity, cloud cover and other meteorological data of the target area at the current time, as well as the recent photovoltaic power output time series data; perform the same preprocessing operation on the real-time observation data as in the training stage, and input the preprocessed real-time data into the trained QPSO-LSTM distributed photovoltaic power output prediction model; the model outputs the photovoltaic power output prediction value of the future period based on the learned time series rule and meteorological influence relationship.
[0089] S4, the QPSO-LSTM distributed photovoltaic power output prediction model is provided with a model updating mechanism, when the average absolute error of continuous multiple prediction periods exceeds the set threshold, the model retraining and parameter reoptimization are automatically triggered.
[0090] After each prediction of the QPSO-LSTM distributed photovoltaic power output prediction model, the system automatically calculates the prediction mean absolute error (MAE) of the period and stores the result in the historical error queue; set an error threshold (such as MAE> 15%) and set the number of continuous monitoring periods (such as 5 consecutive periods), when the system detects that the MAE of continuous N prediction periods exceeds the threshold, the update flag is triggered; the system automatically executes the following steps:
[0091] Collect the latest historical data (including recent meteorological and output data);
[0092] Re-execute data preprocessing (STL-LOF anomaly detection, K-nearest neighbor filling, normalization);
[0093] Call the QPSO algorithm to re-optimize the LSTM hyperparameters (number of neural network hidden layer neurons, training times and learning rate);
[0094] Use new data and optimized parameters to retrain the model;
[0095] After the training is completed, the system automatically verifies the performance of the new model (e.g., the test set error is lower than the original model), and replaces the old model after verification to ensure uninterrupted prediction service.
[0096] As Figure 3 shown, the second embodiment of the present application provides a QPSO-LSTM-based distributed photovoltaic output prediction system, which includes:
[0097] A data acquisition module is configured to acquire original distributed photovoltaic output historical data and related meteorological data of a target area.
[0098] A preprocessing module is configured to preprocess the acquired data to generate a training sample data set.
[0099] A QPSO-LSTM original prediction module is configured to fuse QPSO and LSTM, construct a QPSO-LSTM prediction model, and input the training sample data set.
[0100] A QPSO-LSTM distributed photovoltaic output prediction module is configured to initialize network parameters of the LSTM and particle swarm parameters of the QPSO, perform optimization on hyperparameters of the LSTM based on the QPSO, and obtain an optimized QPSO-LSTM distributed photovoltaic output prediction model.
[0101] A prediction data output module is configured to input real-time observation data of the target area into the QPSO-LSTM distributed photovoltaic output prediction model, and output distributed photovoltaic output prediction data of a future period.
[0102] As Figure 4 shown, the third embodiment of the present application provides a comparison of prediction results of a QPSO-LSTM-based distributed photovoltaic output prediction model, which includes:
[0103] The historical data from 6:00 to 18:00 in May to July 2024 is used as a training set for parameter learning and optimization of the model, and the data from 6:00 to 18:00 in August 2024 is divided into a test set as a basis for model performance verification. Through this time series division method, the prediction ability of the model for the future change trend of distributed photovoltaic output in actual application can be better reflected, ensuring the scientificity and rationality of the evaluation results. In addition, the data preprocessing, feature selection, and model training process are also designed to improve the generalization ability and prediction accuracy of the model. The prediction output results of the distributed photovoltaic output in August 2024 are compared based on the model (QPSO-LSTM) proposed in the present application and the LSTM and PSO-LSTM models, and the prediction results are shown in Table 1.
[0104] Table 1 Prediction results
[0105]
[0106] It can be seen that the three models can better fit the actual distributed photovoltaic output variation trend in the overall trend, but there are differences in prediction accuracy.
[0107] From Figure 4 It can be seen that the QPSO-LSTM distributed photovoltaic output prediction model proposed in the application has the highest prediction accuracy, is significantly better than the LSTM model and the PSO-LSTM model, and can better fit the evolution trend of the real new energy penetration rate. Although there is a certain prediction deviation in the local part, the overall trend is consistent, and the fluctuation change can also basically reflect the synchronization, indicating that the model has good time series tracking ability and short-term prediction stability.
[0108] In summary, compared with the prior art, the present application has the following significant advantages: first, compared with the traditional time series model, single LSTM or experience parameter tuning prediction method, the present application realizes the automatic and global optimization of the hyperparameters by pre-optimizing the LSTM model through the QPSO algorithm, effectively avoids the blindness of manual parameter tuning and the risk of the model falling into local optimum, thereby significantly improving the convergence speed, accuracy and generalization ability of the prediction model. Secondly, the QPSO-LSTM model constructed by the present application has strong global search ability of QPSO and excellent ability of LSTM to depict the time series dynamic characteristics. The LSTM model can effectively learn the long-term rules and short-term fluctuations in the photovoltaic output sequence, and the QPSO algorithm ensures that the structure of the model is in an optimal or near-optimal state from the model level, and the two cooperate to enhance the modeling and prediction effect of the non-linear characteristics such as randomness and intermittence of photovoltaic output. In addition, the method has good engineering applicability and robustness. The optimization process is completed at one time, and the trained model can quickly respond to the prediction demand, meeting the real-time requirements of short-term and ultra-short-term prediction of photovoltaic output in actual power grid dispatching. At the same time, the framework is easy to extend and can adapt to the changes of photovoltaic output characteristics in different regions and different seasons, providing a more reliable technical tool for the safety analysis and optimal dispatching of power grids under the background of high proportion of new energy access. Overall, the present application not only improves the prediction performance of the LSTM model from the mechanism, provides a scientific and efficient parameter optimization solution, but also shows higher prediction accuracy and stability in practical application, provides strong support for accurate prediction and efficient consumption of distributed energy, has important theoretical value and broad engineering application prospect.
[0109] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium.
[0110] In addition, each functional unit in each embodiment of the present application can be integrated in one processing module, or each unit can be physically present separately, or two or more units can be integrated in one module. The above integrated module can be realized in the form of hardware or in the form of a software functional module. The above integrated module, if realized in the form of a software functional module and sold or used as an independent product, can also be stored in a computer readable storage medium. The storage medium can be a read-only memory, a magnetic disk or an optical disk, etc.
[0111] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A photovoltaic power output prediction method based on QPSO-LSTM, characterized in that, include: Collect historical data on the original distributed photovoltaic power output and related meteorological data of the target area, and generate a training sample dataset after preprocessing. The QPSO and LSTM are integrated to construct a QPSO-LSTM distributed photovoltaic power output prediction model, and the training sample dataset is input. The network structure parameters of the LSTM and the particle swarm parameters of the QPSO are initialized. Based on the QPSO, the hyperparameters of the LSTM are optimized to obtain the optimized QPSO-LSTM distributed photovoltaic power output prediction model. The real-time observation data of the target area is input into the QPSO-LSTM distributed photovoltaic power output prediction model, which outputs distributed photovoltaic power output prediction data for future periods. 2.The QPSO-LSTM-based photovoltaic power output prediction method according to claim 1, wherein, The preprocessing process includes: S1. The photovoltaic power time series is decomposed into trend, seasonal and residual parts by STL decomposition. Based on the residual part, the local density deviation of each data point of the photovoltaic power time series is calculated by the local anomaly factor algorithm, and abnormal data is identified. S2. Based on the identified abnormal data, the K-nearest neighbor method is used for filling, and the expression is: ; wherein is the mth data point to be filled, is the number of neighbors, is the preceding data of the mth data point, is the following data of the mth data point; S3. Apply maximum-minimum data normalization to the model input data. 3.The QPSO-LSTM-based photovoltaic power output prediction method according to claim 2, characterized in that, The constructed QPSO-LSTM distributed photovoltaic output prediction model, the LSTM maintains the memory of the moment unit state, adjusts through the forgetting gate And the input gate And the output gate ; the training sample data set is sequentially processed through the forgetting gate, the input gate and the output gate, and the prediction data is output, and the information is stored for a long time by updating the internal state, and the expression is: ; ; ; ; wherein is the current time, is the output gate, is the input of the current time, is the external state of the previous time, , are the input gate, the forget gate, the output gate and the candidate cell state for processing the current input, respectively, , are the input gate, the forget gate, the output gate and the candidate cell state for processing the previous hidden state, respectively, , are the bias vectors of the input gate, the forget gate, the output gate and the candidate cell state, respectively, is the long-term memory information of the time series, the activation function and map the output to the interval and the interval , respectively; In the constructed QPSO-LSTM distributed photovoltaic power output prediction model, the QPSO is optimized by simulating the behavior of particles in a quantum potential well, and the expression is: ; ; wherein is a uniformly distributed random value, is a uniformly distributed random value, is the attractor of the jth particle in the ith evolution iteration, is the attractor of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the current optimal value and the global optimal value of the jth particle during the ith evolution iteration, respectively, is the current optimal value and the global optimal value of the jth particle during the ith evolution iteration, respectively, is the position of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the position of the jth particle in the ith evolution iteration, is the width of the quantum well in the jth dimension.
4. The QPSO-LSTM-based photovoltaic power output prediction method according to claim 3, characterized in that, Based on the QPSO, the hyperparameters of the LSTM are optimized, including: Based on the continuous iterative update of the hyperparameters of LSTM using QPSO, the optimal values of the number of hidden layer neurons, the number of training iterations, and the learning rate of LSTM are obtained, thus acquiring the optimized QPSO-LSTM distributed photovoltaic power output prediction model. In the QPSO, the hyperparameters of the LSTM are evaluated by using a fitness function, the fitness function including: root mean square error RMSE, mean absolute error MAE, mean absolute percentage error MAPE and determination coefficient ; the corresponding calculation formula is: ; ; ; ; In the formula, N represents the number of tests. Indicates the first The true value of this test This represents the model output value in the j-th test. Indicates the first The average value of the output of the model in each test. 5.The QPSO-LSTM-based photovoltaic power output prediction method according to claim 1, wherein, The QPSO-LSTM distributed photovoltaic power output prediction model is equipped with a model update mechanism. When the average absolute error of multiple consecutive prediction cycles exceeds a set threshold, the model is automatically retrained and the parameters are re-optimized. 6.The QPSO-LSTM-based photovoltaic power output prediction method according to claim 1, wherein, The relevant meteorological data include: solar radiation intensity, wind speed, temperature, humidity, and cloud cover.
7. The photovoltaic power output prediction system based on QPSO-LSTM, applied to any photovoltaic power output prediction method based on QPSO-LSTM as claimed in claims 1-6, characterized in that, include: Data acquisition module: used to collect historical data on the original distributed photovoltaic power output and related meteorological data of the target area; Preprocessing module: preprocesses the collected data to generate a training sample dataset; QPSO-LSTM Original Prediction Module: Combines QPSO and LSTM to construct a QPSO-LSTM prediction model, and inputs the training sample dataset; QPSO-LSTM Distributed Photovoltaic Power Output Prediction Module: Initializes the network parameters of the LSTM and the particle swarm parameters of the QPSO, optimizes the hyperparameters of the LSTM based on the QPSO, and obtains the optimized QPSO-LSTM distributed photovoltaic power output prediction model. Predictive data output module: Inputs real-time observation data of the target area into the QPSO-LSTM distributed photovoltaic power output prediction model and outputs distributed photovoltaic power output prediction data for future periods.