Next Article in Journal
Experimental Fitting of Redesign Electrified Turbocompressor of a Novel Mild Hybrid Power Train for a City Car
Previous Article in Journal
Ab-Initio Molecular Dynamics Simulation of Condensed-Phase Reactivity: The Electrolysis of Ammonia and Ethanimine in Aquatic Carbon Dioxide Solutions
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Short-Term Electricity Price Forecasting Based on BP Neural Network Optimized by SAPSO

School of Civil and Hydraulic Engineering, Huazhong University of Science and Technology, Wuhan 430074, China
*
Author to whom correspondence should be addressed.
Energies 2021, 14(20), 6514; https://doi.org/10.3390/en14206514
Submission received: 18 August 2021 / Revised: 27 September 2021 / Accepted: 7 October 2021 / Published: 11 October 2021
(This article belongs to the Section F: Electrical Engineering)

Abstract

:
In the electricity market environment, the market clearing price has strong volatility, periodicity and randomness, which makes it more difficult to select the input features of artificial neural network forecasting. Although the traditional back propagation (BP) neural network has been applied early in electricity price forecasting, it has the problem of low forecasting accuracy. For this reason, this paper uses the maximum information coefficient and Pearson correlation analysis to determine the main factors affecting electricity price fluctuation as the input factors of the forecasting model. The improved particle swarm optimization algorithm, called simulated annealing particle swarm optimization (SAPSO), is used to optimize the BP neural network to establish the SAPSO-BP short-term electricity price forecasting model and the actual sample data are used to simulate and calculate. The results show that the SAPSO-BP price forecasting model has a high degree of fit and the average relative error and mean square error of the forecasting model are lower than those of the BP network model and PSO-BP model, as well as better than the PSO-BP model in terms of convergence speed and accuracy, which provides an effective method for improving the accuracy of short-term electricity price forecasting.

1. Introduction

In the electricity market, electricity price forecasting is one of the basic conditions for optimal decision-making. The prediction accuracy of the electricity price directly affects the income and risk of transactions and it is the information that market participants pay close attention to [1,2,3,4]. Power generation companies need to determine the bidding curve according to the predicted electricity price in order to maximize profits while reducing risk [5,6]. However, due to the advance of power system development, the fluctuation of the electricity price is not increasing, but affected by many uncertain factors, such as the change of supply and demand, network congestion, market and the psychology of bidders [7]. These random factors, which are difficult to quantify and screen, make it more difficult to forecast electricity price.
At present, the mainstream short-term electricity price forecasting methods can be divided into traditional methods and intelligent methods. The main idea of traditional methods is to take time series as the basis of modeling, such as in the auto-regressive method, auto-regressive moving average method, multiple linear regression method and so on [8,9,10,11,12]. The advantages of these models are simple models and high speed of operation, but the prediction accuracy of the data with nonlinear relationship is not high. Intelligent methods mainly include the neural network, support vector machine, random forest, etc. [13,14,15]. Deep learning is also one of the popular intelligent prediction methods, such as long short-term memory (LSTM) and gated recurrent unit (GRU) [16,17,18,19,20]. Among intelligent methods, the neural network has a strong nonlinear function fitting ability. The main reason is that the method collects abstract features between massive data in the form of multi-layer nonlinear mapping, which is of positive significance to obtain accurate electricity price forecasting results.
The research of artificial neural network technology began in the 1940s. After decades of research, its theory has become quite mature. It has been widely used in various engineering fields, such as prediction, pattern recognition and image processing, control and optimization, prediction and intelligent information management, communication, space science and so on [21,22,23,24,25]. The BP neutral network is one of the most widely used models in electricity price forecasting. Various types of neural networks, such as convolutional neural networks, wavelet neural networks and adaptive neural networks, have been used to forecast electricity prices with good results [26,27]. Long and short-term memory neural networks are often used to solve the very random and sequential electricity price prediction problem due to their unique memory function [18].
The BP neural network has been improved in both network theory and performance. Its outstanding advantage is that it has a strong nonlinear mapping ability and flexible network structure. The number of middle layers and the number of neurons in each layer of the network can be set arbitrarily according to the specific situation and its performance varies with the difference in the structure. However, the BP neural network also has some defects: the learning speed is slow, so even a simple problem generally needs hundreds or even thousands of learning to converge; it is easy to fall into local minimum; there is no corresponding theoretical guidance for the selection of the number of network layers and neurons; there is limited network promotion capacity [28,29,30]. For the above problems, there have been many improvement measures and the most researched issue is how to accelerate the convergence speed of the network and avoid falling into local extremum as much as possible. Many studies have overcome the above shortcomings by combining some optimization methods, such as genetic algorithm, improved LM algorithm, principal component analysis (PCA), Markov chain, etc., in order to improve the convergence performance of the network and improve the stability and predictive ability of the model [31,32,33,34].
Particle swarm optimization (PSO) is a bionic stochastic global optimization method based on swarm intelligence. It has many advantages, such as simple process, few parameters and easy implementation. It is widely used in various optimization problems [35]. However, the original PSO algorithm has obvious disadvantages. One is that the convergence speed is slow in the later stage. If the inertia coefficient is large at this time, the particles do not accurately converge to the optimal solution. The other is the “premature” phenomenon, that is, in the early stage, the particles quickly approach the local optimal value and finally converge to the local optimal value [36,37]. Therefore, this paper uses the linearly decreasing inertia coefficient and the simulated annealing algorithm (SA) to improve the PSO algorithm, obtaining the SAPSO algorithm, so as to overcome the above shortcomings of the PSO algorithm.
The structure of the BP network model is mainly composed of three parts, namely, the input layer, the hidden layer and the output layer, which are associated to weights, thresholds and mapping functions. The current research shows that, in the design of the BP network, the choice of network structure depends on human factors; further, not every time the results are satisfactory and there are many parameters to be estimated, which makes it prone to over-fitting problems, so that the generalization ability of the model is poor [38]. In addition, the neural network for electricity price forecasting also needs to be based on a large number of test data and the analysis of the influencing factors is difficult, so it is difficult to determine the input characteristics. Based on this, this paper uses the maximum information number and Pearson coefficient to analyze the main factors affecting the electricity price and uses the improved particle swarm optimization algorithm to optimize the weights and thresholds of the three-layer BP network, as well as establishing the electricity price forecasting model of the SAPSO-BP network, which is calculated by case data and compared with the traditional BP network and PSO-BP network, in order to find a more accurate electricity price forecasting method.

2. Feature Selection

There are many factors affecting the price of electricity, including some random factors that are difficult to determine and quantify. The holistic approach is obviously impractical. According to the analysis of actual data, it is necessary to conduct a correlation analysis for the factors that may affect the price of electricity and select the main influencing factors as the input factors of neural network prediction. The following factors were taken into consideration:
  • Market supply and demand index (SDI). System load demand generally has a direct impact on the price of electricity; usually, the greater the electricity consumption, the higher the price of electricity. At the same time, the electricity supplied by the system also affects the price of electricity. Generally, the more the maximum available capacity of the system is, the lower the price of electricity is. Therefore, it’s not reasonable to think about demand and supply alone, but to put them together and use SDI as the impact factor. The specific calculation formula is as follows:
    P S D I t = D t S m a x t × 100 %
    In the formula, D(t) is the maximum load in the forecast period t and Smax(t) is the maximum available capacity of the period t;
  • Previous system marginal electricity price (SMP). Because the bidding mode in the system does not change greatly in a short time, the previous SMP can be used as a strong influence factor in the short-term electricity price forecast;
  • The installed capacity ratio, that is, the proportion of the installed capacity of the power plant in the total system capacity; generally speaking, the larger the proportion, the greater the influence of the power generation company on the quotation;
  • System reserve demand and reactive power demand are also one of the factors that affect the system electricity price.
In this paper, the maximum information coefficient (MIC) and Pearson correlation coefficient are used to comprehensively evaluate the influence of various factors on electricity price fluctuation.
The Pearson coefficient is used to measure the linear correlation between two variables and its value is between −1 and 1. Greater than 0 means positive correlation and less than 0 means negative correlation. The calculation method is the quotient of covariance and standard deviation of two variables and the formula is as follows:
r = i = 1 n X i X ¯ Y i Y ¯ i = 1 n ( X i X ¯ ) 2 i = 1 n ( Y i Y ¯ ) 2 .
The MIC is a kind of excellent data correlation calculation used to measure the degree of linear or nonlinear correlation between two variables and is of high accuracy. The idea of the MIC is to draw two random variables into a scatter graph and then divide them with small squares continuously to calculate the probability of falling on each square, so as to estimate the joint probability density distribution. The calculation formula is as follows:
M I C x , y = m a x X Y < B I X , Y l o g 2 m i n X , Y ,
I X , Y = X , Y p X , Y l o g 2 p X , Y p X p Y .
In the formulas, X and Y represent the number of cells divided on the x and y axes and P X , Y is the joint probability between the two variables.
The dataset contains 50 samples and each sample contains values of supply and demand index, previous SMP, system reserve rate, installed capacity and actual electricity value [39]. The previous SMP and the actual electricity price are between 0.1 and 0.6. The supply and demand index, system reserve rate and installed capacity are all in the form of ratios and their values are between 0 and 1.
First, we calculated the MIC value and Pearson coefficient between the above four factors and the actual electricity price for all samples, with X = [x1, x2, …, xi], i = 50, being the influencing factor of 50 samples and Y = [y1, y2, …, yi], i = 50, being the electricity price of 50 samples. The calculation results are shown in Table 1. According to the calculation results in Table 1, it can be seen that the MIC and Pearson coefficient values of SDI and previous SMP, are high, indicating that they are the main factors affecting the electricity price. The Pearson coefficient values of system reserve rate and installed capacity ratio are low but the MIC values are not, indicating that the linear correlation between them and electricity price is weak, but the nonlinear correlation is strong.
Combined with the above analysis of the related influencing factors of electricity price, four factors, such as supply and demand index, previous SMP, system reserve rate and installed capacity ratio, were selected as the input factors for the prediction of electricity price by the neural network.

3. Methods

3.1. Improved Particle Swarm Optimization Algorithm

3.1.1. SAPSO Algorithm

The prototype of the particle swarm optimization algorithm is extracted from the model of bird group. At the beginning, each bird in the group has a flying speed and direction and each bird should strive to keep flying in the population space without colliding with each other. When a bird finds food, it leaves the population and flies to the food. Then, other birds move closer to it and eventually fly to the food. Finally, all birds land where the food is. Figure 1 is a schematic diagram of particle motion.
The mathematical description of the particle swarm optimization algorithm is to randomly generate a specified number of particles, take the optimal value experienced by each particle in the iterative process as its own individual extreme value and record its position as pi. The optimal value of all particles is taken as the global extreme value and its position is recorded as pg. In each iteration, the particles update the position and velocity information of each particle by tracking the above two extreme values according to Equations (5) and (6).
v i k + 1 = w v i k + c 1 r 1 p i x i k + c 2 r 2 p g x i k ,
x i k + 1 = x i k + v i k + 1 .
In the formulas, v is the velocity of the particle, x is the position of the particle, i is the number of the particle, pi is the individual extreme value, pg is the global extreme value, k is the number of iterations, c1 and c2 are learning factors, w is the inertia weight and r1 and r2 are random numbers between 0 and 1.
Aiming at the shortcomings of the particle swarm algorithm, that is, it easily matures early and the later convergence speed is too slow, SAPSO is obtained by improving the simulated annealing algorithm (SA). Inspired by the cooling process of solid annealing, the idea of the SA algorithm is that it reaches an equilibrium state at each temperature in the cooling process and can reach a minimum at room temperature. In the process of searching for the optimal solution, the acceptance rule of inferior solution at each temperature of SA is used to make it possible for each individual extreme value to be accepted and the sudden jump probability of replacing the current optimal solution can be given to reasonably prevent falling into the local extreme value.
After accepting the inferior solution, the updating formula of particle velocity becomes as follows:
v i k + 1 = w v i k + c 1 r 1 p i x i k + c 2 r 2 p g x i k .
In the formula, pg′ is the replacement value of the global extreme value pg selected from pi.
According to the rules of SA, pi is a special solution worse than pg and the better-quality pi should be given the higher probability of replacement. At temperature T, the sudden jump probability of pi relative to pg can be calculated as follows:
e f p i f p g / T / i = 1 M e f p i f p g / T ,
where f represents the fitness value and M is the population size.

3.1.2. Function Testing

Using the same initial population, simulation experiments were carried out to compare the performance of the improved particle swarm optimization algorithm and the basic particle swarm optimization algorithm. The mean and standard deviation were used to analyze the experimental results. The mean and standard deviation are methods to analyze the experimental data which can eliminate the random error and compare the experimental results under the same other conditions.
Different test functions were used to test the improved particle swarm optimization algorithm and the basic particle swarm optimization algorithm and the performance of the algorithm was analyzed by comparing the mean and standard deviation.
In order to test the optimization effect of SAPSO algorithm, three commonly used test functions were selected to test SAPSO. The expression, decision variable constraints and optimal solution of the function are as follows:
  • Sphere function:
    f 1 x = i = 1 n x i 2 5.12 x i 5.12 ,
    min f 1 x = f 1 0 , 0 , , 0 = 0 ;
  • Rastrigin function:
    f 2 x = i = 1 n x i 2 10 cos 2 π x i + 10 5.12 x i 5.12 ,
    min f 2 x = f 2 0 , 0 , , 0 = 0 ;
  • Ackley function:
    f 4 x = 20 exp 0.2 1 n i = 1 n x i 2 exp 1 n i = 1 n cos 2 π x i + 20 + e 8 x i 8 ,
    min f 4 x = f 2 0 , 0 , , 0 = 0 .
Different test functions were used to test PSO and SAPSO. Considering the influence of random factors of the algorithm, the two algorithms ran 20 times each when using each test function. The dimension of the test function is unified as 10 dimensions, the number of particles is 100 and the maximum number of iterations is 200. The optimization results are shown in the Table 2.
It can be seen, from Table 1, that the calculation results of SAPSO on the test functions f1~f3 are better than those of PSO. For the function f1, both PSO and SAPSO can converge to the optimal value quickly. For function f3, PSO cannot converge to the global optimal value, while SAPSO can obtain better optimization results quickly.
Figure 2 shows the convergence curves of PSO and SAPSO in solving the sphere, Rastrigrin and Ackley functions. It can be seen, from the figure, that SAPSO has a good solution effect, effectively improves the early convergence problem, improves the convergence speed and greatly improves the optimization ability compared with PSO.

3.2. BP Neutral Network Optimization Based on SAPSO

In 1985, Rumelhart and McClelland proposed the BP neural network. After decades of development, the BP neural network has been widely recognized by the academic community and has shown its skills in various fields, such as information, medicine, psychology, engineering, control, transportation and so on. The learning process of the BP network is consistent with the cognitive process law in the human learning process. It goes through the following three links to simulate the human brain: the first step is to use neural network to absorb knowledge from the outside through the learning process; in the second step, internal neurons store the acquired knowledge; the third step is to use the acquired knowledge for migration to solve similar problems encountered next time. The above three links are cyclic and interrelated, forming a complete organic advanced intelligent system.
The model shown in Figure 3 is a BP network with one hidden layer. The BP network is the learning process of the error back propagation algorithm, which is divided into two stages, namely, forward propagation and back propagation. In forward propagation, information is transferred from the input layer to the middle layer (the middle layer can be designed as a single hidden layer or multiple hidden layers), is processed by the middle layer and then transferred to the output layer to complete the forward propagation process of one learning. When the actual output is inconsistent with the expected output, it enters the back propagation stage of error. The error passes through the output layer, modifies the weight of each layer in the way of error gradient descent and transmits it back to the hidden layer and the input layer one by one. The characteristic function of a neuron node is S-type function, as shown in Equation (12):
f x = 1 1 e x .
Aiming at the shortcomings of the BP neural network, we used the intelligent optimization algorithm to optimize the initial weights and thresholds of the BP network before training, thus greatly shortening the training time of the BP network and avoiding the algorithm from falling into the local optimum to a certain extent. The SAPSO algorithm can overcome the shortcomings of the PSO algorithm and optimize the BP network. It can more quickly and effectively optimize the weight and threshold of the network, so that the model has higher stability and accuracy. In the SAPSO algorithm, the value of each element of particle vector X i = X i 1 , X i 2 , , X i d represents the weight or threshold value of the neurons in the BP neutral network, where d is the number of ownership and threshold value in the BP neutral network. The fitness function of the particle in the particle swarm optimization algorithm is calculated as follows:
I i = j = 1 S ( Y i , j y i , j ) 2 ,
f = 1 n i = 1 n I i .
In the formula, n is the number of samples, S is the number of particles, Yi,j represents the jth actual value of the ith sample and yi,j represents the jth calculated value of the ith sample.
The steps of the SAPSO algorithm to optimize the BP network are as follows:
  • Initialize the BP neural network parameters, including network structure, number of neurons at each layer and transmission function. Set particle swarm parameters, including population size, particle dimension, maximum number of iterations, inertia weight and learning factor;
  • Initialize the population position and speed. The initial position of particles is randomly set within the value range of weight and threshold of the BP network;
  • Calculate the fitness value of each particle. The particle position is assigned to the neural network as the weights and thresholds, the model is used to calculate the sample prediction error of the training set and the particle fitness value is calculated according to Formula (14);
  • Determine individual and global extrema. The initial individual extremum is the adaptive value of each particle, the best one of which is called the global extremum.
  • The optimal position of each individual is given a jump probability, which is calculated according to Equation (8). According to the probability, an individual optimal position is randomly selected to replace the global optimal position in the speed update formula;
  • Judge whether the maximum number of iterations has been reached. If so, proceed to step 7. Otherwise, anneal, update the speed and position of the particles and then go to step 3 to continue the cycle;
  • The optimal position of particles is taken as the initial weights and thresholds of the BP neural network;
  • Train the BP network and output results.
The algorithm flow chart is pictured in Figure 4 below.

4. Results

Considering the neural network activation function is sensitive to the data between −1 and 1, all sample data were normalized before network training to reduce training time and improve training effect. The electricity price, supply and demand index, previous SMP, system reserve rate and installed capacity were normalized according to Equation (15).
X = X min X max X min X .
In the formula, X′ is the normalized input variable and max(X) and min(X) are the maximum and minimum values of the variable to be normalized, respectively.

4.1. Algorithm Parameter Setting

The parameter selection of the intelligent algorithm has a great impact on the accuracy and stability of the prediction results. Through many simulation experiments, the parameters of the SAPSO-optimized BP network algorithm were set as follows: learning factor c1 = 1.5, c2 = 1.5; particle position limit xmax = 10 and xmin = −10; speed limit vmax = 5 and vmin = −5; cooling rate q = 0.998. The number of particles was 250 and the maximum number of iterations was 200. The PSO-optimized BP network adopts the same parameters as above to ensure the comparability of the experiment.
The structure setting of the BP network also has a certain impact on the prediction effect. The neural network structure includes input layers, hidden layers and output layers. The network was established by the function newff. Due to the small number of input variables and samples, the network structure did not need to be too complicated; then, the number of hidden layers of the BP network was selected as 1. Here, we used Matlab R2017a and the version number of Neural Network Toolbox used was Version 10.0. The transfer functions of hidden and output layer were Tansig and purelin, respectively, and the training function of back propagation was trainlm, all of which were set by default, with faster speed and higher accuracy. Tansig is a tangent siomoid transfer function and the input value can take any value and the output value is between −1 and +1; purelin is a linear transfer function and the input and output values can be arbitrary. By changing the number of hidden layer neurons to 3, 9 and 15 respectively, we established nine models—BP-3N, BP-9N, BP-15N, PSO-BP-3N, PSO-BP-9N, PSO-BP-15N, SAPSO-BP-3N, SAPSO-BP-9N and SAPSO-BP-15N—to predict the sample data, compare the results, explore the prediction effect of the improved algorithm and observe the impact of the number of hidden layer neurons on the prediction results.
When forecasting electricity prices, we used the first 25 samples of the dataset as the training set and the last 25 samples as the test set. The predictive network input variable is xij, where i = 1, 2, …, 25, j = 1, 2, …, 4, representing the four electricity price influencing factors in the 25 samples, while the output variables are yi, i = 1, 2, …, 25, representing the predicted electricity value of the 25 samples.

4.2. Evaluating Indicator

In order to verify the accuracy and feasibility of the electricity price prediction model proposed in this paper, the mean absolute percentage error (MAPE) and root mean square error (RMSE) were used as the quantitative criteria for the prediction accuracy evaluation and their expressions are as follows:
MAPE = 1 n t = 1 n Y t Y × t Y t × 100 % ,
RMSE = 1 n t = 1 n ( Y t Y × t ) 2 .
In the formula, n is the number of predicted data, Y(t) is the actual value of the electricity price at the predicted time and Y × (t) represents the predicted electricity value at the predicted time.

4.3. Results Analysis

Sample data were collected according to the four impact factors identified above and the data in Table 3-1,2 in Reference [39] were used for training and test. The nine models, BP-3N, BP-9N, BP-15N, PSO-BP-3N, PSO-BP-9N, PSO-BP-15N, SAPSO-BP-3N, SAPSO-BP-9N and SAPSO-BP-15N, were trained with the training set data and then they were tested with the testing set data. Table 3, Table 4 and Table 5 show the predicted value and error calculation results of electricity price for testing set. It can be seen that, no matter how many neurons in the hidden layer of the neural network, the prediction effect of SAPSO-BP is better than that of PSO-BP and the electricity price prediction effect of the BP network is the worst. Although individual samples have large error values, generally speaking, the predicted electricity price of SAPSO-BP is the closest to the real electricity price and the prediction error is the smallest.
Figure 5 shows the comparison between the predicted electricity price and the real electricity price of the nine models for the testing set. The trend of the electricity price curve is consistent with the data in the table, which can show that the SAPSO-BP model has higher accuracy. The longitudinal comparison in Figure 5 shows that the prediction effect order, from good to bad, is SAPSO-BP, PSO-BP and BP. The horizontal comparison in Figure 5 shows that the number of neurons in the hidden layer has little effect on the prediction results. The overall prediction accuracy of the SAPSO-BP method is relatively high and most of the sample prediction errors were less than 5%, but the prediction accuracy of the first, 11th and 17th samples was very poor, exceeding 20%, or even as high as 60%. This should not be a problem with the network model, because the sample training accuracy can meet the preset requirements. The problem may come from the data themselves and there are two possibilities. First, the training sample data contain noise and abnormal samples, which causes the network to fall into a wrong mode in order to correct the above defects during training, causing the illusion that the training accuracy meets the requirements but the network mode is wrong, which leads to large errors in the prediction results. Second, there are noise and abnormal samples in the test sample data, which leads to large errors in the prediction results. In view of the above problems, methods such as wavelet analysis and rough set theory can be used in advance to correct the sample data to eliminate inherent noise and anomalies and improve the accuracy of prediction.
Table 6 shows the calculated values of the evaluation indexes of each model for the testing set. The mean absolute percentage errors of the BP model with hidden layer neurons of 3, 6 and 9 were 32.89%, 27.90% and 38.00%, respectively, and the root mean square errors were 0.0858, 0.0885 and 0.0902, respectively. The mean absolute percentage errors of the PSO-BP model with hidden layer neurons of 3, 6 and 9 were 28.29%, 21.83% and 17.06%, respectively, and the root mean square errors were 0.0688, 0.0780 and 0.0733, respectively. The average absolute percentage errors of the SAPSO-BP model with hidden layer neurons of 3, 6 and 9 were 9.03%, 7.63% and 9.71%, respectively, and the root mean square errors were 0.0639, 0.0548 and 0.0577, respectively. According to the evaluation index, the results of the SAPSO-BP model are obviously better than those of the PSO-BP and BP model. The number of hidden neurons has little effect on the results. For the SAPSO-BP model, when the number of hidden neurons is 9, the prediction result is slightly better than the other two cases.
Figure 6 shows the regression curve of predicted electricity price and actual electricity price of the nine models for the testing set. The R value represents the correlation between the predicted value and the actual value, which can explain the fitting degree between the network output value and the actual value. The closer the R value is to 1, the better the model fitting, but it may also be over fitting. It can be seen, from the figure, that the fitting degree of SAPSO-BP model is the best and the R value is very close to 1. The R value of BP-15N is also close to 1. However, according to the predicted electricity price data, the prediction result is not good, which may be due to too many hidden layer neurons and over fitting. Therefore, the selection of the neural network model should be suitable, not based on the assumption that the more complex the model, the better.
Figure 7 shows the comparison of convergence curves of different algorithms. By comparing the convergence process between SAPSO-BP and PSO-BP, it can be seen that PSO-BP, apparently, incurred convergence stagnation several times, while SAPSO-BP improved the phenomenon by which the PSO algorithm is prone to local convergence stagnation by optimizing the PSO algorithm. In addition, the SAPSO-BP algorithm converged around 80 generations, while PSO-BP converged to the optimal value around 100 times. Therefore, the SAPSO algorithm-optimized BP neutral network has better convergence effect and faster convergence speed.

5. Conclusions

In view of the randomness of electricity price in the electricity market environment and the low accuracy of traditional BP neutral network electricity price prediction, this paper proposes a short-term electricity price prediction model based on the SAPSO-BP neutral network and draws the following conclusions:
(1)
The electricity price has great randomness and uncertainty and there are many factors affecting electricity price fluctuation. By analyzing the main factors affecting electricity price, MIC and Pearson correlation analysis were used to determine the supply and demand indexes, early system marginal electricity price, system reserve rate and installed capacity as the input factors of the electricity price prediction model.
(2)
The combination of the SA algorithm can enhance the ability of PSO to jump out of the local optimal value and avoid the occurrence of the premature phenomenon. The linearly increased inertia weight was used to improve the disadvantage of the decline of the later convergence speed of PSO and to improve the convergence speed of the algorithm. The results show that the improved algorithm has better performance.
(3)
The BP neural network was optimized by the improved particle swarm optimization algorithm and the SAPSO-BP electricity price prediction model was established to improve the accuracy of BP network electricity price prediction. According to the number of hidden layer neurons of networks, nine models, namely, BP-3N, BP-9N, BP-15N, PSO-BP-3N, PSO-BP-9N, PSO-BP-15N, SAPSO-BP-3N, SAPSO-BP-9N and SAPSO-BP-15N, were established to compare the prediction results of the BP, PSO-BP and SAPSO-BP algorithms, respectively, under different network structures. From the evaluation indexes and prediction comparison diagrams, the SAPSO-BP model has high efficiency and accuracy in electricity price prediction, while the number of neurons in the hidden layer has little effect on the prediction results, but it is easy to over fit if there are too many neurons.

Author Contributions

Conceptualization, M.Y. and W.X.; methodology, M.Y.; software, M.Y.; validation, L.M.; formal analysis, M.Y.; data curation, W.X.; writing—original draft preparation, M.Y.; writing—review and editing, W.X. and L.M.; visualization, M.Y.; supervision, L.M. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the National Natural Science Foundation of China (No. 51979114 and No. 51479075) and the Fundamental Research Funds for the Central Universities (No. 2017KFYXJJ199).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Han, S.H.; Hu, F.H.; Cheng, Z.T. Day ahead market marginal price forecasting based on GCN-LSTM. Chin. J. Electr. Eng. 2021, 8, 1–22. [Google Scholar]
  2. Jia, X.F.; Li, C.B. Research on real-time price forecasting of deep ESN power market considering short-term load. Smart Power 2021, 49, 64–70. [Google Scholar]
  3. Cerjan, M.; Petričić, A.; Delimar, M. HIRA Model for Short-Term Electricity Price Forecasting. Energies 2019, 12, 568. [Google Scholar] [CrossRef] [Green Version]
  4. Chen, Y.Y.; Wang, Y.F.; Ma, J.H.; Jin, Q. BRIM: An Accurate Electricity Spot Price Prediction Scheme-Based Bidirectional Recurrent Neural Network and Integrated Market. Energies 2019, 12, 2241. [Google Scholar] [CrossRef] [Green Version]
  5. Li, Y.C. Electricity price forecasting in power market based on convolutional neural network. Mech. Des. Manuf. Eng. 2021, 50, 101–104. [Google Scholar]
  6. Marin, C.; Marin, M.; Marko, D. Dynamic Hybrid Model for Short-Term Electricity Price Forecasting. Energies 2014, 7, 3304–3318. [Google Scholar] [CrossRef]
  7. Zhou, D.M.; Lai, F.; Liu, Y.A.; Wang, Q.; Liu, Y.G. Load forecasting and price forecasting of power system. Power Syst. Prot. Control 2000, 10, 31–33. [Google Scholar]
  8. Dong, H.Y.; Wang, R.J.; Gu, Y.Q. Life prediction of wind turbine bearing based on Auto-regressive summation moving average model. Syst. Simul. Technol. 2017, 13, 185–189. [Google Scholar]
  9. Zhang, X.M. Theoretical research on forecasting online clearing price modeling based on multiple linear regression algorithm. Guangdong Electr. Power 2006, 9, 1–4. [Google Scholar]
  10. Nogales, F.J.; Contreras, J.; Conejo, A.J.; Espinola, R. Forecasting Next-Day Electricity Prices by Time Series Models. IEEE Trans. Power Syst. 2002, 17, 342–348. [Google Scholar] [CrossRef]
  11. Tan, Z.F.; Zhang, J.L. Day-ahead electricity price forecasting based on multi-factor wavelet analysis and multivariate time series models. Proc. Chin. Soc. Electr. Eng. 2010, 30, 103–110. [Google Scholar]
  12. Zhang, Y.H.; Zhu, G.R.; Cai, Y.Z.; Zhu, Y.Q. Day ahead electricity price forecasting based on Autoregressive integral moving average model. Autom. Technol. Appl. 2020, 39, 125–129, 139. [Google Scholar]
  13. Yang, L.; Wu, Y.L.; Zhang, C.; Liu, C.; Jiang, B.; Zhang, P. Improved least squares support vector algorithm for electrical quantity prediction. Power Grid Clean Energy 2017, 33, 71–76. [Google Scholar]
  14. Wei, Q.; Chen, S.J.; Huang, W.B.; Ma, G.W.; Tao, C.H. Spot market clearing price forecasting method based on Stochastic Forest regression. Chin. J. Electr. Eng. 2021, 41, 1360–1367. [Google Scholar]
  15. Chen, J.Y.; Tao, C.H.; Ma, G.W.; Chen, S.J.; Zhao, Y.L.; Wang, J. Spot market clearing price prediction method based on data mining and support vector machine. Power Grid Clean Energy 2020, 36, 14–19, 27. [Google Scholar]
  16. Zhang, R.; Li, G.; Ma, Z. A Deep Learning based Hybrid Framework for Day-ahead Electricity Price Forecasting. IEEE Access 2020, 99, 1. [Google Scholar] [CrossRef]
  17. Li, W.Y. Research on Electricity Price Forecasting in Power Market Based on Deep Learning. Master’s Thesis, Shandong University of Science and Technology, Shandong, China, 2020. [Google Scholar]
  18. Gou, X.; Xiao, X.Y. Short term electricity price forecasting model based on empirical mode decomposition and LSTM neural network. J. Xi’an Univ. Technol. 2020, 36, 129–134. [Google Scholar]
  19. Liu, D.; Lei, Z.Q.; Sun, K. Short term electricity price forecasting based on wavelet packet decomposition and short-term memory network. Smart Power 2020, 48, 77–83. [Google Scholar]
  20. Dong, Z.K. Short Term Transaction Price Forecasting Based on Deep Learning Algorithm. Master’s Thesis, South China University of Technology, Guangdong, China, 2020. [Google Scholar]
  21. Xu, R.N.; Tao, Z.Q.; Zhang, Z.K. Research on traffic accident prediction model based on artificial neural network. Technol. Econ. Guide 2021, 29, 32–33. [Google Scholar]
  22. Espín-Sarzosa, D.; Palma-Behnke, R.; Valencia, F. Modeling of Small Productive Processes for the Operation of a Microgrid. Energies 2021, 14, 4162. [Google Scholar] [CrossRef]
  23. Pawlik, P.; Kania, K.; Przysucha, B. The Use of Deep Learning Methods in Diagnosing Rotating Machines Operating in Variable Conditions. Energies 2021, 14, 4231. [Google Scholar] [CrossRef]
  24. Stratigakos, A.; Bachoumis, A.; Vita, V.; Zafiropoulos, E. Short-Term Net Load Forecasting with Singular Spectrum Analysis and LSTM Neural Networks. Energies 2021, 14, 4107. [Google Scholar] [CrossRef]
  25. Jumilla-Corral, A.A.; PerezTello, C.; CampbellRamírez, H.E.; MedranoHurtado, Z.Y.; MayorgaOrtiz, P.; Avitia, R.L. Modeling of Harmonic Current in Electrical Grids with Photovoltaic Power Integration Using a Nonlinear Autoregressive with External Input Neural Networks. Energies 2021, 14, 4015. [Google Scholar] [CrossRef]
  26. Guo, X.X. Combined forecasting of short term electricity price based on EEMD and wavelet neural network. J. Chongqing Bus. Univ. 2016, 33, 21–25. [Google Scholar]
  27. Yamin, H.Y.; Shahidehpour, S.M.; Li, Z. Adaptive short-term electricity price forecasting using artificial neural networks in the restructured power markets. Int. J. Electr. Power Energy Syst. 2004, 26, 571–581. [Google Scholar] [CrossRef]
  28. Wang, W.; Feng, J.; Xu, F. Estimating Downward Shortwave Solar Radiation on Clear-Sky Days in Heterogeneous Surface Using LM-BP Neural Network. Energies 2021, 14, 273. [Google Scholar] [CrossRef]
  29. Wan, L.J.; Li, H.Y.; Chen, Y.W.; Li, C.Y. Rolling Bearing Fault Prediction Method Based on QPSO-BP Neural Network and Dempster-Shafer Evidence Theory. Energies 2020, 13, 1094. [Google Scholar] [CrossRef]
  30. Han, W.; Nan, L.B.; Su, M.; Chen, Y.; Li, R.N.; Zhang, X.J. Research on the Prediction Method of Centrifugal Pump Performance Based on a Double Hidden Layer BP Neural Network. Energies 2019, 12, 2709. [Google Scholar] [CrossRef] [Green Version]
  31. Liu, H.L.; Li, T.; Zhang, Q.H. Prediction of Sticking Accident Based on Improved BP neural network based on adaptive genetic algorithm. Mod. Electron. Technol. 2021, 44, 149–153. [Google Scholar]
  32. Shang, F.H.; Li, J.C.; Yuan, Y.; Cao, M.J.; Du, R.S. Stratigraphic division method based on Improved BP neural network. Comput. Technol. Dev. 2020, 30, 148–153. [Google Scholar]
  33. Guo, Y. Research on Clothing Pressure Prediction Based on Improved BP Neural Network. Master’s Thesis, Xi’an University of Science and Technology, Xi’an, China, 2020. [Google Scholar]
  34. Huang, G.Q.; Yang, J.J. Short term electricity price forecasting based on BP neural network and Markov chain. J. Shanghai Electr. Power Univ. 2017, 33, 1–3. [Google Scholar]
  35. Chen, Z.Y.; Rui, X.; Wang, K.Y.; Bin, J. Optimal Energy Management Strategy of a Plug-in Hybrid Electric Vehicle Based on a Particle Swarm Optimization Algorithm. Energies 2015, 8, 3661–3678. [Google Scholar] [CrossRef] [Green Version]
  36. Kiani, A.T.; Nadeem, M.F.; Ahmed, A.; Khan, I.A.; Alkhammash, H.I.; Sajjad, I.A.; Hussain, B. An Improved Particle Swarm Optimization with Chaotic Inertia Weight and Acceleration Coefficients for Optimal Extraction of PV Models Parameters. Energies 2021, 14, 2980. [Google Scholar] [CrossRef]
  37. Wu, T.Z.; Shi, X.; Liao, L.; Zhou, C.J.; Zhou, H.; Su, Y.H. A Capacity Configuration Control Strategy to Alleviate Power Fluctuation of Hybrid Energy Storage System Based on Improved Particle Swarm Optimization. Energies 2019, 12, 642. [Google Scholar] [CrossRef] [Green Version]
  38. Zhang, X.; Wang, X.F. Summary of short term electricity price forecasting. Power Syst. Autom. 2006, 3, 92–101. [Google Scholar]
  39. Ma, C. Study on Short Term Optimal Operation and Bidding Strategy of Cascade Hydropower Stations. Ph.D. Thesis, Tianjin University, Tianjing, China, 2005. [Google Scholar]
Figure 1. Schematic diagram of particle motion.
Figure 1. Schematic diagram of particle motion.
Energies 14 06514 g001
Figure 2. (a) Convergence curves of PSO and SAPSO algorithms for solving the sphere function. (b) Convergence curves of PSO and SAPSO algorithms for solving the Rastrigrin function. (c) Convergence curves of PSO and SAPSO algorithms for solving the Ackley function.
Figure 2. (a) Convergence curves of PSO and SAPSO algorithms for solving the sphere function. (b) Convergence curves of PSO and SAPSO algorithms for solving the Rastrigrin function. (c) Convergence curves of PSO and SAPSO algorithms for solving the Ackley function.
Energies 14 06514 g002
Figure 3. BP neutral network topology.
Figure 3. BP neutral network topology.
Energies 14 06514 g003
Figure 4. SAPSO-BP algorithm flow chart.
Figure 4. SAPSO-BP algorithm flow chart.
Energies 14 06514 g004
Figure 5. Comparison between predicted electricity price and actual electricity price of 9 models.
Figure 5. Comparison between predicted electricity price and actual electricity price of 9 models.
Energies 14 06514 g005
Figure 6. Regression curve of predicted electricity price and actual electricity price of 9 models.
Figure 6. Regression curve of predicted electricity price and actual electricity price of 9 models.
Energies 14 06514 g006
Figure 7. Comparison of convergence curves of the PSO-BP and SAPSO-BP algorithms.
Figure 7. Comparison of convergence curves of the PSO-BP and SAPSO-BP algorithms.
Energies 14 06514 g007
Table 1. Correlation between influencing factors and electricity price.
Table 1. Correlation between influencing factors and electricity price.
Influence FactorsMICPearson
SDI0.68650.664
Previous SMP0.72730.791
System reserve rate0.52570.151
Installed capacity0.51550.151
Table 2. Optimization results of different algorithms.
Table 2. Optimization results of different algorithms.
Test FunctionAlgorithmAverage ValueStandard Deviation
SpherePSO1.44 × 10−88.40 × 109
SAPSO1.10 × 10−92.08 × 10−9
RastrigrinPSO2.38 × 101.78 × 10
SAPSO1.98 × 1002.77 × 10−1
AckleyPSO1.21 × 1002.92 × 101
SAPSO1.30 × 10−81.79 × 10−8
Table 3. Predictive value and error using BP.
Table 3. Predictive value and error using BP.
Actual Electricity Price (CNY)Hidden Layer 3 NeuronsHidden Layer 9 NeuronsHidden Layer 15 Neurons
Predictive Value (CNY)ErrorPredictive Value (CNY)ErrorPredictive Value (CNY)Error
0.370.314 15.24%0.352 4.93%0.227 38.76%
0.1580.295 86.73%0.165 4.51%0.235 48.89%
0.4710.345 26.84%0.466 1.14%0.479 1.60%
0.1870.170 8.87%0.226 21.05%0.135 27.92%
0.1790.295 64.82%0.188 4.95%0.281 57.19%
0.220.290 32.04%0.266 21.00%0.280 27.15%
0.130.148 13.98%0.147 13.11%−0.052 140.21%
0.1480.124 16.26%0.019 87.29%0.183 23.76%
0.3140.294 6.47%0.238 24.24%0.403 28.39%
0.2220.281 26.56%0.000 100.13%0.397 78.88%
0.3620.275 24.15%0.129 64.32%0.327 9.80%
0.1320.010 92.06%0.004 96.85%0.215 63.00%
0.4080.251 38.53%0.262 35.80%0.403 1.28%
0.1420.117 17.33%0.114 19.58%0.132 6.92%
0.3910.426 8.88%0.382 2.37%0.399 2.09%
0.5050.412 18.50%0.410 18.74%0.582 15.21%
0.1970.345 74.92%0.231 17.41%0.289 46.46%
0.1920.285 48.60%0.229 19.48%0.196 2.10%
0.1630.182 11.58%0.209 27.97%0.228 39.67%
0.1440.281 95.20%0.150 4.35%0.108 24.93%
0.1390.181 30.23%0.172 23.60%−0.073152.59%
0.2290.345 50.62%0.309 34.76%0.168 26.71%
0.1330.128 3.57%0.145 8.83%0.079 40.60%
0.140.128 8.60%0.111 20.73%0.109 22.38%
0.3390.344 1.56%0.270 20.28%0.419 23.48%
Table 4. Predictive value and error using PSO-BP.
Table 4. Predictive value and error using PSO-BP.
Actual Electricity Price (CNY)Hidden Layer 3 NeuronsHidden Layer 9 NeuronsHidden Layer 15 Neurons
Predictive Value (CNY)ErrorPredictive Value (CNY)ErrorPredictive Value (CNY)Error
0.370.285 23.09%0.246 33.54%0.237 35.97%
0.1580.214 35.39%0.026 83.33%0.155 1.81%
0.4710.381 19.02%0.469 0.45%0.432 8.19%
0.1870.209 11.92%0.189 1.13%0.190 1.39%
0.1790.231 29.06%0.061 66.18%0.164 8.11%
0.220.267 21.47%0.162 26.53%0.190 13.86%
0.130.199 53.09%0.112 14.09%0.154 18.47%
0.1480.205 38.33%0.153 3.40%0.125 15.39%
0.3140.337 7.37%0.316 0.49%0.344 9.49%
0.2220.242 9.13%0.225 1.31%0.251 13.10%
0.3620.211 41.62%0.104 71.35%0.073 79.72%
0.1320.199 51.09%0.144 9.37%0.132 0.11%
0.4080.235 42.36%0.394 3.35%0.363 10.97%
0.1420.200 40.91%0.167 17.32%0.183 28.70%
0.3910.417 6.66%0.390 0.19%0.388 0.67%
0.5050.483 4.42%0.520 2.96%0.567 12.26%
0.1970.249 26.27%0.314 59.15%0.312 58.53%
0.1920.234 21.90%0.096 49.81%0.132 31.07%
0.1630.201 23.58%0.171 4.90%0.143 12.58%
0.1440.205 42.25%0.050 65.50%0.099 31.10%
0.1390.200 43.59%0.118 15.10%0.160 15.27%
0.2290.247 7.97%0.204 10.95%0.225 1.74%
0.1330.200 50.39%0.136 2.26%0.144 7.91%
0.140.200 43.14%0.138 1.51%0.136 2.65%
0.3390.295 13.13%0.333 1.63%0.314 7.37%
Table 5. Predictive value and error using SAPSO-BP.
Table 5. Predictive value and error using SAPSO-BP.
Actual Electricity Price (CNY)Hidden Layer 3 NeuronsHidden Layer 9 NeuronsHidden Layer 15 Neurons
Predictive Value (CNY)ErrorPredictive Value (CNY)ErrorPredictive Value (CNY)Error
0.370.259 29.91%0.250 32.54%0.247 33.22%
0.1580.152 3.66%0.156 1.38%0.165 4.12%
0.4710.474 0.54%0.470 0.29%0.452 4.06%
0.1870.183 1.97%0.189 0.86%0.188 0.46%
0.1790.176 1.78%0.177 0.95%0.183 2.46%
0.220.200 8.96%0.223 1.44%0.216 1.62%
0.130.137 5.28%0.133 2.31%0.139 6.61%
0.1480.143 3.22%0.143 3.34%0.140 5.55%
0.3140.310 1.42%0.318 1.19%0.320 1.80%
0.2220.207 6.56%0.219 1.23%0.235 6.05%
0.3620.089 75.35%0.147 59.33%0.138 61.82%
0.1320.137 3.76%0.131 1.13%0.121 8.02%
0.4080.380 6.85%0.396 2.90%0.376 7.94%
0.1420.142 0.05%0.147 3.35%0.159 12.25%
0.3910.396 1.31%0.390 0.31%0.389 0.45%
0.5050.507 0.44%0.523 3.53%0.534 5.75%
0.1970.314 59.31%0.314 59.44%0.318 61.60%
0.1920.193 0.71%0.187 2.38%0.190 0.94%
0.1630.160 1.78%0.164 0.89%0.159 2.51%
0.1440.138 4.21%0.136 5.51%0.134 7.10%
0.1390.141 1.25%0.143 2.57%0.145 4.23%
0.2290.225 1.60%0.224 2.27%0.228 0.55%
0.1330.137 3.03%0.132 0.56%0.131 1.52%
0.140.140 0.28%0.139 0.88%0.138 1.56%
0.3390.348 2.53%0.338 0.26%0.337 0.54%
Table 6. MAPE and RMSE of 9 models.
Table 6. MAPE and RMSE of 9 models.
MethodsBPPSO-BPSAPSO-BP
Number of Neurons in the Hidden Layer391539153915
MAPE (%)32.8927.9038.0028.2921.8317.069.037.639.71
RMSE0.08580.08850.09020.06880.07800.07330.06390.05480.0577
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Yi, M.; Xie, W.; Mo, L. Short-Term Electricity Price Forecasting Based on BP Neural Network Optimized by SAPSO. Energies 2021, 14, 6514. https://doi.org/10.3390/en14206514

AMA Style

Yi M, Xie W, Mo L. Short-Term Electricity Price Forecasting Based on BP Neural Network Optimized by SAPSO. Energies. 2021; 14(20):6514. https://doi.org/10.3390/en14206514

Chicago/Turabian Style

Yi, Min, Wei Xie, and Li Mo. 2021. "Short-Term Electricity Price Forecasting Based on BP Neural Network Optimized by SAPSO" Energies 14, no. 20: 6514. https://doi.org/10.3390/en14206514

APA Style

Yi, M., Xie, W., & Mo, L. (2021). Short-Term Electricity Price Forecasting Based on BP Neural Network Optimized by SAPSO. Energies, 14(20), 6514. https://doi.org/10.3390/en14206514

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop