Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 4:38 pm
by gerrg
So a while ago I had a problem with my trains where they weren't being fulling unloaded at a station because the chests for the last 2 wagons were full, while the front two wagon chests were completely empty (using provider chests and bots to pull from them). it was then suggested to me to have some cascaded chests such that it would be something like this: Train -> Inserter -> chest -> inserter -> provider Chest, and to have the second inserter setup with some circuit conditions such that they would try to pull evenly from the regular chests. That way if on the provider chests got full, the inserters wouldn't pull from any of the regular chests, because they couldn't all pull evenly from the regular chests. I'm using something similar to the link below
The change i'm making to this however is instead of making sure all all the chests are loaded into evenly, i'm wanting to make sure i'm pulling from chests evenly. This works great.... most of the time. The problem is sometimes i'll run into a problem where all the chests will have about the same amount, and then nothing gets pulled from the chests. So heres my setup
-there are 48 normal chests (12 per wagon, and 6 on each side)
-all normal chests are connected with green wires and are fed into the input of the arithmatic combinator
-all inserters (pulling from the normal chests) are connected with green wires and connected to the output of the combinator
-each inserter is connected directly to it's normal chest with a green wire
-Combinator is setup to take everything from the input and divide it by Negative number of chests (so divided by -48 in my case)
-combinator outputs everything
-inserters are setup to be enabled when everything is >=0
the problem happens when the chests get down to close to 1K of items. each chest will have around 950 items but the output of the combinator will be something like -963. so then 950 + (-963) is not greater than 0, so non of the inserters move anything.
I'm not quite sure what's going wrong... am i missing something simple? Thanks for any advice!
Re: Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 5:30 pm
by Trebor
If the total of all chests divided by the number of chests is 963 then at least one chest has more then 950. Find that chest and verify its inserter’s condition.
Also make sure only the chest contents are used.
Re: Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 5:37 pm
by Optera
You misunderstood my reply.
I said loading from logistic network to train will need a cascade using zuri's balanced loading to ensure bots are filling chests equally.
2018-11-21-18-34-14-2128399.png (1.32 MiB) Viewed 7819 times
Unloading can be balanced simply by using active provider chests. Just make sure to have enough storage chest space.
2018-11-21-18-34-25-7276886.png (874.95 KiB) Viewed 7819 times
Re: Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 7:52 pm
by gerrg
@Trebor
Yeah, when i was typing that out, i knew it didn't make sense. Next time it happens i'll do a bit more investigating before temporarily fixing it.
@optera
Ahh, I did misunderstand that. Though this was has seemed to work pretty well.... this is the second time it's gotten stuck though, but i'd like to try to figure out why it's getting stuck and if i can fix it . That way i won't have to worry about having enough storage as it'll all be contained within the station itself.
So far having just requester chests looks like it's delivering goods to each chest fairly equally, but if it looks like it's not later than I'll switch stuff out and switch it out to you suggestion. Thanks for the screenshots! those help a lot!
Re: Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 8:16 pm
by Optera
Unloading from chest into passive provider will never balance. Bots always prioritize the closest chest.
Unless bot drain exceeds chest to provider transfer, items will aggregate in the farthest chest.
there's also either a type or setup problem in the description:
gerrg wrote: ↑Wed Nov 21, 2018 4:38 pm
-Combinator is setup to take everything from the input and divide it by Negative number of chests (so divided by -48 in my case)
-combinator outputs everything
-inserters are setup to be enabled when everything is >=0
- combinator should be each / -n = each
- inserters should be item < 1 or anything < 1
Re: Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 8:45 pm
by gerrg
I've seen them taking from the closest chest as well. What's seemed to happen though is that the bots would empty out the 3 sets of chests, while the last set is completely full. Since the inserters still can't move stuff because the chest is full (and therefore none of the inserters can move) the bots will eventually have to pull from the last chests as it's their only option. Once they do that, the provider chest will start having space and then all the inserters can start moving again... untill that last chest gets full again, at which point they'll all stop. So the balance here isn't going to the provider chests, but rather a balanced pull from the chests that the trains unload into.
You're right about the Each instead of everything. I keep getting the wildcards mixed up.
For the inserters i put it to >=0 instead of <1 since i'm wanting to inserters to pull from the chest that have more than the average first, as opposed to putting into the chest that have less than the average first. I used 0 as my threshold, because i thought it would move stuff if the amount in the chest was the same value as the average (in my attempt to keep it from getting stuck). That's the same reason i used >= instead of just > was to help with it getting stuck as well.
Am i missing something fundamentally wrong with this whole attempt? this is my first big bot based outpost that I've messed with so I'm still trying to figure things all out. Should I instead just use the active providers and have them moved to buffer chests or something? I would want to tie the buffer chests to my train station to avoid completely filling up the buffer chests though. Also, i'm concerned that I may have a similar problem that i do know where the bots would empty the passive providers closest to the buffer chests, leave the ones further away still full, and therefore unable to completely empty a wagon.
Thanks for helping me understand all this!
Re: Modified MadZuri's smart unloading getting stuck and nothing unloads
Posted: Wed Nov 21, 2018 10:01 pm
by disentius
Another variant on balanced bot loading using buffer chests, thanks to Madzuri:
Balanced bot loading.PNG (1.01 MiB) Viewed 7793 times
Use buffer chests to request, and let the buffer chest average set the request anount in the requesters.
Main motivation was to get rid of the 2nd row of inserters and chests.