mmmPI wrote: Mon Jun 24, 2019 5:06 am
mrvn wrote: Sat Jun 22, 2019 12:29 pm
Occupied blocks ~= (LengthOfTrain + avg. Speed * Brakeforce) * number of trains on the move
I am not sure how to understand brakeforce if i want to replace with real values, isn't the formula saying that the higher the brakeforce , the more block occupied ? I guess 1/brakeforce is an easy fix. Else it's nice .It gives a good understanding of the dynamics involved in one picture.
Of course, it's 1/brakeforce, but the formula is not math, it just says, that it depends on brakeforce, now how, the rest was explained in the text. But - well - it's misleading.
I would say many small trains need many stations unloading at the same time to achieve the same thoughput of material which would mean the same number of inserter.
Let's compare 4 situations
1 =>LCCCC unload during 4 minutes
2=> LC LC LC LC unload during 4 minutes
3=> LCCCC unload during 1 minute + 3 minutes the station is iddle
4=> LC unload 1 minute another LC the next minute another LC the next minute another LC the next minute.
1 and 2 have same number of inserter and thoughtput,
4 is the same as 1or 2 excpect at lower scale
3 has the same throuput as 4 but is not good for CPU only because it create spikes during which you use more while you could have ditributed it better.
Now i understand you refers to situation 3 vs 4, but i see 1vs2 when comparing long vs short train. So i think there is something more that i cannot word precisely yet.
Well, I thought a while about it and now I try to fiddle out the different effects in detail.
a) It's chaotic
To calculate what length of train is optimal (for your situation), you need not only to take in account how
one train behaves. You need to calculate how they behave in your current network with your current work-load. Which soon gets extremly chaotic.
b) ... but there are computeable parts
There are non-chaotic parts, which can be calculated, that is mainly how many "space" trains occupy. For the example above: A LCCCC train occupies a spces of 5 compared to a LC, which occupies only 2. But that is only true while you are standing. When running you need to add the reserved tracks, which looks for some speed X like so:
Train without speed:
LCCCC => 5
LC => 2
Train running at maximum speed, "R" is the reserved tracks (I just took some numbers):
RRRRRRRRRRRRRRRLCCCC => 7 + 5 = 20
RRRRRRRRRRRRRRRLC => 7 + 2 = 17
This says, that the longer the train and the faster it goes the "better", cause the "R"-part gets bigger compared to the length of train. The ratio (17 / 20 = 0.85 versus 2 / 5 = 0.4 ) between both types of trains gets more and more equal, the faster a train goes.
b1) Dependency to travel-time
This is a simpe thought: The longer the train needs to travel, the more blocks it needs to occupy, not only due to the length of the travel, but also due to the time it takes. Cause (see below) with the time the chance rises, that another train wants to occupy the same block.
c) Speed is limited!
There is a natural limit for b): when the R's cannot get longer! This happens because trains have a maximum speed. Which means:
There must be an upper limit, where it makes no more sense to make a train longer. Without thinking much about it: It is clear that the ratio get's more and more to 1, the faster the train goes. So the longer the train the better. But the speed is limited, and so the advantage of train with the length of N to a second train with the length of N+1 goes to zero. I think that is simple to understand.
Now comes the other aspect: A train with the length of N needs to travel longer paths, because of his length. Ok, this is a bit difficult to understand. Let's say we have a circle with two stations. Now I put in a train with the length of 1. Then you need to add one block more space to the circle as space for the train station. The length of the track the train needs to drive from station A to B is now one block longer in average.
Now I do that with a train with length 10. I need to expand the train station to 10 blocks and that is only possible, if I add nine more blocks to the circle; this train needs to travel 9 more blocks compared to the first train.
It is of course thinkable to place the train stops so, that longer trains have no effect on travel-length. But then you need to make the belts longer! So the length of a train has an effect on how much longer the track ist.
This and the train speed limits somehow the length of trains, where trains are still effective. I would say, that this limit is somewhere when the ratio (see above) between a train with the length of N and a train with the length of N+1 is over 0.98.
This depends of course the train configuration:
LC -> reaches max. speed, but low acceleration, average travel length is 1 block longer (length / 2)
LCC -> does not reach max. speed, average travel length: +1.5 blocks
LLCC -> reach max. speed, high acceleration, average travel length: +2 blocks
This influences very strong, how much "R's" need to come into the calculations. And that it makes no sense to have very long trains on short distances.
And because there is an upper limit of R, all the other effects that I will be explained below have a much, much higher effect to the troughput of a train network, then just the pure length.
If there is someone, which can make a formula out of it and fill with real Factorio-values this could be calculated.
I estimated how much this should be (and there is a much space for discuss in it), but I think a ratio of more than 0.94-0.98 makes no more sense to make a train longer. That might be a train-length of 3-9 and a total length (including the R's) at max-speed of 30-60 or so. Again: we need numbers from Factorio game to calculate that correctly.
d) The chaotic parts
Other effects come in to play when you have more than one train in a network, where trains have a chance to cross the paths of other trains, and they are mainly chaotic nature. There are two effects:
d1) Trains that need to stop
A long train running at full speed takes less space ratio compared to a shorter train (see above), but (!) once two train cross their path, one train needs to stop. And for a stopped long train the ratio is bad quite bad, compared to the short one. This means that a stopped train occupies more space in your train network over time, which means, that there is a higher chance, that a third train needs to cross the path of the stopped one.
This is extremly chaotic, it could be that a network runs hours without problems, and suddenly due to some random crossing of trains the network comes to a deadlock. But mathematically I would explain it as a chance for a stop:
ChanceThatATrainNeedsToStop = ChanceThatTwoTrainsNeedToCrossTheirPaths
Which is (please prove me wrong, I thought only 5 minutues about it):
( OccupiedNumberOfBlocksOfTrain1 * OccupiedNumberOfBlocksOfTrain2 ) * time
And what you see here clearly is, that the chance is quadratic to the occupied number of blocks! So the length of train comes more back into game, than you might think at first!
d2) Stopped trains need time to accelerate
The chance for a train to stop another train is highly dependend to it's length and how long it will need to clear the track, which needs to be crossed. Which is dependend to it's speed and length. That influences the time, that a train needs to clear an area.
So this is the second chaotic element:
When a train was stopped before a crossing it takes time for him to accelerate back to maximum speed. In other words:
The longer the train, the longer it takes to clear a crossing. And the higher the chance, that another train needs to stop, because see d1).
This results in the same effect: A train system works perfect for hours and at some point a train needs to stop, which forces another train to stop and if the trains cannot clear the neuraligic point fast enough (cause they are too long), this swings up to a massive jam or even deadlock.
So the strength of this effect is extremly dependend on the next two, e) and f)!
e) Chance of crossing another trains path
The chance, that two trains cross their path is dependend on how much trains you have.
I would add this to the above formula:
( OccupiedNumberOfBlocksOfTrain1 * OccupiedNumberOfBlocksOfTrain2 ) * time * NumberOfRunningTrains^2
This seems to be quadratic (or exponential?), because one train will have no effect (it's the same train), two train will double the effect, three trains will double the effect of two and so on.
f) Influence of "neuralgic points"
If there are no crossings then the chance that two trains cross is very low. So it's clear, that the chance that two trains cross their paths depends on the number of "neuralgic points" you have in your network.
The formula looks then like so:
( OccupiedNumberOfBlocksOfTrain1 * OccupiedNumberOfBlocksOfTrain2 ) * time * NumberOfRunningTrains^2 * NeuralgicPoints
A "neuralgic point" is hard to define; I would say of it is the number of blocks multiplied with the chance that two trains need to occupy a block at the same time.
NeuralgicPoint = ChanceThatABlockIsOccupied * ChanceThatABlockNeedsToBeOccupied
which can also be written as
NeuralgicPoint = ChanceThatABlockIsOccupied * NumberOfRunningTrains^2
Here comes - the third time now - the quadratic number of running trains into game.
Summary
This is far away of beeing correct! So be careful, I sure when we look deeper into it will be much more different. But this is mainly to the complexity of this subject.
So what you clearly can see is, that the optimal length of trains is extremly dependend to the number of trains you run in your network: The current formula contains three times the number of running trains in quadratic (or more) depenencies. This makes the network very sensitive to changes when you are at the train-network limit.
But what you also can see is another effect:
Reducing the length of trains shifts this sensitivity to more resilience against the chaotic effetcs. This is mainly due to the effect of d2): A short stopped train can clear the neuralgic point much faster, than a long train. But there are also some side-effects in the other parts.
So we can say as summary (till now): Shorter trains are less effective for train networks with low traffic. But with rising traffic the shorter trains will be much more resilient to chaotic effects than with longer trains.
And a second can be said: we speak here not between a difference of LC versus LLLLLLLLLLCCCCCCCCCCCCCC or so, but more to the difference between LCC and LLLCCCCCC. Much more above or below makes no sense because of the effect of c).
If someone has an idea of how to build mathematical formulas with real Factorio relevant values out of it, we could verify, how important which effect is.
Until then I would say: An optimal train size must be between 3 and 9, perhaps 10, because of c). If it's more to 3 or more to 10 depends very much of how much trains drive in your network, and how "neuralgic point free" you build your network.
But - as already mentioned: shorter trains have other advantages, like smaller train station, less inserters needed and so on, so this is n