Page 1 of 1

Way to stop trains from stopping when stations goes disabled

Posted: Sat May 21, 2022 10:43 am
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?

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

Posted: Sat May 21, 2022 10:50 am
by Nosferatu
Don't disable. Set train limit to 0 instead

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

Posted: Sat May 21, 2022 1:18 pm
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).

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

Posted: Sat May 21, 2022 3:00 pm
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.

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

Posted: Fri May 27, 2022 9:34 am
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

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

Posted: Fri May 27, 2022 12:46 pm
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

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

Posted: Fri May 27, 2022 1:28 pm
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.

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

Posted: Sat May 28, 2022 11:44 am
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.

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

Posted: Sat May 28, 2022 2:40 pm
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.

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

Posted: Sat May 28, 2022 9:56 pm
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 2939 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.

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

Posted: Thu Jun 23, 2022 4:34 pm
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!