Real-time management system for automotive charging based on control and optimization algorithms