Battery has a fundamental role in energy storage systems for hybrid electric vehicles (HEV), plug-in hybrid electric vehicles (PHEV), electric vehicles (EV) and nowadays in smart grids. The battery state of charge (SOC) behavior is affected by operating temperature reducing its supply capacity or energy storage, therefore, it has been considered important to establish a mathematical model from experimental data of a electric vehicle during route tests. This article presents a metaheuristic optimization method based on accelerated particle swarm optimization (APSO) for SOC maximization during Lithium-ion (Li-ion) batteries charge and discharge states. The proposed optimization model reach to satisfy the balance between: current, temperature and time for the battery to supply the required amount of energy, minimizing the SOC reduction, subject to system specific restrictions. Simulation results show an improvement in the SOC without sacrificing the energy supply of the battery, which demonstrates the potential of the optimization technique in the EV.