Skip to Content
SolarSolar
  • Article
  • Open Access

11 March 2026

21 Pages

Comparison of Electricity Production Prediction Models Based on Meteorological Data for Photovoltaic Farms in Poland—Challenges and Problems

and
Department of Telecommunications and Teleinformatics, Faculty of Automatic Control, Electronics and Computer Science, Silesian University of Technology, Akademicka 16, 44-100 Gliwice, Poland
*
Author to whom correspondence should be addressed.

Abstract

In response to the growing need for accurate forecasting of electricity generation from PV installations, which is crucial both for enhancing self-consumption and for balancing the power grid, this study presents a comparative analysis of selected machine learning models. The research focuses on the XGBoost algorithm and LSTM neural networks, applied to predict PV energy production based on meteorological data and historical generation records from four medium-sized PV installations (30–50 kWp) located in Poland. Meteorological data were retrieved from open sources and combined with actual production measurements to build the training dataset. This paper discusses the challenges posed by these data at the given latitude, as well as issues related to processing data from newly launched installations. The performance of both approaches was evaluated in short- and medium-term forecasting, with particular attention to prediction accuracy, robustness to noisy data, and the ability to capture nonlinear relationships.

1. Introduction

The global transition towards sustainable energy systems is driving a rapid expansion of photovoltaic (PV) installations, establishing solar energy as a key element of the modern renewable energy landscape. This paradigm shift, driven by the imperative to decarbonize the global economy and observable climate change, has fundamentally changed the topology of electrical grids. Moving from a centralized model dominated by generators burning fossil fuels to a decentralized network of weather-dependent resources requires a complete reimagining of energy management systems. In many countries of the European Union, solar energy is currently recognized not only as an alternative but as a critical component for ensuring future energy security and sustainability, with solar PV projected to meet a substantial portion of electricity demand by 2030 [1]. This shift is particularly visible in Poland, a country historically dependent on coal-fired generation, where the share of renewable energy sources (mainly PV) has surged in recent years. By the end of 2023, Poland’s installed PV capacity exceeded 17 GW, driven largely by a boom in prosumer micro-installations, positioning the country as a leader in European market dynamics [2]. In Poland, prosumers refer to electricity producers in installations with a capacity of up to 50 kW—these are most often micro-installations owned by individuals or small businesses, producing energy primarily for their own use. They feed energy into the grid using a net-metering model (feeding energy to the grid during peak production and drawing a portion when household consumption exceeds production) or a net-billing model (feeding surplus energy to the grid at predetermined or dynamic market rates). However, solar irradiance exhibits inherent intermittency. In combination with Poland’s geographical location, this leads to substantial variability in power generation, posing a significant challenge to grid stability. This requires a complete reimagining of energy management systems with advanced forecasting methods to enable the effective integration of these installations and the management of energy consumption, which is crucial for ensuring the stability and security of the country’s power system [3].
The primary purpose of this work is to develop and validate a robust predictive model for next-day PV electricity production, leveraging the eXtreme Gradient Boosting (XGBoost) algorithm integrated with high-resolution meteorological data. The significance of this study lies in its direct applicability to the evolving regulatory and technical landscape of the Polish energy market. With the transition from net-metering to net-billing in 2022, and the subsequent introduction of dynamic tariffs based on hourly pricing in July 2024, the economic viability of prosumer installations now hinges on the ability to predict generation profiles and optimize self-consumption [4]. Accurate 24-h forecasting enables prosumers and energy management systems to align energy usage with production peaks, thereby mitigating the risk of voltage-induced inverter shutdowns—a prevalent issue in Poland’s low-voltage networks [5,6].
The current state of the research field is characterized by a dichotomy between physical modeling approaches and data-driven techniques. Physical models, which rely on numerical weather prediction and mathematical representations of PV systems, provide interpretability but often suffer from errors due to inaccurate system parameters and local shading effects [7]. On the other hand, machine learning (ML) and deep learning (DL) methods have gained prominence for their ability to learn complex, non-linear mappings between weather variables and power output directly from historical data. Recent literature extensively compares these approaches, with a particular focus on the trade-offs between computational complexity and predictive accuracy [8,9].
Key publications have highlighted the efficacy of ensemble methods like Random Forest and Gradient Boosting Machines for short-term solar forecasting. For instance, studies have demonstrated that XGBoost often outperforms traditional statistical methods like ARIMA (Autoregressive Integrated Moving Average) and even complex deep learning architectures such as LSTM (Long Short-Term Memory) networks when dealing with tabular meteorological data and limited historical datasets typical of newly installed residential PV systems [10]. While LSTMs are theoretically superior for capturing long-term temporal dependencies, their tendency to overfit on small datasets (such as those that are being generated for newly built PV installations) and higher computational requirements have led to controversial and diverging hypotheses regarding their practical superiority over tree-based models for day-ahead forecasting [11]. Furthermore, the integration of hybrid models, combining the feature extraction capabilities of Convolutional Neural Networks (CNNs) with the temporal processing of LSTMs or the gradient boosting of XGBoost, represents a frontier in enhancing forecast precision [12].
This study also addresses the critical role of data quality, evaluating the integration of meteorological data from the Open-Meteo API, which aggregates multiple high-resolution local weather models (e.g., DWD ICON, MeteoFrance AROME). The quality of such forecast data is crucial, as the accuracy of the PV model is fundamentally bounded by the quality of the input weather variables [13] and any errors from weather models are directly transferred to energy production predictions. In the context of Poland, specific challenges such as snow cover (as demonstrated by the data analysis in the paper) and high cloud variability introduce additional layers of complexity that standard models often fail to address [14]. Additionally, issues related to network quality and system stability are discussed in the Section “Photovoltaic Market Dynamics and Grid Integration Challenges in Poland.”
Finally, the main aim of this work is to demonstrate that a properly tuned XGBoost model, enriched with domain-specific features such as solar zenith angles and seasonal indicators, can achieve state-of-the-art accuracy for next-day PV forecasting in the Polish climatic context. The principal conclusions suggest that this approach not only surpasses baseline models but also provides a computationally efficient solution suitable for deployment in edge computing devices [15] such as the Home Assistant ecosystem. To ensure the practical applicability of the developed forecasting models for prosumers, the solution was deployed as a Home Assistant Add-on [16]. In the Home Assistant ecosystem (Supervisor architecture), an Add-on is a standalone Docker container running alongside the core automation platform, enabling the forecasting models to operate in an isolated environment with their own dependencies. The Add-on exchanges data with the Home Assistant Core via an internal API, publishing PV generation forecasts as virtual sensors. These forecasts can be directly used by Home Assistant automations to support local energy management, including increasing PV self-consumption during periods of high predicted generation. The edge-based execution on the user’s hardware ensures low latency, data privacy, and independence from external cloud services. By enabling precise energy planning, this research contributes to the broader goal of stabilizing distributed energy grids and maximizing the economic benefits of renewable energy prosumers under dynamic pricing schemes [17]. Properly prepared predictions can also indicate inverter anomalies, enabling the identification of critical failures in PV systems [18].

Photovoltaic Market Dynamics and Grid Integration Challenges in Poland

The trajectory of the Polish photovoltaic market represents one of the most dynamic shifts in the European energy sector over the last decade. Historically anchored in coal-based generation, Poland has successfully diversified its energy mix, with PV playing a leading role. As noted in Section 1, by the end of 2023, the total installed capacity of PV systems had surpassed 17 GW, a milestone that underscores the rapid acceleration of solar adoption [2]. This growth has not been uniform; it has been characterized by distinct phases driven by evolving subsidy mechanisms and regulatory frameworks. Initially, the market was propelled by the “Mój Prąd” (My Electricity) program, which incentivized residential prosumers to invest in micro-installations (up to 50 kW). This resulted in a distributed generation landscape dominated by over 1.3 million individual prosumers by 2024 [4]. These small-scale systems have created a decentralized topology that the existing distribution network was not originally designed to accommodate. In the short term, this led to the shutdown of individual inverters during peak photovoltaic energy production hours. The long-term consequences, particularly in rural areas dominated by old transmission networks, meant that newly constructed installations were unable to transmit energy to the grid for many hours a day during periods of rapid urbanization. More recently, data from the Institute for Renewable Energy (IEO [19]) indicates a structural shift towards larger-scale installations. In the first quarter of 2025 alone, Poland added 637 MW of new capacity, with utility-scale farms (above 1 MW) significantly increasing their market share. This transition reflects a maturing market that is moving from purely residential rooftop systems to substantial commercial and industrial generation capacities.
The regulatory environment in Poland has been the primary architect of the PV market’s morphology. The initial net-metering system, which operated on a system of discounts (allowing prosumers—depending on the installation size—to feed energy into the grid and retrieve 80% of it later for free), was highly favorable and sparked the initial boom. However, this system treated the grid as a virtual battery, decoupling production from consumption signals and creating huge problems for the distribution system operators. In April 2022, Poland switched to net-billing, a value-based settlement system where prosumers sell overproduced energy at the monthly market price and purchase energy at retail rates. This mechanism began to align prosumer behavior with market economics, encouraging self-consumption [5], therefore requiring a reliable forecast of energy production. The biggest change, however, was the introduction of dynamic tariffs in July 2024, as observed in some Western European countries. Under this regime, energy settlement is based on hourly prices derived from the day-ahead market. This exposes prosumers to the volatility of wholesale prices, which can turn negative during periods of extreme oversupply—typically sunny, windy weekends [4]. In this new paradigm, the “produce and forget” approach is no longer financially viable. Prosumers must now actively manage their energy flows, storing energy during low-price periods and consuming or exporting during high-price intervals. This shift creates a critical dependency on accurate, next-day generation forecasting to inform the dispatch strategies of Energy Management Systems (EMS) and Battery Energy Storage Systems (BESS).
The integration of gigawatts of distributed PV capacity has exposed the technical limitations of Poland’s low-voltage (LV) networks. Originally designed for unidirectional power flow from central power plants to consumers, these grids now frequently experience reverse power flows. The impedance of rural and suburban lines leads to a phenomenon known as voltage rise at the Point of Common Coupling (PCC), which occurs when local generation exceeds local demand. According to Polish law, the inverter must disconnect when the voltage exceeds 253 V (within the time window defined by PN-EN 50549) and must absolutely disconnect when it exceeds 264 V (10% and 15% of the 230 V base voltage, respectively). This results in lost potential green energy and negatively affects the economic outcomes for prosumers. Research quantifying this issue in southeastern Poland found that in 2024, a single household could experience over 600 overvoltage incidents in 78 days, resulting in an annual energy loss of up to 22% [3]. Moreover, due to the lack of systemic modernization, an upward trend is evident: in a similar area a year earlier, the number of outages was approximately one-sixth lower [6].
This technical constraint creates a “zero-sum game” among neighbors, in which inverters that first detect high voltage disconnect, enabling others to continue operating. Furthermore, on a macro scale, the Transmission System Operator (PSE) has increasingly resorted to non-market redispatch, effectively curtailing large-scale solar farms to balance the national system. In the first half of 2025, nearly 600 GWh of PV energy was curtailed due to system balancing needs, a 34% increase year-on-year. This phenomenon is clearly illustrated in the dataset used for this research, where despite the forecasted production, the actual output dropped to zero because the inverter was switched off. It is also shown in the graphics later in the article.
All these considerations lead to the conclusion that—particularly in the Polish context—it is necessary to establish a robust system capable of accurately predicting electricity production, especially for new and relatively small installations (up to 50 kWp), and to integrate these methods with widely available home energy management tools.
The subsequent sections of this report will detail the theoretical underpinnings of the selected algorithms, the data and methodology of their processing, and a comprehensive discussion of the experimental results.

2. Materials and Methods

2.1. PV Dataset and Meteorological Data

The data analyzed in this work were obtained from privately maintained databases supplied by external partners. The measurements come from four photovoltaic sites located in southern Poland, comprising systems rated at 26 kWp, 25.55 kWp, and two systems of 49.5 kWp. Each pair of installations is represented by a complete year of observations, although the covered periods differ: the smaller systems were monitored from 15 October 2023, to 15 October 2024, while the two bigger systems were recorded from 8 May 2023, to 8 May 2024.
It is important to note that while the temporal windows for the smaller and larger systems do not perfectly overlap, each dataset captures a full, continuous 12-month cycle. This ensures that the seasonal variability inherent to the Polish climate—ranging from high-irradiance summer months to snow-covered winter periods—is fully represented for all installations. Furthermore, the use of non-overlapping meteorological years for different subsets of installations serves as an additional robustness check, verifying the model’s ability to generalize across different annual weather patterns without overfitting to a specific calendar year.
The accuracy of any PV generation forecast is intrinsically limited by the quality of the underlying weather forecast. NWP (Numerical Weather Prediction) models simulate the atmosphere’s fluid dynamics to predict future states. For PV forecasting in Poland, global models such as GFS (Global Forecast System) often lack the spatial resolution (~22 km) needed to capture local phenomena, such as valley fog or convective storms. Regional models, such as ICON (with 13 km and 7 km nested grids) from the German Meteorological Service (DWD) and AROME (1.3 km) from Météo-France, provide significantly higher fidelity for Central Europe. These models better account for topography and land use, which influence local cloud formation and wind patterns. However, it should be noted that these models are not perfect, and forecast accuracy is inherently limited by their errors.
For this research, the Open-Meteo API was selected as the primary data source. Open-Meteo acts as an aggregator, providing unified access to multiple high-resolution models (ICON, GFS, ECMWF) without the need for complex API keys or proprietary data handling. It offers both historical reanalysis data (crucial for model training) and operational forecasts (for inference). Validation studies of satellite-derived irradiance data (e.g., from CAMS or SARAH, often integrated into such platforms) against ground-based pyranometers show a high correlation ( R 2 > 0.9) for clear sky conditions, though biases exist during broken cloud conditions [13]. Consequently, despite these limitations, this data source was selected to ensure spatial and temporal homogeneity across all analyzed locations, avoiding the inconsistencies of heterogeneous ground-based hardware. By utilizing Open-Meteo, the forecasting model benefits from “best-match” logic, which automatically selects the most appropriate local model for the specific GPS coordinates of the PV installation. However, this factor should be considered when using free, open-access meteorological data sources.
Although it was ultimately decided to use most of the features, parameter correlation heatmaps (as in Figure 1) were also prepared at the data analysis stage to identify variables with the strongest impact on the energy production volume and to detect potential collinearity between meteorological parameters, which allowed us to avoid redundancy of input data and minimize the risk of model overfitting.
Figure 1. Correlation heatmap of meteorological parameters and PV power output.
As mentioned, subsequent analyses by the Home Assistant add-on [16] showed that in everyday use, the number of parameters did not make a noticeable difference in computational load, and the prediction quality did not deteriorate when using most parameters. Ultimately, the model is based on the parameters listed in Appendix A.

2.2. Theoretical Foundations of Photovoltaic Generation

Forecasting PV power requires a fundamental understanding of its primary energy source: solar irradiance. The power output ( P P V ) is primarily a function of the Global Tilted Irradiance ( G T I ) received by the module surface. This is derived from three components relative to the plane of array (POA):
  • Direct Beam Irradiance ( G b ): Radiation coming directly from the solar disk without scattering.
  • Diffuse Irradiance ( G d ): Radiation scattered by atmospheric particles (clouds, aerosols).
  • Reflected Irradiance ( G r ): Radiation reflected from the ground (albedo).
The geometric relationship depends on the solar zenith angle ( θ z ), solar azimuth ( γ s ), panel tilt ( β ), and panel azimuth ( γ ). The angle of incidence ( θ ) of the sun’s rays on the panel is calculated according to Equation (1).
c o s ( θ ) = c o s ( θ z ) c o s ( β ) + s i n ( θ z ) s i n ( β ) c o s ( γ s − γ )
Forecasting models that explicitly incorporate these geometric features ( θ z ,   θ ) tend to outperform those that rely solely on raw Global Horizontal Irradiance (as GHI—obtained from weather—different from the calculated GTI) predictions, as they provide a deterministic bound to the potential power output. Accurate consideration of the variation in the sun’s inclination relative to the panels is particularly important in the Polish latitude, where high variability of production is observed depending on the change of season, which is very well illustrated in the example figure presenting daily production (Figure 2). The first graph shows that despite the initial, relatively consistent predictions, which match actual production values, these values begin to diverge significantly in the afternoon. This effect is especially pronounced in spring, when the sun rises quickly to generate energy, but its contribution diminishes in the afternoon. The annual model, which is incrementally trained with data from October, does not cope well in this scenario. It cannot yet keep up with changes that only maintain their annual cycle.
Figure 2. The difference between the predicted and actual value occurring in the spring months (estimation tail).
While irradiance drives generation, other meteorological variables modulate efficiency. The efficiency of a crystalline silicon PV cell is inversely proportional to its temperature ( T c ). The cell temperature is, in turn, a function of ambient temperature ( T a ), irradiance ( G ), and wind speed ( v w ). A simplified thermal model commonly used in forecasting is presented in Equation (2).
T c = T a + G × N O C T − 20 800
where N O C T is the Nominal Operating Cell Temperature.
However, wind speed provides a convective cooling effect that is not captured by this simple model. Advanced data-driven models like XGBoost can learn the non-linear cooling effect of wind speed ( v w ) and wind direction as a feature to better estimate P P V [20].
In the Polish climate, cloud cover is the most significant stochastic variable. Clouds affect not just the magnitude of irradiance but its spectral quality. High cloud cover converts direct beam radiation into diffuse radiation, which PV panels convert less efficiently. Furthermore, snow cover presents a binary forecasting challenge. A sunny winter day might suggest high production, but if snow covers the panels, output drops to zero. This is clearly illustrated in Figure 3, where the forecasted production value increases noticeably, while the actual value is close to zero throughout several consecutive days due to persistent snow cover.
Figure 3. The difference between the predicted and actual value in the case of snow cover on photovoltaic panels—day by day.
Standard NWP models predict snowfall but not necessarily snow retention on tilted glass surfaces. This discrepancy is a major source of error in winter forecasting. Models that incorporate “snow depth” and “temperature history” (to detect melting) as features show significantly improved winter performance [14].

2.3. Machine Learning Methodologies for PV Forecasting

Traditional physical models require detailed system specifications (tilt, azimuth, cable losses, inverter efficiency curves), which are often unavailable or inaccurate for residential systems. Data-driven models, by contrast, treat the PV system as a “black box,” learning a transfer function f X → Y , where X is the vector of weather variables and Y is the power output. This approach is particularly robust to aging effects (degradation) and site-specific shading, which the model learns as recurring patterns associated with specific solar angles. The work focused on the use of XGBoost and LSTM, therefore the solutions used are described below.

2.3.1. XGBoost

Xtreme Gradient Boosting (XGBoost) has emerged as a state-of-the-art algorithm for tabular regression tasks. Unlike Random Forest, which builds deep independent trees, XGBoost builds an ensemble of shallow trees sequentially. Each new tree attempts to correct the residual errors of the previous ensemble.
Formula (3) describes the computation of the loss function [21,22]
L t ≈ ∑ i = 1 n l y i , y i t − 1 + g i f t x i + 1 2 h i f t 2 x i + ω f t
where
L t : The loss function in the t -th iteration of the model.
l y i , y i t − 1 : The loss function for the i -th sample, based on the actual value y i and the predicted value in the previous iteration y i t − 1 .
g i : The first-order gradient of the loss function with respect to the predicted value in the previous iteration. It represents the direction and magnitude of the change needed in predictions to reduce the loss function.
f t x i : The predicted value by the current decision tree f t for the i -th sample x i .
h i : The second-order gradient. Including this term improves the stability of optimization and accounts for the curvature of the loss function.
ω f t : The regularization parameter.
The regularization parameter is calculated according to Equation (4) [10,21,22]:
ω f t = γ T + 1 2 λ ∑ j = 1 T ω j 2
where T : the number of leaves in the decision tree; ω j : the value assigned to leaf j ; γ : the regularization parameter penalizing tree complexity (the number of leaves); λ : the regularization parameter penalizing the weights of the leaves.
These regularization terms define how XGBoost controls overfitting, a critical advantage when training on small datasets (e.g., one year of hourly data from a single home). Furthermore, XGBoost’s sparsity-aware split-finding algorithm allows it to handle missing weather data natively, without requiring aggressive imputation that could introduce bias [10,23].
Formula (5) describes the calculation of feature importance in the XGBoost algorithm [24].
gain = 1 2 ∑ I L g i 2 ∑ I L h i + λ + ∑ I R g i 2 ∑ I R h i + λ + ∑ I g i 2 ∑ I h i + λ − γ
where I = I L ∪ I R , I L and I R are the numbers of samples assigned to the left and right nodes of the decision tree. λ and γ serve as regularization parameters. A feature with a greater contribution to the objective function receives a higher importance score, indicating its stronger influence on the model. The overall operation of the model within the proposed approach can be illustrated in the form of a diagram shown in Figure 4.
Figure 4. Data processing process for XGBoost.
The raw data from Open-Meteo and the PV inverter (via Home Assistant) undergo a rigorous Extract-Transform-Load (ETL) process. Weather data (often UTC) and inverter data (often Local Time) are synchronized to a common UTC timestamp. Data points where the solar elevation angle is below zero are explicitly set to zero power output. Regardless of the raw inverter readings or potential missing data gaps during night hours, the production values were forced to zero. Subsequently, the feature engineering stage is performed. Time variables (hour of day and month of year) are transformed into cyclical features using sine and cosine functions. This ensures that the model captures that hour 23 is closely adjacent to hour 0 (6).
H s i n = sin 2 π h 24 , H c o s = cos 2 π h 24  
To capture the persistence of weather, lag features (e.g., P t − 24 , G H I t − 24 ) are created. This allows the model to use the conditions from the same hour on the previous day as predictors for the current day, which is highly predictive in stable weather regimes [25].
The performance of XGBoost is sensitive to its hyperparameters. A Bayesian Optimization approach (using BayesSearchCV) was employed to navigate the search space efficiently. The key hyperparameters selected for tuning are summarized in Table 1.
Table 1. Hyperparameter space and best results for XGBRegressor.
This automated tuning ensures that the model generalizes well to unseen data, adapting to the specific characteristics of the PV installation (e.g., shading patterns, orientation) [26].

2.3.2. LSTM

LSTM networks are a specialized form of Recurrent Neural Network (RNN) designed to model sequential data. Through their gating mechanisms (forget, input, and output gates—as shown in Equations (7)–(12), LSTMs can maintain a “cell state” over long sequences, theoretically allowing them to capture the thermal inertia of PV modules or the persistence of weather patterns (e.g., a cloudy morning often leads to a cloudy afternoon).
Input gate:
i t = σ W i h t − 1 , x t + b i
Forget gate:
f t = σ W f h t − 1 , x t + b f
Output gate:
o t = σ W o h t − 1 , x t + b o
Candidate for the new cell state:
C t ~ = t a n h W s h t − 1 , x t + b s
Cell state at time t :
C t = f t ∗ C t − 1 + i t ∗ C t ~
Hidden layer output at time t :
h t = o t ∗ t a n h C t
Long Short-Term Memory (LSTM) networks are currently regarded as the gold standard for Deep Learning in time-series forecasting due to their ability to model non-linear temporal dependencies. Therefore, LSTM was selected as the reference baseline to represent the Deep Learning paradigm. However, recent comparative studies suggest that for day-ahead forecasting (24 h horizon), the performance gap between LSTM and XGBoost is narrow, often favoring XGBoost for smaller datasets. LSTMs typically require large volumes of data to generalize well and are computationally more intensive to train. In the context of a Home Assistant integration running on low-power hardware (like a Raspberry Pi), the inference efficiency of XGBoost is a decisive factor [11]. Consequently, especially in the context of the four installations presented in the work, for which only annual meteorological data were collected, XGBoost was prioritized. Due to the literature evidence of the advantages of XGBoost over LSTM (both in terms of prediction quality [27] and speed and scalability [28], as well as robustness and interpretability [29]), it was decided to use this algorithm as the main model and LSTM as the reference algorithm. The data processing graph for LSTM is shown in Figure 5.
Figure 5. Data processing process for LSTM.
Data acquisition and synchronization were performed as described for the XGBoost model. The data cleaning stage required interpolation when data were unavailable, as LSTM, unlike XGBoost, does not natively support NaN values in input matrices. This primarily occurred during the previously described periods when production had to be shut down at the request of an external market regulator, as illustrated in Figure 6.
Figure 6. One of the mandatory outages (less than half an hour) related to standards and/or a regulator’s order, causing interruptions in electricity production that are difficult to explain for models.
Subsequently, the features were normalized to the [0, 1] range using MinMaxScaler. To prepare the input for the recurrent neural network, the normalized tabular data was reshaped into a 3D tensor structure with dimensions: (Samples, Time Steps, Features). A sliding window approach was implemented, utilizing a 24-h historical window to predict a 24-h future horizon.
Regarding the internal validation procedure during the hyperparameter optimization phase (for the training set), a standard randomized cross-validation (K-Fold) was explicitly avoided to prevent look-ahead bias. Instead, a chronological hold-out validation strategy was employed where the training portion of the data was partitioned into 85% for training and 15% for internal validation with shuffle = False.
Finally, the data split for the overall experiment followed the primary assumptions, with one installation serving as the unseen validation set, and the remaining installations serving as test and training sets. Training was conducted with regularization to prevent overfitting on the small dataset, consistent with the assumptions for annual data without cyclicality. Selected hyperparameters and configuration for the LSTM model are summarized in Table 2.
Table 2. Selected Hyperparameters and Configuration for the LSTM Model.
  • Traditional statistical models such as ARIMA were excluded from this analysis as recent benchmarks in very short-term PV forecasting (e.g., [26]) have already established the superior performance of XGBoost over ARIMA (reporting up to ~14% improvement in RMSE). Consequently, this study narrows its focus to the comparative performance of two dominant non-linear machine learning paradigms: LSTM and XGBoost. Recent advancements in the state-of-the-art for short-term PV forecasting have increasingly shifted towards complex hybrid architectures. Methodologies proposing physics-informed XGBoost-LSTM pipelines or multi-objective CNN ensembles have demonstrated exceptional raw predictive accuracy, particularly by capturing both deep temporal dependencies and spatial weather patterns. However, these hybrid models are predominantly designed for utility-scale solar farms and require massive, multi-year datasets as well as substantial cloud-computing resources [30,31].
Conversely, recent comparative studies emphasize that in data-scarce environments, classical machine learning models utilizing robust feature engineering can rival the accuracy of deep learning architectures [32]. Furthermore, as highlighted in [33] the deployment of predictive models in low-voltage distribution networks necessitates ‘lightweight AI’ suitable for edge computing. Therefore, the novelty of this study is deliberately positioned in the applied domain: rather than proposing a new hybrid algorithm, this work evaluates whether a standalone XGBoost model—when enhanced with rigorous, domain-specific feature engineering (e.g., cyclical time encoding and lag features)—can achieve sufficient accuracy to optimize prosumer self-consumption while satisfying the strict computational constraints of local Home Assistant gateways

2.3.3. Model Evaluation

The model quality was evaluated using standard metrics. A brief description of each is provided below.
Mean Absolute Error (MAE) measures the average absolute error between the actual values y i and the predicted values y i ^ . The MAE has the same unit as the data. The formula for MAE is given in Equation (13) [26]:
M A E = 1 n ∑ i = 1 n y i − y i ^
Mean Squared Error (MSE) measures the average of the squared errors, meaning that larger errors have a greater impact on the result. The formula for MSE is given in Equation (14) [21]:
M S E = 1 n ∑ i = 1 n y i − y i ^ 2
The Root Mean Squared Error (RMSE) metric is derived from MSE, but the result is expressed in the same units as the original data y . RMSE is particularly useful as it highlights large errors more than MAE, meaning that larger deviations from actual values are penalized more. This allows for better evaluation of models that should minimize large prediction errors. The formula for RMSE is given in Equation (15) [26]:
R M S E = 1 n ∑ i = 1 n y i − y i ^ 2
Coefficient of Determination (R2)—A statistical measure used to quantify the proportion of variability in the dependent variable y explained by the independent variables in the regression model. Its value is denoted by R 2 . When R 2 = 1 , this indicates perfect predictive power. When R 2 = 0 , the model performs no better than predicting the mean of the data y ‾ . For R 2 < 0 , the model performs worse than predicting the mean alone. The formula for R 2 is given in Equation (16) [26]:
R 2 = 1 − ∑ i = 1 n y i − y i ^ 2 ∑ i = 1 n y i − y ‾ 2

3. Results

The proposed methodology was validated on a single dataset selected as the test set, which corresponded to a 49.5 kWp installation in Poland. The XGBoost model was compared with an LSTM network. The distributions of values around the expected values were very similar for both models. The distribution for XGBoost is shown in Figure 7, while that for LSTM is shown in Figure 8.
Figure 7. Correlation graph of actual and estimated energy production values for the XGBoost model.
Figure 8. Correlation graph of actual and estimated energy production values for the LSTM model.
The XGBoost model demonstrates high predictive ability, as evidenced by the strong concentration of points along the ideal fit line, particularly in the low-production range (0–10 kW). As the generated power increases above 20 kW, a progressive increase in the dispersion of results (heteroscedasticity) is observed, suggesting lower model precision under peak conditions. However, the symmetrical distribution of errors around the y = x line indicates a lack of systematic estimation bias. Individual outliers may result from weather anomalies or measurement errors that the model was unable to compensate for during training, which is reflected in the RMSE results below.
This specific behavior is likely attributed to inherent uncertainties in the NWP inputs, particularly under partially cloudy conditions where minor temporal or spatial deviations in forecasted irradiance translate into significant power output errors near peak generation. Additionally, unmodeled local factors—such as transient shading from nearby obstacles or soiling—are not captured by the satellite-derived features used in this study. It is important to note that without high-resolution, on-site irradiance measurements and detailed 3D site models, a quantitative separation of these NWP-induced errors from local shading effects remains outside the scope of this work.
Compared to the XGBoost model, the LSTM network shows higher output dispersion and systematically underestimates production at higher values, as indicated by a shift in the points below the ideal y = x line for production above 30 kW. While the model maintains overall correlation with real-world data, the model exhibits a wider error band (higher variance) across the entire power spectrum, as well as numerous cases of overestimation with near-zero real-world production, suggesting lower stability than the gradient algorithm. Ultimately, the graph indicates that for this dataset, the LSTM architecture performs worse in representing production dynamics, resulting in higher RMSE and lower R 2 compared with XGBoost. The evaluation metrics used were RMSE, MAE and the Coefficient of Determination ( R 2 ). Results are presented in Table 3.
Table 3. Final results of the algorithms for the test set.
As shown in the analysis of the results (derived from the thesis data), the XGBoost model achieved the lowest error rates: RMSE = 4.09 kW, MAE = 1.91 kW, R 2 = 0.85, and for the LSTM, RMSE = 5.53 kW, MAE = 3.08 kW, R 2 = 0.73. The poorer performance of the LSTM in this specific experiment highlights the difficulty of training deep networks on a limited, tabular dataset (1 year of data). The model likely failed to converge or overfit the noise. In contrast, XGBoost demonstrated robust performance, effectively capturing the diurnal cycle and the impact of cloud cover.
To verify whether the observed performance improvement of XGBoost over LSTM is statistically meaningful, a paired t-test was conducted on the absolute prediction errors of both models on the test set. The test yielded a t-statistic of −29.96 with a p-value < 0.001 (8.47 × 10−188), confirming that the superior predictive accuracy of XGBoost is statistically significant and not a result of random chance.
The observed elevation in prediction errors during spring and autumn persists despite the inclusion of seasonal binary indicators and cloud coverage data. This phenomenon correlates with the high variability of solar irradiance typical for transitional seasons in this climatic zone. While the model correctly identifies the season, the high frequency of changes, as well as constant time changes, are observable problems on some days.
Snow cover proved to be a major challenge for both models. The initial LSTM did not account for it at all, while XGBoost slightly lowered its forecasts on the day after snowfall. However, the data shows that snowfall only occasionally covered the panels, making it challenging for the models to forecast such events. Installation outages also posed difficulties, due to the previously mentioned seasonality, which, for the models, created incomprehensible interruptions in energy production, inexplicable by atmospheric phenomena. Since this phenomenon occurs most often on days with good weather in the morning, on some days one can observe a kind of hallucination by the models, as if deliberately underestimating the forecast during this period, expecting outages. This is well illustrated, for example, in Figure 9, where the mid-morning prediction falls short of actual values, and despite the lack of variability in atmospheric conditions, the prediction breaks down twice.
Figure 9. A graph presenting the prediction for a cloudless sky, with a characteristic hallucination related to the potential shutdown of the photovoltaic installation due to network parameters.
The analysis reveals that forecasting error is not uniform throughout the year. Errors are highest in spring and autumn—transition periods characterized by highly variable cloud cover in Poland, which results in more installation shutdowns. In contrast, stable winter days (though low-production) and clear summer days yield the highest accuracy.
While filtering these events would allow the model to learn pure solar physics, it would render the forecast less practically useful for the prosumer, who requires an accurate estimate of harvestable energy, not theoretical potential. Furthermore, treating shutdowns as a separate classification task poses significant challenges due to the stochastic nature of local grid impedance, which depends on unobservable external factors (e.g., neighbors’ load profiles). Consequently, this study retains these events in the training data, accepting that the model learns a hybrid representation of meteorological and grid constraints. Future iterations of this work could explore hybrid modeling where grid voltage forecasts are explicitly integrated as an input feature, provided such data is available from the inverter.

4. Conclusions

The integration of meteorological data for next-day photovoltaic energy prediction using XGBoost represents an effective approach to addressing the challenges of the modern Polish grid. This report concludes that for residential and small-commercial-scale forecasting with limited historical data, XGBoost offers a superior balance of accuracy, speed, and interpretability compared to LSTM. The ability to forecast generation 24 h ahead is directly translatable to economic value under Poland’s dynamic tariff system, enabling prosumers to avoid negative pricing intervals and maximize self-consumption. The use of aggregated, high-resolution NWP data (via Open-Meteo) is as critical as the algorithm selection. Global models are insufficient for the specific topography and weather patterns of Central Europe. Future research should focus on hybridizing these approaches—perhaps using CNNs to extract cloud motion vectors from satellite imagery as input to an XGBoost regressor—and on probabilistic forecasting, which would provide not just a single power value but a confidence interval, allowing for more risk-aware energy management decisions. As the grid moves towards flexibility, the intelligence provided by these models will transform PV systems from passive generators into active, stabilizing assets of the smart grid.

5. Future Work

Building upon the findings of this comparative analysis, future research will focus on three key areas: scalability, methodological refinement, and commercial application.
Firstly, to further validate the robustness of the proposed XGBoost models, the authors are currently expanding the study scope to a significantly larger dataset. This ongoing work involves data acquisition from approximately forty prosumer PV installations of similar capacity (up to 50 kW) distributed across different micro-climatic zones in Poland. This expansion aims to verify whether the performance advantage of gradient boosting approaches remains consistent across a broader statistical sample and diverse hardware configurations.
Secondly, regarding algorithmic development, we aim to explore hybrid and alternative modeling paradigms. While this study focused on the difference between Deep Learning (LSTM) and Ensemble Learning (XGBoost), defined in literature as a state-of-the-art in this research context, we do not rule out the use of methods based on, e.g., fuzzy logic in the future. Based on the experience of our team and contributory studies, fuzzy logic approaches show great potential in handling the uncertainty and high intermittency of solar irradiance characteristic of transitional climates. Integrating fuzzy rules with the current XGBoost framework could potentially further reduce prediction errors during variable weather conditions.
Finally, the project aims to bridge the gap between academic prototyping and market implementation. Parallel work is underway to refine the developed Home Assistant Add-on into a scalable commercial solution. This involves optimizing the forecasting engine for lower latency on edge devices and integrating it with energy storage management systems to maximize auto-consumption for prosumers.

Author Contributions

Conceptualization, methodology, formal analysis P.K. and K.H.; software, visualization P.K.; validation, writing, supervision, administration K.H. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Polish Ministry of Science and Higher Education, partially by Statutory Research, and partially by Young Researchers funds of Department of Telecommunications and Teleinformatics Silesian University of Technology.

Data Availability Statement

Data is unavailable due to privacy restrictions. The entities providing the data have not granted the rights to their further transfer and publication.

Acknowledgments

This work was supported by Polish Ministry of Science and Higher Education by Young Researchers funds of Department of Telecommunications and Teleinformatics Silesian University of Technology.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
PVPhotovoltaic
NWPNumerical Weather Prediction
XGBoosteXtreme Gradient Boosting
LSTMLong Short-Term Memory
CNNConvolutional Neural Network
ICONIcosahedral Nonhydrostatic Model
AROMEApplications of Research to Operations at Mesoscale
ECMWFEuropean Centre for Medium-Range Weather Forecasts
GHIGlobal Horizontal Irradiance
GTIGlobal Tilted Irradiance
R2Coefficient of Determination
MSE/RMSEMean Squared Error/Root Mean Squared Error
MAEMean Absolute Error
PSEPolskie Sieci Elektroenergetyczne
IEOInstytut Energetyki Odnawialnej
ARIMAAuto Regressive Integrated Moving Average
kw/kWpkilowatt/kilowatt-peak
GW/GWhgigawatt/gigawatt-hour

Appendix A

This appendix provides the complete list of input parameters used by the forecasting models. Although correlation analysis was performed to identify the most influential variables and potential collinearity, the final feature set intentionally includes most available parameters, as no negative impact on model stability or computational performance was observed. The parameters represent meteorological conditions, solar irradiance components, temporal information, and historical production data, ensuring consistent input representation across all analyzed locations. The full list of parameters is given below.
Temperature_2m, Relative_humidity_2m, Dew_point_2m, Apparent_temperature, Precipitation, Rain, Wind_speed_10m, Wind_gust_10m, Shortwave_radiation, Diffuse_radiation, Global_tilted_irradiance, UV_index, Altitude, Is_Spring, Is_Summer, Is_Fall, Is_Winter, Weather_code, Cloud_coverage, Surface_pressure, Date and Time, Historical PV Data.

References

  1. Rataj, M.; Berniak-Woźny, J.; Plebańska, M. Poland as the EU Leader in Terms of Photovoltaic Market Growth Dynamics—Behind the Scenes. Energies 2021, 14, 6987. [Google Scholar] [CrossRef] [Scilit]
  2. Chomać-Pierzecka, E.; Kokiel, A.; Rogozińska-Mitrut, J.; Sobczak, A.; Soboń, D.; Stasiak, J. Analysis and Evaluation of the Photovoltaic Market in Poland and the Baltic States. Energies 2022, 15, 669. [Google Scholar] [CrossRef] [Scilit]
  3. Cieslak, K.J.; Adamek, S. Overvoltage Challenges in Residential PV Systems in Poland: Annual Loss Assessment and Mitigation Strategies. Energies 2025, 18, 6247. [Google Scholar] [CrossRef] [Scilit]
  4. Kelm, P.; Mieński, R.; Wasiak, I. Control of an Energy Storage System in the Prosumer’s Installation Under Dynamic Tariff Conditions. Energies 2025, 18, 6313. [Google Scholar] [CrossRef] [Scilit]
  5. Cieślak, K.J. Profitability Analysis of a Prosumer Photovoltaic Installation in Light of Changing Electricity Billing Regulations in Poland. Energies 2024, 17, 3618. [Google Scholar] [CrossRef] [Scilit]
  6. Hanzel, K. Analysis of Financial Losses and Methods of Shutdowns Prevention of Photovoltaic Installations Caused by the Power Grid Failure in Poland. Energies 2024, 17, 946. [Google Scholar] [CrossRef] [Scilit]
  7. Nematzadeh, S.; Esen, V. Explainable Machine Learning and Predictive Statistics for Sustainable Photovoltaic Power Prediction on Areal Meteorological Variables. Appl. Sci. 2025, 15, 8005. [Google Scholar] [CrossRef] [Scilit]
  8. Di Leo, P.; Ciocia, A.; Malgaroli, G.; Spertino, F. Advancements and Challenges in Photovoltaic Power Forecasting: A Comprehensive Review. Energies 2025, 18, 2108. [Google Scholar] [CrossRef] [Scilit]
  9. Fazekas, Z.; Balázs, G.; Gáspár, P. ANN-Based Classification of Urban Road Environments from Traffic Sign and Crossroad Data. Acta Polytech. Hung. 2018, 15, 83–100. [Google Scholar] [CrossRef] [Scilit]
  10. Rodriguez-Leguizamon, C.K.; Alfonso López-Sotelo, J.; Cantillo-Luna, S.; López-Castrillón, Y.U. PV Power Generation Forecasting Based on XGBoost and LSTM Models. In 2023 IEEE Workshop on Power Electronics and Power Quality Applications (PEPQA); IEEE: New York, NY, USA, 2023; pp. 1–6. [Google Scholar]
  11. Iheanetu, K.J. Solar Photovoltaic Power Forecasting: A Review. Sustainability 2022, 14, 17005. [Google Scholar] [CrossRef] [Scilit]
  12. Aksan, F.; Suresh, V.; Janik, P. Optimal Capacity and Charging Scheduling of Battery Storage through Forecasting of Photovoltaic Power Production and Electric Vehicle Charging Demand with Deep Learning Models. Energies 2024, 17, 2718. [Google Scholar] [CrossRef] [Scilit]
  13. Esposito, E.; Leanza, G.; Di Francia, G. Comparative Analysis of Ground-Based Solar Irradiance Measurements and Copernicus Satellite Observations. Energies 2024, 17, 1579. [Google Scholar] [CrossRef] [Scilit]
  14. Gulkowski, S.; Krawczak, E. Long-Term Energy Yield Analysis of the Rooftop PV System in Climate Conditions of Poland. Sustainability 2024, 16, 3348. [Google Scholar] [CrossRef] [Scilit]
  15. Hong, Y.; Yang, J.; Yang, Z.; Yan, J. PV Power Prediction Based on XGBoost Algorithm. In 2023 IEEE 5th International Conference on Civil Aviation Safety and Information Technology (ICCASIT); IEEE: New York, NY, USA, 2023; pp. 930–933. [Google Scholar]
  16. PKraska02 Solar_Forecast_24H/Solar_Forecast_24H at Main · PKraska02/Solar_Forecast_24H. Available online: https://github.com/PKraska02/Solar_Forecast_24H/tree/main/Solar_Forecast_24H (accessed on 14 January 2026).
  17. Gajdzik, B.; Jaciow, M.; Wolniak, R.; Wolny, R.; Grebski, W.W. Energy Behaviors of Prosumers in Example of Polish Households. Energies 2023, 16, 3186. [Google Scholar] [CrossRef] [Scilit]
  18. Monteiro, F.; Sarquis, E.; Branco, P. Identifying Critical Failures in PV Systems Based on PV Inverters’ Monitoring Unit: A Techno-Economic Analysis. Energies 2024, 17, 4738. [Google Scholar] [CrossRef] [Scilit]
  19. EC BREC Instytut Energetyki Odnawialnej. Available online: https://ieo.pl/en/ (accessed on 12 December 2025).
  20. Munir, M.A.; Khattak, A.; Imran, K.; Ulasyar, A.; Khan, A. Solar PV Generation Forecast Model Based on the Most Effective Weather Parameters. In 2019 International Conference on Electrical, Communication, and Computer Engineering (ICECCE); IEEE: New York, NY, USA, 2019; pp. 1–5. [Google Scholar]
  21. Feng, Y.; Wang, S. A Forecast for Bicycle Rental Demand Based on Random Forests and Multiple Linear Regression. In 2017 IEEE/ACIS 16th International Conference on Computer and Information Science (ICIS); IEEE: New York, NY, USA, 2017; pp. 101–105. [Google Scholar]
  22. Santos, R.S.; Pour Yousefian Barfeh, D. Time Series Forecasting for Issuance of Alien Employment Permits by Nationality in the Philippines Using Holt-Winters Method. In 2019 International Conference on Computational Intelligence and Knowledge Economy (ICCIKE); IEEE: New York, NY, USA, 2019; pp. 240–245. [Google Scholar]
  23. Xia, L.; Yaomei, G.; Weiwei, S. Forecast to Textile and Garment Exports Based on Holt Model. In 2010 International Conference of Information Science and Management Engineering; IEEE: New York, NY, USA, 2010; pp. 274–277. [Google Scholar]
  24. Gupta, A.; Kumar, A. Mid Term Daily Load Forecasting Using ARIMA, Wavelet-ARIMA and Machine Learning. In 2020 IEEE International Conference on Environment and Electrical Engineering and 2020 IEEE Industrial and Commercial Power Systems Europe (EEEIC/I&CPS Europe); IEEE: New York, NY, USA, 2020; pp. 1–5. [Google Scholar]
  25. Shafiuzzaman, M.; Safayet Islam, M.; Rubaith Bashar, T.M.; Munem, M.; Nahiduzzaman, M.; Ahsan, M.; Haider, J. Enhanced Very Short-Term Load Forecasting with Multi-Lag Feature Engineering and Prophet-XGBoost-CatBoost Architecture. Energy 2025, 335, 137981. [Google Scholar] [CrossRef] [Scilit]
  26. Chen, X.; Wu, Y.; He, X. Long Short-Term Memory Network PV Power Prediction Incorporating Extreme Extreme Gradient Boosting Algorithm. In 2022 12th International Conference on Power and Energy Systems (ICPES); IEEE: New York, NY, USA, 2022; pp. 821–825. [Google Scholar]
  27. Cortez, J.C.; Zenichi Terada, L.; Barros Bandeira, B.V.; Soares, J.; Vale, Z.; Rider, M.J. Comparative Analysis of ARIMA, LSTM, and XGBoost for Very Short-Term Photovoltaic Forecasting. In Proceedings of the 2023 15th Seminar on Power Electronics and Control (SEPOC), Santa Maria, Brazil, 22–25 October 2023. [Google Scholar]
  28. Mollasalehi, A.; Farhadi, A. Solar and Wind Power Forecasting: A Comparative Review of LSTM, Random Forest, and XGBoost Models. arXiv 2025, arXiv:2509.24059. [Google Scholar] [CrossRef] [Scilit]
  29. Dakheel, F.; Çevik, M. Optimizing Smart Grid Load Forecasting via a Hybrid Long Short-Term Memory-XGBoost Framework: Enhancing Accuracy, Robustness, and Energy Management. Energies 2025, 18, 2842. [Google Scholar] [CrossRef] [Scilit]
  30. Bin Yousuf, K.; Akter, A.; Noor, H.A.; Hoque, A.; Ahmed, A. A Hybrid XGBoost-LSTM Model with Physics-Informed Features and Uncertainty Quantification for Solar Power Forecasting. Energy Rep. 2026, 15, 109068. [Google Scholar] [CrossRef] [Scilit]
  31. Abumohsen, M.; Owda, A.Y.; Owda, M.; Abumihsan, A. Hybrid Machine Learning Model Combining of CNN-LSTM-RF for Time Series Forecasting of Solar Power Generation. e-Prime-Adv. Electr. Eng. Electron. Energy 2024, 9, 100636. [Google Scholar] [CrossRef] [Scilit]
  32. Kuriakose, J.; Jadoun, V.K.; Dutta, S. Wind and Solar Power Generation Forecasting Based on LSTM and XGBoost Models: A Case Study for Mangaluru. In 2025 IEEE 5th International Conference on Sustainable Energy and Future Electric Transportation (SEFET); IEEE: New York, NY, USA, 2025; pp. 1–5. [Google Scholar]
  33. Fan, Y.; Wu, H.; Lin, J.; Li, Z.; Li, L.; Huang, X.; Chen, W.; Chen, B. A Distributed Photovoltaic Short-Term Power Forecasting Model Based on Lightweight AI for Edge Computing. J. Phys. Conf. Ser. 2024, 2876, 012050. [Google Scholar] [CrossRef] [Scilit]
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.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.