-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circuit based chest balancing #30
Comments
I don't exactly see the purpose of this. In your image above, you have at least 24 fast inserters for one express belt, but the correct ratio is 6 fast inserters to one express belt (as is already set up). I could add the combinators/wires with the existing setup, but then I think that misses the point since it already balances everything. How big a deal is space over throughput? |
I support this feature request. It's actually why I'm looking through the code base now. The pic above is a bad example. In the current Autotorio bp, each belt runs to 6x insterters. Current design is first come first serve chest loading. This means the first chest gets loaded disproportionately more than the last chest. This results in a chest inventory gradient with max being first chest and min being last chest. (stair step). Adding circuit logic can ensure the chests get loaded evenly. This only matters if your chests are running empty during loading and the train is waiting on the first chest to finish while the last chest is empty and idle. The circuit logic can be generic, it doesn't have to be tied to a specific item. You'll set the inserter logic to be enabled when EVERYTHING <1 and the arithmetic combinator will be EACH / -6 (for 6 chests). Example blueprint (v.16) 0eNrdWdtu4yAU/BeenV3D8TXax33sH6xWkePQBtU3YVxtVOXfF5y2SWlPysmb+5LIJozHwwCHyTPbNpMctOoMWz8zVffdyNZ/ntmoHrqqcffMYZBszZ6UNpO9E7Guat2N0y9Wd+wYMdXt5D+25seI0PP3RU9x/Bsx2RlllDwRmC8Om25qt1Jb6HNvI2WzqvdyNBZy6Efbp+/c8yzOCiJ2cF8W2r5LJ2vXOLpW7j603F2iK3uVuEc/aCk7v8WSOh7dK3lcxBuX+2o0K9WNUhvbgLJJTmyM7pvNVu6rJ9Vr95Na6XpSZmPbdm/97pUezSZYRfkk9cHsVffATk8ZTeUGk7uLdqh0ZdzD2C92DNcEUE04ogkEayIWqom4eGt3naMaJYhGSaCHBdnD3OOWotwA4ZYGcuM3zK/33AqUW45wy0K9FS/UWrknUYlKVCAS5cHTjy9Uo8zTCF+iUkSjIsziMdnhqUeNxyi3DOFWho7fdxk+LvAtJkZE4nHYCNLXqMJnx1F2JUYusEK5YXGPfXZ2s30d6Jc9GZMSK2F4cA2z1O26/EK0K/7Dahx+LnIqrcy+lUbVK0txq7qZ4gfxXqvRHyki3xnnrOB4i4RVvXfijdLBbM4aruzm2Q/SSjizYj9t134yw0QGJ2g/KxgxgTWjrryskKr6MaC0Fp/ipOE44hpOFowTX4PJw+nwazhFMM7VtyqDYa6xEefVuJU7NbUr2VhvaDslhr6R6GT4HIxTR96WvGyn9MmN76vMN1BBtUEIKBA9EYKZUA0SApoShzkEMyM6MAQzv8lH/FMbFcRjKHj8lnYm9Xc5wLc1wLY1URLzjKWLhp9AASs9ISblT4IQteDVm8BqTeCkJIHCxq814Uo8hh1GQRBPo8s3lCcafjgFLBwCoKUcC9cM/DgNMlwz7EQPCSm1os3K6AMHjB5WzkJKSRwo7PxMDfDECLDEDzJa5rB0w4GvGR7gArrw5rRj89I181ObJA49RAO6ORSUnIQyKcovyOIbLWDJM5SUxIlCtiCsL1homMS35RFijiO+9uX3DCdmZ+LhxIsX7GAoI1v7nPMfpBFrqq20pNhdX+3spZ1z48w8K3IhCl7GuT3d/gem0wCH More info on the logic here https://old.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ |
You can use an arithmetic combinator to balance across all chests, instead of a belt-based balancing solution. This allows for much more compacted setups, as less space is needed between the inserters and the miners for a potentially large belt balancer, and also passively re-balances all chests after asymmetric train loading (though I don't think this will ever be relevant). Especially with long trains, say 6 cargo waggons and more, the space needed and number of belts to build can decrease greatly with this approach. I've been using this with 10 cargo waggons (a whopping 60 chests - I know there are balancers this size around but...), and it looks really neat and requires next to zero effort.
Here's a screenshot: (ignore the two cables on the leftmost power pole)
And here's a blueprint string for the setup (for 2 cargos):
The only things that needs to be taken care of are:
The way this works is relatively simple. All chests are wired together in green, this goes to the combinator's input side. The combinator is set to "each divided by -(number of chests)", so with 12 chests in the above blueprint it needs to divide by -12. The output is then wired together across all belt-to-chest inserters. These are set to be active when "everything <= 0". Also, each inserter is wired to its corresponding chest in red (so as not to mix the signals). For backwards compatibility, you could also (theoretically) set the inserters to "everything < 1", but not "everything < 0" as that can cause deadlocks.
This makes every inserter receive the number of items it currently has on red, and the average number of items across all chests (with inverted sign) on green. Whenever the latter becomes larger than (or equal to) the former, the inserter is activated and puts another item (or three of them, if you got the research) into the chest. This makes its chest's content be higher than average, deactivating the inserter again until the others have caught up.
Note, these wire colors should be kept for compatibility with the Logistic Train Network mod, which for obscure reasons only accepts its input on the green wire (this might have been a bug and fixed, but why bother and check that, right :P )
The text was updated successfully, but these errors were encountered: