The specifics of the code are way over my head, but, in game,
Seems to work for matching both the goods list and actual revenue. I built a test track in 2020 with a Panthress and 5 cars. The test track was 81 tiles long. By the formula above, the price per km was .3475 credits, which rounds to the goods table value of .35 credits. The base speed is 180 km/h and the bonus is 15%. The actual revenue was 8917.0 credits.
If you take the raw 2020 value, .3475 credits, you get a revenue of 9007.2 credits, close, but not exact. Now, speedbonus in 2020 is still increasing, in fact by a rate of 6.375 km/h per year. Since this test track run was was very close to February, the speedbonus base speed had actually increased a bit, to a little over 180.5 km/h. This reduces the revenue per km to about .3462 credits. Using this value you get 8974.97 for total revenue. Close, but not quite.
Then I started playing around with numbers, and it seems that simutrans actually counted the total distance as 80.5 tiles. Unclear why, but using 80.5 tiles and the revenue of .3462 credits, I calculated a revenue of 8919 credits, only 2 credits away from the actual value.
So Perhaps, the formulas have not changed after all: the constant increase of speedbonus and this odd way of calculating .5 tiles too few of revenue is throwing off revenue in your testing, prissi.
If the formula above is correct, then this formula in the XLS must be incorrect:
EDIT: I can upload this test track save if you want to take a look at the behavior.
EDIT 2: Just looked at the nightly, the new trailers look nice, but the paper and steel ones are flipped (the one with paper takes steel and vice-versa)