In this paper, we present a comprehensive study on the optimal configuration of energy storage systems to mitigate power quality issues caused by grid-connected distributed photovoltaic generation. The increasing penetration of distributed photovoltaic systems into distribution networks has introduced significant challenges, including voltage deviation, voltage fluctuation, and harmonic distortion. To address these problems, we propose a snake optimization algorithm for determining the optimal siting and sizing of energy storage systems. We first establish an equivalent circuit model to analyze the mechanisms by which photovoltaic integration affects voltage deviation, voltage fluctuation, and harmonics. Then, we develop a power quality optimization strategy based on distributed energy storage and apply the snake optimization algorithm to solve the optimal placement and capacity allocation problem. Through extensive simulations on both a custom distribution feeder and the IEEE 33-bus test system, we verify the effectiveness and economic viability of the proposed method. Our results demonstrate that the snake optimization algorithm outperforms particle swarm optimization, genetic algorithm, and whale optimization algorithm in terms of convergence speed and solution quality, achieving a 42.3% reduction in investment cost while improving voltage profiles.
1. Introduction
The large-scale integration of distributed photovoltaic systems into distribution networks has made power quality issues increasingly complex, affecting the reliability and safety of power equipment. Reasonable quantification and optimization of power quality are essential for improving supply quality and achieving economic operation of the grid. Existing studies have explored various techniques such as static var compensators, coordinated inverter control, and voltage regulation strategies to address these challenges. However, with the expanding scale of distributed photovoltaic systems, optimizing control strategies and enhancing power quality remain critical tasks. In this work, we focus on the role of energy storage systems in mitigating power quality degradation. Energy storage systems, when properly configured, can smooth power fluctuations, compensate for reactive power, and reduce harmonic distortion. The key challenge lies in determining the optimal location and capacity of energy storage systems under practical constraints. We introduce the snake optimization algorithm, a bio-inspired metaheuristic, to solve this nonlinear constrained optimization problem. The algorithm mimics the foraging behavior of snakes and has demonstrated superior performance in global optimization tasks. By integrating the snake optimization algorithm with a multi-objective function that balances power quality indices and economic costs, we provide a systematic methodology for planning energy storage systems in distribution networks with high photovoltaic penetration.
2. Analysis of Power Quality Issues Caused by Photovoltaic Integration
Distributed photovoltaic systems affect power quality primarily through three aspects: voltage deviation, voltage fluctuation, and harmonic distortion.
Voltage deviation: The mismatch between photovoltaic output and load demand alters the distribution of active and reactive power along the feeder, thereby influencing the voltage magnitude at each node. When photovoltaic generation is high and load is low, the voltage may rise beyond acceptable limits, especially at the end of the feeder.
Voltage fluctuation: The intermittent and random nature of photovoltaic output, such as sudden changes in solar irradiance, causes power fluctuations at the point of common coupling. These fluctuations propagate through the line impedance, leading to voltage fluctuations. The magnitude of fluctuation depends on the short-circuit capacity at the coupling point, the change in photovoltaic power, and the impedance angle of the system.
Harmonics: Photovoltaic inverters, as power electronic devices, inject harmonic currents into the grid due to switching actions. The harmonic content is influenced by the grid connection location, inverter control strategy, and background harmonics. Harmonic distortion is quantified using the total harmonic distortion of voltage and current:
$$
rTHD_{u} = \frac{\sqrt{\sum_{h=2}^{H} U_{h}^{2}}}{U_{1}} \times 100\%
$$
$$
rTHD_{i} = \frac{\sqrt{\sum_{h=2}^{H} I_{h}^{2}}}{I_{1}} \times 100\%
$$
where \(U_{h}\) and \(I_{h}\) are the h-th harmonic voltage and current, and \(U_{1}\) and \(I_{1}\) are the fundamental components. These indices are used to evaluate the severity of harmonic pollution. The combined impact of these three factors necessitates effective mitigation measures, among which the optimal deployment of energy storage systems is a promising solution.
3. Power Quality Optimization and Energy Storage System Configuration
To improve power quality, we employ a combination of dynamic voltage regulation, reactive power compensation, and three-phase imbalance mitigation. Distributed energy storage systems play a central role due to their fast response and bidirectional power capability. The objective is to determine the optimal siting and sizing of energy storage systems that minimize total economic cost while satisfying power quality constraints.
3.1 Objective Function
The objective function is formulated as a weighted sum of power quality indices and economic cost:
$$
M = \sum_{i=1}^{n} \left( a \cdot \frac{|U_i – U_{ref}|}{U_{ref}} + b \cdot \frac{|f_i – f_{ref}|}{f_{ref}} + c \cdot \frac{\sqrt{\sum I_{i,j}^2}}{I_{i,1}} + d \cdot N_{total} \right)
$$
where \(a\), \(b\), \(c\), and \(d\) are weight factors, \(U_i\) and \(f_i\) are the voltage and frequency at node \(i\), \(I_{i,j}\) and \(I_{i,1}\) are the harmonic and fundamental currents, and \(N_{total}\) is the annualized total cost of the energy storage system. The annualized total cost includes power cost, capacity cost, installation cost, operation and maintenance cost, and efficiency losses:
$$
N_{total} = \frac{\alpha P + \beta S + \gamma C_{install}}{N_{life}} + k(\alpha P + \beta S + \gamma C_{install}) + \frac{\beta S}{\eta(S)}
$$
where \(\alpha\) is the unit power cost, \(\beta\) is the unit capacity cost, \(\gamma\) is the number of energy storage units, \(P\) and \(S\) are the rated power and capacity, \(C_{install}\) is the installation cost, \(N_{life}\) is the design life, \(k\) is the annual operation and maintenance rate, and \(\eta\) is the round-trip efficiency. The weight factors are normalized so that \(a + b + c + d = 1\), and penalty factors are introduced to discard infeasible solutions.
3.2 Constraints
The optimization is subject to the following constraints:
- Power flow balance: For each node \(i\), the active and reactive power injections must satisfy the network equations:
$$
P_i = e_i \sum_{j=1}^{n} (G_{ij} e_j – B_{ij} f_j) + f_i \sum_{j=1}^{n} (G_{ij} f_j + B_{ij} e_j)
$$
$$
Q_i = f_i \sum_{j=1}^{n} (G_{ij} e_j – B_{ij} f_j) – e_i \sum_{j=1}^{n} (G_{ij} f_j + B_{ij} e_j)
$$
where \(e_i\) and \(f_i\) are the real and imaginary parts of the node voltage, and \(G_{ij}\) and \(B_{ij}\) are the conductance and susceptance of the node admittance matrix. - Node voltage limits: \(V_{i}^{\min} \leq V_{i} \leq V_{i}^{\max}\).
- Energy storage power limits: \(P_{\max}^{-} \leq P_{storage,t} \leq P_{\max}^{+}\) where \(P_{\max}^{-}\) and \(P_{\max}^{+}\) are the maximum charging and discharging power.
- Branch current limits: \(I_i \leq I_{i}^{\max}\).
- Network topology constraint: Different distributed energy resources cannot be connected to the same node: \(X_i \neq X_{i+1} \neq X_{i+2}\).
3.3 Snake Optimization Algorithm for Energy Storage Configuration
The siting and sizing of energy storage systems is a nonlinear constrained optimization problem that cannot be solved analytically. We employ the snake optimization algorithm (SO), a bio-inspired metaheuristic that mimics the foraging behavior of snakes. The algorithm is adapted to the energy storage planning problem by:
- Variable mapping: Each individual in the population is defined as a tuple (node number, capacity value) representing a candidate energy storage configuration.
- Constraint validation: After each position update, the solution is checked against all constraints; infeasible solutions are repaired or penalized.
The procedure is as follows:
- Initialization: Set maximum iterations and population size. Perform chaotic initialization based on load node distribution.
- Fitness calculation: Evaluate the multi-objective function for each individual and identify the best solution.
- Constraint-adaptive iterative update: Apply the snake foraging operators (exploration and exploitation) while ensuring constraint satisfaction.
- Termination: Stop when the maximum iteration is reached and output the optimal solution set.
4. Simulation and Case Studies
We build a simulation model of a grid-connected photovoltaic system to validate the analysis of power quality impacts and the effectiveness of the proposed energy storage configuration method. The model includes six photovoltaic units placed at different distances from the point of common coupling (0.01 km, 0.2 km, 0.4 km, 0.6 km, 0.8 km, and 1.0 km).
4.1 Effect of Irradiance on Power Quality
We simulate a sudden decrease in irradiance from 1 kW/m² to 0.7 kW/m² at t = 1 s with a constant temperature of 25 °C. The results show that the photovoltaic DC voltage fluctuates by about 20 V at the instant of change, whereas the initial transient during 0–0.5 s exhibits fluctuations of 50–300 V lasting 0.1 s. For photovoltaic units farther from the point of common coupling, the irradiance change has little effect on the DC voltage. The three-phase grid current shows a clear reduction in amplitude after the irradiance drop, and the current total harmonic distortion (rTHDi) increases from 3.33% to 5.73%, while the voltage total harmonic distortion (rTHDu) changes only slightly from 4.15% to 4.21%.
| Condition | Grid Current rTHDi (%) | Grid Voltage rTHDu (%) |
|---|---|---|
| Before irradiance change | 3.33 | 4.15 |
| After irradiance change | 5.73 | 4.21 |
4.2 Effect of Grid Topology
We compare a radial topology with a ring topology. The ring topology has a higher voltage overshoot (800 V vs. 500 V) and a longer average settling time (0.8 s vs. 0.48 s). The total harmonic distortion in the ring topology is slightly higher for voltage (4.20% vs. 4.15%) and current (3.79% vs. 3.33%). The radial topology is advantageous in suppressing grid-connection impacts. Harmonic analysis shows that the radial topology has lower 2nd and 20th harmonics, while the ring topology has fewer 8th and 15th harmonics. Overall, the radial structure performs better.
| Topology | Voltage Overshoot (V) | Grid Current rTHDi (%) | Grid Voltage rTHDu (%) | Average Settling Time (s) | Steady-State Voltage (V) |
|---|---|---|---|---|---|
| Radial | 500 | 3.33 | 4.15 | 0.48 | 308 |
| Ring | 800 | 3.79 | 4.20 | 0.8 | 318 |
4.3 Validation of Snake Optimization Algorithm
To assess the performance of SO, we compare it with particle swarm optimization (PSO), genetic algorithm (GA), and whale optimization algorithm (WOA) under identical conditions (population size 50, search range ±100%, 50 iterations). The convergence curves show that PSO and WOA easily fall into local optima, GA converges slowly, while SO achieves the best fitness value with faster convergence. The snake optimization algorithm is more effective for the energy storage system configuration problem.
4.4 Case Study 1: 23-Node Distribution Feeder
We consider a distribution network with 23 nodes and 10 load nodes (nodes 3, 5, 7, 9, 13, 15, 17, 19, 21, 23). The goal is to select the optimal location and capacity for an energy storage system among nodes 2–23, with the constraint that the capacity does not exceed 50% of the line’s maximum load. The multi-objective algorithm identifies node 15 with a capacity of 4 MW as the optimal solution. We compare two scenarios: “actual” energy storage connection (node 11, 5.6 MW) and “optimized” connection (node 15, 4 MW).
Voltage profile: The optimized energy storage connection yields higher node voltages, better balancing load fluctuations. The voltage quality (per unit) improves from 0.984 p.u. to 0.986 p.u.
Economic analysis: With unit power cost α = 5658.43 yuan/kW and unit capacity cost β = 5716.66 yuan/kW, the total investment for the actual connection is 2.74 billion yuan, while the optimized connection costs 1.58 billion yuan – a reduction of 42.3%. The optimized scheme not only improves voltage quality but also significantly reduces investment, and by avoiding overloading and deep cycling, the system lifespan and utilization rate are also enhanced.
| Scheme | Voltage Quality (p.u.) | Total Investment (billion yuan) |
|---|---|---|
| Actual | 0.984 | 2.74 |
| Optimized | 0.986 | 1.58 |
4.5 Case Study 2: IEEE 33-Node Test System
To verify the generality of the proposed method, we apply it to the standard IEEE 33-bus distribution system. Distributed photovoltaic units of 800 kW, 500 kW, and 600 kW are connected at nodes 18, 23, and 33, respectively. The snake optimization algorithm (population size 50, 200 iterations) identifies node 18 as the optimal location with an energy storage capacity of 850 kW. Before optimization, some nodes near the end of the feeder experience voltage violations. After adding the energy storage system, the maximum voltage deviation drops from 0.056 p.u. to 0.028 p.u., and the voltage compliance rate improves significantly.
Economic comparison: Using the same cost parameters as in the previous case, the optimized scheme has a total investment of 9.6738 million yuan. If the energy storage system were instead placed at node 33 with a capacity of 1000 kW, the cost would be about 11.38 million yuan with poorer voltage improvement. This demonstrates that the snake optimization algorithm is effective for different network sizes and structures.
| Scheme | Optimal Node | Capacity (kW) | Max Voltage Deviation (p.u.) | Total Investment (million yuan) |
|---|---|---|---|---|
| Optimized (SO) | 18 | 850 | 0.028 | 9.67 |
| Alternative | 33 | 1000 | 0.035 | 11.38 |

5. Conclusion
In this work, we have comprehensively analyzed the impact of distributed photovoltaic integration on distribution network power quality and proposed an optimal configuration method for energy storage systems based on the snake optimization algorithm. Our key findings are:
- Distributed photovoltaic systems significantly alter voltage profiles, causing voltage deviation, fluctuation, and harmonic distortion. The irradiance level primarily affects current harmonics, while grid topology has a substantial influence on transient overshoot and settling time.
- Energy storage systems play a crucial role in mitigating these power quality issues. The optimal siting and sizing of energy storage systems can effectively improve voltage quality and reduce harmonic distortion.
- The snake optimization algorithm outperforms other metaheuristics (PSO, GA, WOA) in solving the constrained nonlinear optimization problem, achieving faster convergence and better solution quality.
- Case studies on a 23-node distribution feeder and the IEEE 33-bus system demonstrate that the optimized energy storage configuration reduces investment costs by up to 42.3% while maintaining or improving voltage quality.
Future work will extend the proposed method to consider dynamic operating conditions, uncertainty in photovoltaic generation and load, and more detailed energy storage system models including battery degradation and lifecycle costs. The integration of the snake optimization algorithm with real-time control strategies also deserves further investigation.
