Simple Balanced Train Loader

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
Post Reply
User avatar
mward
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Dec 24, 2014 9:38 am
Contact:

Simple Balanced Train Loader

Post by mward »

This uses a circuit idea I saw somewhere on the forum, which I have reproduced from memory (Edit: it was MadZuris) The priority splitters make the design even simpler: these ensure that all the goods are shifted to the centre, so that each wagon gets a reasonable supply of goods to load. Then the circuit network ensures that all the chests have roughly the same amount of items in them at all times: even if the train is not unloaded in a balanced way.
balanced_train_loader.png
balanced_train_loader.png (1.62 MiB) Viewed 44953 times
How it works:

Think of a red or green "wire" as actually a big bundle of strands, one for each item plus a few extras. The "voltage" on each strand is the sum of all items that the wire can "see" in objects or combinators that are connected to the same wire.

All 48 chests are connected together with red wire: so the "green circuit" voltage is the total of all the green circuits in all the chests. This wire is also connected to the input of the arithmetic combinator which is set to divide the "green circuit" value by minus 48 and output the result as a "green circuit" value:
combinator.png
combinator.png (28.91 KiB) Viewed 44953 times
The output is therefore the average amount in each chest, as a negative number. (If you have a different number of chests, then divide by the number of chests you are using). The combinator output is connected to all the inserters which feed into the chests with another red wire. This red wire must not connect to the red wire connecting the chests!

Finally, each inserter is connected to its own chest via a separate green wire. (There should not be any green wire connecting the chests, only red wire).

The red wire supplies each inserter with the average chest contents as a negative number, the green wire supplies the inserter with its chest contents as a positive number. So the total at the inserter will be positive when the chest has more than the average number of items, and negative when the chest has less than the average number of items.

So the condition on each inserter is "green circuits less then or equal to zero":
inserter.png
inserter.png (238.06 KiB) Viewed 44953 times
Each inserter then fills its chest whenever the chest has less than or equal to the average number of items of all the chests. So regardless of the initial state, or how the chests are emptied, all the chests end up with an average number of items: this average will steadily increase.

Usually, about half the chests will be less than or equal to the average, so about half the inserters are operating as the chests fill up.

For the supply belts, you just need one belt for each belt full of items you are producing, and at least as many chains of priority splitters as you have belts: extra splitters will help to re-balance the chests if the train comes in with unbalanced cargo wagons.

Here is the blueprint:
blueprint
Attachments
balanced_train_loader.txt
(4.69 KiB) Downloaded 469 times
Last edited by mward on Sat Mar 09, 2019 4:09 pm, edited 2 times in total.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Simple Balanced Train Loader

Post by Optera »

What you got there is MadZuris train loader. It's been around since Factorio 0.12.
https://www.reddit.com/r/factorio/comme ... w_does_it/

All these splitters are pretty pointless for it's functionality, at least in this configuration. To maximize inserter pickup items should be provided to an end belt in only a single line.

User avatar
mward
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Dec 24, 2014 9:38 am
Contact:

Re: Simple Balanced Train Loader

Post by mward »

The splitters are there to ensure that if the train keeps coming in with one wagon empty and the others full, that wagon's chests will get all the supply, so the empty wagon will get filled as much as possible: and you don't need a 3 to 24 throughput-maximised belt balancer to do it!

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Simple Balanced Train Loader

Post by Optera »

With the normal Zuri Loader design stack inserters are inactive most of the time.

The top design is only marginally slower than the bottom one. In neither configuration can 6 stack inserters drain a blue belt.
2019-03-09-17-22-01-4456471.png
2019-03-09-17-22-01-4456471.png (1.44 MiB) Viewed 44939 times
If you want to go faster you have to set the inserter trigger to allow more imbalance.
anything < -12 for example would allow them to work even if their chest is one inserter load above average.

User avatar
mward
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Dec 24, 2014 9:38 am
Contact:

Re: Simple Balanced Train Loader

Post by mward »

I should probably have mentioned that the original design had red belts: and 6 stack inserters can drain a red belt.

The new upgrade planner is great :D

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Simple Balanced Train Loader

Post by quyxkh »

Four stack inserters can drain a blue belt.

Attachments
snap@T1724323=1856x2048+100618.5+100170.75,z2.jpg
snap@T1724323=1856x2048+100618.5+100170.75,z2.jpg (255.21 KiB) Viewed 44899 times

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Simple Balanced Train Loader

Post by Optera »

quyxkh wrote:
Sat Mar 09, 2019 10:07 pm
Four stack inserters can drain a blue belt.
Yes they can. Unless they are controlled by average item count like zuri did in his self balancing loader.
Optera wrote:
Sat Mar 09, 2019 4:27 pm
If you want to go faster you have to set the inserter trigger to allow more imbalance.
anything < -12 for example would allow them to work even if their chest is one inserter load above average.

User avatar
mward
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Dec 24, 2014 9:38 am
Contact:

Re: Simple Balanced Train Loader

Post by mward »

What I like about the priority splitter design is that it works with any number of belts, any number of wagons, any type of belt and any type of inserter, while also being simple and compact.

Also, adding an extra belt of material, or an extra wagon to the train is simple.
Last edited by mward on Sun Mar 10, 2019 4:12 pm, edited 1 time in total.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Simple Balanced Train Loader

Post by quyxkh »

Optera wrote:
Sun Mar 10, 2019 8:21 am
quyxkh wrote:
Sat Mar 09, 2019 10:07 pm
Four stack inserters can drain a blue belt.
Yes they can. Unless they are controlled by average item count like zuri did in his self balancing loader.
With volume like this just call the trains to arrive a few seconds early so draining the buffers clears any imbalance, even if you manage to fall behind on your pickups and let the n/12-remainder imbalance accumulate for hours a thousand item imbalance clears in seconds. If your wagons aren't arriving empty you need balancing across all the belts, which is literally out of the question here -- nobody in this thread's showing a six-belt balancer across the supply lines, and that kind of pickup imbalance would turn madzuri into an expensive and pointless extra set of chest bars. Its value is in avoiding imbalance-correction delays, those can get annoying in places like early-ish ore outposts.
Attachments
snap@T4118511=1104x1376-184.75-385,z2.jpg
snap@T4118511=1104x1376-184.75-385,z2.jpg (155.32 KiB) Viewed 44840 times

User avatar
mward
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Dec 24, 2014 9:38 am
Contact:

Re: Simple Balanced Train Loader

Post by mward »

How would you add an extra belt of material and/or an extra wagon to this design?

It is trivial to do so with the priority splitter design.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Simple Balanced Train Loader

Post by quyxkh »

mward wrote:
Mon Mar 18, 2019 2:15 pm
How would you add an extra belt of material and/or an extra wagon to this design?.
I wouldn't, this hits a real sweet spot for my mining outposts in default-settings launch bases, I included it just to show where I think madzuri really shines.

Post Reply

Return to “Railway Setups”