Page 3 of 4

Re: Belt math, using lower tier belts to effect.

Posted: Thu Aug 29, 2019 9:49 pm
by BlueTemplar
Nice, I might use that, thanks !

Clarification on the term "balancing"

Posted: Fri Aug 30, 2019 10:01 pm
by Impatient
When looking at this thread, I feel the urge to clarify the term "balancing".
Balancing
"Balancing" in the context of Factorio means transforming one or several (n) rates of input (i1, i2, in) to one or several (m) rates of output (o1, o2, ... om), where all the rates of output are equal!

o1 = o2 = ... = om = o

If the combined rate of input equals the combined rate of output the transformation can be expressed as the following formula:
i1 + i2 + ... + in = o1 + o2 + ... + om = m*o

Rate

"Balancing" in the context of Factorio and in common language mostly is used when refering to the task to evenly distribute the items from a numer n of belts to another number m of belts. Former are referd to as input belts and the later ones as ouput belts. Sometimes "balancing" also is used for the problem to evenly distribute the items from the lanes of an input belt or input belts to the lanes of an ouput belt or output belts.

Balancing problem
Balancer

Clarification on "ratio splitting"

Posted: Sat Aug 31, 2019 12:16 am
by Impatient
Following up on the clarification on "balancing", I also want to clarify the term "ratio splitting".
Ratio splitting
"Ratio splitting" in the context of Factorio refers to the task of transforming one or several (n) rates of input (i1, i2, in) to one or several (m) rates of output (o1, o2, ... om), where the rates of output have fixed ratios (r1, r2, ... rm) compared to the combined input (i).

i1 + i2 + ... + in = i

o1 = r1*i
o2 = r2*i
...
om = rm*i

Example
Relation of balancing and ratio splitting
Looking at the meaning of "balancing" and "ratio splitting" reveals, that balancing problems are a subset of ratio splitting problems with the constraint, that all output ratios have to be equal.

Constraint for "balancing":
r1 = r2 = ... = rm = r

and thus

o1 = o2 = ... = om = o

Re: Belt math, using lower tier belts to effect.

Posted: Sat Aug 31, 2019 12:51 pm
by steinio
What does the term 'throughput unlimited' mean?

Re: Belt math, using lower tier belts to effect.

Posted: Sat Aug 31, 2019 2:26 pm
by Optera
steinio wrote:
Sat Aug 31, 2019 12:51 pm
What does the term 'throughput unlimited' mean?
It means feeding n compressed belts to any inputs allows drawing n compressed belts from any outputs.
Most balancers have have insufficient internal throughput and are therefore not throughput unlimited.
see https://wiki.factorio.com/Balancer_mechanics
and viewtopic.php?t=60561

I havn't used balancers myself in ages since i ran benchmarks on balancers made of splitters vs loaders with wide chests. Loader performance already is 50% better for balancing 4 belts.

Re: Belt math, using lower tier belts to effect.

Posted: Sat Aug 31, 2019 3:12 pm
by Oktokolo
Optera wrote:
Sat Aug 31, 2019 2:26 pm
I havn't used balancers myself in ages since i ran benchmarks on balancers made of splitters vs loaders with wide chests. Loader performance already is 50% better for balancing 4 belts.
And it seems to be impossible to make circuit-less balancers in vanilla that evenly distribute the input to unblocked outputs if one or more outputs is backed-up. That is my standard use case whenever i think about using a balancer instead of a priority splitter.
It is trivial to do that with loaders and wide chests/warehouses.

Re: Belt math, using lower tier belts to effect.

Posted: Sun Sep 01, 2019 11:38 am
by disentius
Oktokolo wrote:
Sat Aug 31, 2019 3:12 pm
Optera wrote:
Sat Aug 31, 2019 2:26 pm
I havn't used balancers myself in ages since i ran benchmarks on balancers made of splitters vs loaders with wide chests. Loader performance already is 50% better for balancing 4 belts.
And it seems to be impossible to make circuit-less balancers in vanilla that evenly distribute the input to unblocked outputs if one or more outputs is backed-up. That is my standard use case whenever i think about using a balancer instead of a priority splitter.
It is trivial to do that with loaders and wide chests/warehouses.
It is possible in vanilla. Rather bulky 2 lane version i posted earlier this thread: (viewtopic.php?f=202&t=74800&start=20#p453655)
Gif shows even input consumption with a 3/4 blocked output.
If I play modded I go with loaders like Optera, for the same reasons. (and Angels Warehouses instead of Wide Chests, because they look stunning:))

Re: Belt math, using lower tier belts to effect.

Posted: Sun Sep 01, 2019 3:47 pm
by Oktokolo
disentius wrote:
Sun Sep 01, 2019 11:38 am
Oktokolo wrote:
Sat Aug 31, 2019 3:12 pm
And it seems to be impossible to make circuit-less balancers in vanilla that evenly distribute the input to unblocked outputs if one or more outputs is backed-up. That is my standard use case whenever i think about using a balancer instead of a priority splitter.
Rather bulky 2 lane version i posted earlier this thread: (viewtopic.php?f=202&t=74800&start=20#p453655)
Gif shows even input consumption with a 3/4 blocked output.
Well, even distribution for unblocked outputs is implicit if there is only one unblocked output.
The until now unseen belt balancer would have more than two inputs and more than two outputs. It would evenly balance inputs to unblocked outputs so that every unblocked output gets roughly the same (does not have to be count-perfect) amount of item throughput. Inputs are assumed to contain the same item type, so mixing order doesn't matter. Input and output lanes are assumed to be balanced already. So it is only about balancing belts - not lanes.

Re: Belt math, using lower tier belts to effect.

Posted: Sun Sep 01, 2019 4:31 pm
by disentius
Well... be specific. What do you want, exactly?
Saying something can't be done without being precise is not very informative. Showed you that your initial statement:
Oktokolo wrote:
Sat Aug 31, 2019 3:12 pm
...
And it seems to be impossible to make circuit-less balancers in vanilla that evenly distribute the input to unblocked outputs if one or more outputs is backed-up. That is my standard use case whenever i think about using a balancer instead of a priority splitter.
It is trivial to do that with loaders and wide chests/warehouses.
is not true, by building a concept for two belts.
You obviously did not test it. Go ahead, try blocking/consuming in every variation, THEN tell me what is wrong. Dismissing a build without testing is not the factorio way. :D

Re: Belt math, using lower tier belts to effect.

Posted: Sun Sep 01, 2019 7:05 pm
by Oktokolo
disentius wrote:
Sun Sep 01, 2019 4:31 pm
Well... be specific. What do you want, exactly?
I am searching for a circuit-free belt balancer (not a lane balancer) with four input belts and four output belts.
Whenever there are items available on one of the inputs, they should be distributed evenly to all non-backed-up outputs. So that balancer would act like a balancer of four input belts to N output belts for N = zero to four depending on how many of the four output belts are able to receive items (are not backed up).

I chose the four-belt version, because i assume, that it could be used as a building block to build back-up-aware belt balancers for arbitrary amounts of inputs and outputs.

Re: Belt math, using lower tier belts to effect.

Posted: Sun Sep 01, 2019 7:10 pm
by Impatient
@disentius:

I studied the designs you presented here viewtopic.php?f=202&t=74800&start=20#p453655 . You show a 2>>2 balancer, that has a 2>>2 mixer and 2 output AND input lane balancers included. Very nice.

BUT I have the suspicion, that the mixture of those components can not be generalized to every n>>m problem. And let's leave the mixing and lane balancing part out. Let's just look at the belt balancing. Without the mixing and lane balancing parts, the design you showed is "just" a 2>>2 belt balancer. In the case of a 2>>2 belt balancer, which is a vanilla Factorio splitter, it is easy to evenly "distribute" the input to the other output"s", if one ouput is disconnected (or the belt at that output is backlogging), as there is just one "other" output.

In my experience every n>>m problem where y outputs are (partially) blocked, becomes temporarily an n>>(m-y) problem, for which to solve, a completely different balancer is required.

I tested the standard designs of an 8>>8 and of a 4>>4. They are not capable of balancing to (m-y) outputs. You might argue, that a completely different balancer is required, more complex, which can handle every case. But I doubt that such a solution exists. Looking at 8>>8 and 4>>4 balancers and their output behavior, when 1 output is blocked, it becomes apparent, that the culprit is the fact, that only the vanilla Factorio splitter, which is a 2>>2 balancer, can be used to split, mix and combine the contents of belts. For 2 outputs of an n>>m, there is always 1 "last" splitter inside the balancer. "Last" in the sense of "the last splitter before those 2 outputs". If one of the outputs is blocked, the other output gets ALL the inputs from that splitter, not just one half of it.

What are your thoughts?

Re: Belt math, using lower tier belts to effect.

Posted: Sun Sep 01, 2019 8:09 pm
by disentius
Thank you both for clearing up the details :)
I agree. There is no solution that i know of for even distribution in all cases possible for a 4-4 balancer.

Re: Belt math, using lower tier belts to effect.

Posted: Mon Sep 02, 2019 8:27 am
by Trebor
disentius wrote:
Sun Sep 01, 2019 8:09 pm
Thank you both for clearing up the details :)
I agree. There is no solution that i know of for even distribution in all cases possible for a 4-4 balancer.
My first attempt is a spectacular failure as what's mixed in the first phase is separated in the second!
Screen Shot 2019-09-02 at 4.20.08 AM.png
Screen Shot 2019-09-02 at 4.20.08 AM.png (3.66 MiB) Viewed 5789 times
Blocking different outputs causes mixing but as soon as all are opened again the mixing ceases.

Re: Belt math, using lower tier belts to effect.

Posted: Mon Sep 02, 2019 9:57 am
by Impatient
@Trebor:

In general I think, what a mixer has to look like, always depends on, in what pattern the items are supplied on the input side. I think there is no mixer which reliably mixes every input pattern.

In the case of this design you show, where the item types are separated by input belts
Image

the belts, mixed in the 1st phase, need to be split by lanes in the 2nd phase.

That is my brute force attempt for a 4>>4 balancer and mixer for item types separated by input belts. The picture is also showing different rates of input (i1,i4=45, i2=15, i3=30). The parts, marked in green, are the lane splitters.

factorio.4-4bal+mixer.jpg
factorio.4-4bal+mixer.jpg (334.91 KiB) Viewed 5781 times

Re: Belt math, using lower tier belts to effect.

Posted: Mon Sep 02, 2019 1:13 pm
by Trebor
Here's my second attempt.
Screen Shot 2019-09-02 at 9.09.08 AM.png
Screen Shot 2019-09-02 at 9.09.08 AM.png (6.35 MiB) Viewed 5762 times
Note each belt has the same ratio of items just in different lanes. I've also tested this by blocking different output belts and it only glitches during the transition.

Re: Belt math, using lower tier belts to effect.

Posted: Mon Sep 02, 2019 1:30 pm
by Trebor
I had to increase the length of the output lanes to check the ratios when input is starved but it looks like the ratios are the same in each lane. Note the output is always a repeating pattern of 4 copper, 4 iron, 2 coal, 2 blank (it's probably 6 blank but I can only see when several are consecutive).
Screen Shot 2019-09-02 at 9.23.42 AM.png
Screen Shot 2019-09-02 at 9.23.42 AM.png (5.64 MiB) Viewed 5758 times
Edit: Added BP.

Re: Belt math, using lower tier belts to effect.

Posted: Thu Sep 05, 2019 3:49 pm
by Trebor
Turns out you are right. Ratios change when both inputs are starved and outputs are backed up. I think I know the reason. When inputs are starved empty spaces are are introduced if the balancer is throughput unlimited the empty spaces are passed to the outputs, this retains ratios by replacing an item with an empty space. When just the outputs are backed up the balancer becomes throughput limited. So when inputs are starved and outputs are blocked the empty spaces introduced are removed which changes the ratios of items within the balancer.
Screen Shot 2019-09-05 at 11.19.51 AM.png
Screen Shot 2019-09-05 at 11.19.51 AM.png (7.83 MiB) Viewed 5703 times
Display rows top/down are belts top/down. Columns left to right: Coal, Copper, Iron, Stone. Second belt is stopped in this pic.

Re: Belt math, using lower tier belts to effect.

Posted: Thu Sep 05, 2019 4:35 pm
by disentius
yep. Any uneven input or output screws it up.

Re: Belt math, using lower tier belts to effect.

Posted: Thu Sep 05, 2019 10:11 pm
by Trebor
disentius wrote:
Thu Sep 05, 2019 4:35 pm
yep. Any uneven input or output screws it up.
Not with my balancer above, uneven input OR uneven output have stable ratios. It’s only uneven inputs AND outputs that the ratios are different.

Re: Belt math, using lower tier belts to effect.

Posted: Fri Sep 06, 2019 9:44 am
by disentius
I stand corrected:)