Overtaking

To check that one train is able to overtake another, we require two movements and put timing constraints on their entry and exit which require one train to enter first and the other train to exit first.

vehicle passengertrain length 150.0 accel 1.0 brake 0.9 maxspeed 20.0
vehicle goodstrain length 650.0 accel 1.0 brake 0.9 maxspeed 20.0

movement passengertrain {
  visit #p_in [b1]
  visit #p_out [b2]
}

movement goodstrain {
  visit #g_in [b1]
  visit #g_out [b2]
}

timing p_in g_in
timing g_out p_out

Note that if we had instead required the long goods train to enter first, the verification would fail, as the goods train would block all paths for the passenger train. The constraints would be as follows:

timing start_g start_p
timing end_p end_g

Result

When the passenger train goes first, we get the following successful dispatch plan:

route ra2
train t2 l=150.0 a=1.0 b=0.9 v=20.0 rentrya
wait
route ra1
route rexita1
train t1 l=650.0 a=1.0 b=0.9 v=20.0 rentrya
wait
route rexita2