Energy Management System for a Photovoltaic System With Battery Storage Participating in Grid Voltage Quality Improvement