Ok, either we need a better explanation of the results, or there is some thing wrong with the equations. I worked out Swallow vs. Raven and Swallow vs. Rhino. I assumed condition = 100% and all upgrades were installed for both trains in each pairing. Unless I did my arithmetic wrong, here are my results: Swallow vs. Raven, T = -8121.16; Swallow vs. Rhino, T = 6.22.
Now, you said that "If the answer is 0 or negative, use the faster train." That would mean that the Raven would be preferred over the Swallow. However, Swallow vs. Rhino yields a positive T, even though the Rhino is clearly superior in velocity, waggons and acceleration.
So, either the explanation of result needs more detail, or the equations are flawed. I don't know which.
Excellent work. But it needs to be taken a step further. Not many people are going to want to work out these equations train pair by train pair. We need to do the calculations and put the results into a matrix, era by era. Then this will be very useful. I'll get to work on that soon.