## 3 The Proposed Algorithm of PQDs Detection and Classification Based on PSR and CNN
### The Proposed Method  
The main framework of the proposed method is illustrated in Figure 3. A CNN model composed of three convolution layers, two pooling layers, a fully connecting layer, and an output layer is established. The number of the convolution kernels in different layers are 32, 48, and 64, respectively. Figure 1: The fundamental framework of the convolutional neural network (CNN) model. \begin{table}
\begin{tabular}{c c c c} \hline
**PQ Disturbance** & **Label** & **Numerical Model** & **Parameters** \\ \hline Sag & Sag & \(v(t)=(1-a(u(t-t_{1})-u(t-t_{2})))sinut\) & \(0.1\leq a\leq 0.9\), \(T\leq t_{2}-t_{1}\leq 9T\) \\ \hline Swell & Swell & \(v(t)=(1+a(u(t-t_{1})-u(t-t_{2})))sinut\) & \(0.1\leq a\leq 0.8\), \(T\leq t_{2}-t_{1}\leq 9T\) \\ \hline Interruption & Inter & \(v(t)=(1-a(u(t-t_{1})-u(t-t_{2})))sinut\) & \(0.9\leq a\leq 1\), \(T\leq t_{2}-t_{1}\leq 9T\) \\ \hline Flicker & Flicker & \(v(t)=(1+a/\sin(\textit{flat}))sinut\) & \(0.1\leq a\leq 0.5\), \(S\leq 9\leq 20 Hz\) \\ \hline Harmonic & Har & \(v(t)=a_{1}sinut+a\sin(\textit{slot}+a\sin\textit{slot})\) & \(0.05\leq a_{3}\leq 0.5\), \(\Sigma\alpha^{2}=1\) \\ \hline Oscillatory Transient & Osc & \(v(t)=sinut+\alpha^{\frac{(0.1)}{a}}sinu_{h}(t-t_{1})\times[u(t_{2})-u(t_{1})]\) & \(0.1\leq a\leq 0.8\), \\  & & & \(0.5T\leq t_{2}-t_{1}\leq 3T\), \\  & & & \(8 ms\leq t_{5}\leq 40 ms\), \\  & & & \(300\leq f_{5}\leq 900 Hz\) \\ \hline Spike & Spike & \(v(t)=sinut+sign(simut)\times\) & \(0.1\leq t\leq 0.4\), \(S\leq t_{1}\), \(t_{2}\leq 0.5T\) \\  & & & \(0.017\leq t_{2}-t_{1}\leq 0.05T\) \\ \hline Sag \& Harmonic & Sag \& Har & \(v(t)=(1-a(u(t-t_{1})-u(t-t_{2})))\times\) & \(0.1\leq a\leq 0.9\), \(T\leq t_{2}-t_{1}\leq 9T\) \\  & & & \((a_{1}sinut+a\sin(\textit{slot}+a\sin\textit{slot}))\) & \(0.05\leq a_{3}\), \(a_{5}\leq 0.15\), \(\Sigma\alpha^{2}=1\) \\ \hline Interruption \& Harmonic & Inter \& Har & \(\begin{array}{l}v(t)=(1-a(u(t-t_{1})-u(t-t_{2})))\times\\ (a_{1}sinut+a\sin(\textit{slot}+a\sin(\textit{slot})))\end{array}\) & \(0.9\leq a\leq 1\), \(T\leq t_{2}-t_{1}\leq 9T\) \\ \hline Swell \& Harmonic & Swell \& Har & \(\begin{array}{l}v(t)=(1+a(u(t-t_{1})-u(t-t_{2})))\times\\ (a_{1}sinut+a\sin(\textit{slot}+a\sin(\textit{slot})))\end{array}\) & \(0.1\leq a\leq 0.8\), \(T\leq t_{2}-t_{1}\leq 9T\) \\ \hline \end{tabular}
\end{table} 
Table 1: Results of variational mode decomposition (VMD) for power quality disturbances (PQDs) with harmonics and interharmonics extraction. Herein, the image features are extracted by the convolution operator to preserve the spatial relationship between pixels in the image matrix. A feature map is produced by a kernel based on the input image. In this paper, three kinds of convolution kernel with two different size (\(5\times 5\) and \(3\times 3\)) are used. For the sake of simplicity, a \(5\times 5\) convolution kernel is taken for example and the convolution operation is implemented by:  
\[c_{ij}^{k}=\sum\
olimits_{m=0}^{4}\sum\
olimits_{n=0}^{4}w_{m,\ n}x_{i+m,j+n}+b ^{k} \tag{5}\]  
where \(w\) is the weight of the kernel, \(x\) is the input data of this layer, \(b\) is a bias term, \(c\) is the result of convolution operation, \(k\) is the number of kernels, and \(i,\ j\) and \(m,\ n\) are the location labels of the original image and convolution kernel matrices, respectively. The implementation of the convolution operator is illustrated in Figure 4. A kernel slides over the input image by using (5) to produce a feature map and the stride size of the sliding is 1. To guarantee the process of feature extraction, the zero padding method is used to preserve the information of the input volume. The convolution of another kernel over the same image gives a different feature map. Actually, the convolution operation captures the local dependencies in the input image and different feature maps are generated by different kernels. An additional operation, called activation, is performed after every convolution layer.