Trains: 2 lane 2 way

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
killerrabbit
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Mar 23, 2024 2:11 pm
Contact:

Trains: 2 lane 2 way

Post by killerrabbit »

Does anyone have any good resources on 2 lane 2 way train designs? I kinda want to attempt this (I recognize the throughput limitations this will have, it basically turns everything into an intersection)

I'd like to dynamically have both lanes switch what direction they allow. that is if one train is on the track other trains are allowed to follow in the same direction. turning this into a quasi two lane design but dynamically changing (from RHD to LHD) depending on the first train into an empty lane. yes this is overcomplicated and probably not worth it. I'm attempting to avoid bypass lanes as well.

I'm thinking this is going to require some circuit magic to get working.

I'm stuck because I need a circuit timer that will turn off a rail signal for a period of time on the other track (block trains from going the same direction on the other rail). I can delay turning it red when the condition is met, but I can't get it to stay red for 30 seconds after the condition is met.

I'll add some pictures later of my designs when I'm not on my phone

Koub
Global Moderator
Global Moderator
Posts: 7204
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Trains: 2 lane 2 way

Post by Koub »

[Koub] Moved to Gameplay Help
Koub - Please consider English is not my native language.

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trains: 2 lane 2 way

Post by mrvn »

Something like this?
timed-signal.png
timed-signal.png (126.35 KiB) Viewed 360 times


The combinators on the left produce a 1 tick pulse "P" when the combinator is turned on. It's important that the pulse is exactly one tick. On the right is a clock that counts down and turns the signal red when T > 0. Every time a pulse hits 1800 ticks are added to the clock. Making it reset to 1800 ticks on every pulse regardless at what count it currently is would also be possible. Or only set the clock when it is run down. Depends on what you need.

Some thoughts:

1) You can't stop a train with it's breaking point past the signal by turning it red. But the signal will remain red when the train has past.
2) This idea fits a single track better.
3) You should turn the track uni-directional when a train enters and keep it that way for a given time only. Otherwise both tracks will switch to one direction and then possibly never switch back.
4) You should switch the track back to bi-directional when there is no train on it. Possibly only after a short delay.
5) With traffic going both way in sufficient quantity to warrant 2 tracks I bet both tracks will simply pick a direction and stay that way forever.
6) You should only switch the second track to the same direction as the first when the first has too many trains on it. Switching back to a single track if the flow of trains goes below the threshold might also be a good idea.
7) When 2 tracks are going in the same direction and the time limit expires only switch one track back and force it to the other direction (contidional on trains waiting on the other side?)

(Arbitrarily picking left/right as track directions from here on)

I would think of it as a state machine with 3 states: 2 left - left/right - 2 right

The base state is having one track go left and the other go right. On both ends you add a buffer for incoming and outgoing trains. If the incoming buffer on the left is sufficiently larger than on the right then switch to "2 left" state. If the imbalance is the other way then switch to "2 right" state. Otherwise if there are trains waiting on the left or right go back to the "left/right" state.

Note: You can subtract the trains in the outgoing buffer from the corresponding incoming buffer so you stop sending more trains down the line when they can't leave.

For this design you don't need a clock as the threshold for trains adds a hysteresis to switching directions all on it's own. For switching tracks you have to delay opening the opposite signal till the trains going the old direction have left the track. So you have to have a wire across all the signals on the track (except the ends) and read out the status. So it's more 7 states:

Code: Select all

 2 left --> left/blocked left entry  --> left/right -->  blocked left entry/right --> 2 right.
        <-- left/blocked right entry <--            <-- blocked right entry/right <--

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Trains: 2 lane 2 way

Post by Illiander42 »

I guess the use for this is if a section of rail is increadably bursty?

So everything wants to go one way, then everything wants to go the other way.

Would a 3-lane system with a variable middle lane be easier to set up safely?

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trains: 2 lane 2 way

Post by mrvn »

Illiander42 wrote:
Mon Mar 25, 2024 10:22 am
I guess the use for this is if a section of rail is increadably bursty?

So everything wants to go one way, then everything wants to go the other way.

Would a 3-lane system with a variable middle lane be easier to set up safely?
Doubtful. Once you figure out how to program one lane safely you can duplicate that for any number of lanes with minimal extra logic.

Post Reply

Return to “Gameplay Help”