Whole trip longitudinal dynamics and energy analysis of heavy haul trains are required by operators and manufacturers to enable optimisation of train controls and rolling stock components. A new technology named train dynamics and energy analyser/train simulator (TDEAS) has been developed by the State Key Laboratory of Traction Power in China to perform detailed whole trip longitudinal train dynamics and energy analyses. Facilitated by a controller user interface and a graphic user interface, the TDEAS can also be used as a train driving simulator. This paper elaborates the modelling of three primary parts in the TDEAS, namely wagon connection systems, air brake systems and train energy components. TDEAS uses advanced wedge-spring draft gear models that can simulate a wider spectrum of friction draft gear behaviour. An effective and efficient air brake model that can simulate air brake systems in various train configurations has been integrated. In addition, TDEAS simulates the train energy on the basis of a detailed longitudinal train dynamics simulation, which enables a further perspective of the train energy composition and the overall energy consumption. To demonstrate the validity of the TDEAS, a case study was carried out on a 120-km-long Chinese railway. The results show that the employment of electric locomotives with regenerative braking could bring considerable energy benefits. Nearly 40 % of the locomotive energy usage could be collected from the dynamic brake system. Most of tractive energy was dissipated by propulsion resistance that accounted for 42.48 % of the total energy. Only a small amount of tractive energy was dissipated by curving resistance, air brake and draft gear systems.