**1. Introduction**

Solar power is one of the viable alternatives to fossil-fuel-generated power, which causes serious environmental damage [1]. In terms of total energy consumption, India is ranked third after China and the United States [2], and has a target of producing 57% of total electricity capacity from renewable sources by 2027 [3]. In this paper, we developed a novel method for the short-term (some hours ahead) [4] forecasting of the clearness index (Kt) (defined as the ratio of global horizontal irradiance (GHI) to extraterrestrial irradiance) [5–8] while accounting for unpredictable weather conditions, focusing on variability in cloud cover [9–12]. Cloud variability leads to highly localized solar prediction, as a single model is unable to provide accurate forecasts under different weather conditions [13,14].

Long short-term memory (LSTM) [15] is one of the most popular deep-learning algorithms, mainly used to handle sequential data, and it can preserve knowledge by passing through the subsequent time steps of a time series [16]. In [17], the authors developed a site-specific univariate LSTM for the hourly forecasting of photovoltaic power output. In [18], the authors compared the performance of several alternative models for forecasting clear-sky GHI. These included gated recurrent units (GRUs), LSTM, recurrent neural networks (RNNs), feed-forward neural networks (FFNNs), and support vector regression (SVR). GRU and LSTM outperformed the other models in terms of root mean square error

**Citation:** Malakar, S.; Goswami, S.; Ganguli, B.; Chakrabarti, A.; Roy, S.S.; Boopathi, K.; Rangaraj, A.G. Deep-Learning-Based Adaptive Model for Solar Forecasting Using Clustering. *Energies* **2022**, *15*, 3568. https://doi.org/10.3390/en15103568

Academic Editors: Luis Hernández-Callejo, Sergio Nesmachnow and Sara Gallardo Saavedra

Received: 24 March 2022 Accepted: 19 April 2022 Published: 13 May 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

(RMSE). In [19], the authors proposed an hour-ahead solar power forecasting model based on RNN-LSTM for three different solar plants. In [9], LSTM and GRU dominated over artificial neural networks (ANNs), FFNNs, SVR, random forest regressor (RFR), and multilayer perceptron (MLP) in solar forecasting. The above discussion suggests that the authors used a single model to forecast solar irradiation for a particular day and did not consider cloud cover at the time of forecasting. In [20], the authors designed a forecasting model for one-day ahead hourly prediction using LSTM. The authors reported that the algorithm performed effectively under fully or partially cloudy conditions. In [21], the authors proposed a one-hour-ahead hybrid solar forecasting model using traditional machine-learning models such as random forest (RF), gradient boosting (GB), support vector machines (SVMs), and ANNs. The RF model showed the best forecasting accuracy for the spring and autumn seasons, while the SVR model performed best for the winter and summer seasons. In [22], the authors evaluated 68 machine-learning models for 3 sky conditions, 7 locations, and 5 climate zones in the continental United States. No universal model exists, and specific models for each sky and climate condition are recommended. Hence, it is well-established that a single site-specific forecasting model is unable to produce consistent forecasting performance in all cloud conditions and seasons [20–22].

Typically, a site-specific model is built for solar-energy prediction, and multiple models are built for different seasons. However, even within the same day, there can be fluctuations due to variability in cloud cover [23]. So, a single model gives a very high error in terms of NRMSE. The error is further pronounced for time windows with high cloud variability. The authors in [22], found that a specific forecasting model showed very high error in NRMSE in overcast cloud conditions in comparison with clear-sky conditions on a particular day. They also stated that forecasting performance significantly changed with the change in cloud conditions on a particular day. The authors in [24], stated that LSTM outperformed other predictive models in short-term solar forecasting. Nevertheless, its ability to predict cloudy days with low solar irradiance is significantly reduced. This serves as a motivation to implement an adaptive model. Table 1 summarizes the forecasting error of LSTM for nine solar stations across three climatic zones of India. Solar stations are described in Section 3.1. Figure 1 depicts the deviation of NRMSE in high- and lowvariability cloud-cover conditions in comparison with overall NRMSE. In high cloud-cover variability, forecasting error was significantly higher compared to overall NRMSE. This signifies that if cloud variability ever increases too much, site-specific LSTM cannot handle such a situation very well. Another motivation is provided by the parity plot in Figure 2, which shows forecast and actual clearness indices for three solar stations separately for high and low cloud-cover variability conditions. Forecasts were more accurate under low-variability cloud cover conditions than those for high-variability cloud conditions.

In this paper, we propose a novel short-term (2 h ahead) solar forecasting approach [25] that uses clustering on the basis of cloud parameters as a preprocessing step, and subsequently uses LSTM that is cluster-specific for the forecasting clearness index. Specifically,


The major contributions of the paper are as follows:


The rest of the paper is organized as follows. Section 2 provides the background on various deep-learning model architectures. Section 3 presents the proposed method, and Section 4 presents details on its forecasting performance. The paper is concluded with a discussion in Section 5.

**Table 1.** Forecasting performance (NRMSE in %) of LSTM for high- and low-cloud-variability cloud cover.


**Figure 1.** Deviation of NRMSE (%) in high and low cloud-cover variability conditions compared to overall NRMSE (%).

**Figure 2.** Parity plot showing forecast and actual clearness indices for three solar stations for high and low cloud-cover variability conditions. (**a**) Bhainsdehi (high cloud-cover variability); (**b**) Bhainsdehi (low cloud-cover variability); (**c**) Osmanabad (high cloud-cover variability); (**d**) Osmanabad (low cloud-cover variability); (**e**) Khaga (high cloud-cover variability); (**f**) Khaga (low cloud-cover variability).
