# Adaptive Leakage Protection for Low-Voltage Distribution Systems Based on SSA-BP Neural Network
## 3 Normal Leakage Current Prediction Model
### Data Pre-Processing  
The input feature vector includes the environmental temperature, humidity, leakage current, and 3-phase current. In order to ensure the validity and typicality of the sample data, it is necessary to preprocess the input, which specifically includes two aspects:  
(1) Make sure that the leakage current measured is normal leakage current rather than fault current. The influence of environmental factors on the normal leakage current of the line is a slow-changing process that takes tens of minutes or even several hours, so the adjacent cycle currents have a high degree of similarity. Unlike the normal leakage current, there is a short transient state when the leakage fault occurs, and its duration ranges from several milliseconds to several cycles. Therefore, the similarity coefficient of two adjacent cycle waveforms can be used to distinguish the two types of leakage current. When the leakage current is identified as the fault leakage current, the subsequent data will no longer be used as training data. In this paper, the Pearson similarity coefficient is used, and the leakage current similarity coefficient of the \(n\)-th adjacent cycle is defined as follows:  
\[r_{k}(n)=\frac{\sum_{j=1}^{M}\left[\left(x_{k-j}-\overline{x_{k}}\right)\left( x_{k-n-j}-\overline{x_{k-n}}\right)\right]}{\sqrt{\left[\sum_{j=1}^{M}\left(x_{k-j}- \overline{x_{k}}\right)^{2}\right]\left[\sum_{k=1}^{M}\left(x_{k-n-j}- \overline{x_{k-n}}\right)^{2}\right]}}=\frac{\overline{x_{k}x_{k-n}}-\overline {x_{k}}\times\overline{x_{k-n}}}{\sqrt{\left(\overline{x_{k}^{2}}-\overline {x_{k}}^{2}\right)\left(\overline{x_{k-n}^{2}}-\overline{x_{k-n}}^{2}\right)}}, \tag{7}\]  
where \(x_{k}\) is the leakage current, \(M\) is the number of sampling points in one cycle, and \(\overline{x_{k}}\) is the average value of \(x_{k}\) one cycle.  
In practice, since the signal measured by the leakage sensor is an alternating current signal, both \(\overline{x_{k}}\) and \(\overline{x_{k-n}}\) are 0, and Equation (7) is simplified as:  
\[r_{k}(n)=\frac{\overline{x_{k}}\overline{x_{k-n}}}{\sqrt{\left(\overline{x_{k} ^{2}}\right)\left(\overline{x_{k-n}^{2}}\right)}}, \tag{8}\]  
(2) Ensure the typicality of the training data. The collected environmental temperature, humidity, and load current are all continuous data. It is not necessary to use all the sampled data when selecting the training samples, and the method of sampling every other time period can be adopted. The method in this paper acquires sampling data every 1 min. In addition, due to the different units of the input parameters and the large difference in range, in order to ensure the convergence speed of the neural network and improve the prediction accuracy, the data needs to be normalized. In order to normalize the input data into \([0,1]\), the specific Equation is:  
\[x_{i}^{n}=\frac{d_{i}^{n}-d_{min}^{n}}{d_{max}^{n}-d_{min}^{n}}, \tag{9}\]  
where \(x_{i}^{n}\) is the normalized data, \(d_{i}^{n}\) is the measured data, \(d_{max}^{n}\) and \(d_{min}^{n}\) are the maximum and minimum values in the \(n\)-th input sample data, respectively.