How does this railway station work exactly?
A rail at a junction (a standard rail surrounded on 3 sides by other rails) will change between two possible orientations depending on whether it is getting a strong redstone signal or not. When your minecart crosses a curved track, if it hits the straight side it will take the turn, if it hits the curved side it will continue over it. This lets you use redstone to direct a minecart. Caveat: when building a junction, it will use the direction it is built regardless of power state, so you need to power cycle the junction to see its default state. Also, whether the default is to take the turn or continue straight depends on the cardinal directions the rails are facing.
I built the junctions and noted that the unpowered state of the junction would allow the minecart to continue to the next junction. The powered state of the junction would cause the minecart to take the turn, thus sending you off on a particular railway.
Each junction has a torch under it, providing strong power or no power depending on the state. So sending a signal to the torch will invert the state. Since each junction starts off powered, the minecart will take the turn, heading off on Track One in the default state. If we inverted the torch under Track One, then the minecart would bypass that junction and head off on Track Two, etc.
To select the track, I am using an item frame. An item frame contains an item, and the item can be reoriented by right-clicking. This was original just for decorative purposes and rotated in 90 degree intervals, but in 1.8 they were updated to rotate in 45 degree intervals, and the position could be read by a comparator from the opposite side of the block.
When you place in item in the item frame, that is its default state. It will give off a signal strength of 1, meaning only the first redstone dust in a line of redstone dust coming off of the output of the comparator will receive power. In the 2nd position, it will give off a signal strength of 2, etc. There are eight total positions.
I used an arrow in the item frame since it points in an obvious direction so that we could add signs around the item frame describing which track that position would cause you to take. Caveat: different resource packs show a different default position. So on the default texture, the default state for the arrow in the item frame is pointing up-right. In
UTAlan's old resource pack it was something else. Neither of us knew this issue and we ran headlong into it. Later
UTAlan picked a different resource pack that uses the same default direction. So pro tip, if someone using the track complains that it's mis-calibrated, suggest they change their resource pack.
So now you run in to a problem. You can send a signal up to 8 redstone dust down the line, but since a junction must be two blocks from another junction, you are wasting half the signal. Only every other direction on the item frame will create a signal that reaches the next junction.
The solution is that since the junctions are every 2 blocks, we want to add 2 to the signal power for every position on the item frame. That means we need to multiply by two. But how do you multiply with Minecraft redstone? There is no block to multiply, add, or divide a signal power. However, the comparator has a second state. If you right-click it, the front torch will turn on and it will be in subtraction mode. In subtraction mode, the highest side input signal power will be subtracted from the rear input signal power.
So now we need to multiply by 2 with subtraction. A general solution to this that includes division (fancy subtraction) would be:
f(x) = x - (x/2 - x) - (x/2 - x)
But we cant divide in Minecraft. However, we know a couple of things that can be useful. We can't ever have negative signal power, so the minimum value we can work with is 0, and the maximum value for a redstone signal is 15, a game rule. Also, we can only work with whole numbers. So:
f(x) = 15 - (7 - x) - (8 - x)
Another way to reason this out:
We have a maximum value of 15.
If we subtract it from itself, we get our minimum value of 0.
15 - 15 = 0
If we divide that subtraction across two steps, we still get our minimum value of 0, but have introduced a multiple of 2
15 - 7.5 - 7.5 = 0
Whole numbers only
15 - 8 - 7 = 0
Now we can reflect that division as multiplication by 2 of a given value
15 - (8 - a) - (7 - a) = 2a
Now that's something we can do with redstone. For any input signal x, we can get 2*x using the above formula. Now we just have to make that into something physical. Comparators can do subtraction, as we mentioned, when you right-click on them to turn on their front torch. Now we need a signal power of 15 which is the same as given by a torch, lever, button, redstone block, etc. We also need signal power of 7 and 8, which we could technically do with more item frames and comparators. But comparators can also read signal strength from other objects which can vary the signal. Anything that can contain items will give off a varying signal based on how full it is. Anything you choose is fine, but I like to use droppers. A dropper with 4 non-stackable items and a single stack of 32 items will give off a signal power of 8, and if the single stack were only 24 it would give off a signal power of 7, exactly what we need. I use 4 wooden shovels and stacks of sticks.
Side note:
15 - (8 - a) - (7 - a) = 15 - (7 - a) - (8 - a), so it doesn't matter which dropper has the stack of 24 and which has the stack of 32.
So now all that's left is to rearrange slightly and bury it all underground. Let me know if you have any questions.