## 2 Problem Formulation  
The two buses of the main feeder in the distribution network with a combination of PV and BES can be represented in Figure 1.  
Forward/backward sweep algorithm is utilized to obtain the system load flows. The reactive and real power flows are calculated by Equations (1) and (2), respectively [32].  
\[\begin{split} P_{K}=P_{(K+1)}+P_{L,(K+1)}+R_{K,(K+1)}\left(\frac {(P_{(K+1)}+P_{L,(K+1)})^{2}+(Q_{(K+1)}+Q_{L,(K+1)})^{2}}{\left|V_{(K+1)} \right|^{2}}\right)\end{split} \tag{1}\]  
\[\begin{split} Q_{K}=Q_{(K+1)}+Q_{L,(K+1)}+X_{K,(K+1)}\left(\frac {(P_{(K+1)}+P_{L,(K+1)})^{2}+(Q_{(K+1)}+Q_{L,(K+1)})^{2}}{\left|V_{(K+1)} \right|^{2}}\right)\end{split} \tag{2}\]  
where, \(P_{(K+1)}\) and \(Q_{(K+1)}\) represent the real and reactive power flow from bus (\(K\)) to the next bus system, respectively. The reactive and real load flows between (\(K\)) and (\(K+1\)) buses are \(Q_{K}\) and \(P_{K}\), respectively. the reactance and resistance between (\(K\)) and (\(K+1\)) buses are \(X_{K,(K+1)}\) and \(R_{K,(K+1)}\), respectively. The reactive and real load at bus (\(K+1\)) are \(Q_{L,(K+1)}\) and \(P_{L,(K+1)}\), respectively.  
Figure 1: Two buses of radial distribution network.  
The voltage magnitude of system buses is evaluated by Equation (3).  
\[\mathbf{V_{(K+1)}}^{2}=\mathbf{V_{K}}^{2}-2\left(\mathbf{P_{K}}\mathbf{R_{K,(K+1)}}+\mathbf{Q_{K}}\mathbf{ X_{K,(K+1)}}+\mathbf{(R_{K,(K+1)}}^{2}+\mathbf{X_{K,(K+1)}}^{2}\right)\frac{{(\mathbf{P_{K}}^{2}+ \mathbf{Q_{K}}^{2})}}{{\mathbf{V_{K}}^{2}}} \tag{3}\]  
where \(\mathbf{V_{(K+1)}}\) and \(\mathbf{V_{(K)}}\) are the system voltage at buses \((\mathbf{K+1})\) and \((\mathbf{K})\), respectively. Installation of PV and BESS in RDS changes the load flows through the system branches. Therefore, Equations (1) and (2) are modified to Equations (4) and (5), respectively.  
\[\mathbf{P_{K}}=\mathbf{P_{(K+1)}}+\mathbf{P_{L,(K+1)}}+\mathbf{R_{K,(K+1)}}\left(\frac{{(\mathbf{P_{ (K+1)}}+\mathbf{P_{L,(K+1)}})^{2}+{(\mathbf{Q_{(K+1)}}+\mathbf{Q_{L,(K+1)}})^{2}}}}{{\big{|} \mathbf{V_{(K+1)}}^{2}}}\right)-\mathbf{P_{(PV+BESS)}},\mathbf{(K+1)} \tag{4}\]  
\[\mathbf{Q_{K}}=\mathbf{Q_{(K+1)}}+\mathbf{Q_{L,(K+1)}}+\mathbf{X_{K,(K+1)}}\left(\frac{{(\mathbf{P_ {(K+1)}}+\mathbf{P_{L,(K+1)}})^{2}+{(\mathbf{Q_{(K+1)}}+\mathbf{Q_{L,(K+1)}})^{2}}}}{{ \big{|}\mathbf{V_{(K+1)}}^{2}}}\right)-\mathbf{Q_{(PV+BESS)}},\mathbf{(K+1)} \tag{5}\]  
where, \(\mathbf{Q_{(PV+BESS)}}\),\(\mathbf{(K+1)}\) and \(\mathbf{P_{(PV+BESS)}}\),\(\mathbf{(K+1)}\) are the injection reactive and real power from BESS and PV units at bus \((\mathbf{K+1})\), respectively.  
The ratio of system losses with incorporating BESS and PV to the system losses without incorporating BESS and PV in RDS is formulated as single objective function as shown in Equation (6).  
\[\mathbf{F_{o}}=\sum(\frac{\sum_{h=1}^{24}\mathbf{P_{loss}}(h)^{after\ (PV+BESS)}\mathbf{\Delta(h)}}{\sum_{h=1}^{24}\mathbf{P_{ loss}}(h)^{before\ (PV+BESS)}\mathbf{\Delta(h)}}),\ \ \mathbf{h=1,2,3,4,.........\ 24\ \mathbf{h}} \tag{6}\]  
where, \(\mathbf{P_{loss}}(\mathbf{h})^{before\ (PV+BESS)}\) and \(\mathbf{P_{loss}}(\mathbf{h})^{after\ (PV+BESS)}\) are the system losses before and after incorporating BESS and PV in distribution system at time \((h)\).  
The inequality and equality constraints are formulated as shown next [33; 34; 35; 36]: