Way to stop trains from stopping when stations goes disabled

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
-Holo-
Burner Inserter
Burner Inserter
Posts: 15
Joined: Thu Feb 04, 2021 7:26 pm
Contact:

Way to stop trains from stopping when stations goes disabled

Post by -Holo- »

So. I have a factory using forward artillery bases to keep the biters away, those bases are wired up with logic to enable/disable the station depening on if it lacks ammo/resources. Using a trainlimit at 5 to keep the trains coming when needing ammo etc, but as soon as the station gets disabled the trains that was on their way stops dead on the tracks blocking traffic. Is there some way to get them to return home (next station) when a tragetstation gets disabled?
User avatar
Nosferatu
Filter Inserter
Filter Inserter
Posts: 252
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by Nosferatu »

Don't disable. Set train limit to 0 instead
robot256
Filter Inserter
Filter Inserter
Posts: 938
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by robot256 »

What does the train and its schedule say when it stops? The schedule will skip to the depot if all the resupply stops are disabled. If the train says "No path", then you need to build a turnaround loop at the resupply station so that it can get back to the depot.

If the train says "Destination full", then it's because another resupply station is enabled but already has enough trains. There's nothing you can do to make the stopped train skip back to the depot schedule entry. You have to let it get to the destination (by setting limit=0 and not disabling any of them).
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by SoShootMe »

robot256 wrote: Sat May 21, 2022 1:18 pm The schedule will skip to the depot if all the resupply stops are disabled. If the train says "No path", then you need to build a turnaround loop at the resupply station so that it can get back to the depot.
In addition, if the stop the train was heading to is disabled, but there is still at least one enabled stop of the same name, it will try to go to a different stop (rather than the depot), possibly with the same result ("No path"). Practically speaking, to be certain you will never have a problem when disabling non-unique stops you should ensure your rail network has a path from every point to every other point.

Nosferatu's suggestion of setting the train limit to zero instead of disabling the stop gives a less strict requirement because trains will always continue to a enabled stop with a train limit, even if the limit is subsequently reduced.
-Holo-
Burner Inserter
Burner Inserter
Posts: 15
Joined: Thu Feb 04, 2021 7:26 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by -Holo- »

Ah sorry, been off from Factiorio for a while.
The train stops dead in the tracks with a no path error (got plenty and plenty of roundabouts and whatnot), Hadn't thought about setting trainlimit to 0 though, gonna give that a try next time the need to harass biters occur! :D
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by SoShootMe »

-Holo- wrote: Fri May 27, 2022 9:34 am The train stops dead in the tracks with a no path error (got plenty and plenty of roundabouts and whatnot)
Apparently not everywhere you need them :D
astroshak
Filter Inserter
Filter Inserter
Posts: 638
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by astroshak »

If you have one train servicing several resupply stations, you can safely use Enable/Disable on the resupply stations as long as the supply station you load the train at is always on. NEVER turn that supply station off.

If you are using multiple trains to service those resupply stations, then do NOT use the Enable/Disable (you get the “thundering herd” when one station turns on if you do). Use the Train Stop Limit to call for a single train instead.
Tertius
Filter Inserter
Filter Inserter
Posts: 946
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by Tertius »

With a small bit of circuitry (1 combinator per station), you can proactively set the train limit of a station exactly to the amount of trains this station is able to load or unload. And never need to enable/disable with its interesting side effects.

How it works:
You know the station capacity and the train capacity. You also know how much material is currently stored in a station.

For loading stations, divide current station material by train capacity. The result can be set as train limit, because this is the amount of trains that can be filled with the current amount of stored material.

For unloading stations, get the free space by subtracting currently stored material from station capacity. Divide the free space by train capacity. The result can be set as train limit, because this is the amount of full trains that can be emptied into the station without the need to wait.

There are blueprint examples for this deep in the forum, but I guess the fun is to create this by oneself.
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by SoShootMe »

Tertius wrote: Sat May 28, 2022 11:44 am With a small bit of circuitry (1 combinator per station)
[...]
For unloading stations, get the free space by subtracting currently stored material from station capacity. Divide the free space by train capacity. The result can be set as train limit, because this is the amount of full trains that can be emptied into the station without the need to wait.
That's two combinators ;). But it is a very simple and effective system for trains carrying a single item. The only caveat is that you must ensure buffers for each wagon are emptied evenly.

I note you don't need to use the full station capacity in the subtraction; it is just an upper limit. A lower value can be useful if the item is in short supply and/or the buffer is emptied at a low rate.
Tertius
Filter Inserter
Filter Inserter
Posts: 946
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by Tertius »

You actually need one Arithmethic combinator and one Constant combinator for the unloading station. In the constant combinator, you save the negative value of station capacity and feed this and the wire from the chests to the input of the Arithmetic combinator, so you get the negative of the free space. You divide this by the negative value of the train capacity (value given directly in the Arithmetic combinator), so minus times minus makes plus, and this is the positive value you need.

It looks like this:
Screenshot 2022-05-28 234853.png
Screenshot 2022-05-28 234853.png (335.84 KiB) Viewed 2953 times


It seems I didn't actually made a similar loading station, instead I hardcoded a train limit of 1 for all of my loading stations, because my train concept defines that every loading station should always have a train waiting that leaves the moment enough material for a full train accumulated.
-Holo-
Burner Inserter
Burner Inserter
Posts: 15
Joined: Thu Feb 04, 2021 7:26 pm
Contact:

Re: Way to stop trains from stopping when stations goes disabled

Post by -Holo- »

Thanks everyone for the help :)
Using train stop limits fixed the issue so currenlty migrating all the old outposts to use that logic!
Post Reply

Return to “Gameplay Help”