Train speed calculation

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
ingmarins
Inserter
Inserter
Posts: 27
Joined: Wed Aug 03, 2016 10:44 am
Contact:

Train speed calculation

Post by ingmarins »

I'm playing with mods that change trains, so I was wondering what would be a good locomotive/cargo wagon ratio. The wiki page of Locomotive explains something about maximum speed, but there are some constants involved that I'm not sure about the meaning of.

Why is there a 10 here?:

Code: Select all

train_speed = train_speed + (10 × number_of_locomotives_in_moving_direction × fuel_acceleration_bonus ÷ train_weight)
Is that the vanilla 600kW divided by 60 ticks/s? So for a modded locomotive I would replace the 10 with the modded consumption / 60?

Why is there a 1.2 here?:

Code: Select all

max_speed = 1.2 * fuel_top_speed_multiplier
Is that the vanilla top speed in m/tick? So for a modded locomotive I would replace the 1.2 with the modded top speed in m/tick?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Train speed calculation

Post by DaveMcW »

The constants are historical values that were picked randomly, then followed precisely during 7 years of development to avoid any breaking changes. You can use math to give them different meanings, but you can't change them.

For example, let's rearrange the locomotive speed formula.

Code: Select all

train_speed = train_speed + (number_of_locomotives_in_moving_direction × (fuel_acceleration_bonus × 10) ÷ train_weight)
Now it is saying that the fuel_acceleration_bonus is expressed in units 10x smaller than normal.


Or we can move it to another position.

Code: Select all

train_speed = train_speed + (number_of_locomotives_in_moving_direction × fuel_acceleration_bonus ÷ (train_weight ÷ 10))
Now it is saying that train_weight is expressed in units 10x larger than normal.

Either way, fuel_acceleration_bonus and train_weight are using units that differ by a factor of 10.

Post Reply

Return to “Gameplay Help”