Set any inserter stack size with just 1 combinator
Posted: Fri Oct 28, 2016 8:56 pm
by hansinator
Edit: I have found a new way of precisely setting the stack size for any inserter with just a constant combinator. The topic name has been changed to reflect that.
The new version can set any inserters stack size via the circuit network by using integer overflow. It works with normal inserters and with filter inserters in "set filters" mode. There is no downside and it will not influence anything (like slowing down the belt) but the stack size. It is not limited to a stack size of 1 like the old version and it uses just one constant combinator instead of nine combinators. Unfortunately this does not work when taking from a chest.
The gif first shows the left inserter with its stack size set to 1 and the right inserter with its stack size set to 2 and filter set to iron plates. In the second part of the gif the left inserter stack size is set to 5 and the right inserter stack size to 1. The nixie tube displays how many items are in the corresponding chest.
It works like this:
The combinator value, let's call it X, is calculated like this: X = 2147483648 - desired_stacksize
Examples:
* stack size 1 has combinator value 2147483647
* stack size 2 has combinator value 2147483646
* stack size 3 has combinator value 2147483645
..
* stack size 11 has combinator value 2147483637
* stack size 12 (max) needs no combinator..
There is one thing to note. You may only connect one wire type, either red or green, but not both. If you connect both, you need to use this formula: X = 2147483648 - 2 * desired_stacksize
That is because each wire type will reflect back the hold value to the inserter. Two wire types reflect it twice.
Here's the old post:
old post
Here's a little contraption that makes a filter inserter pick one item at once, avoiding the stack "bonus".
It works in filter mode and you can set any item filter you want via the circuit network. To do this one needs to apply a control pulse of one tick length with the signals of the items to be filter-inserted set to 1. Another drawback besides the 1-tick control pulse is that the control pulse may not be re-applied until the inserter has turned back into its pick-up position. This limits the repetition rate to approximately once per game second.
The lower two decider combinators and constant combinator generate the control pulse every 64 ticks. They are part of the blueprint for demonstration but may be deleted when another control pulse is available.
The contraption consists of an RS-latch, a PWM-generator and a signal filter/multiplexer. The basic principle is that when the RS-latch is armed by the control pulse it starts a self-resetting timer that counts up to 8 as soon as an item that is included in the filter list is present on the belt in front of the inserter. The inserter is activated with the filter list set until the counter has counted to 4, after which the inserter will be disabled. When the counter reaches 8 it resets itself to zero. If the inserter hasn't picked up an item yet then the counter will be automatically restarted as soon as an item is present in front of the inserter. This effectively generates pulses so short that the inserter may only pick up one item. When the inserter has picked up an item it will reset the RS-latch and the whole thing returns to an idle state. The signal filter/multiplexer part isolates the wanted items from the "read items - hold" signal of the belt in front of the inserter and uses them to trigger the counter. This is necessary to ensure that the inserter is activated exactly in the right moment. There is some strange double wiring with green/red that is necessary to circumvent the signal delay introduced by some combinators. I might post a circuit diagram if there is demand (I'm lazy here).
I couldn't get it to use less than 9 combinators.. it might be possible to get it smaller.
Might be possible with just two combinators, I am on mobile, so here a short idea
Inserter: Set filter, Read hand content hold
Decider: Each > 0; Each = 1
Input to to items, which should be filtered, output with red wire to filter inserter
Arithmetic: Each := Each * -2
Input connected with green wire to the inserter, Output connected with red wire to the inserter
gheift wrote:Might be possible with just two combinators, I am on mobile, so here a short idea
Inserter: Set filter, Read hand content hold
Decider: Each > 0; Each = 1
Input to to items, which should be filtered, output with red wire to filter inserter
Arithmetic: Each := Each * -2
Input connected with green wire to the inserter, Output connected with red wire to the inserter
This will make the inserter pick up three items at once. One tick after the inserter outputs a "read items" signal it is already too late to switch it off.
DaveMcW wrote:You can do pick-1 with zero combinators. Feed this contraption with a filter inserter to do filtered pick-1.
pick1.jpg
Yeah slowing the belt also works.. but it slows down the belt and reduces throughput! It will also fail and pick up two items when both lanes are used and the belt is backing up. It is of no use to me but others might find it helpful. It's simple indeed.
You have much more simple and fast.
Connect the inserter to a pool and set :
* Check enable/Disable
* Check Read Hand Contents
* Check Hold
* Enable condition : everything < 1 (you can set 2,3,4 whatever you want your inserter to pick at once but no more)
In fact the inserter will disable itself when it has the requested number in hand
You have much more simple and fast.
Connect the inserter to a pool and set :
* Check enable/Disable
* Check Read Hand Contents
* Check Hold
* Enable condition : everything < 1 (you can set 2,3,4 whatever you want your inserter to pick at once but no more)
In fact the inserter will disable itself when it has the requested number in hand
This does not work with filter inserters when you set the filters via the circuit network, which is what this thread is about.
You have much more simple and fast.
Connect the inserter to a pool and set :
* Check enable/Disable
* Check Read Hand Contents
* Check Hold
* Enable condition : everything < 1 (you can set 2,3,4 whatever you want your inserter to pick at once but no more)
In fact the inserter will disable itself when it has the requested number in hand
This does not work with filter inserters when you set the filters via the circuit network, which is what this thread is about.
Ok sorry see the picture of DaveMcW and it was not a filter inserter.
But even with filter inserter you have the same way of doing it.
Lest say your filter network is the green wire, you set in the green wire the filter with the amount wanted (ex copper = 3)
Connect the green wire to your filter inserter (inserter in filter mode of course then Read Hand Contents and Hold)
Connect a red wire from your inserter to the entry of a calculator set it "each * -3"
Connect the output of the calculator to the green wire (the one already connected to your inserter)
Enjoy
PS : the each mult by '-3' remain the same even if you set copper=1 or 5 or whatever of course
Gnark wrote:
Lest say your filter network is the green wire, you set in the green wire the filter with the amount wanted (ex copper = 3)
Connect the green wire to your filter inserter (inserter in filter mode of course then Read Hand Contents and Hold)
Connect a red wire from your inserter to the entry of a calculator set it "each * -3"
Connect the output of the calculator to the green wire (the one already connected to your inserter)
Did you test the construction? It is basically the same that user gheift suggested. It does not work, the inserter will pick more items.
One tick after the inserter outputs a "read items" signal it is already too late to switch it off. So you _must_ use more combinators to produce pulses short enough.
I could only get it to pick 3 or 2 items at once but not just one. How did you get it to pick one item only? I exactly reproduced the circuit you posted but it does not work for me.. I am using Factorio v 0.14.17 but the behaviour should be the same as in the latest 0.13 stable release.
Gnark wrote:
PS : I also remember that I use this on a yellow belt ... if you try on a blue belt ?
faster belt may cause that inserter take item faster ?
Oh yes that's it! I am only using blue belts.
I have updated the original post and devised a new way of precisely controlling the stack size for any inserter that works with any belt and any inserter.
Re: Set any inserter stack size with just 1 combinator
Posted: Mon Dec 05, 2016 6:49 pm
by justarandomgeek
This can be done with no combinators at all - wire an inserter to a chest. Configure the inserter to read/hold mode, then configure it's enable condition as Every<[your threshold value] or Item<[your threshold value]. The inserter will load the chest to exactly that value, and if possible, do it in a single stack.
Re: Set any inserter stack size with just 1 combinator
Posted: Mon Dec 05, 2016 7:10 pm
by hansinator
justarandomgeek wrote:This can be done with no combinators at all - wire an inserter to a chest.
Did you even read the thread or did you just post your example? -.-
Your solution does not solve the problem for filter inserters and you are not the first one to make this mistake.