Text this: A Novel Optimal Charging Algorithm for Lithium-Ion Batteries Based on Model Predictive Control