Stack Filter Inserter - set stack size according to filter
Stack Filter Inserter - set stack size according to filter
I'm trying to load a specific number of different items into a train (e.g. 11 solar panels and 7 accumulators) by sending a bunch of signals from the circuit network.
I have some logic that figures out the difference between what is already on the train and what I want on the train and outputs signals as appropriate - e.g. if there is already 1 solar and 5 accumulators on board, it will output 10 solar and 2 accumulators.
I've got a stack filter inserter doing this; setting the filter isn't a problem - I just connect the output of my existing logic into the inserter, set it to 'set filters' and it does it's stuff; it seems to just pick the first signal it finds (in this case solar panels) and uses that as the filter until my logic removes that filter, then it moves onto the next signal (accumulators in my example). That's all fine and dandy and works great.
My problem comes with setting the stack size.
Seeing as the filter inserter can't take 'each' for filter size (you have to specify a signal type), I need to somehow figure out how to grab the 'first' signal (the same one that the inserter is using for the filter) from the bunch, and get the count of that (which I can then convert to a different signal and do some maths to get a stack size <= 12). I have no idea how to find out which signal the inserter is currently using as it's filter though - is there a way of doing that?
Thanks
I have some logic that figures out the difference between what is already on the train and what I want on the train and outputs signals as appropriate - e.g. if there is already 1 solar and 5 accumulators on board, it will output 10 solar and 2 accumulators.
I've got a stack filter inserter doing this; setting the filter isn't a problem - I just connect the output of my existing logic into the inserter, set it to 'set filters' and it does it's stuff; it seems to just pick the first signal it finds (in this case solar panels) and uses that as the filter until my logic removes that filter, then it moves onto the next signal (accumulators in my example). That's all fine and dandy and works great.
My problem comes with setting the stack size.
Seeing as the filter inserter can't take 'each' for filter size (you have to specify a signal type), I need to somehow figure out how to grab the 'first' signal (the same one that the inserter is using for the filter) from the bunch, and get the count of that (which I can then convert to a different signal and do some maths to get a stack size <= 12). I have no idea how to find out which signal the inserter is currently using as it's filter though - is there a way of doing that?
Thanks
Re: Stack Filter Inserter - set stack size according to filter
I am curious. Why not set filters in the wagon and use multiple insertion points (until the inserter stuck holding an item forever bug gets fixes).
Re: Stack Filter Inserter - set stack size according to filter
Because I may want to load different things into it depending on what I'm doing.
The train is my 'personal transport' train that I tend to load up with stuff that I need to e.g. build a certain type of outpost, or build some more assembly capacity, or whatever my current project may be. It'd be a faff to manually change all the car filters every time (unless this can be done by circuit network? I can't see how...)
Also I am actually using multiple inserters to do this; I only mentioned one for the sake of keeping the example simple.
The train is my 'personal transport' train that I tend to load up with stuff that I need to e.g. build a certain type of outpost, or build some more assembly capacity, or whatever my current project may be. It'd be a faff to manually change all the car filters every time (unless this can be done by circuit network? I can't see how...)
Also I am actually using multiple inserters to do this; I only mentioned one for the sake of keeping the example simple.
Re: Stack Filter Inserter - set stack size according to filter
If they simply fixed the inserter then 1 requester chest would do. You could tell it to get you X of 15 different items.
Re: Stack Filter Inserter - set stack size according to filter
That doesn't work - if there are already some on the train, it will load too many.
Re: Stack Filter Inserter - set stack size according to filter
Not if you filter the car in conjunction.AxeSlash wrote:That doesn't work - if there are already some on the train, it will load too many.
I do this now with my construction train though it takes 12 requester chests instead of 1.
Re: Stack Filter Inserter - set stack size according to filter
I tried a few things at various points. Other than modding (basically code a special inserter that "does the right thing" including not getting stuck holding an unwanted item), just having one chest/inserter per item type is pretty much the only way that works reliably for both personal and regular supply.
As well as the issue where an inserter grabs more than it can unload and getting stuck, it can get stuck if the destination changes in some way (train leaves, player manualyl adds items, changes a slot, etc.) or if the supply chest doesnt have an item (because an inserter filter only takes the first N filters, just 1 for stack ones, if there is none of those N items, but you do have the N+1 item, it wont load it and just sits there).
Upto 12 chests per wagon is normally a good enough selection, and for a personal construction train I don't mind it having lots of wagons and being a little slower.
A lot of the same issues apply when trying to move items between adjacent logistics networks as well.
As well as the issue where an inserter grabs more than it can unload and getting stuck, it can get stuck if the destination changes in some way (train leaves, player manualyl adds items, changes a slot, etc.) or if the supply chest doesnt have an item (because an inserter filter only takes the first N filters, just 1 for stack ones, if there is none of those N items, but you do have the N+1 item, it wont load it and just sits there).
Upto 12 chests per wagon is normally a good enough selection, and for a personal construction train I don't mind it having lots of wagons and being a little slower.
A lot of the same issues apply when trying to move items between adjacent logistics networks as well.
-
- Fast Inserter
- Posts: 124
- Joined: Fri May 22, 2015 3:31 pm
- Contact:
Re: Stack Filter Inserter - set stack size according to filter
Can you set it up to use two inserters? One stack filter, and one normal filter with stack override = 1.
Once you do your math to figure out how many of each item to load, send the signals through a combinator with "each >= 12 -> each" to the stack filter, and "each < 12 -> each" to the normal one (replace 12 with whatever your current stack size bonus is). That should result in the stack inserter being used to load the bulk of stuff where you need a lot, and then get topped off to the exact amount by the normal filter inserter.
It will be slightly slower, but at least should work... (or maybe faster, since the normal filter inserter will be topping things off while the stack filter is working on something else)
Once you do your math to figure out how many of each item to load, send the signals through a combinator with "each >= 12 -> each" to the stack filter, and "each < 12 -> each" to the normal one (replace 12 with whatever your current stack size bonus is). That should result in the stack inserter being used to load the bulk of stuff where you need a lot, and then get topped off to the exact amount by the normal filter inserter.
It will be slightly slower, but at least should work... (or maybe faster, since the normal filter inserter will be topping things off while the stack filter is working on something else)
Re: Stack Filter Inserter - set stack size according to filter
Yep, this is possible:AxeSlash wrote: Seeing as the filter inserter can't take 'each' for filter size (you have to specify a signal type), I need to somehow figure out how to grab the 'first' signal (the same one that the inserter is using for the filter) from the bunch, and get the count of that (which I can then convert to a different signal and do some maths to get a stack size <= 12). I have no idea how to find out which signal the inserter is currently using as it's filter though - is there a way of doing that?
- using a separate filter inserter as a "sensor": you sends signal bunch to the sensor and receives "first" signal by checking what item was transferred.
- or you can use predefined table with IDs.
First approach is compact, slow and a bit ugly; second approach - slightly larger, faster and also ugly .
Another way to solve the initial problem is to use a separate inserter that will take extra items out of the wagon.
-
- Burner Inserter
- Posts: 15
- Joined: Tue Apr 14, 2015 9:01 pm
- Contact:
Re: Stack Filter Inserter - set stack size according to filter
Use an inserter to take items out of the wagon. This is the only solution that works because the main inserter will always deposit one load into the train wagon when it first arrives. Its a simple setup.
here is an example blueprint: I don't know why the entire blueprint isn't appearing, but you can click quote to see the whole thing.
0eNrll8FymzAQht9Fxw7KAMY49qFP0Vsnw8iwsTUFiS7CbZLh3bsSCWBbdqHtrRczQtoPaffX7vqN7csWapTKsN0bk7lWDdt9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print: I don't know why the entire blueprint isn't appearing, but you can click quote to see the whole thing.
0eNrll8FymzAQht9Fxw7KAMY49qFP0Vsnw8iwsTUFiS7CbZLh3bsSCWBbdqHtrRczQtoPaffX7vqN7csWapTKsN0bk7lWDdt9fWONPChR2nfmpQa2Y9JAxQKmRGVHKGTJuoBJVcBPtou6p4CBMtJI6O3d4CVTbbUHpAWDZWPI9nA03CECVuuGrLSynyJSHLAXtuOPXRdcQeKFkNQHWQ2QUh9kY2TO8yM0hovcyBPwGvVJFrTyisrDh3UPXj2sfehkQD/L0gByqRpA42OdoQJWSIS8n6a9UxAM6jLbw1GcpEZrk0vMW2mySheQ6edM14Cit4g6Z6J6QmNXR/YHoZiGQtIoCoOBZMdx90QHYfoEiHTorDEi/5Y18hUc9uqE64URSHxuSm9FAOF7S8/7vo+dw96XZr2je8l9aHHAWzEbbJ1bOOq9Nsx6qrVaX4d2Z+8m8fWO7i0fJYRQC4m8Jq+Na6NwungURS0Bc6kOxG5V0fBKHMSrVDBaxmeWU2drBfyHKMtbXxl9emgVNy0i3Nr9ZlRpSU9zRP2DtOqxefIEbzPZFJ2az1d6fKn09J8p/YAA6krrkRW35wiPC0Uc+yDbASJQmiP50cpYV3uphNE+Bfe0cOZ9H6kZTRdyOPCzRNL9VXo+STStKMcM3a/gIPIj691GAbOB5XRBJj5ln8hGt6ZuF1O7ReFIrZ5YvDxeNmn9ka/5/+BsX5aPRld7ppOJj93y+PJFeisSF7mVjng/Dh+X/yoQiT8Q03T+mw7Ek9y7IXkl4aQ1CX7Lusj6Xk48gzMtB900Uw+U1QzKzTrRTQvFgExmICcFZAJZD4z1DMaksEzPNjDSGQxfxfHCNk7Bf9jVuG7Um2M2F0rfetohn+7HBqGCQrYVh5L2haSYWpdwp+j1wv+b7sy3ndWyChZ6IckyiLcKRgsbQm8/GI3Ni2UoTmqtPT51hHRWHvnw4pDN7yTzc4W2KJQNsEY4z+R05Wx4dFULdNluxz4z14mKIntGXWVu82xHSQneX9uD1FCcz7jBMDW7Cnxh3V8p6caN2F5dnf4zZe9IdH4/OEUn2zDapqtkE6/SlCS4d722sHPJ9jFcbeNoTY8o8f7vijbLpEIQ2rMLzm7yJzVg9F+l6fvHJInXqzRKqN51vwBsGPfs
Re: Stack Filter Inserter - set stack size according to filter
Eh, you can make it work. I had a wall repair train in my last game that would carry walls, turrets, multiple power poles, concrete, both kinds of bots, roboports, rails, fuel... All without filters in the wagons and all loading to one wagon from one side (so 6 stack inserters for 10+ items). There were two tricks to make that work though. First, you've gotta empty the train every time it arrives so you know exactly what it contains (although with 0.15 you could probably make it work with read train contents... but that might actually be slower since you won't know what you need until the train arrives) Next, you have to have two stages of loading. You don't put more into the chests at the station then what you need. You don't filter what gets put into the train, you filter it before it gets to the station.SyncViews wrote:just having one chest/inserter per item type is pretty much the only way that works reliably for both personal and regular supply.
You still could be off by a couple depending on the stack size inserting into the staging chests. In my case that wasn't an issue, but if it is you could have an inserter with stack size fixed at 1 which will pull the excess items out after you've put the correct amount in the staging area but before they get loaded onto the train. One option would be to load the train from 3 chests per side per wagon. Between the chests you chain stack size 1 filter inserters, with the filter set to whatever is in the chests plus a constant combinator of whatever you need with negative values (so the network and filters show only the excess). Then just don't let the train start loading unless everything in that network is 0. Meanwhile you keep an extra buffer behind the station to quickly reload as soon as the train leaves.
Re: Stack Filter Inserter - set stack size according to filter
Yeah I guess that works. Even in 0.15 you need to either at least partially empty the wagon, or have a lot of spare space. The inserter may still be holding an unwanted item when the train arrives and will get stuck if it cant drop it.
Its a nice technical effort to prove it can be done, but I feel for what should be a simple idea (filter wagons plus inserters each doing multiple items, or filtered chests to unload) the work around will end up worse than 6 stack or 12 long inserters most of the time.
For the unloading side at least spare space in a chest is generally fine, but you still need to deal with the priority order and only having one filter at a time (on a stack filter inserter).
Its a nice technical effort to prove it can be done, but I feel for what should be a simple idea (filter wagons plus inserters each doing multiple items, or filtered chests to unload) the work around will end up worse than 6 stack or 12 long inserters most of the time.
For the unloading side at least spare space in a chest is generally fine, but you still need to deal with the priority order and only having one filter at a time (on a stack filter inserter).