Setting train destinations using combinators - 2

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.
Post Reply
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Setting train destinations using combinators - 2

Post by XKnight » Mon Jun 12, 2017 8:36 pm

Initially, I wanted to create a post in this discussion, but my solution completely differs from the proposed one, so it deserves a separate topic.

TL;DR - Described a system which allows to select destination station in runtime using combinators.

Also, I'm assuming you are familiar with combinators, trains and at least once you tried to switch off a train stop.

To understand the further system you have to keep in mind these facts:
- A parked train ignore all changes in its route until it leaves the station.
- A parked train will wait until all leaving conditions are met even if its station is disabled.
- If the destination station is disabled during the trip the train switches to the next available station in its route.
- During this "switching" train may lose all its speed if the new destination station is:
a) unreachable (no path)
b) new path differs from the previous path
- Red rail signal placed in front of the station stop prevents train from any movement.

Let's start. First of all, ALL trains (except static trains in case of a mixed system) in the proposed system have exactly the same route and it looks like this (obviously it is not limited with 6 stations, this just an example):
Image
1 2 3 4 ... - different stations in system.
1' 2' 3' 4' ... - "shadows" of the real stations.

Station example:
Image

The core operation of this system is a "shifting" operation: all real and shadow stations sequentially changes their state to opposite in the next pattern: N-th shadow station, N-th station, (N-1)-th shadow station, (N-1)-th station, (N-2)-th shadow station, (N-2)-th station, ... , 1-th shadow station, 1-th station.
All trains that went to K-th station before shifting will be sent to K-th shadow station after shifting.
Step-by-step explanation
So, now we are able to make a main workflow of this system:
- When any train is ready to leave its station it initiates a shifting operation.
- First shifting operation (station -> shadow station). During shifting each station will "release" its train (if it is ready to leave) if the destination station is the next station for a parked train.
Example
Using this advanced shifting it is possible only to upraise train. This means we can send train from "4" to "3"/"2"/"1", but it is impossible to send train from "1" down to "5".
- Applying inverted shifting (shadow station -> station). Inverted shifting can only descend train (for example: "2" to "3"/"4"/"5").

When direct shifting and inverted shifting used together we may redirect each train from any station to any other station.

And what happens to the other trains during shifting?
- Nothing, because
a) their destination station is always enabled (either shadow station or real station),
b) their path is always identical (because shadow station is placed right next to the real station).
As a result they won't notice any shifting or changing in their path :D

System prototype:

Although it is quite complex to entirely understand this system, but it is surprisingly easy to build it.
The entire system consist of 5 combinators per station + 7 combinators for shared logic.
Station consists of:
- memory cell (to store what station is enabled shadow or real, 2x combinator)
- circuit to identify what shifting is required (direct or inverted, 3x combinator)
- also, station should have some circuits for
a) setting destination (this may be a simple constant or something more advanced)
b) leave condition

For a testing purpose I've built a small system:
6 different station + 4 dynamic trains.
1, 2, 3 stations change their destination in a "splitter" way (first train is send to the left station, second train - to the right).
4, 5, 6 redirects all trains to 2, 1, 3 respectively.
Image

Action video:


Setup guide
Last edited by XKnight on Wed Jun 14, 2017 10:55 pm, edited 2 times in total.

Bauer
Filter Inserter
Filter Inserter
Posts: 260
Joined: Fri May 05, 2017 12:48 pm
Contact:

Re: Setting train destinations using combinators - 2

Post by Bauer » Tue Jun 13, 2017 6:59 am

Brilliant. It took some time to wrap my head around it, though.
Do you mind sharing a blue print?

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Setting train destinations using combinators - 2

Post by XKnight » Tue Jun 13, 2017 7:06 am

Bauer wrote:Do you mind sharing a blue print?
Perhaps you have to wait till the evening - I have an assumption that "End" station is redundant.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Setting train destinations using combinators - 2

Post by XKnight » Wed Jun 14, 2017 10:45 pm

Updated original post.
As I expected "End" station was redundant, also I did some clean-up and greatly simplify almost everything.
Quite interesting that now train may enter into the ongoing shifting, so mean waiting time is halved.

Post Reply

Return to “Railway Setups”

Who is online

Users browsing this forum: Google [Bot]