Analysis and simulation of energy-efficient control of a train