## 2 Formulation of the Planning Problem
### Operation Constraints
The constraints related to the whole grid buses are reported in Table 4. Particularly, the three phase load flow equations are formulated for each phase p of each bus \(i\) which in Equation (a) in Table 4 are expressed with reference to each time interval of each typical day. Also, the active \((P^{p}_{i,k_{(y,d)}})\) and reactive \((Q^{p}_{i,k_{(y,d)}})\) powers at the left side of Equation (a) in Table 4 refer to injected powers. Their value must comply with Equations (b) and (c) in Table 4 where, in case of absence of load, DG or DESS at the phase \(p\) of bus \(i\), the relative power terms at the right side assume value zero. In case of linear loads, they could also be modeled by including the specified load shunt admittance in the network's admittance matrix. Equations (d) and (e) in Table 4 refer to the bus no.1, which is assumed as slack bus. This bus is also the point of common coupling thus a constraint is imposed here on the active and reactive powers flowing through the interfacing transformer whose values are limited by its size Equation (f) in Table 4  
Finally, with reference to all the grid's buses, admissible ranges are imposed on the phase-voltage magnitudes in Equation (g) in Table 4, the unbalance factor in Equation (h) in Table 4, and the line phase currents in Equation (i) in Table 4. The unbalance factors in Equation (h) in Table 4 and currents in Equation (i) in Table 4 are expressed as function of the phase voltages. \begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{3}{c}{**Net Energy Charged and Discharged**} \\ \hline \(\sum_{k=1}^{mt}\Delta t\:\gamma^{k_{i}}_{i,k_{(y,d)}}P^{k_{i}}_{DESS_{i_{(y,d) }}}=0\quad i\:\varepsilon\:\Omega_{DESS},\quad k=1,\ldots,nt,\) \\ where & \(\gamma^{k_{i}}_{i,k_{(y,d)}}=\begin{cases}\frac{1}{\eta^{k_{i}}_{i,k_{(y,d)}}} &P^{k_{i}}_{DESS_{i_{(y,d)}}}\geq 0,\\ \eta^{k_{i}}_{i,k_{(y,d)}}&P^{k_{i}}_{DESS_{i_{(y,d)}}}<0.\\ y=1,\ldots,ny;d=1,\ldots,nd_{y}.\end{cases}\) (a) \\ \hline \multicolumn{3}{c}{**Charging/discharging periods of the day**} \\ \hline \(-P^{k_{i},ch}_{DESS_{i_{(y,d)}}}\leq P^{k_{i}}_{DESS_{i_{(y,d)}}}\leq 0 \quad i\varepsilon\Omega_{DESS}\quad\quad k\:\in\:\Omega^{k_{i}}_{cth_{i(y,d) }},\) \\ \(0\leq P^{k_{i}}_{DESS_{i_{(y,d)}}}\leq P^{k_{i}}_{DESS_{i_{(y,d)}}}\quad i \varepsilon\Omega_{DESS}\quad\quad k\:\in\:\Omega^{k_{i}}_{cth_{i(y,d)}}.\) (b) \\ \(y=1,\ldots,ny;d=1,\ldots,nd_{y}.\) & **Energy stored** \\ \hline \(E^{\text{B},\mathcal{E}}_{DESS_{i}}\leq E^{\text{B},\mathcal{E}}_{DESS_{(y,d) }}-\sum\limits_{k=1}^{\tau}\Delta t\:\gamma^{k_{i}}_{i,k_{(y,d)}}P^{k_{i}}_{DESS _{i_{(y,d)}}}\leq E^{\text{B},\mathcal{E}}_{DESS_{i}},\) \\ \(ie\Omega_{DESS},\) & (c) \\ \(y=1,\ldots,ny;d=1,\ldots,nd_{y};\tau=1,\ldots,nt.\) & \\ \hline \multicolumn{3}{c}{**Active and reactive power**} \\ \hline \(\sqrt{{(P^{k_{i}}_{DESS_{i_{(y,d)}}})}^{2}+{(Q^{k_{i}}_{DESS_{i_{(y,d)}}})}^{2} }\leq S^{k_{i}}_{DESS_{i}}\quad i\:\varepsilon\:\Omega_{DESS},\) & (d) \\ \(k=1,\ldots,nt;y=1,\ldots,ny,d=1,\ldots,nd_{y}.\) & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Constraints on the Operation of DESSs. \begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{3}{c}{**Reactive Power Provided by the DG Unit**} \\ \hline \(\sqrt{{(P^{k_{i},\,sp}_{DG_{i_{(y,d)}}})}^{2}+{(Q^{k_{i}}_{DESS_{i_{(y,d)}}})}^ {2}}\leq S^{k_{i}}_{DESS_{i}}\quad i\:\varepsilon\:\Omega_{DGS}\:k=1,\ldots,nt;y=1, \ldots,ny;d=1,\ldots,nd_{y}.\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Constraints on distributed generation (DG) units.