Page 1 of 1

How to keep the main line (trains) rolling?

Posted: 27 Apr 2019 15:30
by MarkShot
Suppose I have a mainline either express or fast freight or slow freight (mutually exclusive).

The mainline connects to side stations, and the mainline itself is two tracks running up and down.

The problem is how to keep rail traffic on the mainline rolling?

I already know that junctions should not cross tracks, but should be over/under implementations.

I already know that if you don't disable breakdowns or use a mod that breakdowns pose a severe risk of stalling the mainline.

Suppose a station has N trains which visit via the mainline. I only see two absolute ways to guarantee that those N trains do not stall the main line.

Option #1: Make sure there are enough track and signals on the siding to the station to buffer N trains. Thus, the entire complement can come off the mainline if they must for any reason.

Option #2: The mainline is more than parallel tracks, but rather a race track pattern. When any of those N trains encounters a RED to exit for its station (programmable routing) sends the train past its exit for another lap around the race track. Thus, trains are like planes put into a holding pattern. All the trains behind the given train, can reach their assigned destinations. Hopefully, the "go around" train will be able to make its siding on the next pass. THE PRIMARY RULE IS DON'T STOP MOVING ON THE MAIN LINE.

BTW, I don't have the knowledge I need to implement Option #2, and Option #1, is cumbersome, but trivial to implement.

---

Comment, thoughts, expertise, help?

Thanks!

Re: How to keep the main line (trains) rolling?

Posted: 27 Apr 2019 16:56
by kamnet
Check out https://wiki.openttdcoop.org/Main_Page for advanced concepts on building and managing train networks.

Re: How to keep the main line (trains) rolling?

Posted: 27 Apr 2019 20:37
by Transportman
MarkShot wrote: Option #1: Make sure there are enough track and signals on the siding to the station to buffer N trains. Thus, the entire complement can come off the mainline if they must for any reason.
Or use an escape depot, then you have basically unlimited buffer capacity, although you might need to make some minor modifications if you really have high traffic at the station or have very long trains, as depots have a reduced entry/exit speed.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 05:48
by Alberth
One solution is to use feeders. You have sideline trains and mainline trains, cargo gets transported through feeder stations onto and from the mainline.
That is: producer -> sideline train -> feeder station -> mainline train -> feeder station -> sideline train -> consumer.

Since there is a fixed number of trains on the mainline, (and they don't wait for full load,) main line will continue to roll.
I tried this while aiming to move all industrial cargo to/from all industries, and it's interesting :mrgreen:



I usually build a network of lines (I don't really have main lines and side lines, just a network of connected stations), and in my experience trains are pretty good at finding their way in the network. They avoid busy areas, unless you force everything to the same spot of course.
For example
tarnington_map.png
(45.38 KiB) Not downloaded yet
These networks are created organically, so they are always different.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 07:46
by MarkShot
kamnet wrote:Check out https://wiki.openttdcoop.org/Main_Page for advanced concepts on building and managing train networks.
What an interesting and profound resource. I didn't even know that site existed.

I was only aware of:

https://wiki.openttd.org/Main_Page

I have been relying on YouTube videos.

I am a little confused as to the distinction between these three sites:

https://wiki.openttd.org/Main_Page

https://wiki.openttdcoop.org/Main_Page

https://github.com

Can someone clarify?

Thanks.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 07:52
by MarkShot
If I wanted to try my approach of using a race track pattern with no waiting to pull off the mainline, but to go around ...

Where would I find material on programmable routes such that if a train encountering a Y with two options:

(a) Sideline
(b) Bypass

finds the Sideline blocked, it bypasses and begins a circuit?

Thanks.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 08:28
by kamnet
MarkShot wrote:I am a little confused as to the distinction between these three sites:
1. https://wiki.openttd.org/Main_Page
2. https://wiki.openttdcoop.org/Main_Page
3. https://github.com
1. Is the official OpenTTD wiki, which is contributed to by anybody who wishes to contribute
2. Is the wiki for OpenTTD Co-op, a dedicated group of players (many of them devs) who work on advanced gaming techniques
3. Is the open source code repository where OpenTTD now stores its code.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 09:00
by Transportman
MarkShot wrote:If I wanted to try my approach of using a race track pattern with no waiting to pull off the mainline, but to go around ...

Where would I find material on programmable routes such that if a train encountering a Y with two options:

(a) Sideline
(b) Bypass

finds the Sideline blocked, it bypasses and begins a circuit?

Thanks.
You might want to look at this page. It is a bit of complex material, but in your case, it would be reduced to the following:
  1. Set the setting yapf.rail_firstred_twoway_eol in your openttd.cfg to true
  2. Place a two-way signal on your sideline and have the next signal on the sideline be at least one train length ahead
  3. Place a one-way signal on your bypass and continue with the usual signal distance you use on your mainline
What this does, is when your sideline-entry is blocked by a train, all other trains do not consider the sideline because the two-way signal is red and because of the yapf.rail_firstred_twoway_eol-setting, it is considered the end of the line and has an infinite penalty for the pathfinder. Because your mainline has a one-way signal, it is not considered the end of the line, and has a lower penalty, and trains always take the path with the lowest penalty.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 14:22
by rowdog
I believe that your "race track" is what is commonly referred to as a cyclotron.
https://wiki.openttd.org/Cyclotron

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 14:41
by MarkShot
Transportman wrote:
MarkShot wrote:If I wanted to try my approach of using a race track pattern with no waiting to pull off the mainline, but to go around ...

Where would I find material on programmable routes such that if a train encountering a Y with two options:

(a) Sideline
(b) Bypass

finds the Sideline blocked, it bypasses and begins a circuit?

Thanks.
You might want to look at this page. It is a bit of complex material, but in your case, it would be reduced to the following:
  1. Set the setting yapf.rail_firstred_twoway_eol in your openttd.cfg to true
  2. Place a two-way signal on your sideline and have the next signal on the sideline be at least one train length ahead
  3. Place a one-way signal on your bypass and continue with the usual signal distance you use on your mainline
What this does, is when your sideline-entry is blocked by a train, all other trains do not consider the sideline because the two-way signal is red and because of the yapf.rail_firstred_twoway_eol-setting, it is considered the end of the line and has an infinite penalty for the pathfinder. Because your mainline has a one-way signal, it is not considered the end of the line, and has a lower penalty, and trains always take the path with the lowest penalty.
Yes, I believe this is the key to doing what I had intended.

Thanks.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 14:44
by MarkShot
Before I retired, I was in management and systems design.

Has anyone tried to reduce these problems to queuing theory and mathematical analysis?

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 19:11
by Transportman
rowdog wrote:I believe that your "race track" is what is commonly referred to as a cyclotron.
https://wiki.openttd.org/Cyclotron
What MarkShot wants is basically the inverted cyclotron. The idea behind the cyclotron is to only allow trains onto the mainline if there is a suitable gap and keep their speed while waiting to keep all trains running at full speed, but in this case, the mainline is the cyclotron and only if the sideline is free trains are allowed to leave.

Re: How to keep the main line (trains) rolling?

Posted: 28 Apr 2019 20:03
by acs121
By the way, you should have quadruple track and 1-tile signal density on your busy lines. If you don't have JGRPP, avoid tunnels and bridges at all costs. Also, your curves shouldn't slow down your trains. Make them the length of your trains (I use 5-tile trains generally so it turns out to be easy for me, but it may be difficult with longer trains).

Re: How to keep the main line (trains) rolling?

Posted: 29 Apr 2019 07:28
by MarkShot
Yes, Transportman has got it.

It is the mainline which must NOT slow or backup. The sidelines are to be viewed as independent subsystems connected to the mainline. So, the mainline traffic should be architected to have traffic of a consistent speed.

I am running OTTD-JGR 0.30.3. So, my bridges and tunnels have signals.

My one concern about the changes proposed below. Will these have a broad impact on many other aspects of the game?
Transportman wrote: You might want to look at this page. It is a bit of complex material, but in your case, it would be reduced to the following:
  1. Set the setting yapf.rail_firstred_twoway_eol in your openttd.cfg to true
  2. Place a two-way signal on your sideline and have the next signal on the sideline be at least one train length ahead
  3. Place a one-way signal on your bypass and continue with the usual signal distance you use on your mainline
What this does, is when your sideline-entry is blocked by a train, all other trains do not consider the sideline because the two-way signal is red and because of the yapf.rail_firstred_twoway_eol-setting, it is considered the end of the line and has an infinite penalty for the pathfinder. Because your mainline has a one-way signal, it is not considered the end of the line, and has a lower penalty, and trains always take the path with the lowest penalty.

Re: How to keep the main line (trains) rolling?

Posted: 29 Apr 2019 17:27
by Transportman
MarkShot wrote:Yes, Transportman has got it.

It is the mainline which must NOT slow or backup. The sidelines are to be viewed as independent subsystems connected to the mainline. So, the mainline traffic should be architected to have traffic of a consistent speed.

I am running OTTD-JGR 0.30.3. So, my bridges and tunnels have signals.

My one concern about the changes proposed below. Will these have a broad impact on many other aspects of the game?
Transportman wrote: You might want to look at this page. It is a bit of complex material, but in your case, it would be reduced to the following:
  1. Set the setting yapf.rail_firstred_twoway_eol in your openttd.cfg to true
  2. Place a two-way signal on your sideline and have the next signal on the sideline be at least one train length ahead
  3. Place a one-way signal on your bypass and continue with the usual signal distance you use on your mainline
What this does, is when your sideline-entry is blocked by a train, all other trains do not consider the sideline because the two-way signal is red and because of the yapf.rail_firstred_twoway_eol-setting, it is considered the end of the line and has an infinite penalty for the pathfinder. Because your mainline has a one-way signal, it is not considered the end of the line, and has a lower penalty, and trains always take the path with the lowest penalty.
It will not have a broad impact, unless you use two-way signals everywhere. But it is very unlikely that you have that as there are very few instances where two-way signals make sense (as they are all block signals, any train in the block will block the entire block) so the only impact on your games is that you need to change all signals where you want to say DON'T GO HERE IF IT IS RED to two-way.

Re: How to keep the main line (trains) rolling?

Posted: 29 Apr 2019 21:40
by Eddi
a less impactful approach would be to use exit signals instead of setting "firstred_twoway_eol", because there is a quite large "firstred_exit_penalty". you might have to do some adjustments to the crossings for this to work, as it is not an infinite penalty, but tweaking that value has a lower chance of destroying the flow elsewehere in your network.

the idea here is that the firstred_exit_penalty would get larger than the combined penalty of one roundtrip to get back to that signal, or through another overflow line, or whatever.