Coordinated operation of energy storage systems for distributed harmonic compensation in microgrids