In recent years, the rapid integration of photovoltaic (PV) generation has significantly altered the dynamics of modern power systems. As PV penetration levels increase, traditional synchronous generators (SGs) are displaced, leading to reduced system inertia and a higher risk of frequency instability. The battery energy storage system (BESS) has emerged as a key technology to mitigate these challenges by providing instantaneous power support during disturbances. However, oversizing the battery energy storage system imposes substantial economic burdens, while undersizing fails to maintain frequency stability. In my work, I propose a novel optimization framework for determining the optimal capacity of the battery energy storage system, explicitly considering frequency stability constraints. The methodology is tested on a modified IEEE 39-bus system under various PV penetration scenarios, and the results demonstrate that the optimized battery energy storage system effectively prevents under-frequency load shedding and enhances grid resilience. This article details the modeling, optimization algorithm, simulation setup, and key findings, supported by extensive numerical analysis.

To evaluate the frequency response capability of the system, I first define the effective center frequency, which aggregates the contributions of all synchronous generators. The effective center frequency is given by:
$$
f_{COF} = \frac{\sum_{i=1}^{m} f_i H_i S_i}{\sum_{i=1}^{m} H_i S_i}
$$
where \(S_i\) is the rated power of the \(i\)-th SG, \(f_i\) is the terminal frequency of the \(i\)-th SG, and \(H_i\) is the inertia constant of the \(i\)-th SG. The system frequency stability is characterized by two key metrics: the frequency nadir (minimum frequency after a disturbance) and the rate of change of frequency (RoCoF). The RoCoF at the instant of disturbance is expressed as:
$$
\Delta f_{COF} = \frac{1}{2} \frac{P_{dis} f_0}{I_R}
$$
where \(I_R\) represents the total system inertia, \(P_{dis}\) is the power disturbance magnitude, and \(f_0\) is the nominal system frequency (50 Hz in my study). The optimization objective is to minimize the total installed capacity of the battery energy storage system while ensuring that frequency constraints are respected. The objective function is:
$$
\min f = \sum_{i=1}^{h} P_{BESS_i}
$$
where \(h\) is the number of PV systems integrated into the grid, and \(P_{BESS_i}\) is the capacity of the battery energy storage system installed at the \(i\)-th PV bus. The optimization is subject to three categories of constraints:
- Frequency response constraints: the frequency nadir and RoCoF must stay within acceptable limits:
$$
f_{i_{\min}} \le f_i \le f_{i_{\max}}
$$
$$
\Delta f_{COF_{\min}} \le \Delta f_{COF} \le \Delta f_{COF_{\max}}
$$
- Generator power constraints: active and reactive power outputs of all SGs are bounded:
$$
P_{i_{\min}} \le P_i \le P_{i_{\max}}, \quad i = 1, 2, \dots, m
$$
$$
Q_{i_{\min}} \le Q_i \le Q_{i_{\max}}, \quad i = 1, 2, \dots, m
$$
- Battery energy storage system state-of-charge (SOC) constraints: prevent overcharging or deep discharging:
$$
SOC_{i_{\min}} \le SOC_i \le SOC_{i_{\max}}, \quad i = 1, 2, \dots, h
$$
I employ the particle swarm optimization (PSO) algorithm to solve this constrained optimization problem. PSO is a population-based metaheuristic that iteratively updates particle positions (representing battery energy storage system capacities) and velocities based on personal and global best solutions. The update rules are:
$$
v_i^{t+1} = w v_i^t + c_1 r_1 (P_{best} – x_i^t) + c_2 r_2 (G_{best} – x_i^t)
$$
$$
x_i^{t+1} = x_i^t + v_i^{t+1}
$$
where \(i\) indexes the particle, \(t\) is the iteration number, \(w\) is the inertia weight, \(c_1\) and \(c_2\) are learning factors, and \(r_1, r_2\) are random numbers uniformly distributed in [0,1]. In my implementation, I set the population size to \(N_p = 10\), maximum iterations to \(N_I = 100\), \(c_1 = c_2 = 1.5\), and \(w = 1\). The algorithm proceeds as follows:
- Initialize particle positions (BESS capacities in MW) and velocities randomly. Set iteration counter \(t = 1\).
- For each particle, perform a dynamic simulation of the grid with the corresponding battery energy storage system capacity. Extract the frequency nadir and RoCoF from the simulation results.
- Check if the constraints are satisfied. If yes, update the particle’s personal best \(P_{best}\) based on the objective function; otherwise, keep \(P_{best}\) unchanged.
- Update the global best \(G_{best}\) as the minimum \(P_{best}\) among all particles. Then update each particle’s velocity and position.
- After updating, compute the range of particle positions. If the range is below a predefined threshold \(\delta\), terminate the algorithm; otherwise, return to step 2. If the maximum iteration count is reached, terminate and output \(G_{best}\) as the optimal BESS capacity.
The stopping criterion is:
$$
\max\{x_i^t\} – \min\{x_i^t\} < \delta
$$
In my study, I set \(\delta = 0.1\) MW to ensure convergence.
The modeling of the battery energy storage system in the DIgSILENT PowerFactory simulation environment consists of two main components: the energy storage part and the AC-DC inverter. The energy storage part is characterized by the SOC, and the terminal DC voltage is expressed as:
$$
U_{DC} = U_{\max} SOC + U_{\min} (1 – SOC) + I Z
$$
where \(U_{\max}\) and \(U_{\min}\) are the fully charged and fully discharged battery voltages, \(I\) is the output current, and \(Z\) is the internal resistance. The inverter part includes three controllers: a frequency controller, an active/reactive power controller, and a charging controller. The controller parameters are adopted from the literature to ensure realistic dynamic behavior.
I perform case studies on a modified IEEE 39-bus system with 10 synchronous generators, nominal frequency 50 Hz, and under-frequency load shedding (UFLS) enabled at 49 Hz. PV systems replace selected SGs to achieve different penetration levels: 30%, 40%, and 50% of total generation. The battery energy storage system is installed at the buses where PV systems are connected. The test system configuration for 50% PV penetration is illustrated conceptually (without figure reference). The generator outage event is simulated by tripping SG5, which has a rated capacity of 508 MW, at \(t = 10\) s. Table 1 summarizes the generation parameters for each scenario.
| Scenario | Total SG Power (MW) | Total PV Power (MW) | Number of SGs | Number of PV Systems |
|---|---|---|---|---|
| 30% PV penetration | 3686 | 1680 | 8 | 2 |
| 40% PV penetration | 3136 | 2230 | 7 | 3 |
| 50% PV penetration | 2556 | 2810 | 6 | 4 |
First, I examine the frequency response without any battery energy storage system. For the three PV penetration levels, after SG5 trips, the system frequency drops rapidly. In all cases, the frequency falls below 49 Hz, triggering UFLS. The load shedding amount is 601.9 MW, which exceeds SG5’s output, causing a subsequent frequency overshoot to about 50.4 Hz. The steady-state frequency remains above nominal because PV generation does not decrease after the event. The frequency nadir under 30% PV penetration is the highest among the three, around 48.9 Hz, while for 50% PV penetration it is the lowest, around 48.6 Hz. This confirms that higher PV penetration exacerbates frequency instability in the absence of support from the battery energy storage system.
Next, I apply the proposed optimization method to determine the optimal battery energy storage system capacity for each scenario. The frequency constraints are set to \(f_{i_{\min}} = 49.5\) Hz, \(f_{i_{\max}} = 50.5\) Hz, \(\Delta f_{COF_{\min}} = -1\) Hz/s, and \(\Delta f_{COF_{\max}} = 1\) Hz/s. The SOC limits are 20% and 100%. The PSO algorithm converges within about 33 iterations for the 30% PV case, yielding an optimal battery energy storage system capacity of 139.9 MW. For 40% and 50% PV penetration, the optimal capacities are 173.34 MW and 212.26 MW, respectively. The convergence behavior is smooth, indicating that the algorithm efficiently finds a feasible solution.
With the optimized battery energy storage system installed, I rerun the SG5 trip simulation. The frequency responses are summarized in Table 2. In all three scenarios, the frequency nadir is exactly 49.05 Hz, which is above the UFLS threshold of 49 Hz. The RoCoF is also well within the allowable range. No load shedding occurs because the battery energy storage system rapidly injects active power to compensate for the generation loss. The battery energy storage system’s frequency controller detects the frequency drop immediately and increases the power output of the active/reactive power controller. The system frequency stabilizes around 49.8 Hz after a few seconds.
| PV Penetration | Optimal BESS Capacity (MW) | Frequency Nadir (Hz) | RoCoF (Hz/s) | UFLS Triggered? |
|---|---|---|---|---|
| 30% | 139.90 | 49.05 | -0.82 | No |
| 40% | 173.34 | 49.05 | -0.84 | No |
| 50% | 212.26 | 49.05 | -0.87 | No |
Compared to the no-BESS cases, the improvement is dramatic. The frequency nadir rises from below 49 Hz to exactly 49.05 Hz, a safe margin above the load shedding threshold. The RoCoF is also reduced by approximately 0.2–0.3 Hz/s. Importantly, the required battery energy storage system capacity increases with PV penetration, but the growth is sublinear: a 66% increase in PV penetration (from 30% to 50%) only requires a 52% increase in battery energy storage system capacity. This suggests that the marginal benefit of additional battery energy storage system capacity decreases at higher PV levels, which is economically favorable.
I also analyze the sensitivity of the results to the choice of frequency constraints. For example, tightening the frequency nadir limit to 49.7 Hz increases the optimal battery energy storage system capacity by about 15–20% across all scenarios. Conversely, relaxing the RoCoF limit to 1.5 Hz/s has a negligible effect because the dominant constraint is the frequency nadir. This indicates that the frequency nadir is the binding constraint in the optimization, which aligns with practical observations that frequency excursions are more critical than RoCoF for system stability.
The simulation platform used is DIgSILENT PowerFactory, which provides accurate electromagnetic transient models. The battery energy storage system model incorporates realistic inverter dynamics and SOC-dependent characteristics. I validate that the SOC remains within the 20–100% range throughout the simulation; the maximum SOC variation during the event is less than 5% for all scenarios, confirming that the battery energy storage system is not overcharged or deeply discharged.
From a practical perspective, the proposed optimization method provides system operators with a quantitative tool to determine the minimum battery energy storage system capacity required to maintain frequency stability under high PV penetration. The approach can be extended to consider multiple contingency events, stochastic PV output, and battery degradation costs. In future work, I intend to incorporate the intermittent nature of PV generation and the aging characteristics of the battery energy storage system into the optimization framework. Additionally, hardware-in-the-loop testing will be performed to validate the simulation results under real-world conditions.
In conclusion, my study demonstrates that the optimal configuration of the battery energy storage system, guided by frequency stability constraints and solved via PSO, effectively prevents under-frequency load shedding in grids with high PV penetration. The battery energy storage system acts as a fast-acting reserve that compensates for the loss of synchronous inertia. The proposed method systematically balances investment cost and stability requirements, making it a valuable tool for grid planning and operation. The numerical results on the modified IEEE 39-bus system confirm that even at 50% PV penetration, a modest battery energy storage system capacity of 212.26 MW is sufficient to maintain the frequency above the critical threshold. This work contributes to the ongoing effort to integrate renewable energy sources while preserving grid reliability.
