Degradation-Aware Optimal Control Of Grid-Connected Lithium-Ion Batteries