4-way intersections: Throughput and deadlocks [image heavy]

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

4-way intersections: Throughput and deadlocks [image heavy]

Post by aaargha »

0.16 rework in progress
Now that 0.16 feels like it is starting to stabilize it's time to revise parts of this post, mostly regarding deadlocks. As it seems like the pathfinding changes made in 0.15.27 are going to stick I'm going to change the deadlock ratings as all the builds I've seen so far can be signalled to be safe, as long as long as you don't disable stations/break paths.

First out is the updated throughput setup. The new and improved version for 0.16 can be found just above the results.
Regarding the 0.15.27 path-finding changes
With the changes made to the path-finding algorithm in 0.15.27 almost all intersections rated from B to E (inclusive) are safe as long as the player does neither, disable the train station the train is heading to while travelling, nor, destroy/build rails/signals that makes the train's path invalid.

However, as there are still some quirks with the current implementation (to be fixed in 0.16), I will wait for those changes to to be made before I make any drastic changes to this post.
Test details
As a part of trying to break things better understand trains I've started to build a test bench for 4-way intersections. What I thought I'd do here is share the results of my tests and allow people to submit new designs for testing. The tests will currently cover deadlock analysis and, unless it's too deadlocky, throughput. I'll also try to do some signal optimization (mostly pruning redundant signals) and add some notes on if there are things that need to be adjusted when changing train length.

Deadlock analysis
This is pretty much a worst case analysis, the only thing I assume about the rest of the train system is that the output block is properly sized. Trains are allowed to change path at the worst time, basically I'll do my best to make it break. While this is mostly manual analysis I will provide examples of any deadlock from my tests if I'm able.
Here is how I grade how "deadlockable" an intersection is.
  • A - Safe, will not be the source of a deadlock
  • B - Can deadlock if more than one train changes path inside the intersection, may resolve itself if output block becomes free
  • C - Can deadlock if more than one train changes path inside the intersection, requires player to resolve
  • D - Can deadlock if a train changes path in the intersection, may resolve itself if output block becomes free
  • E - Can deadlock if a train changes path in the intersection, requires player to resolve
  • F - Can deadlock in regular traffic, usually caused by loops that can be saturated
Note that all this goes out the window if you don't use large enough output blocks.
Also note that in reality B pretty much as good as A. Any problems will be very rare (unless you're super unlucky with your rail system design) and are likely to resolve themselves pretty quickly. C is very close behind as problems are still exceedingly rare, they may require the player to step in though.

Throughput testing
For throughput testing I've written a mod to spawn in trains as needed to ensure a good enough saturation of all input lanes (about 29.35 trains per minute for each input lane, which should be full saturation as the trains can't travel closer to each other). The trains have a randomized destination to make them go straight or turn left/right, the probability of each direction can be controlled by assigning different direction different weights. Each test consists of one run of each set:

Set 1:
Left: 33.3%
Right: 33.3%
Straight: 33.3%

Set 2 (for left hand drive)
Left: 35%
Right: 15%
Straight: 50%

Set 2 (for right hand drive)
Left: 15%
Right: 35%
Straight: 50%

Set 1 is equal probability. Set 2 is to simulate a more "realistic" usage situation where the player has planned the routes a bit.

All tests are done using fully upgraded 2-4 trains running on rocket fuel.

I let it run for 15 min while counting how many trains exit the intersection. When the time is up I calculate the average throughput in trains/min. Note that this is not too exact and small measured differences between intersections may not really mean that much.

For intersections that require lane changers I'm using these that are designed by Tallinu. (Note that I only have 4-lane versions so if your 6-/8-lane design needs lane changers you need to design them yourself)

Notes
If there is a design you want me to test that is not already covered just give me a blueprint string of your intersection. I'm always looking for more meat for the grinder new and interesting designs.

Thought of a good test to add, let me know and I'll see if I can make it work.

Are you the creator of any of the designs here? Most of these are intersections I've tested for various threads so just shoot me a link to the original post and I'll add some credits.

This message is sponsored by Creative mode, /u/RattlemBones train counter(0.15 blueprint string), (self plugging intensifies) Screenshot camera and, (it's getting even worse) Automatic train deployment

Some good resources on signalling and deadlocks.

Try it for yourself
If you want to try things out for yourself take a look at the attached save below. For usage instructions see the thread for the mod or the thread linked below.
V2 for 0.16
V1 for 0.15
A savefile with an older version of the test setup, among lots of other tests, can be found here.
Results
Grouped by deadlock rating and roughly sorted by throughput. Names are basically just some bullshit to keep them apart. To see the full images (rendered at 0.5 zoom) just open them in a new tab.

Deadlock examples can be found here
Changelog
8-lane
A
Multi-cross
Flower MK3
Christmas
Compact christmas
Square twister
B
Spiral
D
Reverse roundabout
6-lane
Christmas
4-lane
A
Multi-cross
Flower MKII
Flower
Semi-cross 8-car
Alternating cross
Traditional
Fresh cross MK2
Christmas
Switching Christmas
Wavy
Simple
Adapted wide
B
Spiral
Parentheses
New Gauge Interchange
C
Almost squareabout OCD
Almost squareabout
Double squareabout
D
Encircled knot
Quadabout
Proper doubleabout
Doubleabout
2-lane
A
Pasta MKIII
Pasta MKII
Windmill MK2
Multi-Cross
Inscribed square
Whirlpool
Pasta
Propeller
Windcross
Cross
Windmill
Buffered compact attempt
2x high-perf-3-way
Spinabout v3
Spinabout
Shuriken
Compact
Crushed Celtic knot
Compact Celtic knot
Super compact Celtic knot
Wide
Wide B
Pleasing
Crushed Wide
2x 3-way
Knot
R-twister
Buffered roundabout MK2
Compact spiral
Chunk-aligned cross
Compact attempt
Compact cross
Double diamond
Direct cross
Roundabout safe
B
Braid
Spiral
Wide crossover
Rotary
Buffered roundabout
Minimal
Curly
C
Squareabout
D
Cloverleaf
Improved-er reverse roundabout
Encircled compact
No Gods
Crossabout
Reversed roundabout
Roundabout
E
Nothing here yet.
F
Magic-roundabout
Priority roundabout
No left
Double wide bubble cross
Last edited by aaargha on Tue Jan 09, 2018 9:09 pm, edited 57 times in total.
Zonk
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Tue Jul 12, 2016 12:05 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by Zonk »

Wew nice work!
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by AndrewIRL »

Wow, great work.

In terms of throughput / (rails used x space) then it looks like the compact is the best. Still, my favourite is the r-twister because it looks pretty!
Shokubai
Filter Inserter
Filter Inserter
Posts: 470
Joined: Mon May 02, 2016 3:17 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by Shokubai »

These are awesome. Great work.

Am curious...the center sections of your cross seem to be missing several chain signals to break up the blocks. At a glance it looks like your N-S/E-W traffic would block trains moving the opposite way through.


Also damn your left hand drive :)
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by aaargha »

Shokubai wrote:These are awesome. Great work.

Am curious...the center sections of your cross seem to be missing several chain signals to break up the blocks. At a glance it looks like your N-S/E-W traffic would block trains moving the opposite way through.
I think it's about as good as it can get, some of the blocks look a bit large but in those blocks the rails cross so they'll block each other anyway. N-S/E-W traffic runs fine for opposing trains as far as I can tell. However, if you spot a missing signal somewhere I'll take a look.
Shokubai wrote:Also damn your left hand drive :)
Hehe, it kinda ended up like that as the deadlock tester I built was for LHD, now that my systems can handle both I really should get to including more RHD variants as well. Currently I only have the squareabout (which can't be converted as is to LHD).
iceman_1212
Filter Inserter
Filter Inserter
Posts: 256
Joined: Wed Aug 17, 2016 9:49 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by iceman_1212 »

Very nice

p.s. i laughed when i saw the curly intersection :lol:
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by impetus maximus »

about throughput...
ask yourself, how many trains can be going in different directions at once in the four way intersection?
if it's less than three (max), you should rethink your intersection. ;)
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by aaargha »

Thanks for the kind words!

I've updated the post with RHD variants for most intersections. I'll have to take a look at a few of the ones left to see if it's possible to fit the signals in some reasonable manner.
impetus maximus wrote:about throughput...
ask yourself, how many trains can be going in different directions at once in the four way intersection?
if it's less than three (max), you should rethink your intersection. ;)
I feel like I'm misunderstanding you but wouldn't that depend on which directions the trains are comping from and which exit each train is taking?
For example (in an LHD system) most intersections allow four trains to turn left at the same time, one from each direction. Going straight ahead or turning right is at best two as the paths intersect. And for most designs it's possible to do combinations more or less well. For the Cross design it's possible (if it all lines up) to have four trains turning left while two trains can go right/straight allowing for a six train "burst", so to speak.

Gah, time to stop over analysing and go to sleep.
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by impetus maximus »

i don't know what a LHD is. load haul dump?

i'm saying for a 4 way intersection of a two way rail system (not double two way etc) AT MOST in a best case scenario, three trains should be able to pass each other without stopping. of course depending on the direction trains having to cross other lines this can, and will be less.
iceman_1212
Filter Inserter
Filter Inserter
Posts: 256
Joined: Wed Aug 17, 2016 9:49 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by iceman_1212 »

impetus maximus wrote:i don't know what a LHD is. load haul dump?
left hand drive
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by impetus maximus »

of course. lol thanks iceman_1212. i should know that, i use left hand drive (live in the US)
Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by Aeternus »

I'm surprised that the basic direct cross isn't on here:
Image
Compact, can't deadlock since the entire intersection is one block, but very low throughput. Should be used on low-traffic sections that you don't want to risk jams at (rail sections far away from your main factory that just service some mining outposts).
Shokubai
Filter Inserter
Filter Inserter
Posts: 470
Joined: Mon May 02, 2016 3:17 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by Shokubai »

Aeternus wrote:I'm surprised that the basic direct cross isn't on here:
****
Compact, can't deadlock since the entire intersection is one block, but very low throughput. Should be used on low-traffic sections that you don't want to risk jams at (rail sections far away from your main factory that just service some mining outposts).
Bad signaling...Too large of a block. Max 1 train anywhere in the intersection?
Also you need standard signals instead of chains on the exits.
Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by Aeternus »

Yea, that was an old screeny. Entrance chain, exit standard signals. The whole thing is a single block by design. As I said, very basic, low thoughput, but very safe. Use in low traffic areas only, where only deadlock resilience is a must.
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by impetus maximus »

here is the left side drive, 4-way intersection i came up with. i moved the left turns to the outer part so up to three trains can pass each other.
yes, she's a big one.
its.my.4way.png
its.my.4way.png (1.01 MiB) Viewed 526559 times
i ran 2 trains from each direction, going to each direction. 12 total for 24+ hours. 0 deadlocks.
i use double headed trains. these singles are just to Illustrate direction.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by aaargha »

Another small update: Added example pictures of deadlocks for any intersection not rated A. Tested the Direct cross intersection. Finished making RHD blueprints for all intersections that do not require major restructuring to fit signals where I need to.
impetus maximus wrote:here is the left side drive, 4-way intersection i came up with. i moved the left turns to the outer part so up to three trains can pass each other.
yes, she's a big one.
its.my.4way.png
i ran 2 trains from each direction, going to each direction. 12 total for 24+ hours. 0 deadlocks.
i use double headed trains. these singles are just to Illustrate direction.
That design is tested, look at "Wide crossover". The flaw with this design, in my eyes, is that the right turn cross more paths than needed, two trains cannot turn left right at the same time. For an improved variant take a look at "Wide". If you want to see how your intersection can deadlock there is and example picture linked in the OP.

Also, if you're the creator of this design, and want to be sourced for it, send me a link to the original post and I'll add it as source.
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by impetus maximus »

aaargha wrote: That design is tested, look at "Wide crossover". The flaw with this design, in my eyes, is that the right turn cross more paths than needed, two trains cannot turn left right at the same time. For an improved variant take a look at "Wide". If you want to see how your intersection can deadlock there is and example picture linked in the OP.

Also, if you're the creator of this design, and want to be sourced for it, send me a link to the original post and I'll add it as source.
i'll see if i can improve it. i posted that design on April 3rd. ;)
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by aaargha »

Added a few more LHD/RHD blueprints. All intersections, except the roundabouts and 2x 3-way, now have blueprints for both LHD and RHD.
impetus maximus wrote:i'll see if i can improve it. i posted that design on April 3rd. ;)
Thanks, I don't really remember where I've found all of them:)
zytukin
Fast Inserter
Fast Inserter
Posts: 215
Joined: Sat Mar 12, 2016 12:14 am
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by zytukin »

Posted this on your reditt topic but will post here as well.
Image

I don't use 4 ways anywhere in my factory so don't actually use this.
This came from modifying the standard T intersection I use everywhere in my factory which I carried over to my 0.15 factory from my 0.14 factory.
When the original T intersection was used in my 0.14 factory, I never had a dead lock despite having 200+ trains running at once, including when I sent 40 trains to get copper and iron at once when I started a Green Circuit production area.

As it is pictured it is signaled for my current factory's 2-8 trains.



For the sake of reference, this is the T intersection that I use. Pic is from my 0.14 fac and it's signaled for the 1-4 trains it used.
Image
User avatar
Distelzombie
Filter Inserter
Filter Inserter
Posts: 336
Joined: Tue May 02, 2017 4:27 pm
Contact:

Re: 4-way intersection testing: Throughput and deadlocks

Post by Distelzombie »

Great work!
This one is not in your list. It is similiar to the basic direct cross, but its bigger and has signals.
As far as i know its made by maurojunior2011, but i've seen it in other threads too.
Blueprint
Attachments
4-way.png
4-way.png (1.04 MiB) Viewed 525677 times
Complete 2-Lane system as a Blueprint-Book! The perfect OCD reactor? Testing chained science lab efficiency Please use real prefixes and proper rounding!
Locked

Return to “Railway Setups”