Next Article in Journal
Optimal Power Flow Formulations for Coordinating Controllable Loads in Distribution Grids: An Overview of Constraint Handling and Hyper Parameter Tuning When Using Metaheuristic Solvers
Previous Article in Journal
Advanced Multivariate Models Incorporating Non-Climatic Exogenous Variables for Very Short-Term Photovoltaic Power Forecasting
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Forecasting Electricity Demand in Renewable-Integrated Systems: A Case Study from Italy Using Recurrent Neural Networks

by
Alessandro Franco
1,* and
Cecilia Pagliantini
2
1
Department of Energy Systems, Territory and Construction Engineering (DESTEC), University of Pisa, Largo Lucio Lazzarino, 56122 Pisa, Italy
2
Department of Mathematics, University of Pisa, Largo B. Pontecorvo 5, 56127 Pisa, Italy
*
Author to whom correspondence should be addressed.
Electricity 2025, 6(2), 30; https://doi.org/10.3390/electricity6020030
Submission received: 15 April 2025 / Revised: 12 May 2025 / Accepted: 19 May 2025 / Published: 3 June 2025

Abstract

:
Balancing electricity production and distribution remains a central challenge in modern energy systems, especially with the increasing penetration of renewable sources that introduce variability and uncertainty. In this context, accurate forecasting of electricity demand is essential for grid stability and operational efficiency. This study addresses the problem of hourly electricity demand forecasting in Italy using recurrent neural networks (RNNs), particularly long short-term memory (LSTM) models, which are designed to capture complex temporal dependencies in time series data. Utilizing real consumption data from Terna—Rete Elettrica Nazionale S.p.A.—for the years 2022 and 2023, we developed and tested an LSTM model capable of predicting national hourly demand with Root Mean Squared Error (RMSE) consistently below 2%. The model’s forecasts show strong agreement with official data provided by Terna, accurately capturing demand peaks and seasonal trends over both short- and medium-term horizons. In addition to evaluating predictive performance, this work proposes a reproducible methodology applicable to other national contexts or similar forecasting problems. Our findings suggest that, while data-driven models offer robust and replicable results, further improvements may require the integration of system-specific knowledge to address persistent limitations in forecasting extreme events or structural anomalies.

1. Introduction

Energy, in particular renewable energy, is a fundamental theme when discussing sustainability [1], encompassing production and transformation, energy use, transport and distribution, storage, and energy flow management [2,3]. An integrated model of energy systems moves beyond a sectoral approach, aiming for optimal resource utilization, though this also increases complexity [4,5].
In recent years, the penetration of renewable energy sources has become central. Renewables, particularly hydropower, wind, and solar photovoltaics, have seen remarkable growth in electricity generation. According to the International Energy Agency (IEA), IRENA, and other sources [6,7,8], at least 30% of global electricity is now generated from renewable sources, with even higher shares in some countries. For instance, in Italy, over 40% of electricity comes from renewables, such as solar, wind, and hydropower [9]. However, this shift introduces complexity, aligning production with consumption. The variability and intermittency of sources, such as solar and wind, demand innovative solutions to ensure system stability and reliability, a topic under study since the 2010s, especially in Europe [10,11]. The global transition to renewables is a key element in achieving sustainability goals. However, it comes with significant technical and economic challenges that require innovation, infrastructure upgrades, and careful planning [12,13]. While many issues are at play, one universally acknowledged as highly significant is forecasting, both of energy final uses and energy production. This topic is particularly critical in the electricity sector, where the complexity of implementing efficient energy storage systems makes accurate forecasting even more essential for maintaining balance and reliability [14,15,16].
One of the primary challenges of renewable energy is its variability. Sources such as wind and solar are inherently intermittent, which can lead to instability in the power grid [17]. To address this, monitoring systems have advanced, allowing us to optimize energy flows within the grid and ensuring efficient use and allocation of resources and energy storage solutions. Technologies such as batteries and other storage methods can absorb surplus energy during peak production and release it when demand exceeds supply, maintaining grid balance [18].
The growing share of renewable energy demands a significant upgrade of transmission and distribution networks, so the topic of modernizing transmission and distribution infrastructure is a relevant topic of research. Modernization efforts should focus on upgraded transmission devices designed to handle higher energy loads while ensuring reliability and the development of smart grid technologies. These enable real-time, two-way communication between consumers and the grid, creating a more dynamic and adaptive energy distribution system [19]. As renewable energy increases in the mix, ensuring continuous balance between energy supply and demand becomes increasingly complex. Effective dispatching requires efficient energy technologies to optimize production and reduce inefficiencies and integrated control systems to enhance the management of production, distribution, and consumption [20].
Forecasting continues to be a critical tool in ensuring system efficiency and stability. By leveraging advanced techniques, such as machine learning, we can accurately predict energy demand and supply, enabling proactive resource management; anticipating demand patterns ensures optimal production and distribution. Accurate forecasts empower operators to optimize energy flows, plan infrastructure upgrades, and respond effectively to fluctuations in supply and demand. A thorough understanding of energy demand is critical to system efficiency. This allows us to optimize production and distribution by tailoring energy generation to actual needs, reducing inefficiencies. Proactive maintenance and development of resilient systems prevent outages and blackouts. Addressing these challenges requires comprehensive strategies and innovative approaches. In this regard, Ref. [21] explores a range of critical issues related to smart energy systems, providing valuable methodologies to enhance their reliability, efficiency, and sustainability.

1.1. State of the Art

The forecasting of electricity demand has become a critical aspect of grid management, as accurate predictions enable the optimization of operations and support decision-making processes related to energy production and distribution. This not only enhances operational efficiency but also improves the reliability of energy systems.
Based on factors such as data availability and system complexity, the problem of predicting energy demand can be tackled by different methods, including statistical models, machine learning algorithms, and physics-based models. Load forecasting has been a fundamental business problem since the inception of the electric power industry [22]. Traditionally, energy demand forecasting relied on statistical and mathematical models, such as time series analysis and regression techniques, which were effective in identifying patterns in structured data [23]. However, with the growing availability of detailed consumption data and the increasing complexity of energy systems, these methods have faced limitations in capturing non-linear relationships and dynamic behaviors [24]. The advent of data-driven approaches, fueled by advancements in machine learning, has significantly transformed forecasting methodologies [25]. Big data analytics further enhances this transformation by enabling more accurate and real-time insights into energy consumption patterns, facilitating smarter energy management [26]. Machine learning, a subset of artificial intelligence, employs sophisticated statistical techniques to uncover complex patterns in large datasets. These models can adapt to evolving data trends and account for various factors influencing energy demand, such as weather conditions, economic activities, and consumer behavior [27].
Key machine learning techniques applied in energy forecasting include supervised learning models [28], deep learning architectures [29] and hybrid models [30]. Among these, supervised learning models, such as support vector machines (SVMs), random forests (RF), and neural networks (NN), are widely utilized for demand prediction, leveraging their ability to identify patterns in large datasets. Deep learning architectures, including recurrent neural networks (RNNs), are particularly notable for their capability to capture temporal dependencies and sequential patterns, making them highly effective in time-series forecasting. Additionally, hybrid models combine machine learning techniques with physical knowledge. These models bridge the gap between data-driven models and energy systems, offering a reliable framework for forecasting.
As energy systems continue to evolve towards greater complexity and renewable integration, the role of machine learning in forecasting will become increasingly vital for achieving sustainable and resilient energy management.
Traditional methods, such as regression models and time-series analysis (e.g., ARIMA), remain useful for capturing seasonal trends and cyclical patterns. However, the increasing availability of large, complex datasets has accelerated the adoption of machine learning techniques, which better capture non-linear relationships and temporal dependencies. Deep learning models, such as long short-term memory (LSTM) networks and gated recurrent units (GRUs), are particularly effective for time-series forecasting, while hybrid approaches integrate these methods with classical techniques for greater accuracy. Many traditional approaches rely heavily on historical data and assume linear behavior, making them inadequate for capturing the nonlinear dynamics and increased variability introduced by renewable energy sources and distributed generation. Furthermore, data quality and integration across diverse sources, such as weather, socioeconomic indicators, and sensor data, remain complex, and most models struggle to adapt to abrupt changes, such as extreme weather events or economic disruptions. Even advanced AI-based models often suffer from limited transparency and scalability. Addressing these challenges is essential to improve forecasting accuracy, ensure grid stability, and support the transition toward a more resilient and renewable-driven energy system.

1.2. Objectives of the Paper

The objective of this paper is to contribute to the ongoing research on energy demand forecasting by applying advanced machine learning techniques. In this context, we investigate the adaptability of a forecasting algorithm to a well-defined dataset.
Although this topic has been extensively studied and numerous contributions exist in the literature, forecasting errors are still significant, particularly in critical and unpredictable situations, highlighting the need for more robust and adaptable approaches. The increasing penetration of renewable energy plants and the widespread deployment of small-scale generation units make forecasting increasingly complex and uncertain, calling for advanced models capable of adapting to a new, distributed and highly variable energy landscape. We apply our approach to a large and realistic dataset—the electricity demand in Italy. In this study, we focus on testing the performance of recurrent neural network models through numerical experiments, given their promising capabilities in handling sequential data. Recurrent neural networks (RNNs) are neural networks with cycles, where outputs can become future inputs. This makes them particularly suited for time-series forecasting. Specifically, we implemented the long short-term memory (LSTM) model, a type of RNN designed to capture both short and long-term dependencies in sequential data. While RNNs have been widely explored in energy forecasting [31], much of the existing research relies on theoretical models or simulated datasets. This study contributes by applying RNNs to real electricity demand data, providing empirical validation and insights into their practical implementation challenges and benefits.

2. Background and Statement of the Problem

In recent years, driven by the increasing implementation of sustainability and climate change policies, renewable energy sources have gained significant traction in power systems. This shift has been particularly evident in many European countries, where the traditional model of centralized power generation has gradually evolved into a distributed generation system. The need to efficiently generate and utilize energy, especially in the context of high renewable penetration, has brought forecasting to the forefront of energy management. In this regard, the Italian energy system presents a valuable platform for testing forecasting algorithms, given its dynamic and evolving nature. The Italian energy system, like many others, has undergone a rapid transformation in recent years, shifting from a centralized structure with a few large power plants to a decentralized system comprising millions of small-scale generation units. Unlike many other energy markets, however, Italy stands out due to the small size of these units, with the average capacity of installations being significantly lower. This shift is primarily driven by the rapid growth of renewable energy sources, such as PV solar and wind. The challenge of managing energy flows, which has been recognized for some time, has become significantly more complex in recent years. At the end of March 2025, Italy had about 1,900,000 plants in operation, the major number are photovoltaic (PV) plants (1,878,780), with a total installed capacity of 37.9 MW [32]. The installed capacity for different renewable energy sources is distributed as follows:
Photovoltaics: 37.9 GW;
Wind: 13.0 GW;
Hydropower: 21.6 GW;
Bioenergy and Geothermal: 4.8 GW.
The increasing penetration of intermittent renewable sources, such as solar and wind, not only introduces variability in generation but also alters load profiles due to prosumer behaviours and local balancing mechanisms, as discussed in [33]. Recent events, such as the blackout in Spain, highlight how regional imbalances and insufficient forecasting accuracy can amplify the impact of renewable variability on system reliability [34].
Figure 1 illustrates the complexity of the electricity system, characterized by the interaction of millions of users and generation units, often interconnected. These elements contribute to a dynamic network where electricity flows are frequently bidirectional, due to the presence of distributed energy resources, such as solar panels and small-scale producers. The system must balance highly variable consumption patterns with equally variable production profiles, also accounting for imported energy, typically concentrated during night hours. Furthermore, the increasing penetration of renewable energy sources, such as solar and wind, adds to this challenge due to their inherent intermittency and unpredictability. Ensuring grid stability and a reliable electricity supply, therefore, requires the integration of emerging technologies, including energy storage systems, demand-response strategies, and green hydrogen. Hydrogen can act as a flexible energy carrier, storing excess renewable production and making it available when needed, thus contributing to the system’s dynamic balance. This intricate and evolving structure highlights the need for accurate forecasting to ensure system stability and enable efficient energy management. The analysis of electricity consumption in Italy highlights the evolving dynamics of energy demand, shaped by seasonal variations, daily usage patterns, and the growing impact of renewable energy sources.
In recent years, peak demand has increasingly shifted toward the summer months, reflecting broader changes in consumption behavior and energy system operation. A wide range of data is now available to support research and analysis in the energy sector.
In the case of Italy, a valuable source is Terna, the national electricity transmission system operator, which provides extensive datasets through the “Transparency Report” section of its website [33]. In compliance with EC Regulation no. 1228/2003, this platform offers detailed and regularly updated information on load, transmission, generation, and balancing. For this study, we focused on actual electricity load data, reported every 15 min or hourly for seven Italian regions—Northern, Central-Northern, Central-Southern, Southern Italy, Sardinia, Sicily—and for the country as a whole (Figure 2).
The analysis of electricity use data in Italy reveals a specific trend, characterized in recent years by peaks in energy demand during the summer season. Figure 3 provides a three-dimensional view of the curves obtainable for a specific year, with the three axes representing the hours of the day (24), the days of the year (365), and the power demand on the grid along the z-axis.
To provide a clearer picture of these trends, Appendix A includes key figures that illustrate electricity demand patterns across different timeframes obtained from [35,36,37]. These visualizations capture the variability of energy consumption throughout the year, emphasizing how modern electricity systems no longer follow perfectly repetitive cycles. Additionally, Appendix A presents the expansion of power plants in Italy, based on data from the Italian Energy Services Operator (GSE—Gestore dei Servizi Energetici) [32,35,36,37].
The integration of decentralized power generation, particularly from renewable sources, has significantly increased the complexity of modern energy systems. These developments have introduced bidirectional energy flows, heightened grid sensitivity, and a growing dependence on accurate forecasting to ensure system stability. Modern smart energy systems, powered by advanced Information and Communication Technologies (ICT), rely on real-time data exchange and precise predictions of both consumption and renewable generation to maintain grid balance, prevent congestion, and optimize operations. As shown in Figure 1, managing such an interconnected and variable energy network requires forecasting models capable of adapting to increasing uncertainty. This is essential not only for efficient market functioning but also to reduce waste and ensure sustainable use of resources. Accurate knowledge of energy demand supports optimization of production and (re)distribution, reduction of inefficiencies, prevention of grid failures, and long-term infrastructure planning.
Electricity demand in Italy exhibits consistent daily and seasonal trends across the country. Although the qualitative shape of the load profile is moderately consistent across the seven geographical zones, significant quantitative differences among the seven zones described in Figure 2 emerge, due to varying population densities and industrial activity levels, as evidenced in [38]. Daily, load profiles are strongly influenced by the type of day. In many areas, three distinct clusters emerge, working days, Saturdays, and Sundays/holidays, with demand progressively decreasing from weekdays to weekends. However, in Southern Italy, Saturdays often resemble working days in terms of load, suggesting a simpler two-cluster classification between working days (including Saturdays) and holidays. Seasonal variations are also evident. Winter and summer show higher overall loads due to heating and air conditioning, respectively, while spring and autumn tend to have lower demand. The shape of the daily load curve changes with the seasons:
In winter, peaks occur in the morning and evening (heating use);
In mid-seasons, a third peak emerges in the afternoon, as heating decreases and midday activities grow;
In summer, peaks shift to the morning and afternoon, reflecting air conditioning usage, especially in workplaces, with the evening peak diminishing;
Figure 4 shows the main clusters emerging from the raw analysis of the data.
Three typical daily profiles are observed: working days, Saturdays or pre-holidays (with intermediate demand), and Sundays or holidays (with lower demand). Monday often shows a distinct profile in the Italian power system, with the largest gap between nighttime minimum and late-morning peak load, due to the sharp restart of activities after the weekend. This can be identified with the feature defined as “morning slope”, defining the difference between the load value at 10.00 a.m. and at 06.00 a.m., as discussed in [38]. Seasonal effects are also evident, with varying peak times across winter, summer, and mid-season periods, while recurring patterns—such as daily, weekly, or seasonal cycles—and predictable factors, such as temperature or daylight hours can inform forecasts, energy demand remains highly irregular and sensitive to both local conditions and unforeseen events (e.g., heatwaves, behavioral shifts, such as the adoption of electric vehicles). These characteristics make it extremely difficult to derive effective physics-based models.
Over time, the field has increasingly shifted towards data-driven approaches. However, although such models achieve acceptable error margins, their reliability under extreme or rapidly changing conditions is still limited, highlighting the need for more robust and adaptable solutions. Figure 5 displays the forecasting curves (in red) alongside the actual measured loads (in blue) for the Italian electricity network, as provided by the national system operator. The four images represent two consecutive days under different seasonal conditions: summer (a), autumn (b), winter (c), and spring (d). As can be observed, although the general load trends are well captured, there are still significant discrepancies, especially when peak load conditions occur, highlighting the challenges in achieving high forecasting accuracy. Within this context, temporal forecasting plays a central role. It involves predicting future values of a time series.

3. Methodology Developed for Forecasting: Recurrent Neural Network (RNN) with Long Short-Term Memory (LSTM)

Forecasting methods can be applied to both electricity demand and energy production. As discussed in the previous sections, this topic has been widely studied and remains central to modern energy system management. Broadly speaking, forecasting techniques can be categorized into three main approaches:
(1)
physics-based models, which rely on physical laws and system modeling;
(2)
data-driven approaches, which use historical and real-time data to detect patterns and trends;
(3)
hybrid models, which combine physical insights with data analytics.
Mathematically, the forecasting problem can be stated, in a simplified form, as follows, given a set of historical observations:
X1, X2, …, Xn
The purpose is to find an approximation of a future value X by constructing a so-called forecasting model, which accurately describes the future behaviour of the time series. The forecasting model can be written as follows:
X = 𝑓(X1, X2, …, Xn; β)
where nonlinear function f generates the forecast and depends on the past data and on parameters β, which determine the response to the inputs. The parameters must be appropriately trained to produce an accurate forecast. The forecasting algorithm learns from past data to generate reliable predictions about future values. Figure 6 provides a visual representation of this process.
The forecasting of electricity demand is becoming increasingly important, especially in the context of rising renewable energy integration. Accurate predictions of electricity demand are crucial for effective grid management, enabling the optimization of energy production and distribution. As variable renewable sources, such as wind and solar, increase, forecasting becomes essential to maintain grid stability and avoid imbalances. Accurate forecasting also helps prevent energy waste and supports efficient system operation.
Fortunately, large datasets from operators, such as Terna, are now available, offering valuable resources for forecasting studies. Forecasting is essential to modern electricity system management, spanning both demand and generation predictions across different time horizons to support decision making [39].
Very short and short-term forecasting, sometimes called nowcasting, supports real-time system operation and intraday electricity market management.
Medium-term forecasting, typically up to 24 h ahead, enables day-ahead market scheduling and critical planning, such as resolving network congestion.
Long-term forecasting focuses on strategic planning, including infrastructure development and investment decisions.
These forecasting objectives are summarized in Table 1, highlighting varying timeframes crucial for ensuring grid efficiency. The classification of forecasting time horizons is freely adapted from [40], providing a structured perspective on their role in energy management. Forecasting is challenging due to irregular fluctuations in demand, with peaks and valleys being particularly hard to predict. Defining a physical model is not feasible due to the large number of influencing factors and their unpredictability.
Given these challenges, accurate demand forecasting is more important than ever, requiring sophisticated data-driven approaches, such as machine learning, to handle the complexities and uncertainties in energy consumption. In developed countries, electricity demand follows recurring patterns, such as daily, weekly, and seasonal trends. However, there are also unpredictable factors, such as sudden heatwaves, unexpected events, or changes in consumption behavior, which can significantly impact demand.
In the field of energy systems, forecasting has become a crucial area of research and innovation. Recently, there has been a growing interest in machine learning techniques, which leverage large datasets and advanced algorithms to identify complex patterns and improve prediction accuracy, offering significant potential for modern energy systems.
Machine learning (ML) models offer significant potential for forecasting, particularly in predicting future electricity demand. ML, a branch of artificial intelligence, uses statistical methods to detect patterns in data, making it highly effective for modeling complex relationships that traditional analytical functions cannot capture. We are working with a time series, where each data point represents electricity demand at a specific time. This involves finding a function f that maps past demand data to future values, using a set of parameters, as illustrated in Equation (2). The machine learning algorithm is trained from historical data by finding the parameters β that minimize the misfit with the training data. Once trained, the model is capable of extrapolating and predicting future demand values, offering reliable forecasts even for time periods not directly observed. As the electricity grid becomes increasingly reliant on renewable energy sources, accurate forecasting of energy consumption is crucial for optimizing production and distribution. Electricity demand in a complex system, such as a national grid, is influenced by numerous factors, including weather conditions, economic activities, and social behaviors, which evolve over time [38,41].
In particular, we aim to explore the application of recurrent neural networks (RNNs) and long short-term memory (LSTM) networks to predict electricity demand [42,43]. The choice of LSTM as a forecasting model is motivated by previous work conducted by one of the authors, in which a comparative analysis of several ML algorithms showed no substantial differences in performance. Only ensemble approaches, combining multiple models, led to significantly improved results. In this context, selecting a single, well-understood architecture allows us to focus on model interpretability and integration, without compromising accuracy [44].
Other types of neural networks could have been considered, such as artificial neural networks (ANNs), convolutional neural networks (CNNs), and deep neural networks (DNNs), which are all powerful architectures. ANNs and DNNs are general-purpose networks often used for static data, while CNNs are particularly effective for spatial or image-based inputs.
Traditional forecasting methods often struggle to account for the temporal dependencies and fluctuations inherent in energy demand.
The specific type of RNN, called long short-term memory (LSTM) networks, was introduced by Hochreiter and Schmidhuber in 1997 [45,46]. LSTM networks represent variations of RNNs, which are particularly well suited for handling time series data, as they process not only single data points but also entire sequences of data [47,48]. LSTM networks are explicitly designed to handle time-series data, thanks to their internal memory mechanisms that allow them to capture temporal dependencies and patterns over longer horizons. In the context of electricity load forecasting—where historical patterns and sequential correlations are fundamental—LSTMs offer a natural and efficient modeling choice.
The LSTM method has found extensive applications across a wide range of fields due to its ability to handle sequential data and capture long-term dependencies. Key areas of application include natural language processing (NLP), time-series analysis, healthcare and biomedical applications, audio and speech processing, video and image sequence analysis, control systems, robotics and autonomous vehicles. Some non-exhaustive examples of LSTM applications can be found in several studies across the literature [49,50,51].
LSTM networks were chosen because they are particularly well suited for modeling temporal dependencies in time series data, often outperforming other architectures, such as standard feedforward or convolutional networks, in capturing sequential patterns. Although a detailed comparison is beyond the scope of this work and has already been tested in different papers, LSTM’s effectiveness in reconstructing time series dynamics made it a natural choice for this specific application.
The method’s versatility lies in its architectural enhancements that mitigate issues such as the vanishing gradient problem, allowing it to effectively process sequences over long horizons. For this reason, LSTM networks seem particularly well suited for predicting electricity demand in complex systems due to their inherent ability to model temporal dependencies and sequential data. This feature is crucial in energy demand forecasting, where patterns are often influenced by historical consumption trends, seasonal variations, and temporal correlations. For a more in-depth exploration of these concepts, reference texts, such as [52], provide a comprehensive treatment of the subject. The building block of LSTM models is the recurrent unit. This is typically composed of a cell and three gates that regulate the flow of information into and out of the cell: the input gate, the output gate, and the forget gate. To update the cell state Ct, the unit maintains a so-called hidden state ht, which plays the role of a memory, and is updated at each time step based on the previous hidden state and on the current input Xt. The LSTM could remove or add information to the cell state via the gates. This feedback loop allows the LSTM network to maintain useful, long-term dependencies to make predictions, both in current and future time-steps. In their formulation, the states of LSTM are defined by the following variables:
Xt is the input state at time t;
ht is the hidden state at time t;
ct is the cell state at time t.
The gates are neural network layers whose architecture is of the following form:
σ(Wz[Xt, ht-1]+bz)
where σ is the sigmoid activation function, and, for any z = {F, I, O}, Wz are the weights and bz are the biases. The weights and the biases of all layers form the set of parameters β introduced in the general forecasting model previously defined by Equation (2). The LSTM network processes electricity load data, available every 15 min (4 times per hour), by using gates to control the flow of information. The forget gate decides which past data to discard by evaluating which information is no longer relevant. For example, if a sudden spike in electricity demand occurs due to a temporary event (such as a short-term weather change), the forget gate may decide to ignore that spike in future predictions. The input gate determines which new information to add to the memory, focusing on patterns that are consistent and relevant, such as recurring load patterns during peak hours. Finally, the output gate controls what information is used to make predictions. This flow of information allows the network to remember important trends (like daily peaks) while forgetting irrelevant noise, ensuring accurate predictions based on historical load trends. The fundamental steps and equations for an LSTM can be summarized as follows:
  • Forget gate layer. In the first step, a neural network (NN) layer is used to decide what information to discard from the cell state based on the current input state Xt and on the hidden state computed in the previous unit:
    Ft = σ(WF[Xt, ht−1]+bF)
  • Input gate layer. This is a neural network layer aimed at deciding what new information to retain in the cell state:
    It = σ(WI[Xt, ht−1]+bI)
  • Next, a tanh (hyperbolic tangent) NN layer creates a vector of new candidate values of the cell state:
c ~ t   = tanh ( W c [ X t , h t 1 ] + b c )
4.
Update the cell state ct:
c t = F t     c t 1   + I t     c ~ t
where the operator ⊙ denotes the element-wise product of vectors (Hadamard product) and c ~ t Is the candidate cell state.
5.
Update the hidden state ht:
ht = Ot ⊙ tanh(ct)
by means of the output gate:
Ot = σ(WO[Xt, ht−1]+bO)
These operations enable LSTMs to learn long-term dependencies by selectively keeping relevant information and discarding irrelevant data over time. Despite recent variations, most LSTM methods share the same basic architecture, including the main operators, shown in Figure 7, with input and output gates only. By leveraging the LSTM model, we aimed to improve the accuracy of electricity demand predictions, which is crucial for better energy management and grid optimization in Italy.

3.1. Data Description

We focused on the electricity demand in Italy, utilizing datasets provided by Terna S.p.A., the operator responsible for the national electricity grid. The data include electricity consumption (actual load) expressed in gigawatts (GW) measured every 15 min for the years 2022 and 2023, available at [35,36,37]. Although our analysis considers the entire national grid, it is worth noting that the system is divided into 7 commercial zones, allowing for a more granular analysis at the zonal level. In a previous work [38], one of the authors has already explored regional-level analysis, observing the benefits and challenges but also the inherent limitations of higher spatial granularity. However, for the purposes of this work, we opted to use aggregated national-level data to ensure consistency in model comparison, robustness of the results, and relevance for system-wide decision making.
Similar datasets are available for different states on the ENTSO-E Transparency Platform [53], which provides comprehensive electricity market and grid data for various European countries, enabling cross-country comparisons and broader analyses. We considered two different types of datasets: the actual load dataset, containing the load consumption, and the day-ahead load forecast data, containing the load forecast provided by Terna. The first dataset is used to test the neural network, while the second is used for comparison. To ensure the datasets were suitable for analysis, some preprocessing steps were applied. First, the data were cleaned to address missing or inconsistent values. Next, to predict hourly consumption, data were downsampled using the resample function from a 15 min to an hourly frequency. Moreover, since ML algorithms are sensitive to the scale of the input data, the dataset was normalized; that is, they were rescaled to the range [0, 1]. Finally, the dataset was split into training, validation, and testing sets to facilitate model development and evaluation.

3.2. Model Architecture and Test Methodology

We developed an LSTM model using Python (version 3), a versatile and widely used programming language [54], and the Keras library with a specific architecture. Keras is an open-source library specifically designed for deep learning tasks. Integrated within TensorFlow, Keras provides a high-level application programming interface (API) that simplifies the creation and training of neural network models. Keras was chosen because of its ability to handle sequential data efficiently through recurrent neural networks and, more specifically, LSTM models [55]. The code was implemented by the authors, leveraging standard routines (e.g., sequential model, layers, dropout) available in Keras libraries.
To better understand the structure of the proposed model, we provide the following description of its architecture and training process. The model is based on a recurrent neural network with LSTM layers. Specifically, it consists of four LSTM layers, each containing 50 hidden units. To prevent overfitting, a dropout layer with a rate of 0.2 is applied. The final output is produced by a single output layer. The input to the model is a sequence of “length” 100, and the total number of trainable parameters amounts to 71,051. The training process spans 50 epochs with a batch size of 20. The model is optimized using the Adam algorithm, and the mean squared error (MSE) loss function is employed to measure prediction accuracy. The dataset consists of hourly electricity demand data in the Italian system from January 2022 to December 2023 (a range of 17,520 h). The data were normalized in the [0, 1] interval and divided as follows:
Training set: Data from 1 January 2022 to 12 April 2023 (a period of around fifteen months) were used for model training.
Validation set: This was used to fine-tune the network architecture during training and collected data from 13 April 2023 to 7 August 2023 (a period of around four months has been considered).
Test set: Data from 8 August 2023 to 31 December 2023 (a period of around five months) were employed to evaluate the model’s performance.
The training and validation sets correspond to 80% of the total available data, while the test set collects the remaining 20% of the data. The validation period (13 April 2023–7 August 2023) and testing period (8 August 2023–31 December 2023) were selected to cover a wide range of seasonal and operational variations in electricity demand. Figure 8 provides all the data, evidence of the dataset used (in blue), the result of the forecasting on the training data (in orange), and on the test data (in green). The selected data range (January 2022–December 2023) were chosen to ensure the availability of data representative of a system configuration closely aligned with the current context. While similar results were observed when using different or longer training periods, this specific range offers a good compromise between recent data and length of the training period. The results are therefore representative and only minor adjustments (e.g., batch size) may be required when applying the method to different datasets.

3.3. Validation and Metrics

The key aspect of ML algorithm is the training phase, where the goal is to derive the function parameters β such that the model performs well on new, previously unseen inputs. At this stage, the number of parameters plays a crucial role. Indeed, a model with very few parameters will not be able to capture some of the core features of the time series and underfit the data. In contrast, the more parameters, the more likely the model is to fit to the spurious noise in the time series signal and hence cannot be extrapolated very well to new data, the so-called overfitting. A powerful feature of ML algorithm is the possibility to minimize, during the training phase, the generalization error, namely the expected value of the error on new data, ideally from the set of data that we expect the algorithm to encounter in practice. To simulate this, the generalization error is estimated by assessing its performance on a test set of examples that were collected separately from the training set, the so-called validation set. In the numerical tests of this work, the model was validated using the root mean squared error (RMSE) as the evaluation metric.
R M S E = 1 n i = 1 n y i y ^ i 2  
where y i and y ^ i correspond to the measured and predicted values at each sample instant i (i.e., every hour), respectively. RMSE measures the average squared difference between predicted and actual values, providing a robust indicator of the model’s performance. The same metric was used to assess the quality of the model predictions on the test set collecting data that were not seen by the ML model. A lower RMSE value indicates higher accuracy and better predictive capability. The results are similar to Terna’s in terms of the error computed over the test set—0.0161 compared to Terna’s 0.0204. When looking at the RMSE over the test data corresponding to each single week, we observe, in Figure 8, that our model presents less oscillations of the error compared to Terna’s result, showing a good predictive capability both a couple of weeks ahead and more than 15 weeks ahead. Qualitatively, the algorithm seems slightly better at capturing the function’s behavior during peak periods, at least for these data sets. As shown in Figure 9, the developed method demonstrated an excellent fit to the data, outperforming the official model developed and used for predictions by Terna. This highlights the effectiveness of the proposed approach in accurately capturing the dynamics of electricity demand.

4. Results and Discussion

The forecasting model we developed has yielded highly satisfactory results. As demonstrated in Figure 8 and Figure 9 by the analysis of the predictions for a week in September 2023 (covering a total of 168 h), the model’s performance aligns closely with that of Terna’s official model and even surpasses it in accurately predicting energy demand peaks, at least for the tested problem. While the figure presented refers specifically to this selected week, the analysis was conducted over the entire period, confirming the model’s consistency and reliability. Figure 10 compares the normalized power data obtained experimentally with the data predicted by the two forecasting models. This figure highlights the differences between the actual and predicted values, allowing an assessment of the accuracy and reliability of the models in predicting the power grid. While the figure presented refers specifically to this selected week, the analysis was conducted over the entire period (see Figure 8), confirming the model’s consistency and reliability.
As shown by the error analysis in Figure 9 and by the comparison between the two forecasting techniques exposed in Figure 10, the results are very promising and demonstrate the potential of the model. The numerical experiments confirm the following:
The forecasting accuracy of the developed model is comparable to that of Terna’s model.
The model effectively predicts hourly energy demand for both short-term and medium-term horizons, according to the definitions analyzed in Table 1, with notable reliability.
The model delivers qualitatively robust results, successfully reproducing energy demand peaks, with a quantitative error that is below 2%.
These findings highlight the robustness and adaptability of the proposed forecasting approach.
The promising results obtained from the forecasting model suggest several notable advantages. First, the model’s ability to consistently predict energy demand peaks, even under the complex conditions of Italy’s decentralized and highly variable energy landscape, highlights its robustness. Moreover, the simplicity of implementing LSTM models in comparison to other machine learning techniques is a significant advantage. After being trained, LSTM networks can efficiently handle real-time data streams, making them particularly suitable for operational use in systems such as Italy’s energy grid. This feature is especially beneficial when considering the growing number of small-scale renewable energy installations, which require continuous adjustment in forecasting methods.
Another key strength of the proposed approach lies in its scalability. The model can easily be extended to account for longer forecasting horizons or more granular time intervals, which is crucial as energy management systems evolve to incorporate more distributed generation units and more complex demand-response mechanisms.
An additional advantage of the proposed LSTM-based forecasting model is its ease of implementation, which is facilitated by the widespread availability of well-established algorithms and libraries. Tools such as Keras, but also TensorFlow and PyTorch, offer open-access and user-friendly interfaces and pre-built functions that significantly reduce the complexity of building and training deep learning models. These libraries, coupled with extensive community support, allow for faster model development and deployment, even for teams with limited deep learning expertise.
As a result, integrating this model into operational systems becomes a feasible task for energy providers without requiring significant resources or time investments.
While the model’s implementation is straightforward, its value lies in offering a practical and adaptable framework for electricity demand forecasting using recurrent neural networks, specifically LSTM architectures. Our approach, tested on real-world data from the Italian electricity grid, produced results that are comparable to those of the official forecasting model used by Terna. The forecasting model and algorithm used by Terna are not publicly disclosed. While the performance of their approach is adequate, our method, despite being very simple, runnable on a laptop, and not relying on any physical information, such as weather data, achieves results that are comparable to those of Terna.
Beyond the accuracy of the predictions, we believe this study contributes to the analysis of a highly relevant and timely topic. It demonstrates how data-driven models can be effectively applied in operational contexts. However, the performance plateau observed suggests that future improvements may require integrating domain-specific knowledge and physical constraints into the learning process. A purely data-driven approach may struggle to significantly exceed current levels of performance without accounting for the underlying structure and dynamics of the energy system.
To improve forecasting accuracy, especially at finer temporal scales, the model can be enriched with handcrafted features that describe key aspects of the load profile, such as daily variability, peak structure, and intra-day fluctuations. These features help the model better interpret not only the quantity of energy consumed but also its distribution throughout the day. Table 2 summarizes, according to our vision, a selection of such features, including statistical measures (e.g., mean, variance), temporal indicators (e.g., peak hour, morning slope), and frequency components (e.g., Fast Fourier Transform peaks), describing their relevance and contribution to capture different dimensions of the daily load behavior. Adding descriptive features to LSTM models moderately increases input complexity but does not significantly burden the model structure. If well selected and properly preprocessed, these features enhance learning by providing structured context, improving performance, especially during atypical days or in the presence of less predictable temporal patterns.

5. Conclusions

The increasing use of renewable energy sources and the optimization of energy systems require continuous balancing between energy supply and demand. Accurate forecasting of energy needs plays a crucial role in this process. In recent years, despite the proliferation of advanced forecasting algorithms, no substantial improvements have been observed in terms of accuracy. While the overall forecast error may appear acceptable, significant discrepancies persist at the level of specific time intervals or localized events. This limitation was starkly highlighted by the widespread blackout that occurred in Spain and Portugal on 27 April 2025, underscoring the operational relevance of reliable forecasting.
This paper explored how the vast amount of available data can be leveraged to build numerical models that, despite some degree of error, identify relationships and patterns in the data, enabling future demand predictions. We focused on evaluating the performance of recurrent neural network (RNN) models through numerical experiments. Unlike traditional neural networks, RNNs can retain information from previous time steps, making them well suited for time series forecasting. Specifically, we implemented the LSTM (long short-term memory) model, a type of RNN designed to capture both short-term and long-term dependencies in sequential data.
To assess the model’s performance, we used electricity demand data from Terna—Rete Elettrica Nazionale S.p.A., the Italian operator of the electricity transmission grid. The results of our analysis show the following:
The accuracy of our predictions is comparable to the official model used by Terna.
The model is effective at predicting hourly demand with good accuracy for both short- and medium-term periods (up to several months).
The model accurately reproduces energy peaks, with quantitative errors consistently below 2%.
Our findings demonstrate that carefully designed machine learning models can significantly enhance the accuracy of energy demand forecasting. Moreover, this study not only validates the LSTM model’s effectiveness in predicting electricity demand but also provides a methodology that can be easily replicated for similar forecasting tasks in other fields: the method presented has broader applicability and can inform similar analyses in other national contexts.
Although the results obtained with the RNN-LSTM model are encouraging and comparable to those of official forecasts, it is important to highlight a structural limitation of data-driven approaches. These models are often designed in an ad hoc manner and lack a solid theoretical foundation, making their performance highly dependent on the specific dataset and experimental conditions. As such, they may yield excellent results in one context but generalize poorly in another. This result reinforces the idea that, while data-driven methods are useful, their predictive capacity reaches a plateau when relying solely on historical data. A more effective strategy could involve the development of hybrid models, incorporating not only accurate meteorological inputs but also physical information about the electrical system and its dynamics. Such integration could enhance the robustness and reliability of forecasts, especially under stress or near-critical conditions.

Author Contributions

Conceptualization, A.F. and C.P.; methodology, A.F. and C.P.; software, A.F. and C.P; validation, A.F. and C.P.; formal analysis, A.F. and C.P; investigation, A.F. and C.P; resources, A.F.; data curation, C.P.; writing—original draft preparation, A.F. and C.P; writing—review and editing, A.F. and C.P; visualization, A.F. and C.P.; supervision, A.F. and C.P. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the National Recovery and Resilience Plan (NRRP), Mission 4 Component 2 Investment 1.3—Call for tender No. 1561 of 11 October 2022 of Ministero dell’Università e della Ricerca (MUR); and by the European Union—NextGenerationEU. Award Number: Project code PE0000021, Concession Decree No. 1561 of 11 October 2022 adopted by Ministero dell’Università e della Ricerca (MUR), CUP I53C22001450006, according to attachment E of Decree No. 1561/2022, Project title “Network 4 Energy Sustainable Transition—NEST”.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Some relevant data presented in the study are included in the article; further inquiries about additional data can be directly directed to the corresponding authors.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

bBiases of the neural network layer
ctCell state at time step t
c ~ t Candidate cell state at time step t
htHidden state at time step t
fGeneral nonlinear function
FtForget gate at time step t
ItInput gate at time step t
OtOutput gate at time step t
PgridPower in the Italian national grid
TTime step
XtInput state at time step t
y i measured value at each sample instant i
y ^ i predicted value at each sample instant i
WWeights of the neural network layer
βParameter of the forecasting model
σsigmoid activation function for the cell
APIApplication Programming Interface
ARIMAAuto Regressive Integrated Moving Average
FFTFast Fourier Transform
GRUGated Recurrent Unit
ICTInformation and Communication Technologies
LSTMLong Short-Term Memory
MLMachine learning
NNNeural Network
PVPhoto Voltai
RMSERoot Mean Squared Error
RNNRecurrent Neural Network
SVMSupport Vector Machines
TSOTransmission System Operator

Appendix A. Description of the Italian Power System Dataset

In this appendix, we describe in detail the structure and origin of the data used to model and analyze the Italian electricity system. In Figure 3, we have already highlighted the typical trend of electricity demand in Italy over a representative year. In this appendix, we provide a more detailed analysis of the data referring to a recent year, to capture current dynamics and shifts in consumption behavior. Figure A1, which refers to data from 2023, provides a clearer representation of minimum and maximum values. As can be observed, all the curves exhibit distinct behaviors, with no exact repetitions, reflecting the inherent variability of modern energy systems. This non-repeating nature is now a common feature across all complex energy systems, driven by diverse factors such as changing consumption patterns, integration of renewable sources, and the increasing role of distributed generation. All the data are derived from the national operator Terna’s portal and all figures, and the Table has been produced by the authors based on data from the national operators, GSE and Terna’s portal [32,35,36,37].
As shown in the figure, the range of demand in Italy for 2023 varied from a minimum value around 20 GW to almost 60 GW. Electricity demand values above 50 GW occur only in limited periods, mainly during the winter and, more frequently, in the summer months, when the widespread use of air conditioning significantly increases consumption. Semeraro et al. have previously analyzed in [38] the relationship between electricity demand and several key variables, such as weekdays (including working days, pre-holidays, and holidays), as well as seasonal patterns. This wide fluctuation underscores the challenges in balancing supply and demand, highlighting the need for reliable forecasting to maintain grid stability and efficiency. To furnish major details, Figure A2 represents the demand on a typical autumn week. The analysis includes a clustering that highlights differences between weekdays, pre-holiday days, and holidays. The curve shows two to three peaks, corresponding to the hours between 12:00 PM and 8:00 PM, with a minimum demand ranging between 22 and 25 GW and a maximum demand reaching values between 34 and 45 GW. This shift has transformed the traditional electricity grid, previously reliant on a few large power plants with unidirectional energy flow, into a decentralized system with distributed energy sources.
Figure A1. Annual trend of electricity demand in Italy during 2023.
Figure A1. Annual trend of electricity demand in Italy during 2023.
Electricity 06 00030 g0a1
The Italian electricity system has become increasingly complex in recent years, as highlighted in Table A1. This table, rearranged by the authors, basing on the data distributed by Terna [35,36,37], illustrates how the significant growth in the number of power plants—primarily renewable installations, particularly PV systems—has complicated system management. This evolution has occurred despite a stable demand, emphasizing the challenges posed by the sheer number of plants now integrated into the grid.
Figure A2. Electricity demand in Italy during a typical week in the intermediate season, highlighting daily variations and differences between weekdays (from Monday to Friday), pre-holiday day (Saturday), and holiday (Sunday).
Figure A2. Electricity demand in Italy during a typical week in the intermediate season, highlighting daily variations and differences between weekdays (from Monday to Friday), pre-holiday day (Saturday), and holiday (Sunday).
Electricity 06 00030 g0a2
Table A1. Evolution of Power Plant Numbers and the Resulting Challenges in Grid Management: data rearranged by the authors considering those available in [32].
Table A1. Evolution of Power Plant Numbers and the Resulting Challenges in Grid Management: data rearranged by the authors considering those available in [32].
202320222021202020152010
287,372295,853295,702279,171292,073305,761Energy on the grid (GWh)General data
108,955100,466116,339116,915108,90476,964Energy from RES (GWh)
1,611,4021,239,1981,029,479948,979697,137159,875Renewable plants (number)
1,597,4471,225,4311,016,083935,838687,759155,957Number of plantsPV plants
30,31925,06422,59421,65018,9013470Power installed (MW)
30,71128,12125,03924,94222,9421906Energy Produced (GWh)
484847844646450339632729Number of plantsHydroelectricity plants
19,27419,26519,17219,10618,54317,876Power installed (MW)
40,51728,39845,38847,55245,53751,116Energy Produced (GWh)
60195928573156602734487Number of plants
12,33511,85811,28910,90691625814Power installed (MW)Wind plants
16,01720,49420,92718,76214,8449126Energy Produced (GWh)
343434343433Number of plants
818818818818821772Power installed (MW)Geothermal plants
569258375914602661855376Energy Produced (GWh)
30543021298529442647669Number of plantsBioenergy
407840504106410540562351Power installed (MW)
16,01817,61619,07119,63419,3969440Energy Produced (GWh)

References

  1. Xue, C.; Shahbaz, M.; Ahmed, Z.; Ahmad, M.; Sinha, A. Clean energy consumption, economic growth, and environmental sustainability: What is the role of economic policy uncertainty? Renew. Energy 2022, 184, 899–907. [Google Scholar] [CrossRef]
  2. Ang, T.Z.; Salem, M.; Kamarol, M.; Das, H.S.; Nazari, M.A.; Prabaharan, N. A comprehensive study of renewable energy sources: Classifications, challenges and suggestions. Energy Strategy Rev. 2022, 43, 100939. [Google Scholar] [CrossRef]
  3. Infield, D.; Freris, L. Renewable Energy in Power Systems; John Wiley & Sons: Hoboken, NJ, USA, 2020. [Google Scholar]
  4. Impram, S.; Nese, S.V.; Oral, B. Challenges of renewable energy penetration on power system flexibility: A survey. Energy Strategy Rev. 2020, 31, 100539. [Google Scholar] [CrossRef]
  5. Al-Shetwi, A.Q. Sustainable development of renewable energy integrated power sector: Trends, environmental impacts, and recent challenges. Sci. Total Environ. 2022, 822, 153645. [Google Scholar] [CrossRef]
  6. REN21. Renewables 2024 Global Status Report Collection. A Comprehensive Annual Overview of the State of Renewable Energy. 2024. Available online: https://www.ren21.net/gsr-2024/ (accessed on 31 December 2024).
  7. IRENA. Renewable Energy Statistics 2024, International Renewable Energy Agency, Abu Dhabi. 2024. Available online: https://www.irena.org/Publications/2024/Jul/Renewable-energy-statistics-2024 (accessed on 31 December 2024).
  8. Ritchie, H.; Rosado, P.; Roser, M. “Energy” Published Online at OurWorldinData.org. 2023. Available online: https://ourworldindata.org/energy (accessed on 31 December 2024).
  9. Terna S.p.A. Statistical Data of Energy in Italy. 2023. Available online: https://www.terna.it/en/electric-system/statistical-data-forecast/statistical-publications (accessed on 31 December 2024).
  10. Franco, A.; Salza, P. Strategies for optimal penetration of intermittent renewables in complex energy systems based on techno-operational objectives. Renew. Energy 2011, 36, 743–753. [Google Scholar] [CrossRef]
  11. Lund, P.D.; Lindgren, J.; Mikkola, J.; Salpakari, J. Review of energy system flexibility measures to enable high levels of variable renewable electricity. Renew. Sustain. Energy Rev. 2015, 45, 785–807. [Google Scholar] [CrossRef]
  12. Chen, Y.; Xu, J.; Wang, J.; Lund, P.D.; Wang, D. Configuration optimization and selection of a photovoltaic-gas integrated energy system considering renewable energy penetration in power grid. Energy Convers. Manag. 2022, 254, 115260. [Google Scholar] [CrossRef]
  13. Child, M.; Kemfert, C.; Bogdanov, D.; Breyer, C. Flexible electricity generation, grid exchange and storage for the transition to a 100% renewable energy system in Europe. Renew. Energy 2019, 139, 80–101. [Google Scholar] [CrossRef]
  14. Ahmed, A.; Khalid, M. A review on the selected applications of forecasting models in renewable power systems. Renew. Sustain. Energy Rev. 2019, 100, 9–21. [Google Scholar] [CrossRef]
  15. Deng, X.; Lv, T. Power system planning with increasing variable renewable energy: A review of optimization models. J. Clean. Prod. 2020, 246, 118962. [Google Scholar] [CrossRef]
  16. Sweeney, C.; Bessa, R.J.; Browell, J.; Pinson, P. The future of forecasting for renewable energy. Wiley Interdiscip. Rev. Energy Environ. 2020, 9, e365. [Google Scholar] [CrossRef]
  17. Liang, X. Emerging power quality challenges due to integration of renewable energy sources. IEEE Trans. Ind. Appl. 2016, 53, 855–866. [Google Scholar] [CrossRef]
  18. Chen, X.; Jiang, Y.; Terzija, V.; Lu, C. Review on measurement-based frequency dynamics monitoring and analyzing in renewable energy dominated power systems. Int. J. Electr. Power Energy Syst. 2024, 155, 109520. [Google Scholar] [CrossRef]
  19. Vahidinasab, V.; Tabarzadi, M.; Arasteh, H.; Alizadeh, M.I.; Beigi, M.M.; Sheikhzadeh, H.R.; Mehran, K.; Sepasian, M.S. Overview of electric energy distribution networks expansion planning. IEEE Access 2020, 8, 34750–34769. [Google Scholar] [CrossRef]
  20. Marzbani, F.; Abdelfatah, A. Economic dispatch optimization strategies and problem formulation: A comprehensive review. Energies 2024, 17, 550. [Google Scholar] [CrossRef]
  21. Fathi, M.; Zio, E.; Pardalos, P.M. (Eds.) Handbook of Smart Energy Systems; Springer Nature: Berlin/Heidelberg, Germany, 2023. [Google Scholar]
  22. Hong, T.; Fan, S. Probabilistic electric load forecasting: A tutorial review. Int. J. Forecast. 2016, 32, 914–938. [Google Scholar] [CrossRef]
  23. Hong, T.; Pinson, P.; Wang, Y.; Weron, R.; Yang, D.; Zareipour, H. Energy forecasting: A review and outlook. IEEE Open Access J. Power Energy 2020, 7, 376–388. [Google Scholar] [CrossRef]
  24. Nti, I.K.; Teimeh, M.; Nyarko-Boateng, O.; Adekoya, A.F. Electricity load forecasting: A systematic review. J. Electr. Syst. Inf. Technol. 2020, 7, 13. [Google Scholar] [CrossRef]
  25. Alazemi, T.; Darwish, M.; Radi, M. Renewable energy sources integration via machine learning modelling: A systematic literature review. Heliyon 2024, 10, e26088. [Google Scholar] [CrossRef]
  26. Zhou, K.; Fu, C.; Yang, S. Big data driven smart energy management: From big data to big insights. Renew. Sustain. Energy Rev. 2016, 56, 215–225. [Google Scholar] [CrossRef]
  27. Wang, H.; Lei, Z.; Zhang, X.; Zhou, B.; Peng, J. A review of deep learning for renewable energy forecasting. Energy Convers. Manag. 2019, 198, 111799. [Google Scholar] [CrossRef]
  28. Ahmad, T.; Chen, H.; Huang, R.; Yabin, G.; Wang, J.; Shair, J.; Akram, H.M.; Mohsan, S.A.; Kazim, M. Supervised based machine learning models for short, medium and long-term energy prediction in distinct building environment. Energy 2018, 158, 17–32. [Google Scholar] [CrossRef]
  29. Bedi, J.; Toshniwal, D. Empirical mode decomposition based deep learning for electricity demand forecasting. IEEE Access 2018, 6, 49144–49156. [Google Scholar] [CrossRef]
  30. Luzia, R.; Rubio, L.; Velasquez, C.E. Sensitivity analysis for forecasting Brazilian electricity demand using artificial neural networks and hybrid models based on Autoregressive Integrated Moving Average. Energy 2023, 274, 127365. [Google Scholar] [CrossRef]
  31. Zhang, M.; Yu, Z.; Xu, Z. Short-term load forecasting using recurrent neural networks with input attention mechanism and hidden connection mechanism. IEEE Access 2020, 8, 186514–186529. [Google Scholar] [CrossRef]
  32. GSE. Dati Scenari e Statistiche Sull’energia Rinnovabile in Italia. Available online: https://www.gse.it/documenti_site/Documenti%20GSE/Rapporti%20statistici/Rapporto%20Statistico%20GSE%20-%20Energia%20da%20FER%20in%20Italia%20-%20anno%202023.pdf (accessed on 2 January 2025).
  33. Siano, P. Demand response and smart grids—A survey. Renew. Sustain. Energy Rev. 2014, 30, 461–478. [Google Scholar] [CrossRef]
  34. Gonzalez-Reina, A.E.; Sanchez-Sanchez-de-Puerta, A.; Abellan-Chuecos, F.; Girona-Garcia, V.; García-Torres, F.; Jimenez-Hornero, J.E. Enhanced Resilience of Microgrids Through Distributed Open Ring Topologies and Advanced Model Predictive Control Techniques. 2025; preprint. Available online: https://ssrn.com/abstract=5245303 (accessed on 20 May 2025).
  35. Terna S.p.A. Transparency Report Database. Available online: https://www.terna.it/it/sistema-elettrico/transparency-report (accessed on 10 April 2025).
  36. Terna S.p.A. Load Data of Italian Electric Energy System. Available online: https://dati.terna.it/en/load#total-load (accessed on 2 January 2025).
  37. Terna S.p.A. Statistical Publications, Electricity Data Archives and the Latest Electricity Report. Available online: https://www.terna.it/it/sistema-elettrico/statistiche/pubblicazioni-statistiche (accessed on 2 January 2025).
  38. Semeraro, L.; Crisostomi, E.; Franco, A.; Landi, A.; Raugi, M.; Tucci, M.; Giunta, G. Electrical Load Clustering: The Italian case. In IEEE PES Innovative Smart Grid Technologies, Europe; IEEE: Piscataway, NJ, USA, 2014; pp. 1–6. [Google Scholar]
  39. Ahmad, N.; Ghadi, Y.; Adnan, M.; Ali, M. Load forecasting techniques for power system: Research challenges and survey. IEEE Access 2022, 10, 71054–71090. [Google Scholar] [CrossRef]
  40. Mystakidis, A.; Koukaras, P.; Tsalikidis, N.; Ioannidis, D.; Tjortjis, C. Energy Forecasting: A Comprehensive Review of Techniques and Technologies. Energies 2024, 17, 1662. [Google Scholar] [CrossRef]
  41. Antonelli, M.; Desideri, U.; Franco, A. Effects of large-scale penetration of renewables: The Italian case in the years 2008–2015. Renew. Sustain. Energy Rev. 2018, 81, 3090–3100. [Google Scholar] [CrossRef]
  42. Aseeri, A.O. Effective RNN-based forecasting methodology design for improving short-term power load forecasts: Application to large-scale power-grid time series. J. Comput. Sci. 2023, 68, 101984. [Google Scholar] [CrossRef]
  43. Nespoli, A.; Ogliari, E.; Pretto, S.; Gavazzeni, M.; Vigani, S.; Paccanelli, F. Electrical load forecast by means of LSTM: The impact of data quality. Forecasting 2021, 3, 91–101. [Google Scholar] [CrossRef]
  44. Gigoni, L.; Betti, A.; Crisostomi, E.; Franco, A.; Tucci, M.; Bizzarri, F.; Mucci, D. Day-ahead hourly forecasting of power generation from photovoltaic plants. IEEE Trans. Sustain. Energy 2017, 9, 831–842. [Google Scholar] [CrossRef]
  45. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
  46. Gers, F.A.; Schmidhuber, J.; Cummins, F. Learning to forget: Continual prediction with LSTM. Neural Comput. 2000, 12, 2451–2471. [Google Scholar] [CrossRef]
  47. Yu, Y.; Si, X.; Hu, C.; Zhang, J. A review of recurrent neural networks: LSTM cells and network architectures. Neural Comput. 2019, 31, 1235–1270. [Google Scholar] [CrossRef]
  48. Mienye, I.D.; Swart, T.G.; Obaido, G. Recurrent neural networks: A comprehensive review of architectures, variants, and applications. Information 2024, 15, 517. [Google Scholar] [CrossRef]
  49. Karevan, Z.; Suykens, J.A. Transductive LSTM for time-series prediction: An application to weather forecasting. Neural Netw. 2020, 125, 1–9. [Google Scholar] [CrossRef]
  50. Yuan, Q.; Dai, Y.; Li, G. Exploration of English speech translation recognition based on the LSTM RNN algorithm. Neural Comput. Appl. 2023, 35, 24961–24970. [Google Scholar] [CrossRef]
  51. Dudkina, E.; Crisostomi, E.; Franco, A. Prediction of CO2 in Public Buildings. Energies 2023, 16, 7582. [Google Scholar] [CrossRef]
  52. Goodfellow, I.; Bengio, Y.; Courville, A.; Bengio, Y. Deep Learning; MIT Press: Cambridge, UK, 2016; Available online: https://www.deeplearningbook.org/ (accessed on 23 February 2025).
  53. ENTSO-E. Transparency Platform. 2025. Available online: https://transparency.entsoe.eu/ (accessed on 23 February 2025).
  54. Python Programme. Available online: https://www.python.org/ (accessed on 2 January 2025).
  55. K Keras. A Superpower for ML Developers. Available online: https://keras.io/ (accessed on 2 January 2025).
Figure 1. The dynamic interplay between various energy resources, illustrating their interconnections and dependencies within the broader energy system.
Figure 1. The dynamic interplay between various energy resources, illustrating their interconnections and dependencies within the broader energy system.
Electricity 06 00030 g001
Figure 2. Italian national territory and the 7 commercial zones considered by Terna.
Figure 2. Italian national territory and the 7 commercial zones considered by Terna.
Electricity 06 00030 g002
Figure 3. Three-dimensional representation of Italy’s electricity load profile over a full year, illustrating the typical seasonal and weekly demand patterns observed during the reference year.
Figure 3. Three-dimensional representation of Italy’s electricity load profile over a full year, illustrating the typical seasonal and weekly demand patterns observed during the reference year.
Electricity 06 00030 g003
Figure 4. Box diagram illustrating the main electricity demand clusters identified from raw data.
Figure 4. Box diagram illustrating the main electricity demand clusters identified from raw data.
Electricity 06 00030 g004
Figure 5. Comparison between forecasting load curve and real load for Italian grid in four different periods of the year: two days in summer (a), autumn (b), winter (c), and spring (d).
Figure 5. Comparison between forecasting load curve and real load for Italian grid in four different periods of the year: two days in summer (a), autumn (b), winter (c), and spring (d).
Electricity 06 00030 g005
Figure 6. The concept of forecasting from data (a) to fitting (b) to prediction (c). The question marks in (a,b) indicate the unknown values that the model aims to estimate.
Figure 6. The concept of forecasting from data (a) to fitting (b) to prediction (c). The question marks in (a,b) indicate the unknown values that the model aims to estimate.
Electricity 06 00030 g006
Figure 7. Architecture of a basic RNN LSTM neural network with focus on the input and output gates.
Figure 7. Architecture of a basic RNN LSTM neural network with focus on the input and output gates.
Electricity 06 00030 g007
Figure 8. Dataset of hourly electricity demand in Italy (January 2022–December 2023) divided into training (orange), validation (blue) and testing (green) sets.
Figure 8. Dataset of hourly electricity demand in Italy (January 2022–December 2023) divided into training (orange), validation (blue) and testing (green) sets.
Electricity 06 00030 g008
Figure 9. Error analysis and comparison between the tested model and the official model used by Terna operator. The x-axis spans a period of 20 weeks (8 August–31 December) corresponding to the entire test set.
Figure 9. Error analysis and comparison between the tested model and the official model used by Terna operator. The x-axis spans a period of 20 weeks (8 August–31 December) corresponding to the entire test set.
Electricity 06 00030 g009
Figure 10. Comparison of normalized experimental data and predictions from the two forecasting models in a week of the “testing period”.
Figure 10. Comparison of normalized experimental data and predictions from the two forecasting models in a week of the “testing period”.
Electricity 06 00030 g010
Table 1. Summary of distinct forecasting objectives, emphasizing varying timeframes and applications essential for electricity grid efficiency and reliability (rearranged from [40]).
Table 1. Summary of distinct forecasting objectives, emphasizing varying timeframes and applications essential for electricity grid efficiency and reliability (rearranged from [40]).
ApplicationsRangeTime Horizon
Control and adjustment actionsFew seconds to 30 min aheadVery short-term
Economic Dispatch Planning;
Load Increment/Decrement Decisions
30 min to 6 h aheadShort-term
Generator Online/Offline Decisions;
Operational Security in Day-Ahead;
Electricity Market
6 h to 1 day aheadMedium-term
Unit Commitment Decisions;
Reserve Requirement Decisions;
Maintenance Scheduling;
1 day to 1 week or more aheadLong-term
Table 2. Daily load features that can be used to enrich the input space of LSTM models, aimed at capturing structural and temporal patterns beyond raw time series data.
Table 2. Daily load features that can be used to enrich the input space of LSTM models, aimed at capturing structural and temporal patterns beyond raw time series data.
FeatureDescriptionRelevance
Peak Hour Hour of daily maximum loadCaptures timing of peak
Morning Slope Load increase from 06:00 to 10:00Morning activity signal
Partial Daily MeanAvg. load from 11:00 to 20:00Core daytime consumption
Partial Max-difference Max minus average from 11:00 to 20:00Load volatility indicator
FFT Peak Strongest frequency in load spectrumDetects dominant cycles
Daily Variance Overall variability of the daily profileDay-to-day stability
Early Afternoon Drop from 11:00 to 15:00Lunch-hour load change
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Franco, A.; Pagliantini, C. Forecasting Electricity Demand in Renewable-Integrated Systems: A Case Study from Italy Using Recurrent Neural Networks. Electricity 2025, 6, 30. https://doi.org/10.3390/electricity6020030

AMA Style

Franco A, Pagliantini C. Forecasting Electricity Demand in Renewable-Integrated Systems: A Case Study from Italy Using Recurrent Neural Networks. Electricity. 2025; 6(2):30. https://doi.org/10.3390/electricity6020030

Chicago/Turabian Style

Franco, Alessandro, and Cecilia Pagliantini. 2025. "Forecasting Electricity Demand in Renewable-Integrated Systems: A Case Study from Italy Using Recurrent Neural Networks" Electricity 6, no. 2: 30. https://doi.org/10.3390/electricity6020030

APA Style

Franco, A., & Pagliantini, C. (2025). Forecasting Electricity Demand in Renewable-Integrated Systems: A Case Study from Italy Using Recurrent Neural Networks. Electricity, 6(2), 30. https://doi.org/10.3390/electricity6020030

Article Metrics

Back to TopTop