Train pathing through station
Train pathing through station
Hi,
as far as I understand https://wiki.factorio.com/Railway/Train_path_finding trains should not path through unused stations if nothing extraordinary happens. But still I have this issue quite often. As you can see below, the light blue has a train station but still the trains like to path through it. Even adding a 2nd station to increase the penalty doesn't help.
This happens to me quite often in a complicated station which causes many congestions. Maybe this issue is somehow caused by my long train paths (several thousand tiles)?
Does anyone have a solution, or is this maybe a bug that I should report?
Thanks for your help.
as far as I understand https://wiki.factorio.com/Railway/Train_path_finding trains should not path through unused stations if nothing extraordinary happens. But still I have this issue quite often. As you can see below, the light blue has a train station but still the trains like to path through it. Even adding a 2nd station to increase the penalty doesn't help.
This happens to me quite often in a complicated station which causes many congestions. Maybe this issue is somehow caused by my long train paths (several thousand tiles)?
Does anyone have a solution, or is this maybe a bug that I should report?
Thanks for your help.
Re: Train pathing through station
There are no circuits on the main rail and both stations are enabled?
There are 10 types of people: those who get this joke and those who don't.
Re: Train pathing through station
Could there be a signalling issue with the part of the track aside the station?
What happens if you completely break the station part off? Do you get any "No Path" errors?
It may help to upload your save file, as it is hard to see all the details just form the screenshot.
What happens if you completely break the station part off? Do you get any "No Path" errors?
It may help to upload your save file, as it is hard to see all the details just form the screenshot.
Re: Train pathing through station
I got no circuits controlling signals at all. Both stations are enabled.Jap2.0 wrote:There are no circuits on the main rail and both stations are enabled?
I don't think there is a signalling issue, most trains just drive straight and skip the station.sillyfly wrote:Could there be a signalling issue with the part of the track aside the station?
What happens if you completely break the station part off? Do you get any "No Path" errors?
Also no "No Path" errors.
Savegame: You need to extract it and then repack is as a .zip, this saves some file size for up/downloading. I also used the ups-up-mod to reduce the size even further.
If you want to find the station, just take a train to: "Iron Ore 15 Bhf"
So you may take a look at the station. The error is pretty rare in this place though, not a lot of trains driving there.
Re: Train pathing through station
If there is a train on the straight section, then the path-finder might consider the longer route through the station as better. Typically though I would only expect that to happen if the 'loop' was otherwise empty, which means it shouldn't cause delays for a train that wants to use the station.
This post viewtopic.php?f=194&t=52544 has a setup that is designed to solve your porblem. (I haven't used it myself, but Aaargha generally knows what he is talking about with the train network).
This post viewtopic.php?f=194&t=52544 has a setup that is designed to solve your porblem. (I haven't used it myself, but Aaargha generally knows what he is talking about with the train network).
Re: Train pathing through station
As far as I understand the penalty for another train, especially if it is a long distance away, should not be higher than the penalty for a station.
Also, even if the loop/station is empty at the time of the pathfinding, another train may still arrive before the train taking the detour. This happens sometimes in my tightly packed main station with one train that stops for a long time, the "wrong" train blocks the main track, a long queue builds up end everything comes to a standstill.
Thanks for your link, I'll give it a try. although I don't think it will help, considered a station should give 2k penalty, a signal, that is red by circuit, only 1k. At least it's a pretty nice Idea, though.
Update: I overlooked the chain signal at the station entrance, it should probably work. Although queues requires a dummy station.
Also, even if the loop/station is empty at the time of the pathfinding, another train may still arrive before the train taking the detour. This happens sometimes in my tightly packed main station with one train that stops for a long time, the "wrong" train blocks the main track, a long queue builds up end everything comes to a standstill.
Thanks for your link, I'll give it a try. although I don't think it will help, considered a station should give 2k penalty, a signal, that is red by circuit, only 1k. At least it's a pretty nice Idea, though.
Update: I overlooked the chain signal at the station entrance, it should probably work. Although queues requires a dummy station.
Last edited by Mimos on Mon Nov 13, 2017 12:33 am, edited 2 times in total.
Re: Train pathing through station
Well mrvn also described his approach to solving the same problem in that thread I linked.
Re: Train pathing through station
Yeah - the penalty for a full block is 2*length, which shouldn't be a penalty of more than a few hundred here. Each station adds a penalty to 1000.
There are 10 types of people: those who get this joke and those who don't.
Re: Train pathing through station
I think the penalty of a station is even 2k. A signal red by circuit is 1k according to https://wiki.factorio.com/Railway/Train_path_finding.
Re: Train pathing through station
Well, in my post before I overlooked the chain signal at the entrance to the train station track. After some test it looks like this still does not prevent bad pathing but it might prevent the train to enter if it actually arrives. Although designing queues requires one dummy station for each entry path.Zavian wrote:This post viewtopic.php?f=194&t=52544 has a setup that is designed to solve your porblem.
I also have a savegame where a bad path is planned less than 1min after loading. It still is changed again a few seconds later. I can provide it in case the devs are interested.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Train pathing through station
You say that your problem is that trains "path through" the sation instead of going around it. But i'm guessing your problem is actually trains blocking the whole track when a train attempts to path through the station in a situation where the station is already occupied. Because if the station wasn't occupied a train driving through it at full speed would not pose any problems. So ...based on that assumption of your problem, i think you can simply solve it by encasing the whole parralel tracks section into a singular chain signal block (compressed example below). That way any train attempting to pass the block will wait before the block and then use whichever side of the track is free. Hopefully resulting in trains more often using the shorter track that doesn't get the 2K Station penalty. (Btw, yea. it's 2K not 1K as some ppl say)
If you have similar problems on larger setups you might want to consider reading more about the magic of signals (or call me an idiot for being completly wrong :P).Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Train pathing through station
Yes, you are right. So a train passing through an empty station is still ugly, but I can live with it.eradicator wrote:You say that your problem is that trains "path through" the sation instead of going around it. But i'm guessing your problem is actually trains blocking the whole track when a train attempts to path through the station in a situation where the station is already occupied.
Thanks for your solution. I like it, because it is quite simple. Although stations using a queue or even a stacker require more complicated solutions (as suggested in the previous posts).
Re: Train pathing through station
I know it's also the equivalent of asking if the computer is plugged in, but you are playing with the latest version right? Non-experimental builds shouldn't have the station pathfinding increase.
Re: Train pathing through station
I'm using 0.15.37 which is the newest stable version as of now. Starting with 0.15 the station penalty should be applied according to https://wiki.factorio.com/Railway/Train_path_finding.Xeorm wrote:I know it's also the equivalent of asking if the computer is plugged in, but you are playing with the latest version right? Non-experimental builds shouldn't have the station pathfinding increase.
- impetus maximus
- Smart Inserter
- Posts: 1299
- Joined: Sat Aug 20, 2016 10:07 pm
- Contact:
Re: Train pathing through station
Mimos, aside from the chain signal, did you try the entire solution Zavian linked to?
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Train pathing through station
I missed that post at first. But that really is a nice solution. I experiemented before with that kind of block-detection but didn't have a good usecase for itimpetus maximus wrote:Mimos, aside from the chain signal, did you try the entire solution Zavian linked to?
![Smile :)](./images/smilies/icon_e_smile.gif)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Train pathing through station
Yes, I did. At least if I didn't overlooked something. I made some screenshots, right before the train plans the worong path and right after it. Sadly it's pretty zoomed out and thus a little hard to see. You cannot see the circuits, but you can see that the controlled signal is red both times. You can also see a train passing by which is probably causing this mess.impetus maximus wrote:Mimos, aside from the chain signal, did you try the entire solution Zavian linked to?
Re: Train pathing through station
I think I've figured out what is happening. The reason that the path through the station becomes cheaper is that the train on the main path is in the arrive_station state. From what I can tell from some testing the major part of the "train is waiting at station" penalty, which is huge for most wait conditions (I got bored with testing at about 200k), is also applied for that state and not only for wait_station.
What happens is that as a train is calculating its path another train is on the main line outside the loop station and is braking for entering a nearby station (they start really far away). As the penalty for the braking train is gigantic the path through the station is shorter. As far as I can tell from trying your save, if the train is only passing by it does not cause this behaviour.
Unfortunately it's hard to get around this problem in a nice way, though placing this contraption at the split before the stations might help. Some uglier alternatives include moving the stations far away from the main line so the trains are off the main line when they change to arrive_station. Another ugly solution would be to add an additional train stop before the final stop that trains would wait at for 0 seconds, this would remove the excessive penalty.
There are already changes planned to how trains work for 0.16 but I'll do some testing to try to confirm this behaviour and then perhaps file a bug report. (EDIT: Bug report here for those interested)
What happens is that as a train is calculating its path another train is on the main line outside the loop station and is braking for entering a nearby station (they start really far away). As the penalty for the braking train is gigantic the path through the station is shorter. As far as I can tell from trying your save, if the train is only passing by it does not cause this behaviour.
Unfortunately it's hard to get around this problem in a nice way, though placing this contraption at the split before the stations might help. Some uglier alternatives include moving the stations far away from the main line so the trains are off the main line when they change to arrive_station. Another ugly solution would be to add an additional train stop before the final stop that trains would wait at for 0 seconds, this would remove the excessive penalty.
There are already changes planned to how trains work for 0.16 but I'll do some testing to try to confirm this behaviour and then perhaps file a bug report. (EDIT: Bug report here for those interested)
Re: Train pathing through station
Thanks for your explaination! You are right, the coal train just starts braking when it's on this intersection.
But how can you see the exact state of a train? I looked at the color of its "show-train-stop-point" indicator, but the names you use suggest you know another way.
But how can you see the exact state of a train? I looked at the color of its "show-train-stop-point" indicator, but the names you use suggest you know another way.
Re: Train pathing through station
I'm using to see which entry from the list here it is (0 based) while hovering over a train. 6 is arrive_station and 7 is wait_station.
The Lua API holds a lot of goodies once you know where to look![Smile :)](./images/smilies/icon_e_smile.gif)
I'm thinking of making a mod that would change the colours of trains depending on which state they're in so that it's easier to debug these kinds of issues. It shouldn't be that hard, but we'll see.
Code: Select all
/c game.player.print(game.player.selected.train.state)
The Lua API holds a lot of goodies once you know where to look
![Smile :)](./images/smilies/icon_e_smile.gif)
I'm thinking of making a mod that would change the colours of trains depending on which state they're in so that it's easier to debug these kinds of issues. It shouldn't be that hard, but we'll see.