k-Nearest Neighbors algorithm for PV power forecasting

Share

Scientists from the University of Technology – Iraq have utilized the k-Nearest Neighbors (k-NN) machine learning (ML) algorithm to classify the operational status of PV panels and predict their voltage, current, and power output.

“At its core, k-NN operates on the principle that similar things exist in close proximity. In practical terms, it can be understood that the algorithm predicts the label of a new data point based on the majority vote or average of its ’k’ nearest neighbors in the feature space,” explained the scientists. “In classification tasks, k-NN is employed to categorize new observations into predefined classes based on the most common class among its nearest neighbors.”

The research group trained the algorithm on a dataset generated via by Python and LTspice XVII software, employing a 2-diode-based equivalent PV module modeling technique. It created almost seven million cases reflecting a wide spectrum of conditions, including parameters such as solar irradiation levels, PV panel configurations, fault conditions, partial shading conditions, and temperature variations.

Half of the dataset was used for training, while the other half was used for testing. For classification purposes, the scientists used accuracy and F1 metrics. For the power output forecast, they used two assessment metrics of regression analysis – root mean square error (RMSE) and coefficient of determination (R2).

“The classification accuracy for the main categorizing is noticed to be 99.2% while it slightly dropped to 98.9 % when classifying the subcategories,” said the scientists. The k-NN model also recorded an RMSE score of 0.036 for predicting voltage and an R2 of 1.00. As for current, it showed an RMSE of 1.813 and an R2 of 0.878, while, in terms of power, the analysis shows an RMSE of 0.371 and an R2 of 0.994.

“Although predicting current presented some challenges, the overall performance of the model in forecasting power output was notably accurate, further validating the potential of ML techniques in enhancing the efficiency and reliability of solar energy systems,” concluded the team. “Through this investigation, the study not only confirmed the viability of simulation-based data in pre-experimental assessments but also highlighted the significant role of ML, particularly the k-NN algorithm, in advancing solar energy research and application.”

Their findings were presented in the study “Evaluating electrical power yield of photovoltaic solar cells with k-Nearest neighbors: A machine learning statistical analysis approach,” published on e-Prime – Advances in Electrical Engineering, Electronics and Energy.

This content is protected by copyright and may not be reused. If you want to cooperate with us and would like to reuse some of our content, please contact: editors@pv-magazine.com.

Popular content

Germany’s balcony PV installations hit 200 MW in H1
19 July 2024 Germany's Federal Network Agency (Bundesnetzagentur) says 220,000 balcony PV systems were installed in the country in the first half of the year, reac...