Belt Balancers - how they work and how to make them

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
EX_plode
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Jul 07, 2018 3:57 pm
Contact:

Belt Balancers - how they work and how to make them

Post by EX_plode »

I have created what I call "A compilation of research and occasionally a useful guide" on the designing of belt balancers, as this is a complex topic that I have recently been doing a lot of research into, and there seems to currently be a dearth of guides available. There are plenty of copy-and-paste designs on the wiki, but nobody seems to be explaining why they work, or how to make them yourself. I have attempted to do this.

The introduction of the guide follows:

This “guide” is the sum total of my belt-balancing knowledge after approximately 15 hours of research, testing and investigation. In it, I explain some of the theory behind how belt balancers work and how to design them properly. I have come up with a reliable method to design one-to-many splitters and many-to-one mergers. I have also come up with a method to design many-to-many balancers, but the designs produced are too large to be of practical use.

Bear in mind that the following information is merely the conclusions I have reached from my own investigation; I do not have answers to some of the questions raised, and there is always the possibility that I am wrong about something.

However, I hope that at the very least I will shed some light on the mysterious belt spaghetti, and perhaps give you a 15-hour head-start on your own learning.


Download here:
Factorio Belt Balancers v1.0.pdf
Belt Balancers - A compilation of research and occasionally a useful guide
(8.44 MiB) Downloaded 18169 times

jcranmer
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Wed Jun 29, 2016 9:59 pm
Contact:

Re: Belt Balancers - how they work and how to make them

Post by jcranmer »

You say that it's impossible to build a perfect 3-1 balancer that will still balance its inputs evenly, even if some of them are missing. It's not, at least not if you allow a little bit of circuit network. Here's how:

Build a standard 4-to-1 pyramid. Hook the unused output back into the unused input. Attach one belt of all three inputs to the same circuit, holding the number of items on each input belt. Enable the feedback loop only when that number is more than 18 (i.e., only enable the feedback loop when all three lanes have items on them).

Doing a test where each input lane uses a different item, and summing up the results via flowmeter, confirms that, after a short settling period, the consumption rate on a blue belt over three seconds is exactly 40 items each if all three are enabled, or 60 items each for the two active inputs if only two are enabled, for each combination of two lanes.

I guess it might not work correctly if one of the lanes is <⅓ belt and the other two are >⅓ belt. But with that kind of disparity of input, the idea of perfect balancing is already sort of ill-defined. When you're reducing the number of belts, you usually just care about the balancer itself not being the throughput bottleneck; guaranteeing exactly even pull of all inputs is pretty much limited in use-case to even drawing between railway carriages, where all the inputs should be always saturated anyways.

EX_plode
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Jul 07, 2018 3:57 pm
Contact:

Re: Belt Balancers - how they work and how to make them

Post by EX_plode »

jcranmer wrote:You say that it's impossible to build a perfect 3-1 balancer that will still balance its inputs evenly, even if some of them are missing. It's not, at least not if you allow a little bit of circuit network. Here's how:

Build a standard 4-to-1 pyramid. Hook the unused output back into the unused input. Attach one belt of all three inputs to the same circuit, holding the number of items on each input belt. Enable the feedback loop only when that number is more than 18 (i.e., only enable the feedback loop when all three lanes have items on them).
You are quite right, I have tested it and it does work.
Working at full capacity:
3-to-1 full
3-to-1 full
full.jpg (140.33 KiB) Viewed 76422 times
Working with one belt empty:
3-to-1 one empty belt
3-to-1 one empty belt
2to1.jpg (138.76 KiB) Viewed 76422 times
Working with two half belts and one empty belt:
3-to-1 2 half belts to one whole
3-to-1 2 half belts to one whole
2halfto1whole.jpg (138.45 KiB) Viewed 76422 times

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Belt Balancers - how they work and how to make them

Post by Zavian »

I think it would work without the circuits.

EX_plode
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Jul 07, 2018 3:57 pm
Contact:

Re: Belt Balancers - how they work and how to make them

Post by EX_plode »

Zavian wrote:I think it would work without the circuits.
Nope. If the loop is active when there are only two full inputs, the balancer pulls twice as much from one input as the other. I have tested it.

alercah
Fast Inserter
Fast Inserter
Posts: 151
Joined: Sun Apr 07, 2019 5:19 am
Contact:

Re: Belt Balancers - how they work and how to make them

Post by alercah »

This is an excellent, helpful post. I am curious about the mathematical theory of balancing and looked into things a bit, it seems that this 3-1 balancer now behaves correctly, and other bugs such as straightforward 4x4 balancers not working correctly seem fixed as well. I imagine this is all due to https://www.factorio.com/blog/post/fff-287? Would love to hear if others disagree.

Mr. Tact
Filter Inserter
Filter Inserter
Posts: 460
Joined: Sat Mar 26, 2016 3:37 pm
Contact:

Re: Belt Balancers - how they work and how to make them

Post by Mr. Tact »

jcranmer wrote:
Sun Jul 08, 2018 5:38 am
You say that it's impossible to build a perfect 3-1 balancer that will still balance its inputs evenly, even if some of them are missing. It's not, at least not if you allow a little bit of circuit network. Here's how:

Build a standard 4-to-1 pyramid. Hook the unused output back into the unused input. Attach one belt of all three inputs to the same circuit, holding the number of items on each input belt. Enable the feedback loop only when that number is more than 18 (i.e., only enable the feedback loop when all three lanes have items on them).

Doing a test where each input lane uses a different item, and summing up the results via flowmeter, confirms that, after a short settling period, the consumption rate on a blue belt over three seconds is exactly 40 items each if all three are enabled, or 60 items each for the two active inputs if only two are enabled, for each combination of two lanes.

I guess it might not work correctly if one of the lanes is <⅓ belt and the other two are >⅓ belt. But with that kind of disparity of input, the idea of perfect balancing is already sort of ill-defined. When you're reducing the number of belts, you usually just care about the balancer itself not being the throughput bottleneck; guaranteeing exactly even pull of all inputs is pretty much limited in use-case to even drawing between railway carriages, where all the inputs should be always saturated anyways.
Okay, since no one else has asked I will -- how exactly did you figure that out? :o
Professional Curmudgeon since 1988.

jcranmer
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Wed Jun 29, 2016 9:59 pm
Contact:

Re: Belt Balancers - how they work and how to make them

Post by jcranmer »

The trite answer: math.

The longer answer: in many cases, you can model a splitter as something that distributes all of its inputs equally over its outputs. This allows you to convert any splitter network into a directed graph, with the vertices being splitters and the edges being belts connecting them. You can build a set of linear equations, where each splitter is an equation and the variables are the total throughput on the graph. Manipulating these equations allows you to solve for the outputs in terms of the inputs, even if the graph is cyclic. Usually, I do this under the assumption that there are at least as many outputs as inputs (which adds a sanity condition that no belt should ever have more than 100% items going through it), but I figured that the mirror case can work if the mirror case is applied: the problem of one belt evenly distributing to three output belts being isomorphic to the the problem of one output belt evenly pulling from three input belts. I did test it, of course.

Building a "perfect" M-N balancer, when M≤N, works like this: when N is a power of 2, an N-N balancer is built as a recursive butterfly network (build 2 N/2-N/2 balancers, and then hook one output from each sub-balancer into two outputs). When N is not a power of 2, you build the next largest power-of-2 balancer, and then hook the unused outputs up to unused inputs to go around again. An M-N balancer (when M<N) is built by building an N-N balancer and simply ignoring excess inputs. I don't actually have a formal proof for the non-power-of-2 case, but the sketch of correctness is that you're not gumming things up as you would by leaving splitters with no outputs; in the steady state, the total output must equal the total input (since you're not accumulating things somewhere); and the correctness of the underlying butterfly network means that all of the outputs must have identical output.

I will point out one complication with this model, which is why I put "perfect" in scare quotes. Essentially, it assumes that the output is always going to be ready to drain a splitter rather than filling up and clogging the network. The resulting networks can't balance things perfectly if some inputs aren't producing and some outputs aren't consuming. The most obvious failure is in the 4-4 balancer: this model says you need 4 splitters to do the trick, while the usual blueprint people use has 6 splitters. That's because the 4-splitter model can only route one full lane of the bottom half of input to the top half of output, so if the top inputs aren't producing and the bottom outputs aren't consuming, the balancer can only deliver 1 belt worth of goods instead of the 2 that the inputs and outputs are capable of producing/consuming. The 2 extra splitters add another belt's worth of cross-half capacity to allow any combination of inputs to deliver to an equal number of outputs at full throughput. This model of balancer I've seen called "count-perfect" or "full-throughput". There is a mathematical model that satisfies this case (switching networks), but I'm nowhere near as well-versed there as I am in linear algebra and graph theory, so I've eschewed it.

Itemfinder
Inserter
Inserter
Posts: 29
Joined: Thu Feb 21, 2019 4:46 pm
Contact:

Re: Belt Balancers - how they work and how to make them

Post by Itemfinder »

jcranmer wrote:
Wed May 08, 2019 1:47 am
I will point out one complication with this model, which is why I put "perfect" in scare quotes. Essentially, it assumes that the output is always going to be ready to drain a splitter rather than filling up and clogging the network. The resulting networks can't balance things perfectly if some inputs aren't producing and some outputs aren't consuming. The most obvious failure is in the 4-4 balancer: this model says you need 4 splitters to do the trick, while the usual blueprint people use has 6 splitters. That's because the 4-splitter model can only route one full lane of the bottom half of input to the top half of output, so if the top inputs aren't producing and the bottom outputs aren't consuming, the balancer can only deliver 1 belt worth of goods instead of the 2 that the inputs and outputs are capable of producing/consuming. The 2 extra splitters add another belt's worth of cross-half capacity to allow any combination of inputs to deliver to an equal number of outputs at full throughput. This model of balancer I've seen called "count-perfect" or "full-throughput". There is a mathematical model that satisfies this case (switching networks), but I'm nowhere near as well-versed there as I am in linear algebra and graph theory, so I've eschewed it.
Check this out..
https://www.reddit.com/r/factorio/comme ... dium=web2x

Post Reply

Return to “Gameplay Help”