Train physics made simple

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Frightning
Filter Inserter
Filter Inserter
Posts: 814
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Train physics made simple

Post by Frightning »

So we get semi-regular questions on these boards asking about train throughput and wagon versus loco count, 1-way versus 2-way, etc. I decided some of the deeper info, about the actual underlying physics isn't very easy to find (I've had to use some carefully chosen keywords to re-find a rather old post that actually covers the underlying math, though afaik the numbers haven't changed, sans 0.15's max speed modifiers for different fuel types), and even when found, is rather complicated at first look. However, with a bit more work, it's possible to greatly simplify the required calculations, it's reasonably well-known among the regulars on these boards that train speed is related the loco-to-wagon ratio, and perhaps a bit less well known is that locos facing in opposite direction not only don't contribute to the train's forward movement, they are each equivalent to 2 wagons in weight (2000 instead of a wagon's 1000 weight). The locos that are contributing to forward movement also apply their weight, but that does not impact the loco-to-wagon ratio (Each loco can get up to 4000 total weight to maximum speed; hence 1 loco to 2 wagons, or 1-2-0 trains, or multiples thereof, such as 2-4-0, 3-6-0, 4-8-0, etc.), moreover, most people don't actually know train speeds for less-than-maximum speed trains, which can be computed in a relatively straightforward manner using the game's own equations, especially if you first simplify them by entering in the relevant constants.

It is a common convention to denote train configurations with a 3-number triple, such as 1-2-0, or 2-4-2. What this denotes is:

(number of forward facing locos)-(number of wagons)-(number of backward facing locos)

It provides a very concise way of describing the configuration of a train containing all of the important information that determines things such as max speed and theoretical item throughput.

The information below was derived using information obtained from this post: viewtopic.php?f=93&t=21001&p=147834#p147834.

Train speed maximum:
1.2 tiles/tick=72 tiles/sec=259.2 km/h

This is exact, as is easily checked by doing the math assuming that 1 tile=1 (sq.) meter. Because of this, it is easy to derive a conversion factor for converting between tiles/tick and km/h:

Speed conversion factor:
1 tile/tick=216 km/h

Simplified general equation for (1-way) train speed in tiles/tick:
S=5L/(2L+W) (capped at a max of 1.2)
...where...
S is train top speed in tiles/tick
L is number of locos
W is number of wagons

For 2-way trains, use the above formula for 1-way, but treat each backward facing loco as 2 wagons. Explicitly, the resulting formula is:
S=5F/(2F+W+2B) (capped at a max of 1.2)
...where...
S is train top speed in tiles/tick
F is number of forward facing locos
W is number of wagons
B is number of backward facing locos

Since most people that use 2-way trains use 'balanced' 2-way trains, we can further simplify the above formula to obtain:
S=5L/(4L+W) (capped at a max of 1.2)
with L being the number of locos per direction (e.g. a 1-2-1 train has L=1).

An interesting observation is that, for 1-way, the 1-to-2 loco-to-wagon rule is actually slightly loco heavy, the perfect ideal ratio to achieve maximum speed is actually 6 locos to 13 wagons (rather than 12), a 6-13-0 train. An interesting consequence of this is that it actually is possible for a 'balanced' 2-way train to achieve maximum speed with a given number of wagons, the perfect ratio in that case is a 6 locos per direction per wagon, a 6-1-6 train.

The above equations are useful for practical train problems, but for the more theoretical questions pertaining to optimizing large scale train networks, an alternative form, based on the loco-to-wagon ratio is preferable.

Ratio version of general 1-way train speed equation:
S=5/(2+R) (capped at a max of 1.2)
...where...
S is train top speed
R is the ratio of wagons per loco, or W/L.

The cap is reached precisely when R=13/6, and hence, for any R values at or below that number, S is simply 1.2, what's more interesting is what happens to speed as R exceeds 13/6. The equation clearly has the form of a reciprocal, and hence, train speed decreases sharply at first, leveling off towards its asymptote of 0 as R grows without bound. One might naively conclude from this that the highest throughput 1-way trains are those with the exact 6-13 ratio, because that gives highest speed, and therefore most wagons per second, but this is actually presumptive because a nontrivial portion of the train is locos and not wagons, sacrificing some speed could perhaps still result in more wagons per second because more of the train is wagons rather than locos. It turns out however, that the naive assertion is correct, though it takes some work to prove it. Of interest for those wanting to know how much efficiency is lost for running more wagons than is optimal, is the following equation.

Wagon rate in Wagon tiles/tick:
T=5R/((1+R)(2+R)) (only valid for R not less than 13/6)
...where...
R is the ratio of wagons to locos, W/L
T is the number of wagon tiles moved per tick (that is, speed, in tiles/tick, times proportion of train that is made up of wagons)

You can obtain wagons/tick by dividing T by 7, and wagons/sec by multiply that result by 60, or in otherwords:

Wagons/sec=(60/7)*T

To compute efficiency against the theoretical optimum, we first evaluate T for R=13/6, obtaining:

T=78/95=0.8(210526315789473684)...

Then we compare the value of T for general R to that for the optimum, taken general/optimal to obtain efficiency rating in decimal form (to convert to %, multiply by 100). Thus we obtain:

E(R)=475R/(78(1+R)(2+R))

Some sample values, rounded, I've included the actual value of E(2), accounting for capped speed and sub-optimal wagon to loco ratio, compared to ideal E(13/6) for reference:
E(2)=0.97436=97.436%
E(2.5)=0.96663=96.663%
E(3)=0.91346=91.346%
E(3.5)=0.86118=86.118%
E(4)=0.81197=81.197%
E(5)=0.72497=72.497%
E(6)=0.65247=65.247%
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: Train physics made simple

Post by AndrewIRL »

Frightning wrote:So we get semi-regular questions on these boards asking about train throughput and wagon versus loco count, 1-way versus 2-way, etc.
Disappointingly, you don't directly address the 1-way versus 2-way question.
Frightning wrote:An interesting observation is that, for 1-way, the 1-to-2 loco-to-wagon rule is actually slightly loco heavy, the perfect ideal ratio to achieve maximum speed is actually 6 locos to 13 wagons (rather than 12), a 6-13-0 train. An interesting consequence of this is that it actually is possible for a 'balanced' 2-way train to achieve maximum speed with a given number of wagons, the perfect ratio in that case is a 6 locos per direction per wagon, a 6-1-6 train.
I didn't know this.


So what does this mean for the man about to plan out a new rail system? What are the tradeoffs between say 1-4-1 and a 2-4-0? Same loco+cargo count, same size stations.

If the 1-4-1 is slower then the throughput (assuming full cargo) must be lower so you would need correspondingly more trains to cover the deficit.

Two locos and four cargo:

Code: Select all

LL-CCCC,  ratio = 2, top speed = 259.2
L-CCCC-L, ratio = 6, top speed = 134.6
The convenience of dual head costs about 48% in top speed.

but wait, there's more
Lower speeds means more time between stations per train => more congestion

So you get a double whammy congestion effect. If the train is twice as slow then it blocks an intersection or a rail section for twice as long, doubling congestion. If it twice as slow then it only delivers good at half the rate so you need two, doubling congestion.

All told your congestion is quadrupled when train speed is halved. So, in exchange for station convenience, you are going to need 4x as much track for the same level of congestion?

Yes, No, Maybe?


What does solid or rocker fuel do to the balance? Can rocket fuel drive a train to a higher top speed or does it only affect acceleration?
Frightning
Filter Inserter
Filter Inserter
Posts: 814
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Train physics made simple

Post by Frightning »

I didn't directly address the 1-way versus 2-way question because it has to do with much more than just train physics, but the physics do inform the discussion. For long distances and large networks, you do suffer almost quadruple the throughput loss going 1-4-1 versus 2-4-0, but at practical distances and network scales, those losses may be far less in practice, and the benefits of smaller stations and needing to lay less rail may be very worthwhile to you.
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: Train physics made simple

Post by AndrewIRL »

If we could get our hands on aaargha's save game for this testing:
4-way intersection testing: Throughput and deadlocks
We could run 1-4-1 trains through it, compare the 15 minute count and see a factor of 3 or 4 difference?

I'm going to message aaargha and see if he can be convinced to test it.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Train physics made simple

Post by DaveMcW »

I don't think you considered air resistance.

1-2-0 is much worse than 2-4-0, due to air resistance eating a lot of power from the first locomotive.

Similarly 1-4-1 is much worse than 2-8-2.
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: Train physics made simple

Post by AndrewIRL »

I asked aaargha and he responded. Apparently rocket fuel is the great equalizer and a 2-4-0 train will hit the same top speed as a 1-4-1 although it does accelerate a bit slower. Weaker acceleration would negatively affect throughput but not nearly as dramatically. However aaargha does point out that when approaching congestion limits with trains stopping the higher acceleration will be important. That will probably delay the moment of system overload but not enough to matter (IMHO).
Post Reply

Return to “Gameplay Help”