## Accurate belt segment measurements

Post all other topics which do not belong to any other category.
ignatio
Long Handed Inserter
Posts: 77
Joined: Mon Jun 27, 2016 3:59 pm
Contact:

### Accurate belt segment measurements

I found myself wondering exactly how long belt segments are, or more precisely how long it takes for an item to get from one end to the other.

The wiki page (as of the time of this posting) tells us that straight segments have 32 "slots", which are travelled 1 slot per tick on a yellow belt, hence it takes 32 ticks from one end to the other. (The page also tells us items take up 9 slots, which is no longer accurate in 0.17, but this is not about that bit of stale info.)

The length of a straight is correct. But then the page describes turns, and says the outer lane of a turn is 37 slots and the inner lane is alternating between 13 and 14 slots, and I couldn't get it to work like that: I did some spirals with turns in only one direction, and cancelling out the straights I got that the successive inner turns took:

13, 13, 13, 14, 13, 13, 13, 14, 13, 13, 13, ...

I.e. only every 4th turn takes 14 ticks, or, put differently, an inner turn seems to be 13.25 slots long. Outer turns too don't quite take 37 ticks each:

36, 37, 37, 37, 37, 37, 37, 37, 36, 37, 37, ...

First I thought that was some off-by-one problem in my test rigs, but it's perfectly repeatable.

Now I got intrigued, so I set up circular belts of different sorts where single items go round and round. Then I added some circuitry to predict the lap times - when the constants are right it should line up perfectly with the real measurements regardless how many laps it takes for the cycle to repeat.

With some deductions from the lap times of those circuits we can measure the fractional slots for each type of belt segment, also including sideloaded belts, underground belts, splitters, etc. I included some sanity checks too, like checking that left and right turns take the same time.

Rather than dealing with fractional "slots" we can scale things up to whole numbers, and so we find that there are in fact 8 times more positions:
• Straight segments have 256 positions per lane.
• Yellow belts move items at 8 positions per tick, red 2*8=16, and blue 3*8=24 positions/tick.
• Underground segments and splitters also have 256 positions per lane.
• The outer lanes in turns have 295 positions.
• The inner lanes in turns have 106 positions.
• Straights and underground entrances sideloaded "early" have 188 positions.
• Straights and underground exits sideloaded "late" have 68 positions.
With "early" and "late" sideloading above I mean where on the belt the sideloaded items enter - "early" means it's closer to the back (also the only place that isn't blocked on an underground entrance), and "late" means it's closer to the front (and the only place open on an underground exit).

An observation is that it's possible to get items to travel faster by converting inner turns to sideloaded segments. However it doesn't affect the throughput, i.e. items per second.

Based on these findings I'm going to update the wiki page, and also fix the stale item size info at the same time. But I thought to post here first in case there are thoughts on this.

If you want to try it out yourself I've attached the blueprint below. It requires that the infinity chest is unlocked, which you can do with the Creative Items mod, but other than that it should work on vanilla. The test is enabled by turning on the constant combinator in the top left corner. Because I'm a bit lazy with the combinator logic, the speakers will alert when the test is turned on or off, but once that has died down after the start there should be no more alerts as long as it's kept running.

Bilka
Factorio Staff
Posts: 2709
Joined: Sat Aug 13, 2016 9:20 am
Contact:

### Re: Accurate belt segment measurements

Do you think the "amount of slots" info is important? I was planning to nuke that wiki page....
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

ignatio
Long Handed Inserter
Posts: 77
Joined: Mon Jun 27, 2016 3:59 pm
Contact:

### Re: Accurate belt segment measurements

Well, I think it's interesting to understand the belt mechanics more deeply.

In "normal" gameplay it's arguably not of much practical value, but then again people are doing all sorts of cool things in Factorio that isn't "normal" gameplay, and then it might be useful.

The reason I got into it was that I wanted to have good figures on inserter throughput, and there it turns out that the exact positions of items on the belt wrt the hand can have long-lasting effects. So I need to accurately control the phase between belt items and inserter hands to get good measurements, and then this matters.

Bilka
Factorio Staff
Posts: 2709
Joined: Sat Aug 13, 2016 9:20 am
Contact:

### Re: Accurate belt segment measurements

ignatio wrote:
Sat Apr 27, 2019 4:14 pm
Well, I think it's interesting to understand the belt mechanics more deeply.
So it's a typical wiki thing... I'll figure something out for the page, thanks for the updated data
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

ignatio
Long Handed Inserter
Posts: 77
Joined: Mon Jun 27, 2016 3:59 pm
Contact:

### Re: Accurate belt segment measurements

It wasn't only out of idle curiosity, although that is a perfectly sufficient reason in my book.

Just to give an example of why belt positions can matter, in these two cases the only difference is that the bottom lane has started one tick later (both inserters use max stack size). The inserter on the left has 36% more throughput than the one on the right, and that's sustained - it never gets better (unless there are gaps on the belt, and if there are it can just as well get worse again).

9.47 items/second: 6.92 items per second:

What do you have in mind for the wiki page? I'm happy to have a go at it myself.

Bilka
Factorio Staff
Posts: 2709
Joined: Sat Aug 13, 2016 9:20 am
Contact:

### Re: Accurate belt segment measurements

I missed your question about the wiki page. Good thing I did, because your update to the page turned out amazing. Thank you!
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

ignatio
Long Handed Inserter
Posts: 77
Joined: Mon Jun 27, 2016 3:59 pm
Contact:

### Re: Accurate belt segment measurements

JCav
Long Handed Inserter
Posts: 50
Joined: Mon Aug 15, 2016 9:01 pm
Contact:

### Re: Accurate belt segment measurements

In your .gif examples, how would one make sure they have the best throughput every time? In other words, how would one start the inserter at the appropriate time to ensure the throughput is highest?

ignatio
Long Handed Inserter
Posts: 77
Joined: Mon Jun 27, 2016 3:59 pm
Contact:

### Re: Accurate belt segment measurements

In other words, how would one start the inserter at the appropriate time to ensure the throughput is highest?
That's a good question. It might be possible to sense the items on a belt tile before the inserter and use a few combinators to start the inserter at the right moment.

However a problem with that is that you can only sense belt items with the resolution of one game tick, and that might not be enough. As my belt loop experiment shows, an item can be in any of 24 different positions on an express belt and still register in the same game tick, and the inserter does not react the same way to all those 24 positions.

It's possible to get the resolution down to 8 positions by either measuring over a longer time and detecting the 2-3-3-2-3-3 tick pattern that the express belt produces, or weighing together measurements from several belt tiles. But then the combinator logic starts to get complicated, and the resolution is still only 8 positions which may not be enough. But I don't know that - I have only measured inserter throughputs at 8 position offsets (i.e. for two lanes, 8*8 = 64 measurements (I can explain further where that comes from, but maybe another time because I'm already nested two parenthesis levels here)).

All that makes it a rather complicated and fragile approach. I think it's more practical to just not count on any better throughput than the worst, and instead focus on changing the belt layout to get better throughput.

E.g. the particular case I showed is with items in both lanes, and a turn facing away from the inserter. If it's a straight instead, or - even better - just one lane is in use, then the lowest throughput is much higher: 10.58 items/s in the first case (straight, both lanes), and 11.25 items/s in the 2nd (single lane, but still the same kind of turn).

Yes, that's right - throughput is better if only a single lane is used. That's because the inserter spends less time moving around the hand trying to catch items, and instead more waiting in more or less the same spot for items to arrive. For the quick express belts the latter wins, but the situation gets different for the basic yellow belts. Then the throughput of the belt becomes the limiting factor, i.e. a green stack inserter can empty both lanes of a yellow belt quickly enough.

### Who is online

Users browsing this forum: Google [Bot]