## 5 Application of I-GWO to the Proposed Problem  
### Problem Formulation  
The objective of the DSTATCOM placement and sizing problem considered in this paper is the maximization of TACS while enhancing the voltage profile.  
Figure 8: Gray wolf hunting strategy.  
The investment cost of the DSTATCOM per year [23] is computed as below:  
\[ICD_{year}=CD\frac{\left(1+B\right)^{n}\times B}{\left(1+B\right)^{n}-1} \tag{37}\]  
where \(CD\) is the cost of the DSTATCOM, \(B\) is the rate of return, and \(n\) is the lifetime of the DSTATCOM in years. In this paper: \(CD=50\$/\mathrm{kV}\mathrm{A}\mathrm{r}\mathrm{a}\mathrm{r}\), \(n=1\), and \(B=0.1\).  
To calculate the total annual cost savings (TACS) [23], the overall energy loss costs before and after the installation of the DSTATCOM must be considered, as follows:  
\[TACS=K_{P}\Big{(}T\times P_{TLoss}^{Before}\Big{)}-K_{P}\Big{(}T\times P_{ TLoss}^{After}\Big{)}-\big{(}ICD_{year}\big{)} \tag{38}\]  
where \(K_{P}\) is the energy cost of losses and is given a value of \(0.06\$/\mathrm{kW}\mathrm{h}\). \(T\) is the annual number of hours, equivalent to 8760 h annually, \(P_{TLoss}^{Before}\) and \(P_{TLoss}^{After}\) are the total active losses before and after installing the DSTATCOM, respectively. The TACS in the per-unit system can be expressed as follows:  
\[TACS_{(p.u.)}=\frac{TACS}{K_{P}\Big{(}T\times P_{TLoss}^{Before}\Big{)}} \tag{39}\]  
The total power losses \(P_{TLoss}\) in the distribution system can be determined using the following formula [11]:  
\[P_{TLoss}=\sum_{i\in\mathbb{R}_{bus}}\sum_{j\in\mathbb{R}_{bus}}\big{[}\alpha_ {ik}\big{(}P_{i}P_{k}+Q_{i}Q_{j}\big{)}+\beta_{ik}\big{(}Q_{i}P_{k}-P_{i}Q_{j} \big{)}\big{]} \tag{40}\]  
where \(P_{i}\) and \(Q_{i}\) are the active and reactive power injected at bus \(i\), \(\mathbb{N}_{bus}\) is the set of system buses, and \(\alpha_{ik}\), \(\beta_{ik}\) can be calculated as follows:  
\[\alpha_{ik}=\frac{r_{ik}}{V_{i}V_{k}}\cos(\theta_{i}-\theta_{k}) \tag{41}\]  
\[\beta_{ik}=\frac{r_{ik}}{V_{i}V_{k}}\sin(\theta_{i}-\theta_{k}) \tag{42}\]  
Thus, the objective function can be defined as:  
\[\max\ F_{obj}=\underbrace{\kappa\times TACS_{(p.u.)}}_{(1)}\ \ \ \ \underbrace{-(1-\kappa)\times V_{D}}_{(2)} \tag{43}\]  
where \(\kappa\) is a weighting factor selected from the range [0, 1] in a manner that ensures that the voltage profile remains within an acceptable range (\(\pm\)5%) and \(V_{D}\), the voltage deviation, can be calculated as follows:  
\[V_{D}=\sum_{i\in\mathbb{N}_{bus}}\left|1-V_{i}\right| \tag{44}\]  
* The first term in Equation (43) aims to maximize the TACS by minimizing both power loss costs and DSTATCOMs costs.
* The second term in Equation (43) aims to improve the voltage profile by reducing the voltage deviation \(V_{D}\). This problem is subject to the following equality and inequality constraints:  
1. Power Flow Equations: The net active and reactive powers must be equal to zero, and the node voltage equation must be satisfied at each bus: \[P_{i}=P_{i-1}-P_{L,i}-r_{i-1,i}\Big{(}P_{i-1}^{2}+Q_{i-1}^{2}\Big{)}/\left|V _{i-1}\right|^{2}\ \forall i\in\mathbb{N}_{bus}\] (45)\[Q_{i}=Q_{i-1}-Q_{L,j}-x_{i-1,i}\left(P_{i-1}^{2}+Q_{i-1}^{2}\right)/\left|V_{i-1} \right|^{2}\ \ \forall i\in\aleph_{bus} \tag{46}\] \[V_{i}^{2}=V_{i}\cdot V_{i-1}+\sqrt{\left(P_{i}^{2}+Q_{i}^{2} \right)\cdot\left(T_{i,i-1}^{2}+x_{i,i-1}^{2}\right)}\ \forall i\in\aleph_{bus} \tag{47}\]
2. Branch flow limits: The current in each branch of the distribution system must not surpass the maximum permissible current limit \(I_{\max}\), as expressed by: \[\left|I_{i,j}\right|\leq I_{i,j}^{\max}\ \forall i,j\in\aleph_{branch}\] (48)