trains getting stuck

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
altaykilic
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Nov 19, 2020 12:35 pm
Contact:

trains getting stuck

Post by altaykilic »

why does this happen? they keep getting stuck like this, the upper train could take the red path but it just doesn't want to
Attachments
Screenshot_61.png
Screenshot_61.png (3.75 MiB) Viewed 3344 times
Zavian
Smart Inserter
Smart Inserter
Posts: 1648
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: trains getting stuck

Post by Zavian »

https://wiki.factorio.com/Railway/Train_path_finding

In particular the following bit.
When the path includes a train stop that is not the destination -> Add a penalty of 2000.
MassiveDynamic
Filter Inserter
Filter Inserter
Posts: 261
Joined: Sun Sep 16, 2018 10:44 pm
Contact:

Re: trains getting stuck

Post by MassiveDynamic »

It’s best to place your train stations off of the travel lanes so that all trains that are not using the station can bypass it, and also trains that use the station will not block traffic.
User avatar
valneq
Smart Inserter
Smart Inserter
Posts: 1260
Joined: Fri Jul 12, 2019 7:43 am
Contact:

Re: trains getting stuck

Post by valneq »

Why do you have the train signals set to be two-directional in this roundabout?
If you make the roundabout one-directional, you won't have this issue – irrespective if there is a train stop on the roundabout.

In any case, keep the rails coming from the south and from the east two-directional.
Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: trains getting stuck

Post by Zanthra »

Can you post the save for that? The train should not be getting stuck there. They upper train should sit there for 30 seconds max before repathing.
Zavian wrote: Thu Nov 19, 2020 12:57 pm https://wiki.factorio.com/Railway/Train_path_finding

In particular the following bit.
When the path includes a train stop that is not the destination -> Add a penalty of 2000.
Yes, but there is this penalty.
When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.
Given that there is no distance to the start of the occupied block, it's effectively infinite path cost, so it will be greater cost than pathing through the train depot. At the next 30 second repath event for waiting at chain signals, that train should be taking the top path.
Loewchen
Global Moderator
Global Moderator
Posts: 9096
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: trains getting stuck

Post by Loewchen »

Zanthra wrote: Sat Nov 21, 2020 4:55 am Yes, but there is this penalty.
When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.
Given that there is no distance to the start of the occupied block, it's effectively infinite path cost, so it will be greater cost than pathing through the train depot. At the next 30 second repath event for waiting at chain signals, that train should be taking the top path.
The divisor can never go below 1:

Code: Select all

// Neighbor segment penalties
      if (!neighborSegment->getBlock()->isFree(request.train))
        costFromStart += (2 * neighborSegment->getLength()) / (currentNode->blockDistanceFromStart + 1);
Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: trains getting stuck

Post by Zanthra »

Loewchen wrote: Sat Nov 21, 2020 5:19 am
Zanthra wrote: Sat Nov 21, 2020 4:55 am Yes, but there is this penalty.
When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.
Given that there is no distance to the start of the occupied block, it's effectively infinite path cost, so it will be greater cost than pathing through the train depot. At the next 30 second repath event for waiting at chain signals, that train should be taking the top path.
The divisor can never go below 1:

Code: Select all

// Neighbor segment penalties
      if (!neighborSegment->getBlock()->isFree(request.train))
        costFromStart += (2 * neighborSegment->getLength()) / (currentNode->blockDistanceFromStart + 1);
Ah so it is distance +1 which is very different in a situation like this.

PS: It should however eventually clear up due to this condition.

When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.
Unless I am misunderstanding that one too.
User avatar
Nosferatu
Filter Inserter
Filter Inserter
Posts: 251
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: trains getting stuck

Post by Nosferatu »

Yes. After 5 - 6 minutes it should repath.
Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: trains getting stuck

Post by Zanthra »

Nosferatu wrote: Sat Nov 21, 2020 7:49 am Yes. After 5 - 6 minutes it should repath.
Which, i'll admit, would look like they are getting stuck.

Since the southwest bound trains are very reluctant to use the trainstop as a bypass, you either need another bypass, or you need to signal the main line as you would if the trainstop rail was not there. Replace the standard signals on the bidirectional route with chain sginals to force any trains to reserve the entire route before they enter. The only standard signal in that screenshot that can stay is the top left one direction signal that leads to the train stop.
altaykilic
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Nov 19, 2020 12:35 pm
Contact:

Re: trains getting stuck

Post by altaykilic »

Zanthra wrote: Sat Nov 21, 2020 4:55 am Can you post the save for that? The train should not be getting stuck there. They upper train should sit there for 30 seconds max before repathing.
yes, it resolves itself after 30 seconds or so. I just didn't wait long enough to see that until you pointed it out.
I'll post the save when I figure out how to do it :P
altaykilic
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Nov 19, 2020 12:35 pm
Contact:

Re: trains getting stuck

Post by altaykilic »

here's the save file
Attachments
sp10.15.zip
(9.55 MiB) Downloaded 84 times
Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: trains getting stuck

Post by Zanthra »

altaykilic wrote: Sat Nov 21, 2020 2:27 pm
Zanthra wrote: Sat Nov 21, 2020 4:55 am Can you post the save for that? The train should not be getting stuck there. They upper train should sit there for 30 seconds max before repathing.
yes, it resolves itself after 30 seconds or so. I just didn't wait long enough to see that until you pointed it out.
I'll post the save when I figure out how to do it :P
I set it up so that trains meet at that location, and it did take more than 5 minutes to clear on it's own, which could hurt throughput a fair bit.

In this image the red marks are regular signals on the main bidirectional trunk highlighted in green that you may want to replace with chain signals.
Chain Singal Protection.jpg
Chain Singal Protection.jpg (119.06 KiB) Viewed 2850 times
Post Reply

Return to “Gameplay Help”