energy storage optimization