[0.17.54] Heavier trains sometimes have a higher top speed

Bugs that are actually features.
Post Reply
danatron1
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Mar 04, 2019 11:39 pm
Contact:

[0.17.54] Heavier trains sometimes have a higher top speed

Post by danatron1 »

I was investigating train top speed and discovered something that doesn't make any sense.
When testing with coal, I found that the train's top speed was higher if I used a denser wagon.

1 locomotive (coal) + 1 cargo wagon = top speed 258.6
1 locomotive (coal) + 1 locomotive (no fuel) = top speed 258.7
1 locomotive (coal) + 1 artillery wagon = top speeed 258.9

Sure, the difference is small, but (assuming the wiki is correct regarding weight values) I would expect the heavier trains to have a lower top speed. I did another test with 3 trains that should have identical weights, based on the wiki assumption:

1 locomotive (coal) + 4 cargo wagons = top speed 215.7
1 locomotive (coal) + 2 locomotives (no fuel) = top speed 244.5
1 locomotive (coal) + 1 artillery wagon = top speeed 258.9

Since adding more wagons reduces the top speed of a train, it clearly is the case that weight impacts top speed, so I suspect this is unintended behaviour. Instead it appears that train length is what determines top speed and higher weight actually helps it? This is a consistently reproducable oddity.

Blueprint to reproduce: https://pastebin.com/Y1FW3Hxr
Log file: https://pastebin.com/2qTYJeQU

edit: Just did some additional testing to further confirm the weight issue. A 1-4-1 train is exactly as fast as a 1-5 train. And a 1-4 train is 0.2 slower than a 1-4 train made out of artillery wagons. Something is funky with the train weights.
Last edited by danatron1 on Sun Jul 07, 2019 5:45 pm, edited 1 time in total.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [0.17.54] Heavier trains sometimes have a higher top speed

Post by Deadlock989 »

Weight overcomes air resistance. Not a bug IMO.
Image

danatron1
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Mar 04, 2019 11:39 pm
Contact:

Re: [0.17.54] Heavier trains sometimes have a higher top speed

Post by danatron1 »

Deadlock989 wrote:
Sun Jul 07, 2019 1:34 pm
Weight overcomes air resistance. Not a bug IMO.
That would make sense for justifying a longer stopping distance, but not a top speed. The energy input (force) is the same, so surely each train would have the same kinetic energy, but not the same top speed (F=MA). There's a reason sports cars are made out of carbon fibre and not tungsten.

Also wouldn't that logic mean that the equal weight trains should go roughly the same speed, since due to the slipstream, the drag additional wagons add is negligable?

User avatar
Jon8RFC
Filter Inserter
Filter Inserter
Posts: 553
Joined: Tue May 10, 2016 3:39 pm
Contact:

Re: [0.17.54] Heavier trains sometimes have a higher top speed

Post by Jon8RFC »

Interesting find. From what you described about an empty-fuel locomotive, I wondered if the direction of those locomotives mattered, and it does. Absolutely a bug, IMO.


One locomotive plus two same-direction empty locomotives has a lower top speed than if those empty locomotives were facing the opposite direction of the locomotive with fuel. Whether the locomotive with fuel is in front or behind doesn't matter.


Tested with nuclear fuel. Didn't pay attention to how acceleration is impacted.

It makes me wonder if it's related to the fix about that one bug regarding speed and forward/reverse directions.
Image

danatron1
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Mar 04, 2019 11:39 pm
Contact:

Re: [0.17.54] Heavier trains sometimes have a higher top speed

Post by danatron1 »

Jon8RFC wrote:
Mon Jul 08, 2019 4:16 pm
Absolutely a bug, IMO.
Moved to "not a bug", rip

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2420
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: [0.17.54] Heavier trains sometimes have a higher top speed

Post by BlueTemplar »

Deadlock989 wrote:
Sun Jul 07, 2019 1:34 pm
Weight overcomes air resistance. Not a bug IMO.
Yeah, no, IRL mass has no (direct) effect on top speed, only drag has (aerodynamic and wheel friction*). And drag depends solely on the shape of the object and the density of the fluid it's moving through. An extreme case is vacuum, with no top speed in newtonian mechanics.
*wheel friction might depend on mass though, not sure how much it matters for the relevant cases ?

And AFAIK, Factorio uses some air friction and road adherence coefficients for their vehicles...
BobDiggity (mod-scenario-pack)

quale
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Thu Aug 15, 2019 4:16 pm
Contact:

Re: [0.17.54] Heavier trains sometimes have a higher top speed

Post by quale »

This made me curious. I had a bunch of train motion equations and found they no longer apply to 0.17. The cause appears to be the order of train physics. In 0.16 it was friction, drag, propulsion. That order happens to make trains the fastest, even slightly faster than idealized continuous-time differential equations describe. In 0.17 it’s friction, propulsion, drag. That’s instead slightly slower than the continuous equations. I have no idea why they changed it. Maybe it was a side effect of eliminating idle burner ticks somehow.

Top speed for various update orders (not accounting for idle ticks because that would set your brain on fire):

Continuous: v=max((p-f)/d,0)
Friction, drag, propulsion (0.16): v=max((p-f)/d+f/m,p/m)
Friction, propulsion, drag (0.17): v=max((p-f)/d-(p-f)/m,(p/m)(1-d/m))
Propulsion, friction, drag: v=max((p-f)/d-(p-f)/m,0)
Propulsion, drag, friction: v=max((p-f)/d-p/m,0)
Drag, propulsion, friction: v=max((p-f)/d,0)
Drag, friction, propulsion: v=max((p-f)/d,p/m)

v = top speed in meter/tick (multiply by 216 for km/h; ignores speed cap)
p = motive force in mass*meter/tick^2 (wood = coal = 10; solid fuel = 12; rocket fuel = 18; nuclear fuel = 25)
f = friction force in mass*meter/tick^2 (0.5 per car)
d = drag of leading car in mass/tick (7.5 for locomotive; 10 for cargo/fluid wagon; 15 for artillery wagon)
m = mass (1000 per wagon; 2000 per locomotive; 4000 per artillery wagon)

The idealized top speed doesn’t depend on mass at all; more mass just makes acceleration take longer. All deviations from ideal are inversely proportional to mass. So in 0.16 where the deviation made trains faster, more mass resulted in less speed (but always faster than continuous). In 0.17 where the deviation makes trains slower, more mass results in more speed (but always slower than continuous).

Nothing makes all that much sense in terms of real physics. But there is one update order corresponding to the most sensible math: drag, propulsion, friction. It applies drag first, to the actual speed, just like the continuous differential equation, so it converges on the same top speed. An overloaded train also doesn’t crawl (with a unit of acceleration describing speed, violating dimensional analysis) because friction is applied after propulsion. If you want to preserve crawling (I can see players would think an unmoving train spewing smoke is glitched rather than overburdened) and the little jumpstart where the first tick of acceleration is unusually strong, use drag, friction, propulsion.

Post Reply

Return to “Not a bug”