Essentially maths & physics calculations, but rather complicated because train resrstance changes with velocity, as does power output of locomotives. And you also have to cater for changes in gradients, speed restrictions, etc. Good luck.
The following may help a bit (.doc file download) - for acceleration:--
http://www.google.co.uk/url?sa=t&rct...aVebXrA8ae1q6w
and for braking
http://www.google.co.uk/url?sa=t&rct...dXghvmKA-K_Rpg
If the links fail, do a Google search for "train acceleration model".