Something Wrong with Train Path Finding
-
- Burner Inserter
- Posts: 8
- Joined: Wed Apr 18, 2018 12:31 pm
- Contact:
Something Wrong with Train Path Finding
I have built a train network to distribute goods between each station. Rails are in grid layout which similar like manhattan block. However, when trains finding path between stations, it simply avoid go straight when where is intersection, even doing circling around blocks.
I have attached two images. Second one showing the design on intersection. The first one demonstrating a path finding, the red and green lines are path it actual found, the blue is obviously the SHORTEST path.
I have attached two images. Second one showing the design on intersection. The first one demonstrating a path finding, the red and green lines are path it actual found, the blue is obviously the SHORTEST path.
- Attachments
-
- TIM截图20180418223540.png (761.73 KiB) Viewed 8319 times
-
- Untitled.png (1.82 MiB) Viewed 8320 times
Last edited by DeckerCHAN@gmail.com on Thu Apr 19, 2018 11:41 am, edited 2 times in total.
Re: Something Wrong with Train Path Finding
This is just very bad signalling resulting in unnecessarily occupied blocks.
-
- Burner Inserter
- Posts: 8
- Joined: Wed Apr 18, 2018 12:31 pm
- Contact:
Re: Something Wrong with Train Path Finding
Why it is bad and any suggestion to improve it?Loewchen wrote:This is just very bad signalling resulting in unnecessarily occupied blocks.
Re: Something Wrong with Train Path Finding
You should have signals before and after the intersections, and include some normal ones at the end of intersections, to break up blocks - I don't see anything other than chain inserters, and to be quite honest I'm surprised that it's worked as well as it is. How well do you know the signalling?DeckerCHAN@gmail.com wrote:Why it is bad and any suggestion to improve it?Loewchen wrote:This is just very bad signalling resulting in unnecessarily occupied blocks.
There are 10 types of people: those who get this joke and those who don't.
Re: Something Wrong with Train Path Finding
The blue lined block is occupied by the waiting train to the top left of it (carrying copper wire) thats trying to turn into the path of that train that's already waiting there. You've got a deadlock there actually.
Using chain signals like this is going to cause issues. Chain signals reserve the entire path - from the trains departure to it's arrival station, if they only encounter additional chain signals. So each time a train moves, it's entire route is blocked to all other trains.
[Edit] Nevermind, images are different now. Signalling issue still remains.
Using chain signals like this is going to cause issues. Chain signals reserve the entire path - from the trains departure to it's arrival station, if they only encounter additional chain signals. So each time a train moves, it's entire route is blocked to all other trains.
[Edit] Nevermind, images are different now. Signalling issue still remains.
Last edited by Aeternus on Thu Apr 19, 2018 2:31 pm, edited 1 time in total.
Re: Something Wrong with Train Path Finding
You only have chain signals. That means every train plans out the whole trip to the next station and reserves the full path. Each train can only find a path that no other train will be using. So most times they have to take quite a detour blocking even more paths for other trains.
Note how all the signals are red on your blue path. The train might like to go there but that would mean waiting for the signals to turn bkue/green. The other path is free now.
Note how all the signals are red on your blue path. The train might like to go there but that would mean waiting for the signals to turn bkue/green. The other path is free now.
-
- Burner Inserter
- Posts: 8
- Joined: Wed Apr 18, 2018 12:31 pm
- Contact:
Re: Something Wrong with Train Path Finding
From my understanding, signalling split rail to multiple blocks. As long as train paths do not overlapping, trains are able to work at same time.Jap2.0 wrote:You should have signals before and after the intersections, and include some normal ones at the end of intersections, to break up blocks - I don't see anything other than chain inserters, and to be quite honest I'm surprised that it's worked as well as it is. How well do you know the signalling?DeckerCHAN@gmail.com wrote:Why it is bad and any suggestion to improve it?Loewchen wrote:This is just very bad signalling resulting in unnecessarily occupied blocks.
I understand this is not a common approach and the best way is to put signals after and before interaction.
However, you may consider my set up as an "extreme" case to test train signalling.
Currently, I suspect the reason that trains circling instate go straight, is to trying to avoid to step into blocks which shorter than length of train it self.
So that when trains doing routing, shorter blocks has extra penalty than other blocks.
But when blocks created by chain signals, this penalty should not apply due to train will wait for entire route clear.
In fact, I have done some test. I have disconnect those bends to "force" trains go straight and they achieved to do that without "route not found" error(see attachement).
I did not find any document explain this and think this might be a bug.
- Attachments
-
- Untitled.png (478.08 KiB) Viewed 8328 times
Re: Something Wrong with Train Path Finding
After every junction you need a block where a train is allowed to stop. So you need to add regular signals to the exit from every junction. The way you have your track laid out and signalled it is basically one large junction, and I don't think you can cleanly fix that without moving to a proper dual rail track system, with sidings for the stations, (ideally with enough waiting bays, to cope with the max number of trains assigned to that station). eg something similar to
(Images from Factorio blueprints https://factorioprints.com/view/-Kt7QxVushfraBweWaRk ).
At an absolute minimum you probably need to more to a grid of one way tracks. (Think a city street layout where this street is eastbound only, then the next street south is westbound only). If you don't add waiting bays, then you should signal the whole network as one big junction, (apart from any sidings where trains can stop). Doing that will probably work but throughput will get pretty bad.
Not having an exit block large enough for your longest train as part of the exit to every junction can lead to train deadlock. Not having enough waiting bays at stations can also cause deadlocks.
I'm pretty sure that it's impossible to adequately signal two-way sections of rail such that you separate the junctions and add exit blocks, without running into another possible case of deadlock. (This one is where a train is sitting waiting at the junction trying to go north, but it is blocked by another train sitting on the other side of that junction trying to go south. You might think that one of them could take the scenic route and turn east or west, but what if there are already two trains blocking those routes. One to the east of the junction wanting to go through the junction to anywhere, and another to the west, also wanting to path through the junction).
(Images from Factorio blueprints https://factorioprints.com/view/-Kt7QxVushfraBweWaRk ).
At an absolute minimum you probably need to more to a grid of one way tracks. (Think a city street layout where this street is eastbound only, then the next street south is westbound only). If you don't add waiting bays, then you should signal the whole network as one big junction, (apart from any sidings where trains can stop). Doing that will probably work but throughput will get pretty bad.
Not having an exit block large enough for your longest train as part of the exit to every junction can lead to train deadlock. Not having enough waiting bays at stations can also cause deadlocks.
I'm pretty sure that it's impossible to adequately signal two-way sections of rail such that you separate the junctions and add exit blocks, without running into another possible case of deadlock. (This one is where a train is sitting waiting at the junction trying to go north, but it is blocked by another train sitting on the other side of that junction trying to go south. You might think that one of them could take the scenic route and turn east or west, but what if there are already two trains blocking those routes. One to the east of the junction wanting to go through the junction to anywhere, and another to the west, also wanting to path through the junction).
Last edited by Zavian on Thu Apr 19, 2018 2:23 pm, edited 1 time in total.
-
- Burner Inserter
- Posts: 8
- Joined: Wed Apr 18, 2018 12:31 pm
- Contact:
Re: Something Wrong with Train Path Finding
OK, maybe that example is not very good. I have done another attempt and this one, the blue block is not blocked by any other routing train.Aeternus wrote:The blue lined block is occupied by the waiting train to the top left of it (carrying copper wire) thats trying to turn into the path of that train that's already waiting there. You've got a deadlock there actually.
Using chain signals like this is going to cause issues. Chain signals reserve the entire path - from the trains departure to it's arrival station, if they only encounter additional chain signals. So each time a train moves, it's entire route is blocked to all other trains.
- Attachments
-
- Untitled.png (1.82 MiB) Viewed 8320 times
Re: Something Wrong with Train Path Finding
Still to many yellow, and red signals there. Looks like there is another train running across the path.
Re: Something Wrong with Train Path Finding
Are you disabling stations using the circuit network? There is a penalty for a train stop that is not the destination, but I have no idea what the penalty for a disabled station is, or even if the rail path algorithm considers that as a station.
Also if you actually want the devs to look at this you should upload the save. (One min to download and open a saved game vs 10+ mins to recreate your rail setup, and then they still don't know what your combinators are doing).
Also if you actually want the devs to look at this you should upload the save. (One min to download and open a saved game vs 10+ mins to recreate your rail setup, and then they still don't know what your combinators are doing).
Re: Something Wrong with Train Path Finding
Still chain signals everywhere opposite each other. You need a chain signal before the crossing and a normal signal after. Then the train stops at the chain signal if it can't pass the normal signal, thus not blocking the intersection.
And as said, in general it's best to have one track for each direction
And as said, in general it's best to have one track for each direction
Re: Something Wrong with Train Path Finding
But doing will make the layout prone to deadlocks.Serenity wrote:Still chain signals everywhere opposite each other. You need a chain signal before the crossing and a normal signal after
Zavian wrote:I'm pretty sure that it's impossible to adequately signal two-way sections of rail such that you separate the junctions and add exit blocks, without running into another possible case of deadlock. (This one is where a train is sitting waiting at the junction trying to go north, but it is blocked by another train sitting on the other side of that junction trying to go south. You might think that one of them could take the scenic route and turn east or west, but what if there are already two trains blocking those routes. One to the east of the junction wanting to go through the junction to anywhere, and another to the west, also wanting to path through the junction).
Re: Something Wrong with Train Path Finding
Yeah, but as you said that's because the distance between the intersections are too small. Not directly because of the signals. You need to space them at least a train length apart
Re: Something Wrong with Train Path Finding
@serenity: All the tracks are bi-directional. Placing full signals would cause trains to halt in the middle of their path and then you quickly have trains going in opposite directions blocking each other. It's just not possible with his design.Serenity wrote:Yeah, but as you said that's because the distance between the intersections are too small. Not directly because of the signals. You need to space them at least a train length apart
If you want to keep your bi-directional design then you simply have to live with trains going out of their way to drive around other trains.
Re: Something Wrong with Train Path Finding
No it's a general property of the two way rails. They enable two trains to approach head to head on the same track, which doesn't happen on a dual track system. See viewtopic.php?f=194&t=53937 . That's why I don't think you can cleanly separate the junctions without moving to one-way tracks, (or at least inserting sections of one way track as exit buffers). If you are going to do that, then you might as well make even lines run eastbound, and odd lines run westbound (and do the same with north and south lines). That effectively gives you one-way tracks, without needing all the space of a dual track system. And it will allow exit buffers without adding to the risk of deadlock.Serenity wrote:Yeah, but as you said that's because the distance between the intersections are too small. Not directly because of the signals. You need to space them at least a train length apart
Yeah, but a single large junction like that will almost certainly have terrible throughput.mrvn wrote:@serenity: All the tracks are bi-directional. Placing full signals would cause trains to halt in the middle of their path and then you quickly have trains going in opposite directions blocking each other. It's just not possible with his design.Serenity wrote:Yeah, but as you said that's because the distance between the intersections are too small. Not directly because of the signals. You need to space them at least a train length apart
If you want to keep your bi-directional design then you simply have to live with trains going out of their way to drive around other trains.
Re: Something Wrong with Train Path Finding
First of all you should not use chain signals in your example. Chain signal looks all the way forward train's path up until normal signal or train's destination. In your case trains just won't move at all cause other train is somewhere there along his path (even if not near).
So try starting with replacing your signals with notmal ones.
Another problem is that when stopped at the signal your trains can't make a decision to change its path so this design will be deadlocked in no time. This is why the basic design of every intersection is placing chain signal before the intersections and normal after - the train will stop at chain signal and consider other path around if the initial one is blocked.
Third problem correlates with the first one and it is using dual way lines. Dual way railways are prone to deadlocks even more than any other faulty designs.
And the fourth problem in your design is not having train-fitting fragments between intersections. This generally does not allow for more valid solution in your layout. This was already noted by Zavian.
So yeah. This will never work fine as it is even with minor changes. You need more space for your stations and place chain signal after station before the intersection and normal signal on every intersection exit. This will end up having double signals everywhere but not inside intersections, with normal signal paired with chain signal. Not sure how effective will it end up but it will possibly somehow work.
So try starting with replacing your signals with notmal ones.
Another problem is that when stopped at the signal your trains can't make a decision to change its path so this design will be deadlocked in no time. This is why the basic design of every intersection is placing chain signal before the intersections and normal after - the train will stop at chain signal and consider other path around if the initial one is blocked.
Third problem correlates with the first one and it is using dual way lines. Dual way railways are prone to deadlocks even more than any other faulty designs.
And the fourth problem in your design is not having train-fitting fragments between intersections. This generally does not allow for more valid solution in your layout. This was already noted by Zavian.
So yeah. This will never work fine as it is even with minor changes. You need more space for your stations and place chain signal after station before the intersection and normal signal on every intersection exit. This will end up having double signals everywhere but not inside intersections, with normal signal paired with chain signal. Not sure how effective will it end up but it will possibly somehow work.
Re: Something Wrong with Train Path Finding
Regardless of the fact that OP has created a very strange setup, it's still an interesting question why the train does that. I did a quick test and passing through disabled train-stops still seem to have the same penalty, so I don't think that's it.
For testing purposes, what would happen if you removed all trains but one?
For testing purposes, what would happen if you removed all trains but one?
Re: Something Wrong with Train Path Finding
Can you show the blocks? My guess is that the track just to the northeast of the intersection is unsignaled, so the train at the end of the red block is blocking it - although I thought in that case the signals would be flashing.DeckerCHAN@gmail.com wrote:OK, maybe that example is not very good. I have done another attempt and this one, the blue block is not blocked by any other routing train.Aeternus wrote:The blue lined block is occupied by the waiting train to the top left of it (carrying copper wire) thats trying to turn into the path of that train that's already waiting there. You've got a deadlock there actually.
Using chain signals like this is going to cause issues. Chain signals reserve the entire path - from the trains departure to it's arrival station, if they only encounter additional chain signals. So each time a train moves, it's entire route is blocked to all other trains.
There are 10 types of people: those who get this joke and those who don't.
Re: Something Wrong with Train Path Finding
Yes, he should use chain signals. He MUST use chain signals. The design requires it since tracks are bidirectional and any full signal would cause instant deadlocks.PacifyerGrey wrote:First of all you should not use chain signals in your example. Chain signal looks all the way forward train's path up until normal signal or train's destination. In your case trains just won't move at all cause other train is somewhere there along his path (even if not near).
So try starting with replacing your signals with notmal ones.