OPTIMIZING ENERGY STORAGE SYSTEMS FOR GRID