Factorio – How to Avoid Logistic Network Loops

factorio

So I've come across multiple scenario's where it would be very handy to have cache's of certain items closer to a build site. Say I want to plonk down another thousand solar array's, to facilitate build time I'd be handy if I could have a set of Passive Provider Chests stocked with panels, accumulators and substations ready to go.

The problem is after all the construction is done, I need to then make sure I remember to swap out the PP chests for requester chests to refill the cache, and then once all the dust settles, swap the requester chests back to PP chests. This seems like something I should be able to automate (isn't that Factorio's motto?) with a circuit combination, but I don't understand what people are talking about when they talk about how to do it on Reddit. Even the imgur picture doesn't help because I don't understand what's going on or why that is supposed to work, but I get the feeling that the picture above is supposed to solve a slightly different problem.

Can anyone shed some light on either why the above combination works, or a better solution to my problem?

Best Answer

The setup in the OP's linked image works something like this:

The requester chest will sum all its circuit inputs and request exactly that. The left combinator sends out 1 copper plate as long as the roboport reports there is less than some amount available in the logistics system.

The right combinator will add -1 copper plate to the sum requested (totalling to 0), but only when the provider chest has anything in it.

Basically that system will request 1, immediately move it to the provider, which one tick later adds -1 to the requested amount. Once something empties the provider the requester will once again request 1.

The inserter "overfills" the requester even if it's not requesting anything, as long as the total amount of plates is below 200 in the logistics network (NOT the circuit network), to allow a larger buffer than just 1 item at a time. (Note: Depending on your bot and inserter upgrades, you may never get exactly the number of items you request, but you will never get less than that in one delivery.)

The key here is that there is currently no direct way to automate switching of chest types or stop providing something, but requester chests can be told to only request items when a circuit condition is met.

Another important thing to note is that fetching objects from Storage chests take priority over fetching from Passive Provider chests. The setup in the image does not use this, but it can be used to prioritize where robots fetch from.

This is why I sometimes prefer the slightly different approach I describe in my answer here: https://gaming.stackexchange.com/a/292661/74907.

This question seems limited to using the logistics network only, where the above mentioned question could be interpreted as allowing any approach to obtaining the goal of moving useful items closer to some specific location on the map. I guess they overlap but aren't exact duplicates.

Rather than repeating my entire answer from the other question here, I'll just say that the key is to move all items from the requesting chest into a [regular type] buffer-chest for temporary storage until the total amount of items at the location is enough to stop requesting. Once that condition is met and requesting has stopped, all items can be moved to a Storage chest. Robots will the prioritize fetching from that chest even if there are other sources nearby.

Finally you need a condition at which to begin requesting again, at which point your storage chest will likely first be drained into the requester chest (you could speed that up by also enabling an inserter between them). That will not cause a loop as once the storage chest is empty and the requester chest says it wants more items, they will be gathered from elsewhere (this is why your buffer chest must not be another requester, storage or provider).

I've got storage chests scattered all over the place so my bots can drop overflow off anywhere practical for them, and I only user passive provider chests as outputs from factories, which become "inputs" to the logistics network(s). As long as bots can get what they need from storage I won't waste energy producing more of those items. If the factory is large and the bots get tempted to ignore my storage and get things from passive providers anyway, I've set the inserters emptying my factories to not empty while the logistics network still has more than X amount in it. The the bots will be forced to drain the storage chests and reduce the amount of over-production.

Just make sure the bots can actually get what they need within each logistics network...

Related Topic