Maximizing the value of battery energy storage systems