Set the route before dispatch. The switch is locked whenever the train occupies the branching region.