**4. Methodology**

The optimal siting and sizing of the BESS in distribution networks with RESs are presented in this work. The simulation of distribution networks was conducted in MATLAB and MATPOWER was also adopted. For the optimization process, genetic algorithm (GA) and particle swarm optimization (PSO) were both applied to find the minimum value of the objective function for finding the optimal siting and sizing of BESS and the performance of these algorithms were compared.
