Using the LSTM Network to Forecast the Demand for Electricity in Poland

: The impact of environmental regulations introduced by the European Union is of key importance for electricity generation systems. The Polish fuel structure of electricity production is based on solid fuels. Moreover, the generating base is outdated and must gradually be withdrawn from the power system. In this context, Poland’s energy policy is undergoing a transformation as climate and environmental regulations are becoming increasingly stringent for the energy sector based on solid fuels (hard coal and lignite). However, the transformation process must be adapted to market demands, because the overriding goal is to ensure energy security by maintaining the continuity of energy supplies and an acceptable electricity price. This directly contributes to the development of the entire economy and the standard of living of the society, in accordance with the European Agreement establishing an association between the Republic of Poland and the European Communities and their Member States, signed on 16 December 1991, and the European Energy Charter, signed on 17 December 1991. Ensuring energy security is the most important goal of the energy policy. Therefore, energy companies must forecast the demand. The main goal of this article is to develop a mathematical model of electricity consumption by 2040 by all sectors of the economy: industry, transport, residential, commercial and public services, agriculture, forestry, and ﬁshing. In order to achieve the intended goal, a model was developed by using Long Short-Term Memory (LSTM) artiﬁcial neural networks, which belong to deep learning techniques and reﬂect long-term relationships in time series for a small set of statistical data. The results show that the proposed model can signiﬁcantly improve the accuracy of forecasts (1–3% of mean absolute percentage error (MAPE) for the analyzed sectors of the economy).


Introduction
Poland's energy policy is based on two strategic documents, namely The Strategy for Responsible Development Until 2020-with Prospects Until 2030, adopted in 2017, and Poland's Energy Policy, which is currently being updated (PEP2040) [1]. The main goal of energy policy is the energy security while ensuring the competitiveness of the economy, energy efficiency, and reducing the impact of the energy sector on the environment, as well as the optimal use of our own energy resources [2][3][4]. A number of activities are underway to ensure the stability and continuity of electricity production. One example may be the introduction of the capacity market, which will guarantee financing of maintaining additional capacity in times of an increased demand and peak periods (winter-summer) as well as the protection of unstable energy sources (RES). This mechanism will contribute to the stability of the entire energy system. Additionally, measures are being taken to support the development of high-efficiency cogeneration and renewable energy sources, as well as the implementation of nuclear energy after 2033.

Energy Security
Twelve countries dominate the production of electricity in the European Union countries, which together produce 88% of all electricity produced in the European Union. Figure 1 shows the energy production of these twelve Member States in the years 1990-2018. The largest producers of electricity among the member states are Germany and France, their share is as much as 37% of the total production in the European Union (EU). It is followed by Great Britain, Italy, and Spain, whose production volumes are 18%. These member states produce just over 65% of the total energy of the entire European Union. Next are Poland and Sweden, whose share in total energy production in the EU is 5%. Other countries, such as: the Netherlands, Belgium, the Czech Republic, Finland, and Austria together produce just over 13%.
The European Union member states are diversified among themselves in the context of energy raw materials used for the production of electricity and the restrictive requirements for the reduction of greenhouse gas emissions and the increase in the required level of renewable sources are becoming a challenge for economies that use fossil fuels to a large extent in the raw material structure, including Poland. Figure 1. Electricity production volume in selected EU countries in the years 1990-2018, thousand GWh, source: own study based on data [13].

Poland's Energy Policy
The energy policy in Poland is conditioned by the requirements of the climate and energy policy of the European Union. In 2009, a regulatory package was adopted, setting out three basic targets for counteracting climate change by 2020 ( In 2014, the European Council maintained the rigorous direction of combating climate change and approved four more goals in the perspective, up to 2030, for the entire EU, which were defined as follows [14]: − reduction of greenhouse gas emissions by 40% compared to 1990 emissions (in terms of 2005 levels, i.e., a decrease of 43% in the EU ETS sectors and a decrease of 30% in non-ETS), − at least 32% share of renewable sources in gross final energy consumption, − increase in energy efficiency by 32.5%, − completing the internal EU energy market.
The set environmental goals require significant financial outlays for the modernization of the energy infrastructure, which will bring effects only in the long-term horizon; hence, the process of changes is carried out in several stages. However, investment decisions are not linked to any longterm action plan.
To achieve the emission reduction target at an international level in 2030, two separate targets have been set for sectors: EU ETS (−43% compared to 2005) and non-ETS (−30% compared to until 2005). The amounts of non-ETS emissions are determined at the level of the European Union member

Poland's Energy Policy
The energy policy in Poland is conditioned by the requirements of the climate and energy policy of the European Union. In 2009, a regulatory package was adopted, setting out three basic targets for counteracting climate change by 2020 (3 × 20% package) [1]: − increasing energy efficiency by saving primary energy consumption by 13.6 Mtoe in 2010-2020 compared to the forecast of demand for fuels and energy from 2007, − increasing the share of energy from Renewable Energy Sources (RES) in gross final energy consumption to 15% by 2020, − contributing to the EU-wide reduction of greenhouse gas emissions by 20% (compared to 1990) by 2020 (in 2005 levels: −21% in the EU Emissions Trading System (EU ETS) sectors and −10% in the non-ETS).
In 2014, the European Council maintained the rigorous direction of combating climate change and approved four more goals in the perspective, up to 2030, for the entire EU, which were defined as follows [14]: − reduction of greenhouse gas emissions by 40% compared to 1990 emissions (in terms of 2005 levels, i.e., a decrease of 43% in the EU ETS sectors and a decrease of 30% in non-ETS), − at least 32% share of renewable sources in gross final energy consumption, − increase in energy efficiency by 32.5%, − completing the internal EU energy market.
The set environmental goals require significant financial outlays for the modernization of the energy infrastructure, which will bring effects only in the long-term horizon; hence, the process of changes is carried out in several stages. However, investment decisions are not linked to any long-term action plan.
To achieve the emission reduction target at an international level in 2030, two separate targets have been set for sectors: EU ETS (−43% compared to 2005) and non-ETS (−30% compared to until 2005).
The amounts of non-ETS emissions are determined at the level of the European Union member states on the basis of the new regulation, i.e., Regulation of the European Parliament and of the Council No. 2018/842 (the so-called ESR Regulation), according to which Poland is obliged to reduce greenhouse gas emissions from sectors non-ETS by 2030 by 7% compared to the level in 2005, which is presented in Figure 2.  Figure 2. On the other hand, with regard to the industrial sectors belonging to the EU ETS, the most important are the emission limits and operating rules established for the EU ETS. Emissions from the EU ETS are accounted for at the enterprise level, which means that enterprises have to surrender an appropriate number of allowances to cover their own emissions. The energy and climate package also sets national limits on greenhouse gas emissions for the non-ETS sector, which includes agriculture, transport, construction, waste, and industrial emissions outside the ETS. As non-ETS deals with domestic emissions, reporting and accounting for annual emissions in non-ETS rests with the government administration. The remaining elements of the package, i.e., the use of renewable energy sources, biofuels, and the implementation of Carbon Capture and Storage (CCS) technologies, show the way to achieve the assumed goals of reducing greenhouse gas emissions.
According to the data on monitoring the implementation of climate goals in the EU countries, most countries by 2020 have made satisfactory progress in achieving the assumed goals. The energy transformation requires significant and long-term investments. They are primarily required for the modernization and reconstruction of the coal energy infrastructure. The pace of these changes varies across the member states, as it is determined by the financial capabilities of member states with different levels of economic development. Against the background of European guidelines and environmental goals, the development of Poland's energy policy will be focused in the near future at the stabilization of the energy system with the existing hard coal and lignite resources at a constant level, which determine the security of supply, with a focus on increasing the use of renewable sources to meet energy demand. The regulations contained in the new EU energy policy will have an impact on energy companies in Poland.
The legal basis for the development and implementation of Poland's energy policy is the Act of April 10, 1997-the Energy Law, which defines the principles of shaping the state's energy policies as well as rules and conditions for the supply and use of fuels and energy, including heat, and the operation of energy enterprises. This act also determines the competent authorities in matters of fuel and energy management. The purpose of the act is to create conditions for the sustainable development of the country, ensuring energy security, economical and rational use of fuels and On the other hand, with regard to the industrial sectors belonging to the EU ETS, the most important are the emission limits and operating rules established for the EU ETS. Emissions from the EU ETS are accounted for at the enterprise level, which means that enterprises have to surrender an appropriate number of allowances to cover their own emissions. The energy and climate package also sets national limits on greenhouse gas emissions for the non-ETS sector, which includes agriculture, transport, construction, waste, and industrial emissions outside the ETS. As non-ETS deals with domestic emissions, reporting and accounting for annual emissions in non-ETS rests with the government administration. The remaining elements of the package, i.e., the use of renewable energy sources, biofuels, and the implementation of Carbon Capture and Storage (CCS) technologies, show the way to achieve the assumed goals of reducing greenhouse gas emissions.
According to the data on monitoring the implementation of climate goals in the EU countries, most countries by 2020 have made satisfactory progress in achieving the assumed goals. The energy transformation requires significant and long-term investments. They are primarily required for the modernization and reconstruction of the coal energy infrastructure. The pace of these changes varies across the member states, as it is determined by the financial capabilities of member states with different levels of economic development. Against the background of European guidelines and environmental goals, the development of Poland's energy policy will be focused in the near future at the stabilization of the energy system with the existing hard coal and lignite resources at a constant level, which determine the security of supply, with a focus on increasing the use of renewable sources to meet energy demand. The regulations contained in the new EU energy policy will have an impact on energy companies in Poland.
The legal basis for the development and implementation of Poland's energy policy is the Act of April 10, 1997-the Energy Law, which defines the principles of shaping the state's energy policies as well as rules and conditions for the supply and use of fuels and energy, including heat, and the operation of energy enterprises. This act also determines the competent authorities in matters of fuel and energy management. The purpose of the act is to create conditions for the sustainable development of the country, ensuring energy security, economical and rational use of fuels and energy, development of competition, counteracting the negative effects of natural monopolies, taking into account environmental protection requirements. Improving energy efficiency is one of the priorities of the EU energy policy, with the goal of reducing energy consumption by 20% [16]. Poland has made great progress in this area. Development resulting from the use of new technologies indicates a significant increase in electricity consumption with a relative decline in other forms of energy. Therefore, all possible measures will be taken, which include: − increasing the efficiency of electricity generation through the construction of highly efficient generation units, − a twofold increase in the production of electricity generated in the high-efficiency cogeneration technology by 2020, compared to production in 2006, − reduction of the network loss ratio in transmission and distribution, through inter alia, modernization of the existing networks and construction of new ones, replacement of low-efficiency transformers, and development of distributed generation, − increase in end-use energy efficiency, − increasing the ratio of the annual demand for electricity to the maximum demand for power at peak load, which allows reducing the total cost of meeting the demand for electricity [16].
It is planned to implement measures that will significantly reduce the energy consumption of the Polish economy, and, thus, increase energy security: − setting a national target for increasing energy efficiency, − introducing a systemic support mechanism for activities aimed at achieving the national goal of increasing energy efficiency, − stimulating the development of cogeneration through support mechanisms, including cogeneration from sources below 1 MW, and the appropriate policy of municipalities, − applying mandatory energy performance certificates for buildings and apartments when placing them on the market and renting them, − marking the energy consumption of energy-consuming devices and products and introducing minimum standards for energy-consuming products, − commitment of the public sector to play an exemplary role in the efficient management of energy, − support for investments in the field of energy savings with the use of preferential loans and subsidies from national and European funds, including under the Act on supporting thermo-modernization and renovation, the Operational Program, − infrastructure and environment, regional operational programs, − funds from the National Fund for Environmental Protection and Water Management, − supporting scientific and research works in the field of new solutions and technologies reducing energy consumption in all directions of its processing and use, − the use of Demand Side Management techniques, stimulated by, e.g., daily diversification of distribution fees and electricity prices based on reference prices resulting from market introduction, − the current day and transferring price signals to recipients by means of remote two-way communication with electronic meters [16].
These activities will make it possible to achieve a measurable effect in the form of reducing pollutant emissions in the energy sector and stimulating investments in modern, energy-saving technologies and products, and will contribute to the growth of innovativeness of the Polish economy. Energy saving will have a significant impact on improving the economic efficiency of the economy and its competitiveness.

Electricity Production in Poland
Electricity in Poland is produced by thermal, hydro, and wind power plants. Thermal power plants using hard coal and lignite generate the most energy. In 2019, the total installed electrical capacity was 47.4 GW, of which the share of installed capacity in lignite and hard coal remains at the level of 70%, and renewable energy sources account for over 20%, as shown in Figure 3.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 17 − the current day and transferring price signals to recipients by means of remote two-way communication with electronic meters [16].
These activities will make it possible to achieve a measurable effect in the form of reducing pollutant emissions in the energy sector and stimulating investments in modern, energy-saving technologies and products, and will contribute to the growth of innovativeness of the Polish economy. Energy saving will have a significant impact on improving the economic efficiency of the economy and its competitiveness.

Electricity Production in Poland
Electricity in Poland is produced by thermal, hydro, and wind power plants. Thermal power plants using hard coal and lignite generate the most energy. In 2019, the total installed electrical capacity was 47.4 GW, of which the share of installed capacity in lignite and hard coal remains at the level of 70%, and renewable energy sources account for over 20%, as shown in Figure 3. There has been an increase in the installed electrical capacity compared to 2018, which is the result of completing the construction of two new units in Opole with the capacity of 900 MW each, and 3.5 times more photovoltaic installations have been installed than a year earlier, as shown in Figure 4. There has been an increase in the installed electrical capacity compared to 2018, which is the result of completing the construction of two new units in Opole with the capacity of 900 MW each, and 3.5 times more photovoltaic installations have been installed than a year earlier, as shown in Figure 4.
In 2019, the share of coal in electricity production was 73.6% and it was lower by 4.8% compared to 2018. The changes in electricity production result from an increase in the share of RES (15.4%) and natural gas (8.8%) as well as competitively priced electricity imports (10.6 TWh was imported in 2019) and an increase in production by wind farms. Electricity production in 2019 was the lowest in five years and amounted to 164 TWh. The Polish electricity market is demand-driven, which means that it has to meet the demand for electricity by various sectors of the economy. Unfortunately, most of the existing hard coal-fired power stations are outdated, low-efficiency units. The age structure of boilers and turbine units used in power plants is extremely variable [6,18], 57% of generating units is over 30 years old, of which as much as 9% is over 40 years old, and new generation units-in operation for fewer than 10 years-account for only 10% [6]. In 2019, the share of coal in electricity production was 73.6% and it was lower by 4.8% compared to 2018. The changes in electricity production result from an increase in the share of RES (15.4%) and natural gas (8.8%) as well as competitively priced electricity imports (10.6 TWh was imported in 2019) and an increase in production by wind farms. Electricity production in 2019 was the lowest in five years and amounted to 164 TWh. The Polish electricity market is demand-driven, which means that it has to meet the demand for electricity by various sectors of the economy. Unfortunately, most of the existing hard coal-fired power stations are outdated, low-efficiency units. The age structure of boilers and turbine units used in power plants is extremely variable [6,18], 57% of generating units is over 30 years old, of which as much as 9% is over 40 years old, and new generation units-in operation for fewer than 10 years-account for only 10% [6].

Methods
Most of the research studies forecasting energy demand aim for that enough electricity is produced to meet future needs. A reliable forecasting model is necessary for accurate investment planning of electricity generation and distribution. Fazil Kaytez [19] proposed a hybrid model based on least-square support vector machine and an autoregressive integrated moving average for forecasting electricity demand. The study results indicate that the proposed model can generate more realistic and reliable forecasts. It can also be stated that it responds better to some unexpected reactions in the time series, for example, political decisions that are not a continuation of the adopted strategies. Przemysław Kaszynski and Jacek Kaminski [20] proposed the linear programming approach, which reflected the key relationships between the hard and brown coal mining sector and the power sector in the context of the environmental regulations. On the other hand, in the works [21][22][23][24], artificial neural networks LSTM were used as tools that allow forecasting time series with a small number of statistical data, which is the case in this analysis.

Methods
Most of the research studies forecasting energy demand aim for that enough electricity is produced to meet future needs. A reliable forecasting model is necessary for accurate investment planning of electricity generation and distribution. Fazil Kaytez [19] proposed a hybrid model based on least-square support vector machine and an autoregressive integrated moving average for forecasting electricity demand. The study results indicate that the proposed model can generate more realistic and reliable forecasts. It can also be stated that it responds better to some unexpected reactions in the time series, for example, political decisions that are not a continuation of the adopted strategies. Przemysław Kaszynski and Jacek Kaminski [20] proposed the linear programming approach, which reflected the key relationships between the hard and brown coal mining sector and the power sector in the context of the environmental regulations. On the other hand, in the works [21][22][23][24], artificial neural networks LSTM were used as tools that allow forecasting time series with a small number of statistical data, which is the case in this analysis.
The LSTM network architecture is recursive and is used in deep learning methods. Unlike standard recursive networks, the LSTM network has a feedback loop, which allows it to process not only individual data points, but also entire sequences. Hence, these networks are used for classification, processing, and forecasting based on time series data. In LSTM networks, the network output layer has an influence on the input layer [25,26]. These networks have the ability to learn long-term relationships. They were introduced in the article [27], and then refined and popularized in the works [28,29].
The LSTM network computes the mapping from the input sequence x = (x 1 , ..., x T ) to the output sequence y = (y 1 , ..., y T ) by calculating iteratively from t = 1 to T the network unit activation using the Equations (1)-(6) [26]: where conditions W, U are weight matrices, conditions b denote the polarization vectors (b i is the input gate polarization vector), σ is the activation function, i, f, o, and c are, respectively, input gates, forget gates, output gates, and activation vectors of cells, of which all are the same size as the output cell activation vector, that is the result of the vectors, g and h are functions of input cell and output cell activation.
In this paper, three widely used performance metrics are adopted: mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE), in order to assess the prediction accuracy of the proposed methods [30]: where: y i . identifies the actual value for sample I,ŷ i . identifies the predicted value for sample i; n is the testing data.

Electricity Consumption on the Polish Market
Electricity consumption in Poland is increasing. Between 2010 and 2019, the demand for electricity increased by an average of 1.1%. This rise is a result of an increasing demand by all sectors of the national economy, except for transport and agriculture, as shown in Figure 5.
The service sector is the fastest growing one in the economy. Between 1990 and 2018, the value added doubled in this sector. The value added also increased in industry, although the share of the industry sector in the consumption structure was gradually decreasing due to the increase in energy efficiency. Households' demand for electricity was also increasing. Over the years 1990-2018, the increase was 44% and it was the result of improvement in housing conditions in Poland. The number of people per household was falling whereas household's available income was rising. The demand for passenger and freight transport work was the basic factor influencing the level of demand for energy in the transport sector. The visible decrease in demand is the result of a significant increase in the demand for transport work, performed with the use of individual motorization (passenger cars) and carriers. In the branch system, road transport has the largest share of the demand for cargo transport, the share of which in the transport work amounts to 573 billion tkm in 2019. In the agriculture, forestry, and fishing sector, direct consumption is approx. 167 PJ, including 61% of liquid fuels, 33% of solid fuels, 3% of electricity, 2% of gaseous fuels, and less than 1% of heat [32]. The service sector is the fastest growing one in the economy. Between 1990 and 2018, the value added doubled in this sector. The value added also increased in industry, although the share of the industry sector in the consumption structure was gradually decreasing due to the increase in energy efficiency. Households' demand for electricity was also increasing. Over the years 1990-2018, the increase was 44% and it was the result of improvement in housing conditions in Poland. The number of people per household was falling whereas household's available income was rising. The demand for passenger and freight transport work was the basic factor influencing the level of demand for energy in the transport sector. The visible decrease in demand is the result of a significant increase in the demand for transport work, performed with the use of individual motorization (passenger cars) and carriers. In the branch system, road transport has the largest share of the demand for cargo transport, the share of which in the transport work amounts to 573 billion tkm in 2019. In the agriculture, forestry, and fishing sector, direct consumption is approx. 167 PJ, including 61% of liquid fuels, 33% of solid fuels, 3% of electricity, 2% of gaseous fuels, and less than 1% of heat [32].

Methodology of Electricity Final Consumption Forecasting
The demand for electricity by economic sectors in the time domain is shown in Figure 6.

Methodology of Electricity Final Consumption Forecasting
The demand for electricity by economic sectors in the time domain is shown in Figure 6. Building a forecasting model for the next several dozen years requires making assumptions that are subject to uncertainty. This is mainly due to legal regulations, economic factors (population size, Gross Domestic Product (GDP)), and innovations in technology development, especially energy consumption (an unexpected technological leap in one of the alternative reduction technologies may significantly increase its economic attractiveness compared to others). Each of these uncertainties Building a forecasting model for the next several dozen years requires making assumptions that are subject to uncertainty. This is mainly due to legal regulations, economic factors (population size, Gross Domestic Product (GDP)), and innovations in technology development, especially energy consumption (an unexpected technological leap in one of the alternative reduction technologies may significantly increase its economic attractiveness compared to others). Each of these uncertainties affects the credibility of the developed model.
In order to build a reliable model, the statistical data were divided into two sets: training and test data (70% and 30%, respectively). These data were transformed into an input data matrix and entered into the network according to the algorithm shown in Figure 7:  These matrices are introduced into the LSTM network model in the TensorFlow environment. The generated theoretical values are analyzed in accordance with the Equations (1)- (6). After obtaining a statistically significant match, ex post forecasts can be generated, which are re-analyzed using Equations (7) and (8). If this stage is successful, long-term forecasts can be generated and checked for statistical correctness. By comparing the results theoretically with the current state of the process and taking into account common-sense horizons, the model can be accepted or rejected. Rejecting the model causes a re-analysis of the input parameters or the structure of the LSTM neural Statistical analysis -stationarity study, partial autocorrelation.
− The study of the stability of the dispersion of the observation sequence was carried out using the F-Snedecor test for the variance determined from statistical samples. − The partial autocorrelation function plays an important role in data analysis to determine the effect of delay on the model. The procedure is to look for the point on the plot where the partial autocorrelations for all larger delays are essentially zero. For this purpose, the confidence interval is plotted on the graph. All values below the confidence interval are treated as zero partial autocorrelations. Partial autocorrelation values that are statistically significant were obtained for the delays of 1 and 3. A delay of 3, based on partial autocorrelation, was assumed. − Transformation-data standardization. − LSTM-training 200 steps, 25 epochs, the network parameters are shown in Table 1.  These matrices are introduced into the LSTM network model in the TensorFlow environment. The generated theoretical values are analyzed in accordance with the Equations (1)- (6). After obtaining a statistically significant match, ex post forecasts can be generated, which are re-analyzed using Equations (7) and (8). If this stage is successful, long-term forecasts can be generated and checked for statistical correctness. By comparing the results theoretically with the current state of the process and taking into account common-sense horizons, the model can be accepted or rejected. Rejecting the model causes a re-analysis of the input parameters or the structure of the LSTM neural network.
The comparison of the theoretical and actual values is shown in Figures 8-12, and the forecast acceptability study is summarized in Table 2.
The results in Table 2 confirm that LSTM networks can be used to forecast electricity final consumption (MAPE error (%) is lower than the assumed 5%). Figure 13 shows the forecast data prepared in five−year periods with a perspective until 2040.           The results in Table 2 confirm that LSTM networks can be used to forecast electricity final consumption (MAPE error (%) is lower than the assumed 5%). Figure 13 shows the forecast data prepared in five−year periods with a perspective until 2040.
According to the forecasts presented in Figure 7, it can be seen that final electricity consumption is increasing. It is particularly visible in the commercial and public services, and the residential and transport sectors. The decline in energy consumption occurs in the industry sector after 2025. However, the constant level of consumption is visible in the agriculture sector, forestry, and fishing. In the commercial and public services sector, which is currently developing very dynamically on the domestic market, there is an increase of 19% compared to 2015. In the years 2025-2040, it is relatively even at an average level of 10%. The residential sector is also experiencing an increase, which is at a constant level of 7% and is related to the increase in household's available income, while the 10% increase in the transport sector is due to the popularization of electric solutions in individual transport and cargo transportation. In the case of the industry sector, electricity consumption increases by 2025, while after 2025 there is a decrease by about 15%, which may be the result of an increase in energy efficiency.

Conclusions
In any electric power system, demand forecasting plays a key role in the efficient management of energy resources. The lack of accurate forecasts leads to an increase in operating costs or an imbalance in the stability of energy supplies. A key element related to the selection of the theoretical model for forecasting energy consumption is the number of statistical data. There is an active According to the forecasts presented in Figure 7, it can be seen that final electricity consumption is increasing. It is particularly visible in the commercial and public services, and the residential and transport sectors. The decline in energy consumption occurs in the industry sector after 2025. However, the constant level of consumption is visible in the agriculture sector, forestry, and fishing. In the commercial and public services sector, which is currently developing very dynamically on the domestic market, there is an increase of 19% compared to 2015. In the years 2025-2040, it is relatively even at an average level of 10%. The residential sector is also experiencing an increase, which is at a constant level of 7% and is related to the increase in household's available income, while the 10% increase in the transport sector is due to the popularization of electric solutions in individual transport and cargo transportation. In the case of the industry sector, electricity consumption increases by 2025, while after 2025 there is a decrease by about 15%, which may be the result of an increase in energy efficiency.

Conclusions
In any electric power system, demand forecasting plays a key role in the efficient management of energy resources. The lack of accurate forecasts leads to an increase in operating costs or an imbalance in the stability of energy supplies. A key element related to the selection of the theoretical model for forecasting energy consumption is the number of statistical data. There is an active discussion in the literature on the determination of the size of the forecasting data set [23]. However, scientific research on the subject agrees that the predictive model depends on the size of the input data set. As a result, the statistical models used for long-term forecasts do not generate statistically significant forecasts. In this work, a mathematical model based on LSTM artificial neural networks was developed to predict electricity consumption by all sectors of the national economy: unlike standard recurrent networks (RNN), the LSTM network has a feedback loop, which allows it to process not only individual data points, but also entire sequences. Hence, these networks are used for forecasting from time series data, especially those where there are delays of unknown duration between important events. LSTM networks are a special type of RNN, capable of learning long-term relationships. They work extremely well with long-term dependency problems, and this dependency occurs with electricity consumption. Remembering information for long periods of time is their default behavior. The results of electricity final consumption forecasts presented in the article are characterized by a high degree of adjustment, it is around 1-3% of MAPE for the analyzed sectors of the economy and these forecasts can be used to build strategic assumptions for the electric power system in Poland. Funding: The research task was financed from the funds of the Ministry of Science and Higher Education, allocated to maintaining the research potential from funds for statutory activities. The work was within in framework of statutory research 06/010/BK-20/0042.

Conflicts of Interest:
The author declare no conflict of interest.