Optimal Energy Management In Electric Vehicles: Convex Optimization For Model Predictive Control