Page 1 of 1

[0.16.x] inserter rotation speed

Posted: Sat Feb 09, 2019 6:55 pm
by osldgoth
I have been trying to calculate the throughput of inserters for my mod ACT and have been using this wiki as a guide, but I've been unable (as far as I can tell) to come up with reliable numbers. Take the "inserter" as an example; it has a rotation speed of 0.014. The wiki claims that its 'turns per Game-tick'. I don't know how the wiki has calculated .83 for 'Turns per Game-second' for chest to chest. The closest I get is .014 * 60 which is .84. The wiki also calls it 'Arm cycles per second'. Perhaps .83 is not correct I don't know, I have no way of knowing for sure. Can anyone(one of the devs) shed some light on this? thanks

Re: [0.16.x] inserter rotation speed

Posted: Sat Feb 09, 2019 7:12 pm
by DaveMcW
The number you really want is "ticks per cycle".

Ticks per cycle
Burner inserter - 102
Inserter - 72
Long-handed inserter - 52
Fast inserter - 26

When calculating ticks per cycle you can see where the rounding error comes from.

1 / 0.014 = 71.4 ticks per cycle = round up to 72
60 / 72 = 0.833 cycles per second

Re: [0.16.x] inserter rotation speed

Posted: Wed Feb 13, 2019 4:03 pm
by osldgoth
Well I'm not going to round the number in the middle of the calculation.

Re: [0.16.x] inserter rotation speed

Posted: Thu Feb 14, 2019 7:44 am
by DaveMcW
Then you will get the wrong answer, because that is how the game does it.

Re: [0.16.x] inserter rotation speed

Posted: Thu Feb 14, 2019 9:02 am
by bobingabout
osldgoth wrote: Wed Feb 13, 2019 4:03 pm Well I'm not going to round the number in the middle of the calculation.
The game works in whole steps called ticks.
For example... You can carry 100 apples at a time in a box, you have 7166 apples. How many trips does it take to carry all those apples from point A to point B. is it 71.66 trips because 7166/100 is 71.66, or is it 72 trips?
it's 72 trips, you can't have 0.66 of a trip. That's how the game works, you can't have 71.66 game ticks, you need to round up to 72 ticks.

Re: [0.16.x] inserter rotation speed

Posted: Mon Feb 18, 2019 12:09 am
by osldgoth
ok I understand, the number isn't actually 0.014 but 0.013888... which is 1/72.

inserter: shown - 0.014 actual 0.01388... (1/72)
fast/stack-inserter: shown - 0.4 actual 0.03846... (1/26)

I can round the number for the inserter but rounding isn't going to help the fast/stack inserter. 1/.04 = 25. I really don't want to hard code the numbers. anyone have suggestions? perhaps 25 will be close enough

Re: [0.16.x] inserter rotation speed

Posted: Mon Feb 18, 2019 12:46 am
by quyxkh
Arm rotation isn't the only thing that matters, you're trying to calculate the total time for a pickup and a drop and two rotations from just the rotation speed, so you're already getting wrong answers, even before belts get involved. Trying to fit results into a deficient model is a recipe for frustration, doing it doggedly frustrates everybody watching too.

Re: [0.16.x] inserter rotation speed

Posted: Mon Feb 18, 2019 12:55 am
by DaveMcW
I believe this is the correct formula (at least, it works for all four vanilla inserter speeds, and correctly gives 14 for a double speed fast inserter):

ticks_per_cycle = math.floor(0.5 / rotation_speed) * 2 + 2

The explanation is it takes 1 tick to pick up, 1 tick to drop, and half a rotation each way.

Re: [0.16.x] inserter rotation speed

Posted: Mon Feb 18, 2019 9:42 am
by bobingabout
DaveMcW wrote: Mon Feb 18, 2019 12:55 am ticks_per_cycle = math.floor(0.5 / rotation_speed) * 2 + 2
Wouldn't it be math.ceil() to round up instead of down?

Re: [0.16.x] inserter rotation speed

Posted: Mon Feb 18, 2019 10:33 am
by DaveMcW
Why don't you just check the source code confirm I'm right. :P

Re: [0.16.x] inserter rotation speed

Posted: Mon Feb 18, 2019 11:16 am
by quyxkh
bobingabout wrote: Mon Feb 18, 2019 9:42 am
DaveMcW wrote: Mon Feb 18, 2019 12:55 am ticks_per_cycle = math.floor(0.5 / rotation_speed) * 2 + 2
Wouldn't it be math.ceil() to round up instead of down?
Doesn't seem likely. Stack is .04, 1/25. so a half swing is 12.5 ticks, half-swing and a pickup/drop is 13.5 ticks, we can measure a full stack cycle at 26 ticks so if it's really 1-tick pickup/drop, as seems likely, inserter hands just have to get close. One-tick pickup/drop is looking awfully good for burner inserter timing, .01 rotation speed gets you exactly 100-tick full rotation, but the observed burner cycle is 102 ticks.

Anyway, it doesn't really matter much, what matters is how long it actually takes and this model doesn't account for belts and other inserters competing and all. Trying to predict inserter performance with belts involved seems like a quick route to ... I dunno, somewhere I don't want to go.

Re: [0.16.x] inserter rotation speed

Posted: Fri Mar 08, 2019 5:02 am
by osldgoth
anyone want to tackle picking up items from belts? Throughput (items/sec) = 1 / (t_item + t_arm / n) https://wiki.factorio.com/Inserters#Inserter_Throughput

I have no clue where t_item comes from. I have a little data on the number of ticks each inserter takes to pick up max stack size(3/12) but that doesn't tell me much.
  • yellow belt (only one belt/inserter orientation - I may just assume it's the same for all configurations for simplicity)
    -------basic, fast, stack inserter
    • 18, 11, 74
  • red belt
    • 11, 10, 52
  • blue belt
    • 6, 5, 44
I have no way of calculating or estimating those numbers in lua