Novel methodology to determine the optimal energy storage location in a microgrid and address power quality and stability