This paper deals with the design of a switched Nonlinear Model Predictive Controller (NMPC) for collaborative ecodrive control of railway vehicles. Relying on a discrete, switched and nonlinear model of the train, the NMPC optimizes the handle position while fulfilling constraints on velocity and journey time. Specifically, the optimizer provides a set of operating modes, which the human driver is able to implement to modulate traction or braking forces and such that the corresponding driving style is constrained by predefined driving sequences. At network level, a Dissension based Adaptive Law (DAL) is then proposed to adjust the parameters of the NMPC cost so as to efficiently share the available regenerated braking energy among the train...