Page 1 of 1

[Solved] Filter 1 or more signals from a bunch of signals

Posted: Sun Jul 17, 2016 6:34 pm
by DOSorDIE
I have a chest as example (later it will be a signal from my Smart Factory) and i want filter out 1 or more signal from it.
Something Like:
12 Iron, 19 Copper, 6 Steel, 9 Wood ---> will get only the 6 Steel and the 9 Wood.
Next time i must filter total different things of a another signal ...
But how i make that?
I filter the signal but only with 1 of it ... but i need the orginal number.

Please Help!
Help.jpg
Help.jpg (89.67 KiB) Viewed 6376 times

Re: Need Help: Filter 1 or more signals from a bunch of signals

Posted: Sun Jul 17, 2016 6:59 pm
by siggboy
Here's a good solution for this problem: viewtopic.php?f=8&t=20732&start=60#p171258

It works like this: you have a bunch of "candidate signals" that you are interested in. These are the signal colors (types) you want to extract from the input signal.

You give each of the candidate signals a large value (e.g. 2 billion = 2,000,000,000), then you add this artificial large value to the original signal.

Let's say your original signal contained the value "Iron 1,234" and some rubbish that you're not interested in. You now add "Iron 2,000,000,000" to this, and the result is "Iron 2,000,001,234" (and the rubbish signals.)

Now comes the filtering step: you extract everything that is greater than "2,000,000,000" and the only thing that remains will be "Iron 2,000,001,234". The rubbish signals will be filtered out because they were too small.

In the last step you subtract the original "2,000,000,000" and you are left with your original "Iron 1,234" and nothing else.

It also works with multiple signals so you can make arbitrary filters.

Does that solve your problem?

Re: Need Help: Filter 1 or more signals from a bunch of signals

Posted: Sun Jul 17, 2016 7:13 pm
by DOSorDIE
I have try it this ... and it works!
Thank you very much! :mrgreen:

Re: [Solved] Filter 1 or more signals from a bunch of signals

Posted: Tue Jul 19, 2016 9:15 am
by Harkonnen604
There is much easier way. Put arithmetic combinator for every item you want to filter out with +0 operation (e.g. stone+0 => stone), then gather their outputs. This plus-zero operation also allows to remap signals to different items/colors.

Re: [Solved] Filter 1 or more signals from a bunch of signals

Posted: Tue Jul 19, 2016 1:03 pm
by siggboy
Harkonnen604 wrote:There is much easier way. Put arithmetic combinator for every item you want to filter out with +0 operation
This is only easier if you know in advance what you want to filter, and if it's not a lot of signals (because you need 1 combinator per signal).

Obviously if all you care about is filtering "Copper Plate" from a bunch of signals, then the method you've described is much easier (only 1 combinator, and easier to understand).

The way I understood him, he needs a dynamic filter, so he has an unknown set of input signals, and he needs to apply a dynamic signal filter to it; so he could not follow your advice and program a couple of combinators in advance (that would be a static filter).

Re: [Solved] Filter 1 or more signals from a bunch of signals

Posted: Tue Jul 19, 2016 2:19 pm
by Harkonnen604
Got it. Would be very good actually if combinators allowed treating red/green inputs separately and map them to operands. This way each-red * each-green -> each would allow masking out necessary materials.

Re: [Solved] Filter 1 or more signals from a bunch of signals

Posted: Wed Jul 20, 2016 11:37 am
by DOSorDIE
Im happy when you give me new input.
Filter 1 item out or get the info for 1 item is was not the problem.
I have make it with *1 to get only that or to filter make it negativ and sum it with the other.
I use that for my big dream ... near configless Smartfactorio, but i have many problems to solve :(