An algorithm for state of charge estimation based on a single-particle model