Smart Filter Inserter

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
wallE
Burner Inserter
Burner Inserter
Posts: 19
Joined: Fri Aug 12, 2016 3:15 pm
Contact:

Smart Filter Inserter

Post by wallE »

Assume you have a chest (or belt or train waggon - it doesn't matter) with mixed content from which you want to pick - lets say 50 repair packs, 30 fast inserters and 15 laser turrets with only ONE filter inserter.
In this chest is an unknown amount of anything (iron, coal, ...), maybe there are enough packs, inserters and turrets, maybe there are plenty or none at all in any kind of variations.

You'd do this: connect your target chest to your filter inserter - insert the filter condition to your wanted goods and now the my trouble beginns.
I can't make up a logical network that tells the filter inserter has enough eg. repair packs but still should grab turrets and so on.
You could make up some ORed conditions (grab things as long as there is still something missing) but this will not work because the filter insert would happily grab turrets even you have already 2k of them
but there is 1 repair pack missing.

What i need is a really smart filter inserter where i can set up not only WHAT to insert but also HOW MUCH based on some logic condition individually per every WHAT to grab.

I have some kind of awkward workaround:
unload the chest with a filter inserter onto a belt, from there grab with another filter inserter (one for each different stuff i need) connected to a logic network (for the numbers) AND let the belt be unloaded into the chest again.

Where do i use this:
My mining outposts are automatically supported with defensive goods in the very first waggon of each train. The waggon is filled in my production central with various turrets, ammo, repair packs and stuff.
AND i have some general purpose trains which visit all outposts and restock their needed supply.
At an outpost i set up this workaround to unload only the needed amount of goods -- e voila -- automated, electrified, defended outpost.

BTW: My outposts are pretty far away so there is no direct connection to them but trains. I'm just figuring how to notice if a specific outpost is depleted in a CENTRAL unloading station and signaling that by some display?

Hope this wasn't answered elsewhere - search results were negative.

EDIT:
I think i nailed it now:
What i want is an inserter which works (roughly) like that on belts:
Phase 1) Identify what will be picked next (or empty) -> send to logic
Phase 2) Pick on yes/no from logic
Phase 3) Use standard rules for dropping

For chests and the like we need phase 1.5
1.5) logic can signal to "move over to next stack to pick from" or more general "move to stack #n"

In short words my inserter would have a reverted workflow where the (outside) logic decides what to do and not the inserter is telling the logic what it has done.

Epicnoob
Burner Inserter
Burner Inserter
Posts: 12
Joined: Sun Jul 03, 2016 6:56 pm
Contact:

Re: Smart Filter Inserter

Post by Epicnoob »

For pulling stuff off a belt or chest you could use a setup like below. Hook up your chest to a decider that outputs 1 for each item that is in the chest. (top decider). Then hook up that decider to a multiplier that multiplies that 1 or 0 with the maximum value of a 32-bit signed integer (which is 2147483647). So if the chest has an item available, this combinator will output 2147483647 for that item.
In the botton combinator the magic happens, its input is the sum of that last combinator and the demand (as a positive value). Because 2147483647 is the maximum integer value, it will flip to a negative value whenever you add a positive value to it. So if there is demand and there is at least one of the items in the chest, the sum will become negative; therefore make the bottom decider output 1 for each item that has a negative value.
Now hook up this output to the (stack) filter inserter and set the inserter so it takes its filters from the circuit network.

TL:DR this setup is basically an AND operation for two inputs of the same signal, setting the filters of the inserter to any items that are both in supply and in demand.
setup to empty chest, rearrange combinators as you please
Extension: To immediately subtract any items from the demand after they are taken out of the chest, you could hook up the first piece of belt (reading in pulse mode) to a memory combinator. Hook up the last piece of belt (also reading in pulse mode) before the item becomes part of the network to this same combinator, but as a negative value.
Now a memory combinator is an arithmetic combinator that outputs its input unchanged and then loop back its output to its input (the combinator outputs input + 0). Subtract this combinator's value from the demand of the network before connecting the (net) demand to the combinator logic. Memory cell pic is given below:
With memory cell, picture not including wire from the last piece of belt

However, if you want to use this to fulfill demand of outposts there are problems getting the demand signal to your main base. As far as I know there is no better way to measure demand than to methaphorically throw the resources at the wall and see what sticks. This means load up a wagon with all the different goods an outpost may need (set filtered slots with middle mouse button to ensure that all different items can fit in the wagon) and send it to the outpost. Then if the outpost only takes out the items it needs, attempt to refill the wagon everytime it returns from the outpost.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Smart Filter Inserter

Post by ssilk »

Moved from General to Gameplay Help.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

wallE
Burner Inserter
Burner Inserter
Posts: 19
Joined: Fri Aug 12, 2016 3:15 pm
Contact:

Re: Smart Filter Inserter

Post by wallE »

@ssilk: tx for moving this thread to where it belongs!

@Epicnoob: tx for your input! I had to adapt your input to my needs but it was extremly valuable for me!

Maybe i will show my solution here if someone is interested ...

wallE
Burner Inserter
Burner Inserter
Posts: 19
Joined: Fri Aug 12, 2016 3:15 pm
Contact:

Re: Smart Filter Inserter

Post by wallE »

I'm not sure if this is the right thread to post or the "show your creations" thread.

I've found and build a solution that works quite nice - not perfect, but good enough. It is possible to fill each of the 20 slots of a wagon with different stuff out of ONE chest. There is no need for 12 different chests to fill a supply train with stuff and still need more ;)
See solution
The principal idea is waiting for the "filling inserter(s)" to get stuck and then remove some of the stuck items from the wagon.
My problem is now: I'm sure someone could minimize my creation so it uses less combinators.

And there is one more problem: There should be need for every different good in the wagon to be sure it will be processed.
Sorry for my bad english :(
Blueprint

Post Reply

Return to “Gameplay Help”