BackgroundWith the increasingly serious environmental pollution and natural environment damage, renewable energy such as solar cells have gradually become the key to change this situation. Therefore, the local abnormal diagnosis of the charge and discharge of solar cell capacitors is particularly important. ObjectiveTo extend the life of ultracapacitors by resolving the issue of their low detection rate and enhancing the capacity to recognize fault diagnosis factors. A novel approach to charging and discharging, as well as the diagnosis of local anomalies, is put forth, utilizing switching networks. MethodsBy controlling the capacitors of multiple solar cells and supercapacitors to work together, it is possible to compensate for the shortage of photovoltaic power. The performance of fault diagnosis is optimized by combining principal component analysis and binary K-means clustering, which completes the fault diagnosis of capacitors. ResultsThe experimental results show that the research method can increase the maximum output power of photovoltaic by 32.9% under multi-layer shadows. In the charging state of the training set, the number of abnormal capacitors is 6, and the number of normal capacitors is 12, and both of them are in accordance with the preset value. The number of abnormal capacitors and normal capacitors in the discharge state is the same as that in the charging state, which is also 6 and 12. ConclusionThe research method can effectively address the issue of unbalanced energy storage battery packs and minimize the impact of local shadows on photovoltaic systems. In comparison to fuzzy C-means clustering, this method requires fewer iterations, enables faster fault diagnosis, and produces more accurate clustering results. It can provide technical support for diagnosing local abnormalities in the charging and discharging of solar cell capacitors.