Train self-deadlock

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Mimos
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon Nov 07, 2016 5:15 pm
Contact:

Train self-deadlock

Post by Mimos »

Hi,

I have an issue with my train layout where some trains quite sometimes deadlock themselfes.

All the screenshots are taken with the train driven manually, so the signal colors may not be 100% accurate (reservations).
Factorio 0.15.34

Starting Position. The train on the top right corner may want to go north or south, both ways lead to the destination having roughly the same length.
Train deadlock 1.png
Train deadlock 1.png (1023.31 KiB) Viewed 2204 times
The train propably decided to take an "u-turn" to go to the north, otherwise it should not be in this position
Train deadlock 2.png
Train deadlock 2.png (1.01 MiB) Viewed 2204 times
For some reason the train now decieded to go south instead. But it cannot because it's in its own way. So how can this happen? I thought signal 1 at the bottom should only let trains pass when there is an unblocked path up to and including the next normal signal. But there is none to the bottom, because signal 2 at the top is already red. So why doesn't the train already stop at signal 1 at the bottom? And after waiting at the bottom for a while it would hopefully decide to take another path, instead. Or can the train decide to take another path in the middle of the track even if it is in a special "protected" signal block?
Train deadlock 3.png
Train deadlock 3.png (1.23 MiB) Viewed 2204 times
The next question is: can anyone think of a nice solution? For now I just removed the two signals but this limits througput. And I'm hoping to aviod resizing the "circle".

Regards,
Mimos

Loewchen
Global Moderator
Global Moderator
Posts: 8285
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Train self-deadlock

Post by Loewchen »

See: 22939
You can avoid this with better signalling or simply not using loops. Requiring the train to turn around on the main track is as bad as it gets, let the train merge in the main track in the correct direction directly.

Mimos
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon Nov 07, 2016 5:15 pm
Contact:

Re: Train self-deadlock

Post by Mimos »

Thanks for your reply.

I did some more reading and found out that a train may also change it's path not only at signals but also in the middle of the track if it sees it needs to stop. So it's not the signals fault here, the train decides to change it's path after it passed the bottom signal.
It propably only worked until now becaus I just started to use longer trains to increase the throughput.

I like the circles because they are quite space efficient and they fit my railway grid quite nicely and they reduce my need for complicated intersections. And removing them means refactoring a lot of intersections. But then I'll propably have to change that anyway.

I also spotted another possibility for a deadlock in this intersection (requiring two trains to happen) which would not be solvable by any reasonable signal logic I can think about.

Loewchen
Global Moderator
Global Moderator
Posts: 8285
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Train self-deadlock

Post by Loewchen »

Mimos wrote: I did some more reading and found out that a train may also change it's path not only at signals but also in the middle of the track if it sees it needs to stop. So it's not the signals fault here, the train decides to change it's path after it passed the bottom signal.
Sure, but in the end you need to work with the behaviour at hand, and that makes this setup not stable to use, and even with said bug fixed it will still destroy throughput.
Mimos wrote: I also spotted another possibility for a deadlock in this intersection (requiring two trains to happen) which would not be solvable by any reasonable signal logic I can think about.
When using the right setup you can have hundreds of trains with 10+ wagons without deadlock, but I doubt it is possible with loops like this.

User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Train self-deadlock

Post by impetus maximus »

as Loewchen said. if you start the train in the correct direction from the station it's at, there is no need for loops/roundabouts.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Train self-deadlock

Post by orzelek »

If you want ot have loops like this then you need to make sure that each side of loop can accomodate whole train between signals.
This should reduce the deadlock chances but it won't eliminate them completely.
There are few pretty complex bugs in game currently that can cause trains to repath in strange ways and they can deadlock then anyway.

Mimos
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon Nov 07, 2016 5:15 pm
Contact:

Re: Train self-deadlock

Post by Mimos »

I am not sure if I would consider this a bug (I guess fixing it would at least require some complicated pathfinding), but at least I finally found a solution in viewtopic.php?f=23&t=53773#p315938 . Just place additional chain signals before the exit signals and now the train is no longer allowed to change it's path while inside the loop (as far as I understand). And it seems to be working :-)
Solution.jpg
Solution.jpg (292.14 KiB) Viewed 1952 times

Post Reply

Return to “Gameplay Help”