Balanced Warehousing Station (un)loading

Post pictures and videos of your factories.
If possible, please post also the blueprints/maps of your creations!
For art/design etc. you can go to Fan Art.

Post Reply
vanatteveldt
Filter Inserter
Filter Inserter
Posts: 946
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Balanced Warehousing Station (un)loading

Post by vanatteveldt »

I use the warehousing mod to get huge (6x6) storage areas which are ideal for station (un)loading since you don't have to mess with splitters, etc. Also, it looks cool.

However, I use multiple wagons (two, in this case) and it tickles my OCD if the warhouse stocks are not in balance (e.g. front warehouse has more stone than rear warehouse.

These is a "balance chest" mod that automatically balances neighbouring chests, so I figured I would create a "balance warehouse".

A trivial solution would be to have a smart inserter moving from A to B if the stock in A > B (and vice versa), but that would cause endless moving of goods when the balance is close. So, we want to move if A is at least (e.g.) 100 more than B.

Image

The left arithmetic combinator adds 100 to the stone signal of the left warehouse, and stores it as "A". The left decider compares "A" to the stone signal from the right warehouse, so emits "A=1" if the left warehouse is understocked by at least 100.

The right combinators do the same but inversed, and use the B signal.

The A and B signal are both moved via the pole to the 2x3 smart inserters, which move the goods to the left if A>0, and to the right if B>0.

This works (as far as I can see), which ensures that trains are loaded evenly, that waiting until empty makes sense, and that I can take from a single warehouse e.g. to smelt bricks or make landfills, without upsetting the balance.

Can this design be simplified?


(edit: I guess now that we have a balancer I might as wel remove the splitter / loop, and just run the belt past both warehouses. Also, apologies to my avatar for decapitating him)

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: Balanced Warehousing Station (un)loading

Post by Dr. Walrus »

I saw your post and decided to have a crack at simplifying your design and I've got it down to 1 arithmetic combinator and 1 constant combinator by using both color wires.

Image
Both warehouses are connected by a red wire, which will sum their contents and send that signal to the first arithmetic combinator.
The arithmetic combinator divides by 2 to find the average of the two warehouses and sends the result as a blue signal.
The constant combinator adds 50 blue (or half of whatever you want the maximum difference to be) onto that red wire and sends that signal to the inserters.
The inserters are hooked with green wire to their source warehouse and will move items from that warehouse if it has has 50 more material in it than the average of both warehouses, which is just if the item (I used the everything signal so you could use this setup with any item) > blue.

I've tested this setup with 3 side by side by side warehouses and it still works pretty well if you set the constants in the combinators to 3 and 1/3 of the desired max difference.

vanatteveldt
Filter Inserter
Filter Inserter
Posts: 946
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: Balanced Warehousing Station (un)loading

Post by vanatteveldt »

Great! Smart idea to average the contents and compare to that. That even allows you to place the whole thing in between the two warehouses, very neat!

I didn't know about the everything/anything signals, these sound very useful (although I would have picked other symbols, e.g. the inverted-A forall and inverrted-E exists logic symbols, instead of using nonintuitive colors to communicate this meaning)

(for other noobs like me :) : " Special inputs - Anything, Everything, and Each" in combinators 101 )

Edit: still don't quite understand it. The 101 gives info on the "each' (yellow star) symbol in comparisons, but how does it work in arithmetic? Is it the min (or max?) of all signals?Also, you use the "all" (red star) symbol on the green inserter, you could also have used the other stars right, since there is only one symbol on the green wire? Or am I misunderstanding something now?

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: Balanced Warehousing Station (un)loading

Post by Dr. Walrus »

vanatteveldt wrote:Great! Smart idea to average the contents and compare to that. That even allows you to place the whole thing in between the two warehouses, very neat!

I didn't know about the everything/anything signals, these sound very useful (although I would have picked other symbols, e.g. the inverted-A forall and inverrted-E exists logic symbols, instead of using nonintuitive colors to communicate this meaning)

(for other noobs like me :) : " Special inputs - Anything, Everything, and Each" in combinators 101 )

Edit: still don't quite understand it. The 101 gives info on the "each' (yellow star) symbol in comparisons, but how does it work in arithmetic? Is it the min (or max?) of all signals?Also, you use the "all" (red star) symbol on the green inserter, you could also have used the other stars right, since there is only one symbol on the green wire? Or am I misunderstanding something now?
The symbols actually work slightly differently depending on which device you are using so it's fairly tough to understand the nuances without a lot of trial and error. For this build you could just use the item you will be storing as your signal and it would work the same. I just used the each and everything signals so it would work with any item. I no expert either but I'll try to give a basic explanation.

First off there's 3 types of circuit network readers ie. a building that does something based on a circuit condition.
These are the input of the arithmetic combinator, the input of the decider combinator, and devices that turn on or off based on a circuit condition like smart inserters, pumps and lamps. These can all accept 1 or more of the special signals as in input

The yellow "each" symbol is the easiest to understand. It's found only on decider combinators, and arithemtic combinators.


Ok maybe I'll make a guide and post it later as it's own topic with pictures and in depth explanations of the use of every special input in every device. But that will take a looong time so not tonight.

To answer your question. When you use EACH as an input on an arithmetic combinator, the combinator performs is action on each signal it receives. duh. But the use here that's not so easy to realize is that this allows 1 arithmetic combinator to do a function to every signal it gets and output each of those.

Example 1: Set the arithmetic combinator to Input[EACH * 5] Output[EACH]. If you input 4 iron and 8 copper (ie. connect a wire to the input and connect that wire to a chest containing 4 iron and 8 copper), the combinator will output 20 iron and 40 copper.

Example 2: Same setup but set the combinator to Input[EACH * 5] Output[coal]. The combinator now does a few fancy tricks. It takes the output of the result of it's math (which is still 20 iron and 40 copper) and converts each of those numbers to coal. So it outputs 20 coal and 40 coal. But because a wire can't carry both 20 and 40 of the same item, the two numbers of coal are added together before being output. So we will just see the combinator output 60 coal. This works even if the signal selected for the output is the same as an inputted signal. If I set it to Input[EACH * 5] Output[iron], the output would still be 60 iron.

Example 3: My setup in the warehouse design. The combinator is set to Input[EACH /2] Output[blue]. By design It will only ever receive one type of signal, because the warehouse will only ever store one type of item. I don't necessarily know which item it will be. But the EACH input will recognise any input, divide it, and then convert it to the blue signal. In this case, if I was storing only copper ore I could have set the arithmetic combinator to Input[copper ore /2] Output[blue]. In that setting the combinator would only respond to copper ore.


Yes you are correct about EVERYTHING(red) and ANYTHING(green) being interchangeable in this setup, but at first glance it's not so obvious why they are interchangeable. In this setup, there are actually 2 inputs to the inserters. The item in the warehouse(lets call it iron) and the blue signal. My inserters are set to IF[EVERYTHING>blue]. If you take a close look, you'd think that the inserter should never run. Why? Because for IF[EVERYTHING>blue] to be true, then every signal that the inserter receives must be greater than blue. And the blue signal it receives will never be greater than the blue signal it receives! So I should have used the ANYTHING signal.

Interestingly, ANYTHING and EVERYTHING don't work like that. When you set an inserter to IF[EVERYTHING/ANYTHING>any signal] (as opposed to setting it to IF[EVERYTHING/ANYTHING>a constant number]) the inserter does not does not evaluate the signal to the right of the ">" sign along with everything else. So in this case the inserter checks to see if every signal except blue it receives (in this case it's only one signal, iron) is greater than the blue signal it receives. If this is true than the inserter inserts.

Let me know if this was helpful or not. I think I might write up a guide explaining all the quirks of the special signals if people are confused and if I can help. I know I'm not the best at using the circuit network but I know my way around a combinator and writing a good guide is all about clarity.

vanatteveldt
Filter Inserter
Filter Inserter
Posts: 946
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: Balanced Warehousing Station (un)loading

Post by vanatteveldt »

This certainly helps :)

Maybe you should have a good look at https://wiki.factorio.com/index.php?tit ... gnals#Each and clariy there? It would already help to have the right pictures next to each heading, and I think the wiki does not list some of the cases you descibe above (but maybe I'm just a bad reader...)

Post Reply

Return to “Show your Creations”