## Single rail train network

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?

### Re: Single rail train network

how cheap depends on the world.

impetus maximus
Smart Inserter

Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm

### Re: Single rail train network

Optera wrote:
mrvn wrote:
Optera wrote:Rule of thumb for train networks in factorio:
Use block signals only at entrances to blocks safe for trains to wait and chain signals everywhere else.

Adhering to that rule i see no way a single track setup would ever deadlock. Throughput will be terrible though.

It is simple to deadlock. Example: You have 2 trains in stations. You have 2 trains trying to reach the same 2 stations sitting in the last bypass before those stations. You have trains in every other bypass between those two stations. Minimum for this is 4 trains total.

But it's the basic problem of having more trains trying to reach a station than can fit in that station. Waiting bays will solve this.

If you only use block signals at the entrance to a safe waiting bay and chain signals everywhere else it can't deadlock unless you have more trains than waiting areas.
2017-07-13-14-51-45-1224483.jpg

Wrong. You can have a million bypasses (what you showed isn't a waiting bay) and a million stations and just 4 trains can deadlock. It's a problem of a series of trains forming a loop all waiting on the next train. With trains going 2 ways the minimum number of trains to block is determined by the 2 stations closest together (with a train stopping at both), not the overall size of the network.

But, as said, this is best avoided by designing all stations in such a way that all trains with that destination can be inside the station at one time. If the station has enough waiting bays then trains can't deadlock the main tracks.
mrvn
Smart Inserter

Posts: 2046
Joined: Mon Sep 05, 2016 9:10 am

### Re: Single rail train network

vanatteveldt wrote:I expect that it might even make sense to have lines going out to outposts be single track. If you use large trains (say 8 wagons) the frequency can be fairly low anyway, and have no waiting bays at all between outpost and trunk line.

(I guess the real problem is that laying track is simply so cheap that you might as well just double track everything...)

Having single lines going to an outpost also has the advantage that you naturally limit the number of trains going to that outpost. So you can name every iron mine station "iron mine" and the signaling will prevent all trains going to the same station and instead spread to all mines. If you signal them correctly that is.

But that is a totally different story from having single rail lines as you main bus.
mrvn
Smart Inserter

Posts: 2046
Joined: Mon Sep 05, 2016 9:10 am

### Re: Single rail train network

Xtrafresh wrote:Pet peeve time: OP asks HOW to accomplish a certain task, and the forums erupt in a discussion about why it's a bad idea

While a fair pet peeve, I think if someone asks "how do I do X" and X is really bad idea, "X is a really bad idea" is a fair answer.
Laziest Bastard Mod or Let's Play
"So you launched a rocket in a spaghetti factory? Well I hand crafted a rocket and threw it into space with my bare hands!"

5thHorseman
Filter Inserter

Posts: 383
Joined: Fri Jun 10, 2016 11:21 pm

### Re: Single rail train network

5thHorseman wrote:
Xtrafresh wrote:Pet peeve time: OP asks HOW to accomplish a certain task, and the forums erupt in a discussion about why it's a bad idea

While a fair pet peeve, I think if someone asks "how do I do X" and X is really bad idea, "X is a really bad idea" is a fair answer.

Someone who has random urges to make mog juice isn't exactly going to care about the cost effectiveness of obtaining it.
vanatteveldt
Filter Inserter

Posts: 828
Joined: Wed Nov 25, 2015 11:44 am

### Re: Single rail train network

First I thought I will help with designing such network.
Then I had some time to think about it.
Then I found the task is impossible to handle.
All this bypasses only work on a point to point deliveries. And the limit is that your single bypass should be able to hold (N-1) trains then it will work w/o deadlocks.
However this starts to make no sense after you get 3 trains or more.
And there is a real complication with handling intersections.
At the point where your whole system holds 4+ trains all this bypass crap starts to make no sense at all turning your system into something containing only bypasses of huge size.

There are two methods available.
Here are general rules:
- All single rail fragments (and intersections) should have no signals. The only signals in the system are ones in the bypasses.
- All single rail fragments (and intersections) should have bypasses on all exits.

Method 1:
- Bypass should be able to hold N-1 trains in any direction where N is the number of trains passign through this bypass. This means it should be long and contain N-1 sections for trains divided by signals.
- You do not need any chain signals here at all. Basicly take Optera's design and replace chain signals with nornal ones.

Method 2:
You can also use Optera's design. In this case every straight block of your system (w/o intersections) should have N-1 bypasses.

P.S. The idea is still really bad.
PacifyerGrey
Filter Inserter

Posts: 919
Joined: Wed Jun 29, 2016 10:02 am

### Re: Single rail train network

5thHorseman wrote:
Xtrafresh wrote:Pet peeve time: OP asks HOW to accomplish a certain task, and the forums erupt in a discussion about why it's a bad idea

While a fair pet peeve, I think if someone asks "how do I do X" and X is really bad idea, "X is a really bad idea" is a fair answer.

Except, of course, that it's not universally a bad idea. It's a bad idea for megabases, high throughput, high train counts. It's an excellent idea for long train lines with very few trains, especially if your resources for building tracks are limited (e.g. early game marathon mode).

If you're going to assert that "X is a really bad idea" make sure you think about (and write about) the assumptions you're making when deciding it's a bad idea.
Selvek
Fast Inserter

Posts: 174
Joined: Fri May 06, 2016 4:04 am

### Re: Single rail train network

mrvn wrote:
Wrong. You can have a million bypasses (what you showed isn't a waiting bay) and a million stations and just 4 trains can deadlock. It's a problem of a series of trains forming a loop all waiting on the next train. With trains going 2 ways the minimum number of trains to block is determined by the 2 stations closest together (with a train stopping at both), not the overall size of the network.

Can you post a screenshot of how this deadlock happens?
Selvek
Fast Inserter

Posts: 174
Joined: Fri May 06, 2016 4:04 am

### Re: Single rail train network

Selvek wrote:It's a bad idea for megabases, high throughput, high train counts.

i.e., networks.

It's an excellent idea for long train lines with very few trains

i.e., not a network.

If you're going to assert that "X is a really bad idea" make sure you think about (and write about) the assumptions you're making when deciding it's a bad idea.

I did, and will make sure to keep doing so in the future.
Laziest Bastard Mod or Let's Play
"So you launched a rocket in a spaghetti factory? Well I hand crafted a rocket and threw it into space with my bare hands!"

5thHorseman
Filter Inserter

Posts: 383
Joined: Fri Jun 10, 2016 11:21 pm

### Re: Single rail train network

Selvek wrote:
mrvn wrote:
Wrong. You can have a million bypasses (what you showed isn't a waiting bay) and a million stations and just 4 trains can deadlock. It's a problem of a series of trains forming a loop all waiting on the next train. With trains going 2 ways the minimum number of trains to block is determined by the 2 stations closest together (with a train stopping at both), not the overall size of the network.

Can you post a screenshot of how this deadlock happens?

You can build it yourself. Just have 2 stations A and B with a single bypass in between them and add 4 trains with A and B as destinations. You get one train at each station and 2 in the bypass and then its a deadlock.
mrvn
Smart Inserter

Posts: 2046
Joined: Mon Sep 05, 2016 9:10 am

### Re: Single rail train network

mrvn wrote:
Selvek wrote:
mrvn wrote:
Wrong. You can have a million bypasses (what you showed isn't a waiting bay) and a million stations and just 4 trains can deadlock. It's a problem of a series of trains forming a loop all waiting on the next train. With trains going 2 ways the minimum number of trains to block is determined by the 2 stations closest together (with a train stopping at both), not the overall size of the network.

Can you post a screenshot of how this deadlock happens?

You can build it yourself. Just have 2 stations A and B with a single bypass in between them and add 4 trains with A and B as destinations. You get one train at each station and 2 in the bypass and then its a deadlock.

That's 4 waiting bays blocked by 4 trains, not a million waiting bays blocked by 4 trains.
For trains to move on such a simplistic train line: train capacity = waiting bays - 1.
My Mods:

Optera
Smart Inserter

Posts: 1481
Joined: Sat Jun 11, 2016 6:41 am
Location: Österreich

### Re: Single rail train network

I did state that at every straight segment of your system you got to have N-1 bypasses where N is a number of trains passing through this segment.
This means that for 1 bypass you can only use 2 trains. For 4 trains you got to add 3 bypasses.

Or you can add a multistop station at every end with number of stops equal to the number of trains. In this case it won't deadlock ever but trains will be mostly waiting. Adding Optera's bypasses will increase throughput.
PacifyerGrey
Filter Inserter

Posts: 919
Joined: Wed Jun 29, 2016 10:02 am

### Re: Single rail train network

Optera wrote:
mrvn wrote:
Selvek wrote:
mrvn wrote:
Wrong. You can have a million bypasses (what you showed isn't a waiting bay) and a million stations and just 4 trains can deadlock. It's a problem of a series of trains forming a loop all waiting on the next train. With trains going 2 ways the minimum number of trains to block is determined by the 2 stations closest together (with a train stopping at both), not the overall size of the network.

Can you post a screenshot of how this deadlock happens?

You can build it yourself. Just have 2 stations A and B with a single bypass in between them and add 4 trains with A and B as destinations. You get one train at each station and 2 in the bypass and then its a deadlock.

That's 4 waiting bays blocked by 4 trains, not a million waiting bays blocked by 4 trains.
For trains to move on such a simplistic train line: train capacity = waiting bays - 1.

I didn't say you can only have 2 stations or that one bypass. Just somewhere in you fast rail network have such a constelation.
mrvn
Smart Inserter

Posts: 2046
Joined: Mon Sep 05, 2016 9:10 am

### Re: Single rail train network

PacifyerGrey wrote:I did state that at every straight segment of your system you got to have N-1 bypasses where N is a number of trains passing through this segment.
This means that for 1 bypass you can only use 2 trains. For 4 trains you got to add 3 bypasses.

Or you can add a multistop station at every end with number of stops equal to the number of trains. In this case it won't deadlock ever but trains will be mostly waiting. Adding Optera's bypasses will increase throughput.

If you have too many trains for your stations then some will stay in bypasses and block the flow. It doesn't matter how many bypasses you have they will be stuck and prevent any train from passing them. With enough bypasses they will not deadlock but will slow down the throughput to be useless. On the other hand if you never have more trains going to a station than the station can hold (including stacks aka waiting bays) then you don't need as many bypassed between stations. For 4 trains 2 bypasses are enough to prevent deadlocks. Bu if no 2 trains have the same destination then 0 bypasses is deadlock free too.

The idea of the bypass is not to buffer trains waiting to enter a station but to let trains going in opposite direction pass each other. You don't even need one bypass per pair of stations. Every couple of stations is enough. Can limit the throughput though.
mrvn
Smart Inserter

Posts: 2046
Joined: Mon Sep 05, 2016 9:10 am

### Re: Single rail train network

mrvn wrote:
PacifyerGrey wrote:I did state that at every straight segment of your system you got to have N-1 bypasses where N is a number of trains passing through this segment.
This means that for 1 bypass you can only use 2 trains. For 4 trains you got to add 3 bypasses.

Or you can add a multistop station at every end with number of stops equal to the number of trains. In this case it won't deadlock ever but trains will be mostly waiting. Adding Optera's bypasses will increase throughput.

If you have too many trains for your stations then some will stay in bypasses and block the flow. It doesn't matter how many bypasses you have they will be stuck and prevent any train from passing them. With enough bypasses they will not deadlock but will slow down the throughput to be useless. On the other hand if you never have more trains going to a station than the station can hold (including stacks aka waiting bays) then you don't need as many bypassed between stations. For 4 trains 2 bypasses are enough to prevent deadlocks. Bu if no 2 trains have the same destination then 0 bypasses is deadlock free too.

The idea of the bypass is not to buffer trains waiting to enter a station but to let trains going in opposite direction pass each other. You don't even need one bypass per pair of stations. Every couple of stations is enough. Can limit the throughput though.

You are right about the purpose of the bypass.
Later in the evening when I'll get to my factorio I will post an image of what I mean and you will see it work without deadlocks.
The main concept here is that all single rail fragments should be a single block and should not contain any signals at all. This will prevent trains from entering them from opposite directions forming a deadlock
PacifyerGrey
Filter Inserter

Posts: 919
Joined: Wed Jun 29, 2016 10:02 am

### Re: Single rail train network

5thHorseman wrote:
Selvek wrote:It's a bad idea for megabases, high throughput, high train counts.

i.e., networks.

It's an excellent idea for long train lines with very few trains

i.e., not a network.

If you're going to assert that "X is a really bad idea" make sure you think about (and write about) the assumptions you're making when deciding it's a bad idea.

I did, and will make sure to keep doing so in the future.

Network: "a group or system of interconnected people or things"
The word "network" makes no assumptions about the number of interconnected things, or their density... so I'm not sure I follow your logic. Also, I'm sorry if I missed a post where you explained your assumptions, but I've been looking and I still can't find it!
Selvek
Fast Inserter

Posts: 174
Joined: Fri May 06, 2016 4:04 am

### Re: Single rail train network

Jarin wrote:So I've been looking through rail network tutorials, and have a pretty solid grasp on the basics, but every guide and discussion seems to work on the assumption that you have one rail going each direction, requiring two full tracks to any destination. I'm trying to make a fully operational train network that can handle multiple trains, but using only one track; with bypasses for trains going opposite directions. Are there any discussions or guides out there on this topic? Search has been failing me (or I've been failing it; whatever).

I think the first reply pretty much nailed it that you'll find once you start adding bypasses to resolve problems you'll find yourself having 2 or more tracks =p And somewhat unintuitively, you'll actually need far more bidirectional tracks to support the equivalent function of a dedicated 2 unidirection track system.

That said I encourage you to try, it can be fun! and it'll give you a much better understanding of why you'd want to use 2 tracks than the people who just start that way.
Ripshaft
Inserter

Posts: 45
Joined: Tue May 23, 2017 9:09 pm

### Re: Single rail train network

Selvek wrote:Network: "a group or system of interconnected people or things"
The word "network" makes no assumptions about the number of interconnected things, or their density... so I'm not sure I follow your logic. Also, I'm sorry if I missed a post where you explained your assumptions, but I've been looking and I still can't find it!

I wholeheartedly apologize for assuming the OP wanted a fully operational train network that can handle multiple trains, but using only one track. I don't know where I got that. Maybe from this:

Jarin wrote:I'm trying to make a fully operational train network that can handle multiple trains, but using only one track

I now see that for me, "Multiple" means dozens of trains supplying many stations in a fully functional base, but you're right he probably just wants 2 or 3 trains going back and forth to a remote outpost that he's networking into his main base where the actual work is being done. I will refrain from juxtaposing my own biased interpretation any further.
Laziest Bastard Mod or Let's Play
"So you launched a rocket in a spaghetti factory? Well I hand crafted a rocket and threw it into space with my bare hands!"

5thHorseman
Filter Inserter

Posts: 383
Joined: Fri Jun 10, 2016 11:21 pm

### Re: Single rail train network

hm okay I noticed that in the 2 pages there aren't actually many useful bits of information on assembling a bidirectional track...

Think I can help with that.. well, sorta, it's actually extremely simple. You really don't have any options in rail design, in general - for bidirectional tracks, you have essentially segments of line between stations. There can be no signals along the line from one point of [dis]embarkation or you will get jams, there's no avoiding this part of things. Any bypass you have must also be bidirectional or there's no point to it, which I think is one of the few constructive points I've seen here as we get deep into the philosophy of traintracks =p

Though really it's not that hard to have a bidirectional track system that works just fine, even on fairly large builds, but the lack of throughput restricts your train usage... small numbers of very large trains are your friend when you do this.
Ripshaft
Inserter

Posts: 45
Joined: Tue May 23, 2017 9:09 pm

### Re: Single rail train network

5thHorseman wrote:
Selvek wrote:Network: "a group or system of interconnected people or things"
The word "network" makes no assumptions about the number of interconnected things, or their density... so I'm not sure I follow your logic. Also, I'm sorry if I missed a post where you explained your assumptions, but I've been looking and I still can't find it!

I wholeheartedly apologize for assuming the OP wanted a fully operational train network that can handle multiple trains, but using only one track. I don't know where I got that. Maybe from this:

Jarin wrote:I'm trying to make a fully operational train network that can handle multiple trains, but using only one track

I now see that for me, "Multiple" means dozens of trains supplying many stations in a fully functional base, but you're right he probably just wants 2 or 3 trains going back and forth to a remote outpost that he's networking into his main base where the actual work is being done. I will refrain from juxtaposing my own biased interpretation any further.

Ok. Fair enough.

In my first ever playthough of the game, I built a fully operation train network (no deadlocks) that could handle multiple trains (in my case, 3 trains servicing about 5 mining outposts because the oil train visited several outposts) but using only one track (and maybe a half dozen bypasses, plus inherent bypasses at stations). My goal in that playthrough was to launch a single rocket, and I accomplished it easily without straining the single track system. My base was also fully functional (even though it was a horrible spaghetti mess... but I digress).

With the assumption that multiple means "dozens", I fully agree with you. But even my current base, which is, umm, slightly larger than my first playthrough (that is, ~1-2x all science/sec + massive module production for my next expansion) is only using maybe 16 trains... "dozens" seems like a pretty high assumption.
Selvek
Fast Inserter

Posts: 174
Joined: Fri May 06, 2016 4:04 am

PreviousNext