Train speed formula

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
mrvn
Smart Inserter
Smart Inserter
Posts: 3386
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Train speed formula

Post by mrvn » Mon Jul 01, 2019 12:29 am

I'm looking for the formula how factorio calculates train speeds. The wiki has this formula:

https://wiki.factorio.com/Locomotive#Maximum_speed
Maximum speed

The maximum speed that a locomotive can get to depends on the train that it is pulling. The speed of an accelerating train can be calculated with the following formula:

train_speed = (old_train_speed - (train_friction_force ÷ train_weight) + ((10 × number_of_locomotives_in_moving_direction × fuel_acceleration_bonus) ÷ train_weight)) × (1 - air_resistance_of_front_rolling_stock × 1000 ÷ train_weight)

where train_friction_force is amount of wagons and locomotives ÷ 2 and train_weight is the summed up weight of each wagon and locomotive, see their individual pages for the weight values. The calculated train_speed is capped to max_speed = 1.2 * fuel_top_speed_multiplier.
So every tick the train looses some speed to friction and then it gains some speed from the locmotives. Both of those factors do not include the speed of the train. So every tick the train should gain the same amount of speed until it hits the max speed. Also if the train is too long the formula turns negative, the train should loose speed every tick.

But observation show:
- A train with 1 locomotive and 128 cargo wagons moves. Terribly sow but it moves.
- A train with 1 locomotive and 32 cargo wagons accelerates from 0 at about 1km/hs. At 60km/h it accelerates about 0.5km/hs. At 80km/h it accelerates about 0.3km/hs. At 98km/h it accelerates about 0.03km/hs.

This leads me to believe that the formula for train speed in the wiki is outdated or incomplete. There clearly is a component that is dependent on the speed of the train.

Could any devs shed some light on this please?

Frightning
Filter Inserter
Filter Inserter
Posts: 782
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Train speed formula

Post by Frightning » Mon Jul 01, 2019 12:34 am

I agree that it would be nice for the devs to give the proper formulae for trains now, I've tried doing the math with the new vehicle modifiers on fuel and haven't been able to get numbers that match in game behavior, so the models I was using (which worked up to 0.15 more or less) is no longer valid, and in particular, don't explain how fuels w/ modifiers work.

mrvn
Smart Inserter
Smart Inserter
Posts: 3386
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Train speed formula

Post by mrvn » Mon Jul 01, 2019 12:53 am

Note: My LC128 train is still moving at a shown 0.0km/h at 10x speed since I started the first post. Looks like max speed for LC128 is < 0.05km/h.

FuryoftheStars
Fast Inserter
Fast Inserter
Posts: 207
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Train speed formula

Post by FuryoftheStars » Mon Jul 01, 2019 2:18 am

I would really like to know this as well.

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: No registered users