{'fraction_non_alphanumeric': 0.019158033218220686, 'fraction_numerical': 0.003535602696924848, 'mean_word_length': 4.819617224880383, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Research on power quality prediction of fluctuating load

With the development of intelligent distribution network, power quality prediction is becoming more and more important. In this paper, the power quality prediction methods are studied and applied to a power grid. Firstly, on the basis of time series research, two mathematical models of ARIMA and BP neural network are derived and analyzed, and the corresponding power quality data prediction models are established. Then, the two models are applied to two datasets of different sizes to test and analyze their predictive effects. Based on the analysis and comparison of the prediction results, the improvement direction to further improve the prediction accuracy of the method is proposed.


Introduction
With the development of industrialization, the non-linear, impact and other disturbance loads in the power system have increased dramatically, making power quality problems more and more prominent. At the same time, the development of electronic information makes power users have higher requirements on the level of power quality. For the safe, reliable and economical operation of power grid, power supply enterprises must pay more attention to power quality [1,2].
Power quality prediction is the analysis of existing data. By finding the law of data change, we can predict the power quality indicators in the future, so as to find potential power quality problems ahead of time. Operation and maintenance personnel can take measures timely, so as to minimize the various problems caused by power quality.
The reference [3] proposes a prediction method based on Monte Carlo sampling. The load current data could be gotten with the Monte Carlo model according to the probability distribution models. [4] uses the ARIMA time series algorithm to predict the active power, and establishes neural network model to predict conventional indicators according to the relationship between active power and power quality indicators. The reference [5] presents a hybrid model with the k-means clustering and BP neural network to forecast the electricity load based on the existing electric power data.
Most of the predictions of power quality in the references have combined the knowledge of probability and statistics. And most of the prediction models are linear, and the prediction results are deviated from the actual values. In this paper, the methods of power quality prediction based on ARIMA model and BP neural network algorithm are proposed, and artificial intelligence algorithm is adopted to improve the prediction accuracy. The ARIMA model and BP neural network are introduces in section 1, and the power quality prediction models are established; section 2 proves the accuracy of the algorithm through the examples; finally, the main conclusion are drawn in section 3.

Research on power quality prediction
Power quality prediction is based on the analysis of the changing rules about the monitoring data, fully exploiting the potential relationship between historical data. In this paper, two kinds of commonly used mathematical models are used to predict power quality data, and the prediction effect is analyzed and compared.

Auto-Regressive Integrated Moving Average model
The Auto-Regressive (AR) model is a linear regression model that describes the power quality value at a certain time in the future by using the linear combination of the power quality monitoring data at several moments in the early stage. The expression is shown below. Where, y t-1 to y t-p are the values of the current and previous moments; and y t is the value of the next predicted time; p is the order of the model; a i and e t are model parameters and white noise sequences, respectively.
The Moving Average (MA) model is used to represent the current predicted value through the linear combination of random interference at each moment in the past. Its mathematical expression is shown in equation 2.
In the formula, q represents the order of the model; i θ is the non-zero model parameter.
By combining the AR model with the MA model, the Auto-Regression and Moving Average (ARMA) model is obtained. Its mathematical model can be expressed as Where p and q are the autoregressive order and moving average order of the model; a and θ are undetermined coefficients that are not zero; e is the independent error term; y t is a stationary time series with a zero-mean normal distribution. When the historical power quality data is non-stationary sequence, ARMA model cannot be directly used, but the non-stationary sequence can be stabilized by finite difference, which is Auto-Regressive Integrated Moving Average (ARIMA) model. After finite-order difference processing, ARMA model can be used for power quality data prediction.

BP Neural Network
2.2.1. Multilayer feedforward neural network modal. The neural network model is made up of many interconnected neuron models. A basic neuron model consists of three parts: input, computation and output. A neuron model can receive multiple inputs. Each input quantity is multiplied by a corresponding weight and then summed, and the obtained sum is added with an offset quantity, then processed by a nonlinear function, and the value of the obtained function is the final output [6].  Multiple neuron models are arranged hierarchically and connected to each other according to certain principles, and multilayer neural networks can be constructed. A three-layer neural network model is shown in figure 1. From left to right are the input layer, the hidden layer, and the output layer. The neurons in each layer of the multilayer neural network are not connected to each other. Each layer of neurons is connected to the next layer of neurons, and the output of the previous layer is the input of the latter layer. The input is processed from the input layer through one or more hidden layers and finally output by the output layer. This one-way multi-layer neural network is a feedforward neural network model.
The weight of each connection between the layers in the feedforward neural network model, and the base offset of each neuron, ie the threshold, are undetermined. Through the existing historical data, that is, the training samples, the weights and thresholds of the neural network are continuously updated according to a certain learning algorithm. Finally, a neural network model that performs well on both the training sample and the test sample is obtained, that is, the trained neural network model.

Back propagation Algorithm.
Back propagation algorithm, referred to as BP algorithm, is a commonly used neural network training method. During data sample training, the input data is passed to the input layer of the neural network, and processed through the hidden layer and the output layer to obtain an output value. Then the actual output value is compared with the expected output value to get the error. This process is forward propagation [7].
The commonly used error measure is the average squared error, which is obtained by equation 4: In the formula, m is the number of training samples; y u is the expected output of a training sample; and ˆu y is the actual output of the training sample after processing through the current network.
The error function E can be expressed as a function of weights and thresholds, and the partial derivatives of the error functions to the weights and thresholds of each connection are obtained. The opposite number of partial derivative, that is, the negative gradient direction of function, is the fastest direction of error reduction. On the basis of each of the original weights and thresholds, plus the value of the corresponding negative partial derivative function, the updated weight and threshold are obtained.
Through the above method, the error function is reversely transmitted from the output layer to the input layer, and the weight and threshold of each layer are adjusted according to the negative gradient direction. This process is called a back propagation process. The purpose of the back propagation process is to reduce the function value of the error function, and constantly adjust the parameters of the neural network to optimize the parameters.

BP neural network.
The multilayer feedforward neural network trained by BP algorithm is BP neural network. The training process of the BP neural network is to adjust the parameters through forward calculation and back propagation for each sample. Performing such training on all the data in the training sample will result in a trained neural network. The trained neural network needs to be verified on the validation samples and tested by the test samples to test its performance and generalization ability.

The introduction of example data
In this paper, the power quality data is predicted based on the data of the 5th harmonic voltage and the voltage deviation of a monitoring point. The 5th harmonic voltage contains 29 data points in days, and the voltage deviation is 310 nodes in minutes. In order to test the effect of the model prediction, the historical data is divided into two parts: the training sample and the test sample. Training samples The first example is the prediction of the 5th harmonic voltage ratio. The training sample is the data of the first 25 time points, and the predicted sample is the data of the last 4 time points. This data size is small. The second example is the prediction of the voltage deviation. The training sample is the first 300 time points, and the prediction sample is the data of the last 10 time points. This data is large in scale.

The prediction results of ARIMA model
The data of the training set was taken as known data, then two examples were modeled by ARIMA model, and the future values were predicted. The predicted results are shown in figure 2 and figure 3 respectively.    Through the comprehensive analysis of the prediction results of example 1 and 2, it is found that when the prediction step size is not large, the change trend of the prediction data is basically the same as the actual situation, and the prediction effect is better. However, the prediction error is large for the nodes with large fluctuation range or fast fluctuation speed, and the prediction results lag behind the actual trend.

The prediction results of BP neural network
The     The errors between the predicted value and actual value of the two examples are calculated, as  shown in table 3 and table 4 respectively. According to the figure 4 and table 3, it can be concluded that in the first example, the established neural network model has a better fitting effect on the training samples, but the prediction error on the predicted samples is larger. It can be seen from figure 5 and table 4 that in the second example, the established neural network model has better fitting effects on the training samples and prediction effects on the predicted samples. The neural network model accurately fitted and predicted the trend of data variation, and the relative error value between predicted and actual value were small.
A comprehensive analysis of two examples shows that the training of neural networks requires a large data set. The prediction effect on the smaller data samples is poor; but on the larger data samples, after multiple model training and rolling prediction, the prediction effect is greatly improved, and the prediction results are more accurate

Conclusion
This paper introduces the purpose and significance of the research firstly, then theoretically analyzes the ARIMA model and the BP neural network; next, the power quality prediction models were established based on the above algorithm; finally, the methods are verified by two examples.
The case study shows that the trend of the ARIMA model is basically the same as the actual data. However, when the data fluctuates greatly, the change trend of the predicted results lag behind the reality slightly. The analysis also shows that the power quality prediction model based on BP neural network algorithm has good prediction results and high prediction accuracy when there are lots of historical data for training.