Rails Elevator with Binary Panel

    Joined
    Nov 9, 2015
    Messages
    4
    Reaction score
    1
    • Community Content - Bronze 1
    Players making rails elevators with a high number of stops (say, larger than 5) will frequently find themselves requiring a wall of buttons to get to the desired floor. A 16 floor elevator, for instance, would in theory require 16 buttons in the cab.

    This post is a small tutorial on how to use a binary panel to reduce that requirement to only log2(number of floors) + 1 buttons, rounding up. In other words: an elevator spanning 5-8 floors needs 4 buttons, 9~16 floors requires 5 buttons, and 17 to 32 floors can be done with 6 buttons only. Because of this rounding up, the biggest savings are when the number of floors are a power of two, and elevators are tall.


    Trivia: my elevator is about 100m tall on a 200m diameter planet. If the planet was the Earth, the top floor would be about 20 times higher than the ISS. So when I say "tall", I mean it.

    I'll assume you already have an elevator working, otherwise there's plenty of other tutorials teaching how to build them, and I doubt there's anything very insightful that I can add.

    Code:
    Space requirements and materials for N stops elevator (logic only):
    
    The cab:
        - Wireless modules: log2(N) + 1 (rounded up)
        - Buttons: 1
        - Optional: log2(N) activation modules 
          (only if you dislike the idea of using Wireless modules as the panel buttons)
    
    The shaft:
        - Wireless modules: log2(N) + 1 (rounded up)
        - Not gates: log2(N) (rounded up)
        - And gates: N
        - A working elevator set up.

    Binary Number Intro
    Starting with a short(ish) intro on how to represent numbers in binary, feel free to skip if you already know this. Now, we all know computers store data in binary form. That is, your HD is kinda like a bazillion of little switches that can be either turned on or off. Same goes for the basic logic operators in StarMade, they can be high (or on or blue) or low (or off or orange). Any information you store on them is, therefore, irrevocably binary.

    Binary is just a different form (or base) from the standard decimal base we use. If we read the number 42, we also know what it is: it's 4 times 10 plus 2 times 1, which yields forty-two. Conversely, if we want to write twenty-seven in decimal, we all know how: twenty seven is 2 times 10 plus 7 times 1, hence 20 + 7 or 27.

    Except twenty-seven is not that at all, twenty-seven is just twenty-seven. It's a number on its own, just like one or six. We may think of it as a combination of other numbers for notational simplicity, since it'd be quite unmanageable to have a different symbol for each of the infinite numbers that exist. So we think of twenty-seven as 27, or ninety-nine as 99. We could use a different notation convention though. In France, for instance, the word for ninety-nine translates to "four twenties-nineteen". So there's no reason why they shouldn't write it down in base 20 as well: 4S ("S" being the symbol I chose for 19). That is 4 times 20 + "S" times 1.

    So what does a string of 1's and 0's translate to in decimal? Let's take, for example, 101011. Reading from right to left, we have:

    Code:
      1 * 2^0 =  1
    + 1 * 2^1 =  2
    + 0 * 2^2 =  0
    + 1 * 2^3 =  8
    + 0 * 2^4 =  0
    + 1 * 2^5 = 32
    =           42
    So 101011 is 42. And conversely, how do we represent a number in binary? You do the same thing in reverse. Let's take the number 27 as an example:

    • What is the largest power of 2 that we can fit in 27? A: 16, so our number will have 5 digits and the first is one: 1####
    • Remainder is 27 - 16 = 11
    • The next power of 2 (going down) is 8. Can we fit it in 11? A: yes, so add another 1 to the first: 11###
    • Remainder is 11 - 8 = 3
    • Can we fit 4? A: no, so add a 0: 110##.
    • Can we fit 2? A: yes, so another 1: 1101#
    • Remainder is 1, which does fit a 1, so we finally have: 11011


    And voilà, 27 in base 10 is the same as 11011 in base 2.

    Setting up the binary panel

    Start by placing all the "and" blocks where you will want them. Note that each of them will need to link to the button that calls the elevator to a particular floor, so place them somewhere such that the wires won't be going through the shaft or anything of that sort.


    In a ship, I'd probably place them behind the shaft's wall, or under it, so the connectors are invisible. Then again, I don't build ships this big, so don't look at me for advice on that one.

    Next, place all but one of the shaft's wireless logic buttons in a row, and one not gate adjacent to each. Connect each wireless module into a single not gate. Place the remaining wireless gate off to the side, so you won't confuse it with these ones, and connect this last one to every single and gate you've placed. Turn it on for now.


    None of the and gates are on because the one on the left, which connects to all of them, is off. Now that I think of it, maybe it would have been more instructive to actually set up a combination for this picture. But I didn't ¯\_(ツ)_/¯

    Now, think of the wireless modules as ones, and the not gates as zeros. Each corresponds to a power of 2: 1, 2, 4, 8 etc. We want to connect them to the and gates so that each one of these activates to a single combination. For example, my elevator has 15 floors/4 buttons. So 0000 (i.e. all the nots) connect to the and gate that will activate floor 0 (the ground floor), 0001 to floor 1, 0010 to floor 2 and so on.


    If you're adapting an existing elevator, once the above is done, it is a good time to connect each and gate to everything that each corresponding button in the cabin is connected. The way I built mine, each and gate only connects to a button on each floor, but your setup might include doors, delays etc, so be thorough to avoid any odd behaviours. You might want to follow the next set of instructions (on how to setup the cab) before you tear down yours, just to make sure it works to your liking. Once you're sure everything is connected correctly, feel free to tear down your wall of buttons.

    For those building an elevator from scratch
    , just connect each and gate to the elevator call button on the corresponding floor.

    Now, to build the cab. Inside it, place all but one of the wireless modules and a single button in whatever way you find more aesthetically pleasing. The button is a "go" button—you first click the wireless modules on or off to determine the floor you want to go to, then you'll hit that button to start moving.


    "Inside", "above", all the same. If I hit the "go" button right now, we'll go to floor 1+2+4+8 = 15

    Now connect each of the wireless modules in the cab to the corresponding power of 2 in the shaft. In mine, top two buttons mean 1 and 2, while the bottom two are 4 and 8. You should have one remaining wireless module. Place it somewhere hidden (mine is under the cab) and connect the button to it. Lastly, connect this wireless button to the remaining button that you previously connected to every single and gate.


    And you should be done. Should you have any doubts, post them here and I'll try to look at them when I have the chance. I'd also like to see pictures of any unreasonably large elevators that you build, so feel free to post them =]
     
    • Like
    Reactions: MrDeez
    Joined
    Sep 25, 2013
    Messages
    203
    Reaction score
    141
    I will definitely be using this (assuming I can understand your instructions) for my ship, which has 19 floors accessible only by lift, and many of the others only accessible to each other via the lift.
     
    Joined
    Nov 9, 2015
    Messages
    4
    Reaction score
    1
    • Community Content - Bronze 1
    (assuming I can understand your instructions)
    I think it should be reasonably simple if you read the intro to binary first, but if you're having trouble, drop me a message and I'll try to explain whatever is unclear.
     
    Joined
    Jan 4, 2014
    Messages
    48
    Reaction score
    54
    • Purchased!
    • Legacy Citizen
    Had this idea also when built my little binary counter. I wont personal use it since my ship will feature only 5 floors but this will be great for stations or very tall ships :)
    I made a elevator allrdy (see my thread! shameless attention) but the logic for all floors is a mess :)

    More binary solution to the people!