Command line belt balancer analyzer

Enhance Your Overall Game-Play.
Mod-Database, Calculators, Cheatsheets, Multiplayer, Scripts, Libs and Other Useful Stuff.

Command line belt balancer analyzer

Postby d4rkpl4y3r » Tue Oct 11, 2016 7:12 pm

When designing belt balancers it usually takes a large amount of time to properly test it. Therefore I decided to write a tool to help me with that. No more need to painfully test every input ingame. Now I also decided to release it to the public.

You can get it from github.

Because of technical reasons the balancer that is tested needs to have each input and output as a belt piece. For example this 12 to 12 balancer:

Image

Also side loading is a no go.

There are some commandline options that I will explain:

-f=FILE Loads the blueprint string file FILE, if not found tries again with %APPDATA%\factorio\script-output\blueprint-string\FILE
-t2 Tests all throughput combinations where exactly two inputs and outputs are used.
-tallcpu Tests all throughput combinations where more or equal to two inputs and outputs are used. (The 12 belt balancer needed 10 minutes on my pc with this option)
-i=N Specifies the number of iterations the simulation should run. Default is 2 * (2 * nSplitter + nInputs + nOutputs + 1)
-time Times the complete testing time needed.
-s Does suppress the ongoing progress display. Useful if you pipe the output to a file.
-benchmark times only the simulation time needed to run the specified amount of iterations.

-f=FILE is mandatory. Then there is also -gpu using CUDA, but the overhead is usually larger than the performance gain. There was one case with the big 512 belt balancer where this option did actually win against the cpu, but for all sane balancers (<= 32 belts), cpu wins. -tallgpu does also exist, but it crashes my display driver more often than not.

I usually have a cmd window open with the line:
BeltBalancer.exe -f=test.txt -t2
Then I can just save my balancer I am working on as test, swap to the console hit the up arrow and enter.

Happy balancer building!
d4rkpl4y3r
Long Handed Inserter
Long Handed Inserter
 
Posts: 64
Joined: Wed Apr 27, 2016 8:24 pm

Re: Command line belt balancer analyzer

Postby Koub » Tue Oct 11, 2016 9:51 pm

Meh bored testing balancers. Let's automate.
Factorio/10 :)
Koub - Please consider English is not my native language.
Koub
Global Moderator
Global Moderator
 
Posts: 2944
Joined: Fri May 30, 2014 8:54 am
Location: France

Re: Command line belt balancer analyzer

Postby hansinator » Fri Oct 14, 2016 7:28 pm

Oh great I was thinking about doing the same! Thank you!

Edit:
Your 12 by 12 balancer seems interesting. Do the loopbacks prevent throughput loss when output lanes are blocked?
Can you share the blueprint?
User avatar
hansinator
Fast Inserter
Fast Inserter
 
Posts: 159
Joined: Sat Sep 10, 2016 10:42 pm
Location: Germany

Re: Command line belt balancer analyzer

Postby d4rkpl4y3r » Fri Oct 14, 2016 10:12 pm

hansinator wrote:Do the loopbacks prevent throughput loss when output lanes are blocked?


No, it is based on 4 3 belt balancer that go into 3 4 belt balancer. Those loopbacks are part of the 3 belt balancers and do not prevent troughput loss in such situations.

hansinator wrote:Can you share the blueprint?


Yes, I already did: https://www.reddit.com/r/factorio/comme ... er/d8jolix
d4rkpl4y3r
Long Handed Inserter
Long Handed Inserter
 
Posts: 64
Joined: Wed Apr 27, 2016 8:24 pm

Re: Command line belt balancer analyzer

Postby ssilk » Mon Nov 21, 2016 7:27 am

Cool stuff, cool stuff.. :)

But I ask myself, why didn't someone not write just a mod to CREATE belt balancers automatically?
Define input belts and output belts, click on "Generate" and finished.
8-)

And another cool stuff is here:
https://wiki.factorio.com/Splitters/Weighted_splitters
where the first link points to
https://www.reddit.com/r/factorio/comme ... balancers/
and there you need to click on the pics like I did:
Image
Image
Image
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
ssilk
Global Moderator
Global Moderator
 
Posts: 10382
Joined: Tue Apr 16, 2013 10:35 pm
Location: Würzburg, Germany

Re: Command line belt balancer analyzer

Postby d4rkpl4y3r » Thu May 04, 2017 7:57 pm

I released version 1.4 which features support for vanilla blueprint strings. By default it additionally reads from clipboard if you don't specify a file.
d4rkpl4y3r
Long Handed Inserter
Long Handed Inserter
 
Posts: 64
Joined: Wed Apr 27, 2016 8:24 pm

Re: Command line belt balancer analyzer

Postby Mobius1 » Mon May 22, 2017 10:38 pm

ssilk wrote:But I ask myself, why didn't someone not write just a mod to CREATE belt balancers automatically?
Define input belts and output belts, click on "Generate" and finished.
8-)

Nexela did it already, Picker Mod Extended.
Mobius1
Fast Inserter
Fast Inserter
 
Posts: 154
Joined: Thu Feb 09, 2017 12:05 am

Re: Command line belt balancer analyzer

Postby pieppiep » Sat Jul 01, 2017 7:25 pm

Very nice tool, but there's something I don't understand while testing the 4x4 balancer.
Famous 4x4 balancer without closing splitters
0eNqdluuOwiAQhd9lfuMGhl60r2I2Gy/EkFTaAN1oTN99qTVZo2O184vQlo+TM3MoF9jWnWm9dRGqC9hd4wJU6wsEe3CbengWz62BCmw0RxDgNsdhZk6tNyEsot+40DY+LramjtALsG5vTlCpXnwMCW1tYzT+bjn23wKMizZaMwq6Ts4/rjtu05eVeidFQNuEtLxxw/4JuUAB5zRk/SDtAYdsnKZwejZOTojL5otTE7j8Cdcl0/3BN2l8A9SpRLdaNl1su6HkTxsUjA3kDH45248pO5ZcGln5FbuRkMIpya49Jiv31pvd+K6g6Op1Fp+58isfyYpUityefxCKFFxzi0S7mnGrJD/QmnPhtK8FtwMkiSv56Vf/4bTuRTbVktkGtNoV+yj5RCxKZlvJ99lCxWSTXYDsHxQZANRzgq9uwScPPMw4ZwitKp+BkpOiCqb5tK6Saz5911hyE03jVszEkTTNjUSipSvb9YJX3V0qBfwaH8aUZBkWqLQuy77/AwZwjSo=

Code: Select all
C:\Users\Jeroen\Downloads\BeltBalancer_v1.6>BeltBalancer -t2
Loading a 4 to 4 balancer with dimensions 4x7 and 4 splitters
Output balance: 4/4
Input balance: 4/4
Throughput under full load: 100%
Min Throughput with two belts: 50%

C:\Users\Jeroen\Downloads\BeltBalancer_v1.6>BeltBalancer -tall
Loading a 4 to 4 balancer with dimensions 4x7 and 4 splitters
Output balance: 4/4
Input balance: 4/4
Throughput under full load: 100%
Min Throughput with all combinations: 50%

C:\Users\Jeroen\Downloads\BeltBalancer_v1.6>


Famous 4x4 balancer with closing splitters
0eNqdluuOgjAQhd9lftdNO+WivIrZbLw0pgkW0paNxvDuW2Sza3REmV8EkY8zc+a0vcC27kzrrYtQXcDuGhegWl8g2IPb1MNv8dwaqMBGcwQBbnMc7syp9SaERfQbF9rGx8XW1BF6AdbtzQkq1Yu3IaGtbYzG37yO/acA46KN1oyCrjfnL9cdt+mflXolRUDbhPR644bvJ+QCBZzTJe8HaXc4nI9TEzg9GycnaNls2pS2/Hn/iSI/8hGVUaiCbYKmcOUDrkvT4A++SdcXNug0O79D1nSx7YZZfPjAckbpcrLyFUOqnKFUSa7nZGcVPy5I8vh5wVT+3nqzG58VFF3PGdE/oxSpNONG8U4oUvCc6xLdVXae5BtaS65lktS65GqlbVrxs6/+A2XdkzyhZI4BWTwqpu/y9fAjspeWtxqhmdJJ2zDjTgEZAMw5wadRBWebIxdPLJkto4VxNiFa14rbfHJL05K7QNA4xUwcTUOmB4mWTpLXc2d1c9YV8G18GEOYZVig0ros+/4HwH2/NQ==

Code: Select all
C:\Users\Jeroen\Downloads\BeltBalancer_v1.6>BeltBalancer -t2
Loading a 4 to 4 balancer with dimensions 4x8 and 6 splitters
Output balance: 4/4
Input balance: 4/4
Throughput under full load: 100%
Min Throughput with two belts: 100%

C:\Users\Jeroen\Downloads\BeltBalancer_v1.6>BeltBalancer -tall
Loading a 4 to 4 balancer with dimensions 4x8 and 6 splitters
Output balance: 4/4
Input balance: 4/4
Throughput under full load: 100%
Min Throughput with all combinations: 100%

C:\Users\Jeroen\Downloads\BeltBalancer_v1.6>

So, with the splitters after it, it should work whatever lines I cut, right?
When I cut input line 4 and output line 2, line 1 is still full, but lines 3 and 4 aren't completely compressed.
pieppiep
Fast Inserter
Fast Inserter
 
Posts: 159
Joined: Mon Mar 14, 2016 8:52 am

Re: Command line belt balancer analyzer

Postby mustapelto » Sat Jul 01, 2017 11:02 pm

So, with the splitters after it, it should work whatever lines I cut, right?
When I cut input line 4 and output line 2, line 1 is still full, but lines 3 and 4 aren't completely compressed.


This seems to be a problem with the game, not the balancer design. I tested by building lots of these next to each other, and got some moving at full throughput, while some had the exact same problem you described. Probably something to do with how splitters work, as I managed to "switch states" (i.e. from near-full to full throughput or vice versa) a couple of times by removing and adding a splitter or piece of belt (temporarily blocking and reopening output 1 seemed to be most reliable).

See also this screenshot (green arrows indicate balancers working as intended): Image
mustapelto
Manual Inserter
Manual Inserter
 
Posts: 2
Joined: Sat Jul 01, 2017 10:54 pm

Re: Command line belt balancer analyzer

Postby d4rkpl4y3r » Sun Jul 02, 2017 12:10 am

pieppiep wrote:When I cut input line 4 and output line 2, line 1 is still full, but lines 3 and 4 aren't completely compressed.


That is thanks to the sorting ability of splitters. The only way to make a truly throughput unlimited balancer is to get a normal throughput unlimited balancer of twice the size, split each input belt side to its own belt and run that through the larger balancer. An example for a true 4 belt throughput unlimited balancer:

Image

That gives you lane balance as well but is highly impractical. My tool does not simulate actual items on belt but instead a number for throughput, thus if it says 100% it can still have some weird behavior in Factorio. But if it is reporting less than 100% you can be sure that your balancer is not throughput unlimited.
d4rkpl4y3r
Long Handed Inserter
Long Handed Inserter
 
Posts: 64
Joined: Wed Apr 27, 2016 8:24 pm

Re: Command line belt balancer analyzer

Postby pieppiep » Sun Jul 02, 2017 8:06 am

StrangeSplitter.png
StrangeSplitter.png (543.24 KiB) Viewed 9182 times

This is strange!
I have to think about this to really understand what's happening here.
It's something about the sorting you say. Interesting.
pieppiep
Fast Inserter
Fast Inserter
 
Posts: 159
Joined: Mon Mar 14, 2016 8:52 am

Re: Command line belt balancer analyzer

Postby TheRaph » Wed Dec 06, 2017 12:16 pm

May it be possible to output the 4 IO-Combinations with lowest throughput? So one can improve his balancers ... please.
TheRaph
Inserter
Inserter
 
Posts: 34
Joined: Sun Sep 24, 2017 6:31 pm
Location: Pinneberg, Northwestern Germany

Re: Command line belt balancer analyzer

Postby golfmiketango » Thu Dec 07, 2017 5:50 am

pieppiep wrote:Image
This is strange!
I have to think about this to really understand what's happening here.
It's something about the sorting you say. Interesting.

Bugs aside, splitters can be thought of as obeying the following restrictions, in order of descending precedence:

  1. Items are never destroyed or created and items do not move to the other lane of the belt when passing from input to output
  2. Items do not ever stop moving at the input terminal of a splitter if there is room on either or both output belts to output them.
  3. Items of a given type will be distributed evenly between the output belts (not the lanes).
  4. When only a single belt can accommodate a given output but inputs are available from both input belts, the left side is chosen.
  5. Splitters do what they want

Think of these like Asimovian robot rules. So if the splitter can't do #2 without violating #1 then it is required to break rule #2 and respect rule #1. In theory it will try to obey all the rules simultaneously but conflicts are common between them, in which case the lower numbered rules are always (in theory) respected even if this means breaking the higher numbered rules, and no exceptions are permitted, i.e., a splitter will break rules #2,#3,#4, and #5 to comply with #1 even if it could comply with all the other rules by breaking rule #1 "just a little bit".
golfmiketango
Filter Inserter
Filter Inserter
 
Posts: 308
Joined: Fri Jan 29, 2016 2:48 am


Return to Tools

Who is online

Users browsing this forum: No registered users and 1 guest