**3. The Mathematical Model for Optimal Allocation of BESS**

#### *3.1. Objective Function*

After the DC locking fault occurs in the AC/DC hybrid system, when the system optimizes the configuration of BESS, it should also have a certain economy while eliminating the power flow over-limit on the sensitive and vulnerable lines. Therefore, the multi-objective function of the optimal configuration of BESS in the AC/DC hybrid system is as follows:

$$\max \Gamma = \sum\_{k=1}^{K} \left| \frac{\Delta P'}{D\_{k-A} \cdot P\_{\text{dc}-\text{max}}} \right| \tag{11}$$

$$\text{minG}\_{inv} = \frac{r(1+r)^y}{(1+r)^y - 1} \cdot (c\_1 \cdot P\_\varepsilon + c\_2 \cdot E\_\varepsilon) \tag{12}$$

where Γ is the sum of the improved power flow exceeding risk index of sensitive vulnerable lines after DC blocking fault; *Dk*−*<sup>A</sup>* is the LODF; *P*dc−max is the thermal stability limit value of DC line; *Ginv* is the annual investment cost of BESS; *c*1, *c*<sup>2</sup> are the unit power cost and capacity cost of BESS; *Pe*, *Ee* are the rated power and rated capacity of the BESS, respectively; *r* is the annual interest rate of the fund; *Y* is the life cycle of BESS; *K* is the sensitive vulnerability line.

### *3.2. Constraint*

(1) Power balance constraints

$$\sum\_{m=1}^{M} P\_{G,m} + \sum\_{n=1}^{N} P\_{L,n} + \sum\_{s=1}^{S} P\_{B,s} = 0 \tag{13}$$

where *PG*,*m*, *PL*,*n*, *PB*,*<sup>s</sup>* are, respectively, the output of generator *m*, the required power of load *n*, and the charging and discharging power of BESS s; *S* is the quantity of configured BESS in the system; *M* and *N* are the number of generators and the number of loads in the system.

(2) Line loss constraint

$$P\_{\mathbb{R}}^{\prime} \mathcal{U}\_{\mathbb{R}}^{2} \geq \, \mathcal{R}\_{\mathbb{R}} \cdot \left(P\_{\mathbb{R}}^{\prime, 2} + \mathcal{Q}\_{\mathbb{R}}^{\prime, 2}\right) \tag{14}$$

where *P <sup>R</sup>*, *Q <sup>R</sup>* are the active power and reactive power transmitted by the receiving end of the *R* line, respectively; *RR* is the resistance of the *R* line; *UR* is the voltage amplitude of the receiving terminal node of the Rth line.

(3) Generator power constraint

$$
\overline{P}\_{G,m} \le P\_{G,m} \le \underline{P}\_{G,m} \tag{15}
$$

where *PG*,*m*, *PG*,*<sup>m</sup>* are the upper and lower limits of generator output, respectively. (4) Line power constraint

$$
\overline{P}\_{L,m} \le P\_{L,m} \le \underline{P}\_{L,m} \tag{16}
$$

where *PL*,*m*, *PL*,*<sup>m</sup>* are the upper and lower limits of the active power of the transmission line.

(5) Capacity constraints of BESS

$$S\_{\min} \le S\_r \le S\_{\max} \tag{17}$$

where *S*min, *S*max are the minimum and maximum capacities of BESS, respectively. (6) Power constraint of BESS charge and discharge

$$\begin{cases} -P\_{r,\text{max}} \le P\_r^c \le 0\\ 0 \le P\_r^d \le P\_{r,\text{max}} \end{cases} \tag{18}$$

where *Pr*,max is the maximum value of BESS discharge power; *P<sup>c</sup> <sup>r</sup>* , *P<sup>d</sup> <sup>r</sup>* are the charge power and discharge power of the BESS system, respectively.

#### **4. Model-Solving Method**

The sharing of information among the entire population is beneficial for the population towards a better position in genetic algorithms. Only the best individual's information is shared in PSO, and the entire search process is tracking the optimal solution. So, the PSO algorithm has faster convergence than the genetic algorithm. And due to its advantages of high accuracy and fast convergence, the PSO algorithm is widely used in BESS capacity configuration [33,34]. Therefore, this article chooses the PSO algorithm for solving BESS capacity configuration.

To reasonably obtain the location of BESS, the PSO algorithm is used to solve for the optimal capacity of BESS, and the optimal location of BESS is selected from candidate nodes. Meanwhile, BESS adopts the active power control strategy, including plant-level control and local control, which quickly eliminates the power exceeding the limit of the AC line, suppresses the power fluctuation of the power grid, and ensures the safe and stable operation ability of the power grid.

The specific process is shown in Figure 1, and the solution steps are as follows:


$$x\_{i\rangle} = x\_{\rangle}^{\text{min}} + rand() \cdot (x\_{\rangle}^{\text{max}} - x\_{\rangle}^{\text{min}}) \tag{19}$$

where *i* = 1, 2, ... , *N* is a D-dimension vector; *j* = 1, 2, ... , *d*; *rand*() represents random numbers between 1 and 0; *x*max *<sup>j</sup>* , *<sup>x</sup>*min *<sup>j</sup>* are the maximum and minimum values of particles, respectively;

(8) Calculate the fitness value for particles by using (20). It is updated local optimal position and global optimal position by using Equations (21) and (22).

$$p\_i = \frac{F\_i}{\sum\_{k=1}^{N} F\_k} \tag{20}$$

$$v\_{i\bar{j}}(t+1) = w \times v\_{i\bar{j}}(t) + \varepsilon\_1 \times rand() \times \left(p\_{i\bar{j}}(t) - x\_{i\bar{j}}(t)\right) + \varepsilon\_2 \times rand() \times \left(p\_{i\bar{j}}(t) - x\_{i\bar{j}}(t)\right) \tag{21}$$

$$\mathbf{x}\_{i\bar{j}}(t+1) = \mathbf{x}\_{i\bar{j}}(t) + \upsilon\_{i\bar{j}}(t+1) \tag{22}$$

where *Fi* is the corresponding fitness value for particles I; *vij*(*t* + 1), *vij*(*t*) are the velocity of the ith particle at *t* + 1, *t* times, respectively; *w* is the inertia factor; *w* = 0.8, *c*<sup>1</sup> and *c*<sup>2</sup> are the learning rate; *c*<sup>1</sup> = 0.9, *c*<sup>2</sup> = 0.9. *pij*(*t*), *pgj*(*t*) respectively represent the individual optimal value and the global optimal value of particles;

(9) Output optimal solution. If the iteration number is greater than the set value, then output the Parote optimal. Otherwise, return to step (7).

**Figure 1.** Solution flow of BESS optimization configuration.
