Based on Deep Learning Model and Flink Streaming Computing Short Term Photovoltaic Power Generation Prediction for Suburban Distribution Network

Hongtao Li1, Zijin Li1, Chen Wang1, Lei Xia2, Huilei Tan2 and Kai Li2,*

1State Grid Beijing Electric Power Company, Beijing, China
2Tsinghua University, Beijing, China
E-mail: Kaili2163@yeah.net
*Corresponding Author

Received 17 March 2024; Accepted 11 July 2024

Abstract

With the advancement of global energy internet construction, accurate prediction of new energy generation power such as photovoltaic is an important foundation for ensuring the safety and economic working of new power systems. A short-term photovoltaic power generation prediction method for suburban distribution networks based on deep learning model fusion and Flink flow calculation is proposed to address the challenges of complex power grids, diversified disturbance factors, and isolated monitoring points. This method uses Bi directional Long Short Term Memory(BiLSTM) to extract cross sequential nonlinear characteristic of photovoltaic power generation time series data. Compared with standard LSTM, BiLSTM can consider both historical and future information simultaneously, thus extracting richer extracted features from power generation time series data. This method also integrates attention mechanism to capture the importance distribution of historical temporal features for power generation prediction, effectively solving the problem of long-term temporal dependence in standard LSTM models. The Flink streaming computing framework embeds a trained BiLSTM-Attention photovoltaic power generation prediction model, enabling real-time prediction and monitoring analysis of photovoltaic power generation at various monitoring points in the suburban distribution network. This article uses a dataset of a suburban photovoltaic power station for validation, and trains the model with historical power generation data, meteorological factors, weather types, seasons, and other information as inputs. The BiLSTM-Attention fusion model studys the temporal characteristics of power generation, and has high accuracy in predicting short-term photovoltaic power generation in different scenarios. The Flink streaming computing platform can not only process high throughput predicted power data, but also has low time delay.

Keywords: Load forecasting, deep learning, BiLSTM, attention mechanism, Flink.

1 Introduction

Against the backdrop of rapid development of smart grids and distributed new energy grid connected power generation, photovoltaic power generation is growing at a relatively fast pace year by year [14]. However, due to the influence of environmental factors such as weather and season on photovoltaic power generation technology, the output power exhibits real-time changes and random fluctuations, and large-scale photovoltaic power grid integration will bring huge impacts to the power grid [59]. Therefore, conducting short-term forecasting research on photovoltaic power generation and guiding photovoltaic grid connection scheduling is of great significance for maintaining stable operation of the power grid.

As a popular research topic, photovoltaic power prediction has gone through three main stages of development: firstly, classic statistical analysis methods, including linear regression LR model, Holt Winters, etc. The model is easy to derive and has strong interpretability, but poor generalization; The second is simple machine learning methods, including logistic regression [10], gradient lifting regression tree [11], etc. The model accuracy is improved and the degree of freedom is high, but it relies on expert experience; The third is the highly anticipated deep learning methods, including Long Short Term Memory (LSTM) [12, 13], Convolutional Neural Networks (CNN) [14], etc. The model does not rely on feature engineering and can automatically mine complex association information from time-series data of power generation, but still faces problems such as high data demand and poor interpretability.

Deep learning methods have been extensively studied in short-term photovoltaic power generation prediction, mainly represented by sequence models such as RNN [15], LSTM [16], wavelet transform-support vector machine [17], etc. These sequence models have the ability to mine deeper data features, resulting in more accurate results. There are still two key issues with this method: on the one hand, there is a problem of long-term dependence on historical data, lacking the ability to predict current data using previously learned feature data, resulting in less accurate prediction results. On the other hand, the existing research generated photovoltaic power generation prediction models have lag in practical applications, and the data collected from various monitoring points in the suburban distribution network is scattered, making it impossible to conduct real-time photovoltaic power generation prediction and coordinated scheduling for complex regional power grids.

Based on the above analysis, this article proposes a short-term photovoltaic power generation prediction method for suburban distribution networks based on BiLSTM-Attention neural network and Flink flow calculation. The main innovation points are as follows: (1) Introducing BiLSTM [18] to learn the characteristics of photovoltaic power generation data in suburban distribution networks, and BiLSTM introduces the idea of reverse transmission on the basis of LSTM [19]. By obtaining contextual information, BiLSTM can achieve better feature expression results, thereby improving prediction accuracy. (2) Introducing an attention mechanism [20] to achieve weight allocation helps to discover important features in data and greatly improves the accuracy of prediction results. (3) Using the Flink streaming computing framework to build a real-time prediction and monitoring platform for photovoltaic power generation, and embeds the trained BiLSTM Attention model. It can monitor the real-time prediction results of photovoltaic power generation at various monitoring points in the suburban distribution network. Compared with Spark [21] and Storm [22], Flink has high throughput, low latency, and a comprehensive fault-tolerant mechanism [23, 24].

This article uses a dataset of a suburban photovoltaic power station for validation, and trains the model with historical power generation data, meteorological factors, weather types, seasons, and other information as inputs. The BiLSTM Attention fusion model has higher prediction accuracy in different weather and seasons, and the Flink platform has higher throughput while achieving low time delay, thus achieving real-time surveying and analysis of the predicted results data of photovoltaic power generation in suburban distribution networks.

2 Real Time Prediction Technology for Short-term Photovoltaic Power Generation in Suburban Distribution Networks Based on BiLSTM Attention and Flink

2.1 A Short Term Photovoltaic Power Generation Prediction Model Integrating BiLSTM and Attention

The short-term photovoltaic power generation prediction model based on BiLSTM-Attention is shown in Figure 1:

(1) Input layer: used to convert numerical variables of historical power generation and weather data, as well as discrete variables of weather type and season, into inputs for the backbone network.

(2) Backbone network: Firstly, use the BiLSTM neural network to learn the nonlinear characteristics of data in the input layer Then, the importance of different input feature vectors for short-term prediction is analyzed through the Attention mechanism. Finally, the weighted results of the Attention mechanism are obtained.

(3) Output layer: Its function is to output short-term prediction data of photovoltaic power generation.

images

Figure 1 Prediction model based on BiLSTM attention.

2.1.1 Data preprocessing

The data flow of the prediction model is shown in Figure 2, which preprocesses historical power generation, meteorological factors, weather types, seasons, and other data as input to the model. The prediction result is photovoltaic power generation. The meteorological factor data mainly includes solar radiation intensity, temperature, humidity, wind speed, etc. The data preprocessing process mainly includes normalization and denormalization of data, as well as dataset generation based on sliding windows.

images

Figure 2 Data flow of prediction model based on BiLSTM attention.

Raw data may lead to inaccurate predictions, the original power data is normalized, and the processed data results are distributed in the [0,1] range:

xnorm=x-xminxmax-xmin (1)

In the equation, xnorm represents the normalized value, x represents the data to be normalized, xmin represents the minimum value in the data, and xmax represents the maximum value in the data. This article uses One-Hot encoding to convert classification variables into numerical values. For instance, the One-Hot encoding V in spring during the season can be expressed as: V = [1, 0, 0, 0].

The model needs to convert temporal data into supervised data for short-term photovoltaic power generation prediction, and a dataset needs to be generated based on a sliding window, as shown in Figure 3 The power data variables of the first N moments are used to predict the power data of the next moment, and a large number of data combinations are obtained through sliding windows to generate a dataset, thereby supporting the training and testing of models.

images

Figure 3 Schematic diagram of sliding window.

2.1.2 Construction of BiLSTM neural network

BiLSTM introduces the concept of backpropagation on the standard LSTM model and adds two hidden layers with opposite directions. By obtaining contextual information, BiLSTM can achieve better feature extraction results.

As shown in Figure 4, it is mainly composed of memory cells (Cells), input gates, forget gates, and output gates. Cells are responsible for storing historical information left in neurons, input gates are responsible for determining which input data Cells will accept, forget gates are responsible for controlling how much historical data in Cells will be lost, and output gates are responsible for outputting data. LSTM achieves its special memory function through these three gates, making the model to learn temporal data features that are correlated and continuous before and after learning.

images

Figure 4 LSTM internal structure of neurons.

Due to the fact that the LSTM algorithm mentioned above only considers the features of historical information in the feature extraction process, without considering the impact of future information on feature extraction of sequence data. This paper takes into account the data features of future information and uses the BiLSTM algorithm for power feature extraction. The model is shown in Figure 5.

images

Figure 5 BiLSTM neural network model.

The network of the BiLSTM model consists of an input layer, a forward and reverse LSTM network, and an output layer. The output is the eigenvector of the forward generation power sequence, represented by Hp; The eigenvector of the reverse generation power sequence, represented by Hn; Finally, add the two outputs one by one to obtain the eigenvectors of the power generation sequence:

H=Hp+Hn (2)

2.1.3 Establishment of attention neural network

The output layer of the BiLSTM network consists of 801 time steps, with 128 neurons per time step. Each time step has different weights in power prediction. The Attention mechanism calculates the weights of each time step separately, and then emphasizes and highlights the role of time steps with high weights in the data information of transmission power prediction. The Attention layer takes the Bi-LSTM output layer as the processing object, and uses the power prediction vector output in the 801st time step as the benchmark to calculate and normalize the attention weights for each time step. The calculation formulas are shown in (3) and (4).

sti=vtanh(WhT+Uhi+b) (3)
ati=exp(sti)j=iTxexp(stj) (4)

In the formula, hT represents the state value of the last time step, and W,U,b and v represent the learnable network parameters. Sti is the attention weight of the previous time step based on the value of the last time step state, and ati is the normalized weight.

The 128 neurons hi in each time step are multiplied by their own attention weight ati, and then the 801 neurons in each time step are matched and merged to obtain the feature vector C. The calculation formula is shown in formula (5).

C=i=1Txatihi (5)

Finally, the output of the Attention layer is the feature vector C of 128 neurons. It aggregates the weights of each time step as the final output feature vector, which is passed to the fully connected layer.

2.2 Parallel Real-time Prediction and Monitoring Platform for Suburban Distribution Network Based on Flink

2.2.1 Flink framework structure

Flink can be used in highly flexible time window based scenarios, equipped with a fault-tolerant mechanism based on lightweight distributed snapshots. Compared to other streaming computing frameworks, Flink has advantages such as high throughput and low latency.

images

Figure 6 Flink framework structure.

As shown in Figure 6, When Flink runs, the Flink client optimizes the stream data job into a JobGraph topology and uploads it to the job manager JobManager. JobManager assigns the job to the task manager TaskManager for analysis and calculation. Each TaskManager has at least one Slot, which runs the specific job task as the minimum resource allocation unit, and each calculation is synchronously recorded in the State, State plays an important role in Flink fault-tolerant recovery and iterative computation. Flink has high throughput, high error tolerance, and low latency performance, which can continuously and stably handle concurrent data traffic. It is very suitable for parallel real-time prediction and monitoring of short-term photovoltaic power generation at detection points in suburban distribution networks.

2.2.2 Construction of Flink parallel real-time prediction and monitoring platform

As shown in Figure 7, this article constructs a parallel real-time prediction and monitoring platform for suburban distribution network monitoring points based on Flink flow computing, and embeds the trained BiLSTM-Attention prediction model.

images

Figure 7 Parallel real-time prediction and monitoring platform for monitoring points in suburban distribution networks.

This article constructs a power generation prediction calculation cluster based on the Flink streaming computing framework. JobManager manages computing resources, receives upstream power generation data streams, and distributes them to relevant work nodes for handling and computing. TaskManager is a work node that receives task scheduling from JobManager, executes corresponding computational processing tasks, and uses the trained BiLSTM-Attention model to predict and detect photovoltaic power generation data.

3 Example Analysis

3.1 Data Acquisition

This article selects a suburban photovoltaic power station for simulation and prediction, verifies the accuracy of the prediction mechanism based on BiLSTM-Attention, and tests the reliability of the prediction system. The research period is from March to October 2019. The sensors collect meteorological data such as solar radiation intensity, temperature, humidity, and wind speed every two minutes. The average values are recorded in the meteorological database at 30 minute intervals. Train the prediction model using all data in the meteorological database except for the test day as the training set, and select March 9th (light rain, 4.3–12.6C), May 4th (cloudy, 6.5–27.4C), and October 21st (sunny, 12–30.3C) as the test days for validation.

3.2 Model Training and Results

3.2.1 Parameter settings

The specific parameter settings for the prediction model of BiLSTM-Attention are shown in Table 1.

Table 1 Model parameters

Parameter Numerical Value
Total number of samples 4500
Training batch 64
Iterations 600
Time step 801
Learning rate 0.05
Loss rate 0.4

The training process of the BiLSTM-Attention prediction model is shown in Figure 8. As the number of iterations continues to increase, the training loss of the BiLSTM-Attention network model goes on decrease, while the accuracy of power generation prediction keeps on raising. When the training number reaches 600, the accuracy is close to 100%.

images

Figure 8 Training process of BiLSTM-Attention fusion model.

3.2.2 Verification of BiLSTM-attention model and analysis of experimental results

This article uses the evaluation indicators of average absolute error (eMAE) and average absolute percentage error (eMAE) to evaluate the experimental prediction results. The calculation method is as follows.

{eMAE=1ni=1n|Pi-P^i|eMAPE=1ni=1n|Pi-P^ip¯i| (6)

In the formula: Pi is the actual power value; P^i is the predicted power value; P¯i is the average value of the predicted daily actual power.

The experiment used the trained BiLSTM-Attention model to test the 2020 load dataset and compared it with the optimized LSTM-Attention neural network, LSTM neural network, and CNN model. Each model uses the same power generation and meteorological, weather, and seasonal data for prediction. Figure 9 shows the comparison of different algorithm models under four different weather conditions. The horizontal axis in the figure represents the time scale, and the vertical axis represents the photovoltaic output power. The data predicted by the BiLSTM Attention model is most consistent with the measured data.

images

Figure 9 Comparison between predicted data and measured data of different algorithm models.

Table 2 Comparison of prediction error and accuracy in different seasons

Spring Summer Autumn Winter Seasonal Average
y¯MAE/ y¯MAPE/ y¯MAE/ y¯MAPE/ y¯MAE/ y¯MAPE/ y¯MAE/ y¯MAPE/ y¯MAE/ y¯MAPE/
Model KW % KW % KW % KW % KW /%
BiLSTM-Attention 2.94 2.41 2.89 2.31 2.68 2.14 2.92 2.48 2.86 2.34
LSTM-Attention 3.55 3.39 3.71 3.45 3.84 3.49 3.76 3.58 3.72 3.48
LSTM 4.81 4.85 4.69 4.53 4.75 4.79 4.71 4.71 4.74 4.72
CNN 4.04 4.17 4.15 4.36 4.33 4.46 4.21 4.29 4.18 3.87

The comparison of prediction errors and accuracy between different algorithms is shown in Table 2. From Table 2, it can be seen that the prediction accuracy of the BiLSTM-Attention model in all four seasons is better than the other three models, with the smallest prediction error. The average value of the four season error predicted by the BiLSTM-Attention model y¯MAE reached 2.86 KW, which y¯MAPE is 2.34%. The method proposed in this article has significantly improved both in terms of error and accuracy indicators.

3.3 Performance Analysis of Flink Parallel Real Time Prediction and Monitoring Platform

This article sets up two environments, Flink single machine and cluster. The Flink framework cluster environment sets up one main node and two work nodes, and compares throughput and time delay data, respectively. Taking the average of the experimental results, Figure 10 shows a comparison of throughput. It can be seen that the throughput of the cluster environment is much better than that of the single machine environment. After running for 5 seconds, the performance reaches nearly twice that of the single machine environment. Figure 11 shows the comparison of time delays. Both the standalone and clustered environments reached a stable state after 6 seconds, with a stable time delay of 150 milliseconds for the clustered environment and 210 milliseconds for the standalone environment. From the experimental results, it can be seen that the cluster environment is more suitable for real-time parallel processing of larger data flows in regional power grids.

images

Figure 10 Throughput comparison chart.

images

Figure 11 Time delay comparison chart.

4 Summarize

This article proposes a method based on BiLSTM Attention neural network and Flink flow calculation to achieve short-term prediction of photovoltaic power generation in suburban distribution networks. Through comparative experiments, the BiLSTM-Attention model in this article has strong learning ability for temporal features of power generation, and has high prediction accuracy in different weather and seasons. The prediction and monitoring platform based on Flink performs well in indicators such as throughput and time delay. In the future, based on the platform, we can consider the distributed coordination and scheduling of photovoltaic power generation in the suburban distribution network structure, ensuring stable power supply while improving the economic efficiency of power grid operation.

Funding Statement

This research was supported by the project “Key Technology and Demonstration of Urban-Suburban New Distribution Network Collaborative Planning and Operation Based on Hierarchical Autonomy and Regional Mutual Aid” (Project No.: 5400-202211 507A-3-0-SF).

References

[1] Ghadimi N, Akbarimajd A, Shayeghi H, et al. Two stage forecast engine with feature selection technique and improved meta-heuristic algorithm for electricity load forecasting[J]. Energy, 2018(161): 130–142.

[2] Rodríguez F, Fleetwood A, Galarza A, et al. Predicting solar energy generation through artificial neural networks using weather forecasts for microgrid control[J]. Renewable Energy, 2018(126): 855–864.

[3] Wang Yufei, Fu Yuchao, Xue Hua. DMCS-WNN prediction method of photovoltaic power generation by considering solar radiation and chaotic feature extraction[J]. Proceedings of the CSEE, 2019, 39(S1): 63–71.

[4] Dou J, LIU Z, Xiong W, et al. Research on Multi-level Cooperative Detection of Power Grid Dispatching Fault Based on Artificial Intelligence Technology[J]. Distributed Generation and Alternative Energy Journal, 2021. DOI: 10.13052/dgaej2156-3306.3545.

[5] Youssef A, El-Telbany M, Zekry A. The role of artificial intelligence in photo-voltaic systems design and control: a review[J]. Renewable and Sustainable Energy Reviews, 2017(78): 72–79.

[6] Qiao Ying, Sun Rongfu, Ding Ran, et al. Distributed photovoltaic station cluster short-term power forecasting part II: gridding prediction[J]. Power System Technology, 2021, 45(6): 2210–2218.

[7] Yang Jingxian, Zhang Shuai, Liu Jichun, et al. Short-term photovoltaic power prediction based on variational mode decomposition and long short-term memory with dual-stage attention mechanism[J]. Automation of Electric Power Systems, 2021, 45(3): 174–182.

[8] Qin J, Zhu X, Wang Z, et al. Substation Decision-making Platform Based on Artificial Intelligence[J]. Distributed Generation and Alternative Energy Journal, 2021. DOI: 10.13052/dgaej2156-3306.3524.

[9] Zheng Y, Xue X. Simulation of Wind-solar Complementary Distribution Power Generation System Based on PSCAD[J]. Distributed Generation and Alternative Energy Journal, 2021. DOI: 10.13052/dgaej2156-3306.3523.

[10] Li Jianhong, Chen Guoping, Ge Pengjiang, et al. Output power forecasting of PV generation system based on similar day theory[J]. East China Electric Power, 2012, 40(1): 153–157.

[11] Zhao Kangning, Pu Tianjiao, Wang Xinying, et al. Probabilistic orecasting for photovoltaic power based on improved Bayesian neural network[J]. Power System Technology, 2019, 43(12): 4377–4386.

[12] Zhu Linjian, Xun Zihan, Wang Yuxin, et al. Short-term Power Load Forecasting Based on CNN-BiLSTM[J]. Power System Technology, 2021, 45(11): 4532–4539.

[13] Abdel-Nasser M, Mahmoud K. Accurate photovoltaic power forecasting models using deep LSTM-RNN[J]. Neural Computing and Applications, 2019, 31(7): 2727–2740.

[14] Meng Anbo, Xu Xuancong, Chen Jiaming, et al. Ultra short term photovoltaic power prediction based on reinforcement learning and Combined deep learning model[J]. Power System Technology, 2021, 45(12):4721–4728.

[15] Chen Changsong, Duan Shanxu, Yin Jinjun. Design of photovoltaic array power forecasting model based on neutral network[J]. Transactions of China Electrotechnical Society, 2009, 24(9): 153–158.

[16] Methaprayoon K, Lee W J, Rasmiddatta S, et al. Multistage artificial neural network short-term load forecasting engine with front-end weather forecast[J]. IEEE Transactions on Industry Applications, 2007, 43(6): 1410–1416.

[17] Liu Y Q, Shi J, Yang Y P, et al. Short-term wind-power prediction based on wavelet transform-support vector machine and statisticcharacteristics analysis[J]. IEEE Transactions on Industry Applications, 2012, 48(4): 1136–1141.

[18] Lea Colin, Flynn M D, Vidal R, et al. Temporal convolutional networks for action segmentation and detection[C]//30th IEEE Conference on Computer Vision and Pattern Recognition. Honolulu, USA, 2017: 1003–1012.

[19] Krizhevsky A, Sutskever I, Hinton G. ImageNet classification with deep convolutional neural networks[C]// NIPS’12 Proceedings of the 25th International Conference on Neural Information Processing Systems, December 3–6, 2012, Nevada, USA: 1097–1105.

[20] Vaswani A, Shazeer N, Parmar N, et al. Attention Is All You Need[J]. arXiv, 2017.

[21] Alnafessah A, Casale G. A Neural-Network Driven Methodology for Anomaly Detection in Apache Spark[C]// 11th International Conference on the Quality of Information and Communications Technology. 2018.

[22] Karunaratne P, Karunasekera S, Harwood A. Distributed stream clustering using micro-clusters on Apache Storm[J]. Journal of Parallel & Distributed Computing, 2017, 108(Oct.): 74–84.

[23] Carbone Paris, Ewen Stephan, Fóra Gyula, et al. State management in Apache Flink®: consistent stateful distributed stream processing[J]. Proceedings of the VLDB Endowment, 2017, 10(12): 1718–1729.

[24] Pasan Karunaratne, Shanika Karunasekera, AARON Harwood. Distributed stream clustering using micro-clusters on Apache Storm[J]. Journal of Parallel and Distributed Computing, 2016, 108: 74–84.

Biographies

images

Hongtao Li received the bachelor’s degree in electrical engineering from Tianjin University in 1997 and the master’s degree in electrical engineering from North China Electric Power University in 2005, respectively. He is currently working as a professor of engineering at State Grid Beijing Electric Power Company. His research areas include smart grid distribution system and New Electric Power System.

images

Zijin Li received the bachelor’s degree in renewable energy North China Electric Power University in 2011 and 2014. She is currently working as a senior engineer at State Grid Beijing Electric Power Company. Her research areas include hybrid ac/dc distribution network and microgrid.

images

Chen Wang was born in Beijing, China, in 1994. He received the B.S. and M.S. degree in electrical engineering from China Agricultural University, Beijing, China, in 2017 and 2021. His main research interests include hybrid ac/dc distribution network, renewable energy generation, and active distribution networks.

images

Lei Xia received the bachelor’s degree in engineering from Nantong University in 2015. He is currently an employee of the Energy IoT Application Technology Research Center at the Wuxi Institute of Technology Application at Tsinghua University. His research areas include electrical status monitoring and alarm in the petrochemical industry.

images

Huilei Tan received the master’s degree in control theory and control engineering from Jiangsu University, China, in 2017. He is currently engaged in research at Wuxi Research Institute of Tsinghua University. His research areas include image processing, pattern recognition.

images

Kai Li received the Master degree from Jiangnan University, Wuxi, China, in 2015. In 2022, he joined Wuxi Research Institute of Applied Technologies Tsinghua University, Wuxi, China. He Mainly engages in research on power grid planning and development of power grid big data applications.

Abstract

1 Introduction

2 Real Time Prediction Technology for Short-term Photovoltaic Power Generation in Suburban Distribution Networks Based on BiLSTM Attention and Flink

2.1 A Short Term Photovoltaic Power Generation Prediction Model Integrating BiLSTM and Attention

images

2.1.1 Data preprocessing

images

images

2.1.2 Construction of BiLSTM neural network

images

images

2.1.3 Establishment of attention neural network

2.2 Parallel Real-time Prediction and Monitoring Platform for Suburban Distribution Network Based on Flink

2.2.1 Flink framework structure

images

2.2.2 Construction of Flink parallel real-time prediction and monitoring platform

images

3 Example Analysis

3.1 Data Acquisition

3.2 Model Training and Results

3.2.1 Parameter settings

images

3.2.2 Verification of BiLSTM-attention model and analysis of experimental results

images

3.3 Performance Analysis of Flink Parallel Real Time Prediction and Monitoring Platform

images

images

4 Summarize

Funding Statement

References

Biographies