Next Article in Journal
Special Issue “Sustainable Operations: Advancing Industry Practices for a Greener Future”
Previous Article in Journal
The Mystery of the High-Carbon Bias in Technology Trade?—An Empirical Examination at the Provincial Level in China Under the Influence of the Digital Economy
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An AI-Based Solar Power Forecasting and Switching System

1
Department of Electrical Engineering, Chung Yuan Christian University, No. 200, Zhongbei Road, Zhongli District, Taoyuan City 320314, Taiwan
2
Graduate Institute of Automation and Control, National Taiwan University of Science and Technology, No. 43, Sec. 4, Keelung Road, Da’an District, Taipei City 106335, Taiwan
*
Author to whom correspondence should be addressed.
Sustainability 2026, 18(13), 6630; https://doi.org/10.3390/su18136630
Submission received: 8 May 2026 / Revised: 17 June 2026 / Accepted: 25 June 2026 / Published: 30 June 2026
(This article belongs to the Section Energy Sustainability)

Abstract

Solar power generation is highly sensitive to short-term weather variations, particularly under rapid cloud movement, leading to significant power fluctuations and challenges in stable energy dispatch. To address this issue, this study proposes an AI-based solar power prediction and power switching control system integrating a hybrid deep learning model with an embedded microcontroller. The model combines radar echo imagery and meteorological time-series data, where a convolutional neural network (CNN) extracts spatial cloud features and a gated recurrent unit (GRU) captures temporal dynamics for short-term irradiance forecasting. Based on the prediction results, the microcontroller performs real-time power source switching between solar and grid supply. Experimental results using real-world data from the Taiwan Central Weather Bureau demonstrate that the proposed system achieves reliable prediction performance and enables effective proactive energy management. These results suggest that the integration of AI-based forecasting and embedded control has potential for renewable energy utilization and power dispatch applications. By supporting intelligent energy management and more efficient use of photovoltaic energy resources, the proposed framework may contribute to sustainable energy utilization in photovoltaic systems.

1. Introduction

With the rapid growth in global demand for renewable energy and the gradual decline in power generation costs, alternative energy generation has received widespread attention over the past decade. Solar power generation has seen a reduction of more than 80% in the cost of photovoltaic (PV) modules, and the cost of residential systems has decreased by more than two-thirds since 2010 [1]. According to the latest statistics from the IEA-PVPS, the global PV installed capacity reached a record high of 456 GW in 2023. However, the report also points out that residential systems still face higher soft costs and different price decline curves compared to large-scale ground-mounted power plants [2,3].
Since power supply is highly dependent on unpredictable weather, the inherent intermittency and randomness of solar power generation pose serious challenges to system operators in energy management and power market dispatch. To maintain the commercial profitability of power plants and system stability, accurate power generation forecasting and intelligent energy dispatch have become the core of modern photovoltaic system management [4,5].
Solar energy prediction technology has accumulated a large amount of research in academia, and traditional methods include multiple linear regression, random forest, and the ARIMA model [4,6,7]. However, these technologies are mostly based on linear assumptions or simplified physical models, making it difficult to accurately capture the complex nonlinear characteristics between photoelectric efficiency and meteorological variables (such as irradiance, temperature, and cloud dynamics) [8,9]. In addition, distributed systems often face challenges such as inconsistent sensor accuracy or a lack of communication data when deployed in practice [10], resulting in insufficient stability of traditional statistical models in practical environments.
To overcome the above limitations, deep learning has become a widely adopted approach for photovoltaic forecasting owing to its ability to learn complex nonlinear relationships from heterogeneous data sources [11,12,13]. Although the combination of convolutional neural networks and recurrent neural networks has been widely applied to improve forecasting performance [14,15,16], existing studies have mainly focused on forecasting accuracy, while comparatively less attention has been given to the integration of forecasting outputs with embedded control systems. In addition, some forecasting studies primarily emphasize statistical performance indicators, such as RMSE and MAE, whereas comparatively fewer studies investigate how forecasting outputs can be directly integrated with embedded controllers and practical actuation mechanisms. Furthermore, some forecasting approaches rely on high-frequency satellite observations or dedicated sky-imaging systems [17,18], which may increase deployment and maintenance costs in practical applications.
Our contributions: This paper proposes a forecast-driven solar power source switching architecture that integrates a Conv2D-GRU hybrid deep learning model [19,20] with an embedded microcontroller. In addition to investigating short-term solar irradiance forecasting performance, this study explores the integration of forecasting outputs with an embedded control framework [21] to establish an automated prediction-to-actuation closed loop, as illustrated in Figure 1.
The main contributions of this research are summarized below:
  • A Conv2D-GRU-based forecasting framework is implemented to incorporate both spatial information derived from radar echo imagery and temporal information obtained from meteorological observations [22,23]. The model is designed for short-term solar irradiance forecasting using heterogeneous data sources.
  • Forecasting outputs are transmitted to an STM32F746 microcontroller (STMicroelectronics, Geneva, Switzerland) through a USB-based communication interface, enabling real-time information exchange between the forecasting module and the embedded control system.
  • An embedded switching framework is implemented to investigate the interaction between AI-based forecasting and prediction-assisted source switching control. The framework demonstrates how forecasting outputs can be integrated with embedded hardware to support proactive switching decisions.
  • Open-source radar data provided by the Central Weather Administrator of Taiwan are utilized as an alternative source of cloud-related information, reducing reliance on dedicated solar irradiance sensing equipment while supporting short-term forecasting and control experiments [24].
This paper is structured as follows: Section 2 reviews related work on solar irradiance forecasting and switching strategies; Section 3 describes the overall system architecture and the proposed Conv2D–GRU model; Section 4 presents the experimental results, including comparative analysis under different weather conditions and evaluation of the embedded switching system; and finally, Section 5 concludes the paper.

2. Related Work

The development of solar energy forecasting technology can be summarized into three stages of evolution from traditional statistics to artificial intelligence. Early research mainly relied on statistical models, such as multiple linear regression and the autoregressive integrated moving average model (ARIMA) [7,22]. These methods have good interpretability in stable climate environments, but their accuracy is significantly limited when dealing with drastically changing weather. Subsequently, machine learning technology and fuzzy systems were applied to capture the nonlinear relationships between meteorological variables. For example, Ghenai et al. [25] used the adaptive neuro fuzzy inference system (ANFIS) for short-term load forecasting and verified the key role of nonlinear feature processing in improving the stability of energy dispatch.
With the improvement of computing power, deep learning has become a widely adopted approach for photovoltaic forecasting [11,26]. In particular, hybrid architectures that combine convolutional neural networks for spatial feature extraction and recurrent neural networks for temporal dependency modeling have been widely investigated in many studies [14,15,19]. Although GRUs can effectively alleviate the gradient vanishing problem [12], their parameter complexity is still a major challenge for practical deployment in embedded environments with limited computing resources. Cho et al. [27] proposed the gated recurrent unit to reduce the computational load while maintaining accuracy by simplifying the gating mechanism. Compared with LSTM, GRU employs a simplified gating structure and requires fewer trainable parameters, making it more suitable for embedded-oriented forecasting applications where computational efficiency is an important consideration. A recent study published in [28] has further confirmed that deep learning architectures have stronger generalization ability when processing long-sequence data compared with traditional methods such as random forest.
For meteorological data with high spatial characteristics, image-based spatiotemporal forecasting has become a research focus in recent years. The convolutional recurrent architecture proposed by Shi et al. [29] laid the theoretical foundation for image sequence forecasting. By integrating the convolution operator into the gating state transition process, it can capture the spatial evolution and temporal evolution of clouds at the same time. Li et al. [20] further reported that architectures combining convolutional layers and GRUs can effectively represent dynamic spatiotemporal features. In addition, for the forecasting needs of nonlinear dynamic systems, some studies have explored a hybrid architecture combining Echo State Networks, which provides an important reference for understanding the complex random fluctuations in renewable energy [30]. This study continues spatiotemporal modeling thinking and uses the Conv2D-GRU architecture to extract features from the meteorological bureau’s radar echo map [31,32,33]. The objective is to investigate whether the lightweight Conv2D-GRU architecture can support short-term forecasting while maintaining relatively low sensing requirements.
Despite significant progress in prediction algorithms, transforming prediction data into effective hardware scheduling instructions remains a core challenge in practical applications. Traditional photovoltaic system switching logic often employs “passive control” based on voltage or power thresholds. This approach is prone to triggering frequent relay switching when frequent cloud cover causes severe fluctuations in power generation, thereby shortening the lifespan of the hardware.
With the development of embedded systems and intelligent energy management technologies, proactive control strategies have gradually gained attention from the academic community. To ensure stable and low-latency communication between the forecasting module and the embedded controller, a wired communication architecture is adopted in this study. Compared with wireless communication approaches, wired communication is often adopted when stable and low-latency transmission is required for embedded control applications. Prediction results generated by the AI model are transmitted to the STM32 microcontroller in real time, enabling proactive hardware switching based on forecasted solar irradiance.
Although existing studies have primarily focused on cloud-based data analysis and offline forecasting, comparatively less attention has been given to the integration of AI-based forecasting models with microcontrollers for real-time actuation. In particular, the closed-loop interaction between image-based prediction and hardware execution has not been sufficiently investigated in practical systems.
This study aims to bridge this gap by establishing a Conv2D-GRU-based proactive control framework, where prediction results are directly linked to hardware switching decisions. The proposed architecture provides a framework for exploring the integration of ultra-short-term forecasting and real-time power management within embedded systems.

3. Methodology

This section describes the methodology of the proposed AI-based solar power forecasting and switching system. The framework integrates data acquisition and preprocessing, spatiotemporal feature extraction, forecasting model design, system architecture, and real-time control implementation on embedded hardware.

3.1. Data Acquisition and Preprocessing

This study utilizes two primary data sources, including meteorological time-series observations and radar echo imagery, to capture both temporal and spatial characteristics associated with solar irradiance variations.
The meteorological data are obtained from the Central Weather Administration (CWA) of Taiwan [34], which provides hourly observations including air temperature, relative humidity, wind speed, wind direction, precipitation, and global horizontal irradiance (GHI) [35]. These variables describe the temporal evolution of atmospheric conditions and serve as the primary inputs for solar irradiance forecasting.
In addition to meteorological observations, radar echo images are incorporated to provide supplementary spatial information related to cloud distribution and precipitation activity. Compared with dedicated sky-imaging systems such as all-sky cameras, radar data are publicly available and can be continuously acquired over a wide geographic area. Previous studies have indicated that cloud coverage and precipitation conditions can significantly influence the amount of solar radiation reaching the Earth’s surface. Therefore, information describing cloud and rainfall patterns may provide useful cues for short-term solar irradiance forecasting.
Radar reflectivity data (dBZ) contains information regarding the intensity and spatial distribution of precipitation systems. Although radar observations do not directly measure cloud coverage, they can provide useful indications of cloud and precipitation conditions surrounding the target location. For this reason, radar echo images are incorporated as an additional data source in this study and are subsequently utilized for radar-derived feature extraction and solar irradiance forecasting.
As illustrated in Figure 2, a region of interest (ROI) centered on the target observation site is extracted from the original radar image and resized to a fixed spatial resolution of 32 × 32 pixels. This procedure reduces computational complexity while preserving the local cloud distribution surrounding the target location. The processed radar images are subsequently utilized for spatiotemporal feature extraction and forecasting model development.
The meteorological observations and processed radar images obtained through the above procedures provide the basis for subsequent spatiotemporal feature extraction and forecasting model construction, which are described in the following sections.

3.2. Spatiotemporal Feature Extraction

To transform the meteorological observations and processed radar images into model-ready representations, a spatiotemporal feature extraction procedure is performed. The objective of this process is to convert heterogeneous data sources into structured numerical features that can effectively describe atmospheric conditions associated with solar irradiance variations.
The proposed feature set consists of three categories, including meteorological features, temporal features, and radar-derived features. Meteorological variables describe the physical state of the atmosphere, temporal variables capture periodic patterns associated with solar radiation, and radar-derived features provide additional spatial information regarding cloud and precipitation activity surrounding the target location.
The extracted features are subsequently integrated and organized into sequential input samples for solar irradiance forecasting. The overall spatiotemporal feature extraction process is illustrated in Figure 3.

3.2.1. Temporal Alignment and Sliding Window Construction

To ensure temporal consistency between meteorological observations and radar echo data, all input variables are aligned according to their corresponding timestamps before feature extraction and model construction. As illustrated in Figure 2, meteorological observations and radar ROI sequences are synchronized to a common temporal framework, allowing information from different sources to be integrated into a unified input representation.
To preserve temporal dependencies, a rolling-window strategy is adopted to construct sequential input samples. Let (T) denote the window length. The input sequence at prediction time (t) is defined as
X t = [ x t T + 1 , , x t ]
where ( X t ) denotes the input sequence at prediction time (t), ( x t ) represents the feature vector at time step (t), and (T) denotes the window length. In this study, (T = 12), corresponding to the previous twelve hourly observations used for solar irradiance forecasting.
Although real-time observations are updated every 10 min during deployment, the interval between adjacent samples within the input sequence remains fixed at one hour. This design maintains the temporal structure used during model training while enabling more frequent prediction updates in practical applications. An example of the rolling-window construction process is presented in Table 1.
As shown in Table 1, the forecasting model maintains a fixed one-hour interval between adjacent observations within the input sequence. For each prediction cycle, a new input sequence is constructed by selecting the most recent twelve observations that satisfy the predefined temporal spacing. This approach preserves the temporal structure used during model training while allowing the prediction target to be continuously updated as new observations become available.

3.2.2. Radar-Derived Feature Extraction

To quantitatively describe cloud distribution and precipitation activity surrounding the target location, four radar-derived statistical features are extracted from each processed radar image. These features are designed to represent the intensity, variability, spatial coverage, and relative location of radar echoes within the region of interest (ROI). The physical meanings of the extracted radar features are summarized in Table 2.
The average radar reflectivity within the ROI is calculated as
Radar _ Mean = 1 N i = 1 N I i
where ( I i ) denotes the reflectivity value of the (i)-th pixel and (N) represents the total number of pixels within the ROI. This feature reflects the overall radar echo intensity within the observation region.
The spatial variability of radar reflectivity is represented by the standard deviation
Radar _ Std = 1 N i = 1 N I i R a d a r _ M e a n 2
which describes the degree of variation in radar echo intensity within the ROI.
The echo coverage ratio is calculated as
Radar _ Cov = N r N
where ( N r ) denotes the number of pixels whose reflectivity exceeds the predefined threshold and (N) represents the total number of pixels within the ROI. This feature reflects the spatial coverage of effective radar echoes within the observation region.
The relative location of the radar echo region is represented by
Radar _ Dist = x c x 0 2 + y c y 0 2
where (( x c , y c )) denotes the centroid coordinates of the effective radar echo region and (( x 0 , y 0 )) represents the center coordinates of the ROI. This feature describes the relative distance between the dominant precipitation region and the target observation location.
To further illustrate the physical relevance of radar-derived features, Figure 4 presents the temporal relationship between radar feature statistics and precipitation. It can be observed that variations in radar reflectivity are closely associated with rainfall events, indicating that radar data effectively capture cloud dynamics and precipitation intensity. This relationship supports the use of radar imagery as an informative input for short-term solar irradiance prediction.
By extracting the radar-derived features described above, the original radar echo imagery can be transformed into structured numerical representations that characterize cloud and precipitation conditions surrounding the target location. These features are subsequently integrated with meteorological and temporal variables to form the input feature set for the forecasting model.

3.2.3. Feature Fusion and Normalization

After radar-derived feature extraction, the radar features are integrated with meteorological observations and temporal variables to construct the final input feature set. The objective of this process is to combine information from multiple sources into a unified representation that can effectively describe atmospheric conditions associated with solar irradiance variations.
The final input features used in this study are summarized in Table 3.
As summarized in Table 3, the final feature set consists of meteorological, temporal, and radar-derived variables. Meteorological features describe the current atmospheric conditions, temporal features capture cyclic seasonal and diurnal patterns, and radar-derived features provide additional information regarding cloud and precipitation activity.
In addition, the solar irradiance observation from the previous time step (Insolation_Lag1) is included as an input feature to provide historical irradiance information and assist the forecasting model in capturing short-term temporal dependencies.
Temporal variables are represented using cyclic encoding to preserve daily and seasonal periodicity. Specifically, sine and cosine transformations are applied to the hour and month variables to avoid discontinuities associated with raw temporal values.
To reduce scale differences among variables and improve numerical stability during model training, all input features are normalized using min–max scaling, which can be expressed as
X n o r m = X X m i n X m a x X m i n
where ( X ) denotes the original feature value, while ( X m i n ) and ( X m a x ) represent the minimum and maximum values obtained from the training dataset, respectively. The normalized feature value ( X n o r m ) is constrained to the range [0, 1].
Following feature fusion and normalization, the resulting feature vectors are organized into sequential samples using the rolling-window strategy described in Section 3.2.1. The processed input data are subsequently provided to the Conv2D-GRU forecasting model for solar irradiance prediction.

3.3. Forecasting Model Architecture

Based on the spatiotemporal features described in Section 3.2, a Conv2D-GRU forecasting model is developed for solar irradiance prediction. The proposed architecture combines convolutional feature extraction with recurrent temporal modeling, enabling the learning of both feature correlations and temporal dependencies from the fused input data.
The overall architecture of the proposed model is illustrated in Figure 5, while the corresponding hyperparameter settings are summarized in Table 4.
The model first employs convolutional layers to extract representative patterns from the input features. The extracted feature maps are subsequently reshaped and processed by a GRU layer to capture temporal dependencies within the sequential data. The resulting hidden representations are then passed through fully connected layers and mapped to a single output neuron to generate the predicted solar irradiance value.
Through the integration of convolutional and recurrent learning mechanisms, the proposed Conv2D-GRU architecture is designed to effectively model both short-term atmospheric dynamics and feature interactions associated with solar irradiance variations.

3.4. System Overview

This section describes the system architecture developed to integrate solar irradiance forecasting with embedded control and power management. Based on the Conv2D-GRU forecasting model described in Section 3.3, the proposed framework utilizes forecasting results as references for subsequent switching decisions.
The system consists of four major components, including the overall system framework, physical implementation, switching control strategy, and embedded communication framework. Through the integration of forecasting, decision-making, and control modules, the proposed architecture is intended to support predictive energy management under varying environmental conditions.

3.4.1. Overall System Architecture

The proposed system integrates solar irradiance forecasting, embedded control, and power management into a unified framework. As shown in Figure 6, the architecture consists of three functional layers, including the forecasting layer, embedded control layer, and power management layer.
The forecasting layer utilizes the Conv2D-GRU model described in Section 3.3 to generate solar irradiance predictions from meteorological and radar-derived features. The embedded control layer receives prediction results and converts them into control commands, while the power management layer performs power source switching according to the received control signals.
Unlike conventional threshold-based approaches that rely solely on instantaneous measurements, the proposed framework incorporates forecasted solar irradiance information into the switching decision process. This design is intended to provide additional information for power source selection under changing weather conditions.

3.4.2. Physical Implementation

A prototype system is constructed to evaluate the feasibility of the proposed framework under practical operating conditions. The implementation consists of a solar panel, embedded controller, communication interface, and power management components integrated into a functional hardware platform, as shown in Figure 7.
The forecasting model is executed on a host computer, while the STM32 microcontroller is responsible for receiving control commands and performing switching operations. The resulting prototype serves as an experimental platform for investigating the interaction between the forecasting and embedded control modules.
The major hardware components identified in Figure 6 are summarized in Table 5.

3.4.3. Switching Control Strategy

To mitigate unnecessary switching caused by short-term prediction fluctuations, a hysteresis-based control strategy is adopted. Two switching thresholds are defined at 280 W/m2 and 320 W/m2.
The threshold values were selected based on the operating conditions of the prototype system and preliminary observations of solar irradiance variations during system testing. The selected thresholds were subsequently applied throughout the experiments to provide a consistent basis for evaluating the proposed switching strategy. A hysteresis band is introduced between the two thresholds to reduce frequent switching near the decision boundary while maintaining a consistent switching strategy. The corresponding switching rules are summarized in Table 6.
As shown in Table 6, the system switches to solar mode when the predicted irradiance exceeds 320 W/m2 and switches to utility mode when the predicted irradiance falls below 280 W/m2. When the predicted value remains within the hysteresis region, the previous operating state is maintained to avoid unnecessary switching caused by short-term prediction fluctuations.
The overall switching process is illustrated in Figure 8. Based on the predicted solar irradiance, the controller determines the operating mode according to the predefined hysteresis thresholds. The hysteresis-based switching logic adopted in this study can be mathematically represented as Equation (7).
S t a t e = S o l a r , P t > 320 U t i l i t y , P t < 280 S t a t e t 1 , 280 P t 320
where ( P t ) denotes the predicted solar irradiance at time step (t), and ( S t a t e t 1 ) represents the previous operating state. The hysteresis mechanism allows the system to maintain its current state when predictions fall within the transition region.
The current implementation utilizes deterministic point forecasts for decision making. Future studies may investigate the incorporation of uncertainty estimation techniques to further assess their potential influence on switching performance under highly variable weather conditions.

3.4.4. Embedded Communication Framework

The forecasting results generated by the host computer are transmitted to the STM32 microcontroller through a USB-to-UART communication interface. The received information is subsequently converted into control commands and processed by the switching logic implemented on the embedded controller.
The communication interface serves as a bridge between the forecasting module and the embedded controller, allowing prediction results to be transferred for subsequent switching decisions. A wired communication architecture is adopted in this study to provide stable and low-latency data transmission during system operation.
Figure 9 illustrates the communication workflow between the forecasting module and the STM32 controller. By separating forecasting and control tasks, the proposed architecture provides a flexible framework for integrating machine learning models with embedded control systems.
The proposed framework establishes a prediction-assisted control mechanism in which forecasting results are incorporated into the switching decision process. The resulting control commands are subsequently transmitted to the embedded controller for power source switching.
The performance of the proposed switching strategy is further evaluated in Section 4.

4. Results

This section presents the experimental results of the proposed solar irradiance forecasting framework. First, the evaluation metrics and experimental settings adopted in this study are introduced. Subsequently, the forecasting performance of different models is compared to using multiple statistical indicators. Finally, the practical behavior of the proposed switching control strategy is analyzed using the embedded prototype system described in Section 3.

4.1. Evaluation Metrics

To evaluate the forecasting performance of the proposed model, several standard regression metrics are adopted, including mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), and the coefficient of determination (R2).
The MAE measures the average magnitude of prediction errors and is defined as:
MAE = 1 N i = 1 N y i y ^ i
The RMSE emphasizes larger errors by penalizing squared deviations and is given by:
RMSE = 1 N i = 1 N y i y ^ i 2
The MAPE quantifies the relative prediction error in percentage form:
MAPE = 100 % N i = 1 N y i y ^ i y i
It is noted that MAPE may be sensitive to low-irradiance conditions, where small actual values can lead to disproportionately large percentage errors. In this study, no samples are excluded, and the reported MAPE reflects performance across all operating conditions, including low irradiance periods.
The R2 evaluates how well the predicted values match the observed data:
R 2 = 1 y i y ^ i 2 y i y ¯ 2
where y i and y ^ i denote the actual and predicted values, respectively, y ¯ represents the mean of the observed values, and N denotes the total number of samples.
These metrics provide complementary perspectives for evaluating model performance, including absolute error, sensitivity to large deviations, relative accuracy, and overall goodness of fit. Together, they are used to assess the forecasting capability of different models under the selected evaluation conditions.

4.2. Experimental Setup

The dataset utilized in this study consists of meteorological observations and radar-derived features collected from the Central Weather Bureau of Taiwan. The data span from 1 January 2024 to 31 December 2025, with a total of approximately 15,161 records. After constructing input sequences using the rolling-window strategy described in Section 3, 15,149 valid samples are obtained.
The meteorological data are primarily recorded at hourly intervals, including temperature, precipitation, relative humidity, wind speed, and whole-sky solar irradiance. Radar data are originally updated at a higher temporal resolution (approximately every 10 min). To maintain consistency with the temporal structure adopted for model training, radar-derived features are preprocessed and temporally aligned with the meteorological observations, resulting in hourly input sequences.
The target variable is whole-sky solar irradiance expressed in physical units (W/m2). To provide a realistic evaluation setting, the dataset is partitioned chronologically. Specifically, 80% of the data are allocated to model development, while the remaining 20% are reserved for testing. Within the development subset, 10% of the samples are further assigned to validation. This results in approximately 72% training data, 8% validation data, and 20% testing data. Such a partitioning strategy avoids information leakage from future observations.
The proposed Conv2D-GRU model is trained using the Adam optimizer with an initial learning rate of 0.0001. The loss function is defined as MAE, while MSE is monitored as an additional evaluation metric. The model is trained for up to 200 epochs with a batch size of 16. Additional training configurations are summarized in Table 4.
To evaluate the forecasting capability of the proposed approach, six models are considered for comparison, including Conv2D-GRU, Conv2D, GRU, XGBoost, TCN-BiGRU, and TCN-BiGRU-Conv2D. These models represent different approaches for temporal modeling, spatial feature extraction, and hybrid spatiotemporal learning. All models are trained and evaluated under comparable experimental settings to facilitate a consistent comparison.

4.3. Forecasting Performance Comparison

This section compares the forecasting performance of the evaluated models using the metrics introduced in Section 4.1. The comparison includes Conv2D-GRU, Conv2D, GRU, XGBoost, TCN-BiGRU, and TCN-BiGRU-Conv2D. Model performance is first analyzed under general daytime conditions using statistical indicators and is subsequently examined under different weather scenarios through representative forecasting cases.

4.3.1. General Performance

The overall forecasting performance of the evaluated models is summarized in Table 7. As shown in Table 7, the proposed Conv2D-GRU model provides the lowest MAE (58.10 W/m2), RMSE (96.37 W/m2), and MAPE (24.02%), while also achieving the highest R2 value (0.9210) among the evaluated models. These results suggest that the proposed model can represent solar irradiance variations more consistently than the comparison models under the selected evaluation conditions.
Compared with the other evaluated models, the Conv2D-GRU architecture combines spatial feature extraction and temporal sequence modeling within a unified framework. Conv2D achieves performance comparable to that of the proposed model, while GRU exhibits larger prediction errors. A similar trend can also be observed when comparing model pairs with and without convolutional feature extraction. Conv2D-GRU achieves lower prediction errors than GRU, while TCN-BiGRU-Conv2D provides slightly improved performance compared with TCN-BiGRU. These observations suggest that incorporating convolutional operations may help extract useful spatial information and contribute to forecasting performance. The hybrid TCN-BiGRU and TCN-BiGRU-Conv2D models provide reasonable forecasting accuracy but exhibit slightly larger errors than the proposed Conv2D-GRU model.
Figure 10 presents representative forecasting results under general conditions, including comparisons between actual and predicted solar irradiance values as well as the corresponding prediction errors.
All evaluated models are able to capture the overall diurnal irradiance pattern; however, noticeable deviations can still be observed during peak irradiance periods and rapid transition intervals.
The proposed Conv2D-GRU model generally follows the observed irradiance trend more closely than the comparison models. In addition, the corresponding prediction errors tend to remain within a relatively narrower range throughout most of the evaluation period.
These observations are consistent with the quantitative results presented in Table 7.

4.3.2. Sunny Condition Performance

The forecasting performance under sunny conditions is summarized in Table 8. Under sunny conditions, all evaluated models achieve lower prediction errors than those observed under general conditions, reflecting the relatively stable irradiance patterns during clear-sky periods.
As shown in Table 8, the proposed Conv2D-GRU model provides the lowest MAE (40.36 W/m2), RMSE (57.15 W/m2), and MAPE (10.73%), while also achieving the highest R2 value (0.9737) among the evaluated models. These results suggest that the proposed model can represent solar irradiance variations consistently under sunny conditions.
Compared with GRU, the Conv2D-GRU model exhibits lower prediction errors. A similar trend can also be observed between TCN-BiGRU and TCN-BiGRU-Conv2D, where the incorporation of convolutional operations is associated with a modest improvement in forecasting performance. Conv2D also achieves performance comparable to that of the proposed model, indicating that spatial feature extraction remains useful even under relatively stable weather conditions.
Figure 10 presents representative forecasting results under sunny conditions, including both the predicted solar irradiance values and the corresponding prediction errors.
As shown in Figure 11, all evaluated models can capture the overall diurnal irradiance pattern under sunny conditions. Nevertheless, deviations can still be observed near peak irradiance periods, where prediction errors tend to increase.
The proposed Conv2D-GRU model generally follows the observed irradiance trend more closely than the comparison models. In addition, the corresponding prediction errors remain within a relatively narrower range throughout most of the evaluation period.
These observations are consistent with the quantitative results presented in Table 8.

4.3.3. Rainy Condition Performance

The forecasting performance under rainy conditions is summarized in Table 9. Rainy conditions are generally associated with stronger irradiance fluctuations and more complex cloud dynamics, making solar irradiance forecasting more challenging than under sunny conditions.
As shown in Table 9, the proposed Conv2D-GRU model provides the lowest MAE (86.65 W/m2), MAPE (58.19%), and the highest R2 value (0.6943) among the evaluated models. Although Conv2D achieves a lower RMSE (142.28 W/m2), the overall results suggest that the proposed Conv2D-GRU model maintains comparatively stable forecasting performance under rainy conditions.
Compared with GRU, the Conv2D-GRU model exhibits lower prediction errors. A similar trend can also be observed when comparing TCN-BiGRU and TCN-BiGRU-Conv2D. These observations suggest that incorporating convolutional feature extraction may provide useful information for representing cloud-related variations during rainy periods. Nevertheless, all evaluated models exhibit larger forecasting errors than those observed under sunny conditions, reflecting the increased difficulty of prediction under highly variable weather conditions.
Figure 11 presents representative forecasting results under rainy conditions, including comparisons between actual and predicted solar irradiance values as well as the corresponding prediction errors.
As shown in Figure 12, solar irradiance under rainy conditions exhibits substantial fluctuations, resulting in larger prediction errors for all evaluated models. Noticeable deviations can be observed during rapid irradiance transitions associated with cloud movement and precipitation events.
The proposed Conv2D-GRU model generally follows the observed irradiance trend more closely than most comparison models, particularly during periods of abrupt irradiance variation. In addition, the corresponding prediction errors tend to remain within a relatively narrower range throughout much of the evaluation period.
Nevertheless, larger prediction errors are still observed during several high-variability intervals, indicating the challenges associated with forecasting solar irradiance under rainy conditions. These observations are consistent with the quantitative results presented in Table 9.

4.3.4. Performance Analysis Across Weather Conditions

To further compare model behavior under different weather conditions, scatter plots between the actual and predicted solar irradiance values are presented in Figure 12. The plots are constructed using the same representative evaluation periods adopted in Section 4.3.2 and Section 4.3.3. A closer concentration of data points around the 1:1 reference line indicates better agreement between the predicted and observed irradiance values.
As shown in Figure 13a, the data points under sunny conditions are generally concentrated around the 1:1 reference line for all evaluated models, indicating relatively strong agreement between predicted and observed irradiance values. Among the evaluated models, Conv2D-GRU exhibits the highest coefficient of determination and a comparatively tighter distribution around the reference line.
In contrast, Figure 13b shows a noticeably larger dispersion of data points under rainy conditions. This reflects the increased forecasting difficulty associated with rapid cloud movement and stronger irradiance fluctuations. Nevertheless, the proposed Conv2D-GRU model maintains a relatively closer alignment with the reference line compared with several of the comparison models.
These observations are consistent with the results presented in Table 8 and Table 9, indicating that forecasting performance is strongly influenced by weather variability. Overall, the results suggest that incorporating both spatial and temporal information contributes positively to forecasting performance under different weather conditions.

4.4. Control Performance Evaluation

Following the forecasting performance evaluation presented in Section 4.3, this section examines the control performance of the proposed prediction-driven switching strategy. The analysis focuses on switching behavior, hysteresis operation, communication performance, and prototype implementation results under the experimental conditions.

4.4.1. Switching Behavior Analysis

The control system is evaluated over a test period from 2 April 2026 to 31 May 2026. During this period, forecasting results are continuously converted into switching decisions through the hysteresis-based control logic described in Section 3.4.3.
The overall switching statistics obtained during the evaluation period are summarized in Table 10.
As shown in Table 10, a total of 7577 valid control records are collected during the evaluation period. The proposed switching strategy generates 117 switching events, including 59 transitions from utility mode to solar mode and 58 transitions from solar mode to utility mode. The comparable number of transitions in both directions suggests that the switching mechanism responds to variations in predicted solar irradiance while maintaining balanced operation between the two power sources.
In addition, 163 control events are observed within the hysteresis region (280–320 W/m2). No switching actions occur while the predicted irradiance remains inside the hysteresis band, indicating that the control logic successfully maintains the previous operating state near the decision boundary. This behavior helps reduce unnecessary switching caused by short-term prediction fluctuations.

4.4.2. Communication Performance Analysis

The communication performance between the forecasting platform and the embedded controller is evaluated through UART transmission records collected during the experimental period. For each switching decision generated by the forecasting system, a corresponding control command is transmitted to the STM32 controller, which subsequently returns an acknowledgment message after execution.
The communication statistics obtained during the evaluation period are summarized in Table 11.
As shown in Table 11, all transmitted control commands are successfully acknowledged by the STM32 controller, resulting in a communication success rate of 100%. No communication failures or missing acknowledgments are observed during the experiment.
In addition, the measured communication latency exhibits an average value of 0.052 s. Considering that the forecasting horizon adopted in this study is one hour, the communication delay is negligible relative to the control interval and does not affect the execution of switching decisions.
These results indicate that the proposed communication framework provides reliable information exchange between the forecasting platform and the embedded controller under the experimental conditions.

4.4.3. Duty Cycle Analysis

The duty cycle distribution under different time ranges is summarized in Table 12.
As shown in Table 12, the solar utilization ratio varies considerably across different time periods. When the entire 24-h period is considered, solar power accounts for 22.99% of the operating time, while utility power accounts for 77.01%. This result is primarily influenced by nighttime periods when solar irradiance is unavailable.
When the analysis is restricted to daytime hours (06:00–18:00), the solar utilization ratio increases to 42.98%. During peak daytime periods (08:00–18:00), solar utilization further increases to 53.00%, indicating that solar power becomes the dominant energy source during periods of higher irradiance availability.
The observed duty cycle distribution reflects the combined influence of environmental conditions and the selected control strategy. Since solar irradiance varies throughout the day and across different weather conditions, the proportion of solar operation naturally changes over the evaluation period.
Overall, the results indicate that the proposed prediction-driven switching strategy is capable of utilizing solar energy when irradiance conditions are favorable while maintaining utility power support during periods of insufficient solar availability. This behavior is consistent with the objective of balancing renewable energy utilization and stable system operation within the experimental setup.

5. Discussion and Conclusions

This study presents a prediction-driven solar power management system that integrates a Conv2D–GRU forecasting model with an embedded switching mechanism for real-time energy control. By combining radar-derived spatial features with meteorological time-series data, the proposed approach incorporates information related to both cloud dynamics and temporal atmospheric variations for short-term solar irradiance forecasting.
The experimental results indicate that the proposed Conv2D–GRU model achieves competitive forecasting performance under different weather conditions. Compared with the evaluated baseline models, lower prediction errors are generally observed, particularly under rainy conditions where solar irradiance exhibits stronger variability. These observations suggest that the incorporation of spatial information derived from radar-related features may contribute positively to forecasting performance under complex weather conditions.
In addition to forecasting performance, the proposed framework is evaluated within an embedded control environment. The experimental results show stable switching behavior throughout the evaluation period, with a relatively low switching frequency and no observed chattering events. The hysteresis-based control strategy helps reduce unnecessary switching near the decision boundary, while the duty cycle analysis indicates that solar energy utilization increases during periods of favorable irradiance availability.
The system design also reflects a practical trade-off between solar utilization and switching stability. The selected threshold settings contribute to stable operation under experimental conditions but may limit the overall proportion of solar utilization. This observation highlights the importance of jointly considering control performance and energy utilization when designing prediction-assisted energy management systems.
Compared with conventional measurement-based switching systems that rely on dedicated irradiance sensors and instantaneous observations, the proposed framework utilizes meteorological observations and radar data to estimate near-future irradiance conditions. This approach reduces sensing hardware requirements while providing predictive information for switching decisions. Although the current implementation focuses on source switching rather than comprehensive energy management optimization, the forecasting model enables the controller to anticipate short-term solar variability before significant irradiance changes are observed. Therefore, forecasting serves not only as an alternative sensing mechanism but also as a means of supporting prediction-assisted control actions.
Nevertheless, several limitations remain. The evaluation is conducted using data collected from a specific geographic region and operational setting, which may limit the generalizability of the results to other climates and environments. In particular, the meteorological characteristics of Taiwan, including frequent cloud movement and convective rainfall events, may differ from those of tropical, desert, or high-latitude regions. Therefore, additional validation using datasets collected under different climatic conditions is required to further assess the generalizability of the proposed framework.
In addition, the current implementation adopts fixed switching thresholds, and the experimental validation is limited to the available evaluation period. The selected hysteresis thresholds were determined empirically for the prototype system and may require adjustment under different load characteristics or operating environments.
Future work may investigate adaptive threshold mechanisms, uncertainty-aware forecasting approaches, and additional validation under diverse weather conditions and deployment scenarios. In addition, the forecasting information may be further integrated with battery energy storage scheduling, time-of-use electricity pricing strategies, and V2X-enabled energy coordination. These extensions could enable the proposed framework to support more proactive energy management decisions based on anticipated solar availability.
Collectively, the findings suggest that the proposed framework provides a feasible approach for integrating AI-based forecasting with embedded control. The study highlights the potential of combining forecasting and control strategies within a unified framework for proactive solar energy management.

Author Contributions

Conceptualization, M.Y.H.; methodology, M.Y.H.; software, M.Y.H.; validation, M.Y.H., S.H.C. and Y.P.L.; formal analysis, M.Y.H.; investigation, M.Y.H.; resources, M.Y.H.; data curation, M.Y.H.; writing—original draft preparation, M.Y.H.; writing—review and editing, M.Y.H., S.H.C. and Y.P.L.; visualization, M.Y.H.; supervision, S.H.C. and Y.P.L.; project administration, S.H.C. and Y.P.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by National Science and Technology Council (NSTC), R.O.C. under Grants NSTC 113-2221-E-011-166-MY2.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The original contributions presented in this study are included in the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. International Energy Agency. Renewables 2024: Analysis and Forecasts to 2030; International Energy Agency: Paris, France, October 2024; Available online: https://www.iea.org/reports/renewables-2024 (accessed on 6 May 2026).
  2. International Energy Agency Photovoltaic Power Systems Programme (IEA-PVPS). Trends in Photovoltaic Applications 2024. Report IEA-PVPS T1-41:2024. October 2024. Available online: https://iea-pvps.org/trends_reports/trends-in-pv-applications-2024/ (accessed on 6 May 2026).
  3. Taiwan Power Company. Time-of-Use Electricity Pricing. Available online: https://www.taipower.com.tw/ (accessed on 6 May 2026).
  4. Yang, D.; Kleissl, J.; Gueymard, C.A.; Pedro, H.T.C.; Coimbra, C.F.M. History and Trends in Solar Irradiance and PV Power Forecasting: A Preliminary Assessment and Review Using Text Mining. Sol. Energy 2018, 168, 60–101. [Google Scholar] [CrossRef]
  5. Iheanetu, K.J. Solar Photovoltaic Power Forecasting: A Review. Sustainability 2022, 14, 17005. [Google Scholar] [CrossRef]
  6. Singla, P.; Duhan, M.; Saroha, S. A Comprehensive Review and Analysis of Solar Forecasting Techniques. Front. Energy 2022, 16, 187–223. [Google Scholar] [CrossRef]
  7. Pedro, H.T.; Coimbra, C.F. Assessment of Forecasting Techniques for Solar Power Production with No Exogenous Inputs. Sol. Energy 2012, 86, 2017–2028. [Google Scholar] [CrossRef]
  8. Mellit, A.; Kalogirou, S.A. Artificial Intelligence Techniques for Photovoltaic Applications: A Review. Prog. Energy Combust. Sci. 2008, 34, 574–632. [Google Scholar] [CrossRef]
  9. Al-Dahidi, S.; Madhiarasan, M.; Al-Ghussain, L.; Abubaker, A.M.; Ahmad, A.D.; Alrbai, M.; Aghaei, M.; Alahmer, H.; Alahmer, A.; Baraldi, P.; et al. Forecasting Solar Photovoltaic Power Production: A Comprehensive Review and Innovative Data-Driven Modeling Framework. Energies 2024, 17, 4145. [Google Scholar] [CrossRef]
  10. Islam, M.S.; Hasan, A.S.M.J.; Rahman, M.S.; Yusuf, J.; Sajol, M.S.I.; Tumpa, F.A. Location Agnostic Source-Free Domain Adaptive Learning to Predict Solar Power Generation. In Proceedings of the 2023 IEEE International Conference on Energy Technologies for Future Grids (ETFG), Wollongong, Australia, 3–6 December 2023; pp. 1–6. [Google Scholar] [CrossRef]
  11. LeCun, Y.; Bengio, Y.; Hinton, G. Deep Learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef] [PubMed]
  12. Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [PubMed]
  13. Bamisile, O.; Cai, D.; Oluwasanmi, A.; Ejiyi, C.; Ukwuoma, C.C.; Ojo, O.; Mukhtar, M.; Huang, Q. Comprehensive Assessment, Review, and Comparison of AI Models for Solar Irradiance Prediction Based on Different Time/Estimation Intervals. Sci. Rep. 2022, 12, 9644. [Google Scholar] [CrossRef] [PubMed]
  14. Lee, W.; Kim, K.; Park, J.; Kim, J.; Kim, Y. Forecasting Solar Power Using Long-Short Term Memory and Convolutional Neural Networks. IEEE Access 2018, 6, 73068–73080. [Google Scholar] [CrossRef]
  15. Qu, J.; Qian, Z.; Pei, Y. Day-Ahead Hourly Photovoltaic Power Forecasting Using Attention-Based CNN-LSTM Neural Network Embedded with Multiple Relevant and Target Variables Prediction Pattern. Energy 2021, 232, 120996. [Google Scholar] [CrossRef]
  16. Cheng, L.; Zang, H.; Wei, Z.; Ding, T.; Xu, R.; Sun, G. Short-Term Solar Power Prediction Learning Directly from Satellite Images With Regions of Interest. IEEE Trans. Sustain. Energy 2022, 13, 629–639. [Google Scholar] [CrossRef]
  17. Travieso-González, C.M.; Cabrera-Quintero, F.; Piñán-Roescher, A.; Celada-Bernal, S. A Review and Evaluation of the State of Art in Image-Based Solar Energy Forecasting: The Methodology and Technology Used. Appl. Sci. 2024, 14, 5605. [Google Scholar] [CrossRef]
  18. Zhang, S.; Dong, Z.; Qi, D.; Wang, M.; Xu, Z.; Han, Y. Intra-Hour PV Power Forecasting Technique Based on Total-Sky Images. CSEE J. Power Energy Syst. 2024, 12, 210–219. [Google Scholar] [CrossRef]
  19. Ladjal, B.; Nadour, M.; Bechouat, M.; Hadroug, N.; Sedraoui, M.; Rabehi, A.; Guermoui, M.; Agajie, T.F. Hybrid Deep Learning CNN–LSTM Model for Forecasting Direct Normal Irradiance: A Study on Solar Potential in Ghardaia, Algeria. Sci. Rep. 2025, 15, 15404. [Google Scholar] [CrossRef] [PubMed]
  20. Li, J.; Yang, J.; Gao, L.; Wei, L.; Mao, F. Dynamic Spatial-Temporal Graph Convolutional GRU Network for Traffic Forecasting. In Proceedings of the 2021 6th International Conference on Systems, Control and Communications (ICSCC), Chongqing, China, 15–17 October 2021; pp. 19–24. [Google Scholar] [CrossRef]
  21. Olatomiwa, L.; Mekhilef, S.; Ismail, M.S.; Moghavvemi, M. Energy Management Strategies in Hybrid Renewable Energy Systems: A Review. Renew. Sustain. Energy Rev. 2016, 62, 821–835. [Google Scholar] [CrossRef]
  22. Reikard, G. Predicting Solar Radiation at High Resolutions: A Comparison of Time Series Forecasts. Sol. Energy 2009, 83, 342–349. [Google Scholar] [CrossRef]
  23. Alharkan, H.; Habib, S.; Islam, M. Solar Power Prediction Using Dual Stream CNN-LSTM Architecture. Sensors 2023, 23, 945. [Google Scholar] [CrossRef] [PubMed]
  24. Yang, J.; He, H.; Zhao, X.; Wang, J.; Yao, T.; Cao, H. Day-Ahead PV Power Forecasting Model Based on Fine-Grained Temporal Attention and Cloud-Coverage Spatial Attention. IEEE Trans. Sustain. Energy 2023, 15, 1062–1073. [Google Scholar] [CrossRef]
  25. Ghenai, C.; Al-Mufti, O.A.A.; Al-Isawi, O.A.M.; Amirah, L.H.L.; Merabet, A. Short-Term Building Electrical Load Forecasting Using Adaptive Neuro-Fuzzy Inference System (ANFIS). J. Build. Eng. 2022, 52, 104323. [Google Scholar] [CrossRef]
  26. Yu, J.; Li, X.; Yang, L.; Li, L.; Huang, Z.; Shen, K.; Yang, X.; Yang, X.; Xu, Z.; Zhang, D.; et al. Deep Learning Models for PV Power Forecasting: Review. Energies 2024, 17, 3973. [Google Scholar] [CrossRef]
  27. Cho, K.; Van Merriënboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; Bengio, Y. Learning phrase representations using an RNN encoder-decoder for statistical machine translation. arXiv 2014, arXiv:1406.1078. [Google Scholar] [CrossRef]
  28. Olcay, K.; Tunca, S.G.; Özgür, M.A. Forecasting and Performance Analysis of Energy Production in Solar Power Plants Using Long Short-Term Memory (LSTM) and Random Forest Models. IEEE Access 2024, 12, 103299–103312. [Google Scholar] [CrossRef]
  29. Shi, X.; Chen, Z.; Wang, H.; Yeung, D.Y.; Wong, W.K.; Woo, W.C. Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting. In Proceedings of the Advances in Neural Information Processing Systems 28 (NIPS 2015), Montreal, QC, Canada, 7–12 December 2015; pp. 802–810. [Google Scholar]
  30. López, E.; Valle, C.; Allende, H.; Gil, E.; Madsen, H. Wind Power Forecasting Based on Echo State Networks and Long Short-Term Memory. Energies 2018, 11, 526. [Google Scholar] [CrossRef]
  31. Rao, Z.; Yang, Z.; Yang, X.; Li, J.; Meng, W.; Wei, Z. TCN-GRU Based on Attention Mechanism for Solar Irradiance Prediction. Energies 2024, 17, 5767. [Google Scholar] [CrossRef]
  32. Alharbi, M.; Alghamdi, A.S. Hybrid CNN-GRU Forecasting and Improved Teaching–Learning-Based Optimization for Cost-Efficient Microgrid Energy Management. Processes 2025, 13, 1452. [Google Scholar] [CrossRef]
  33. Sansine, V.; Ortega, P.; Hissel, D.; Ferrucci, F. Hybrid Deep Learning Model for Mean Hourly Irradiance Probabilistic Forecasting. Atmosphere 2023, 14, 1192. [Google Scholar] [CrossRef]
  34. Central Weather Administration (CWA). Open Meteorological Data Platform. Available online: https://opendata.cwa.gov.tw (accessed on 9 June 2026).
  35. Zhang, Y.; Ren, X.; Zhang, F.; Liu, Y.; Li, J. A Deep Learning-Based Dual-Scale Hybrid Model for Ultra-Short-Term Photovoltaic Power Forecasting. Sustainability 2024, 16, 7340. [Google Scholar] [CrossRef]
Figure 1. Forecast-driven solar power source switching framework.
Figure 1. Forecast-driven solar power source switching framework.
Sustainability 18 06630 g001
Figure 2. Radar Echo Preprocessing for Model Input. A 32 × 32 region of interest (ROI) is extracted from the raw radar reflectivity image and resized for use as the model input.
Figure 2. Radar Echo Preprocessing for Model Input. A 32 × 32 region of interest (ROI) is extracted from the raw radar reflectivity image and resized for use as the model input.
Sustainability 18 06630 g002
Figure 3. Workflow of spatiotemporal feature extraction and input construction.
Figure 3. Workflow of spatiotemporal feature extraction and input construction.
Sustainability 18 06630 g003
Figure 4. Temporal relationship between radar-derived features and precipitation.
Figure 4. Temporal relationship between radar-derived features and precipitation.
Sustainability 18 06630 g004
Figure 5. CNN–GRU forecasting architecture illustrating spatial feature extraction from radar ROI sequences, latent sequence embedding, temporal modeling, and regression-based solar irradiance prediction under a rolling window framework.
Figure 5. CNN–GRU forecasting architecture illustrating spatial feature extraction from radar ROI sequences, latent sequence embedding, temporal modeling, and regression-based solar irradiance prediction under a rolling window framework.
Sustainability 18 06630 g005
Figure 6. Overall architecture of the proposed solar energy management system. The blue, green, and cyan dashed boxes represent the forecasting layer, embedded control layer, and power management layer, respectively. Orange arrows indicate the data flow between system modules, while red arrows represent the power flow within the power management layer.
Figure 6. Overall architecture of the proposed solar energy management system. The blue, green, and cyan dashed boxes represent the forecasting layer, embedded control layer, and power management layer, respectively. Orange arrows indicate the data flow between system modules, while red arrows represent the power flow within the power management layer.
Sustainability 18 06630 g006
Figure 7. Physical implementation of the proposed solar energy management system. (A) Host computer; (B) STM32F746ZG development board; (C) Relay module; (D) DFR0535 solar power management module; (E) Solar panel; (F) DC/DC converter; and (G) LED indicator.
Figure 7. Physical implementation of the proposed solar energy management system. (A) Host computer; (B) STM32F746ZG development board; (C) Relay module; (D) DFR0535 solar power management module; (E) Solar panel; (F) DC/DC converter; and (G) LED indicator.
Sustainability 18 06630 g007
Figure 8. Hysteresis-based switching logic used for power source selection. The left flowchart illustrates the control process for hysteresis-based switching. The red dashed box highlights the hysteresis decision logic, where the controller switches to solar mode when the predicted irradiance exceeds 320 W/m2, switches to utility mode when it falls below 280 W/m2, and maintains the previous operating mode within the hysteresis band (280–320 W/m2). The blue arrow links the decision logic to the switching condition diagram shown on the right, which illustrates the hysteresis thresholds and switching behavior based on the predicted irradiance.
Figure 8. Hysteresis-based switching logic used for power source selection. The left flowchart illustrates the control process for hysteresis-based switching. The red dashed box highlights the hysteresis decision logic, where the controller switches to solar mode when the predicted irradiance exceeds 320 W/m2, switches to utility mode when it falls below 280 W/m2, and maintains the previous operating mode within the hysteresis band (280–320 W/m2). The blue arrow links the decision logic to the switching condition diagram shown on the right, which illustrates the hysteresis thresholds and switching behavior based on the predicted irradiance.
Sustainability 18 06630 g008
Figure 9. Communication workflow between the forecasting module and STM32 embedded controller.
Figure 9. Communication workflow between the forecasting module and STM32 embedded controller.
Sustainability 18 06630 g009
Figure 10. (a) Comparison of the actual solar irradiance (black line) and the predicted solar irradiance from different forecasting models under general weather conditions. (b) Corresponding prediction errors of different models.
Figure 10. (a) Comparison of the actual solar irradiance (black line) and the predicted solar irradiance from different forecasting models under general weather conditions. (b) Corresponding prediction errors of different models.
Sustainability 18 06630 g010aSustainability 18 06630 g010b
Figure 11. (a) Comparison of the actual solar irradiance (black line) and the predicted solar irradiance from different forecasting models under sunny conditions. (b) Corresponding prediction errors of different models.
Figure 11. (a) Comparison of the actual solar irradiance (black line) and the predicted solar irradiance from different forecasting models under sunny conditions. (b) Corresponding prediction errors of different models.
Sustainability 18 06630 g011
Figure 12. (a) Comparison of the actual solar irradiance (black line) and the predicted solar irradiance from different forecasting models under rainy conditions. (b) Corresponding prediction errors of different models.
Figure 12. (a) Comparison of the actual solar irradiance (black line) and the predicted solar irradiance from different forecasting models under rainy conditions. (b) Corresponding prediction errors of different models.
Sustainability 18 06630 g012
Figure 13. Scatter plots of actual and predicted solar irradiance for different forecasting models under (a) sunny conditions and (b) rainy conditions.
Figure 13. Scatter plots of actual and predicted solar irradiance for different forecasting models under (a) sunny conditions and (b) rainy conditions.
Sustainability 18 06630 g013
Table 1. Example of rolling-window input sequence construction during real-time inference.
Table 1. Example of rolling-window input sequence construction during real-time inference.
Prediction TimeInput Sequence (12 Hourly Observations)Forecast Target
15:1014:20, 13:20, …, 3:2015:20
15:2014:30, 13:30, …, 3:3015:30
15:3014:40, 13:40, …, 3:4015:40
Table 2. Physical interpretation of radar-derived features.
Table 2. Physical interpretation of radar-derived features.
FeaturePhysical Meaning
Radar_MeanAverage radar echo intensity within the ROI
Radar_StdVariability of radar echo intensity within the ROI
Radar_CovRatio of effective echo area within the ROI
Radar_DistDistance between the dominant echo region and the ROI center
Table 3. Input feature categories used for solar irradiance forecasting.
Table 3. Input feature categories used for solar irradiance forecasting.
CategoryFeatures
Meteorological FeaturesTemperature, Dew Point, Relative Humidity, Wind Speed, Wind Direction, Precipitation, Insolation_Lag1
Temporal
Features
Hour_sin, Hour_cos, Month_sin, Month_cos
Radar-Derived FeaturesRadar_Mean, Radar_Std, Radar_Cov, Radar_Dist
Table 4. Hyperparameter settings of the proposed Conv2D-GRU model.
Table 4. Hyperparameter settings of the proposed Conv2D-GRU model.
ParameterValue
OptimizerAdam
Learning Rate0.0001
Batch Size16
Epochs200
Early StoppingPatience = 25
Loss FunctionMAE
Table 5. Hardware components used in the prototype system.
Table 5. Hardware components used in the prototype system.
LabelComponent
AHost Computer (Leadtek Research Inc., New Taipei City, Taiwan)
BSTM32F746ZG Development Board (STMicroelectronics, Geneva, Switzerland)
CRelay Module (BEST MODULES CORP., Hsinchu, Taiwan)
DDFR0535 Solar Power Management Module (DFRobot, Shanghai, China)
ESolar Panel (E-KONG Solar Technology Co., Ltd., Dongguan, China)
FDC/DC Converter (In-house fabricated PCB adapter board, Taoyuan, Taiwan)
GLED Indicator (In-house fabricated PCB adapter board, Taoyuan, Taiwan)
Table 6. Switching decision rules adopted in the proposed system.
Table 6. Switching decision rules adopted in the proposed system.
Predicted IrradianceSystem Action
>320 W/m2Solar Mode
280–320 W/m2Maintain Previous State
<280 W/m2Utility Mode
Table 7. Performance comparison under general conditions.
Table 7. Performance comparison under general conditions.
ModelMAE (W/m2)RMSE (W/m2)MAPE (%)R2
XGBoost62.9799.1324.870.9068
GRU67.04109.6328.370.8860
Conv2D59.8097.7624.470.9094
Conv2D_GRU58.1096.3724.020.9210
TCN_BiGRU64.65103.9027.310.8977
TCN_BiGRU_Conv2D63.77101.8525.690.9038
Table 8. Performance comparison under sunny conditions.
Table 8. Performance comparison under sunny conditions.
ModelMAE (W/m2)RMSE (W/m2)MAPE (%)R2
XGBoost49.9467.3711.680.9592
GRU42.8360.8711.160.9667
Conv2D41.6958.7111.010.9690
Conv2D_GRU40.3657.1510.730.9737
TCN_BiGRU45.6060.3011.620.9673
TCN_BiGRU_Conv2D42.1456.5911.760.9712
Table 9. Performance comparison under rainy conditions.
Table 9. Performance comparison under rainy conditions.
ModelMAE (W/m2)RMSE (W/m2)MAPE (%)R2
XGBoost94.83150.5961.860.6444
GRU98.37155.8569.350.6192
Conv2D85.77142.2857.350.6825
Conv2D_GRU86.65144.1358.190.6943
TCN_BiGRU99.27156.5269.650.6559
TCN_BiGRU_Conv2D92.73154.1358.770.6875
Table 10. Switching statistics during the evaluation period.
Table 10. Switching statistics during the evaluation period.
ItemValue
Valid Control Records7577
Total Switching Events117
Utility → Solar59
Solar → Utility58
Hysteresis Events163
Switching Within Hysteresis Band0
Table 11. Communication performance statistics during the evaluation period.
Table 11. Communication performance statistics during the evaluation period.
ItemValue
Total Commands Sent7577
Successful Acknowledgments7577
Communication Success Rate100%
Average UART Latency0.052 s
Table 12. Duty cycle distribution under different time ranges.
Table 12. Duty cycle distribution under different time ranges.
Time RangeSolar (%)Utility (%)
Full day (24 h)22.9977.01
Daytime (06:00–18:00)42.9857.02
Peak daytime (08:00–18:00)53.0047.00
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Hsieh, M.Y.; Chang, S.H.; Liao, Y.P. An AI-Based Solar Power Forecasting and Switching System. Sustainability 2026, 18, 6630. https://doi.org/10.3390/su18136630

AMA Style

Hsieh MY, Chang SH, Liao YP. An AI-Based Solar Power Forecasting and Switching System. Sustainability. 2026; 18(13):6630. https://doi.org/10.3390/su18136630

Chicago/Turabian Style

Hsieh, Ming You, Shin Hung Chang, and Yu Ping Liao. 2026. "An AI-Based Solar Power Forecasting and Switching System" Sustainability 18, no. 13: 6630. https://doi.org/10.3390/su18136630

APA Style

Hsieh, M. Y., Chang, S. H., & Liao, Y. P. (2026). An AI-Based Solar Power Forecasting and Switching System. Sustainability, 18(13), 6630. https://doi.org/10.3390/su18136630

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop