Preventing trains skipping stops.

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
RyuujinZERO
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jul 06, 2018 11:58 pm
Contact:

Preventing trains skipping stops.

Post by RyuujinZERO »

So, in my network I am using trains that have a destination list that simply looks like this:

Code: Select all

Output: Iron Ore [Until full, OR 15 seconds has passed]
Input: Iron Ore [Until empty, OR 15 seconds has passed]
All of the destinations that accept or create a resource on the network, share the same naming scheme and are switched on and off via a circuit depending if they have a load waiting/capacity to accept a full load, and trains collect/drop off at the nearest appropriate location automatically.

The problem I am having is that if two trains try to go the same destination the second train 'skips' it's current task if the station it was going to is switched off. For example a load of iron ore is ready to collect, Train A goes in first, Train B is sat in the lay-by waiting it's turn. Train A takes the entire load, and the station is disabled. Train B instead of waiting for another load to become ready (or travelling to another available load), it instead skips loading entirely, and goes to the unloading step, wasting fuel and causing additional congestion on the line for no benefit.

How can I force Train B in this scenario to stay on it's current step (Collect Ore), instead of skipping to the next available step (Unload Ore) before it is ready?

User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: Preventing trains skipping stops.

Post by TruePikachu »

The system you describe has a major issue, in that there isn't always a stop enabled. Specifically, I believe that if all stops in a train's schedule are disabled, the train will stop where it is and wait for a stop to become enabled again, which can be problematic as it can block other trains.

In theory, a system where you have a dummy station (behind a circuit-network-closed signal) might assist both with the prior point and the question at hand. If you set up circuit network lines such that you can determine at some location (where the dummy station will be) that all other stations with the same name are closed, you can use that information to enable the dummy train stop and, also important, close a red signal just in front of it. Ideally, circuitry should be used at the actual outposts so that there is never such a point in time that no stops are enabled (close the station a few ticks after saying that you closed the station, and open it a few ticks before you say you opened it) -- signals take time to propogate through combinators (and possibly enable/disable the stop), and if all the stops of a given name are closed, the train is likely to skip it.

What should ideally happen after the original destination station closes (with the dummy station enabled but circuit-network-redlighted) is the train will find the dummy station (as the only station with the name that is open), and path over to it. However, it will never be able to arrive (because of the circuit-network-closed signal). Later, when a normal stop is ready again, it causes the dummy station to close and the signal opened, so the train is no longer waiting at a red light, but since the dummy station is no longer a valid destination, it will find the newly-opened normal stop.

The biggest issue I can find with this setup is that if a train is (for whatever reason) past the blocking signal but still before the dummy station when the station opens but the signal closes, or if the stopping point for the train is past the signal, the train might be able to arrive at the dummy station if it opens. This situation can only impact a maximum of one train per dummy station per cycle of all-other-stations-are-closed, and requires very specific circumstances in the first place, so it might not need to be accounted for unless it proves to be a consistent issue.

EDIT: In theory, sufficient minimal circuitry should be as follows:
Outpost:
  • Run red (loading)+green (unloading) circuit network wires along the entire circuit network (this might be doable with a single wire color if you don't have too many things transported on the rail network)
  • Set up a decider combinator that would enable/disable the actual stop, instead of using the built-in comparison on the stop, set to the condition for the stop being open, and outputs e.g. a piece of iron ore for an iron-ore-related stop
  • Connect the output of the decider combinator to the proper track circuit wire (red wire if you're loading iron ore, green if unloading), and connect the output to the train stop as well using the opposite color wire
  • Train stop should be set to be open if it is receiving an iron ore signal, or closed if it doesn't have such a signal
Dummy stop:
  • Ensure that you ran those circuit network wires! They indicate the number of stops of a particular kind that are open.
  • Place a station down, and a rail signal right in front of it (such that the train needs to pass the signal before it can get to the station -- ideally, the signal should be directly next to the stop)
  • Connect the proper wire to both the station and the signal (there is no combinator at this end)
  • Station should enable if e.g. it isn't receiving any iron ore signal, and the signal should be set to close with the same condition
This arrangement should cause the dummy station to open (and the signal turn red) on the same tick the last real station closes, and close the station (and clear the signal) the same tick the first real station opens. This might work, but only if train pathfinding logic doesn't get executed before both stations are updated in the game update cycle.
Last edited by TruePikachu on Sat Jul 07, 2018 1:15 am, edited 1 time in total.

User avatar
RyuujinZERO
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jul 06, 2018 11:58 pm
Contact:

Re: Preventing trains skipping stops.

Post by RyuujinZERO »

Hmm, true that is more a product of the 'orphaned' system than of it skipping destinations, and if there is no valid destination for the train BESIDES the home station it's a symptom of having too many trains/too few output stations for them to collect from, I'm seeing a problem and misunderstanding the real cause.

User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: Preventing trains skipping stops.

Post by TruePikachu »

Trains will never skip a stop unless there are no enabled stops with the same name on the map (surface?). Disabling a station only causes the train to find a new one to arrive at, unless it was the last enabled station.

User avatar
RyuujinZERO
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jul 06, 2018 11:58 pm
Contact:

Re: Preventing trains skipping stops.

Post by RyuujinZERO »

Yeah, I realize that now, misinterpreting cause and effect, thanks for the pointers, I've got things ticking over better now. (Moved over to a rooted system where trains have a 'home' station that is always enabled, and they only depart the station when resources start getting low, and acknowledge that they might return home early if there are no suitable sources for them to load from)

Post Reply

Return to “Gameplay Help”