A Novel Algorithm for Fast DC Electric Arc Detection

: Electric arcing is a common problem in DC power systems. To overcome this problem, the electric arc detection algorithm has been developed as a faster alternative to existing algorithms. The following issues are addressed in this paper: The calculation of the proposed algorithm of incremental decomposition of the signal over time; the computational complexity of Fast Fourier Transform (FFT) and the incremental decomposition; the test bench used to measure electric arcs at given parameters; the analysis of measurements using FFT; and the analysis of measurements using incremental decomposition. The parameters are the DC voltage, electric load, and width of the gap between electrodes. The results showed that the proposed algorithm allows for a faster calculation—about seven times faster than FFT—and cheaper implementation in electric arc detection devices than FFT.

The signal processing methods mentioned above are able to distinguish between waveforms with and without an arc very efficiently, but they also have the drawback of a high computational complexity or the need to learn and thus long calculation times. The aim of the arc detection algorithm proposed in this paper is not strictly to provide a high accuracy, but also a low computational complexity, in order to detect the arc as quickly as possible, regardless of the DC power system, and allow the use of low-cost microcontrollers. The algorithm of incremental decomposition of the signal over time works in the time domain and has been proposed as a less computationally complex and time consuming alternative to the frequency or time-frequency analyses mentioned at the beginning of this paper. The proposed algorithm has been preliminarily tested for arc recognition at a low voltage of 150 V DC and at a low sampling frequency of 250 kS/s [66]. In this study, it was tested at different and higher voltages, for different values of current and various distances between the electrodes of the spark gap. The sampling frequency was also increased to 500 MS/s (signal measured by the oscilloscope) to record faster current spikes and the number of samples was varied to observe for how long the data have to be acquired for the accurate detection of arcs. The current measurement was chosen as it represents the most popular decision in the mentioned literature and the authors want the algorithm to be universal.
The second chapter presents the calculation method commonly used in the arc detection frequency spectrum and proposed algorithm of incremental decomposition of the current over time. Then, the computational complexity of both algorithms and the exact structure of the measurement system are provided. The data acquired form this system are then presented in the third chapter using both algorithms, which are then analysed in the fourth chapter and summed up in the fifth chapter.

Arc Detection Algorithms and Measurement Setup
For arc detection in this study, the authors used the proposed algorithm of incremental decomposition and spectrum analysis, using FFT as the reference.

Spectrum Analysis in Electric Arc Detection
To obtain the frequency spectrum of the measured signal, a popular algorithm that can be used is Discrete Fourier Transform (DFT). The DFT calculation can be performed using the following equation: where X(m)-mth sample of the output signal vector, m-frequency domain output vector sample index, x(n)-nth sample of the input signal vector, n-time domain input vector sample index, and N-window width/sample count. Then, to calculate the exact frequency magnitudes in the spectrum, the absolute values of the output vector complex numbers can be calculated using the following equation: where X mag (m)-mth output spectrum frequency harmonic, X real (m)-real part of the mth complex number, and X imag (m)-imaginary part of the mth complex number.
The exact values of frequency harmonics in terms of FFT are calculated in the same way, since the FFT gives the same result as DFT [67], but the algorithm employed for its calculation was optimized by Cooley and Tukey in 1965. That optimization made the Energies 2021, 14, 288 3 of 17 calculation of the frequency spectrum much faster, but it still requires a lot of computational effort, hence the use of complex numbers. The computational complexity of both algorithms and the one proposed by the author is presented in Section 2.3.
Frequency analysis is a method used, among the others mentioned, in DC arc detection in the photovoltaic industry [68]. The key to detecting an arc efficiently is to define the following parameters of FFT: The sampling frequency, length, and shape of the measuring window. Moreover, on the basis of the FFT results, it is crucial to select the bandwidth, as the area within the arc introduces the most harmonics in reference to the background noise present there all the time [66], and this also applies to AC arc detection devices [69].

Proposed Algorithm of Incremental Decomposition of the Signal over Time
An algorithm of incremental decomposition constructs a spectrum of increments in the given signal. An increment is understood as how much the voltage, current, resistance, or whatever the measured waveform represents, has changed its value (absolute value according to the last sample) in the given amount of time. The calculated chart shows how many increments of particular values have occurred in the order from the lowest in value to the highest. The algorithm of the incremental decomposition calculation is shown in Figure 1.
Xreal(m)-real part of the mth complex number, and Ximag(m)-imaginary part of the mth complex number.
The exact values of frequency harmonics in terms of FFT are calculated in the same way, since the FFT gives the same result as DFT [67], but the algorithm employed for its calculation was optimized by Cooley and Tukey in 1965. That optimization made the calculation of the frequency spectrum much faster, but it still requires a lot of computational effort, hence the use of complex numbers. The computational complexity of both algorithms and the one proposed by the author is presented in chapter 2.3.
Frequency analysis is a method used, among the others mentioned, in DC arc detection in the photovoltaic industry [68]. The key to detecting an arc efficiently is to define the following parameters of FFT: The sampling frequency, length, and shape of the measuring window. Moreover, on the basis of the FFT results, it is crucial to select the bandwidth, as the area within the arc introduces the most harmonics in reference to the background noise present there all the time [66], and this also applies to AC arc detection devices [69].

Proposed Algorithm of Incremental Decomposition of the Signal over Time
An algorithm of incremental decomposition constructs a spectrum of increments in the given signal. An increment is understood as how much the voltage, current, resistance, or whatever the measured waveform represents, has changed its value (absolute value according to the last sample) in the given amount of time. The calculated chart shows how many increments of particular values have occurred in the order from the lowest in value to the highest. The algorithm of the incremental decomposition calculation is shown in Figure 1.  The variable i (Iteration) represents the loop iteration and index of the sample in the vector of the input signal named s (Signal). The variable d (Difference) is the temporary value of the increment calculated and the index of the increment repetition count in the resulting vector of the decomposition calculation named o (Output). All calculations are performed in a single loop. For each iteration, a value of the increment is calculated by the absolute value of subtracting two samples next to each other. Then, the repetition count of a given increment and the sample number are both increased by one. Such operations are performed for the number of samples in the signal minus one.
As mentioned in Section 1, the requirement is that the arc detection algorithm is not computationally complex. The given algorithm is performed in a single loop and works on data directly acquired from the analog-to-digital converter, such as integer numbers. Furthermore, the only mathematical operations performed in the calculation of the incremental decomposition are subtraction and addition. Since no floating-point numbers are used and no multiplication or division operations are performed during calculations, the algorithm can be implemented in low-cost microcontrollers and be calculated in real-time. The final criterion of arc detection is the shape of the decomposition spectrum, and this can be checked by a comparison of two values, if they fit into certain intervals.
In this study, measurements were acquired from the oscilloscope, not directly from an analog-to-digital converter, so additional signal pre-processing had to be conducted compared with [66]. All samples had to be divided by the value of the least significant bit of the oscilloscope's ADC, which was 0.12 mV. This is a part of the algorithm, but the case of an oscilloscope is unusual and the pre-processing division has not been taken into account in Figure 1, since raw data from the ADC in a custom arc detection device are always available. Table 1 shows the computational complexity of Discrete Fourier Transform (DFT), Fast Fourier Transform (FFT) [67], and incremental decomposition, with regard to the types of mathematical operations performed during the calculation. N is the number of samples in the input signal.

DFT FFT (Radix-2) Incremental Decomposition
Complex multiplication As shown in Figure 2, incremental decomposition is less computationally comple than DFT and FFT in terms of the total number of mathematical operations performed, n matter what the sample count is. Fourier transforms works with complex, floating poin  As shown in Figure 2, incremental decomposition is less computationally complex than DFT and FFT in terms of the total number of mathematical operations performed, no matter what the sample count is. Fourier transforms works with complex, floating point numbers and incremental decomposition works with real, integer numbers. What is more, the calculation of DFT and FFT requires multiplication, while the calculation of incremental decomposition only requires subtraction and addition, which are faster to execute with low-cost microcontrollers than multiplication and division. The number of samples for incremental decomposition is insignificant, opposite to the FFT, where it must be the power of 2 when using the most popular radix-2 algorithm.

Test Bench Used to Measure Electric Arcs at Given Parameters
The measurement system can be divided into two subsystems: A first for arc generation and second for acquiring data. Both of them were galvanically separated from each other for safety and noise performance reasons. The first subsystem consisted of power supplies, the dummy load, and a spark gap driven by a stepper motor. The second subsystem included a Rogowski coil with an integrator and an oscilloscope. A block diagram of the whole system is shown in Figure 3 and in a photo in Figure 4.
than DFT and FFT in terms of the total number of mathematical o matter what the sample count is. Fourier transforms works with numbers and incremental decomposition works with real, in more, the calculation of DFT and FFT requires multiplication, incremental decomposition only requires subtraction and addi execute with low-cost microcontrollers than multiplication and samples for incremental decomposition is insignificant, oppos must be the power of 2 when using the most popular radix-2 alg

Test Bench Used to Measure Electric Arcs at Given Parameters
The measurement system can be divided into two subsyste ation and second for acquiring data. Both of them were galvanic other for safety and noise performance reasons. The first subsy supplies, the dummy load, and a spark gap driven by a stepper system included a Rogowski coil with an integrator and an oscill of the whole system is shown in Figure 3 and in a photo in Figur   The power source contained 10 supplies, each with an output voltage of 160 V DC and the maximum current of 1 A, connected in series. Each supply could work as an active power source or as a short, so there was no need to reconfigure any connections to regulate the output voltage. All power supplies were linear, since switched ones may add switching frequency harmonics to the measured spectrum of the arc. The output of the  The power source contained 10 supplies, each with an output voltage of 160 V DC and the maximum current of 1 A, connected in series. Each supply could work as an active power source or as a short, so there was no need to reconfigure any connections to regulate the output voltage. All power supplies were linear, since switched ones may add switching frequency harmonics to the measured spectrum of the arc. The output of the power source included an artificial load connected in series with a spark gap. The artificial load was resistive and contained a reconfigurable circuit of 16 resistors on heatsinks, 100 Ω, 100 W each. The spark gap had two electrodes: One moving and one fixed. The moving electrode was driven by a stepper motor to ensure an accurate distance setting. The available distance was provided in the interval from 0 to 10 mm, with an accuracy of 0.05 mm. The moving electrode was also needed to shorten the circuit and ignite the arc. This ensured the safety of the approach while making measurements, owing to the fact that the spark gap was controlled from the distance to the circuit at a high voltage. The current in the measured circuit was sensed by the Rogowski coil model CWTUM/015/B/1/80 manufactured by PEM. This coil is able to measure signals at frequencies of up to 30 MHz. This high bandwidth was important due to the nature of the electric arc, whose bandwidth is easier to distinguish from the background noise at higher frequencies. The oscilloscope used to capture waveforms from the integrator of the coil covers a much higher bandwidth and has the memory depth of 40 Mpts.
All measurements were taken at different parameters of the arc. One measurement is defined as a continuous signal covering 100,000 samples from the oscilloscope at the sampling rate of 500 MS/s. Measurements were divided into four series:

•
Ten control measurements without an arc (conditions: shorted spark gap and current of 500 mA DC at each measurement); • Ten measurements at different voltages regulated in steps from 160 V to 1.6 kV DC (conditions: 1 mm gap between electrodes and current of 900 mA DC at each measurement); • Ten measurements at different loads regulated in steps from 700 Ω to 1.6 kΩ (conditions: 1 mm gap between electrodes and voltage of 800 V DC at each measurement); • Ten measurements at different gaps between electrodes regulated in steps from 1 mm to 1 cm (conditions: voltage of 1.6 kV DC and current of 1 A DC at each measurement).
All of the measurements in each of the series were repeated ten or more times to check whether they were repeatable. Next, one of the measurements for each of the conditions was selected randomly and taken into consideration as the final tens in each of the series. The results were not averaged in any way. A boxcar window was used for all of the measurements, as it does not require any additional processing of data (multiplying by the window), so it is the best solution for the fastest arc detection algorithm.

Results
All analyses in this chapter for both FFT and incremental decomposition were performed using the same sets of data, described in Section 2.4, for an exact comparison of the two algorithms. All of the charts in this chapter were generated using Scilab. Frequency spectra of all measurements mentioned in Section 2.4 were calculated using FFT (500 MS/s, boxcar window). The obtained frequency spectra showed that there are no differences between their shapes at various voltages, various loads, or various distances between electrodes. The shape of the spectrum only changes when there is no arc and while arcing, so it is possible to detect whether the arc has occurred using FFT. Figure 5 shows two frequency spectra. The first, marked in black, was taken while there was no arc in the circuit, and the second, marked in red, was taken with arcing present in the circuit. using FFT (500 MS/s, boxcar window). The obtained frequency spectra showed that there are no differences between their shapes at various voltages, various loads, or various distances between electrodes. The shape of the spectrum only changes when there is no arc and while arcing, so it is possible to detect whether the arc has occurred using FFT. Figure 5 shows two frequency spectra. The first, marked in black, was taken while there was no arc in the circuit, and the second, marked in red, was taken with arcing present in the circuit.

Analysis of Measurements at the Window Width of 1 kpts
The spectra obtained at the window width of 1 kpts (500 MS/s, boxcar window) also showed that differences between signals can only occur during arcing and when there is no arcing. The voltage, load, or length of the arc has no impact. Figure 6 shows two frequency spectra. The one marked in black was taken while there was no arcing, and the one marked in red was taken while there was arcing. Since the window width was only 1 kpts, the frequency resolution of FFT dropped from 5 to 500 kHz.

Analysis of Measurements at the Window Width of 1 kpts
The spectra obtained at the window width of 1 kpts (500 MS/s, boxcar window) also showed that differences between signals can only occur during arcing and when there is no arcing. The voltage, load, or length of the arc has no impact. Figure 6 shows two frequency spectra. The one marked in black was taken while there was no arcing, and the one marked in red was taken while there was arcing. Since the window width was only 1 kpts, the frequency resolution of FFT dropped from 5 to 500 kHz.

Analyses of Measurements Using Incremental Decomposition
As opposed to the FFT, which is a type of frequency-domain analysis, incremental decomposition might be considered as a time-domain analysis. This eliminates the problem of choosing an appropriate frequency spectrum, where the arc introduces the most harmonics with reference to the noise, which is normally present there. The FFT also has one huge drawback, i.e., random spikes in the signal pull the whole spectrum up in amplitude. In incremental decomposition, it will only show up as one high value increment, without disturbing the rest of the decomposition. All incremental decompositions presented in this chapter were calculated using the measurements mentioned in

Analyses of Measurements Using Incremental Decomposition
As opposed to the FFT, which is a type of frequency-domain analysis, incremental decomposition might be considered as a time-domain analysis. This eliminates the problem of choosing an appropriate frequency spectrum, where the arc introduces the most har- monics with reference to the noise, which is normally present there. The FFT also has one huge drawback, i.e., random spikes in the signal pull the whole spectrum up in amplitude. In incremental decomposition, it will only show up as one high value increment, without disturbing the rest of the decomposition. All incremental decompositions presented in this chapter were calculated using the measurements mentioned in Section 2.4. Figure 7 shows incremental decompositions of two random measurements of the signal, without an arc present in the circuit. Figures 8-10 show decompositions of signals during arcing at various parameters. Figure 8 shows two decompositions taken at different voltages, with the black line representing 160 V and the red line representing 1.6 kV. Figure 9 shows two decompositions recorded at different loads, where the black line representing 700 Ω and the red line representing 1.6 kΩ. Finally, Figure 10 shows two decompositions taken at different distances between the electrodes of the spark gap, with the black line representing 1 mm and the red line representing 1 cm. Ten measurements were taken for researching each parameter of the arc, but only two extremes are presented in the figures, in order to clearly show the tendencies.           Figure 11 shows decompositions of two measurements of the signal without an arc. Figures 12 and 13 show decompositions of signals while arcing occurred at different loads and distances of electrodes, respectively. In Figure 12, decompositions are marked as follows: 700 Ω-black line and 1.6 kΩ-red line. Additionally, in Figure 13 Figure 11 shows decompositions of two measurements of the signal without an arc. Figures 12 and 13 show decompositions of signals while arcing occurred at different loads and distances of electrodes, respectively. In Figure 12, decompositions are marked as follows: 700 Ω-black line and 1.6 kΩ-red line. Additionally, in Figure 13 Figure 11 shows decompositions of two measurements of the signal without an arc. Figures 12 and 13 show decompositions of signals while arcing occurred at different loads and distances of electrodes, respectively. In Figure 12, decompositions are marked as follows: 700 Ω-black line and 1.6 kΩ-red line. Additionally, in Figure 13

Analysis of Measurements at the Window Width of 1 kpts
Incremental decompositions of signals without an arc are shown in Figure 14. Figure  15 shows two decompositions recorded at different distances between the electrodes of the spark gap, where the black line marks decomposition at 1 mm and the red line marks that at 1 cm.

Analysis of Measurements at the Window Width of 1 kpts
Incremental decompositions of signals without an arc are shown in Figure 14. Figure  15 shows two decompositions recorded at different distances between the electrodes of the spark gap, where the black line marks decomposition at 1 mm and the red line marks that at 1 cm.

Analyses of Measurements Using FFT
As shown in Figure 5, the spectrum where the arc introduces the most harmonics starts at 20 MHz, which also applies to AC arc, since the author of the Siemens 5SM6 arc fault detection unit has selected the bandwidth from 22 to 24 MHz to be measured by the high frequency sensor in this device [69]. The bandwidth up to 8 MHz reveals no noticeable difference between the shapes of the spectra during arcing or where there is no arcing.
The spectrum shown in Figure 6 proves that low resolution arc detection is possible by measuring the average level of all harmonics in the bandwidth from 8 to 30 MHz, and not by checking the specified shape of the spectrum, since that shape is more random.

Analyses of Measurements Using FFT
As shown in Figure 5, the spectrum where the arc introduces the most harmonics starts at 20 MHz, which also applies to AC arc, since the author of the Siemens 5SM6 arc fault detection unit has selected the bandwidth from 22 to 24 MHz to be measured by the high frequency sensor in this device [69]. The bandwidth up to 8 MHz reveals no noticeable difference between the shapes of the spectra during arcing or where there is no arcing.
The spectrum shown in Figure 6 proves that low resolution arc detection is possible by measuring the average level of all harmonics in the bandwidth from 8 to 30 MHz, and not by checking the specified shape of the spectrum, since that shape is more random.

Analyses of Measurements Using FFT
As shown in Figure 5, the spectrum where the arc introduces the most harmonics starts at 20 MHz, which also applies to AC arc, since the author of the Siemens 5SM6 arc fault detection unit has selected the bandwidth from 22 to 24 MHz to be measured by the high frequency sensor in this device [69]. The bandwidth up to 8 MHz reveals no noticeable difference between the shapes of the spectra during arcing or where there is no arcing.
The spectrum shown in Figure 6 proves that low resolution arc detection is possible by measuring the average level of all harmonics in the bandwidth from 8 to 30 MHz, and not by checking the specified shape of the spectrum, since that shape is more random. The measurements also show that an arc generates harmonics in the low frequency region, Energies 2021, 14, 288 13 of 17 from 10 to 400 kHz, but at a lower level. A circuit measuring at this bandwidth has been developed by Texas Instruments as an evaluation board for arc detection in photovoltaics, named . This board filters frequencies from 40 to 120 kHz and then checks, using FFT, whether the spectrum has the same shape as the input filter response. Although this method works, it has the disadvantage of false triggering during the appearance of any disturbances at low frequencies (e.g., DC-DC converters). In the higher frequency region, it is least certain that a load introduces its harmonics to the waveform of the current [69]. Generally speaking, it is possible to identify arcing using FFT; however, the microcontroller that needs to be implemented in the measurement system must have a relatively high computational power.

Analyses of Measurements Using Incremental Decomposition
In the case of 100 kpts analysis, according to Figure 7, incremental decompositions of signals with no arc in the circuit cover each other, so they are repeatable. The same situation is present in Figure 8, but for different voltages, so the voltage has no effect on the shape of decomposition (measurements for different voltages were taken at a constant current by varying the load). The situation is different in Figure 9, where the count of repetitions of increments to 2.5 mA/ns decreases, and from 2.5 mA/ns, increases when stepping up the load and therefore stepping down the current. The distance between the electrodes of the spark gap has the largest influence on the shape of the decomposition, as shown in Figure 10. When stepping up the distance, the count of repetitions of increments to 2.5 mA/ns increases and from 2.5 mA/ns, decreases.
Incremental decompositions for 10 kpts were calculated for measurements at a sampling rate of 500 MS/s with a reduced window width from 100 to 10 kpts. A chart with decompositions at various voltages has been omitted here, since no tendency was observed with fewer samples. In terms of decompositions at different loads, shown in Figure 12, fewer samples effaced the tendency shown before. The difference between the repetition count of the 0.5 mA/ns increment dropped from 1000 to 200 for two extreme loads. The tendency with different distances between the electrodes of the spark gap is shown in Figure 13, and it is the same as that displayed in Figure 9. However, the difference between the repetition count of the 0.5 mA/ns increment dropped from 3000 to 300 for two extreme distances between electrodes.
In the last case, for 1 kpts, the window width was reduced again from 10 to 1 kpts. As shown in Figure 14, measurements with no arc were still repeatable. Figure 15 shows that at a low sample count, the last tendency with the distance of electrodes was also effaced compared to Figure 13. However, decompositions of signals during arcing and with no arcing were still easy to distinguish and arc detection was possible, since the difference between the repetition count of the 0.5 mA/ns increment was approx. 70 when comparing the worst cases of Figures 14 and 15.
With a high number of samples, the shape of the decomposition changes with the current of arc and gap between electrodes. At a low sample count, these parameters are less significant for the decomposition's shape (less repetition count difference for the extreme parameters of the arc), but arc detection itself is still easily possible (the worst case of 70 repetition count difference between arcing and non-arcing). Therefore, the algorithm is demonstrated to have fulfilled the expectations, and can now be implemented in the embedded system and tested for calculation times and arc detection under various loads. The requirements for such a system are a 100 MHz clock and 32 kB program memory microcontroller with an external 5 MS/s sampling rate and 8-bit resolution ADC. Apart from its use in electric arc detection, incremental decomposition has found an application in medicine [71].

Conclusions
This article presents the results of research on the FFT frequency method and incremental decomposition of the current over time in DC electric arc detection. The test bench was built in order to carry out the research, which allowed us to generate arcs at three variable parameters of the voltage, load, and distance between the electrodes of the spark gap. As a result of the tests, waveforms of different durations and numbers of samples from 1 to 100 kpts were recorded.
The first method was proposed as a reference method and requires the use of the FFT algorithm to transform the tested waveform into the frequency domain, which involves a large computational effort, thus prolonging the response time for electric arc detection. The second method, which is currently being developed by the authors, allows for arc detection in about a seven times shorter period for 1024 samples due to its low computational complexity. As a result of the research, it has been determined that, by analyzing the characteristics resulting from incremental decomposition, it is possible to detect an arc. The shape of the characteristics is primarily influenced by the distance of the electrodes between which an electric arc occurs. This relation is valid for all tested sample numbers, as well as for the lowest tested in the article, i.e., 1 kpts.

Conflicts of Interest:
The authors declare no conflict of interest.