## 2 Mathematical Formulation of OPSC Problem  
The OPSC problem basically aims at determining the locations, sizes, and types of SCs such that the main objective of this optimization problem is achieved. The system's total annual cost is set as the objective function (OF). This OF includes the annual cost of active power loss (APL) in addition to the annual cost of SCs' installation and operation. The decision variables required to be optimized are both locations and sizes of SCs, which are denoted as: (_LOC_, _SIZE_), where the vector _LOC_: [_Loc_,..., _Loc_\({}_{n_{SC}}\)] is the SCs' locations, the vector _SIZE_: [\(Q_{SC_{1}}\),..., \(Q_{SC_{n_{SC}}}\)] denotes the SCs' sizes, and \(n_{SC}\) is the number of buses where SCs are installed. Hence, it is required to minimize the total cost according to those decision variables, subject to several equality and inequality constraints. The mathematical formulation of the OPSC problem can be expressed as the following [27]:  
\[Cost_{tot}(LOC,SIZE)=C_{P}*APL*T+D*(C_{I}*n_{SC}+C_{Q}*\sum_{i=1}^{n_{SC}}Q_{ SC_{i}})+C_{O}*n_{SC} \tag{1}\]  
\[\minCost_{tot}(LOC,SIZE). \tag{2}\]  
Subject to  
\[P_{ss}=APL+\sum_{i=1}^{n_{L}}P_{L_{i}} \tag{3}\]  
\[Q_{ss}+\sum_{i=1}^{n_{SC}}Q_{SC_{i}}=RPL+\sum_{i=1}^{n_{L}}Q_{L_{i}} \tag{4}\]  
\[V_{min}\leq V_{i}\leq V_{max} \tag{5}\]  
\[\sum_{i=1}^{n_{SC}}Q_{SC_{i}}\leq\sum_{i=1}^{n_{L}}Q_{L_{i}} \tag{6}\]  
\[Q_{SCmin}\leq Q_{SCi}\leq Q_{SCmax}. \tag{7}\]  
As given in (1) and (2), the total cost has to be effectively minimized, where \(T\) is the time (taking the total hours in a year), \(C_{P}\), \(C_{I}\), \(C_{Q}\), and \(C_{O}\) represent the cost factors per kW-h, installation, kVAr, and operation, respectively, \(D\) denotes the depreciation coefficient, and \(Q_{SC_{i}}\) is the size of the installed SC's at bus \(i\) in kVAr. All the constants' values are taken as in [26; 27; 28] and also given in Table 1.  
It should be noted that the decision variables _LOC_ indirectly contribute in the OF (_Cost\({}_{tot}\)_), since according to those locations, the values of the decision variables _SIZE_ will be determined. Equations (3) to (7) form the problem's constraints. The power balance equality constraints formulated in (3) and (4)  
\begin{table}
\begin{tabular}{c c c} \hline \hline \(T=8760\) & \(C_{P}=0.06\)\%/kW h & \(C_{Q}=25\)\%/kVAr \\ \hline \(D=0.2\) & \(C_{I}=1600\)\$ & \(C_{O}=300\)\$/year/location \\ \hline \hline \end{tabular}
\end{table}
Table 1: The utilized parameters of the total cost objective function.  
are the system's load flow with the presence of SCs, where RPL denotes the reactive power loss, \(P_{ss}\) and \(Q_{ss}\) are the substation's active and reactive powers, respectively, \(P_{L_{i}}\) and \(Q_{L_{i}}\) are the \(i\)th load's active and reactive powers, and \(n_{L}\) is the total number of loads. The load flow in this paper is solved by a backward-forward sweep algorithm (BFSA). Furthermore, some inequality constraints are formulated as in (5) which represents the voltage limitation, where the voltages at all buses (\(V_{i},i=1,\ldots,\,n\): total number of buses) should be remained within their permissible limits (the lower limit \(V_{min}=0.9\) p.u. and the upper limit \(V_{max}=1.01\) p.u.).  
The total reactive power provided from the installed SCs must also be kept less or equal to the total reactive power of all loads, and at the same time, the individual \(Q_{SCi},\ i=1,\ldots,n_{SC}\) (which is taken as a discrete value by steps of 50 kVAr each) is maintained between minimum and maximum values \(Q_{SCmin}=50\) kVAr, and \(Q_{SCmax}=1500\) kVAr respectively. This is guaranteed by formulating the inequality constraints given in (6) and (7).