[solved] multiply 2 networks (or other solution)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
fuinril
Burner Inserter
Burner Inserter
Posts: 15
Joined: Wed Feb 21, 2018 10:50 pm
Contact:

[solved] multiply 2 networks (or other solution)

Post by fuinril »

I have a fairly complex logic network I'm trying to push even further to play with recursive blueprints.

But I'im hitting a wall right now.... Here's my issue :

I have a central command where I define all items I want to craft.

The definition of an item consist of :
-an ID
-a number (corresponding to the number of items I want to craft per train trip)
-needed materials to craft one of this item

.... and some other stuff not relevant for my issue (ideal stock, area of crafting, etc...).


All of this is sent through a multiplex red network where :
- channel 2 contains all the items for which crafting should occurs
- channel 3 contains the number per train trip for all items (let's say 20k gears)
- channel 4 contains the IDs of all items
- channel 10 contains logic signals (0-10A-Z) which value the IDs of the item I want to craft in one area of crafting
- channel 101 and > contain the needed materials needed to craft the corresponding item ID


Now in my crafting area I can dynamically get the desired item, what it takes to craft it, if it has to be craft.... but i'm at a loss to get the number I want to craft (which will serve to send supply needs for this area to my supply center).

For exemple :

gear is defined as follow :
- ID : 101
- number : 20k
- needed materials : 2 iron plates
- crafting area : 1

So, in the crafting area 1, I read signal 0 which value 101.
I get everything from channel 4 which value 101 and I know the crafting area has to craft gear (output gear=>1).
I get everything from channel 2, add it to everything from previous operation and then remove everything that is different from 2 (output gear=>1) so I know I have to craft gear
I get everything from channel 101 (output iron plate=>2)

And now the only thing I need is to multiply the last output signal by the gear signal in channel 3, so it'll output iron plate=>40k. But I cannot figure how to isolate the gear signal value without specifying gear signal...

Any ideas are welcome !
Last edited by fuinril on Thu Jun 14, 2018 9:09 pm, edited 1 time in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: multiply 2 networks (or other solution)

Post by DaveMcW »

So you have 3 networks with useful info:
Network A: Iron gear wheel = 101
Network B: Iron gear wheel = 20k, plus other items
Network C: Iron plate = 2

First we use the ID to create two filters, plus and minus one million.

Each (Network A) > 0 → Each = 1
Each × 1000000 → Each

Each (Network A) > 0 → Each = 1
Each × -1000000 → Each

Then we apply the filters to network B.

Each (Network B) + (+ million filter) > 1000000 → Each + (- million filter)

We are halfway there, our networks look like this:
Network C: Iron plate = 2
Network D: Iron gear wheel = 20k

Convert the unknown signal on network D to a known signal, so we can multiply it.

Each (Network D) + 0 → M
Each (Network C) × M → Each

Final result:
Network E: Iron plate = 40k

fuinril
Burner Inserter
Burner Inserter
Posts: 15
Joined: Wed Feb 21, 2018 10:50 pm
Contact:

Re: multiply 2 networks (or other solution)

Post by fuinril »

Fun fact : I posted after 3 days and maybe 6 or 7 hours of thinking and tries without finding a solution.

Ten minutes after posting genius strikes, some reverse thinking and I came up with a working, simple solution, very close (if a bit simplier, but that's because I use the result from previous operations) to yours !

Mine is

I get everything from channel 2, add it to everything from previous operation and then remove everything that is different from 2 (output gear=>1) so I know I have to craft gear => Network A
Network B: Iron gear wheel = 20k, plus other items
Network C: Iron plate = 2

A - 1000000000 => each
each + B < 0 => each
each + 999999999 => M
M * each (C) => each


3 calculators and one combinator.... So simple ! It makes me feel pretty dumb :oops:

But thank you very much for your very accurate reply anyways ! I should have asked before, it would have spare me some serious headache :roll:

Post Reply

Return to “Gameplay Help”