[15.37] Train changes path after chainsignal (again)

Bugs that are actually features.
KAA
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue Dec 06, 2016 4:50 pm
Contact:

[15.37] Train changes path after chainsignal (again)

Post by KAA »

Hi there!
So I have a situation that really confuses a lot. I cannot figure out what's happening by myself so need your help here.

Here is screenshot:
2017-11-03 20_45_05-Factorio 0.15.35.png
2017-11-03 20_45_05-Factorio 0.15.35.png (3.26 MiB) Viewed 6147 times
So the goal of this railway circle and the fork is to allow "iron" trains enter their "waiting bay" that consists of several waiting sections.
Circle is needed to accept trains that appear from the bottom of the screen also.

So now, as you can see, one train decided by some reason to go to the occupied section. And blocked all the waiting bay.
By the way, this section was occupied for a couple of minutes already, so these trains were not like one after another.
Can you please explain to me why is it happening?

Going into the details,
to avoid this exact situation I put two rail CHAIN signals before waiting bay. They are marked with arrows.

As I understand rail chain signal logic, it allows train to pass in case train wants to go to the section with next green signal. If train chooses section with next red signal, rail chain signal also will be "logically red" for this train so it will stop.

So I assume the logic is the following:
- train comes to rail CHAIN signal. Signal is (in my case now) blue. Because some routes are occupied by trains.
- trains asks "I selected route number X. Is its signal red or green?"
- rail chain signal answers "It's red, brother, you cannot go there"
And here train should stop and try to reroute. Or maybe it will reroute even while moving, doesn't matter.
Anyway, after it chooses correct (free) section of the waiting bay, rail chain signal allows the train to go there.

But looks like I'm missing something so will appreciate any help.
Even if I'm wrong somewhere, I still cannot figure out how can train pass through rail chain signal to occupied railway. It shouldn't happen at all!

User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Trains goes to occupied railway on the fork

Post by Lav »

You have multiple regular signals after your chain signal, and some of them are green. This allows the train to pass through.

From the minimap I can see two unloading stations. However it looks like routes between leftmost waiting bays (most likely two) and rightmost station are unavailable due to curved rail mismatch.

Your bottom train could have pathed to the left station (which seems to be available from all waiting bays), another train stopped at that station while the bottom train was still moving west, making it repath to the right station - but at that point only one path (3rd from the left) was available. If it happened slightly later, the train would have no choice but to keep moving to the left station. If it happened slightly earlier, there would be other waiting bays available to it. So it's a question of chance (though for a specific combination of rail lengths, train lengths and acceleration this chance might be higher or lower than expected).

It's just a guess though as I'd need to examine the exit from your waiting bay to be sure.

Try to block two leftmost waiting bays - if I'm right this should solve the issue.

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

Re: Trains goes to occupied railway on the fork

Post by impetus maximus »

this problem has been around for a long time. trains calculate when leaving a station.
so if a train plans on using a slot, then another train enters said slot you get this problem.

try adding this before the stacker.

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

Re: Trains goes to occupied railway on the fork

Post by Loewchen »

This could happen if the train recalculates its path after passing the chain signal (34844), we would need a save file where this can be observed. What version are you using?

KAA
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue Dec 06, 2016 4:50 pm
Contact:

Re: Trains goes to occupied railway on the fork

Post by KAA »

impetus maximus wrote:this problem has been around for a long time. trains calculate when leaving a station.
so if a train plans on using a slot, then another train enters said slot you get this problem.

try adding this before the stacker.
2017-11-03 22_11_11-Factorio 0.15.35.png
2017-11-03 22_11_11-Factorio 0.15.35.png (137.84 KiB) Viewed 6129 times

save game, 57mb. Just stand there for 3 min and do nothing.
https://goo.gl/C7vJAv

Runs a little bit slow due to several thousands robots loading/unloading stuff. :)


Adding logically signals can cause an issue in case rail chain signal is red, as i read in that topic. So, if I make sure rail chain never goes red (have at least one free way) - it will be "perfect" solution, right?

However, even if so, I still would like to know what exactly causes this and maybe It's an issue in the way I designed this railway. If you have time to help, of course.

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

Re: Trains goes to occupied railway on the fork

Post by Loewchen »

The fix of the bug report I linked is not live yet, it was incorrectly filed, it is therefore likely that this is already fixed in 0.16. If one experiences this issue beyond that release please make a bug report.

KAA
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue Dec 06, 2016 4:50 pm
Contact:

Re: Trains goes to occupied railway on the fork

Post by KAA »

Thanks for explaining and research !
Hope workaround with two rail signals will work for now.

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

Re: Trains goes to occupied railway on the fork

Post by Loewchen »

For fun I revert my last statement once more because the fix had been in 0.15 after all (as mentioned later in the linked topic). The incorrect behaviour can still be produced with the save provided (https://goo.gl/C7vJAv) in 15.37 (after about one minute to the left of the player), so I move this to bugs.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Rseding91 »

Are you disabling the station the train is trying to drive to via the circuit network?
If you want to get ahold of me I'm almost always on Discord.

KAA
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue Dec 06, 2016 4:50 pm
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by KAA »

Rseding91 wrote:Are you disabling the station the train is trying to drive to via the circuit network?
No, I have no railway elements which are controlled by circuit network anywhere on the map as I remember.
And definitely this circuit - from mines to buffer station - has no circuit network controlled stations or other elements. If I understand the question correct.

By the way, I implemented solution mentioned in the post above and updated to "0.15 stable" (it seems the last available version, right?)- the case now reproduces more rare but still happens.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Rseding91 »

Do you have robots/other players that are mining the rails/signals the train may want to drive over/reserve?
If you want to get ahold of me I'm almost always on Discord.

aaargha
Filter Inserter
Filter Inserter
Posts: 330
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by aaargha »

Is this perhaps another symptom of this this bug? Basically the fix that was put in place for this in 0.15.27 is a bit flawed but, supposedly, kovarex is working to fix this for 0.16.

KAA
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue Dec 06, 2016 4:50 pm
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by KAA »

Rseding91 wrote:Do you have robots/other players that are mining the rails/signals the train may want to drive over/reserve?
No, as you can see in the game save, robots there are only performing logistics. Also, I did not modify rail system for a long time in that game save I posted
And now, as this issue keeps happening in about once in 40-60 mins, my rail system is static, nothing is added/removed.
It's also single player save, no other players are/were involved.

P.S.: Maybe a little bit offtopic, but for those who may face this issue, I found another workaround.
Since "waiting bay" with a set of waiting sections is usually designed by people in the way that it can accommodate all trains ( I mean waiting sections count is more or equal to the number of trains that potentially can wait simultaneously), one solutions is to put in every waiting section an "intermediate" Train Station with condition like "Till cargo is full" or something like that, that will always be true for every train.
The logic here is that every train, before it arrives to the ending station, will go to its own waiting section, because his own intermediate station is in that section.

So, in other words, there intermediate Train Stations on a waiting bay sections will allow to assign particular section to a particular train so they never go to the same section and the issue will never happens.
This, of course, complicates train managing a little bit, but because of
a) great comfortable (imho) trains management system in current Factorio comparing to earlier versions.
b) the fact that intermediate station can be inserted in ANY MOMENT AFTER railway is designed and all trains assigned.

this solution seems to be not very complicated to me.

P.P.S: :)
I didn't prepare a screenshot yet but hope this explanation will do the job.
More than that, I'm sure people already use similar setups and I didn't say any revolution things.
Thanks again for the attention to the issue, will continue answering.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Rseding91 »

Ah.. I miss-read the first image. The train changed its path after leaving the chain signal block which is allowed. The train can't change its path while it has the chain signal reserved but after it has passed it, it's free to do what ever it wants.

If you changed your signaling so there are chain signals down the entire section of Ys it would prevent the problem: the train won't change path until it has completely left the chain block at which point it's already set out on a rail that won't block the rest of the chain signals.

You need to build more chain signals: Image
If you want to get ahold of me I'm almost always on Discord.

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Zavian »

That's pretty unintuitive. My understanding was that the train would not pass a chain signal until it had reserved its whole route to pass the regular signal at the end of the block, and that if it decided to repath whilst inside the block, it would choose a path where it could instantly reserve its route past the regular signal that marks the end of the chain signals. (Obviously if you disable a station/mine rail line, it might be unable to find such a path).

What you are saying is that the train can choose to repath between the last chain signal and the regular signal that denotes the end of the set of blocks that the chain signals were employed to protect, and that when doing so, it can choose a route where it can't exit past the regular signal and exit the set of blocks that the chain signals were employed to protect. To me that sounds like an unintended feature of the current implementation, rather than a good design choice. It will force people to add lots of chain signals just before regular signals in places where they would otherwise be unnecessary, just to make sure that the train can't change it's path at the last moment and block an intersection.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Rseding91 »

Zavian wrote:That's pretty unintuitive. My understanding was that the train would not pass a chain signal until it had reserved its whole route to pass the regular signal at the end of the block, and that if it decided to repath whilst inside the block, it would choose a path where it could instantly reserve its route past the regular signal that marks the end of the chain signals. (Obviously if you disable a station/mine rail line, it might be unable to find such a path).

What you are saying is that the train can choose to repath between the last chain signal and the regular signal that denotes the end of the set of blocks that the chain signals were employed to protect, and that when doing so, it can choose a route where it can't exit past the regular signal and exit the set of blocks that the chain signals were employed to protect. To me that sounds like an unintended feature of the current implementation, rather than a good design choice. It will force people to add lots of chain signals just before regular signals in places where they would otherwise be unnecessary, just to make sure that the train can't change it's path at the last moment and block an intersection.
Perhaps, but that is how it has always worked. The chain signal existing doesn't alter the train logic once the train has passed the signal. In your example the chain signal happens to be quite close to the normal signals but imagine you had a chain signal and after it 300 exits. The train was forced to take the 300th exit down the row and as it's driving a closer exit is free - if it turned to take that exit you wouldn't think twice about it. In fact you would want it to do that.

If it worked as you suggest the train would be locked into the path until it passed another standard signal no matter how many better paths may appear.
If you want to get ahold of me I'm almost always on Discord.

triffid_hunter
Inserter
Inserter
Posts: 41
Joined: Wed Dec 14, 2016 7:33 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by triffid_hunter »

The problem here is the train deciding to take an exit that isn't free and jamming the main line despite plenty of space in the stacker. I would much prefer the train be forced to take the 300th exit if that avoids this situation

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Zavian »

Well that behaviour is news to me, and I suspect it will be news to lots of other players as well.

It will lead to an ugly design pattern with extra chain signals that are only there because of implementation limitations.
ChainSignalsGalore.png
ChainSignalsGalore.png (2.11 MiB) Viewed 5956 times

I don't mind a train repathing, However it must not pick a path where it ends up stopped after a chain signal and before a regular signal. That means if it chooses to repath between a chain signal and a before it passes the regular signal, it needs to choose a path where it can reserve a route past a regular signal. (Unless someone has mined a track or disabled a station or something similar, it already has a suitable a path reserved. If it can find a better one fine, but otherwise it shouldn't block the intersection).

Also "the chain signal existing doesn't alter the train logic once the train has passed the signal" doesn't make sense to me. By that logic a train could pass any chain signal, then decide to repath, and choose a path which has a chain signal leading to a blocked exit, and stop at that chain signal. Somewhere the logic needs to know that the train has passed a chain signal, and is now in a set of blocks protected by chain signals, otherwise it could decide to change it's path, pick a different path where it can't reserve the next signal, and block any intersection.

Consider the train below. It entered the roundabout from the east, intending to exit to the west. Just before the exit to the west it decides to repath and exit to the north. Where is it going to stop? Will it be blocking trains wanting to enter from the south and west? Trains that might otherwise have had a clear route through the intersection? Will the fact that I added extra chain signals just before the regular signals at the exit actually help?
roundabout.png
roundabout.png (2.76 MiB) Viewed 5956 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by Rseding91 »

In the round-about example you gave the train is currently inside a chain signal block and is not allowed to re-path. That was fixed a while ago so it doesn't happen unless you break its path by removing rails/signals/stops.
If you want to get ahold of me I'm almost always on Discord.

galibert
Inserter
Inserter
Posts: 42
Joined: Fri Sep 15, 2017 7:42 am
Contact:

Re: [15.37] Train changes path after chainsignal (again)

Post by galibert »

Rseding91 wrote:In the round-about example you gave the train is currently inside a chain signal block and is not allowed to re-path. That was fixed a while ago so it doesn't happen unless you break its path by removing rails/signals/stops.
Is switching a stop on/off through the circuit network equivalent to removing it in that case? (I'd guess yes, but I'd rather ask).

OG.

Post Reply

Return to “Not a bug”