Machine learning diagnosis (ANN vs KNN) of short-circuit, open-circuit, partial shading and line-to-ground faults in PV modules: Case study of Bejaia, Algeria
Main Article Content
Abstract
To ensure optimal energy production and operational safety in solar installations, the implementation of dependable fault identification mechanisms is critical, especially for smaller arrays vulnerable to local weather fluctuations. This research details a diagnostic approach using Artificial Neural Networks (ANN) for a 2×2 series-parallel PV configuration, simulated within the MATLAB/Simulink environment (Simscape Electrical) and driven by ERA5 meteorological records for Bejaia, Algeria. Four electrical fault types were considered: short-circuit, open-circuit, partial shading, and line-to-ground. Time-series simulation outputs were resampled to a one-minute grid and processed to produce a balanced dataset of 2,128 labeled samples. The primary classifier is a feedforward artificial neural network with one hidden layer of 10 neurons; a K-nearest neighbors (KNN) model (baseline, default parameters) was used for comparison. The ANN achieved an overall accuracy of =99.6% (independent test =99.7%) and a fault detection rate of =99.2%, with faults detected within the sampling interval and stable classification during dynamic two-day fault scenarios. Compared to KNN, the ANN exhibited fewer boundary misclassifications and no false positives in the reported experiments. Limitations include reliance on simulation driven by reanalysis data and lack of compound-fault cases; future work will validate the approach on measured field data and investigate richer feature sets and deployment on embedded hardware.
Article Details
Section

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
-
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
-
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
How to Cite
References
Abad, L., Tamalouzt, S., Djermouni, K., Mekhilef, S., & Belkhier, Y. (2025). Analytical modeling of photovoltaic systems under partial shading conditions incorporating bypass and blocking diodes influence. International Journal of Energy Research, 3384091. https://doi.org/10.1155/er/3384091.
Bougoffa, M., Benmoussa, S., Djeziri, M., & Palais, O. (2025). Hybrid deep learning for fault diagnosis in photovoltaic systems. Machines, 13(5), 378. https://doi.org/10.3390/machines13050378.
Boutasseta, N., Ramdani, M., & Mekhilef, S. (2018). Fault-tolerant power extraction strategy for photovoltaic energy systems. Solar Energy, 169, 594–606. https://doi.org/10.1016/j.solener.2018.05.031.
C3S. (2018). ERA5 hourly data on single levels from 1940 to present [Dataset]. Copernicus Climate Change Service (C3S) Climate Data Store (CDS). https://doi.org/10.24381/CDS.ADBB2D47.
Chine, W., Mellit, A., Lughi, V., Malek, A., Sulligoi, G., & Pavan, A. M. (2016). A novel fault diagnosis technique for photovoltaic systems based on artificial neural networks. Renewable Energy, 90, 501–512. https://doi.org/10.1016/j.renene.2016.01.036.
Djalab, A. A., Rezaoui, M. M., Mazouz, L., Teta, A., & Sabri, N. (2020). Robust method for diagnosis and detection of faults in photovoltaic systems using artificial neural networks. Periodica Polytechnica Electrical Engineering and Computer Science, 64(3), 291–302. https://doi.org/10.3311/PPee.14828.
Gadi, S. N., Aly, H. H., & Cada, M. (2024). A proposed hybrid model of ANN and KNN for solar cell defects detection and temperature prediction using fuzzy image segmentation. Heliyon, 10(11). https://www.cell.com/heliyon/fulltext/S2405-8440(24)07805-8.
Janarthanan, R., Maheshwari, R. U., Shukla, P. K., Shukla, P. K., Mirjalili, S., & Kumar, M. (2021). Intelligent detection of the PV faults based on artificial neural network and type 2 fuzzy systems. Energies, 14(20), 6584. https://doi.org/10.3390/en14206584.
Khalil, S. A., & Rahoma, U. A. (2022). Verification of solar energy measurements by (ERA-5) and its impact on electricity costs in North Africa. International Journal of Astronomy and Astrophysics, 12(4), 301–327. DOI: 10.4236/ijaa.2022.124018.
Mellit, A., Herrak, O., Rus Casas, C., & Massi Pavan, A. (2021). A machine learning and internet of things-based online fault diagnosis method for photovoltaic arrays. Sustainability, 13(23), 13203. https://doi.org/10.3390/su132313203.
Pei, T., & Hao, X. (2019). A fault detection method for photovoltaic systems based on voltage and current observation and evaluation. Energies, 12(9), 1712. https://doi.org/10.3390/en12091712.
Tati, F., Talhaoui, H., Aissa, O., & Dahbi, A. (2022). Intelligent shading fault detection in a PV system with MPPT control using neural network technique. International Journal of Energy and Environmental Engineering, 13(4), 1147–1161. https://doi.org/10.1007/s40095-022-00486-5.
Yuan, Z., Xiong, G., & Fu, X. (2022). Artificial neural network for fault diagnosis of solar photovoltaic systems: A survey. Energies, 15(22), 8693. https://doi.org/10.3390/en15228693.