# Optimal Strategy to Select Load Identification Features by Using a Particle Resampling Algorithm
## 2 Materials and Methods
### Event Detection Algorithm  
Load event, which is defined as changes in load characteristics caused by switching on/off or state changes of individual devices [13], is the first and significant step in the load identification. In practical applications, the reliability and accuracy of event detection could be affected by the unpredicted switching and the interference of voltage and current fluctuations. In this paper, a non-parametric cumulative sum control chart (CUSUM) event detection algorithm was used for load detection. This method accumulates the sample data as well as the small deviation of the process. Since the accumulated value is significantly higher, a load event occurs. In addition, the method can be extended to the algorithm bilateral CUSUM due to the fact that the load events about turning on and turning off usually happened in pairs.  
Let the time series of extracting load data be \(X=\{x\left(k\right)\}\), \(k=1\), \(2\),... The statistic function in nonparametric bilateral CUSUM algorithm is defined as:  
\[\left\{\begin{array}{l}f_{0}^{+}=0\\ f_{k}^{+}=\max\left(0,f_{k-1}^{+}+x_{k}-\left(\mu_{0}+\theta\right)\right)\\ f_{0}^{-}=0\\ f_{k}^{-}=\max\left(0,f_{k-1}^{+}-x_{k}+\left(\mu_{0}-\theta\right)\right) \end{array}\right., \tag{1}\]  
where \(\mu_{0}\) is the average value before the occurrence of the load event, \(\theta\) is random noise introduced from outside, and \(f_{k}^{+}\) and \(f_{k}^{-}\) are the random variable with \(0\) being the mean (i.e., random fluctuations around zero). When the load is turning on, \(x_{k}\) will increase and \(f_{k}^{+}\) will have an increasing trend. On the contrary, the load when turned off will make \(f_{k}^{-}\) decrease. So the load event can be detected when the change exceeds the threshold \(h\). Usually, the threshold \(h\) is set according to the lowest power value of the load.  
To make the Equation (1) more understandable, Figure 2 gives a detailed description of the CUSUM. The load is a continuous change on the time axis, i.e., the mean \(\mu_{0}\) in the Equation (1) is changed with time. The sliding window model was then constructed to constrain the accumulated sum to ensure the load event was acquired accurately. So the W1 window and W2 window were modeled in this paper. The W1 window was used to calculate the mean value \(\mu_{0}\) of the sampling sequence. The W2 window was considered as the basis for judging whether a load event has occurred. From Equation (1), the value of \(f_{k}^{+}\) in window W2 gradually accumulates when the value of \(x_{i}\) increases. So when \(f_{k}^{+}\) exceeds a certain threshold \(h\), the load occurs. On the contrary, the value of \(f_{k}^{+}\) in window W2 fluctuates within a small range if no load event is detected. In this case, the W1 and W2 windows slide to the new sampling point and continue to detect.  
Figure 2: Two-sided cumulative sum control chart (CUSUM) algorithm sliding window model.  
Considering that the threshold \(h\) is a global parameter, it is usually determined by the minimum load characteristic value. Therefore, to reduce the influence of the manually set threshold \(h\), the minimum inner-class variance rule can be taken as the change point detection method. In the load event detection window, the active power data samples are classified into two categories: class \(C_{0}\) {\(x_{1},x_{2},\ldots,x_{k}\)} and class \(C_{1}\) {\(x_{k+1},x_{k+2},\ldots,x_{V}\)}, where \(V\) is the sample length in the window, let:  
\[m(C_{0})=\frac{1}{k}{\sum_{i=1}^{k}x_{i}}\text{ and } \tag{2}\]  
\[m(C_{1})=\frac{1}{V-k}{\sum_{i=k+1}^{V}x_{i}}. \tag{3}\]  
When the objective function  
\[\underset{k}{\min}\sum_{i=1}^{k}{(x_{i}-m(C_{0}))^{2}}+{\sum_{i=k+1}^{V}{(x_{i }-m(C_{1}))^{2}}}, \tag{4}\]  
reaches the minimum and \(|m(C_{1})-m(C_{0})|\) is greater than the set active power change value, the time of the change point could be found.