To facilitate dynamic vehicle scheduling for battery electric city buses, a real-time on-line energy consumption prediction model is proposed. The model utilizes the current vehicle velocity and position, combined with knowledge of the remaining route, to predict the total trip energy. The model consists of a remaining velocity profile predictor and a longitudinal dynamics model. The algorithm is demonstrated in a Hardware-in-the-Loop experiment with a battery electric bus. The model has an average error of 3.1% with respect to the total trip energy and adapts in real-time to unexpected acceleration and deceleration events