[OPEN-SOURCE] Machinery Modelling Toolkit

Then wheels have to be moved along the splines? It’s a chicken and egg problem. Connecting wheel to bogie and bogie to locomotive won’t automagically solve it.
One approach is to calculate location of boggies first, in relation to each other. Then find their rotation from how wheels should be located along the rails, for example perpendicular to spline direction and then somehow calculate location and rotation of locomotive.
Second approach is physics based where you have to imitate friction of wheels with the rail and calculate the rest from there.