Optimal Sizing of Energy Storage System for Operation of Wind Farms Considering Grid-Code Constraints

Transmission system operators impose several grid-code constraints on large-scale wind farms to ensure power system stability. These constraints may reduce the net profit of the wind farm operators due to their inability to sell all the power. The violation of these constraints also results in an imposition of penalties on the wind farm operators. Therefore, an operation strategy is developed in this study for optimizing the operation of wind farms using an energy storage system. This facilitates wind farms in fulfilling all the grid-code constraints imposed by the transmission system operators. Specifically, the limited power constraint and the reserve power constraint are considered in this study. In addition, an optimization algorithm is developed for optimal sizing of the energy storage system, which reduces the total operation and investment costs of wind farms. All parameters affecting the size of the energy storage systems are also analyzed in detail. This analysis allows the wind farm operators to find out the optimal size of the energy storage systems considering grid-code constraints and the local information of wind farms.


Introduction
Wind energy is a renewable energy source that has been dramatically exploited in recent years. The Global Wind Energy Council has estimated that the cumulative installed wind power has reached approximately 540 GW in 2017, and this number may reach up to 840 GW by 2022 [1,2]. To convert the wind's kinetic energy into electricity, a huge number of wind turbine generators (WTGs) are installed and grouped to form a wind farm (WF) system. The WF system is operated by an energy management system [3][4][5] to achieve the common objectives for the whole WF system. For instance, an optimization method is proposed in [6] to adjust the set-points of WTGs for maximizing the output power of the entire system.
The output power of the WF system usually fluctuates and is highly dependent on the variations in the wind speed. This may not cause any major issue to the operation of the power system with small WF systems; however, WF systems have been recently developing, and they usually have a large capacity with a vast number of WTGs. A small change in wind speed can cause large fluctuations in the output power of WF systems, which can cause several difficulties in the operation of the power system, even causing instability of the whole system [7,8]. Therefore, transmission system operators (TSOs) often impose different requirements for the operation of large WF systems to ensure the stability of the power system; so-called grid-code constraints [9][10][11]. WF systems need to meet these requirements during the connection time to the power system. However, wind energy is variable and cannot be predicted accurately. There is always an uncertainty factor in determining the output power of the WF system. To mitigate the effect of the uncertainty in wind speed, energy storage systems (ESSs) are often installed in WF systems [12,13]. An optimal structure of a hybrid photovoltaic and wind power supply is presented in [14], an off-grid mode using ESSs to improve power supply reliability. Similarly, an optimal structure of a WF presented in [15] uses kinetic energy storage to enhance the reliability of the power supply.
ESSs can also play a role of an energy buffer to maintain the power balance between load demand and the output power of the WFs [16], and also to maintain frequency control [17,18]. The authors in [19,20] have proposed an optimization dispatching strategy to eliminate the forecasting error and to maintain the output power smoothing under normal operation. The authors in [21] proposed an optimal control strategy for ESSs to reduce wind power curtailment in a WF. The authors in [22] introduced a management policy for ESS installation to support the WF system in grid-connected mode and maximize the economic benefit for this integrated system.
Most of the existing studies available in literature only use ESSs to support WFs in power balancing [16], frequency control [17,18], power fluctuations smoothing [19,20], reducing wind power curtailment [21], or increasing economic benefits [22]. In the operation of WF systems, a violation of grid-code constraints may result in the WF operator being subject to paying a high amount of penalties. The penalties usually come from the power mismatch between the amount of commitment power and the actual output power, which is caused by the uncertainty of the wind speed in WF systems. Furthermore, the requirement of reserve power significantly reduces the amount of output power of the WF system. This is because a large amount of spinning reserve might be required at the WTGs. The ESS can play a role of a reserve capacity source and can potentially reduce the amount of required spinning reserve power and thus, increase the output power of the WF. However, the use of ESSs in supporting WFs to fulfill grid-code constraints has not been considered in existing studies [16][17][18][19][20][21][22]. Therefore, this study proposes an operation strategy to optimize the operation of the WF system using ESSs. The ESSs can support the WF systems in handling different grid-code constraints issued by the TSO, including reserve power and limited power constraints. These constraints ensure that a certain amount of reserve capacity is maintained in the WF system and the injected power from the WF into the power system is always less than or equal to a predetermined limited power. In addition, to reduce the investment costs of ESSs, a mixed-integer linear programming (MILP)-based optimization model is formulated to find out the optimal size of an ESS considering the two different gridcode constraints. The cost function includes the penalty of the power mismatch between the committed power and the actual output power, the investment and operation costs of the ESS, and the profit of selling power to the power system. The total yearly cost of the ESS includes four different cost categories (i) cost of power conversion system, (ii) cost of battery, (iii) cost for the balance of the plant, (iv) annual O&M cost of the ESS. The optimal solution is found by taking a trade-off between the investment and operation costs of the ESS and the profit gained by the WF system. In addition, the effects of different parameters on determining the optimal size of the ESS are analyzed in detail with two constraints from the TSO. WF operators typically collect the entire information of the WF system, including wind speed data, the uncertainty of wind speed, the requirement of the TSO, penalty value, and market price. With this detailed information of a WF system, the detailed analysis in this study allows WF operators to easily determine whether or not to install an ESS and find the optimal size of the ESS.

Operation of WF System
Wind power plays an important role in coping with load growth in a power system and at the same time in cutting capacity from fossil fuel power plants. However, the uncertainty of wind power also causes many difficulties in the operation of the power system. This section presents the operation of WFs considering wind uncertainty and different grid-code constraints. In addition, the effects of ESSs on the operation of WFs is also analyzed in detail.

WF System Configuration and Operation
A WF usually consists of many WTGs and is installed over a huge area. Therefore, all adjacent WTGs are often grouped to form a cluster. In a WF system, there might be several clusters, and the output power of each cluster is adjusted to help the WF to meet all grid-code constraints. The set-points of each cluster or WTG are controlled by a center controller (i.e., a WF operator). The control scheme is summarized as follows: • Firstly, wind speed information is measured locally at each WTG. The available power is then computed and communicated to the WF operator; • The WF operator calculates the total available power in the WF and determines the optimal amount of output power considering grid-code constraints; • Finally, the set-points of each cluster/WTG is determined and implemented at each WTG unit.
In this study, a WF with 20 WTGs is used to evaluate the proposed method and the 20 WTGs are grouped into four clusters, as shown in Figure 1. An ESS is used to improve the performance of the WF. In order to reduce the investment and operation costs for the WF system, different optimization algorithms have been investigated to find out the optimal size of the ESSs using the Voltra model [23], the hybrid particle swarm optimization-genetic algorithm [24], or an MILP [25]. In Section 4, the optimal sizing of the ESS is also discussed in various scenarios using an MILP-based model.
Wind power plays an important role in coping with load growth in a power system and at the same time in cutting capacity from fossil fuel power plants. However, the uncertainty of wind power also causes many difficulties in the operation of the power system. This section presents the operation of WFs considering wind uncertainty and different grid-code constraints. In addition, the effects of ESSs on the operation of WFs is also analyzed in detail.

WF System Configuration and Operation
A WF usually consists of many WTGs and is installed over a huge area. Therefore, all adjacent WTGs are often grouped to form a cluster. In a WF system, there might be several clusters, and the output power of each cluster is adjusted to help the WF to meet all grid-code constraints. The set-points of each cluster or WTG are controlled by a center controller (i.e., a WF operator). The control scheme is summarized as follows: • Firstly, wind speed information is measured locally at each WTG. The available power is then computed and communicated to the WF operator; • The WF operator calculates the total available power in the WF and determines the optimal amount of output power considering grid-code constraints; • Finally, the set-points of each cluster/WTG is determined and implemented at each WTG unit.
In this study, a WF with 20 WTGs is used to evaluate the proposed method and the 20 WTGs are grouped into four clusters, as shown in Figure 1. An ESS is used to improve the performance of the WF. In order to reduce the investment and operation costs for the WF system, different optimization algorithms have been investigated to find out the optimal size of the ESSs using the Voltra model [23], the hybrid particle swarm optimizationgenetic algorithm [24], or an MILP [25]. In Section 4, the optimal sizing of the ESS is also discussed in various scenarios using an MILP-based model.

Grid-Code Constraints
Grid-code constraints are the requirements for WF operation that are issued by TSO at the point of common coupling. The output of the WTGs is adjusted to help the WFs fulfill these requirements. In the Korean power system, grid-code constraints are applied to all renewable energy sources with an installed capacity exceeding 20 MW, and the requirements for renewable energy systems include different aspects, as follows [26]:

Grid-Code Constraints
Grid-code constraints are the requirements for WF operation that are issued by TSO at the point of common coupling. The output of the WTGs is adjusted to help the WFs fulfill these requirements. In the Korean power system, grid-code constraints are applied to all renewable energy sources with an installed capacity exceeding 20 MW, and the requirements for renewable energy systems include different aspects, as follows [26] In the operation of WF systems, all grid-code constraints should be satisfied. In this study, we focused on maximizing the active output power of the WF with the ESS. Therefore, only the active power control is considered and analyzed in detail, while the other constraints are assumed to be fulfilled during the WF operation. The Korean grid-code often requires three constraints for active power control, including (i) the absolute production constraint (i.e., limited power mode); (ii) the delta production constraint (i.e., reserve power mode); and (iii) the power gradient constraint [26]. In the absolute production constraint, a predefined limited power is required to avoid overloading. In the delta production constraint, a certain amount of reserve capacity is maintained in the WF to support the power system in emergencies. In the power gradient constraint, ramp-up and ramp-down for the output of active power are bounded by 10% of the rated power per 1 min.
In this paper, the three above-mentioned active power constraints are considered for the operation of the WF with the ESS. Figure 2a shows the constraint for the output power of the WF in limited power mode. The actual output power is limited by a predefined value determined by the TSO. It can be seen that if the available power of a WF is less than the limited power, the set-point of the WF is the available power, while the available power of the WF exceeds the limited power, the WF must shed the surplus power and maintain output power at the limited value. The second grid-code constraint is the requirement of the total reserve power in a WF system. WFs must be able to support the power system in an emergency. Therefore, a certain amount of reserve power is required in the WF system, as shown in Figure 2b. The WF operator needs to adjust the output power of the WTGs to maintain a required amount of reserve power during the grid-connected time of the WF system. This reserve capacity is usually set to a fixed percentage of the available power of the WF. The third grid-code constraint is the requirement of ramp-up/ramp-down for the output power of the WF. This constraint can be easily met by setting the ramp-up and ramp-down of each WTG in the WF system.
In the operation of WF systems, all grid-code constraints should be satisfied. In this study, we focused on maximizing the active output power of the WF with the ESS. Therefore, only the active power control is considered and analyzed in detail, while the other constraints are assumed to be fulfilled during the WF operation. The Korean grid-code often requires three constraints for active power control, including (i) the absolute production constraint (i.e., limited power mode); (ii) the delta production constraint (i.e., reserve power mode); and (iii) the power gradient constraint [26]. In the absolute production constraint, a predefined limited power is required to avoid overloading. In the delta production constraint, a certain amount of reserve capacity is maintained in the WF to support the power system in emergencies. In the power gradient constraint, ramp-up and ramp-down for the output of active power are bounded by 10% of the rated power per 1 min.
In this paper, the three above-mentioned active power constraints are considered for the operation of the WF with the ESS. Figure 2a shows the constraint for the output power of the WF in limited power mode. The actual output power is limited by a predefined value determined by the TSO. It can be seen that if the available power of a WF is less than the limited power, the set-point of the WF is the available power, while the available power of the WF exceeds the limited power, the WF must shed the surplus power and maintain output power at the limited value. The second grid-code constraint is the requirement of the total reserve power in a WF system. WFs must be able to support the power system in an emergency. Therefore, a certain amount of reserve power is required in the WF system, as shown in Figure 2b. The WF operator needs to adjust the output power of the WTGs to maintain a required amount of reserve power during the grid-connected time of the WF system. This reserve capacity is usually set to a fixed percentage of the available power of the WF. The third grid-code constraint is the requirement of rampup/ramp-down for the output power of the WF. This constraint can be easily met by setting the ramp-up and ramp-down of each WTG in the WF system.

Operation of WF with ESS
As mentioned earlier, the uncertainty of wind speed can lead to large fluctuations in the output power of WFs. Furthermore, the total output power of WFs is also significantly

Operation of WF with ESS
As mentioned earlier, the uncertainty of wind speed can lead to large fluctuations in the output power of WFs. Furthermore, the total output power of WFs is also significantly reduced due to the grid-code constraints. The use of ESSs is intended to increase the output power of WFs in both operation modes (i.e., reserve power and limited power modes), thereby improving the efficiency of the WFs. The benefits of ESSs are analyzed in detail in different scenarios. Figure 3a shows the actual output power of WFs in limited power mode. It can be seen that WFs must curtail a large amount if the available power is higher than the limited power at t 1 , while the output power of the WF is much smaller than the limited power after a few next intervals at t 2 . Using ESSs allows the WF operator to shift the surplus power from the high output power periods to the low output power periods. Therefore, with ESSs, the WF not only reduces the amount of curtailment power but also increases the amount of output power, as shown in Figure 3b.

Limited Power Mode
in different scenarios. Figure 3a shows the actual output power of WFs in limited power mode. It can be seen that WFs must curtail a large amount if the available power is higher than the limited power at t1, while the output power of the WF is much smaller than the limited power after a few next intervals at t2. Using ESSs allows the WF operator to shift the surplus power from the high output power periods to the low output power periods. Therefore, with ESSs, the WF not only reduces the amount of curtailment power but also increases the amount of output power, as shown in Figure 3b.

Reserve Power Mode
In this operation mode, a certain amount of spinning reserve capacity is maintained in the WF, which depends on the available power of the WF. This can be used in emergencies in the power system. Without an ESS, the WF operator must reduce the output power of many WTG units to maintain a required reserve capacity, as shown in Figure 4a. To reduce the amount of spinning reserve capacity, an ESS can store energy and play a similar role to the spinning reserve capacity, as shown in Figure 4b. As a result, the amount of output power is significantly increased compared to the case without ESSs.

System Model
This section presents an MILP-based mathematical model for the optimal sizing of an ESS and the optimal output power of a WF. The optimal size of an ESS is determined by taking a trade-off between the investment costs and its profit in the operation of the entire WF system.

Reserve Power Mode
In this operation mode, a certain amount of spinning reserve capacity is maintained in the WF, which depends on the available power of the WF. This can be used in emergencies in the power system. Without an ESS, the WF operator must reduce the output power of many WTG units to maintain a required reserve capacity, as shown in Figure 4a. To reduce the amount of spinning reserve capacity, an ESS can store energy and play a similar role to the spinning reserve capacity, as shown in Figure 4b. As a result, the amount of output power is significantly increased compared to the case without ESSs. Figure 3a shows the actual output power of WFs in limited power mode. It seen that WFs must curtail a large amount if the available power is higher than the power at t1, while the output power of the WF is much smaller than the limited after a few next intervals at t2. Using ESSs allows the WF operator to shift the s power from the high output power periods to the low output power periods. The with ESSs, the WF not only reduces the amount of curtailment power but also in the amount of output power, as shown in Figure 3b.

Reserve Power Mode
In this operation mode, a certain amount of spinning reserve capacity is main in the WF, which depends on the available power of the WF. This can be used in gencies in the power system. Without an ESS, the WF operator must reduce the power of many WTG units to maintain a required reserve capacity, as shown in Fig  To reduce the amount of spinning reserve capacity, an ESS can store energy and similar role to the spinning reserve capacity, as shown in Figure 4b. As a resu amount of output power is significantly increased compared to the case without E

System Model
This section presents an MILP-based mathematical model for the optimal si an ESS and the optimal output power of a WF. The optimal size of an ESS is deter by taking a trade-off between the investment costs and its profit in the operation entire WF system.

System Model
This section presents an MILP-based mathematical model for the optimal sizing of an ESS and the optimal output power of a WF. The optimal size of an ESS is determined by taking a trade-off between the investment costs and its profit in the operation of the entire WF system.

Wind Data
Wind data is assumed to follow the Weibull distribution [28,29]. Equations (1) and (2) show the formula of probability density function (PDF) and cumulative distribution function (CDF) of the Weibull distribution, respectively.
where: k is Weibull shape factor, λ is Weibull scale parameter (m/s), and v is wind speed (m/s). Each couple of values {k,λ} is determined to fit the historical wind data in a certain period of time (e.g., a day, a week, a month, a season, a year). Fitting the wind data during a short period of time can increase the accuracy of determining wind speed/wind power. However, the optimization model is developed with one-year data. To reduce the complexity of the optimization model and the computation cost, four Weibull distribution functions were estimated to describe the seasonal wind data in a year. This selection not only reduces the complexity of the proposed model, but it also ensures the tracking of the significant changes in the wind speed in each season. WTGs locally control the blade angle and tip speed ratio to maximize their output power. The output power can be computed using Equation (3), considering the cut-in and cut-out speed of the WTG. In the operation of WFs, the operation of upstream WTGs can affect the operation of the downstream WTGs due to wake effects. This reduces the wind speed/wind force of the downstream WTGs, and therefore reduces the amount of output power of the entire WF system. In this study, the main objective is to analyze the effects of an ESS on the operation of a WF and to find out the optimal size of an ESS in different scenarios. Therefore, we assume that the location of all WTGs has been optimally determined to minimize the wind speed reduction and this factor can be neglected in this study. The available power of a WF is calculated by the WF operator by accumulating the available power from the WTGs, as shown in Equation (4). The WF operator determines the optimal set-point of the WF in each operation mode, which fulfills the constraint (5).

Optimization Model for Sizing of ESS
The objective function (6) aims to find out the optimal set-point of the WF and the optimal size of the ESS to reduce the penalty for shortage power in different operation modes; where P is the rated output power of the ESS and P WF out,t is the output power of the WF at t. The first term of (6) represents the total yearly cost of an ESS. The detailed cost calculation of an ESS is presented in Equations (7)-(12), same to [30], including four different cost categories: (i) cost of power conversion system; (ii) cost of battery; (iii) cost for the balance of the plant; and (iv) annual O&M cost of ESS. The factor φ is the capital recovery factor representing the weights between the four types of costs, as given in (7). The second term of (6) shows the penalty of shortage power in the limited power mode due to wind uncertainty. The third term of (6) shows the penalty for the shortage of reserve capacity in the reserve power mode. The fourth term of (6) shows the profit by selling power from WFs to the power system. The coefficients α, β represent the weight of each grid-code constraint in the operation of W. Equation (8) is used to compute the total cost of the power conversion system using the rated output power of the ESS (P) and the unit cost of power electronics. Equation (9) is used to calculate the total cost of the battery by using the length of the discharge cycle (H), the unit cost of the storage devices, P, and the discharging efficiency of the ESS (η dis ). Equation (10) is used to determine the total cost of the balance of the plant using P, H, and the unit cost of the balance of the plant. Equation (11) is used to compute the capital recovery factor using the lifetime of the component (y) and the annual interest rate (i r ). Finally, Equation (12) is used to calculate the annual O&M cost using the fixed O&M cost and P.

Constraints in Limited Power Mode
In this mode, a WF may be charged a penalty amount for its mismatch of power between the commitment power and the actual output power. The uncertainty of wind power causes the actual amount of output power to be significantly lower than the commitment power. Using an ESS significantly reduces this mismatch power. Figure 5 shows the shifting process of the surplus power from the high available power periods to low available power periods. For instance, the available power is higher than the limited power at t, the set-point of the WF is at the limited power and the surplus power is charged to the ESS. At t', we assume that the available power is at the lower bound of wind power uncertainty (i.e., the worst case), as shown in Figure 5. Without an ESS, the shortage of power is dP neg,t , and the WF must pay a penalty for this amount. With an ESS, the value of dP neg,t can be reduced to 0 by discharging power from the ESS. If the discharging amount is greater than the maximum value of dP neg,t , the WF can sell surplus power (dP pos,t ) and earn more profit. The output power of the WF is calculated based on the shortage and surplus power (i.e., dP neg,t , dP pos,t ), as given in Equation (13). The calculation of the amount of surplus/shortage power is summarized in detail in Algorithm 1 based on the amount of discharging power from the ESS. P WF out,t = P WF avl,t − dP neg,t + dP pos,t ∀t ∈ T Algorithm 1: Determine output power of WF with limited power constraint for t to T do//during a year if u·P WF avl,t ≥ P lim,t do dP neg,t = 0 dP pos,t = 0 //charging/discharging bounds out,t = min min P lim,t , P WF avl,t + dP pos,t − dP neg,t , P lim,t end

Constraints in the Reserve Power Mode
In this operation mode, the ESS plays a role of a major power capacity reserve in the WF system. The required reserve capacity can be fulfilled from two sources (i) spinning reserve power from WTGs and (ii) stored power in the ESS. The shortage of the reserve capacity is determined by Equation (14). The storage capacity in the ESS is calculated based on the current state of charge (SOC), as given in Equation (15). The output power of the WF is determined using Equation (16), based on the amount of spinning reserve power, charging, and discharging power of the ESS.

Constraints for the Operation of ESS
Equations (17) (17) and (18), respectively. The SOC of the ESS is computed at the end of each interval using the amount of charged/discharged power, as shown in Equation (19). The SOC of the ESS is set to the initial value at the first interval, as given in Equation (20). The operation bound of the ESS is shown in Equation (21).

Numerical Results
In this section, the optimal output power of a WF is determined in different operation modes using an ESS. The optimal size of an ESS is also analyzed in detail with various parameters of penalty, selling price, uncertainty, and so on. This allows the WF operator to determine the suitable size of the ESS with a given WF system.

Input Wind Data and WF Layout
Firstly, the wind speed parameters for each season following the Weibull distribution are tabulated in Table 1. The two model parameters (i.e., the Weibull shape and Weibull scale) are estimated by fitting an historical wind speed dataset to a Weibull distribution function. Different numerical methods, such as the modified maximum likelihood method, maximum likelihood method, and energy pattern factor method, can be used to determine the two model parameters [29]. The PDFs and CDFs of wind speed are demonstrated in Figures 6 and 7 for different seasons, respectively. The wind data is generated for a year using the given parameters in Table 1. In order to reduce the complexity of the proposed model and computation cost, the time interval is set to 1 h and the total number of intervals is 8760 for a year. The available power at each WTG is determined based on wind speed data using Equation (3) and the available power in the WF is determined by Equation (4). The detailed parameters for the ESS are given in Table 2. The test WF system consists of 20 WTGs and is divided into four clusters, as shown in Figure 1. All WTGs have the same operation parameters. The rated power is 10 MW with a minimum set-point of 1 MW. The maximum ramp-up and ramp-down in two consecutive intervals are 2 MW [28]. As mentioned earlier in Section 3.2, the value of α, β in the objective function (6) represents the weight of each grid-code constraint in the WF operation. The following three cases are analyzed in detail in this study: i. {α =1, β = 0}, the WF operates with limited power constraint only; ii. {α =0, β = 1}, the WF operates with reserve power constraint only; iii. {α =0.5, β = 0.5}, the WF operates with both limited power and reserve constraints and the WF tries to satisfy both constraints with the same priority.
The MILP-based optimization model is implemented in Visual Studio C++ and the optimal solution is determined using commercial software, i.e., IBM ILOG CPLEX 12.6. This optimizer is capable of solving linear programming, MILP, or quadratic programming problems with a high-performance and flexible mathematical programming solver [32].    Figure 6. The probability density function of wind data in different seasons [28].

Optimal Size of ESS in Limited Power Mode
In this mode, the set-point of the WF is limited by a predefined set-point (i.e., limited power). Firstly, we assume that the uncertainty of the wind speed is 2% and the limited power is set to 168 MW. This means that the output power of the WF is always less than  The test WF system consists of 20 WTGs and is divided into four clusters, as shown in Figure 1. All WTGs have the same operation parameters. The rated power is 10 MW with a minimum set-point of 1 MW. The maximum ramp-up and ramp-down in two consecutive intervals are 2 MW [28]. As mentioned earlier in Section 3.2, the value of α, β in the objective function (6) represents the weight of each grid-code constraint in the WF operation. The following three cases are analyzed in detail in this study: i. {α = 1, β = 0}, the WF operates with limited power constraint only; ii. {α = 0, β = 1}, the WF operates with reserve power constraint only; iii. {α = 0.5, β = 0.5}, the WF operates with both limited power and reserve constraints and the WF tries to satisfy both constraints with the same priority.
The MILP-based optimization model is implemented in Visual Studio C++ and the optimal solution is determined using commercial software, i.e., IBM ILOG CPLEX 12.6. This optimizer is capable of solving linear programming, MILP, or quadratic programming problems with a high-performance and flexible mathematical programming solver [32].

Optimal Size of ESS in Limited Power Mode
In this mode, the set-point of the WF is limited by a predefined set-point (i.e., limited power). Firstly, we assume that the uncertainty of the wind speed is 2% and the limited power is set to 168 MW. This means that the output power of the WF is always less than or equal to 168 MW. The optimal size of the ESS is determined to minimize the amount of power shortage in the worst case when the wind speed is at the lower bound of uncertainty. The optimal size of the ESS turned out to be 17.5 MW by considering the trade-off between its profit and investment cost. The costs corresponding to the optimal size of the ESS are calculated based on the unit cost of each component, as tabulated in Table 3. The optimal output power of WF is determined for one year, and to show the results unambiguously, the optimal set-point is only extracted for the first three days, as shown in Figure 8. It can be observed that the output power of the WF is maintained lower than or equal to the limited power (168 MW). Without the ESS, the output power of the WF is always at the lower bound of the uncertainty (blue line). The use of the ESS increases the output power of the WF significantly (red line), thus reducing the amount of the power mismatch between the actual and the committed output power. mismatch between the actual and the committed output power. The detailed operation of the ESS is shown in Figure 9. The ESS plays an important role in shifting the surplus power from high output power periods to low output power periods. The charging/discharging amount of the ESS is shown in Figure 9a. It can be seen that the ESS always tries to charge as much power as possible when the amount of available power is greater than the limited power. Then the ESS discharges the power to fulfill the power mismatch between the actual capacity and committed power caused by uncertainty. The amount of storage power in the ESS is shown in Figure 9b, and is calculated by using the amount of charging/discharging power, as shown in Figure 9a. The detailed operation of the ESS is shown in Figure 9. The ESS plays an important role in shifting the surplus power from high output power periods to low output power periods. The charging/discharging amount of the ESS is shown in Figure 9a. It can be seen that the ESS always tries to charge as much power as possible when the amount of available power is greater than the limited power. Then the ESS discharges the power to fulfill the power mismatch between the actual capacity and committed power caused by uncertainty. The amount of storage power in the ESS is shown in Figure 9b, and is calculated by using the amount of charging/discharging power, as shown in Figure 9a. In this section, the impact of various parameters on determining the size of the ESS are analyzed in detail. Firstly, the ESS is used to reduce the cost of penalties of shortage power. Therefore, the value of the penalty is the main factor affecting the size of the ESS, as shown in Figure 10. The size of the ESS increases significantly if the penalty increases. The optimal size of the ESS is 17.5 MW as the penalty value is approximately 40,000 KRW. In this section, the impact of various parameters on determining the size of the ESS are analyzed in detail. Firstly, the ESS is used to reduce the cost of penalties of shortage power. Therefore, the value of the penalty is the main factor affecting the size of the ESS, In this section, the impact of various parameters on determining the size of the ESS are analyzed in detail. Firstly, the ESS is used to reduce the cost of penalties of shortage power. Therefore, the value of the penalty is the main factor affecting the size of the ESS, as shown in Figure 10. The size of the ESS increases significantly if the penalty increases. The optimal size of the ESS is 17.5 MW as the penalty value is approximately 40,000 KRW. In addition, the values of uncertainty and limited power also affect the size of the ESS. Figure 11a shows the effect of both uncertainty and penalty value on the size of the ESS. It can be seen that when uncertainty increases to approximately 2%, the size of the ESS is the largest. If uncertainty is too high, the available power of the WF in the worst case is less than the limited power at most time intervals. As a result, the WF often generates maximum output power and there is no surplus power for charging the ESS. Similar to Figure 10, with an increase in the penalty, the size of the ESS increases. Figure 11b shows the effect of limited power and the value of the penalty on the ESS size. The size of the ESS increases significantly as the value of the penalty increases and the limited power is set at approximately 168 to 170 MW. This is because if the limited power is too high, the available power of the WF is always lower than the limited power. Therefore, the WF always generates its maximum power and does not charge the ESS. Conversely, when the limited power is too low, the output power of the WF is set at limited power and the ESS does not require to discharge power. Therefore, the size of the ESS is usually very low in these cases. Finally, based on the given information of each WF system, this detailed analysis allows WF operators to find out the optimal size of the ESS. In addition, the values of uncertainty and limited power also affect the size of the ESS. Figure 11a shows the effect of both uncertainty and penalty value on the size of the ESS. It can be seen that when uncertainty increases to approximately 2%, the size of the ESS is the largest. If uncertainty is too high, the available power of the WF in the worst case is less than the limited power at most time intervals. As a result, the WF often generates maximum output power and there is no surplus power for charging the ESS. Similar to Figure 10, with an increase in the penalty, the size of the ESS increases. Figure 11b shows the effect of limited power and the value of the penalty on the ESS size. The size of the ESS increases significantly as the value of the penalty increases and the limited power is set at approximately 168 to 170 MW. This is because if the limited power is too high, the available power of the WF is always lower than the limited power. Therefore, the WF always generates its maximum power and does not charge the ESS. Conversely, when the limited power is too low, the output power of the WF is set at limited power and the ESS does not require to discharge power. Therefore, the size of the ESS is usually very low in these cases. Finally, based on the given information of each WF system, this detailed analysis allows WF operators to find out the optimal size of the ESS.

Optimal Size of ESS in Reserve Power Mode
In reserve power mode, the WF must maintain a certain amount of reserve power. Figure 12 shows the available power and output power of the WF when the required reserve capacity is 10% of the available power. Without the ESS, the output power is always lower than the available power by a certain amount, as shown in Figure 12a. With the ESS, the amount of the storage power in the ESS can play a role in the reserve capacity in the

Optimal Size of ESS in Reserve Power Mode
In reserve power mode, the WF must maintain a certain amount of reserve power. Figure 12 shows the available power and output power of the WF when the required reserve capacity is 10% of the available power. Without the ESS, the output power is always lower than the available power by a certain amount, as shown in Figure 12a. With the ESS, the amount of the storage power in the ESS can play a role in the reserve capacity in the WF system. Therefore, the WF can generate extra output power while ensuring the requirement of reserve power, as shown in Figure 12b. (a) (b) Figure 11. The optimal size of ESS: (a) Different value of uncertainty and penalty (in KRW/kWh); (b) Different value of limited power and penalty (in KRW/kWh).

Optimal Size of ESS in Reserve Power Mode
In reserve power mode, the WF must maintain a certain amount of reserve power. Figure 12 shows the available power and output power of the WF when the required reserve capacity is 10% of the available power. Without the ESS, the output power is always lower than the available power by a certain amount, as shown in Figure 12a. With the ESS, the amount of the storage power in the ESS can play a role in the reserve capacity in the WF system. Therefore, the WF can generate extra output power while ensuring the requirement of reserve power, as shown in Figure 12b. The total reserve capacity in the WF is illustrated in Figure 13. It can be observed that the major reserve capacity comes from the stored energy in the ESS. The remaining is fulfilled by the spinning reserve capacity from the WTGs. The optimal size of the ESS turned out to be 16.3 MW by considering a trade-off between the investment costs and profit of selling power. The detailed cost of the ESS is computed using the unit cost in Table 2 and the detailed ESS cost is summarized in Table 4. The total reserve capacity in the WF is illustrated in Figure 13. It can be observed that the major reserve capacity comes from the stored energy in the ESS. The remaining is fulfilled by the spinning reserve capacity from the WTGs. The optimal size of the ESS turned out to be 16.3 MW by considering a trade-off between the investment costs and profit of selling power. The detailed cost of the ESS is computed using the unit cost in Table  2 and the detailed ESS cost is summarized in Table 4.   In the reserve power mode, the selling price is the main parameter that affected the size of the ESS. A high selling price encourages the WF operator to use the ESS to increase the output power of the WF and sell it to the power system. It can be seen that the size of the ESS increases significantly if the selling price is greater than 540 KRW/kWh. Figure 14 shows the effects of the selling price and requirement of the reserve capacity on the size of the ESS.  In the reserve power mode, the selling price is the main parameter that affected the size of the ESS. A high selling price encourages the WF operator to use the ESS to increase the output power of the WF and sell it to the power system. It can be seen that the size of the ESS increases significantly if the selling price is greater than 540 KRW/kWh. Figure 14 shows the effects of the selling price and requirement of the reserve capacity on the size of the ESS. In the reserve power mode, the selling price is the main parameter that affected the size of the ESS. A high selling price encourages the WF operator to use the ESS to increase the output power of the WF and sell it to the power system. It can be seen that the size of the ESS increases significantly if the selling price is greater than 540 KRW/kWh. Figure 14 shows the effects of the selling price and requirement of the reserve capacity on the size of the ESS.

Optimal Size of ESS Considering Several Grid-Code Constraints
Sections 4.2 and 4.3 present the optimal size of the ESS in only limited power or reserve power mode. It can be seen that the WF operator only decided to use ESS if the penalty for shortage power and selling price is quite high for the limited power and reserve power mode, respectively.
In this section, we consider both requirements of limited power and reserve power. Firstly, the input data is presented as follows: (i) The requirement of reserve power is 10% of the available power; (ii) Limited power is 168 MW;

Optimal Size of ESS Considering Several Grid-Code Constraints
Sections 4.2 and 4.3 present the optimal size of the ESS in only limited power or reserve power mode. It can be seen that the WF operator only decided to use ESS if the penalty for shortage power and selling price is quite high for the limited power and reserve power mode, respectively.
In this section, we consider both requirements of limited power and reserve power. Firstly, the input data is presented as follows: (i) The requirement of reserve power is 10% of the available power; (ii) Limited power is 168 MW; (iii) The value of penalty in both the limited power and reserve power modes are 1000 KRW/kWh; (iv) The selling price for surplus power is 150 KRW/kWh. The optimal size of the ESS turned out to be 16.7 MW. The detailed cost of the ESS is summarized in Table 5. The output power of the WF is shown in Figure 15. This set-point is always lower than or equal to the limited power (168 MW). The storage capacity in the ESS is shown in Figure 16a; this amount can play a role of reserve power in the WF system. Figure 16b shows the total amount of reserve power, including the amount of stored energy in the ESS and the amount of spinning reserve power at the WTGs. It can be seen that sometimes the reserve capacity requirement is not met. This is because the investment cost of the ESS is too expensive compared to the profits from the ESS. Therefore, the WF operator decides to pay the penalty instead of using a large size ESS.    Finally, the effects of the various parameters, including the value of the penalties for two modes, on the size of the ESS are clearly shown in Figure 17. It can be seen that the size of the ESS increases if the value of the penalty increases in both operation modes. The size of the ESS is maximum at approximately 32 MW when the penalty values are approximately 40,000 KRW and 30,000 KRW in the limited power and reserve power modes, respectively. Finally, the detailed analysis in this study helps the WF operator to determine the optimal size of the ESS corresponding to each given WF system. size of the ESS is maximum at approximately 32 MW when the penalty values are approximately 40,000 KRW and 30,000 KRW in the limited power and reserve power modes, respectively. Finally, the detailed analysis in this study helps the WF operator to determine the optimal size of the ESS corresponding to each given WF system.

Discussion and Future Extensions
In this study, a multi-objective optimization model is proposed to optimize the operation of an integrated WF-ESS considering different constraints, i.e., (i) limited power con-

Discussion and Future Extensions
In this study, a multi-objective optimization model is proposed to optimize the operation of an integrated WF-ESS considering different constraints, i.e., (i) limited power constraint and (ii) reserve power constraint issued by TSO, where the weight coefficients α, β represent the priority for each of these constraints. The change in values of α and β can impact the outcome of the optimization model. Therefore, depending on the preference of the WF operators, their values can be decided. For example, if the value of α > β, more preference will be given to fulfilling the limited power constraint and vice versa. The optimal output power of the WF and the optimal size of the ESS are presented with different operation scenarios. However, there are still some limitations of this research and thereby, opens up several approaches for future extension, as follows: a.
Since the life of all the equipment of the ESS is taken as the same, the replacement cost of storage devices was not considered in this study. However, the ESS model can be improved by considering replacement cost and recycling/disposal cost of the ESS; b.
The wind speed at each WTG is determined using a Weibull distribution and this could not be very accurate. Therefore, a deep neural network can be adopted to learn from historical data and be used to predict wind speed with higher accuracy; c.
In small WFs, WTGs might be located in a restricted space. This greatly reduces the wind speed/wind force of the downstream WTGs due to wake effects and thus decreases the amount of output power of the entire WF system. Developing a detailed WF model considering wake effect can increase overall WF performance; d. This study analyzes the operation of WFs in detail and the optimal size of ESSs under different operation scenarios. In the next step, the optimal results might be evaluated and implemented in a real WF system.
In summary, approaches (a)-(c) can be the possible solutions to improving the optimization model. Then, the final optimal solution can be analyzed and applied to some real WF systems in South Korea.

Conclusions
In this study, an optimization algorithm was proposed to find out the optimal size of an ESS to support a WF in fulfilling different grid-code constraints, including the reserve power and the limited power modes. Furthermore, the major parameters affecting the size of the ESS have also been analyzed in detail. In the limited power mode, the optimal size of the ESS was approximately 17 MW with the penalty of power mismatch between actual power and the commitment power of approximately 40,000 KRW/kWh and 2% of the uncertainty in the available power of the WF. In the reserve power mode, the optimal size of the ESS was approximately 16 MW with the requirement of reservation capacity of 10% of the available power. In the case of considering multiple grid-code constraints, the optimal size of the ESS can go up to approximately 32 MW if the penalty values are approximately 40,000 KRW/kWh and 30,000 KRW/kWh in the limited power and reserve power modes, respectively. Finally, based on the detailed analysis in this paper, the WF operator can easily find out the optimal size of an ESS that is suitable with the WF capacity, wind power information, uncertainty, and requirements from the TSOs (i.e., limited power, reserve capacity, penalty of mismatch power, and selling price).