Is a train junction parallel multiplexer possible?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
dongeddis
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Sep 02, 2023 2:09 pm
Contact:

Is a train junction parallel multiplexer possible?

Post by dongeddis »

You have a junction with two independent train lines coming in, and two possible destination lines out. (Or, in general, NxM MUX.) It's easy enough to allow any input train to choose to go to any output track. It's easy to avoid collisions, by having chain signals prior to the junction, and rail signals after the junction. That "locks" the junction itself, for one train at a time.

The question is: is it possible to build a MUX junction, that multiple trains can use simultaneously (assuming they're interested in different destinations)? Without collisions?

The use case is a giant trainyard. All the trains, with different ores, come into my "waiting area". Then any train can get to its correct ore dropoff location. But, as my factory grows, and the number of simultaneous trains grow, I've noticed that they're all waiting too long at the waiting area, even though there are dropoff stations waiting to take their ore ... all because the connection between the waiting and the dropoff has turned into a bottleneck. Only one train can transition from waiting to a dropoff station at a time.

So I was wondering if I could build some kind of clever "multiplexer" in the middle, that would allow 20x trains to come from anywhere in the train waiting area, and allow any of those trains to connect to any of the (ore-specific) dropoff stations that it wanted ... but also allow multiple trains to enter the MUX at the same time, if they happened to come from different places and be heading to different stations.

But I tried to build such a thing myself, and have come close to concluding that it actually isn't possible. Am I right about that? Or did I miss something, and one of you knows a trick to building such a "parallel MUX junction"?

NineNine
Fast Inserter
Fast Inserter
Posts: 102
Joined: Mon Oct 24, 2022 11:20 pm
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by NineNine »

It seems that you're describing a roundabout. You can make them as large as you'd like, and multiple trains can use it at the same time if you have the correct signals, with no collisions.

dongeddis
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Sep 02, 2023 2:09 pm
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by dongeddis »

Huh. I did not make that connection, since I really have all the trains coming from one side, and all exiting on the other side. But the more I think about it ... the more I think you're probably right.

Here (attached) was my own guess. It "kind of" works ... in the sense that, once in awhile, when I get lucky, a new train will enter the junction before the previous train has completed exited.
IMG_8397.jpg
IMG_8397.jpg (1.23 MiB) Viewed 1246 times
But, with your hint, now I think you're right. In many ways, the problem I wanted to solve is essentially the problem of a huge roundabout. Just all the inputs on one side, and all the outputs on the other. But maybe based off something like this:
ra.jpg
ra.jpg (111.6 KiB) Viewed 1246 times
Thanks for the suggestion.

sparr
Smart Inserter
Smart Inserter
Posts: 1359
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by sparr »

dongeddis wrote:
Fri Dec 29, 2023 12:37 am
It's easy to avoid collisions, by having chain signals prior to the junction, and rail signals after the junction. That "locks" the junction itself, for one train at a time.

The question is: is it possible to build a MUX junction, that multiple trains can use simultaneously (assuming they're interested in different destinations)? Without collisions?
This is doable quite simply. You just need to add signals between the different paths within the junction, so trains passing through only reserve ("lock") the blocks they need.

Here's a 4 to 6 junction. It's not an optimal layout, and I forgot a few signals, but it should get the idea across.
factorio-4-6-mux-min.png
factorio-4-6-mux-min.png (22.59 KiB) Viewed 1143 times

Tertius
Filter Inserter
Filter Inserter
Posts: 820
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by Tertius »

If you want to optimize such a station + waiting area setup, think in rail blocks. One block can be occupied by one train only, and if the only path from the waiting area to the station contains an occupied block, a waiting train will not start (in case you're separated blocks with chain signals).
You see the blocks colored, if you hold a signal in hand.
Investigate each block that contains some crossing. Imagine this block is occupied. Is this blocking other possible paths that don't need to be blocked? For example, is this blocking some junction? In this case, divide this block into two or even more blocks.

It's difficult to see, but it seems the long exit lane of your stacker is one big block. Divide it into multiple blocks, one part per stacker lane. You have a generous spacing, so it should be possible to put a signal between each stacker exit, separating each exit from its neighbors. So if there is one train just leaving and at the end of the long exit lane, another train would be able to also enter that exit lane and use one of the shortcut exits you added.

dongeddis
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Sep 02, 2023 2:09 pm
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by dongeddis »

Thanks, guys. I think I get it now. I should have a LOT more space in between my wait area and my drop off area, and then build something like sparr's 4-to-6 mux junction (but perhaps scale it up to 20-to-10 or something). I can see now how that would work. Much appreciated!

Nidan
Filter Inserter
Filter Inserter
Posts: 252
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by Nidan »

dongeddis wrote:
Sat Dec 30, 2023 1:42 am
Thanks, guys. I think I get it now.
Maybe, maybe not…
I should have a LOT more space in between my wait area and my drop off area, and then build something like sparr's 4-to-6 mux junction (but perhaps scale it up to 20-to-10 or something).
Not necessarily. Depending on how many trains go to each station, it might make sense to split the waiting area into several smaller ones that only serve some of the stations, as result the trains already sort themselves when entering the waiting area.

The main issue I spot in your screenshot is some missing signals that hurt performance. This is, I think, what sparr was hinting at and Tertius tried to explain in more detail. I can't see any signals for the track exiting the waiting area (marked in purple), so only one train can be there at any given point in time. The track for entering the stations has some signals, but every connection from the waiting area exit also blocks the two stations preceding it. Without changing your current layout I'd place a signal each on the straight tracks north of every waiting area to station connection (marked in green).
rail.jpg
rail.jpg (543.7 KiB) Viewed 1078 times

dongeddis
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Sep 02, 2023 2:09 pm
Contact:

Re: Is a train junction parallel multiplexer possible?

Post by dongeddis »

Yes, agreed. I actually put chain signals pretty much everywhere. It works as suggested.
IMG_8432.jpg
IMG_8432.jpg (2.06 MiB) Viewed 1035 times
If I were starting over from scratch, I might leave much more space between the waiting area and the drop off area, and build a more symmetric "christmas tree" MUX junction, like sparr suggested. But I wonder if that would actually only be a little bit better than what I managed to squeeze in, at the cost of very much more space.

Post Reply

Return to “Gameplay Help”