1. Introduction
PV energy emerges as a leading renewable energy source, boasting abundant resources, accessibility, and low operational costs. With the escalating energy demand in developing countries, the growth rate of PV power generation has skyrocketed, posing significant challenges to the electrical system capacity [
1]. The International Energy Agency’s 2023 report [
2] highlights a notable increase in global PV generation in 2022, with the total installed capacity reaching 1185 gigawatts and an addition of 240 gigawatts. PV systems have significantly reduced CO
2 emissions from electricity by approximately 1399 tons, underscoring their role in decreasing both electricity costs and emissions. Nonetheless, the intermittent, volatile, and unpredictable output of grid-connected PV systems frequently disrupts the operation, dispatch, and planning of power systems [
3]. Precise PV power forecasting markedly improves solar energy utilization, boosting power stations’ return on investment and minimizing economic losses due to power constraints [
4]. Consequently, research into PV power forecasting is crucial and holds substantial value.
PV forecasting methods are categorized into two primary types: statistical and artificial intelligence (AI) models. Statistical models, including the Autoregressive Moving Average (ARMA) [
5], Autoregressive Integrated Moving Average (ARIMA), and Seasonal Autoregressive Integrated Moving Average (SARIMA) [
6], have been employed. While these models effectively process time series data, they are less adept at managing nonlinear and high-dimensional datasets [
7]. With the advancement of artificial intelligence, newer methods have demonstrated superior capabilities in addressing these challenges. These AI models excel at precisely identifying the dynamic properties of PV power generation [
8]. They autonomously learn and discern complex data patterns, enhancing their efficacy in forecasting PV output. This evolution marks a significant shift, suggesting a promising future for AI in PV forecasting [
9].
Deep learning indeed showcases remarkable abilities in generalization and automatic feature extraction [
10]. Agga et al. [
11] conducted experiments comparing common deep learning prediction models with machine learning prediction models, confirming the superior effectiveness of deep learning methods. Hence, in predicting PV power, deep learning methods [
12] like Artificial Neural Networks (ANNs), CNNs, and Recurrent Neural Networks (RNNs) are typically selected as base models and combined with other methods to create hybrid models for improved accuracy. Zhang et al. [
13] proposed a Wavelet Neural Network (WNN) model based on the Genetic Algorithm (GA) and validated it using experimental data collected every half hour under four typical weather conditions at PV power stations. Feng et al. [
14] introduced a novel hybrid model called KS-CEEMDAN-SE-LSTM, which captures similar characteristics of PV power generation by decomposing and reconstructing data to reduce non-stationary and noisy features. Case studies have demonstrated its strong performance in short-term PV power prediction. Trong et al. [
15] employed Variational Mode Decomposition (VMD) for data preprocessing and proposed a new approach for short-term PV power prediction using the Transformer Neural Network (TransNN) and CNN.
The deep learning models mentioned have demonstrated high accuracy and the ability to capture spatio-temporal features in predicting PV power [
16], resulting in favorable outcomes. However, some networks encounter the vanishing gradient issue during long-term sequence prediction, which hinders their capability to manage long-term dependencies within the dataset [
17]. Additionally, these models often lack interpretability, are susceptible to overfitting, and demand substantial computational resources [
18]. The attention mechanism, as an effective information filtering technique, enables the model to focus adaptively on important features by adjusting the weights of multiple input feature vectors, thereby enhancing the weight of important information and reducing the computational resource requirements [
19]. Mirza et al. [
20] introduced a deep learning model that integrates a transformer architecture, residual networks, and multi-head attention mechanisms. This model introduces attention mechanisms that selectively focus on pertinent information and understand long-term dependencies within the dataset, thereby improving the accuracy of predictions for wind and PV power output. Yin et al. [
21] developed a short-term wind power prediction model that integrates an improved attention mechanism into the Inception Embedding Attention Memory Fully Connected Network. This model outperformed all other comparison algorithms (including EfficientNet, NasNet, and ResNet) by more than 40% on all evaluation metrics. Wang et al. [
22] utilized the BiGRU-Attention model to improve the prediction accuracy of low-frequency sequences in wind power. They then aggregated the predicted values from all components to generate the final prediction outcome. These studies collectively showcase the ability of self-attention mechanisms to extract significant features and identify temporal patterns in data, highlighting their significant potential for application in new-energy prediction.
Due to the fluctuation, randomness, and temporality of meteorological data in PV power prediction [
23], RNNs and LSTM, which have advantages in handling time series data in deep learning methods, are often used for the temporal feature analysis of PV data, while convolutional neural networks (CNNs) are also used for the spatial feature analysis of PV data because of their strong feature extraction capabilities [
24]. However, these models require hyperparameter tuning, and the choice of parameters determines the quality of the model’s prediction results, often using bio-inspired optimization algorithms to identify the optimal hyperparameters for the model [
25]. The Crested Porcupine Optimizer (CPO) [
26] algorithm, proposed in 2023 by Abdel-Basset et al., is a nature-inspired metaheuristic method that utilizes the visual, auditory, olfactory, and physical attack defense mechanisms of the crested porcupine, corresponding to the algorithm’s exploration and exploitation behaviors, to precisely optimize large-scale problems. The algorithm introduces a technique for reducing the cyclic population, activating the defense mechanism only for threatened individuals, thereby improving the convergence speed and population diversity. It exhibits a significantly superior performance on most test functions in the CEC2014, CEC2017, and CEC2020 benchmark tests. Currently, the theory and data of the CPO algorithm are sufficient, but it has not yet been applied to model optimization problems.
In this study, our primary focus revolves around three key aspects. Firstly, we delved into the CNN-LSTM PV power prediction model, leveraging deep learning technology and incorporating an attention mechanism to dynamically extract crucial features. Secondly, we performed a comparative analysis of the predictive performances between models with and without the attention mechanism, alongside the introduction of the CPO algorithm to optimize LSTM parameters. Lastly, we tested the algorithm for embedding MRTPP patterns with different step sizes and compared its performance with those of other algorithms. Furthermore, this paper delineates the following key contributions:
- (1)
The introduction of a deep learning model, CNN-LSTM, that incorporates an attention mechanism. By leveraging this model, we can fully extract the spatio-temporal changing features of parameters, enabling the CLA model to effectively focus on crucial historical data for future power prediction, thus enhancing the prediction performance.
- (2)
To enhance the model’s predictive ability further, we integrated the CPO algorithm to more efficiently adjust LSTM network parameters, resulting in the formation of the CPO-CNN-LSTM-Attention model. Notably, this is the first instance where the CPO algorithm has been utilized for parameter optimization in the LSTM algorithm, to the best of our knowledge.
- (3)
Experimental findings suggest that the proposed PV power prediction model surpasses other classical models in accuracy, demonstrating promising application prospects.
4. Conclusions
To tackle the challenge of short-term sequence forecasting in PV generation, a novel prediction model, CPO-CLA, has been developed. This model integrates the attention mechanism from deep learning with the Crested Porcupine Optimizer algorithm into a CNN-LSTM framework, introducing the CPO algorithm into the LSTM algorithm for parameter optimization for the first time. It effectively focuses on the most important parts of historical data using superior time series processing capabilities, enhancing the accuracy and stability of predictions. Additionally, MRTPP is proposed, which leverages both univariate and multivariate time series forecasts, wherein the target variable and its related multivariate time series serve as inputs. The experimental results prove that the CLA model adapts better and more stably across different time scales. The CPO algorithm excels in optimizing model parameters, reducing the loss value to below 0.02 by the fifth iteration, significantly enhancing the model’s convergence speed. Compared to traditional methods and recently developed optimization models at a step length of 13, the CPO-CLA model has the lowest RMSE and MAE, with an R2 score of 0.974, demonstrating superiority and stability, validating its effectiveness and applicability in the day-ahead hourly power prediction of photovoltaic systems. The CPO-CLA model based on MRTPP not only excels in prediction accuracy but also demonstrates consistent performance during model training and testing, reflecting the model’s high generalization ability and robustness. However, the model does not predict long-term temporal patterns, limiting its capacity to capture connections between long-term sequence data. Both short-term and long-term temporal patterns could be considered for integration in future forecasting work.