Identifying defects on solar cells using magnetic ﬁ eld measurements and arti ﬁ cial intelligence trained by a ﬁ nite-element-model

. Renewable energies have an increasing share in the energy supply. In order to ensure the security of this supply, the reliability of the systems is therefore increasingly important. In photovoltaic modules or in manufacturing, defective solar cells due to broken busbars, cross-connectors or faulty solder joints must be detected and repaired quickly and reliably. This paper shows how the magnetic ﬁ eld imaging method can be used to detect defects in solar cells and modules without contact during operation. For the evaluation of the measurement data several neural networks were used, which were trained with the help of results from ﬁ nite element simulations. Different training data sets were set up in the simulation model by varying the electrical conductivities of the different parts of the solar cell. The in ﬂ uence of the neural network type and the variation of the training data sets as well as an advantage of a combination of simulated and experimental training data are presented and discussed.


Introduction
In Germany, photovoltaics (PV) account for the secondlargest share of electricity generation systems among renewable energies after wind power. Renewable energies accounted for 42.3% of the total amount of electricity fed into the grid in Germany in 2019 [1]. To ensure a safe power supply, the reliability of PV systems is becoming increasingly important. Typical defects of PV modules are defect solder joints, busbars or cross connectors as well as broken solar cells, which are all leading to a decreasing yield. The mentioned defects are typically detected and analyzed by electroluminescence (EL) or thermography. Both methods have disadvantages. EL measurements are usually performed at night or at dusk, since the signal-tonoise ratio is significantly better at night due to the lack of daylight. Daylight measurements are possible but involve special challenges of image filtering and background subtraction. Also, the modules must be powered by an external power source [2]. Thermographic measurements should be carried out on a cloudless day, if possible, as clouds also emit thermal radiation which is reflected in the module glass. As another analyzing technique, the magnetic field imaging (MFI) method which allows to measure contactless the amount and direction of electric currents changed due to defects is used [3]. The sensor can be attached to a motorized table for automated measurements or integrated into a hand-held instrument. The measurement itself is done by moving the sensor across the solar module surface to generate three images of the components B x , B y and B z of the magnetic flux density (see Fig. 1a).
In [3][4][5][6], results of investigating the magnetic field of a solar cell or module using a line sensor were presented. The publications give an overview of the detectable defects and their effects on the resulting magnetic field and compares the MFI with electroluminescence. The sensor technology used is less important here, only the measurement range from a few mT to a few mT must be covered, since the usual current strengths in solar modules generate magnetic flux densities in this range. Compared to electroluminescence MFI provides direct access to the strength and direction of flowing currents. MFI can be used for solar module production, e.g., to check the solder connections to the cross-connector before lamination, or for PV systems in the field for park maintenance or condition assessment purposes.
If solar modules are measured in production or even in field, a big amount of data will be generated and needs to be analyzed reliably and automatically. Thus, DENKweit provides a platform for vision AI. The AI can detect different defects, based on the training data set. In order to optimize the data set, the results of a finite element (FE) simulation were used for the AI training, which has become an increasingly common practice in recent years as in [7][8][9][10].
In this work, an electromagnetic FE model of a fourbusbar solar cell is presented, which is used to generate training data for artificial neural networks which are then used to analyze real measurement data. The advantages of using a finite element model for the data generation are: -Increasing number of training data leading to an improved and more accurate prediction by the AI -Saving time for measuring but having a sufficient amount of training data -Wide variation of possible defects regarding size or position can be considered -Getting data before a technical system is in operation and measurable (e.g. new solder or busbar concept).
Thus, the FE simulation model is applied in this work and results are presented and discussed.

Magnetic field imaging and experimental setup
In working conditions or when power is supplied, solar modules show a characteristic distribution of electric current. The largest current density is located in the busbars. In general, electric current generates a magnetic field, which can be described by a fundamental relationship in magnetostatics, the Biot-Savart law [11], where B is the magnetic flux density, I is the current dℓ, an element of the conductor, the constant m 0 is the permeability of free space, andr 0 andr the locations of the conductor and sensor respectively. Especially in the case of busbars, which can be approximated as line conductors, this model can be used. Defects, e.g. due to broken solder joints, lead to changes in the magnetic field due to the locally changed current flow, which in turn can be detected. For the investigation of the magnetic field of solar modules, two cases, the measurement in the laboratory under forward voltage and the measurement in the field under illumination, needs to be distinguished. In the laboratory, a forward voltage is applied to the module and an electric current of 8 A is applied which is 15-20% less than a current typical module at 1000 W/m 2 for the cell size of 156 Â 156 mm 2 . In the field, the electric current is generated by solar irradiation. The magnetic field generated by this is directly proportional to the electric current flowing in the cell, i.e. proportional to the irradiance but dependent on the maximum power point behavior of the module type. Typical values range from 9 to 10 A und standard AM 1.5 conditions. The test set in the laboratory measurements shown in this paper were made using a DENKweit B-Lab laboratory instrument. Here a 16 cm wide line sensor with 64 data points along the line is integrated. The measuring frequency is 30 Hz. Measurements for testing the performance of the neural networks are carried out with a hand-held device in the lab as well (see Fig. 1a). Here, the integrated magnetic field sensor is the same as in the B-Lab (16 cm wide with 64 data points). For field measurements, the effect caused by shadowing by the sensor or also by the person taking the measurement must be considered. This locally reduces the charge carrier generation and thus also the current distribution in the cell or module. For monofacial modules, this effect can be circumvented by measuring on the rear side. As an example, Figure 1 shows a solar cell with a broken connector to the cross-connector under forward bias with an applied current of 8A. The measurement was done on the cell area only, the cross connector being outside the measurement area. The broken busbar means that no electrical current can flow from the cross connector into the busbar. In the magnetic field image, this is shown by a reduced flux density in the busbar concerned. Since the cell has cross-conductivity due to the grid fingers, the current density in the busbars is equalized over the length of the cell.

Simulation
In order to generate data for AI training, a model for a magnetostatic analysis was set up using the FE software ANSYS Mechanical. A four-busbar solar cell (156 Â 156 mm 2 ) was modelled in consideration of the real layer stack consisting of the busbars, solder connections, grid fingers, the silicon wafer as well as well as a metallization of the entire back side (see Fig. 2b). For simplification, the grid fingers were not explicitly modeled, but substituted by one volume with the same thickness as the original grid fingers. In this volume, the electrical resistivity was reduced and the conductivity was restricted to the x and z direction to represent the electrical properties correctly. This procedure has already been shown in [12]. For busbar defects, the busbars are constructed from different volumes with corresponding electrical conductivities. As shown in Figure 2c exemplarily for busbars 1 and 2, the resistance of all busbars can be adjusted individually at the solar cell inlet and before and after each solder pad on the cell's backside. The cross-connectors were modeled with a better conductivity than the busbars to ensure that the electric current in all four busbars is the same and not distorted by ohmic losses. An additional ambient surrounding volume was modeled with the material properties of air to calculate the magnetic field around the solar cell. For more information about the dimensions, material and properties of the layers see Table 1. The model is based on ohmic resistors and neglects solar cell physics like p-n junction or diodes. This is justified because the measurements mainly show the surface currents in x and y direction. These currents flow through the busbars and the grid fingers or the back contact. All currents in z direction are locally very low with about 50 mA/cm 2 because they are distributed over the entire cell area. In addition, a current perpendicular through a surface directly above the surface shows no measurable magnetic field, since x and y components cancel everywhere except at the surface edges. The relative permeability of all bodies was set to be 1.
The electric boundary conditions were applied on lowresistance cross connectors (CC) connecting the upper and lower busbars respectively. On the top CC, a current of 8 A was set, on the bottom CC the electrical potential was set to 0 V (see Fig. 2a). A parallel magnetic flux on the outer surfaces of the model was defined as the magnetic boundary condition. The global mesh size was set to be 3 mm, however, each line in the x-, yand z-direction was divided into at least two elements. A simulation using one CPU core takes about 3 h.
The model described above is used for both, validation of the FE model and AI training data generation. For this purpose, variations of the model are calculated and combined into "simulation sets" according to their usage. The electrical conductivity of some solar cell components was adjusted in the simulation set in accordance with real solar cells, which can exhibit electrical and therefore magnetic behavior that deviates from that of a perfect solar cell. This may happen due to variation in manufacturing, subsequent assembly or slight damage during operation. In this way, for example, faulty solder points or defects can be modeled. The following simulation sets were set up and calculated: For validation of the finite element model -Solar cell without defect: For the FE model validation, the solar cell without defects was calculated as described above.
-Solar cell with one defect busbar: For further FE model validation, the solar cell was calculated with a defective busbar (busbar 1 at the cell inlet "defect position 0", see Fig. 2c).
For AI training -Solar cell with small variations of the conductivities: In order to train the AI for anomaly detection, simulations without busbar defects were performed. In this set, the electrical conductivities of the individual busbars, the grid fingers and the various solder connections were changed. The values from Table 1 were varied randomly in a range of 90% to 110%.
-Solar cell with greater variations of conductivities: This set is basically like set number 3, except that the conductivities have been varied from 33% to 300%.
-Busbar defects with small variations of conductivities: In order to train the AI to recognize busbars and defective busbars (feature detection), simulations were carried out in which the electrical conductivity of the busbars was increased at various points (seec). In addition, the input resistors of the busbars into the cell, the electrical conductivities of the individual busbars, the grid fingers and the various solder connections were varied randomly from 33% to 300%.
The used specific electrical resistances in V · m for the different cell components are shown in Table 2.

Neural networks 2.3.1 Datasets for training and validation
To be able to apply networks trained with artificial data to real data, the training data must have a similar variation with respect to typical characteristics as the real measured data. In the case of solar modules, this is the current strength in each busbar, which then determines the strength of the magnetic flux density in the measurement. In addition, measurements with a hand-held device are affected by variations due to the operator. This includes a change in the measurement distance, which can result from tilting or a slight lifting of the measurement system. The simulated training data was varied as described in Section 2.2. The variation of the material parameters in the simulation model resulted in significantly different flux densities in the busbars. In the data sets for the training, this was 38% (small variation) and 83% (large variation). With these variations, effects that occur in the field due to local shading are covered as well.
In order to evaluate the influence of this variation, two training data sets of 75 images each were created from sets (set 3 and set 4). These two datasets were each duplicated and supplemented with a few real measurement data to test the training with mixed data (simulation and measurement).
For the training of the networks for busbar defects, a data set with low variation was used, in which in each case one of four busbars was broken at the cell edge. In total, this data set also consisted of 82 images. Here, two classes, "busbars okay" and "busbars broken" were introduced to distinguish both cases. Table 3 summarizes the datasets. For testing the neural networks for detecting defect busbars, a dataset consisting of 6 images was used, each showing a solar cell with a single broken busbar. Again, all measurements were performed with a handheld device (see Tab. 4).

Data preprocessing
In the field, measurements might be slightly rotated with respect to each other, i.e. that the busbars are not parallel to the sensor bars, especially with the handheld device. This results in the B x component losing intensity with increasing rotation, but B y gaining intensity. B z shows invariance to rotations and is therefore used as a basis neural network training. A Gaussian gradient filter is also applied to the image, to allow easy annotation (see Fig. 3).
The filter first reduces the noise and then outputs the local gradient for each point. The result is similar to B x but rotation invariant and represents qualitatively the position of electric conductors on the image. This filter also ensures that measurements of adjacent strings on a module are comparable. Otherwise, a backward current flow will result in opposite sensor readings of the components B x , B y and B z . The Gaussian gradient of B z on the other hand will lead to the same result. Furthermore, the background, such as that created by the earth's magnetic field, is removed. After applying the filter, the current paths appear as line-like structures and are well suited to generate the necessary annotations for training. The training data set is additionally artificially augmented by reflections, random rotations and contrast variations to account for effects such as a rotated sensor or differences in illumination. In addition to the reflections, the image is randomly rotated at an angle between À30°and 30°. Overall, the number of images in the training set is not increased because the images are modified on-thy-fly during training. Thus, an image that is used multiple times for training does not enter the training identically each time.

Training
Two types of convolutional neural networks were trained comparatively using the DENKweit AI platform. Instance segmentation networks and object detection networks are widely used methods to detect objects on images. In this work, the two methods will be compared for the case of training with simulated data in the field of photovoltaics.
Instance Segmentation: This mesh type evaluates the image at pixel level, i.e. each pixel is assigned whether it belongs to an object class or not. In the second step, the pixels are separated to objects, something like a busbar. The result is a mask that indicates which pixels belong to an object. Object detection: This net type finds objects, e.g. busbars, on the image and provides them with a bounding box. Training took place on a Nvidia RTX 2080Ti and took approximately 30 min for each of the networks.
For object detection we use a FCOS-based architecture [13]. The feature extraction backbone is a proprietary development and its structure is dynamically adjusted based on the analyzed dataset. The resulting feature maps are fed into the feature pyramid network and its results are then analyzed by the head network for prediction of the bounding boxes. For instance segmentation, we again used proprietary developed network for feature extraction as a backbone. Here, the centre mask approach was used [14]. The feature map is the fed into the heads for saliency, shape, size, heatmap and offset. Results of the (coarse) shape head are multiplied by the relevant area of the saliency map to separate individual instances of objects on the original image.
For each training dataset without defects, an object detection network and an instance segmentation network were trained first. The goal was to determine the basic suitability of the training data sets and network types for the detection of busbars.
Based on these results, networks with the two classes "busbar okay" and "busbar defect" were then trained to detect both variants simultaneously. The mAP (mean average precision) score for each of the trained networks was 1.0.

FE model validation
In the first step, a validation of the FE model is carried out to check whether the results of the simulation agree with the experimental measured values. As described in Section 2.2, a model without defects was modeled and calculated, and a model with a defective busbar near the cell edge was calculated. Figure 4 shows the magnetic flux density in the x direction 1.5 mm above the upper busbars as a heatmap (Fig. 4a) as well as the results along the shown path across the solar cell (Fig. 4b). One can clearly see the four busbars, since the largest current flows through them in the y-direction, which leads to a magnetic field perpendicular to the current flow direction (x). Both figures show a good agreement between simulation and experiment.

Validation using a solar cell without defect
The measurements were made with the handheld device, which is the reason for the x-axis label of the experimental values only showing the number of "datapoints" and not a distance. If the handheld device would have been used to measure at different velocities along the cell, the distances between the busbars would vary in the plot. Figure 5 shows the magnetic flux density in the x direction 1.5 mm above the upper busbars as a heatmap (Fig. 5a) as well as the results along the shown path across the solar cell (Fig. 5b). Simulation and experiment fit well. One can clearly see the defective busbar (1), as well as the three intact ones (2)(3)(4). The first busbar shows no magnetic field at the inlet to the solar cell (y = 0 mm) which is caused by no electric current at this position. Busbars 2-4 have increased currents at this position compared to Figure 4 the missing electrical connection in busbar 1. Along the busbars, the electrical currents equalize due to the cross-conductivity of the grid fingers. The wave-like structures along the busbars of the experimental data (see Fig. 5c) being caused by the solder points are less visible in simulation.

Detection of busbars
The effectiveness of the neural networks for busbar detection in general is tested by application to the test  data set containing only real measurement data. As well as for training, the set was preprocessed using the Gaussian gradient filter.
In the inference step, objects found on the test images are marked and assigned a probability. Results with probability less than 30% were ignored, because within this limit all busbars could be distinguished from misclassifications with smaller probability. The number of busbars found that had a probability greater than 30% was then determined and compared in terms of training sets and network types. The results can be found in Table 5.
To determine the number of training images needed, the set of training images was reduced to 25 per network and then to 10 per mesh. In particular, for instance segmentation, misclassifications occurred for 25 and 10 training images, meaning that additional areas on the images outside the busbar were detected as busbars. Misclassifications occurred in 13 (high variation) and 8 (low variation) training images for 25, and 14 (high variation) and 19 (low variation) for 10 training images. No misclassifications occurred during object detection, but individual busbars were not detected. With high variation, all busbars were detected; with low variation, 1 busbar (25 images) and 17 busbars (10 images) were missing. For 50 images, the results in Table 5 were obtained. Detection was generally at a rate of more than 99%, except in data set "BB detection, Low Variation, Simulation data only". Here, lower values were obtained, 83.96% for the object detection network, 98.13% for the instance segmentation network. Thus, it is assumed, that the variation data must be at least as high as the variation in the real measurements, to get high detection rates.
The addition of real measurement data, even on a small scale, increases the probability of individual detected busbars. This is true for both types of neural networks. Thus, the meshes can be made much more robust by adding a small number of real measurements. Figure 6 shows an example result for the two network types using one arbitrarily picked measurement, including the probabilities given by the network. For object detection networks the result is a bounding box, for the instance segmentation it is the colored pixels that were detected as belonging to the busbars and the overall probability for each instance.
In this example, the second busbar from the top shows a reduced magnetic field, which may be caused by reduced contact quality to the cross-connector. The trained network also detects these busbars with reduced current. Here, additional filtering can be done after detection to additionally allow a quantitative evaluation.
For certainty of detecting the busbars, the associated probabilities of a correct detection were statistically evaluated for each instance found. The results are summarized in the box plots in Figure 7.
Adding real measurement data on a small scale of 14% (see Tab. 3), leads to an increase in detection probability (see Fig. 7 "simulation only" vs. "simulation + MFI). It is noticeable that the networks trained with the data mix show more outliers in the boxplots. This can be explained by narrower probability distributions, still containing some low values. Since the wisker limits are determined by the interquartile intervals, narrow distributions lead to more outliers. Increasing the variance in the training data has a much smaller effect on the probabilities. Depending on the application, however, it may be useful to train with higher variation in order to make the networks robust for more strongly varying, real measurement data.

Detection of functioning busbars and broken busbars
To detect defective busbars, the trained defect network with the two independent classes ("busbar okay" and "busbar not okay") was applied to images of the test set. 100% of the busbars were found by the "busbar okay" network. Also 100% of the defective busbars were found by the "busbars not okay" network. In one case, a busbar that was not defective was also found by the "busbar not okay" network, resulting in one overall misclassification. Figure 8a shows an example result of a measurement evaluated by the neural network. The broken busbar was correctly marked, as well as the functioning busbars. The K. Buehler et al.: EPJ Photovoltaics 14, 12 (2023) classification probabilities assigned to each found object or instance are in the range above 90% for both the intact busbars and the broken busbars (see Fig. 8b).

Discussion
The simulation model being used could be validated by the MFI measurements. The deviations between simulation and experiment were small. The effect of a defective busbar could be modeled correctly, although the model was meshed relatively coarse in order to keep the simulation times small. This is essential for an efficient creation of the AI training data sets.
The results show that it is possible to train neural networks by simulation data for analysing MFI magnetic field data. Though, it is crucial that the simulation data show a similar variation in typical properties as the real measured data. The data sets from the simulation can be extended with a few measurement data sets, if they are available. This leads to an increased number of features found as well as an increased probability to detect these features by the neural networks.
Using a larger variation of the material properties in the simulation usually leads to an improved recognition rate of the features. Only in one case (see Fig. 7, instance segmentation, sim only, variation low vs. high) a larger variance of the simulation data led to a worse recognition rate. Maybe the test data set was not variable enough.
In order to reflect a certain variance also within the training images, the number should not be too small, because there is a possibility that the intended high variability is not achieved by the small number. In general, two small data sets can differ strongly with respect to the variability of the training set, which then leads to different training results. The choice of the set should therefore be made in such a way that the desired variability is also reflected in the training set. Overall, simulation can help to train an AI if no or not enough measurement data are available. With simulation models the variance of the results can be adjusted quickly and purposefully, allowing the training regions to be extended in a physically correct way, even if no measurement data are available for these areas. The simulation also helps to improve the understanding of the relationship between defects and the resulting magnetic field being measured. Furthermore, the demonstrated method can be used to model and train other solar cell defects such as defective solder points or short circuits in the silicon wafer in order to extend the detection capabilities. The procedure shown in this paper can also be applied to other measurement methods for PV module defect detection such as electroluminescence or thermography, assuming that suitable simulation models are available. Fig. 7. Probabilities of busbar detection for the two neural network types instance segmentation (left) and object detection (right), depending on the variation of the training data sets and the addition of real measurement data. Real measurement data significantly increase the probabilities, higher variation of training data had only a small effect, in some cases detrimental. In this work, only 4-busbar cells were used. An extension to more busbars is easily conceivable with respect to the mesh types used since these are only trained locally to recognize objects. As long as the busbars are separated from each other, the number of busbars on the solar cells does not matter. However, in cells with a larger number of busbars, the current in each busbar is reduced. In this case, a further training step may be required. Since the simulation was set up parametrically, the number of busbars can be varied easily to generate further training data. Another possibility is to normalize the magnetic flux density for all training and measurement data to create comparability and to compensate for differences in illumination intensity.

Summary
This paper presented the Magnetic Field Imaging method and showed how it can be used to identify features and defects on solar cells and modules. The AI being used was trained by the results of FE simulations. For this purpose, an electromagnetic FE model of a four-busbar solar cell was presented in this work. This model has been successfully validated with MFI measurements. Subsequently, the model was used for various defect scenarios providing defined and large number of training data.
By varying the electrical conductivities of individual cell components, training data sets with different ranges of variation were generated. These sets were partially supplemented by a few real measurements. With these training data sets an AI was trained. By using a test data set, the recognition probability was analyzed. The results were very good on correctly labeled features.
Two network types were compared: instance segmentation and object detection. It has been shown that instance segmentation detects more features correctly with higher detection probability based on the same training basis. A larger variation of the simulation training data leads to an improved recognition of the features. Extending the simulation training data with a few measurement data, the recognition rate could be even increased. Thus, FE models for generating artificial and physically correct data for AI training are beneficial for reliable AI usage. This work was funded by the German Federal Ministry for Economic Affairs and Climate Action as part of the 'Central innovation programme for small and medium-sized enterprises (ZIM)' within the mobiInspec À MagPV project (funding number: 16KN083023), which is gratefully acknowledged by all authors.

Author contribution statement
Kjell Buehler: Finite-element modelling, controlling the publication process, drafting & writing the paper. Kai Kaufmann: Generation of MFI real world data, training and evaluation of neural networks, drafting & writing the paper. Markus Patzold: Implementation of the neural networks, drafting & writing the paper. Mawe Sprenger: Implementation of the neural networks, drafting & writing the paper. Stephan Schoenfelder: Scientific supervisor, drafting & revising of the publication regarding scientific methods and content.