** An Improved PSO Algorithm for the Classification of Multiple Power Quality Disturbances **

Liquan Zhao* and Yan Long**

## Article Information

## Abstract

**Abstract:** In this paper, an improved one-against-one support vector machine algorithm is used to classify multiple power quality disturbances. To solve the problem of parameter selection, an improved particle swarm optimization algorithm is proposed to optimize the parameters of the support vector machine. By proposing a new inertia weight expression, the particle swarm optimization algorithm can effectively conduct a global search at the outset and effectively search locally later in a study, which improves the overall classification accuracy. The experimental results show that the improved particle swarm optimization method is more accurate than a grid search algorithm optimization and other improved particle swarm optimizations with regard to its classification of multiple power quality disturbances. Furthermore, the number of support vectors is reduced.

**Keywords:** Classification Accuracy , Classification of Power Quality Disturbance , Particle Swarm Optimization , Support Vector Machine

## **1. Introduction**

The larger number of loads accessing the power system has caused a variety of problems for the power grids, resulting in economic losses and having a strong social impact in recent years. This has made the power providers and their customers more and more concerned about the problems of power quality. Therefore, the classification of power quality disturbances (PQDs) is required in order to solve power quality problems [1]. Frequently, a power quality disturbance is not just a single disturbance but is comprised of a variety of disturbances. In the latter cases, this disturbance is called multiple disturbances [2]. The classification of multiple PQDs includes extracting feature vectors and optimizing classifiers. At present, the main methods of classifying multiple power quality disturbances include: neural network [3], decision tree [4], and support vector machine (SVM) [5,6]. These classification methods are reliable but the processes of feature extraction and construction of the classifier are complex, there is a long training time for a neural network classifier and it is easy to fall into the local minimum. Although the decision tree classifier can be accomplished quickly, the rules are complex and the model is difficult to deal with. The SVM method is widely used to solve pattern recognition problems.

SVM overcomes the disadvantages of the artificial neural network, which easily relapses into the local optimal solution and has a long training time [7], and thus, we used SVM as the classifier in this paper. However, the SVM classifier has currently not been matched with the best method to optimize the parameters. Based on this problem, a new method of power quality disturbance classification method is proposed based on an improved particle swarm optimization (PSO) algorithm for parameter optimization of the SVM classifier.

The SVM method is used as a classifier to classify the PQDs in this paper. First, we use the wavelet transformation method to extract and input the features of PQDs into the classifier. After this, the improved PSO algorithm that we proposed is used to optimize the SVM. Finally, the power quality disturbances are classified by using SVM classifier. The main difference between our approach and previous approaches is that we proposed an improved PSO algorithm to optimize the SVM and applied this improved SVM to classify PQDs to further improve the classifier performance.

## **2. Support Vector Machine**

The SVM-based learning technique is slightly different from pattern-recognition problems in which the desired output is a discrete value instead of the real value function. The SVM utilizes a linear function set most problems are nonlinear in practice. The nonlinear separable problem can be mapped to a high dimensional space by the kernel function, which can be divided into a linear separable problem. The separation of two classes is performed by the optimal hyper plane [8].

The data set is [TeX:] $$T = \left\{ x _ { i } , y _ { i } \right\} , x _ { i } \in R ^ { n }$$ is the input vector and [TeX:] $$y _ { i } \in \{ + 1 , - 1 \}$$ is the output vector. The fuzzy one-class SVM searches for a crisp hyperplane that separates the image of the target class from the origin:

where w is weight and b is base [9]. Eq. (1), which is namely the hyperplane, is considered to be optimal when the separating margin between two classes is at its maximum, which is achieved by computing:

which is subject to:

Lagrange function method is used to optimize the above problem, which can be expressed as followings:

##### (4)

[TeX:] $$\mathrm { L } ( w , b , a ) = \frac { 1 } { 2 } \| w \| ^ { 2 } - \sum _ { i = 1 } ^ { \mathrm { N } } a _ { \mathrm { i } } \left[ y _ { i } \left( w ^ { T } x _ { i } + b \right) - 1 \right]$$ where a_{i} is a Lagrange multiplier and x_{i} that corresponds to a non-zero a_{i} is known as the support vector [10]. When the data set is not linearly separable, a slack variable is introduced. Thus, Eq. (2) is converted to Eq. (5).

##### (5)

[TeX:] $$\varphi ( w , \xi ) = \left\{ \begin{array} { l } { \min ( 0.5 \| \left. w \right|| ^ { 2 } + C \sum _ { i = 1 } ^ { N } \xi _ { i } ) } \\ { \text { s.t. } y _ { \mathrm { i } } \left( w ^ { T } x _ { i } + b \right) \geq 1 - \xi _ { i } \quad \xi _ { i } \geq 0 } \end{array} \right.$$where C and [TeX:] $$\xi _ { i }$$ is the cost factor and slack variable, respectively.

When the data set is not linearly separable, the original data space is transformed into a high dimensional space by using a conversion method. These transformations are performed by using kernel functions. Therefore, Eq. (5) can be converted to the following expression:

##### (6)

[TeX:] $$Q ( a ) = \max \sum _ { i = 1 } ^ { N } a _ { i } - \frac { 1 } { 2 } \sum _ { i , j = I } ^ { N } a _ { i } a _ { j } y _ { i } y _ { j } K \left( x _ { i } \cdot x _ { j } \right)$$subject to:

where [TeX:] $$K \left( x _ { i } \cdot x _ { j } \right)$$ is the kernel function. The polynomial function, Gaussian function and radial basis function (RBF) are the most commonly used kernel functions. We selected the Gaussian kernel function as the kernel function of SVM, which can be expressed as follows:

##### (9)

[TeX:] $$K \left( x \cdot x _ { i } \right) = \exp \left( - \frac { \left\| x - x _ { i } \right\| ^ { 2 } } { 2 \sigma ^ { 2 } } \right)$$where σ is the bandwidth.

Since SVM is originally designed for the binary classification, when we use it to deal with the multiclass problem, such as the classification of multiple PQDs that results in the observed power signals containing several disturbance components at the same time, we should use a combination of several binary classifiers to construct multiple classifiers. There are several methods of combining binary classifiers in order to construct multiclass classifications. The most commonly used multiclass classification method include the one-against-one method and the one against all method. This paper uses the one-against-one method. However, the parameters σ and C have uncertain values in SVM, and the selection of σ and C has a great impact on the classification results of the SVM method. Therefore, this paper uses an improved PSO method to optimize the parameters σ and C in the SVM method. The classification accuracy of power quality disturbances is used as the performance index for optimization.

## **3. Particle Swarm Optimization Algorithm**

The PSO method that was first proposed in 1995. It is motivated by simulating the way in which a swarm of birds search for food. The PSO method firstly randomly initializes the value of positions and velocities for each particle, before every particle adjusts its velocity according to its neighbors and flying experiences. This process can be expressed as the following:

##### (10)

[TeX:] $$v _ { i d } ^ { t + 1 } = w v _ { i d } ^ { t } + c _ { 1 } r _ { 1 } \times \left( p _ { i d } - x _ { i d } ^ { t } \right) + c _ { 2 } r _ { 2 } \times \left( p _ { g d } - x _ { i d } ^ { t } \right)$$

##### (11)

[TeX:] $$x _ { \mathrm { id } } ^ { \mathrm { t } + 1 } = x _ { \mathrm { id } } ^ { \mathrm { t } } + v _ { \mathrm { id } } ^ { \mathrm { t } + 1 }$$ where [TeX:] $$v _ { i d } , x _ { i d } , p _ { i d } \text { and } p _ { g d }$$ are the velocity of particle, the current position of particle, best position of single particle and the best position of the population respectively [11]. The parameters w and t are the inertia weight and current iteration number, respectively. The parameters r_{1} and r_{2} are random positive values that are less than one. The parameters c_{1} and c_{2} are constants.

The PSO method is a type of adaptive search optimization algorithm based on a group. The potential solution of each optimization problem in the algorithm is called a "particle". The objective function determines the fitness value of each particle. We use the classification accuracy of multiple QPDs as the fitness value.

The process of particle swarm algorithm is expressed as follows:

1) Initialize all parameter values.

2) Calculate the fitness value of each particle.

3) Compare the fitness value of each particle with the optimal location of the history. The best fitness value of the particle is used as p_{id}.

4) If the fitness value of every particle is better than the best position of the population. The current value is set to be p_{gd}.

5) According to Eqs. (10) and (11), update the velocity and position of each particle.

6) If the number of iterations reaches its maximum, stop the algorithm. Otherwise, return to step 2.

Although the standard PSO has many advantages, it is very random and the diversity is poor. In particular, it is difficult to obtain the global optimum solution for the PSO methods [12,13]. To overcome this problem, we proposed an improved PSO method.

## **4. Improved Particle Swarm Optimization Algorithm**

The inertia weight is one of the most important parameters for the PSO method, and it controls the degree of historical factors in the current state. Different inertia weights have different effects on the efficiency of the PSO. An increased inertia weight value will accelerate the speed of convergence. However when this value becomes smaller, it will make the convergence efficiency of the PSO more accurate. Setting the parameters properly can greatly improve the efficiency of the PSO method. Most researchers use the linearly decreasing method to calculate the inertia weight in order to improve the performance of the PSO method. These methods have better performance than the methods based on a fixed inertia weight. Furthermore, it can also adjust the local and global optimization ability of the PSO method. However, there are some disadvantages to linear transition as it does not truly reflect the particle search process and the achieved results are not satisfactory. This paper puts forward an exponential decreasing function in the iterative process.

The basic idea behind this method is described as follows. In the initial stage of the algorithm, particles have a rapid searching speed. They expand into the global search space and determine the approximate location of the optimal solution in the shortest time. As the inertia weight gradually decreases, the speed of particles also slows. As the number of iteration increases, the inertia weight also gradually decreases. The exponential inertia weight formula is shown as follows:

where A, T, and k are the amplitude modulation factor, the maximum iteration number, and current iteration number, respectively.

Fig. 1 shows the inertia weight value with the change in the number of iterations. Where A = 3 and T = 100 . It can be seen from Fig. 1 that the improved inertia weight has a rapid decline rate in the initial stage, which results in the particles having a rapid searching speed and determining the approximate location of the optimal solution in the shortest time. As the number of iteration increases, the value of inertia weight gradually decreases which is good for fine search in a local area and improves the performance of the algorithm.

Fig. 2 shows the fitness value with the change in the number of iterations. As shown in Fig. 2, in early iterations, the fitness value obtained by the PSO method is bigger than our proposed PSO method, but after 20 iterations, the fitness value obtained by the improved PSO is bigger than the PSO. This means that the improved PSO method has better performance than the traditional PSO method. This shows that our proposed PSO algorithm is effective.

## **5. Parameters Optimization of SVM based on Improved PSO**

The penalty parameter σ and bandwidth parameter C have uncertain values in the SVM classifier. Therefore, we use the improved PSO method to optimize these parameters to obtain the optimal value. x_{i1} and x_{i2} are used to express the bandwidth parameter and penalty parameter, respectively. The range of σ and C is set to [0.1, 100] and [0.1, 100], respectively. Furthermore, we set the maximum number of iterations as 100 and the number of particles as 20.

The optimization of SVM parameters based on the improved PSO involves the follows:

1) Initialize the speed and position of the particle.

2) The corresponding A and B of each particle at the beginning are used in the SVM classifier. Calculate the initial fitness value of each particle and the fitness value is the classification accuracy of the disturbance.

3) Compare the individual fitness value and the historical optimal fitness value of each particle. If the current fitness value is good, record the current σ and C values and update the system. Otherwise, the σ and C values are unchanged.

4) Compare the current fitness values and the optimal fitness values of population of each particle. If the current fitness value is good, record the current σ and C values and update the system. Otherwise, the σ and C values are unchanged.

5) Update the velocity and position information of each particle according to the velocity and position formula.

6) If the number of iterations reaches the preset maximum, the algorithm stops and outputs the global optimal solution and the corresponding global optimal value. Otherwise, return to step (2) and repeat.

## **6. Simulation and Analysis**

We use 11 types of disturbance as the signals to be classified in this paper [14]. In this paper, the extracted features of the above-mentioned 11 types of PQDs signals are input into the SVM classifier, which uses our proposed PSO method to optimize the parameters of the SVM. Finally, the multiple PQDs are classified by the improved SVM. The process of classification involves the following steps:

1) The normalized processed data is selected as the training sample while the bandwidth parameters and the penalty parameters are given;

2) Use proposed PSO algorithm to optimize the above mentioned parameters and obtain the optimal value;

3) Training samples are trained by the SVM model and the classification model is obtained;

4) Finally, the remaining samples are input into the trained classification model as test samples, and the classification accuracy is obtained.

Table 1 provides the mathematical expression of the 11 types of disturbances. (D1) to (D11) are the mathematical models of voltage sag, voltage interruption, voltage swell, harmonic, impulsive transient, transient oscillation, voltage flicker, voltage sag with flicker, voltage swell with flicker, voltage sag with harmonic and voltage swell with harmonic respectively. In the experiment, we set [TeX:] $$\omega = 100 \pi , t _ { 1 } = 0.071,$$, [TeX:] $$t _ { 2 } = 0.142 \text { and } T = 2 \pi / \omega$$. In the mathematical model, the u(t) is a step function, and the parameters B, [TeX:] $$\alpha _ { 3 } , \alpha _ { 5 } , \alpha _ { 7 } , \alpha \text { and } \beta$$ are randomly generated from the specified ranges that are given in (D1) to (D11), respectively.

In this paper, 11 types of PQDs that are constructed according to the above mentioned model are used as the source signals to test the performance of the proposed classification method. The grid search algorithm [15] and the improved PSO algorithm [16,17] are compared against the multiple power quality disturbances classifications. We mainly focus on PSO algorithm so we did not compare the other swarm intelligence algorithms [18-21] that can also be used to optimize the SVM and classify quality disturbances.

Table 2 provides the comparison of average accuracy and the total number of support vectors of multiple PQDs using the original PSO and improved PSO with different amplitude modulation factors A. The A is a parameter of inertia weight as shown in Eq. (12). There were 80 training samples for each disturbance and 120 test samples.

From Table 2, we can see that the average classification accuracy of method based on the original PSO is 93.9394% and the total number of support vectors is 478. However, for the method based on the improved PSO method, when A=2.9 , the average classification accuracy is 94.3182% and the total number of support vectors is 369. Furthermore, when A=3.0 , the average accuracy of the method based on the improved PSO method is 94.7727% and the total number of support vectors is 325. When A=3.1 , the average classification accuracy of the improved PSO method is 94.4697% and the total number of support vectors is 386. When A=3.2 , the average classification accuracy of the improved PSO method is 94.3939% and the total number of support vectors is 406. Although the classification accuracy of the method based on the improved PSO method and the number of support vector vary with different A values, all accuracy values were higher for our PSO method compared to the method based on the original PSO method while the number of support vectors is less than the original method. This shows that the performance of classification method based on the improved PSO is better than the original PSO in terms of accuracy and running time.

When the value of A is greater than 3 or less than 3, the classification accuracy will be reduced and the number of support vectors will increase. This is because the value of A becomes larger and the maximum and minimum values of the inertia weight will be larger. However, literature has shown that the optimal value of the inertia weight is between 0.4 and 0.9 so the value of A was chosen to be 3 in this paper.

The classification accuracy of power quality disturbances based on different methods is shown in Table 3. There were 80 training samples of each disturbance and 120 test samples. As shown in Table 3, the accuracies of voltage sag and harmonic disturbance are the same for different methods. For the voltage swell disturbance, impulsive transient disturbance, voltage sag+harmonic, the proposed method has the same accuracy as the grid search method, which is higher than others. For the voltage interruption disturbance, the proposed method has the same accuracy of 88.3333% as the SVM method based on the improved PSO [16] method, which is higher than others. For the transient oscillation disturbance and voltage swell+harmonic, the proposed method has the same accuracy as the SVM methods based on the improved PSO [16] and improved PSO [17] method, which is higher than others. For the voltage sag+flicker, the proposed method has higher accuracy than the others. For the voltage flicker and voltage swell+flicker, the proposed method has lower accuracy than other methods. Although our method has lower accuracy for two types of disturbance signals, our method has the same or higher accuracy for the other nine types of disturbance signals and the average classification accuracy of our method is 94.7727%. This is higher than the accuracy of other methods, which is 93.9394%, 94.1667%, 94.1667% and 94.0909%, respectively. This shows that our method has better performance.

## **7. Conclusion**

In this paper, an improved PSO method is proposed and used to optimize the parameters of the SVM to improve the performance of the power quality disturbances classification. The improved PSO algorithm utilizes a new exponential function formula for determining inertia weight. In the initial stage of the algorithm, a particle has a rapid searching speed. With a gradual decrease in the inertia weight, the speed of the particles will be reduced and in the later stage, the rate of inertia weight gradually decreases. This is advantageous in allowing for a continuous search of a local area and improving the performance of the algorithm. The parameters of the SVM are optimized by the improved PSO algorithm before the multiple power quality disturbances are classified. Compared with other improved PSO algorithms and grid search algorithms, the average classification accuracy is enhanced by using the improved PSO method. In addition, the total number of support vectors is also reduced.

## References

- 1 W. G. Morsi, M. E. El-Hawary, "Power quality evaluation in smart grids considering modern distortion in electric power systems,"
*Electric Power Systems Research*, vol. 81, no. 5, pp. 1117-1123, 2011.doi:[[[10.1016/j.epsr.2010.12.013]]] - 2 Z. G. Liu, Q. G. Zhang, Y. Zhang, "Review of power quality mixed disturbances identification,"
*Power System Protection and Control*, vol. 41, no. 13, pp. 146-153, 2013.custom:[[[-]]] - 3 M. Valtierra-Rodriguez, R. de Jesus Romero-Troncoso, R. A. Osornio-Rios, A. Garcia-Perez, "Detection and classification of single and combined power quality disturbances using neural networks,"
*IEEE Transactions on Industrial Electronics*, vol. 61, no. 5, pp. 2473-2482, 2013.doi:[[[10.1109/TIE.2013.2272276]]] - 4 M. Biswal, P. K. Dash, "Detection and characterization of multiple power quality disturbances with a fast S-transform and decision tree based classifier,"
*Digital Signal Processing*, vol. 23, no. 4, pp. 1071-1083, 2013.doi:[[[10.1016/j.dsp.2013.02.012]]] - 5 D. De Yong, S. Bhowmik, F. Magnago, "An effective power quality classifier using wavelet transform and support vector machines,"
*Expert Systems with Applications*, vol. 42, no. 15-16, pp. 6075-6081, 2015.doi:[[[10.1016/j.eswa.2015.04.002]]] - 6 N. Huang, D. Xu, X. Liu, "Identification of power quality complex disturbances based on S-transform and SVM,"
*Transactions of China Electrotechnical Society*, vol. 26, no. 10, pp. 23-30, 2011.custom:[[[-]]] - 7 Y. Mao. C. Xinxin, Z. Qiang, "A review of short-term wind speed prediction based on support vector machine,"
*Journal of Northeast Electric Power University*, vol. 37, no. 4, pp. 1-7, 2017.custom:[[[-]]] - 8 H. F. Chen, L. Qiao, S. L. Liu, "Power quality disturbances identification using decision tree and support vector machine,"
*Power System Technology*, vol. 37, no. 5, pp. 1272-12718, 2013.custom:[[[-]]] - 9 J. Zhang, K. Wang, W. Zhu, P. Zhong, "Least squares fuzzy one-class support vector machine for imbalanced data,"
*International Journal of Signal Processing. Image Processing and Pattern Recognition*, vol. 8, no. 8, pp. 299-308, 2015.doi:[[[10.14257/ijsip.2015.8.8.31]]] - 10 A. A. Abdoos, P. K. Mianaei, M. R. Ghadikolaei, "Combined VMD-SVM based feature selection method for classification of power quality events,"
*Applied Soft Computing*, vol. 38, pp. 637-646, 2016.doi:[[[10.1016/j.asoc.2015.10.038]]] - 11 X. Huang, D. Zhang, B. Feng, X. Xu, S. Guo, R. Liu, "Application of an improved PSO algorithm to control parameters auto-tuning for bi-axial servo feed system,"
*Procedia CIRP*, vol. 41, pp. 806-811, 2016.doi:[[[10.1016/j.procir.2015.12.024]]] - 12 N. Ruoxi, C. Houhe, Z. Rufeng, J. Tao, "Calculation of available transfer capability considering economic dispatch of power system,"
*Journal of Northeast Electric Power University*, vol. 36, no. 6, pp. 18-24, 2016.custom:[[[-]]] - 13 X. Zhaoyang, W. Xiaoyou, X Degui, X. Zhonghui, "Research on dynamic reactive power optimization based on improved PSO,"
*Journal of Northeast Electric Power University*, vol. 37, no. 3, pp. 33-38, 2017.custom:[[[-]]] - 14 G. Liu, F. Li, G. Wen, S. Ning, S. Zheng, "Classification of power quality disturbances based on independent component analysis and support vector machine," in
*Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition*, Tianjin, China, 2013;pp. 115-123. custom:[[[-]]] - 15 Jixiu, H. Zhang, Y. Jin, X. Yan, H. Wang, "Based on SVM power quality disturbance classification algorithm," in
*Proceedings of the 2015 27th Chinese Control and Decision Conference*, Qingdao, China, 2015;pp. 3618-3621. custom:[[[-]]] - 16 H. Xu, G. Chen, "An intelligent fault identification method of rolling bearings based on LSSVM optimized by improved PSO,"
*Mechanical Systems and Signal Processing*, vol. 35, no. 1-2, pp. 167-175, 2013.doi:[[[10.1016/j.ymssp.2012.09.005]]] - 17 Y. Wang, L. Zhang, Y. Liu, J. Guo, "Gold price prediction method based on improved PSO-BP,"
*International Journal of u- and e-ServiceScience and Technology*, vol. 8, no. 11, pp. 253-260, 2015.doi:[[[10.14257/ijunesst.2015.8.11.25]]] - 18 D. Wang, X. Wu, Z. Wang, "Fault location for distribution network with distributed power based on improved genetic algorithm,"
*Journal of Northeast Dianli University*, vol. 36, no. 1, pp. 1-7, 2016.custom:[[[-]]] - 19 F. J. Kuang, S. Y. Zhang, "A novel network intrusion detection based on support vector machine and tent chaos artificial bee colony algorithm,"
*Journal of Network Intelligence*, vol. 36, no. 1, pp. 1-7, 2016.custom:[[[-]]] - 20 J. Zhang, M. Chen, P. W. Tsai, L. M. Tang, X. R. Ji, "A coverage loopholes recovery algorithm in wireless sensor networks,"
*Journal of Information Hiding and Multimedia Signal Processing*, vol. 7, no. 6, pp. 1354-1364, 2016.custom:[[[-]]] - 21 W. Qian. L, Lina. X. Bei, C. Houhe, "Planning of distributed energy storage system for improving low voltage and network loss in rural network,"
*Journal of Northeast Electric Power University*, vol. 37, no. 5, pp. 19-24, 2017.custom:[[[-]]]