Research on a Distributed Photovoltaic Two-Level Planning Method Based on the SCMPSO Algorithm

: In response to challenges such as voltage limit violations, excessive currents, and power imbalances caused by the integration of distributed photovoltaic (distributed PV) systems into the distribution network, this study proposes at two-level optimization configuration method. This method effectively balances the grid capacity and reduces the active power losses, thereby decreasing the operating costs. The upper-level optimization enhances the distribution network’s capacity by determining the siting and sizing of distributed PV devices. The lower-level aims to reduce the active power losses, improve the voltage stability margins, and minimize the voltage deviations. The upper-level planning results, which include the siting and sizing of the distributed PV, are used as initial conditions for the lower level. Subsequently, the lower level feeds back its optimization results to further refine the configuration. The model is solved using an improved second-order oscillating chaotic map particle swarm optimization algorithm (SCMPSO) combined with a second-order relaxation method. The simulation experiments on an improved IEEE 33-bus test system show that the SCMPSO algorithm can effectively reduce the voltage deviations, decrease the voltage fluctuations, lower the active power losses in the distribution network, and significantly enhance the power quality.


Introduction
Solar energy, as one of the most abundant clean energy sources on Earth, is widely regarded as an effective solution to mitigate the current energy crisis [1].Among the various ways to utilize solar energy, photovoltaic (PV) power generation is particularly seen as an efficient method.Currently, distributed PV power generation is a common mode of PV power generation, typically integrated into low-voltage distribution networks as a power source [2,3].This generation method has advantages such as small size, flexible installation locations, and short construction periods, allowing for quick integration into the distribution network.However, the integration of PV power generation also alters the topology and power flow distribution of the distribution network.The uncertainty and variability of its power output may impact the stable operation of the distribution network [4][5][6].Once connected to the grid, PV can potentially reduce the power quality and safety of the distribution network.Therefore, a reasonable layout of PV systems is key to addressing these issues.
To effectively assess the performance of PV grid integration, current standards primarily include power system interconnection standards, power quality standards, safety standards, and technical performance standards [7].Among these standards, the distribution network's capacity to accommodate PV is a crucial indicator within the power system interconnection standards.This indicator is essential to ensure that PV systems can effectively connect to the distribution network, thereby helping to maintain the overall operational efficiency and safety of the distribution network.The capacity of a PV distribution network refers to the maximum PV capacity that can be integrated under the maximum power load or current level that the distribution network can withstand.However, this indicator does not reflect the operational status of the distribution network equipment, the effects of PV grid integration, and other influencing factors [8].In [9], the siting and sizing planning of PV grid integration based on considering capacity are studied.In [10], the distribution network capacity is evaluated based upon three aspects: the equipment level, load supply capability, and distribution network structure.While considering the capacity of the distribution network, PV grid integration must also consider various constraints.The main constraints limiting the integration capacity of PV include the voltage thresholds at each node, PV output constraints, harmonic content, and grid distortion levels.These conditions collectively determine the safety and efficiency of the PV system's grid integration [11][12][13].
Currently, there is a substantial amount of international research on the planning of the distributed photovoltaic (PV) grid integration.Most studies have established optimization objective models based on a single factor, such as solely optimizing for node voltage thresholds, harmonics, or the generalized short-circuit ratio.However, these optimization models do not have universality and are not universally applicable to other constraints.In practical applications, distributed PV grid integration needs to consider multiple constraints to meet real-world requirements.For example, the model proposed in reference [14] performs distributed PV capacity analysis constrained by voltage quality and short-circuit capacity; reference [15] considers the economic perspective and proposes an optimal planning model for the investment, operation, and maintenance of distributed PV grid integration-while references [16,17] optimize based on PV output, node voltage thresholds, and the maximum carrying capacity of currents.However, PV grid integration planning is a nonlinear problem with multiple objective constraints, characterized by complexity and a large computational scale.This makes it challenging for traditional algorithms to effectively optimize and find the optimal solution.
Building on previous research, this paper proposes a new two-level PV grid integration planning method that comprehensively considers multiple aspects such as the distribution network capacity and active power loss.The upper-level planning aims to enhance the network capacity by the precise siting and sizing of PV equipment, while the lowerlevel planning focuses on reducing active power loss, lowering daily operating costs, and minimizing voltage deviations [18].To solve this model, an improved second-order oscillating chaotic map particle swarm optimization algorithm (SCMPSO) combined with a dual relaxation method is employed.Case study analysis verifies the convergence and effectiveness of this algorithm.

Siting and Sizing Planning of PV Equipment
Figure 1 illustrates the structure of distributed PV integration into the distribution network.As shown in Figure 1, the distribution network feeder contains a total of n nodes.U i represents the voltage at node i, measured in kilovolts (kv); i denotes any node.Ri and Xi are the equivalent resistance and reactance of branch i, measured in ohms (Ω).Pi and Qi represent the active and reactive loads at node i, measured in kilowatts (kw) and kilovars (kvar), respectively.P pv denotes the power input from the PV system, measured in kilowatts (kw).In a power system, R i + jX i represents the impedance, where R i denotes the resistance between node i and node i+1, and Xi represents the reactance between node i and node i + 1.The j typically represents the imaginary unit.In Figure 1, S represents the power source.The red box displays a schematic diagram of the components of a distributed photovoltaic system.After the integration of PV, the power flow and voltage distribution in the distribution network are altered.For example, at node i, the voltage difference between the adjacent nodes before PV integration is expressed as: In Equation ( 1), Pm represents the real power consumed or generated by the system from the power source to node m.Qm represents the reactive power consumed or generated by the system from the power source to node m.
The node voltage expression for node i is: In Equation (2), U0 represents the voltage at the node connecting the distribution network to the higher-level grid, i.e., the voltage at node k-1, where k takes values 1, 2, …, n.PPV,j and QPV,j represent the active and reactive power of the distributed PV at node j, respectively, with j ranging from 1 to n. PL,j and QL,j denote the active and reactive loads at node j, respectively.Rk and Xk are the resistance and reactance between nodes k and k−1, respectively.
When PV equipment is integrated into the distribution network, the integration point is represented by any node t.The voltage deviation between any two upstream nodes and the voltage expression for any upstream node iii are as follows: When the PV equipment is integrated into the distribution network, the integration point is represented by any node t.The voltage deviation between any two downstream nodes of the integration point, as well as the voltage expression for any downstream node i, are as follows: After the integration of PV, the power flow and voltage distribution in the distribution network are altered.For example, at node i, the voltage difference between the adjacent nodes before PV integration is expressed as: In Equation ( 1), P m represents the real power consumed or generated by the system from the power source to node m.Q m represents the reactive power consumed or generated by the system from the power source to node m.
The node voltage expression for node i is: In Equation (2), U 0 represents the voltage at the node connecting the distribution network to the higher-level grid, i.e., the voltage at node k − 1, where k takes values 1, 2, . .., n.P PV,j and Q PV,j represent the active and reactive power of the distributed PV at node j, respectively, with j ranging from 1 to n. P L,j and Q L,j denote the active and reactive loads at node j, respectively.R k and X k are the resistance and reactance between nodes k and k−1, respectively.
When PV equipment is integrated into the distribution network, the integration point is represented by any node t.The voltage deviation between any two upstream nodes and the voltage expression for any upstream node iii are as follows: When the PV equipment is integrated into the distribution network, the integration point is represented by any node t.The voltage deviation between any two downstream nodes of the integration point, as well as the voltage expression for any downstream node i, are as follows: According to Equations ( 1) and ( 2), it can be observed that, in the absence of PV integration, the voltage gradually decreases along the transmission line.From Equation ( 3) to (6), it can be seen that, when the output power of the distributed PV at the integration node exceeds the load power, the power flow at the node will reverse, turning the node into an active node.In this scenario, the node will inject power into the distribution network.As the output power of the distributed PV increases, the node voltage rises accordingly, especially at locations close to the load end, where the voltage rise is more significant.This may cause the voltage at the distribution network nodes to exceed the normal threshold range.
Considering the impact of distributed PV integration on the carrying capacity of the distribution network, this study rationally plans the siting and sizing of PV equipment from the perspectives of power quality and system operational safety to ensure the safe and economical operation of the system.This study plans the PV integration capacity while ensuring the maximum carrying capacity of the distribution network and conducts the detailed planning and optimization of the integration location and capacity of the equipment [19].

Two-Level Planning for Distributed PV
The integration of PV into the distribution network affects its carrying capacity.To enhance the carrying capacity of the distribution network, reduce active power losses, increase economic benefits, and ensure the practical feasibility of PV integration, this paper proposes a new two-level model construction scheme [19].This scheme aims to determine the siting and sizing of PV and energy storage equipment to improve the system stability and economic efficiency.The planning framework is as follows: Figure 2 provides a detailed introduction to the two-level planning framework for distributed photovoltaics.The PV model planning mentioned in this paper is divided into two levels.The upper-level planning mainly focuses on maximizing the load-bearing capacity of the distribution network.It establishes a planning model by combining the investment costs of the distributed PV with the system active power loss to determine the siting and sizing of PV equipment.The lower-level planning, on the other hand, aims to reduce the system active power loss, improve the system stability margin, and minimize the voltage deviation.This is achieved by solving the model using an improved second-order oscillating chaotic mapping particle swarm optimization algorithm.The siting and sizing of equipment determined by the upper-level planning become the initial conditions for the lower-level optimization.The results of the lower-level planning are then fed back to the upper level, further optimizing the installation locations and capacities of the PV equipment.The establishment of an evaluation model for the load-bearing capacity of the distribution network under multiple constraints: In Equation (7), F1 represents the maximum load-bearing capacity that the system can withstand, and Si represents the maximum allowable capacity of PV at node i (KVA).ΨDG denotes the set of distributed photovoltaic points.
QDG,i,max≤ QDG,i ≤ QDG,i,max In the above equations, PDG,i and QDG,i represent the active and reactive power outputs of the distributed photovoltaic at node i, respectively.PDG,i,min and PDG,i,max denote the lower and upper limits of active power output at node i, respectively.Similarly, QDG,i,min and QDG,i,max denote the lower and upper limits of reactive power output at node i, respectively.

Node Voltage Constraints:
Translation: According to the "Electric Power Quality Supply Voltage Deviation" GB/T 12325-2008 [20], lines of different voltage levels are allowed different ranges of voltage deviation, and node voltages are constrained by these voltage deviations.
In Equation (10): UN represents the rated voltage of the distribution network at that level (KV); ε represents the voltage deviation rate at that level.The establishment of an evaluation model for the load-bearing capacity of the distribution network under multiple constraints: In Equation (7), F 1 represents the maximum load-bearing capacity that the system can withstand, and Si represents the maximum allowable capacity of PV at node i (KVA).Ψ DG denotes the set of distributed photovoltaic points.
In the above equations, P DG,i and Q DG,i represent the active and reactive power outputs of the distributed photovoltaic at node i, respectively.P DG,i,min and P DG,i,max denote the lower and upper limits of active power output at node i, respectively.Similarly, Q DG,i,min and Q DG,i,max denote the lower and upper limits of reactive power output at node i, respectively.

2.
Node Voltage Constraints: Translation: According to the "Electric Power Quality Supply Voltage Deviation" GB/T 12325-2008 [20], lines of different voltage levels are allowed different ranges of voltage deviation, and node voltages are constrained by these voltage deviations.
In Equation ( 10): U N represents the rated voltage of the distribution network at that level (KV); ε represents the voltage deviation rate at that level.

3.
Line Current Constraints: In Equation ( 11), I i−j represents the current value between branch i-j, I i−j,min , and I i−j,max , respectively, indicating the minimum and maximum currents that can pass through that branch.

4.
Harmonic Constraints: According to GB/T12325-2008 "Power Quality Public Network Harmonics" [20], the maximum allowable harmonic current values vary for systems with different voltage levels and reference short-circuit capacities.To ensure the effectiveness of harmonic current constraints, we determine the harmonic constraints under the maximum output of the photovoltaic equipment: In Equation ( 12), K represents the k-th order harmonic current, and µ represents the maximum allowable harmonic current as per the national standard GB/T 1549-1993 "Power Quality Public Network Harmonics" [21].

5.
Energy Storage Constraints: 0 ≤ |P t j,dch | ≤ |µ t j.dch P max j,ESS | P t j,ch and P t j,dc represent the charging and discharging powers of the energy storage device j at time t, respectively.µ t j,ch and µ t j,dch are binary variables where E equals 1 during charging and 0 otherwise; µ dch is the opposite.P max j,ESS indicates the maximum charging and discharging power of the energy storage device at node j.For the ease of comparison in the charging and discharging diagram, it should be noted that, during charging, P t j,ch is shown below the axis; during discharging, P t j,ch is shown above the axis.

Site Selection and Capacity Determination Model 4.2.1. Development of the Objective Function for Site Selection and Capacity Determination
This paper introduces a model for site selection and capacity determination for PV systems, predicated on the maximum carrying capacity of the distribution network.The objective is to minimize investment costs and active power losses, thereby enhancing the economic efficiency of the system.After confirming the compliance with the carrying capacity requirements, a secondary model is formulated: In Equation ( 17), w 1 , w 2 , and w 3 represent the weights within the objective function, satisfying the condition w 1 + w 2 + w 3 = 1.F 1 denotes the carrying capacity value, and the site selection and capacity determination model is based on the maximum carrying capacity model of the distribution network; hence, w 1 is the predominant weight, such that w 1 ≥ w 2 and w 1 ≥ w 3 .The specific values for the weights w 2 and w 3 are determined based on actual conditions.F 1 is elaborated upon in Equation ( 7), f 2 indicates investment costs, and f 3 represents active network losses.a, b, and c serve as penalty factors.

Investment Costs
The investment costs for a distributed PV primarily comprise the initial capital expenditures and ongoing operation and maintenance expenses.The cost model is described as follows: In Equation ( 18), f (a,b) represents the loss factor of the PV equipment, reflecting the ratio of its current value to its initial investment.a is the annual depreciation rate for the PV equipment, and b denotes its expected lifespan.Ne indicates the number of PV units invested, CI_PV is the cost per unit capacity for installing PV equipment, P PV_i is the installed capacity for the i-th PV, and COM_PV represents the operational and maintenance costs per unit capacity of the PV equipment.

Active Network Loss Optimization Model
Strategically installing PV within the limits of the distribution network's maximum carrying capacity can effectively reduce the active network losses.To minimize these losses, a mathematical model is constructed: In Equation (20), N signifies the system's operational duration, n denotes the number of system branches, Ii is the current in branch i, and R i is the resistance of branch i.

Lower-Level Objective Function Model Development
In PV planning, reducing the active network losses during system operation is crucial.Building on this, reactive power optimization becomes the central issue of the lowerlevel optimization.This process relies on the decisions made in the upper-level planning regarding the site selection and capacity determination of PV equipment.The primary goal is to minimize active network losses.Voltage stability margin and voltage deviation are also considered secondary objectives to effectively regulate the equipment.This approach integrates the goals of both the upper and lower-level planning to ensure the power system's efficient and stable operation.The model for the lower-level objective function is: In Equation (21), w* 1 , w* 2 , and w* 3 are the weights of the objective function, fulfilling the condition w* 1 + w* 2 + w* 3 = 1.The primary optimization target in this model is the system's active network loss, and hence, w* 1 has the greatest proportion, w* 1 ≥ w* 2 and w* 1 ≥ w* 3 .U i,t represents the actual voltage at node i during time t.

Constraints
The lower-level planning constraints slightly differ from those at the upper level, mainly reflecting the temporal changes in state variables [22].

1.
Load flow constraints: P DGi,t and Q DGi,t are the active and reactive powers at node i at time t, i ∈ N; θ i,j,t is the voltage angle difference between nodes i and j at time t, where G i,j and B i,j are the conductance and susceptance between these nodes.

2.
Node voltage constraints U imin and U imax represent the upper and lower voltage limits for node i, respectively.

SVC Reactive Power Output Constraints:
S PV Vi is the capacity of the distributed photovoltaic at node i, and P PV0 i,t is the theoretical output of the distributed photovoltaic at node i.This represents the minimum utilization efficiency of the distributed photovoltaics.
In Equation (24), represent the lower and upper limits of the SVC output at node i at time t.

Solving the Photovoltaic Grid-Connected Model Using an Improved Second-Order Oscillatory Chaos Mapping Particle Swarm Optimization Algorithm
Using the improved second-order oscillatory chaos mapping particle swarm optimization algorithm, rapid solutions are achieved for both upper-and lower-level models.This algorithm facilitates the efficient transmission of the global optimum between the two levels through internal iterations, and the data transfer and feedback between models, ultimately determining the locations and capacities of the distributed photovoltaic systems [23,24].

Overview of PSO
The traditional particle swarm optimization (PSO) is an optimization algorithm developed to mimic the flight trajectories of birds during foraging [25].At the start of the algorithm, a swarm of particles is generated, and the optimal solution is sought by simulating the movement of particles in space.The PSO algorithm takes related variables as target fitness and updates the state based on the current position, velocity, and historical best status of the particles.The algorithm terminates when the number of iterations reaches a preset maximum [26].Different iteration methods of the particle swarm can affect the accuracy of the final result.In each iteration, the velocity and position of the particles are Energies 2024, 17, 3251 9 of 20 calculated according to specific formulas.Through multiple iterations, particles locate the position of the optimal solution.The iteration process continues until the set number of iterations is reached.The formulas for updating the individual particle velocity and position are as follows: W is the inertia weight, c 1 is the individual learning factor, c 2 is the social learning factor, r 1 and r 2 are random numbers between 0 and 1. V i k is the current velocity of the particle, X pbesti k is the current individual best position, and X gbesti k is the global best position at iteration k.
Traditional PSO can easily fall into local optima, converge prematurely, and exhibit uneven particle distribution during iterations [18].To avoid these shortcomings, the particle swarm algorithm has been improved.

Improved Particle Swarm Optimization Algorithm 6.2.1. Chaotic Mapping of Population
In traditional PSO, randomly generated initial positions and velocities can lead to uneven particle distribution in the iteration search space, affecting the algorithm's global search capability.To address this issue, chaotic mapping is introduced to initialize particles.This establishes chaotic mapping for initializing particle positions, enhancing the search range of the swarm and increasing the randomness of particle solutions [27].In this paper, random numbers generated by the logistic map are used as initial positions to increase the diversity of particle solutions, accelerating the convergence speed and enhancing the performance of the algorithm.
The mathematical expression for the logistic map: In Equation (31), r is the control parameter, also known as the chaos mapping parameter.When r is between 0 and 4, the system exhibits periodic and chaotic behavior, and it may also converge to a stable state.At r = 4, the system exhibits the maximum chaotic behavior.
Steps for logistic population initialization: (1) Define the logistic chaos function to generate a D-dimensional vector, with each component within the rand (0,1) range.(2) Use the logistic function to map the population position.

Self-Adaptive Inertia Weight Iteration Improvement
The value of the inertia weight W significantly impacts the algorithm's global and local search capabilities.A high W value can accelerate the convergence of the swarm but reduces the search range, diminishing the diversity of the particle swarm and making, it prone to falling into local optima.Conversely, a low W value can lead to an excessive local search, slowing convergence, and losing global search capability, similarly making it easy to fall into local optima [28].
To balance local and global search capabilities, this paper adopts a self-adaptive inertia weight method, adjusting the inertia weight value appropriately as the number of iterations increases.In the early stages of iteration, a larger inertia weight is set to enhance the global search capability; in later stages, the inertia weight is gradually reduced in a nonlinear manner to enhance the algorithm's local search capability.The expression for self-adaptive inertia weight is: In Equation (32), fit i is the current fitness of the particle, fit gbest is the best fitness among the particle population; and fit 0 is the critical population fitness.In Equation (33), W max is the maximum weight factor, and W min is the minimum weight factor.

Iterative Algorithm Improvement
In the PSO algorithm, the updated particle velocity is determined by the individual's historical best position and the global historical best position, but the relative positions of particles are not fully considered.To improve the precision and coverage of the global search, this paper introduces oscillatory variables, which involve perturbations near the optimal solution to generate new solutions, thereby allowing the algorithm's particles not only to seek existing optimal solutions but also to enhance the diversity of particles [29,30].Such improvements help prevent the algorithm from prematurely converging to local optima, while also enhancing the exploration capability of the algorithm.The update formula for the iterative algorithm is: In Equation (34), λ 1 and λ 2 represent the convergence rates for gradual and oscillatory convergence within the particle swarm, respectively: When the iteration count t ≤ T/2, the algorithm exhibits an oscillatory convergence: When the iteration count t > T/2, the algorithm undergoes progressive convergence: Figures 3 and 4 respectively show the convergence curves at different numbers of population iterations.The PSO algorithm was validated using benchmark functions.Five common benchmark functions were selected to test the algorithm.The sphere function was used to evaluate the convergence efficiency of the algorithm; the Rosenbrock function was used to assess the evaluation accuracy of the algorithm; the Levy function and Griewank function, both multimodal benchmark functions, were used to test the algorithm's performance in the presence of multiple local optima; the Goldstein-Price function was employed to examine the algorithm's global search capability.Table 1 provides relevant data for these benchmark functions.tion was used to evaluate the convergence efficiency of the algorithm; the Rosenbrock function was used to assess the evaluation accuracy of the algorithm; the Levy function and Griewank function, both multimodal benchmark functions, were used to test the algorithm's performance in the presence of multiple local optima; the Goldstein-Price function was employed to examine the algorithm's global search capability.Table 1 provides relevant data for these benchmark functions.To verify that the improved PSO algorithm's convergence is superior to the original PSO algorithm and to other improved PSO algorithms, comparative experiments were conducted using the same benchmark parameters.The specific settings were as follows: the particle swarm size was 50, the dimensionality was 50, and the number of iterations was 2000.The benchmark function test results and the comparison of the convergence precision for each function are shown in Figures 5 and 6.Table 1 shows the relevant parameters of the benchmark functions.To verify that the improved PSO algorithm's convergence is superior to the original PSO algorithm and to other improved PSO algorithms, comparative experiments were conducted using the same benchmark parameters.The specific settings were as follows: the particle swarm size was 50, the dimensionality was 50, and the number of iterations was 2000.The benchmark function test results and the comparison of the convergence precision for each function are shown in Figures 5 and 6.Table 1 shows the relevant parameters of the benchmark functions.To verify that the improved PSO algorithm's convergence is superior to the original PSO algorithm and to other improved PSO algorithms, comparative experiments were conducted using the same benchmark parameters.The specific settings were as follows: the particle swarm size was 50, the dimensionality was 50, and the number of iterations was 2000.The benchmark function test results and the comparison of the convergence precision for each function are shown in Figures 5 and 6.Table 1 shows the relevant parameters of the benchmark functions.Figure 6 shows that the SCMPSO algorithm demonstrates significant advantages early in the iteration process.When the iterations reach around 500, the results of the four particle swarm optimization algorithms converge to approximately zero.To ensure the reliability of the algorithm, the number of iterations should not be less than 500.In this study, 2000 iterations were selected to avoid the potential issue of insufficient iterations compromising the validation of the algorithm's effectiveness.
From Figures 5 and 6, it is evident that the proposed SCMPSO algorithm outperforms other PSO algorithms in terms of convergence speed, search range, and convergence precision.Additionally, when addressing complex problems, this algorithm exhibits the characteristics of rapid convergence, high efficiency, and high stability.

Model Solution
The flowchart for solving the two-layer distributed photovoltaic planning model in the distribution network using the SCMPSO algorithm is shown in Figure 7.  Figure 6 shows that the SCMPSO algorithm demonstrates significant advantages early in the iteration process.When the iterations reach around 500, the results of the four particle swarm optimization algorithms converge to approximately zero.To ensure the reliability of the algorithm, the number of iterations should not be less than 500.In this study, 2000 iterations were selected to avoid the potential issue of insufficient iterations compromising the validation of the algorithm's effectiveness.
From Figures 5 and 6, it is evident that the proposed SCMPSO algorithm outperforms other PSO algorithms in terms of convergence speed, search range, and convergence precision.Additionally, when addressing complex problems, this algorithm exhibits the characteristics of rapid convergence, high efficiency, and high stability.

Model Solution
The flowchart for solving the two-layer distributed photovoltaic planning model in the distribution network using the SCMPSO algorithm is shown in Figure 7. Figure 6 shows that the SCMPSO algorithm demonstrates significant advantages early in the iteration process.When the iterations reach around 500, the results of the four particle swarm optimization algorithms converge to approximately zero.To ensure the reliability of the algorithm, the number of iterations should not be less than 500.In this study, 2000 iterations were selected to avoid the potential issue of insufficient iterations compromising the validation of the algorithm's effectiveness.
From Figures 5 and 6, it is evident that the proposed SCMPSO algorithm outperforms other PSO algorithms in terms of convergence speed, search range, and convergence precision.Additionally, when addressing complex problems, this algorithm exhibits the characteristics of rapid convergence, high efficiency, and high stability.

Model Solution
The flowchart for solving the two-layer distributed photovoltaic planning model in the distribution network using the SCMPSO algorithm is shown in Figure 7.

Bilevel Planning Model Solution Steps:
Energies 2024, 17, 3251 13 of 20 Step 1: Establish the upper-level planning model.Input the network component parameters, active, and reactive power outputs of conventional photovoltaic (PV) systems, SVC (static VAR compensator) devices, and conventional load parameters.
Step 2: Solve the upper-level model using the SCMPSO algorithm.Determine the PV equipment access locations and capacities at each node, and pass the results to the lower level.
Step 3: Establish the lower-level optimization model with the objectives of reducing active power losses, voltage stability margins, and voltage deviations.
Step 4: Solve the lower-level model using the SCMPSO algorithm to obtain the reactive power optimization values.Pass the optimized values back to the upper-level model for the next iteration.
Step 5: Evaluate the convergence conditions.If the preset number of iterations is reached, terminate the process and output the current optimal PV equipment access locations and capacities.If not, continue from Step 1 to Step 4 until the optimal conditions are achieved.
In this paper, the PV access capacity in the first layer is a continuous variable, and the PV access device location is a discrete variable.The upper-level objective function is challenging to solve linearly, so the improved particle swarm optimization (SCMPSO) is used for multi-objective solving.
The second layer of planning is essentially an optimal power flow problem.The non-convex power flow model is relaxed using the second-order cone relaxation method, with the following constraints: Equation ( 40) to (41), Pj and Qj represent the active and reactive power at the node, respectively; Re denotes the real part of the expression, and Im denotes the imaginary part; Yij* represents the conjugate of the admittance matrix between branch i−j; Gij represents the real part of the admittance matrix; rij and xij are the resistance and reactance of the branch, respectively.Other variables used in the equations are annotated in Sections 2 and 3 of the paper and are not explained here again.

Case Analysis
This study uses the improved IEEE-33 node distribution network system, as shown in Figure 8.
Energies 2024, 17, x FOR PEER REVIEW 14 of 20 the branch, respectively.Other variables used in the equations are annotated in Sections 2 and 3 of the paper and are not explained here again.

Case Analysis
This study uses the improved IEEE-33 node distribution network system, as shown in Figure 8.The IEEE-33 node system has a distribution network load of 3.715 MW + 2.3 MVAR and a base voltage of 12.66 kV.The system node voltage safety range is set between 0.95 and 1.05 p.u.The distribution network uses LGJ-150 conductors(which was manufactured by Hebei Guangjie Cable Co., Ltd., located in Cangzhou, Hebei, China.), with a maximum allowable continuous current of 375 A. The unit investment cost for distributed PV is 3500 CNY/kW, and the average operation and maintenance cost per unit is 50 CNY/kWh.The annual depreciation rate is 0.05, and the service life is 25 years.At the beginning of the distribution network, there is an on-load tap-changing transformer (OLTC) with 11 tap positions and a voltage regulation range from 0.95 to 1.05 p.u.
Assuming that each node in the distribution network can be equipped with a distributed PV and energy storage, the number of distributed PV installations is set to 6. Additionally, three static VAR compensators (SVG) with an installed capacity of 200 kVar each are added and connected to nodes 6, 8, and 33.The number of energy storage installations is 4, with an initial charge/discharge efficiency of 75%.In the distribution network, nodes with PV system connections must ensure stability in multiple aspects, including voltage levels, reasonable load distribution, and stable power quality.
This study employs the K-means clustering method to analyze the annual solar intensity and basic load data for a location in Jiangsu, China.The year is divided into five scenarios, labeled from 1 to 5.
Scenario 1: Weak solar intensity, rainy days, low electricity consumption, and light load, mostly occurring during rainy days in spring and winter.
Scenario 2: Slightly stronger solar intensity compared to Scenario 1, low electricity consumption, and light load, common during clear days in spring and winter.Scenario 3: A stronger solar intensity than Scenario 2, higher electricity consumption and moderate load, typical in late spring and early autumn.
Scenario 4: Strong solar intensity within a day, but reduced due to thunderstorms, high electricity consumption, and heavy load, often seen on rainy summer days.
Scenario 5: Very strong solar intensity throughout the day, high electricity consumption, and heavy load, usually occurring on clear summer days.
Figure 9 shows the division of the annual solar intensity and load status into five scenarios.Figure 10 illustrates the normalized load trend over 24 h on a specific day of the The IEEE-33 node system has a distribution network load of 3.715 MW + 2.3 MVAR and a base voltage of 12.66 kV.The system node voltage safety range is set between 0.95 and 1.05 p.u.The distribution network uses LGJ-150 conductors(which was manufactured by Hebei Guangjie Cable Co., Ltd., located in Cangzhou, Hebei, China.), with a maximum allowable continuous current of 375 A. The unit investment cost for distributed PV is 3500 CNY/kW, and the average operation and maintenance cost per unit is 50 CNY/kWh.The annual depreciation rate is 0.05, and the service life is 25 years.At the beginning of the distribution network, there is an on-load tap-changing transformer (OLTC) with 11 tap positions and a voltage regulation range from 0.95 to 1.05 p.u.
Assuming that each node in the distribution network can be equipped with a distributed PV and energy storage, the number of distributed PV installations is set to 6. Additionally, three static VAR compensators (SVG) with an installed capacity of 200 kVar each are added and connected to nodes 6, 8, and 33.The number of energy storage installations is 4, with an initial charge/discharge efficiency of 75%.In the distribution network, nodes with PV system connections must ensure stability in multiple aspects, including voltage levels, reasonable load distribution, and stable power quality.
This study employs the K-means clustering method to analyze the annual solar intensity and basic load data for a location in Jiangsu, China.The year is divided into five scenarios, labeled from 1 to 5.
Scenario 1: Weak solar intensity, rainy days, low electricity consumption, and light load, mostly occurring during rainy days in spring and winter.
Scenario 2: Slightly stronger solar intensity compared to Scenario 1, low electricity consumption, and light load, common during clear days in spring and winter.Scenario 3: A stronger solar intensity than Scenario 2, higher electricity consumption and moderate load, typical in late spring and early autumn.
Scenario 4: Strong solar intensity within a day, but reduced due to thunderstorms, high electricity consumption, and heavy load, often seen on rainy summer days.
Scenario 5: Very strong solar intensity throughout the day, high electricity consumption, and heavy load, usually occurring on clear summer days.
Figure 9 shows the division of the annual solar intensity and load status into five scenarios.Figure 10 illustrates the normalized load trend over 24 h on a specific day of the year.The load trend is influenced by factors such as seasons and holidays, but overall trends exhibit certain similarities, with differences mainly in the load magnitude.
year.The load trend is influenced by factors such as seasons and holidays, but overall trends exhibit certain similarities, with differences mainly in the load magnitude.

Actual Simulation and Comparative Analysis
Based on Figure 9, which shows the annual solar intensity and load scenarios, and Figure 10, the 24 h load trend in Jiangsu, this study uses the SCMPSO algorithm for simulation and solution.By employing the proposed two-level optimization approach, this research aims to provide reasonable optimization strategies for PV integration into the distribution network system, thereby enhancing economic efficiency.
Table 2 provides the access locations and capacities of distributed PV for three different scenarios, along with the corresponding access locations, capacities, and power of the energy storage systems.The specific scenarios are as follows: Scenario 1: Distributed PV access parameters under the condition of maximum voltage stability.
Scenario 2: Distributed PV access parameters under the condition of maximum economic efficiency.
Scenario 3: Distributed PV access parameters considering the system carrying capacity, economic efficiency, public interest, and grid stability margin.
Table 3 presents the cost analysis under different planning scenarios.After determining the configuration of distributed PV and energy storage equipment in Table 1, the upper-level optimization provides the investment cost and annual operation and maintenance cost of PV equipment, as well as the proportion of distributed PV generation in the

Actual Simulation and Comparative Analysis
Based on Figure 9, which shows the annual solar intensity and load scenarios, and Figure 10, the 24 h load trend in Jiangsu, this study uses the SCMPSO algorithm for simulation and solution.By employing the proposed two-level optimization approach, this research aims to provide reasonable optimization strategies for PV integration into the distribution network system, thereby enhancing economic efficiency.
Table 2 provides the access locations and capacities of distributed PV for three different scenarios, along with the corresponding access locations, capacities, and power of the energy storage systems.The specific scenarios are as follows: Scenario 1: Distributed PV access parameters under the condition of maximum voltage stability.
Scenario 2: Distributed PV access parameters under the condition of maximum economic efficiency.
Scenario 3: Distributed PV access parameters considering the system carrying capacity, economic efficiency, public interest, and grid stability margin.
Table 3 presents the cost analysis under different planning scenarios.After determining the configuration of distributed PV and energy storage equipment in Table 1, the upper-level optimization provides the investment cost and annual operation and maintenance cost of PV equipment, as well as the proportion of distributed PV generation in the

Actual Simulation and Comparative Analysis
Based on Figure 9, which shows the annual solar intensity and load scenarios, and Figure 10, the 24 h load trend in Jiangsu, this study uses the SCMPSO algorithm for simulation and solution.By employing the proposed two-level optimization approach, this research aims to provide reasonable optimization strategies for PV integration into the distribution network system, thereby enhancing economic efficiency.
Table 2 provides the access locations and capacities of distributed PV for three different scenarios, along with the corresponding access locations, capacities, and power of the energy storage systems.The specific scenarios are as follows: Scenario 1: Distributed PV access parameters under the condition of maximum voltage stability.
Scenario 2: Distributed PV access parameters under the condition of maximum economic efficiency.
Scenario 3: Distributed PV access parameters considering the system carrying capacity, economic efficiency, public interest, and grid stability margin.
Table 3 presents the cost analysis under different planning scenarios.After determining the configuration of distributed PV and energy storage equipment in Table 1, the upperlevel optimization provides the investment cost and annual operation and maintenance cost of PV equipment, as well as the proportion of distributed PV generation in the overall system.In Scenario 1, the PV equipment access capacity is 1280 kwh with a total cost of CNY 87.1 million; in Scenario 2, the PV equipment access capacity is 1140 kWh with a total cost of CNY 74.645 million; in Scenario 3, the PV equipment access capacity is 1260 kWh with a total cost of CNY 83.116 million.

Distribution Network Node Voltage Status
Table 4 presents comparative data on the voltage status at distribution network nodes across five scenarios under three operating modes: without any PV or energy storage devices, with only PV devices but no energy storage, and with both the PV and energy storage devices.Insights from Table 3 include the following.
With only PV devices and no energy storage, the system is the least stable, exhibiting the most instances of voltage violations, the greatest voltage deviations, and the poorest Scenarios 1 and 2: These scenarios are characterized by lower photovoltaic (PV) outputs and lighter loads, which result in a more gradual distribution of energy storage charging during the afternoon periods.The reduced solar generation leads to less demand on the storage systems, allowing for smoother energy intake and less variability in charging requirements.
Scenarios 3, 4, and 5: In these scenarios, the PV output is considerably higher, and the load gradually increases, necessitating the more concentrated charging of distributed PV systems in the afternoon.This is indicative of peak solar hours aligning with higher energy consumption patterns, maximizing the use of solar power directly and reducing the reliance on stored energy during these periods.
Scenarios 4 and 5: The loads in these scenarios are nearly identical; however, due to meteorological variations, the PV output in Scenario 5 is greater than in Scenario 4. Despite similar timings for charging and discharging the energy storage devices, the power levels vary.This indicates that Scenario 5 may require the more dynamic management of energy storage due to higher PV outputs, potentially leading to more aggressive charging strategies or faster discharge rates to stabilize the grid.
These insights highlight the need for adaptive energy storage management strategies that can respond to fluctuations in both solar energy generation and consumption demands, ensuring stability and efficiency in the power supply.

Distribution Network Node Voltage Status
Table 4 presents comparative data on the voltage status at distribution network nodes across five scenarios under three operating modes: without any PV or energy storage devices, with only PV devices but no energy storage, and with both the PV and energy storage devices.Insights from Table 3 include the following.With only PV devices and no energy storage, the system is the least stable, exhibiting the most instances of voltage violations, the greatest voltage deviations, and the poorest stability margins.In this mode, the electrical energy produced by PV cannot be effectively stored, leading to increased voltage fluctuations.With both PV and energy storage devices, the system operates in the most stable condition, with the fewest voltage violations, minimal voltage deviations, and the best stability margins.This indicates that the use of energy storage devices can effectively mitigate the voltage fluctuations and instability introduced by the integration of PV devices into the system.These data clearly demonstrate that the charging and discharging of energy storage devices not only support the stability of the grid operations but also effectively alleviate the adverse impacts caused by PV integration, thereby enhancing the overall operational efficiency and safety of the system.Figure 12 shows the time-varying curves of active power loss across five scenarios under three operating modes.From these scenarios, it is evident that integrating the distributed photovoltaic (PV) and energy storage devices can effectively reduce the active power losses in the network.Night and early morning: During these periods, there is no sunlight, and the PV systems are inactive with no power output.As shown in Figure 11, energy storage devices are in charging mode during the night and early morning.However, due to the low load and minimal losses during these times, there is not much additional power loss.Thus, in the initial stages of all five scenario graphs, the curves for the three operating states almost coincide.Daytime with increasing load: As the system load the actions of PV and energy storage devices cause changes in active power loss over time, leading to deviations among the three curves.Scenarios 1, 2, and 3 exhibit lower PV output and, consequently, lower system power loss compared to Scenarios 4 and 5. Scenarios 4 and 5 experience the highest system loads and the greatest PV output.As a result, there is a slight increase in the system power loss due to the higher energy throughput.In summary, the integration of PV and energy storage devices in the distribution network significantly mitigates active power losses, particularly during periods of high solar output and peak loads.Figure 12 shows the time-varying curves of active power loss across five scenarios under three operating modes.From these scenarios, it is evident that integrating the distributed photovoltaic (PV) and energy storage devices can effectively reduce the active power losses in the network.Night and early morning: During these periods, there is no sunlight, and the PV systems are inactive with no power output.As shown in Figure 11, energy storage devices are in charging mode during the night and early morning.However, due to the low load and minimal losses during these times, there is not much additional power loss.Thus, in the initial stages of all five scenario graphs, the curves for the three operating states almost coincide.Daytime with increasing load: As the system load increases, the actions of PV and energy storage devices cause changes in active power loss over time, leading to deviations among the three curves.Scenarios 1, 2, and 3 exhibit lower PV output and, consequently, lower system power loss compared to Scenarios 4 and 5. Scenarios 4 and 5 experience the highest system loads and the greatest PV output.As a result, there is a slight increase in the system power loss due to the higher energy throughput.In summary, the integration of PV and energy storage devices in the distribution network significantly mitigates active power losses, particularly during periods of high solar output and peak loads.From the above analysis, it can be seen that the integration of PV devices increases the instability of system node voltages, which is detrimental to the stable operation of the system.However, by reasonably planning the access nodes and capacities of distributed PV and energy storage devices, the aforementioned issues can be effectively avoided.As shown in Figures 11 and 12, and Table 3, the distributed PV two-level planning based on the proposed SCMPSO algorithm not only enhances system capacity but also reduces the active power losses, improves economic efficiency, and decreases the voltage deviations.

Figure 2 .
Figure 2. Two-level planning framework for distributed photovoltaics.

Figure 2 .
Figure 2. Two-level planning framework for distributed photovoltaics.

Figure 5 .
Figure 5. Test results of various benchmark functions.Figure 5. Test results of various benchmark functions.

Figure 5 .
Figure 5. Test results of various benchmark functions.Figure 5. Test results of various benchmark functions.

Figure 6 .
Figure 6.Iteration comparison of different particle swarm optimization algorithms.

Figure 6 .
Figure 6.Iteration comparison of different particle swarm optimization algorithms.

Figure 9 .
Figure 9. Annual solar intensity and load status.

Figure 9 .
Figure 9. Annual solar intensity and load status.

Energies 2024 ,
17,  x FOR PEER REVIEW 15 of 20 year.The load trend is influenced by factors such as seasons and holidays, but overall trends exhibit certain similarities, with differences mainly in the load magnitude.

Figure 9 .
Figure 9. Annual solar intensity and load status.

Figure 11 20 Figure 11 .
Figure 11 displays the optimal timing for charging and discharging under five scenarios within a comprehensive planning scheme.Energies 2024, 17, x FOR PEER REVIEW 17 of 20

Figure 11 .
Figure 11.Charging and discharging schematic of energy storage devices across five scenarios.

3 .
Active Power Loss in the Distribution Network

Figure 12 .
Figure 12.Active power loss over time across five scenarios.Figure 12. Active power loss over time across five scenarios.

Figure 12 .
Figure 12.Active power loss over time across five scenarios.Figure 12. Active power loss over time across five scenarios.

Table 1 .
Parameters of benchmark functions.

Table 1 .
Parameters of benchmark functions.

Table 1 .
Parameters of benchmark functions.

Table 2 .
Node location and capacity configuration of distributed photovoltaic under two-level planning scenarios.

Table 3 .
Cost analysis under different planning scenarios.
7.2.Operating Results under the Two-Level Planning Approach 7.2.1.Operation State of Energy Storage Devices

Table 4 .
Voltage data for each scenario with and without PV and energy storage device integration.