Methodological Approach for Defining Frequency Related Grid Requirements in Low-Carbon Power Systems

Moving towards low-carbon electricity systems through the massive deployment of renewable energy sources (RES) presents a unique opportunity to combat climate change, but it also poses enormous technical challenges, especially from a frequency viewpoint. To ensure a secure RES integration in terms of frequency stability, system operators worldwide have adopted new grid codes requiring RES to provide fast frequency response (FFR). However, if not properly justified, stringent requirements may pose an unnecessary barrier to further RES development and slow their network integration. In this context, this paper presents a methodological framework for systematically defining FFR requirements for RES to ensure system frequency stability. The proposal comprises: i) a model for simulating the dynamic response of system frequency following a contingency with reduced computational effort, ii) a model for reallocating contingency reserves with economic criteria to avoid loss of load following a contingency, and iii) novel indices for characterizing the dynamic performance of system frequency in terms of key operational characteristics, which are then used for defining frequency related grid codes. The benefits and practicability of our proposal are demonstrated in a case study on the Northern Interconnected System in Chile. We show how our proposal can be used to i) identify system operating conditions in which the contribution of RES with FFR is necessary to avoid loss of load and ii) to propose a technically and economically justified grid code that allows both to foster further RES integration while ensuring power system security.


A. SETS AND SYMBOLS
RIF Index for characterizing the increase in system ramping capability that can be achieved by a cost-efficient redispatch for avoiding the activation of UFLSS The Paris Agreement has brought many countries together to undertake ambitious efforts to combat climate change. One of the main goals reached at the 2015 Paris Climate Change Conference was ''Holding the increase in the global average temperature to well below 2 • C above pre-industrial levels and pursuing efforts to limit the temperature increase to 1.5 • C above pre-industrial levels''. This objective has motivated the worldwide implementation of energy policies for the decarbonization of the electricity systems [1]- [3] by promoting the use of renewable energy sources (RES) such as wind and solar power. For instance, the European Union Renewable Energy Directive has set the goal of generating over 32% of the total power from RES by 2030, and achieve zero-net greenhouse gas emissions by 2050 [3]. The United States has also been encouraging the development of RES at the state level. California and New York have both committed to reach RES penetration levels of 50% by 2030 [4]. At the Latin American level, Chile, Colombia, Costa Rica, Dominican Republic, Ecuador, Guatemala, Haiti, Honduras, Paraguay and Peru have officially declared their commitment to a collective regional objective of 70% of RES by 2030 [5]. In the case of Chile, the government has set the goal of generating at least 70% of the electrical energy from RES by 2050, as well reaching carbon neutrality [2].
Moving towards low-carbon electricity systems presents a unique opportunity to effectively combat climate change, but it also poses enormous technical challenges, especially from a frequency stability perspective. One of the main reasons is because converter-based RES, such as wind and photovoltaic power plants, behave differently than conventional generation facilities [6]. Most RES do not (yet) contribute to either the system frequency regulation or to system inertial response [7]. On the one hand, RES are connected to the grid via power electronic converters, which are usually controlled to inject their maximum available active power into the grid. This means that RES do not keep power reserves for helping to sustain the balance between the generated power and the electric demand during normal operation conditions. On the other hand, RES do not usually provide inertial response to the system as conventional Synchronous Generators (SGs) do. Photovoltaic power plants do not have moving elements, and hence there is no kinetic energy stored as in the case of SGs. As for variable speed wind turbines, the power converter fully or partly electrically decouples the generator from the grid, which implies that the kinetic energy stored in their moving parts is not used for supporting the system frequency recovery [8].
The displacement of a large number of conventional SGs by inertia-less RES can lead to deterioration in both system frequency control and inertial response, thus significantly affecting the dynamic behavior of the system frequency [9]- [11]. This can be especially critical in the case of islanded systems and small isolated systems, where the inertia (without RES) is already low [12], [13]. Reduced system inertia increases the frequency nadir after a loss of a generating unit and leads to a steeper Rate of Change of Frequency (ROCOF) [12]. Hence, the frequency dynamics of the power system becomes faster [6], [14] resulting in more frequent and larger frequency excursions following a sudden power imbalance. Accordingly, the likelihood of experiencing frequency instabilities and loss of load due to the activation of Under Frequency Load Shedding Schemes (UFLSSs) increases [12], [15].
The lack of natural inertial response of RES can be counteracted through the implementation of an additional control loop, specifically designed to force the power converters to respond to these variations. This additional control loop allows RES to provide fast frequency response (FFR) to support the grid during major power imbalances as conventional SGs do [16]. Furthermore, the fast response times of power converters may allow an even faster response of RES compared to conventional power plants [17], [18], thus proving to be an effective alternative for supporting system frequency during contingencies [19], [20]. Wind power plants can also provide FFR by using the kinetic energy stored in their blades. However, this may impose important challenges for the frequency recovery after a fault period [21]. A comprehensive review of different control techniques for providing FFR with solar and wind power plants can be found in [22].
Maintaining the grid frequency within an acceptable range during normal operating conditions and major disturbances is a mandatory requirement for the stable operation of electrical power systems. This is a key issue for avoiding the social and economic consequences that major blackouts may have on the society. For instance, a blackout that occurred in Australia on September 28, 2016, which affected around 1.7 million people, resulted in financial costs of around $367 million AUD [23]. Low system inertia was identified as one of the main reasons for this blackout [24]. In summary, the global drive towards RES is moving conventional power systems dominated by SGs towards low-inertia systems. Ensuring system frequency stability under these circumstances will be even more challenging than it is today.

B. REVIEW OF GRID CODE REQUIREMENTS FOR FAST FREQUENCY RESPONSE FROM RES
To ensure a secure transition to future low-carbon electricity systems with high penetration of RES, system operators worldwide have started to put forward new grid codes requiring FFR in RES. One of the first entities in introducing such grid code was Hydro-Quebec TransEnergie. They require that every wind power plant with nominal generation capacity above 10 MVA must implement a virtual (synthetic) inertia strategy for providing FFR [25]. The virtual inertia defined in this grid code is 3.5 s, i.e., these wind power plants must behave like a SG with such inertia during generation-demand unbalances that produce frequency deviations of about 5% from their nominal value in less than 10 s. The Brazilian grid code requires wind power plants with a nominal generation capacity greater than 10 MVA to contribute to the frequency support by providing a power equal to 10% of the nominal capacity of the wind power plant during power imbalances. The contribution must be kept active for 5 s. This mechanism is thoroughly described in [26]. A similar case can be found in South Africa, where the grid code requires RES to contribute to frequency support with a power reserve equal to 3% of the nominal generation capacity. Depending on the type of generation-demand imbalance (rise or drop), specific requirements are also defined to either deploy power reserves or increase power curtailment [27]. In Puerto Rico, the Transmission Systems Operator (TSO) requires RES to operate with a constant de-load level of 10%. Independent from the type of generation-demand imbalance, RES must be able to change their current generation proportionally to the frequency deviation. The rate of change demanded by the TSO of Puerto Rico is 5% of the capacity per Hertz of frequency deviation [28]. Other countries like Spain, Ireland, New Zealand, and Australia are also generating similar grid codes to force large RES to behave like conventional SGs during power imbalances [1]. For further details regarding different grid codes for frequency support provided by RES, readers are referred to [16] and [29].
Finally, it is important to highlight that grid codes described in [16] and [25]- [29] do not indicate how FFR requirements were obtained.

C. DISCUSSION
All grid codes introduced so far requiring FFR capability in RES share a common characteristic in that none of them have been properly justified, either technically or economically. Accordingly, it is unclear whether or not these requirements are necessary or even sufficient to ensure system frequency stability, or if they represent the most economical alternative. To comply with any kind of FFR obligation, RES must be either operated in a de-loaded mode to keep the required power reserves, or they must incorporate an Energy Storage System (ESS) for providing these reserves. When operating in de-load mode, RES supply only a percentage of their available active power, which reduces their profitability and limits the full utilization of clean energy sources. Similarly, incorporating an ESS increases the investment cost of the project thus making it less attractive to investors. In both cases, requiring FFR capability in RES without a proper justification may pose an unnecessary barrier to further RES development and thus the ultimate goal of decarbonizing electricity systems as a means to limit global warming.
One of the main challenges of developing technically and economically justified frequency related grid requirements is to be able to evaluate the impact of several alternatives on both the frequency stability and the economic performance of the power system while maintaining reasonable computational and human efforts. The traditional and most reliable approach used for assessing system stability is through offline time-domain simulations [30], in which the dynamic phenomena of all system components are modeled and then jointly simulated. Dynamic time-domain simulations require solving a large set of nonlinear differential-algebraic equations (DAEs) and are therefore challenging to perform, computationally intensive, and can easily push computational and human resources to their limits [31]. Consequently, offline stability studies in real-world power systems are usually performed following a worst-case approach, where only a limited set of critical operating conditions and contingencies are considered [30], [32], [33]. These critical conditions and contingencies are usually selected based on the historical performance of the system and the planners' experience [34]. For instance, frequency problems are most likely to arise during periods of low net load, where only a limited number of SGs are available to support frequency response. The critical contingency considered within the traditional worst-case approach is the sudden outage of the largest online generation unit [33]. Although worst-case scenarios used for assessing system stability are usually well defined, this approach may no longer be valid in future power systems with high penetration of RES [33]. Among others, the variability and uncertainty of RES may not only result in a shift of the critical operating conditions, but also in an increase of the number of risky conditions in which system stability may be threatened [34], [35]. Consequently, the traditional worst-case approach may fail to cover all critical operating conditions and contingencies that might result in power system instabilities. Hence, a comprehensive stability assessment in large-scale power systems with high penetration of RES would require performing time-domain simulations for all possible operating conditions and contingencies that the system may experience, which is challenging to perform and not realistically feasible in practice, even for offline applications. This situation is further aggravated if different proposals for the grid code definition are being considered. An alternative approach to time-domain simulations to reduce the computational burden is the use of simplified methods such as low-order System Frequency Response (SFR) models [36], [37] and dynamic equivalents for average system frequency behavior [38]. However, the practical use of these methods for frequency stability assessments in real-world power systems is limiting due to their low precision [39]. Another emerging approach is the use of Artificial Intelligence (AI) techniques. Examples of AI-based models used for frequency stability assessments are v-Support Vector Regression [39], Cross-Entropy Ensemble Algorithm [40], Regression Trees [41] and Artificial Neural Networks [42]. The use of AI-based models allows us to reduce dramatically the time required to compute system stability information by eliminating the need to calculate nonlinear equations [43]. However, in order to capture the relationship between power system operating states and stability information, AI-based methods require having a large number of time-domain simulations available, which also limits their practical application for frequency stability studies in large-scale power systems.
From an economic point of view, stability issues in power systems with high RES penetration have also been studied within power system operational planning. In [44], a simplified representation of governor dynamics is implemented in the economic dispatch problem. The formulation captures the basic dynamic features of governors and adds a linear ramp rate constraint to the underlying optimization problem. The concept of simplifying dynamic representations of frequency stability has been extended to various other problems, such as Unit Commitment (UC) [45], storage integration [46], wind turbine frequency response [47], stochastic scheduling [48], and inertia and frequency response pricing [49]. However, in the aforementioned coupled reserve and energy formulations, the system dynamics (i.e. the set of differential equations) are not are not modeled with enough level of detail to guarantee the accuracy of their results from a stability perspective. This lack of representativeness greatly restricts their practical use in the definition of frequency related grid codes. Although dynamically limited, frequency-constrained UC formulations are useful to obtain minimum cost solutions over all feasible combinations of units that satisfy demand and reserve requirements, thus reducing the number of combinations to be analyzed.

D. OBJECTIVES AND CONTRIBUTION
While many of the challenges related to low-inertia power systems have been highlighted in recent reviews and magazine articles (see for example [6], [7] and [12]), to the best of the authors' knowledge there are no proposals published so far that provide operators or energy regulators with a practical methodology for defining justified FFR requirements for RES.
In the aforementioned context, this paper proposes a methodological framework for defining FFR requirements for large-scale RES power plants from a grid code perspective. To this end, we developed two computer-based models that are executed sequentially and iteratively; whose results are then processed through an innovative statistical analysis. While the first model allows for a fast simulation of the dynamic response of the system frequency following a contingency, the second one allows to reallocate contingency reserves with economic criteria in order to avoid the activation of UFLSSs. The statistical analysis performed afterwards uses novel stability indicators able to characterize the system frequency performance as a function of key system operational parameters. Said indices can then be used straightforwardly by system operators or energy regulators to design justified grid code requirements for FFR. After applying the proposed methodology, the regulator will be able to: 1. identify whether or not the current approach for reserve allocation among conventional generating units can avoid the activation of UFLSSs in all operating conditions; 2. if not always possible, identify critical operating conditions in which the reserve allocation leads to activation of UFLSSs. In these critical cases, determine whether or not a reallocation of power reserves among conventional generating units is enough to avoid the activation of UFLSSs, and; 3. if not, determine the minimum amount of reserves that need to be kept in RES for FFR in order to avoid the activation of UFLSSs.
The proposed models require manageable computational and human efforts, which allows considering a large number of system operating conditions and contingencies. Both models scale well to larger power systems thus ensuring their practical use as a supporting tool for system operators and energy regulators.
In summary, the main contribution of this article is to introduce a practical framework that allows identifying the need of RES to support system frequency with FFR and to help defining such requirements from a grid code perspective in real-world power systems with high RES penetration. Note that altogether the proposed framework, the models and the novel indices for characterizing the system frequency performance represent a practical supporting tool for system operators and energy regulators.
The remainder of this paper is organized as follows: Section II presents the proposed methodological approach for defining justified FFR requirements for RES. Section III presents the results obtained by implementing the proposed methodology in a system based on the Northern Chilean Power System (NIS). Finally, in Section IV we provide our conclusions.

II. PROPOSED METHODOLOGY A. OVERVIEW
The proposed methodology aims to be a practical supporting tool for operators and/or energy regulators in the process of defining justified grid code requirements for FFR in RES to ensure a secure system operation in terms of frequency stability, i.e. in case of the sudden outage of a generating unit (hereinafter a contingency). An overview of the proposed methodology is shown in Fig. 1. The starting point of the methodology is to simulate the power system operation according to the existing energy market. Once the system's operating conditions are obtained for all 8760 hours of the year, we start an iterative process. In each iteration k, we first simulate the system frequency response in the corresponding hour h for all possible contingencies j considering the current allocation of contingency reserves (block ''System frequency response''). For a fast computation, we use here a simplified dynamic model of the system and simulate the evolution of the system frequency in small time steps considering the inertial response of SGs, the delay in the response of their governors, as well as the headroom and ramping capability of each machine. The result of this step in iteration k are the frequency nadir f h,j,k min and the time when this frequency nadir is reached t h,j,k min for each contingency j in the corresponding hour h. Based on these results, we identify the worst contingency at hour h, i.e. the one that leads to the lowest frequency nadir, and evaluate whether or not its occurrence results in activation of UFLSSs. If this is the case, we add this worst contingency to the set of critical contingencies h CC and run an optimization tool that reallocates the contingency reserves among online generating units, including RES (block ''Reallocation of contingency reserves''). The objective of this reserve reallocation is to decrease, at minimum costs, the timeframe required to deploy the contingency reserves and thus avoid the activation of UFLSSs. To keep the problem tractable, this block uses a simplified representation of the system dynamics, as in [44].
The results of this iterative process (performed in all system operating conditions) are critical operating conditions in which a reallocation of contingency reserves is needed in order to avoid the activation of UFLSSs and operating conditions that also require RES to contribute with FFR. These results can be then used to perform a statistical analysis to serve as the basis for the decision-making process of defining justified FFR requirements for RES.
It is important to highlight that the proposed methodological approach does not change either the amount of contingency reserves or the unit commitment of the generating units.
In the next subsections we present in detail the models for simulating the system frequency response following a contingency (block ''System frequency response'') and the model for cost-minimum reserve reallocation (block ''Reallocation of contingency reserves'').

B. SYSTEM FREQUENCY RESPONSE
The dynamics of the system's frequency following a power imbalance can be described using the equation of motion of a single-machine equivalent system as follows: where f (t) and f 0 represent the system center of inertia frequency and its nominal value, respectively (Hz); H sys represents total system inertia (MWs), and P M (t) and P G (t) are the sum of the mechanical and electrical power of all online generating units (MW). During the first seconds after the power imbalance, the mechanical power of the prime movers does not change due to the time delay of the speed governors. The initial difference between the total generated power and the system load is covered by additional power drawn from the kinetic energy of SGs. This natural counter response of SGs remains during several seconds whenever the mismatch between generation and consumption remains. After this initial stage, known as inertial response, the governors of the SGs begin to act upon its valves or gates, leading to an increase in the output power VOLUME 8, 2020 of the turbines. Synchronous machines will thus increase their generation until the balance between generation and consumption is restored and the system frequency has been stabilized.
The effectiveness of the combined action of all SGs during a power imbalance is mainly determined by the delay in the response of the governors, as well as the ramping capability, inertia, and headroom of each machine, which limits the available additional power able to be injected into the system. Fig. 2 illustrates a typical dynamic response of a generator i in case of a power imbalance in the system. Note that the slope r i (MW/s) and the time delay t i d (s) depend on the specific generation technology (for instance, gas, coal, and hydro units exhibit different behavior). Thus, the effectiveness of the combined action of all SGs to reduce the power imbalance and hence the frequency excursion depends strongly on the generation mix available during the contingency. The exact computation of (1) requires the use of complex time-domain simulations, which in real-world power systems with hundreds of SGs and thousands of busbars involves high computational efforts. To overcome this complexity, in this work we simulate the evolution of the system frequency after a power imbalance by approximating the governor's response of each generator i as follows: where t i d is the time delay of the governor (s), r i is the ramp rate (MW/s), and R i is the power reserve of generator i (MW). While R i is a result of the UC formulation, the dynamic parameters t i d and r i must be obtained from actual tests on generators of the power system under study, which, in general, are not publicly available. In this work, the parameters t i d and r i of each SG of the NIS were determined by trial and error using simulated responses of each governor, in the absence of actual data. These simulations were performed in the software DIgSILENT PowerFactory [50], using the official dynamic model of the Chilean power system, which is made available by the Chilean ISO [51].
From (2) it can be seen that each SG starts to change its power output after the time delay t i d of its governor's response.
After this time delay, the power output of generator i increases at a roughly constant slope r i until the amount of reserve R i runs out. The evolution of the system frequency after the outage of unit j can then be described by (3): where H j sys is the system inertia after the outage of unit j (MWs), P j is the power output of unit j before its sudden disconnection (MW), and P i (t) is the change in the power output of unit i due to the governor's action estimated in (2). The term ∂f (t) ∂t in (3) is the system ROCOF. To solve (3) we use the Euler's numerical method using integration steps t of 50 ms as follows. At any point in time t n following a contingency j, we first determine the response of the governors P i (t n ) for each unit according to (2). With the governors' response we estimate the value of the frequency at t n+1 = t n + t according to: Note that f (t 0 ) = f 0 . We follow this procedure until the frequency nadir is reached, i.e. when f (t n+1 ) > f (t n ).
The result of this step for hour h in iteration k are the frequency nadir f h,j,k min and the time when this frequency nadir is reached t h,j,k min for each contingency j. If any contingency leads to the activation of UFLSSs (i.e. if the frequency nadir is below the activation threshold of UFLSSs), we identify the most critical one, i.e. the contingency that results in the lowest frequency nadir, and add it to the set of critical contingencies h CC . In addition, we update the time when the frequency nadir is reached t h,j,k min for all critical contingencies contained in h CC .

C. REALLOCATION OF CONTINGENCY RESERVES
The objective of this block is to reallocate the contingency reserves among online generating units, including RES, at minimum cost, in order to avoid the activation of UFLSSs.
Equations (2) and (3) show that if the generator scheduling and the total amount of reserves are fixed, the ROCOF can be reduced by deploying contingency reserves faster. This action renders the frequency dynamics slower thus increasing the frequency nadir after the power imbalance. The deployment speed of power reserves can be enhanced by increasing the headroom of the fastest generating units, i.e. by reducing the dispatch of units with higher ramp capacity (in MW/s). With this in mind, in this step of the methodology we formulate an optimization problem to find the cost-minimum redispatch of the generating units in such a way that the reserves available are fast enough to keep the frequency nadir above the UFLSS threshold, following the findings in [52]. To this end, we ensure that for each critical contingency j contained in the set h CC , the power reserves are fast enough to cover the power imbalance already by the time when the frequency nadir is reached t h,j,k min , according to the results obtained from the previous step. The mathematical formulation of the optimization problem for hour h in iteration k is the following: Subject to: where P h,k i and C i represent the redispatch of generating unit i in hour h and iteration k and its variable generating cost, respectively; P h,k i represents the dispatch of unit i in hour h and iteration k; R h,k i , P˙i and P i represent reserves available according to the new dispatch and the maximum and minimum power, respectively; R t h,j,k min i is a variable that represents the reserves displayed by unit i by the time t h,j,k min when the frequency nadir after the occurrence of critical contingency j in iteration k was reached, according to the results obtained from the block ''System frequency response''; r i and t i d represent the ramp rate and the response delay of the governor. Finally, P h,k j represents the power imbalance due to contingency j.
The objective function (5) consists of minimizing the redispatch cost of the corresponding operating condition. Constraint (6) ensures that the generation feed-in remains the same after the redispatch. Constraints (7) and (8) limit the dispatch of each unit to its maximum and minimum power, respectively. Note that the reserves of unit i, R i is restricted to be greater than or equal to zero according to (9). Constraint (10) limits the reserve displayed by the time t h,j,k min to the maximum available reserve, for all contingencies j ∈ h CC . Constraint (11) limits the reserve deployed by unit i at the time t h,j,k min according to the time delay t i d and the ramp rate r i of its governor. Finally, constraint (11) ensures that the deployment of the power reserves among all units by the time t j,k min covers the power imbalance of the corresponding contingency j.

III. CASE STUDY
In this section we demonstrate the practicability of our methodology using a case study based on the Northern Interconnected System of Chile (NIS). The proposed methodology was implemented in Matlab 2017 and the simulations were done in a computer with Intel Core i5 8600K, 2.4 GHz and 24 GB of RAM.

A. SYSTEM DESCRIPTION
The model of the NIS consists of 458 buses, 213 lines, 258 loads and 73 generation units. The total installed capacity of conventional generation units is equal to 4.6 GW. Its generation capacity is thermal-based, geared towards the mining industry. The yearly demand profile is roughly constant, with an average value of 2150 MW and a peak value of 2465 MW. Fig. 3 presents a single-line diagram of the power system under study. Conventional SGs of the NIS are characterized by low ramping capabilities and low levels of inertia. To increase the share of RES in the system, our case study includes 1.65 GW of solar power, based on RES projects currently being under consideration. Hence, RES represent a 26% of the total installed capacity of the system. Considering this scenario, the total system inertia varies between 0.34 s and 2.2 s during the year. Solar profiles and the power demand were obtained from [53].

B. MARKET SIMULATION
To simulate the yearly economic operation of the system, we implemented a traditional UC formulation [54], and computed the system operation for all 8760 hours within the year. VOLUME 8, 2020 For each hour, the total power reserve requirements of the system were set equal to the power output of the largest online SG. In this step, these reserves were allocated only among online SGs, i.e. without RES contribution, following the criteria established by Chilean ISO. Fig. 4 shows the resulting duration curve of the total demand and the net load. From this figure it can be seen that while the demand is almost constant throughout the year, the net load exhibits high variations. The maximum instantaneous RES penetration is 92% of the total demand.

C. FAST FREQUENCY RESPONSE REQUIREMENTS TO ENSURE SYSTEM FREQUENCY STABILITY
Based on the system operating conditions, we evaluated the system frequency response using the methodological approach described in Section II.B. As a result, we obtained that in 1881 of the 8760 operating conditions (21.47%), the occurrence of at least one contingency resulted in a frequency nadir below the UFLSSs threshold defined by the Chilean regulatory framework (49 Hz). This shows that the power reserves allocation obtained from the UC does not always allow the system to ride through major power imbalances without activation of UFLSSs.
As for the computational performance, determining the frequency nadir of each operating condition (for all contingencies) required on average 0.0591 s. Therefore, computing the frequency nadir sequentially for all 8760 operating conditions and contingencies required around 9 minutes. Note that this computation can be run in parallel and therefore significant time can be spared.
Next we determined the cost-efficient redispatch that allows maintaining the system frequency above the defined threshold in all 1881 critical operating conditions identified in the previous step. For this, we used the methodological approach presented in Section II. As a result, we obtained that RES must contribute with FFR in 760 hours of the 1881 hours that required redispatch, i.e. during 8.7% of the hours of the year. In the remaining 1121 hours, a reserve reallocation among SGs was enough to maintain system frequency above the UFLSS threshold. The maximum and minimum power reserves required by RES were 70 MW and 6.8 MW, respectively, representing 6.3% and 0.42% of the available RES power at the corresponding hour. The average value of RES reserves during the year is 27.8 MW, which corresponds to a yearly spilled energy of 2114 GWh (0.42% of the yearly available RES energy). Fig. 5 shows the duration curve of the redispatch power in percentage of the total dispatch. From this figure it can be seen that the maximum amount of redispatch for a single hour is 18.6% (214.9 MW) whereas the average value among all critical operating conditions is 7.25%. As for the computational performance, computing the costefficient redispatch required on average 20 s. Overall, a total of 205142 iterations were required to obtain the final results (59 hours in total). Among all operating conditions that required a reserve reallocation to avoid the activation of UFLSSs, the maximum number of iterations was 271 (for a single operating condition), while the average number of iterations was 55.5. Note that the aforementioned performance can be significantly enhanced by running the methodology in parallel for each operating condition.

D. DYNAMIC VALIDATION
In order to validate the obtained results obtained so far, we implemented a full dynamic model of the NIS in DIgSILENT PowerFactory and performed time domain simulations in several operating conditions and contingencies. To allow RES to contribute to FFR, we incorporated a control loop in PV power plants that allows them to react to system frequency changes. The control scheme considers a lowpass filter to reduce the noise present in the derivate of the frequency [32].
Next we present the results obtained in four hours of the year with high instantaneous penetration of RES. Table 1 summarizes the main characteristics of these operating points.
The hour 2054 is the hour of the year with the highest instantaneous share of RES and with the minimum value of system inertia (0.34 s). In this operating condition, 92% of the total system demand (1593 MW) is initially supplied by solar power plants (1472 MW) and the remaining 8% by SGs (121 MW). Contingency reserves are 197 MW. In this hour, the results of our methodological approach showed that a total of 96 MW of reserves must be reallocated in order to avoid the activation of UFLSSs. From this amount, only 48 MW had to be allocated in RES power plants, which represents 3.3% of the corresponding total solar power available. The remaining amount of contingency reserves (149 MW) are kept among SGs. Accordingly, after the reserve reallocation, the RES penetration is reduced from 92% to 89% of the system demand (1424 MW), while the power feed-in by SGs increased from 8% to 11% (169 MW). Note that our methodology only allows redispatching SGs in operation, meaning that the system inertia remains the same after the reallocation process. Fig. 6 shows the frequency evolution following the loss of the largest generating unit in hours 2054 and 2035 (Fig.6 a) and b), respectively). In this figure, the red curves show the frequency evolution considering the original dispatch without reserve reallocation, and the blue curves show the frequency evolution with the dispatch obtained after the reserve reallocation using our proposed methodology. As for the amount of reserve reallocation, in hour 2054 the power feed-in of the largest unit increased from 60 MW to 84 MW after applying out methodology. In case of hour 2035, the power feed-in of the largest unit generates increased from 60 MW to 100 MW. From Fig. 6 it can be seen that in both hours, the frequency evolution considering the original dispatch without reserve allocation (red curves) results in a frequency drop below the security limits, which leads to the activation of UFLSSs. The activation of UFLSSs is successfully avoided when the power system operates with the reserve allocation obtained from our methodology (blue curves). These results show that the proposed methodology is able to identify risky operating conditions in terms of frequency stability, and also to propose a reserve reallocation considering FFR contribution of RES that allows avoiding the activation of UFLSSs.
To showcase the performance of our proposed methodology in identifying a-priori non risky conditions, i.e. in which no reserve reallocation is required, in Fig. 7 we present the frequency evolution following the loss of the largest generating unit in operation in hour 5314 (blue curve) and in hour 2225 (blue dashed curve). Note from Table 1 that both hours had a significant instantaneous RES penetration level. However, no reserve reallocation was required according to our proposed methodology.
From Fig. 7 is can be seen that in both cases, the disconnection of the largest generating unit in operation does not trigger the activation of UFLSSs. These results are significant  because they show that high instantaneous penetration of RES does not necessarily pose a threat to system frequency stability, and therefore imposing RES to contribute with FFR is unnecessary. VOLUME 8, 2020 The dynamic results presented above validate the proposed methodology as a valuable tool for: i) identifying risky operating conditions in which reserve allocation is necessary to avoid the activation of UFLSSs during contingencies and ii) successfully prevent loss of load through a cost-effective reserve reallocation among generating units. Similar dynamic results were obtained with other operating conditions. These results are not presented here for brevity purposes.
Observe from Fig. 6 that the reserve reallocation obtained with the proposed methodology is rather conservative, meaning that less reserve reallocation could have been considered. This over-conservative result may be a consequence of the simplifications regarding the load response to frequency deviations, which is not modeled by the reduced-order frequency dynamics (3). The detailed dynamic simulation of the NIS in DIgSILENT PowerFactory includes the frequency response of large mining companies in the area, composed by large and numerous synchronous and induction motors. In future work, it may be important to improve the model in (3) to include a representation of load dynamics, in order to obtain a less conservative and thus more economic reserve reallocation. Still, it is worth mentioning that, when dealing with system stability, the adoption of a conservative approach has been historically the common practice among TSOs, even if this means introducing additional costs in the power system operation.
In summary, the results presented so far allow us to draw three significant conclusions. The first one is that the current approach for allocating power reserves in the Chilean system may not be appropriate with high penetration levels of RES. This result provides powerful evidence for the energy regulator regarding the need to review current market design and norms for assigning reserves among generating units. The second conclusion is that, in scenarios of high penetration levels of RES, the system under study can successfully avoid loss of load if RES power plants support the system frequency with FFR. Finally, the third conclusion is that high levels of RES do not necessarily pose a threat to the system frequency stability. Accordingly, the question of under which operating conditions RES should contribute with FFR should not be answered based on the instantaneous RES penetration level only. These results provide powerful evidence for the energy authorities regarding the need to review current protocols for allocating power reserves among generating units, as well as the need to design appropriate grid codes in terms of the FFR requirements to be fulfilled by RES power plants. Next, we showcase how the results obtained from our methodological approach can actually be used for designing such grid code.

E. STATISTICAL ANALYSIS
In this section we show how the results obtained with our methodology can be used to formulate FFR requirements for RES throughout an innovative statistical analysis. Fig. 8 shows the RES reserves needed for FFR as a function of the instantaneous RES penetration level for each operating condition. In this figure, blue dots represent operating conditions that did not require a redispatch (6879 hours), green dots represent those that required reserve reallocation but only among online SGs (1121 hours); and red dots represent those that required reserve reallocation among SGs and RES (760 hours). From this figure, it can be seen that the contribution of RES with FFR is not necessary for instantaneous RES penetration levels below 43%. This means that below this level the system frequency performance can always be ensured by only allocating contingency reserves among conventional SGs. Note that not every operating condition with an instantaneous RES penetration levels above 43% requires RES reserves to sustain frequency stability. To identify operating conditions in which RES must keep contingency reserves for FFR, we performed a statistical analysis based on stability indicators that are able to characterize the system frequency performance. The simplest indicators that can be used for this purpose are system inertia and system ramping capability (in MW/s), since both are well-recognized factors that influence system frequency performance during contingencies. In Fig. 9 we show the system inertia and the total system ramp in each operating condition. The total ramping capability of the system is determined as the averaged ramp capacity among all SGs that contribute with power reserves. From Fig. 9 it can be seen that operating conditions that required RES to keep power reserves for FFR (red dots) always have low system inertia (H sys below 1.51 s) and low system ramp capacity (r sys below 51.9 MW/s). Still, not all operating conditions fulfilling these conditions, H sys < 1.51 s and r sys < 51.9MW/s, require RES to contribute with FFR during contingencies. In fact, from all 1121 operating conditions that require redispatch without RES reserves (green dots), 520 fall within this area, showing that the statistical analysis cannot only be based on these two indicators.
To identify critical operating conditions that may require RES reserves, we introduce a novel index that characterizes the dynamic performance of system frequency in terms of key . System inertia and ramp for each operating condition and contingency. Depicted in blue are operating conditions and contingencies that did not require any redispatch, in green those that required redispatch of SGs but no FFR of RES, and in red those that required FFR of RES.
operational features. The formulation of this index considers that: i) higher values of system inertia and system ramping capability improve the system frequency performance and ii) higher values of power imbalance reduce it. The proposed index called HRP, is defined as follows: where H h sys and r h sys represent the system inertia and the system ramping capability in hour h for the original dispatch, respectively, and P h max represents the maximum power imbalance in case of a contingency. Note that the higher the value of the HRP index the better the system frequency performance should be.
To verify the performance of the proposed index in identifying operating conditions in which the RES contribution to FFR should be mandatory, in Fig. 10 we show the amount of RES reserves needed for FFR and the value of the HRP index (one dot for each operating condition).
In Fig. 10, the vertical dotted line (HRP = 0.411) divides the figure into 2 parts: i) on the left are all operating conditions that require redispatch (1121 green and 760 red points), and ii) on the right are all operating conditions that did not require any redispatch (6879 blue points). This shows that the HRP index allows us to identify critical operating conditions from a frequency stability point of view, but it does not allow us to identify the conditions in which RES reserves are mandatory.
To identify these conditions, we propose a second index called RIF, which reflects the difference in the deployment speed of power reserves (system ramping capability) between the original generation dispatch and the dispatch obtained after applying our methodology. The proposed index for hour h is defined as follows: where r f ,h sys represents the system ramping capability in hour h obtained after applying the proposed methodology. In Fig. 11 we show both indicators for all system operating conditions under study (8760 hours). From Fig. 11 it can be seen that the joint use of both indicators allows us to clearly identify under which system operating conditions the FFR contribution from RES should be mandatory (dashed area). Although in the dashed area there are still some operating conditions that do not require RES reserves for FFR (green points), they only represent 0.33% of the total operating conditions of the year, and therefore can be disregarded without any apprehension. In next section we present how these indices can be straightforwardly used to design justified grid code requirements for FFR. VOLUME 8, 2020

F. PROPOSAL FOR GRID CODE GENERATION
In this last section we show how the proposed methodology can be used as a supporting tool for system operators and energy regulators in the process of defining justified grid code requirements for FFR in RES. Considering the results presented so far, the Chilean energy regulator could define FFR requirements for RES as follows: ''All RES must contribute with fast frequency response during hour h, by keeping a contingency reserve equal to 7% of their available power. The hours of the year in which this requirement is mandatory must be determined based on the day-ahead operational planning, and will be those hours h where: 1. To evaluate the economic impact of adopting the grid code proposal presented above, we simulated once again the yearly economic operation of the system, but this time considering the contingency reserves that must be kept by RES to support system frequency stability. As a result, we obtained that the adoption of the proposed grid code increases the total system generating costs in only 0.037%. The yearly renewable energy curtailment was 4.71 GWh, which represents only 0.094% of the available RES capacity. These results show that, even though the proposed grid code is rather conservative, it has a low impact in both the economic performance on system and the amount of renewable energy curtailment. However, a significant improvement in the system frequency stability can be obtained.
It is important to highlight that the FFR requirement presented above is just an example of how the results obtained from our methodology can be used to define the pertinent grid code article. In this example, we require RES to keep 7% of their available RES power to contribute with FFR following the results obtained with our proposed methodology, where the maximum amount of reserves required for RES to contribute with FFR in order to avoid the activation of UFLSSs was 6.3% of their available capacity (see Fig. 10). Note that this conservative criterion is not mandatory. Other less conservative approaches can be used as well. The main advantage of our proposed methodology and indicators is that they provide a large amount of valuable information with relatively low computational and human efforts, allowing system operators and/or the energy regulators to explore and analyze a large number of scenarios before formulating the grid code.

IV. CONCLUSION
In this article we presented a novel methodological approach for defining FFR requirements for RES from a grid code perspective. Our proposal also included the introduction of novel indices for characterizing the system frequency performance in terms of key system operational features. These indices can then be used to identify system operating conditions where the FFR of RES should be mandatory in order to ensure frequency stability.
The results obtained in a study case based on a model of the Northern Interconnected Power System (NIS) of Chile show how our proposed methodology and indices can contribute to the definition of justified grid code requirements for RES. We show that in a scenario of high shares of RES in the NIS, the sole allocation of contingency reserves among SGs is unable to prevent the loss of load in a large number of operating conditions. However, with a cost-effective reallocation of contingency reserves among SGs and RES, system security can be ensured. These results were validated by means of time-domain simulations.
Based on the results obtained, we proposed a FFR requirement to include in the Chilean grid code. The requirement establishes that RES must contribute with FFR with a power equals to 7% of their available power if the instantaneous RES penetration level is above 40% and the values of the RIF and HRP indices are bigger and lower than 1.3 and 0.42 respectively.
The main contribution of our proposed methodology is that it provides the corresponding authority with a practical tool for designing grid code requirements systematically for FFR capability in RES and therefore ensures a flawless and secure integration of these types of generating technology.
One area of improvement that will be addressed in a future work is to include load dynamics in the reduced-order representation of system frequency dynamics. This may lead to less conservative and thus more economic reserve reallocation solutions that allow avoiding the activation of UFLSSs in case of extreme contingencies.