Optimal placement of distributed generation in distribution networks