Compact centralized automatic train refueling designs\options (and also a question about train station priority)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Remilian
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Feb 02, 2024 4:56 am
Contact:

Compact centralized automatic train refueling designs\options (and also a question about train station priority)

Post by Remilian »

Preamble 1: Yes I know 2.0 will add an ability to fix this in vanilla, but it is probably at least a year away still, and the problem existed for years so surely someone already came up with a solution, or there is something obvious I haven't figured out yet.
Preamble 2: Yes, the most obvious solution is to add fuel logistic chests to at least 1 stop in every route, but that feels wasteful and I want to explore if there are any other "compact" options on offer.

I've been using Automatic Train Fuel Stop mod. In simple routes that have only 2 stops and no waiting bays it works flawlessly. However, if the routes include more stops or waiting bays - I keep running into deadlocks that keep trains from leaving the Fuel Stops, and because every train needs to be refueled once in a while - that affect all routes, simple or not.

Consider the following route: [Ore](until full) -> [Bay](_) -> [Smelter](until empty)
If I have 10 smelter stations, 10 bay stations, and 20 trains running this route - eventually some of the trains that need a refuel will get a [Fuel stop] added in between [Bay] and [Smelter]. That itself is not a big issue: I'm just making sure that there are connections with the main rail network on both ends of [Bay] blocks and [Smelter] blocks, even if conceptually there is no need to have it after [Bay] or before [Smelter] (alternatively: add station-less rail bypasses to both blocks for same effect).
But now there exists a possibility that I'll get, say, 5 trains that go to refuel after [Bay], and now all 5 are waiting for a [Smelter] opening. But if the throughput is not at 100% - then the remaining 15 trains can keep all of the [Smelter] stops occupied in perpetuity*, never allowing trains on the [Fuel stop] to unlock. And if I run out of [Fuel stop]s then all other routes will eventually halt as well, waiting for a [Fuel stop] opening.

Things I've considered so far:
  • (ATFS) Add more and more [Fuel Stop] stations until their amount exceeds the sum of ALL [Bay] stations of all routes so that this deadlock becomes impossible - that doesn't sound right; too many unnecessary stations, too many chests, not compact at all.
  • (Vanilla) Add logistic refueling chests to stations such that there is no route that does not have one in their schedule - this is exactly what I did not want to do and why I installed ATFS mod to begin with.
  • (Vanilla) Add a normal station to every schedule whose only purpose is to refuel trains: see above, and is essentially equivalent to using ATFS but you waste time and fuel for that every route cycle instead of only when you actually need fuel
    • Use block-specific refueling stations before the bay - I would need to have a non-empty waiting condition on those (such as "Inactivity 2s") which adds a bottleneck to the entire route if I use 1 station, and if I use more then I might as well do it on the [Bay] stations themselves instead, but I count that as equivalent to adding refueling chests to every route.
  • (Compromise) Use ATFS for simple routes where such deadlocks are improbable, and use refillable refueling chests in bays in routes that have bays - essentially what I am forced to do now, but then why use ATFS at all?
  • (Circuits) Replace [Bay](_) stop with [Bay](wait for circuit signal), where circuit signal allows trains to leave only if all [Fuel Stop] stations are empty, which will allow refueled trains to be prioritized* for [Smelter] over those waiting in the bay - this makes sense on paper, but unfortunately the bay trains get queued into their next station immediately and are unaffected by later changes in circuits, so the refueling train would have to wait for all trains currently waiting in the bay to do a full cycle, and only then it will get its turn*. This means that A) you need more [Fuel Stop] stations, which is equivalent to a previously dismissed solution, and B) any deadlock in one route will affect other routes, so you need to either add a ridiculous amount of un-automatable circuitry to keep track which trains are currently waiting on [Fuel Stop]s and "disable" only bays that those trains belong to (keeping in mind that after refueling the train will immediately queue into the next station and "disconnect" from the refueling station so you cant even read a train ID anymore, so you have to use a memory cell and use a bunch of conditions based on the signal stops, which adds even more circuit complexity), or to use and even more complicated circuit system that keeps track of all station availability and dispatches trains one by one... yeah no. All of the previous solutions are way less complex and more compact than this would be.
  • (Circuits) Circuit-controlled train stations on [Smelter] stops:
    • Enable\Disable based on buffer storage item amount: if all stations are disabled (aka if all buffers are full) - the station gets skipped completely in routes that have more than 2 stations, so the bay trains will be running to and from mines, wasting a ton of fuel.
    • 0-1 Train limit based on buffer storage item amount: if all stations are at 0 limit - bay trains will still queue into them, and (as previously mentioned) lose all connection to the [Bay] train stop because they are now "technically" on the way to [Smelter], so you cant use any waiting conditions or circuit controls anymore, so you have no way of forcing refueling trains to be prioritized
    • Both solutions are predicated on having a buffer storage on [Smelter] stations. That does seem like a popular choice in the community, but for some reason I prefer not having chest input buffers. I guess train bay design could be considered an input buffer in its own way...
  • (Design) Separate blocks with large amount of trains into smaller blocks with fewer trains: [Bay-N] -> [Smelter-N] with only 2 trains, times 10. Does solve the issue, but requires a ton of manual labor setting up individual blocks, because now you cant just copy-paste settings and are forced to rename every station and set up every route.
  • Use a different refueling train station mod - the ones I found function in the exact same way as ATFS, or add too much complexity for a task at hand. If there are any out there that simply allow you to specify where the fuel stop is allowed to be in the schedule - that would be perfect.
    • Logistic Train Network: as far as I can tell it would simply replace my example route with [Provider] -> [Requester] -> [Depot] and I would still need to add refueling chests to all [Depot] stations. It centralizes things, but quickly becomes non-compact the bigger your network becomes, and massively changes the way you make train networks. Might as well wait for 2.0 and re-learn it once rather than twice.
    • Smarter Trains: adds a temporary fuel stop specifically to the end of schedule, so I guess it fits the bill and I can just rearrange the schedules so that a fuel stop can never be in between [Bay] and [Smelter], but the mod adds a lot of other unrelated things as well. If the refueling option is not tied to Smart Train Stops the mod adds, then I guess I can just choose not to use Smart Train Stops.
*All of that leads me to the question of priority: there is plenty of info on how trains prioritize stations, but how do queues to stations get resolved? Is it an actual FIFO queue where trains cannot be prioritized in any way above those that queued earlier, or is it pathfinder weighted where closest trains are prioritized over ones further away, or is it completely random where any train in the queue has a chance to take the next opening slot? Because depending on the answer the design of the solution to my problem might change.

With all that, is there a design idea or a simple mod that I am missing here? Or am I doomed to circle back to requester-chest-for-every-route design?

Tertius
Filter Inserter
Filter Inserter
Posts: 673
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Compact centralized automatic train refueling designs\options (and also a question about train station priority)

Post by Tertius »

Very early in my base development I decided to provide refueling via logistic chest in every unloading station, and ever since I'm wondering why people make a kind of rocket science out of it instead of choosing that most simple approach.

At least I have roboport coverage everywhere in the main base anyway, so it just works, it's part of my unloading station blueprints, and it doesn't get on my nerves with mods, schedules and train paths.

The only station type where the loading station has it instead of the unloading station is the supply train.

Bot traffic for fuel is minor, and if you use nuclear fuel it's almost nothing, even for megabase sizes.

Trific
Fast Inserter
Fast Inserter
Posts: 147
Joined: Thu Dec 31, 2020 7:57 pm
Contact:

Re: Compact centralized automatic train refueling designs\options (and also a question about train station priority)

Post by Trific »

I do the same, except not with bots, I have a fuel train that delivers fuel to every pickup location. New fuel is delivered only when the chest is empty, which makes switching fuel as better fuel becomes available trivial, I just change the stop at which the fuel train picks up fuel.

NineNine
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Mon Oct 24, 2022 11:20 pm
Contact:

Re: Compact centralized automatic train refueling designs\options (and also a question about train station priority)

Post by NineNine »

This level of complexity when it comes to train refueling isn't necessary at all. But if it makes the original poster happy, then go have fun!

My entire re-fueling scheme involves just a single blue chest at each train station. That's it.

Personally, I'm not interested in creating an unnecessarily complicated train fueling procedure, but again, it's just a game. You do you!

Post Reply

Return to “Gameplay Help”