Full text
Electrical Power and Energy Systems 156 (2024) 109730 Available online 29 December 2023 0142-0615/© 2023 The Author(s). Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/bync-nd/4.0/). Contents lists available at ScienceDirect International Journal of Electrical Power and Energy Systems journal homepage: www.elsevier.com/locate/ijepes A machine learning-based methodology for short-term kinetic energy forecasting with real-time application: Nordic Power System case Jose Miguel Riquelme-Domingueza,b,∗, Manuel Carranza-Garcíac, Pedro Lara-Benítezd, Francisco M. González-Longatte aElectrical Engineering Department, Escuela Técnica Superior de Ingenieros Industriales, Universidad Politécnica de Madrid, C/ José Gutiérrez Abascal, 2, Madrid, 28006, Spain bElectrical Engineering Department, Escuela Técnica Superior de Ingeniería, Universidad de Sevilla, Camino de los Descubrimientos, Seville, 41092, Spain cDivision of Computer Science, University of Sevilla, Av. Reina Mercedes, s/n, Seville, 41012, Spain dProcess Engineering team in Global Risk Analytics, Bank of America, 2 King Edward St, London, EC1A 1HQ, United Kingdom eFaculty of Environment, Science and Economy, University of Exeter, Exeter Science Park, Exeter, EX5 2FN, United Kingdom ARTICLE INFO Keywords: Data series Forecasting Inertia Kinetic energy Machine learning ABSTRACT The progressive substitution of conventional synchronous generation for renewable-based generation imposes a series of challenges in many aspects of modern power systems, among which are the issues related to the low rotational inertia systems. Rotational inertia and the kinetic energy stored in the rotating masses in the power system play a fundamental role in the operation of power systems as it represents in some sort the ability of the system to withstand imbalances between generation and demand. Therefore, transmission system operators (TSOs) need tools to forecast the inertia or the kinetic energy available in the systems in the very short term (from minutes to hours) in order to take appropriate actions if the values fall below the one that ensures secure operation. This paper proposes a methodology based on machine learning (ML) techniques for short-term kinetic energy forecasting available in power systems; it focuses on the length of the moving window, which allows for obtaining a balance between the historical information needed and the horizon of forecasting. The proposed methodology aims to be as flexible as possible to apply to any power system, regardless of the data available and the software used. To illustrate the proposed methodology, time series of the kinetic energy recorded in the Nordic Power System (NPS) has been used as a case study. The results show that Linear Regression (LR) is the most suitable method for a time horizon of one hour due to its high accuracy- to-simplicity ratio, while Long Short-Term Memory (LSTM) is the most accurate for a forecasting horizon of four hours. Experimental assessment has been carried out using Typhoon HIL-404 simulator, verifying that both algorithms are suitable for real-time simulation. 1. Introduction For many decades, traditional power systems have relied on synchronous machines as the electrical generation used to produce electricity. The synchronous generator is able to produce a set of services that allows the secure and economical operation of the electrical systems. However, many of those large synchronous generators use nonenvironmentally friendly primary energy sources (e.g., thermal power plants such as coal, fuel oil, natural gas, etc.). Synchronous generators that are directly connected to the power grid provide a variety of services. One of them is related to an intrinsic natural electromechanical property, rotational inertia (H). This parameter has an impact ∗Corresponding author at: Electrical Engineering Department, Escuela Técnica Superior de Ingeniería, Universidad de Sevilla, Camino de los Descubrimientos, Seville, 41092, Spain. E-mail address: [email protected] (J.M. Riquelme-Dominguez). on virtually every single electromechanical-related phenomenon, from normal operation to abnormal conditions. The total system rotational inertia is an indicator used to define the system’s robustness to overcome frequency disturbances caused by an imbalance of active power generation and demand [1]. Power imbalances (𝛥𝑃 ) occur in the power systems in many timescales and sizes. Small deviations between generation and demand are pretty frequent and noticeably short terms (second by second) during the normal operation of the power system. They produce small deviations of the frequency typically inside the normal operation band defined in the grid code and not requiring significant control action beyond the normal multi-layer frequency control. However, several https://doi.org/10.1016/j.ijepes.2023.109730 Received 29 May 2023; Received in revised form 12 November 2023; Accepted 14 December 2023
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 2 J.M. Riquelme-Dominguez et al. types of contingencies can create large power imbalances with substantial consequences to the system frequency security. The sudden disconnection of an appreciable generation power plant or a heavily loaded HVDC interconnector can make a substantial frequency drop (under-frequency event) that typically goes beyond the normal frequency control loops requiring the action of emergency frequency control schemes (e.g., under-frequency load shedding [2]). In power systems, the primary sources of rotational inertia are the traditional large synchronous generators directly connected to the grid. The total system rotational inertia plays an essential role in system frequency security by limiting the rate of change of frequency (ROCOF) [3] as well as providing a natural response to system frequency changes caused by power imbalances [4,5]. As the electricity industry is moving very fast towards a zero-carbon emission sector, the generation portfolio is changing, and more ecological generation units (e.g., wind turbines, solar plants, etc.) are displacing the traditional centralised, and large-size synchronous machinesbased generation units [6,7]. One common characteristic of environmentally friendly generation units is the operation desynchronised from the grid, where the generator is disconnected from the grid and interfaced by a power electronic converter. The growing integration of power electronic-interfaced technologies, like solar photovoltaic, wind power, etc., is rapidly replacing traditional synchronous generatorbased technology, removing many of the excellent natural attributes of synchronously connected generators [8]; one key issue is the reduction of total rotational inertia [9]. Decreasing rotational inertia is a common issue in many power systems around the world, including Great Britain, the Republic of Ireland, Australia and the Nordic countries in continental Europe. As a matter of fact, as a consequence of the expected renewable penetration in the UK power system, its system inertia could experience a reduction of 70% by 2033 in comparison with what it had by 2013 [10]. A parameter closely related to the inertia of a power system is the kinetic energy (KE) stored in the system’s rotating machines. Some transmission system operators (TSOs), such as those in the Nordic Power System (NPS), have been monitoring its value for some time. In the NPS, the total system inertia (and thus kinetic energy) has been reduced as the installed wind power capacity has increased [11,12], some thermal and Swedish nuclear plants have been decommissioned, and the interconnection capacity between the NPS and other power systems has been increased by more than 50% [8,13]. Fig. 1 shows the evolution of the kinetic energy available at the NPS in statistical terms over the period 2017–2022 [14]. Although these values depend on the climatic year in question [15,16], it can be seen that the trend of the maximum and minimum values, the median, and the 25th and 75th percentiles are decreasing [17–19]. Additionally, the histograms in Fig. 1 show a higher concentration of samples at reduced KE values. For the reasons stated above, various TSOs worldwide have been interested in estimating and forecasting the total system rotational inertia for many years [9,20]. However, as the number of synchronous machines connected to the power system reduces, finding out the total rotational inertia becomes increasingly essential to take appropriate actions regarding power system stability. Several methods have been available for utilities for decades to measure (or estimate) the total rotational inertia [21]. The Unit Commitment (UC) method is a monitoring method that, based on the connected/disconnected status of the generating units obtained through SCADA measurements, can determine the total inertia of a power system as the sum of the inertia contributed by each synchronous generator. However, this approach assumes that system inertia is generated solely by synchronous generators, ignoring other potential contributors of inertia. This method calculates the rotational inertia at rated speed if the system has long operational periods on under or over frequency. This is the method used in Nordic countries to estimate the total inertia of the system [22]. The main characteristics of this technique are: it is a Fig. 1. Statistical evolution of the kinetic energy in the NPS in the period 2017–2022. monitoring method, and it is based on adding the inertia on the online generators (GVA.s). A different approach uses frequency measurement before or after a vital disturbance [23], known as event-driven method. Nevertheless, because this method requires an event to determine the inertia, it is unsuitable for real-time application. Furthermore, the result of this technique is a discrete inertia estimation, which is not helpful information for the system operator. In summary, event data-driven is an estimation method based on post-mortem analysis of large events (perhaps blackouts) that cannot be done in real-time. The continuous signal approach can be applied to increase the inertia estimation’s temporal resolution. It is an estimation method based on frequency measurements of Phasor Measurement Units (PMUs) [24,25] or extensible grid measurement units (XMU) that, together with the estimation of the power imbalances that occur in the normal operation of the power system, the method can estimate the total inertia of the system in a near-continuous way [21]. The continuous signal method is an estimation method that can be done by real-time analysis of known simulations or small natural perturbations. National Grid, the TSO in the United Kingdom, has been researching mechanisms for calculating or measuring the total rotational inertia for several years; in fact, it was the first TSO in the world to implement a system to measure total power grid inertia, and more lately, they equipped the so-called ‘‘Grid Data Measurement System’’ (GDMS) [26, 27]. Knowing the system’s actual inertia is a good indicator of power system operation and control, particularly in terms of frequency control [15], but more is needed. As the power system’s total rotational inertia decreases, transients become faster, and control action should be adapted to the new and faster changes; in the end, the control system must shift from responsible to productive, [28,29]. The inertia measurement and calculation systems already in place in several power systems worldwide generate data that can be used to forecast inertia. The predicted inertia is then used to take preventive control actions to avoid the risk associated with long periods of low inertia operating scenarios. National Grid is interested in such systems and began a project called ‘‘Short-term System Inertia Forecast’’ in March 2020. This project investigates the development of a proof-of-concept tool for accurate day-ahead and intra-day inertia forecasting with multi-time resolution. This tool could be used to help with day-ahead frequency response procurement and real-time system operation [30]. In the literature, some works deal with forecasting the inertia or kinetic energy of power systems. In [31], it is proposed to predict the kinetic energy available in the Nordic system by decomposing the time
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 3 J.M. Riquelme-Dominguez et al. series into three components: trend, seasonal and irregular. The results of this study show an error below 5% for predictions on the one-hour time horizon. In particular, it is concluded that it has a mean absolute percentage error of 4% for forecasts with a one-hour horizon and 7% for predictions with 24-hour horizons. Although the prediction error is acceptable, the tests were only conducted with one day (24 h) of data in January 2018. The work [32] uses information theory techniques, precisely information length, to determine the variability of the kinetic energy available in the NPS, allowing them to identify which day and month the maximum and minimum values of KE variability are reached. The developed algorithm also will enable them to make KE predictions, getting a root mean square error of 4.33 GWs. The need for inertia prediction in electricity systems as the penetration of nonconventional generation increases is assessed in [33]. It analyses the tool developed by the Electric Reliability Council of Texas (ERCOT), based on Unit Commitment, to predict the synchronous generators that will be connected in the next three hours in the system and the need to estimate the Primary Frequency Response Reserves (PFR). However, this paper cites an event in which the available inertia in the system was overestimated due to a drop in the price of energy. Heylen et al. [34] are the first to develop a probabilistic prediction model of the contribution of synchronous generators connected to the system inertia, which allows the uncertainty of the predictions to be determined. However, the forecasting does not have sufficient granularity to allow the system operator to execute preventive or corrective actions quickly. In [10], a neural network based on measurements of PMUs (total active power generated by synchronous generators, active power injected through electronic converters, and motors directly connected to the grid) is trained to estimate and predict the inertia of a test system. Although the results achieved are encouraging, it is necessary to extrapolate this methodology to an entire system. Over the last years, machine learning (ML) models have acquired increasing popularity for time series forecasting problems. Compared to classical statistical methods such as ARIMA, ML models can extract temporal patterns without any theoretical assumptions on the data, which reduces the need for complicated pre-processing techniques [35]. Furthermore, ML models are more scalable when dealing with big volumes of data since global models can be built for related time series sharing the learning procedure. Many models have been used for TSF, from simple Linear Regression (LR) to more advanced ensemble approaches such as Random Forest (RF). In particular, deep neural networks have also shown a great capacity to learn temporal patterns from time series. Among deep learning models, recurrent architectures, such as Long Short-Term Memory (LSTM) networks, can be considered the most popular model for capturing long-term dependencies in time series. The advantage of neural networks is that they are more flexible than other ML models, obtaining a greater capacity for generalisation with their deep structure [36]. It is clear that the universe of models used in ML is wide, and the number of emerging techniques increases day a day. It is not the objective of this paper to conduct a complete review and assessment of all possible models, so the authors decided to take a representative of candidate models to be assessed. The number of selected models can be increased, and more methods can be added in the assessment step without affecting the applicability and general use of the proposed methodology. However, the author suggests that selecting the different models may include traditional approaches and more sophisticated deep-learning techniques. In this paper, the author considers Linear Regression (LR) [37], Decision Tree Regressor (DTR) [38], Random Forest (RF) [39], Extreme Gradient Boosting (XGBoost) [40], Multi-layer Perceptron (MLP) [41], Convolutional Neural Network (CNN) [42], and Long Short-Term Memory Network (LSTM) [43]. In the case of power systems applications, ML is used for energy demand-side management [44], fault detection [45], and load and generation forecasting [46,47], among others [48]. Some works deal with inertia estimation using Neural Networks [49,50], but not much has been done using ML algorithms for inertia or kinetic energy forecasting. As reviewed, kinetic energy forecasting is an open problem in the literature. The objective of this paper is to develop a machine learning-based methodology that allows the system operator to know, in advance, the kinetic energy of an electricity system in the short-term (scale of minutes to hours) so that the operator can be provided with accurate forecasting. With this information, the operator can execute corrective actions and give room for manoeuvring in case preventive measures must be taken. The methodology presented in this paper constitutes a guide to performing short-term kinetic energy forecasting in power systems. The methodology aims to be as flexible as possible to apply to any power system, regardless of the data available and the software used. In summary, the main contributions of this paper are listed below: 1. A generic methodology to forecast kinetic energy in power systems, including raw data pre-processing, selection of the best model parameterisation, and the most appropriate past history and forecasting horizon windows, is presented. The word generic refers to algorithms being interchangeable with others except for processing and parameterisation issues. 2. As part of the validation process of the proposed methodology, several ML algorithms (from simple to complex) have been implemented, resulting in a comparison of the accuracy of these algorithms for the specific case of the Nordic power system and considering different time horizons, ranging from a prediction horizon of 15 min to 4 h. The TSO can use these results in case of preventive actions must be taken. 3. The best algorithms obtained from Contribution 2 have been implemented on a real-time simulator, verifying that the proposed methodology can run and forecast in real-time. To the authors’ knowledge, this is the first work implementing machine learning algorithms for real-time time series forecasting in Typhoon HIL real-time simulator. All the necessary files for replicating the results of this work are publicly available at [51]. This research paper is organised as follows: The basic components of kinetic energy in power systems are briefly discussed in Section 2, and the fundamentals of the methodology for time series forecasting using machine learning techniques are presented in Section 3. Section 4 presents the simulation results, Section 5describes the real-time validation, and Section 6discusses the results of the experiments. Finally, Section 7presents the conclusions of this work. 2. Kinetic energy The rotational inertia constant (H) is related to the kinetic energy stored in generators because they are spinning. Large rotational machines provide stored energy due to the rotating mass of their rotor, driving turbine shafts etc. Power systems engineers model this as a number of rotating masses. 𝐻=kinetic energy stored [J] power rating [volt–amperes] (1) Rotational inertia constant (of one machine i,𝐻𝑖in seconds) is the energy stored in the rotor (𝐾𝐸𝑖) when it operates at rated speed expressed as watt-seconds per volt–ampere rating of the machine, as defined in (2): 𝐻𝑖=𝐾𝐸𝑖 𝑆𝑖 (2) Therefore, the total rotational inertia (𝐻𝑇) of the system can be expressed as the sum of the rotational inertia of the individual synchronous generators directly connected to the grid when they are referred to the same power base 𝑆𝑏𝑎𝑠𝑒: 𝐻𝑇= 𝑛 ∑ 𝑖=1 𝐻𝑖⋅𝑆𝑖 𝑆𝑏𝑎𝑠𝑒 = 𝑛 ∑ 𝑖=1 𝐾𝐸𝑖 𝑆𝑏𝑎𝑠𝑒 (3)
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 4 J.M. Riquelme-Dominguez et al. Fig. 2. Flowchart of the proposed methodology. being nthe number of synchronous generators on the same base. Using kinetic energy instead of the system’s rotational inertia avoids referring the inertia constants of each generator to a common basis of calculation. This kinetic energy can be understood as the time, in seconds, required to replace the stored energy when the synchronous generator operates at nominal speed and apparent nominal power. Therefore, the total kinetic energy of a system (𝐾𝐸𝑇) can be expressed as the sum of the kinetic energy stored in each of the nsynchronous generators in operation. 𝐾𝐸𝑇= 𝑛 ∑ 𝑖=1 𝐾𝐸𝑖(4) The NPS operators have been recording the total KE of the Nordic system since 2015 on a minute-by-minute basis using estimates based on Unit Commitment [14]. Looking at this historical record, variations in kinetic energy based on its time horizon can be seen as long-term and short-term variations. Although both impact power systems’ operation, this paper aims to forecast kinetic energy values over a concise time horizon (minutes to hours). 2.1. Long-term KE variations Long-term KE variations are related to system planning studies. In these studies, actions for expanding and improving power systems are determined, impacting time scales ranging from a few months to years. The influence of the electricity market is insignificant, as it affects horizons ranging from weeks to months. 2.2. Short-term KE variations Short-term KE fluctuations refer to variations with time horizons ranging from a few minutes to a few hours. In this case, the intraday electricity market has an influence, as does the remuneration for the contribution of ancillary services. These irradiance variations directly impact the system’s operation and security. A minimum inertia (minimum inertia or inertia floor) is necessary to keep the power system within operational limits after an event. In Australia, minimum inertia has been a prerequisite for operation since the 2016 blackout. The short-term KE forecasting must have a low error, typically below the value of a small plant or generation unit in the system, so that the operator can react by connecting a generator if necessary. In addition, the prediction must arrive in sufficient time for the operator to give the connection command. It is worth noting that this short-term KE prediction is not intended to prevent a blackout but to indicate to the system operator when the KE is moving towards potentially dangerous values. 3. Methodology This section presents a general methodology for performing shortterm kinetic energy forecasting in power systems by the appropriate selection and tuning of machine learning algorithms, and a novel concept of moving window with two subwindows. This section starts with a brief introduction to time series forecasting, followed by a detailed description of the proposed three stages that compose the proposed methodology: pre-processing of the time series data, validation stage using a grid search procedure to select the most suitable model for forecasting, and the final training and testing of the selected model. The methodology aims to be as flexible as possible, making it easy to apply to any power system, regardless of the data available and the computational software used. The three-tables are divided into ten steps grouped. The general flowchart of the proposed methodology is shown in Fig. 2, indicating the flow of process and data. 3.1. Time series forecasting A time series (Y) is a collection of data points arranged chronologically (or listed, graphed, etc.): 𝒀= {𝑦𝑡∶𝑡∈𝑻}(5) where 𝑇is the index set. Typically, a time series is modelled using a stochastic process or a group of random variables called 𝑦𝑡. The time
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 5 J.M. Riquelme-Dominguez et al. series values up to time 𝑡are known in a forecasting context, and the focus is on estimating 𝑦𝑡+ℎusing only the data available at time 𝑡. Additionally, the study of time series can be roughly categorised into two types of modelling: descriptive modelling, also known as time series analysis, and predictive modelling, also known as time series forecasting (TSF). 3.2. Stage A. Data pre-processing A very important step of the methodology is adapting the raw data of the time series for use in the forecasting problem; this stage is named data pre-processing. The proposed methodology includes two steps: filling gaps and data scaling. 3.2.1. Step 1. Filling gaps When the raw data of a time series are available, it is common that there are no values associated with the series in some time stamps. This is due to possible failures in communication, storage problems, estimation problems, etc. Therefore, filling the gap with some nearby known value in such situations is necessary. Two simple options for filling gaps are forward and backward-filling. These methods can be mathematically expressed as (6): 𝑦𝑔𝑎𝑝 ={𝑦𝑡−1, 𝑖𝑓 𝑏𝑎𝑐𝑘𝑤𝑎𝑟𝑑 −𝑓𝑖𝑙𝑙𝑖𝑛𝑔 𝑦𝑡+1, 𝑖𝑓 𝑓𝑜𝑟𝑤𝑎𝑟𝑑 −𝑓𝑖𝑙𝑙𝑖𝑛𝑔 (6) being 𝑦𝑔𝑎𝑝 the missing value, 𝑦𝑡−1 the last valid observation of the time series, and 𝑦𝑡+1 the next valid observation. In this methodology, the back-filling technique has been used because, being a forecasting problem, the next value of the series is unknown. 3.2.2. Step 2. Data scaling Once the gaps in the time series have been filled, the next step is to scale the data. The reason for scaling the data in machine learning problems is that scaling facilitates the optimisation process, achieving a smoother gradient descent and reaching the optimisation convergence faster. For scaling, a new range [𝑦𝑙𝑏,𝑦𝑢𝑏] is defined, being 𝑦𝑙𝑏 and 𝑦𝑢𝑏 the lower and the upper bounds, respectively. Then, each observable value of the time series 𝑦𝑡is standardised (7) according to the minimum (𝑦𝑚𝑖𝑛) and the maximum (𝑦𝑚𝑎𝑥) values of the time series and then scaled (8) by the newly established rank. 𝑦𝑡,𝑠𝑡𝑑 =𝑦𝑡−𝑦𝑚𝑖𝑛 𝑦𝑚𝑎𝑥 −𝑦𝑚𝑖𝑛 (7) 𝑦𝑡,𝑠𝑐𝑎𝑙𝑒𝑑 =𝑦𝑙𝑏 +𝑦𝑡,𝑠𝑡𝑑 ⋅(𝑦𝑢𝑏 −𝑦𝑙𝑏)(8) 3.3. Stage B. Selection and validation of candidate methods The second step of the methodology is to carry out a grid search validation procedure in order to find the most suitable forecasting model and the optimal parameter configuration. The following subsection introduces the assessed models used in this methodology. 3.3.1. Step 3. Assessed models The authors decided to take a representative of machine-learning techniques as candidate models to be assessed. The number of selected models can be increased, and more methods can be added in the assessment step without affecting the applicability and general use of the proposed methodology. However, the author suggests that the selection of the different models may include traditional approaches and more sophisticated deep-learning techniques. In this paper, the author considers Linear Regression [37], Decision Tree Regressor [38], Random Forest [39], Extreme Gradient Boosting [40], Multi-layer Perceptron [41], Convolutional Neural Network [42], and Long Short-Term Memory Network [43]. All these models have many hyper-parameters that must be configured, and this decision can significantly impact the forecasting precision. Therefore, the methodology proposes a grid search validation study to find the most suitable model configuration. Fig. 3. Grid search for hyperparameter selection. 3.3.2. Step 4. Grid search Grid search is a technique used for hyperparameter selection. The grid search technique divides the domain of each hyperparameter of each model into a discrete grid, as depicted in Fig. 3. Let us suppose the model Mwith two hyperparameters 𝜶= {𝛼0, 𝛼1, 𝛼2,…, 𝛼𝑛} and 𝜷= {𝛽0, 𝛽1, 𝛽2,…, 𝛽𝑚}. Grid search evaluates Mfor all possible combinations 𝑀(𝛼𝑖, 𝛽𝑗), with 𝑖∈ [0, 𝑛]and 𝑗∈ [0, 𝑚]. The grid search implementation consists of defining a subset of data for validation purposes and then assessing candidate Musing the already defined grid. Typically, this test is performed on a subset of the time series data to reduce the required run time. In this methodology, it is proposed to use a percentage 𝛿of the time series data to carry out the grid search study. Finally, based on an indicator, the best-performing combination of hyperparameters is chosen for each model. 3.3.3. Step 5. Moving window The approach to using these machine learning models for TSF is to transform the time series into a supervised learning problem using a moving window. As depicted in Fig. 4, a window of fixed size is moved over the time series, creating an input–output instance at each position, 𝑡𝑖. The models receive a window of fixed-length 𝑛𝑝 (past history, PH) as input, 𝑋= {𝑥𝑡𝑖−𝑛𝑝 , 𝑥𝑡𝑖−𝑛𝑝+1 ,…, 𝑥𝑡𝑖−1 }and output as many values as the forecasting horizon (FH) defined, 𝑛𝑓, such that 𝑌= {𝑦𝑡𝑖+1 , 𝑦𝑡𝑖+2 ,…, 𝑦𝑡𝑖+𝑛𝑓 }. 3.3.4. Step 6. Performance indicators A metric for evaluating the performance of the different methods needs to be defined. In this methodology three performance indicators are used, namely: Mean Absolute Error (MAE) calculated in terms of the kinetic energy with units of gigawatt seconds (𝐺𝑊 ⋅𝑠) as presented in (9), the Root Mean Square Error (RMSE) of the calculated in 𝐺𝑊 ⋅𝑠 and defined in (10), and the Mean Absolute Percentage Error (MAPE) measured as a percentage shown in (11). 𝑀𝐴𝐸 =1 𝑛𝑓 𝑛𝑓 ∑ 𝑡=1 |𝑦𝑡−𝑦𝑡|(9) 𝑅𝑀𝑆𝐸 =√ √ √ √1 𝑛𝑓 𝑛𝑓 ∑ 𝑡=1[𝑦𝑡−𝑦𝑡]2(10) 𝑀𝐴𝑃 𝐸 =1 𝑛𝑓 𝑛𝑓 ∑ 𝑡=1 ||||| 𝑦𝑡−𝑦𝑡 𝑦𝑡||||| ⋅100 (11) being 𝑦𝑡the actual value of the time series, 𝑦𝑡the mean forecasted value of the time series at time stamp 𝑡, and 𝑛𝑓 the forecasting horizon length.
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 6 J.M. Riquelme-Dominguez et al. Fig. 4. Detail of the moving window used. 3.3.5. Step 7. Selection of the candidate method At this point, first forecasting is performed with the set of methods defined in step 3, considering the combinations of hyperparameters indicated by the grid search and using only the part of the entire time series belonging to the training and validation sets (𝛿). The models are trained to predict by receiving a past history and returning a forecasting horizon according to the moving window configured in step 5. As a result of the forecasting, the indicators of step 6 are computed to select the model with the lowest error. 3.4. Stage C. Final training and testing The candidate model selected in stage B has to be trained with a more significant number of values of the time series considering different sizes of the moving window, and evaluated with an independent testing dataset. 3.4.1. Step 8. Definition of several moving windows The length of the moving window is a fundamental parameter as it determines the number of past values to be taken into account for forecasting and the number of values to be forecasted. There is a tradeoff between these two magnitudes, and using a past history length multiple of the forecasting horizon length is standard. It is important to note that excessively long past history values do not necessarily improve the forecasting process. The same is true for concise past history values. At this step, different combinations of past history and forecasting horizon are defined to assess which is the one that achieves better results. 3.4.2. Step 9. Training candidate method The selected method is trained using the training data subset. As a result of the training, many trained models are obtained as combinations of moving windows are defined in step 8. In other words, each moving window has an associated model capable of forecasting with these past history and forecasting horizon characteristics. 3.4.3. Step 10. Testing candidate method Finally, the trained models are tested with the testing subset. For each model, the performance indicators are computed. This way, the best-performing combination of the method and moving window can be obtained. Fig. 5. Plot of the raw KE data in NPS, from January 2020 to December 2020. 4. Simulation results: Nordic Power System case The raw KE data used in this investigation is available worldwide at [14]. Sweden, Norway, and eastern Denmark’s transmission grids are all a part of the synchronous inter-Nordic system. Since Mach 2015, NPS operators have been calculating the kinetic energy in real-time, and this research uses that information. Data for the year 2020 have been selected as they have a higher concentration of values at low KE levels. From January 2020 to December 2020, historical data on the total kinetic energy in the NPS (measured in GWs) were collected (both included). There are 527040 points in the KE raw time series, which has a resolution of one sample per minute. During this time, the KE ranges between 130 and 260 GWs, with a standard deviation of 24.63 GWs. A plot of the evolution of the raw KE data over the measured period is shown in Fig. 5. The raw KE data is pre-processed by filling gaps in the backwardfilling method. Subsequently, data scaling is applied, considering that the 2020 KE data has a maximum value of 260 GWs and a minimum value of 130 GWs. The new range for the scaled time series is [−1,1]. In Stage B of our proposed methodology, finding the most suitable combination of ML method, hyperparameters, past history and forecasting horizon values over a large dataset can be impractical and computationally unfeasible. Therefore, given the large number of models explored and the length of the time series dataset, only the first three months of 2020 could be considered for the grid search validation study. This experiment uses the first 20 days of each month as training data and the last 10 days as validation data. Then, the best-performing methods are again trained with the entire training set (the first nine months, from 1st January 2020 to 2nd October 2020) and evaluated with an independent testing set (the final three months, from 3rd October 2020 to 31st December 2020). In this way, a complete procedure of training–validating–testing is performed with independent datasets. The following subsections describe in more detail this procedure. 4.1. Grid search validation for model selection This first experiment allowed the selection of the best-performing models in a feasible time with a grid search procedure using the training and validation sets. The characteristics of this study are set out in Table 1. Besides the parameters detailed, it is worth noting that neural network models are trained for 50 epochs with batch size 512. The Adam optimiser is used, with an initial learning rate of 0.001 and a decay rate 0.96.
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 7 J.M. Riquelme-Dominguez et al. Table 1 Parameter grid search conducted to find the optimal model configurations. Model Parameter Values LR [37] – – DTR [38] Max. Depth 10, 100, None RF [39] Estimators 100, 500 Max. Depth 10,100, None Min. Samples split 2, 10 Min. Samples leaf 1, 4 XGBoost [40] Estimators 100, 500 Max. Depth 3,10, None Learning rate 0.05, 0.1, 0.25 Min. Child weight 1, 5 MLP [41]Num. Layers 1, 2, 3 Neurons 64, 128 CNN [42] Num. Layers 1,2,3 Filters 32, 64, 128 Pooling factor 0, 2 LSTM [43] Num. Layers 1,2,3 Num. Units 32, 64, 128 Return sequences True, false Table 2 MAE (GW s) results of the model selection experiment. Model Jan Feb Mar Mean LR 1.30 1.47 1.10 1.29 DTR 2.05 2.44 2.24 2.24 RF 1.66 2.01 1.65 1.77 XGBoost 1.54 1.70 1.29 1.51 MLP 1.40 1.60 1.21 1.40 CNN 1.33 1.54 1.14 1.34 LSTM 1.23 1.49 1.10 1.27 The grid search study was carried out with data from the first three months of 2020 (January, February, and March), representing 𝛿= 25% of the time series, and performed three independent experiments. The first 20 days of each month are used for training models and the last ten days for validation. The forecast horizon is 1 h, and the past history window is four hours. The metric for evaluating the performance is the MAE of all predictions over the test set. Table 2 presents the mean MAE obtained using the best configuration of each model. As can be seen, LR and LSTM present the lowest error, closely followed by CNN. MLP and XGBoost perform similarly, while RF and DTR are the worst. Therefore, LR and LSTM are the models chosen to test the entire dataset. 4.2. Model evaluation For the final evaluation of the selected models (LR and LSTM), we use data from the first nine months of the KE time series as the training set, and the last three months as the testing set. The resolution of the data is kept to one minute. The study carried out includes experiments with four different forecasting horizons (15 min, 30 min, 1 h and 4 h), and three possible past history window sizes (2, 4, or 6 times the length of the forecasting horizon). It is worth noting that the data resolution together with the forecasting horizons make that the moving window is shifted minute by minute; therefore, each forecasting horizon includes the forecasting of 15, 30, 60 and 240 values, respectively, starting in the next most immediate minute. Linear Regression method was trained with a CPU based on a processor Intel(R) Core(TM) i7-7700 with a RAM of 32 GB, and LSTM method was trained both, with the CPU mentioned above and a GPU based on NVIDIA GeForce RTX 3090 with a VRAM of 24 GB. The average training time for all the combinations of past history and forecasting horizon pairs were computed. LR took 55 s on average for training, and LSTM spent an average of 630 min running on the CPU and 28 min training on the GPU. These training times reflect Table 3 MAE, MAPE, and RMSE results over the test set with different forecasting horizons. PH FH Model MAE MAPE RMSE (min) (min) (GW s) (%) (GW s) 30 15 LR 0.49 0.33 0.60 30 15 LSTM 0.48 0.33 0.60 60 15 LR 0.49 0.31 0.58 60 15 LSTM 0.47 0.31 0.59 90 15 LR 0.49 0.31 0.58 90 15 LSTM 0.46 0.31 0.59 60 30 LR 0.73 0.40 0.87 60 30 LSTM 0.72 0.40 0.87 120 30 LR 0.72 0.40 0.86 120 30 LSTM 0.71 0.40 0.87 180 30 LR 0.72 0.40 0.86 180 30 LSTM 0.71 0.40 0.86 120 60 LR 1.15 0.60 1.36 120 60 LSTM 1.14 0.59 1.36 180 60 LR 1.14 0.59 1.35 180 60 LSTM 1.11 0.58 1.33 360 60 LR 1.16 0.59 1.35 360 60 LSTM 1.09 0.56 1.30 480 240 LR 4.05 2.05 4.88 480 240 LSTM 3.40 1.72 4.07 960 240 LR 3.39 1.72 4.04 960 240 LSTM 3.06 1.56 3.64 1440 240 LR 2.71 1.38 3.21 1440 240 LSTM 2.64 1.34 3.12 the different model complexity of the selected methods. The obtained results are presented in Table 3. As can be seen, for the short-term forecasting horizons (15 min, 30 min, 1 h), there is practically no difference between the performance of the two proposed models. Therefore, LR is the most suitable alternative for short-term forecasting, given its simplicity. In contrast, it can be observed that the LSTM outperforms LR when the forecasting horizon is four hours considering all three different past history windows. In light of the results, the authors propose to use an LR model for a forecasting horizon of one hour and an LSTM neural network for a forecasting horizon of four hours. This is explained because, in time series that are sufficiently regular, simple models such as LR show a high capacity to provide accurate forecasts in the very short term (one hour ahead or less). This suitability of simpler approaches for TSF is a tendency that can be observed in recent works in the literature [52]. Only when the forecasting horizon is incremented deep learning models show a higher forecasting accuracy. The advantage of LR over complex deep networks is that there is no need for an exhaustive hyperparameter search. Therefore, LR is preferred over LSTM for short-term forecasting, given that their accuracy is similar. The only hyperparameter to be configured is the past history window. In contrast, the architecture of the LSTM network involves more parameters. The proposed network for longer-term forecasting has been selected using a grid search methodology that experimented with different number of layers, neurons, and training configurations. The selected model has a single LSTM layer with 64 units. Then, the complete sequence of hidden state outputs is returned to feed the final dense prediction layer. Figs. 6 and 7present the average KE forecasts obtained by LSTM for two weeks in October 2020, using a forecast horizon of 1 and 4 h. As can be seen, the proposed model can capture the time series trend even with a longer horizon. 5. Real-time validation The simulation results obtained in the previous section have been validated using real-time simulations (RTS). RTS are a type of discrete simulation in which all mathematical calculations are executed at each integration step, with the calculation of the next step not starting until
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 8 J.M. Riquelme-Dominguez et al. Fig. 6. Historical and forecasted data of KE in NPS with a forecast horizon of 1 h using LSTM. Fig. 7. Historical and forecasted data of KE in NPS with a forecast horizon of 4 h using LSTM. the simulation clock indicates so. Fig. 8 shows the offline and real-time simulations’ differences. In Fig. 8(a), step computations are obtained faster than required. However, the subsequent step is computed immediately, so the simulation is faster than the RTS. Fig. 8(b) depicts a case in which the physical time is shorter than needed to execute all the equations. Neither case (a) nor case (b) corresponds to an RTS. In RTS, Fig. 8(c), all the calculations must be solved during the corresponding time step. The following step is not computed until the physical clock indicates. This is a synchronised real-time simulation. In this paper, it is essential to check that the selected machine-learning techniques can run in realtime. This ensures that the system operator will have the kinetic energy prediction at the right time to take preventive or corrective actions. The simulation testbed has been configured as described below: a host PC based on an operating system Microsoft Windows 10 Home Pro is connected to the Typhoon HIL-404 simulator via USB. The host PC has a processor Intel(R) Core(TM) i7-7700 with a RAM of 32 GB and is equipped with the required software to monitor and control the Fig. 8. Different types of simulation: (a) Faster than real-time, (b) slower than real-time and, (c) synchronised. Fig. 9. Setup for the real-time validation. real-time simulator, namely Typhoon HIL Control Center V2022.4 sp1. Fig. 9 shows the testbed used for the real-time validation. The two best-performing methods from Section 4, LR and LSTM, have been implemented for real-time validation for four pairs of past history and forecasting horizons. The same test has been replicated, i.e., the already trained LR and LSTM models are used to forecast minute-by-minute KE at the NPS for the last 90 days of the year 2020. The simulations are run from the HIL SCADA, where the commands are initialised to load the necessary libraries. Subsequently, once the simulation starts, the predictions are made from macros executed every
International Journal of Electrical Power and Energy Systems 156 (2024) 109730 9 J.M. Riquelme-Dominguez et al. Table 4 Results of the real-time validation. PH FH Model Avg. execution Overruns (min) (min) time (ms) 90 15 LR 2.69 No 90 15 LSTM 56.8 No 180 30 LR 2.57 No 180 30 LSTM 63.8 No 360 60 LR 2.73 No 360 60 LSTM 83.5 No 1440 240 LR 3.21 No 1440 240 LSTM 126.6 No 250 ms. This allows the simulations to be accelerated so that they run 240 times faster than reality, each taking approximately 9 h. The validation results show that both LR and LSTM can run in realtime, logically obtaining the same accuracy as in Section 4. The time elapsed in each simulation step has been measured for each algorithm, and the average execution time has been calculated, shown in Table 4. It can be seen that while the average calculation time for LR is independent of the past history and the forecasting horizon, for the LSTM method, this time increases as the other two values increase. Even so, it should be remembered that 60 s elapse between one prediction and the next, so there is plenty of time to make the forecast in both cases. In fact, no overrun occurs at any time during the real-time simulations. 6. Discussion The proposed methodology has been tested using offline and realtime simulations, considering real data from the Nordic Power System in 2020. The offline simulations implemented a training–validation– testing routine in which several machine learning models were configured with a grid search procedure to obtain the best parameters of each model. Due to the vast amount of data, the number of hyperparameters, and the number of ML algorithms, the entire raw data of KE was split to reduce the computational burden of the selection and validation stage. The results of this first experiment showed that, for a past history of 4 h and a forecasting horizon of 1 h, both Linear Regression and Long Short-Term Memory Network performed similarly regarding forecasting accuracy. For this reason, both models were selected to be tested with several combinations of past history and forecasting horizon. The selected models were tested in the final training and testing stage, considering several combinations of moving windows and the entire dataset. The minor differences found in relative and absolute errors when the forecasting horizon was less or equal to 1 h showed that Linear Regression is the most suitable method to forecast kinetic energy in the Nordic Power System in a very short time. Its simplicity and training speed are such that it could be trained every 55 s when running on a CPU. However, for longer forecasting horizons of up to four hours, LSTM made it perform better for longer horizons. However, the training time of the LSTM models is approximately 630 and 28, slower than the LR when using CPU and GPU, respectively, which makes the models to be updated more difficult. The results of the experiments explain the reason behind the high forecasting accuracy of LR and LSTM. It is essential to mention that the following phenomenon is relatively common in time series forecasting problems. For short forecasting horizons, the accuracy of the LR indicates a clear linear relationship between the very near future instants and those in the immediate past. Another reason is that the rate of change of the magnitude to be forecasted is slow, i.e., a limited number of past observations is considered adequate to make the forecasting. This linear relationship between past and future becomes diluted over time, and broader forecasting horizons are no longer explained linearly from the past. Therefore, it is necessary to resort to more complex models, such as LSTM networks, to capture more complex patterns and long-term dependencies. Finally, neural network-based models incorporate regularisation techniques such as dropout that help prevent overfitting even in long-term forecasting. The authors believe that, depending on the accuracy requirements, the forecasting horizon, and the equipment available, different solutions can be applied in each case. LR and LSTM were tested using a Typhoon HIL 404 real-time simulator in the real-time validation. The selected models showed the same accuracy as in the offline simulations, but it was verified that the time performance of the LSTM was worse as the forecasting horizon increased. However, there was enough margin to perform the forecasting without overruns, which means that every single computation step of the real-time simulator had room to make all the calculations between subsequent steps. Although the proposed methodology has been used to forecast the kinetic energy of the Nordic Power System as a case study, it aims to be as general as possible to apply to any power system, i.e., data preprocessing, selection and validation of candidate methods and training and testing can be used to any power system independently of its characteristics, the level of renewable penetration, etc. The authors recommend replicating the proposed methodology when considering other power systems datasets, as diverse ML methods can be more suitable for different power systems. 7. Conclusions The high penetration of non-conventional generation, especially those using power electronic converters as the interface to the power grid, in modern power systems requires developing new tools for system operators to anticipate and correct potentially dangerous operating situations caused by low rotational inertia. The authors first proposed a machine learning-based methodology for short-term kinetic energy forecasting in power systems in this paper. Although the proposed methodology has been used to forecast the kinetic energy of the Nordic Power System as a case study, it aims to be as general as possible to apply to any power system, i.e., data pre-processing, selection and validation of candidate methods and training and testing can be used to any power system independently of its characteristics, the level of renewable penetration, etc. The authors recommend replicating the proposed methodology when considering other power systems datasets, as diverse ML methods can be more suitable for different power systems. The machine learning models considered as potential algorithms to be used in the methodology were: Linear Regression, Decision Tree Regressor, Random Forest, Extreme Gradient Boosting, Multi-layer Perceptron, Convolutional Neural Network, and Long Short-Term Memory Network. As a result of the assessment, analysis indicates that the Linear Regression and the Long Short-Term Memory models offer the best results for kinetic energy forecasting horizons of one hour. However, due to its simplicity, the LR method is preferable for such a time horizon. In contrast, for forecasting horizons of 4 h, the Long Short-Term Memory model performs best. These two algorithms have been tested with real KE data from the Nordic system for the last 90 days of 2020, representing 129600 predictions in each simulation. The results show a lower MAE, MAPE, and RMSE compared to other studies available in the literature, especially for those predictions in the very short-term. Finally, real-time validation has been performed to verify that the algorithms can run in real-time. This allows the operator sufficient time to take the necessary measures. Although this work adopted forecasting horizons as long as 4 h, the forecasting was made minute-by-minute with the corresponding shift of the moving window, predicting as many as 240 values in each execution. This fact and the verification that the algorithms can run in a real-time simulator mean that the proposed methodology serves to forecast the kinetic energy of a power system in real-time. In future work, the possibility of training these models online is proposed so that the models can learn from the most recent values and