## 2 Formulation of the Planning Problem
### Operation Constraints  
Operation constraints refer to the DESSs, DG units and buses of the network. For ease of reading, only one phase DESS has been considered in the following constraints. In case of two single-phase DESSs, the constraints should refer to both the involved phases. In Table 2, with reference to the DESS connected to the bus \(i\) (\(i\in\Omega_{DESS}\)) and phase \(\xi_{i}\), Equation (a) in Table 2 imposes that the net energy charged and discharged during each typical day (\(d=1,\ldots,\,nd_{y}\)) has to be zero. Equation (b) in Table 2 imposes specified time periods of the day in which each DESS can only charge (\(\Omega_{ch,i_{(y,d)}}^{\xi_{i}}\)) or discharge (\(\Omega_{ch,i_{(y,d)}}^{\xi_{i}}\)). This allows determining the number of daily charging/discharging cycles which have to be opportunely selected to preserve the lifetime of the battery and according to the energy tariff. Battery's lifetime, in fact, is related to charging/discharging cycles by the relation \(L_{b}=N_{cycles}/(365\
u)\) where \(L_{b}\) is the battery's lifetime expressed in years, \(N_{cycles}\) is the total number of charging/discharging cycles corresponding to a specific maximum depth of discharge (DoD) (The relationship between \(N_{cycles}\) and DoD is provided by the battery's manufacturer and depends on the battery's chemistry. ); \(\
u\) is the number of daily charging/discharging cycles. The operational strategy chosen for the battery defines the value of \(\
u\). Here, it is assumed that the considered energy price refers to a Time of Use (ToU) tariff, thus the above time intervals are easily defined by assuming the charging during the off-peak price and discharging during the on-peak price. Alternatively, the charging/discharging time periods could be handled as optimization variables depending on the adopted strategy. Maximum admissible ranges are imposed to the energy stored in each battery by means of Equation (c) in Table 2 where \(E_{DESS_{i}}^{D_{i}\xi_{i}}\) is related to the maximum admissible DoD, (whose value is still imposed to preserve the battery lifetime) and \(E_{DESS_{i}}^{ub,\xi_{i}}\) is the battery size which is given by Equation (c) in Table 1. The aging effect on the capacity of the battery can be taken into account by imposing a decrease of the term \(E_{DESS_{i}}^{ub,\xi_{i}}\) along the years. The percentage of decrease depends on the aging mechanisms of the specific battery technology [43]. Since DESSs are connected through AC/DC interfacing converters, the size of these last poses limits on the active and reactive powers of the DESSs which are imposed by means of Equation (d) in Table 2. It has to be noted that, in case of three phase DESSs, Equations in Table 2 have to be modified to consider the powers resulting from all of the three phases and the whole three phase energy. Constraints on DG units (Table 3) refer to limits imposed to the provided reactive power which is related to the size of the interfacing converter. Equation in Table 3 refers to a single-phase DG unit connected to phase \(\xi_{i}\) of bus \(i\) (\(i\in\Omega_{DG}\)). It is trivial to derive the case of three phase DG units. 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_{k_{(y,d)}}^{p})\) and reactive \begin{table}
\begin{tabular}{l c} \hline \hline \multicolumn{3}{c}{**Number of DESSs**} \\ \hline \(0\leq n_{DESS_{i}}^{p}\leq n_{max}\quad i=1,\ldots,n_{g}\quad p=1,2,3\) & (a) \\ \(\sum_{i=1}^{ng}\frac{3}{p}\sum_{p=1}^{n}n_{DESS_{i}}^{p}\leq N_{max}\) & (b) \\ \(E_{DESS_{i}}^{size}=E_{base}^{size}(\sum_{p=1}^{n}n_{DESS_{i}}^{p})\quad i=1, \ldots,n_{g}\) & (c) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Constraints on the Installation of distributed energy storage systems (DESSs).