Real-world study for the optimal charging of electric vehicles