Analysis and Forecasting of the Primary Energy Consumption in Poland Using Deep Learning

Consumption of fossil energy resources were increased dramatically, due to the economic and population growth. In turn, the consumption of fossil resources causes depletion of resources and contributes to environmental pollution. The European Union's "climate neutrality" initiative requires effective energy management from the member states. By this is meant a resource-efficient and competitive economy in which there is no greenhouse gas emission and where economic growth is decoupled from resource consumption. The article analyzes the level of primary energy consumption in Poland. It was examined whether a 23% drop in energy consumption could be achieved in 2030 compared to the base year and according with energy efficiency assumptions. A methodology for forecasting primary energy consumption based on deep neural networks, in particular on Long Short Term Memory (LSTM) algorithms was also presented.


Introduction
The large scale consumption of energy resources not only reflects the rapid growth of economic and population, but also contributes to the environmental pollution [1,2]. Effective implementation of pollution prevention and energy efficiency initiatives are often supported by an effective energy management, which must identify and forecast energy consumption to correctly identify the relationship between energy consumption, environmental and climate degradation, and optimize existing systems and resources towards sustainable development. Therefore, it is obvious that energy consumption forecasting is the fundamental of energy sector's management. The document "The European Green Deal" [3] approved by the member states of the European Union sets out the objectives that Europe must achieve by 2050 regarding climate neutrality [4,5,6,7]. It is a new strategy for transforming the EU into a fair and prosperous society, with a modern, resource-efficient and competitive economy that has no net greenhouse gas emissions and where economic growth is decoupled from resource use [3]. The European Commission in the Clean Planet for All strategy, a European long-term strategic vision for a prosperous, modern, competitive and climate neutral economy (COM (2018) 773) [8] has identified how it wants to achieve climate neutrality. The priority is to further reduce the emission of the energy system and increase the share of renewable energy sources while simultaneously withdrawing from coal at a rapid pace. By 2030, the EU puts an emphasis on developing energy efficiency. These are requirements for buildings, household appliances, electronics and lighting, but also for the transport sector. The strategy assumes the popularization of electric and hybrid vehicles so that the demand for crude oil is expected to remain at the level of 2019. In addition, the national energy system is to be strongly modernized, increasing the efficiency of energy production (PEP2040) [9]. All these activities are to reduce primary energy demand. The goal for Poland is to achieve savings of 23% of primary energy and 21.5% of final energy in 2030 relative to the base -2007.
Poland consumes approximately 4,400 PJ of primary energy, with the majority being hard coal and crude oil, next natural gas, lignite and renewable sources [10]. Figure 1 shows the current and future primary energy consumption in Poland according to various scenarios [11,12].
In the ARE scenario and the reference GreenPeace, demand for primary energy will increase until 2030, with additional demand being met by renewable energy, nuclear energy and gas. This will lead to diversification of the mix and reduction of the relative role of coal in it. The GreenPeace alternative scenario assumes a decrease in primary energy demand. In comparison to the reference scenario, primary energy consumption in 2030 will be lower by 27%. Despite this, energy needs will be fully balanced -there is no problem of energy shortage on the market or lowering the standard of living of the inhabitants or productivity of the economy. The most important effect of implementing the alternative scenario is reducing the economy's dependence on conventional fuels, including oil imports. The place of fossil fuels is taken by renewable energy sources, with significant shares of wind, biomass and solar energy. A significant increase in the share of renewable energy is possible by to the improvement of equipment efficiency and reduction of technology costs. This mainly applies to solar farms and wind energy.
The purpose of this article is to develop a predictive model of primary energy consumption using deep learning methods, which will answer the question, will Poland manage to achieve the assumed level of energy efficiency? The measure of this level will be the analysis of the trend in the development of primary energy consumption until 2040 and the determination of the level of demand in 2030. It should be noted that the demand for primary energy is a derivative of the demand Submission date: 02-12-2019 | Review date: 06-01-2020 for final energy. Thus, all changes in the final energy structure and reduction of energy transmission losses are visible in future primary energy demand. Therefore, it was decided to build a model based on the history of the phenomenon and taking into account the population and GDP.

Methodology and Data
There are no methods in the world and domestic literature for forecasting of the total amount the consumption of primary energy. There are only studies on forecasting the consumption of each energy resources . In these studies, conventional models and models based on artificial intelligence were used to forecast consumption [13]. Conventional models are divided into time series models (mainly ARMA, ARIMA, SARIMA) and regression models [14,15,16]. Models based on artificial intelligence are grouped into artificial neural network models and machine learning models [17, 18,19]. Review results show that conventional models are preferred for short-term energy consumption forecasts. Among them, non-linear regression models can describe the relationship between consumption data and influencing factors. Artificial intelligence based models have the ability to adapt in all areas and forecasting horizons [13].
In artificial intelligence literature, deep learning models have been identified among machine learning methods [20]. These methods are distinguished from typical neural networks by a greater number of neurons in the layer, by more complex methods of connecting layers in the network and by automatic extraction of functions. The algorithms most commonly used to predict time series during deep learning are recurrent neural network (RNN), long short-term memory (LSTM) and gated recurrent unit (GRU). LSTM networks have three very important aspects that distinguish them from other recursive networks. When designing the network, it is necessary to decide which input data will be entered into the neuron, whether to remember the results of the calculations made in the previous step and when the input data will be forwarded to the next time stamp, as shown in Figure 2.
The functions shown in Figure 2 are defined as follows [21]: where: xt−1 and xt are the previous and current input values, respectively; ht−1and ht are the 193 previous and current hidden gates, respectively; Ct−1 andCt are the previous and current cell states, 194 respectively; wf, wi, wc, and wo are the weight values connecting the input to each gate; bf, bi, bc, 195 and bo are the bias values for each gate's calculation; σ is a sigmoid function; and tanh is a 196 hyperbolic tangent function. In addition, these networks cope well with long-term relationships. This article presents the LSTM networks to predict primary energy consumption. The input data to the model concern primary energy consumption, population and GDP [22,23], as shown in Figure 3.
The population between 1995 and 2018 has decreased from 38.60 to 37.80 million. The average annual decrease is at the level of 3%. Gross domestic product has increased over the years 1995-2018 very rapidly, by about 400%, while primary energy consumption has increased very moderately from 95.3 Mtoe in 1995 to 105, 2 Mtoe in 2018.
In this paper is adopted two widely used performance metrics: mean absolute error (MAE), root mean square er- where: y i identifies the actual value for sample i; y i identifies the predicted value for sample i; n is the testing data

Results
The first model was proposed as shown in figure 4 and it is designed from the input -LSTM, the hidden -dropout to the output -dense layer. The input layer this is historical data connected with the consumption primary energy. The output layer this is prediction.
The second model was proposed as shown in figure  5 and it is designed from the input layers -LSTM, hiden -dropout to the output -dense layer. The input layer this is historical data connected with the consumption primary energy, GDP and population. The output layer this is prediction.
The data was divided the learning data into 70% and training data into 30%. Table 1 summarizes the simulation parameters used in this study. The results have obtained from model 1 and model 2 are similar. The structure of model no. 2 includes explanatory variables that also need to be forecasted. This significantly affects the residuals of the model. In the first model based only on the history of the phenomenon, the errors are 1%. It means that the model has adapted to the real flow in a high level. The advantage of this model is that the forecast is generated only on the historical of the primary energy consumption. In the second model, the errors are 2%. Increasing of the errors is due to forecasting of explanatory variables, however, fitting of the model is also high. Explaining variables have been predicted by regression models. Figure 7 shows the forecast of primary energy consumption.
Poland's primary energy consumption has predicted by two models, and the results are shown in figure 7. In the This data has been added in the model no 2, as a explanatory variables. The model has presented slower growth of primary energy consumption, and after year 2025 the decreasing this consumption. Reducing energy consumption is a priority in the EU. Actions to improve energy efficiency are not only as a methods of ensuring sustainable energy supplies, reducing greenhouse gas emissions, increasing security of supply and reducing expenditure on energy imports, but also promotion of EU competitiveness. The national target for improving energy efficiency is 23% in the 2030 and it is calculated in relation to primary energy from 2007. In absolute terms, it amounts to 91.3 Mtoe in 2030. In the developed models, the value of primary energy is 105 Mtoe and 103 Mtoe and is higher than the assumptions by 12% and 11%.

Discussion and Conclusions
The policy of the European Union is focused on environmental protection. An expression of these trends is newly adopted "European Green Deal", which assume climate neutrality until 2050. To achieve this goal, European Union members have already taken various initiatives. One of these initiatives is reduction of primary energy consumption and increase energy efficiency. The article analyses whether Poland will manage to achieve a 23% reduction of primary energy consumption compared to 2007. This reduction would be the result of an increase in energy efficiency. To analyse the problem, two models have built for forecasting primary energy consumption based on artificial neural networks with the LSTM algorithm. The first model was built only on the history of the phenomenon, while in the second one added explanatory variables: population and GDP. A review of the literature in chapter 2 and model fit metrics in chapter 3 confirm the effectiveness of neural networks to predict time series. The forecasts presented in the article show a decrease in primary energy consumption by about 1.5% after 2025. However, this decrease is insufficient to achieve a reduction of primary energy consumption by 23% compared to the base year in 2030.