OPTIMIZING A BATTERY ENERGY STORAGE SYSTEM FOR FREQUENCY CONTROL