Multi-service battery energy storage system optimization and control