Logic Blog

Welcome To the Wonderful World of Wenches!!

Rating: 7 votes, 5.00 average.
Welcome to the Wonderful World of Wenches!

Indeed, what better way to kick off the logic blog than with a basic overview of my favouritest thing in the (littleBig) World: wenches!! Yes, as many of you know, the vast majority of the logic I use involves a winch somewhere in it, so it seems the best place to start is with a rundown of basic winch techniques.

Now I know I said I wasnít planning on doing a ďhere are some generic switchesĒ type approach, but as it turns out, that's exactly what I'm about to do. Iím pretty sure you are all familiar with the ANDs and ORs and suchlike that Iím listing here, but thatís not important. What is important is laying down the skills and technical understanding, to build upon in future.

It's painfully obvious to me that I have gone overboard on this post. I apologise in advance for its obscene length. I could have broke it out into two parts, but I didn't, feel free to take a break after Section 3.


1. Why Winches?
Winches are quite a unique thing in LBP. Depending on how you look at them, they can be one of the most versatile of all components in the game. But massively overlooked and under appreciated. The winch has one simple, fundamental property:
  • Winches can pull an object in, but they cannot push it away.

Now everyone knows this, but I think a lot of people didn't really appreciate the scope for such a simple feature. We can manipulate this one property to perform a whole host of tasks. So letís cover a couple of very simple examples that many of you should be familiar with.

Spoiler Spoiler - geekNotes - On Winch Analogies


2. The Set Ė Reset Switch
Probably the easiest winch-based logic circuit to understand is the set-reset switch, plus you should all be familiar with it from the Logic Pack. The set-reset has two inputs, set to turn on the output and reset to turn it off.

If you make set TRUE, then the output becomes TRUE, but then when you make set FALSE again, the output remains TRUE. Similarly if you make reset TRUE, the output becomes FALSE, and when you let reset become FALSE again, the output remains FALSE. In this way it has a kind of memory Ė itís output doesnít just depend on what the inputs are doing at that moment in time.

2.1. Building the Switch
So where do the winches come in? Well, the set-reset device is shown below:

The lengths of the winches are such that when extended, the winch will have no effect on the magnetic key block. The winch on the same side as the magnetic switch is the set, the one on the opposite side is the reset. Both winches are set to be backwards and operate at 0.1s timing, so that when activated, they pull the block towards them.

2.2. How Does it Work?
The following is a slightly verbose analysis of the whys of the switch, as we move on I'll start being more succinct with my explanations:

If the set is TRUE and reset is FALSE, its winch will pull the magnetic key towards the magnetic switch and the output will become TRUE:

Similarly when reset is TRUE and set is FALSE, the winch pulls the magnetic key away from the magnetic switch, making the output FALSE:

If neither input is TRUE, then both winches are extended (because they are backwards) and so neither of them has any effect on the magnetic key. It will stay exactly where it is, in either of the positions shown above.

2.3. Tweaking the Device
The analysis above says nothing about the fourth condition, when both set and reset are TRUE at the same time. Both will be pulling on the key and there is no clear indication of what will happen. To accommodate for this, we can adjust the strengths of the winches so the device favours either set or reset.

For example. If the set winch is at strength 10, and the reset winch is at strength 5, both will act normally when activated individually, but when both are activated at the same time, we have a situation where the two connectors are ďfightingĒ each other, just like in a tug of war. Now, itís important to note that there isnít really a fight, we can analyse this situation by simple summation of forces and find it's quite neat and predictable.

If we consider that
  1. winches can only ever exert a force towards themselves
  2. In this case, the strength of the connectors is proportional to the force exerted
  3. Movement towards the magnetic switch is considered positive.

We can draw up the following table.

    Set    |   Reset   ||     Output     | 
 FALSE (0) | FALSE (0) || No Change (0)  |
 FALSE (0) | TRUE (-5) ||   FALSE   (-5) |
 TRUE (10) | FALSE (0) ||    TRUE   (10) |
 TRUE (10) | TRUE (-5) ||    TRUE   (5)  |
The numbers in brackets are the forces involved; as you can see, the overall force (in the output column) is simply the sum of the connector forces from the other two columns. A large amount of logic can be developed around this simple concept of summing forces. As long as you keep all of the motion in a single dimension (i.e. in a straight line), the analysis is quite easy.

2.4. Notes
There are a couple of things to note about this device.

  1. A minor thing is that it has to be stationary and horizontal at all times. Encased in dark matter as shown it is fine. Otherwise, when both inputs are inactive, the glass will slide around and cause all kinds of nastiness. More on this in a later edition.
  2. You cannot directly see what the inputs are doing. On a typical piston-driven switch, you can see the inputs activate and deactivate as the pistons move. Not true here, you can only see the output. This is a typical thing with winch logic and is likely to cause you much anguish during debug. Don't say I didn't warn you.


3. The OR Gate
I know what youíre thinking: ďBut Richard, everyone can make OR gates! my Nan can make a freakin' OR gate in her sleep! why are you showing us this?Ē Well, this OR gate is smaller and lower thermo than more conventional implementations, I invented it, and Iím almost 100% sure that itís not possible to implement a lower-thermo combinatorial OR gate than these, so turn the smugometer up to 11 and bear with me here. More importantly, it's a key component design for everything I do, so it's needed.

3.1. Building the Switch
The winch-based OR gate is shown below:

. . . .

Tweak the connectors to the following:

 Connector  |   Min   |   Max   |   Strength   |   Time   | 
   Piston   |   0.1   |    5    |      5       |    0.1s  |
   Winch    |   0.1   |    5    |      10      |    0.1s  |
Note: that both connectors are set to backwards and inputs are directional. Also note the difference in the strengths. This is the "weak piston / strong winch combo" I've been touting for the last few months.

3.2. How Does it Work?
Well as before, we can analyse the system in terms of strengths of the connectors. Remember that the piston is stiff, so that keeps our motion in one dimension and also makes things easier.

We will consider motion to the left to be positive, so when active:
  • The piston exerts a force of 5
  • The winch exerts a force of 10

and when inactive:
  • The piston exerts a force of -5
  • The winch exerts a force of 0

So if we draw up another table:

 Winch Input  |   Piston Input   ||   Output   | 
  FALSE  (0)  |    FALSE (-5)    || FALSE (-5) |
  FALSE  (0)  |    TRUE   (5)    || TRUE   (5) |
  TRUE  (10)  |    FALSE (-5)    || TRUE   (5) |
  TRUE  (10)  |    TRUE   (5)    || TRUE  (10) |

If either of the inputs is TRUE then the overall force (in the output column) becomes positive and so the output becomes TRUE. It should be clear that this is the characteristic behaviour of an OR gate. Note as well that the overall force is never zero - it's always going to push or pull.

3.5. Notes
As it has only one moving part, it is lower thermo than a conventional gate, which would typically use two. It can also take up less physical space than conventional versions as well, if that's what you're into.

I have done thermonalysis on this many moons ago to see if the "multiple connectors on one object" causes a boost. It doesn't.

Note again that you can never see value of the inputs. The moving part shows you the outputs, but you have to go back to the sources to check the input states.


4: The AND Gate
The winch-based AND gate is very similar to the winch based OR gate. In fact it has the exact same configuration, but the piston and winch are no longer set to backwards and the magnetic key is inverted.

. . . .

Now this brings up an interesting point about inversion. In electronics, we have these concepts of NOT gates. Not gates just take a single input and output the opposite. Due to the backwards property of connectors and the invert property of switches, we can pretty much handle all of our inversion inside the existing gates.

Spoiler Spoiler - geekNotes - On De Morgan's Theorem

4.1. How Does it Work?
Same analysis as for the OR gate:

We will consider motion to the left to be positive again, but everything is inverted. So when active:
  • The piston exerts a force of -5
  • The winch exerts a force of 0

and when inactive:
  • The piston exerts a force of 5
  • The winch exerts a force of 10

Also remember that we need a negative overall force (movement to the right - check the pictures) to get a TRUE output. So if we draw up another table:

 Winch Input  |   Piston Input   ||   Output   | 
  FALSE (10)  |    FALSE  (5)    || FALSE (15) |
  FALSE (10)  |    TRUE  (-5)    || FALSE  (5) |
  TRUE   (0)  |    FALSE  (5)    || FALSE  (5) |
  TRUE   (0)  |    TRUE  (-5)    || TRUE  (-5) |
So the output is only TRUE if both inputs are TRUE. Which would be an AND.

4.2. Notes


5. Flexible Number of Inputs
With these ANDs and ORs, having one moving part on a two input gate is a slight improvement on other designs. But what if you could have only one moving part for any number of inputs you want? Well, itíd be awesome is what and Iíve got good news for you: the designs above can be extended to take any number of inputs.

OK, I say "any number", I tried it with the nice round number of 16 and that performed fine, I canít vouch for any more than that, because I got bored, or somat more interesting happened.

5.1 Flexible Number of Inputs OR
This flexible number of inputs is achieved by adding an extra winch for each extra input. This winch is configured the same as the first winch. That's it, all you need to do. Below is an image of the flexible OR:

. . . .

I'm not going to do the analysis in full, but feel free to do it yourself, it's just summation of forces again. As a hint, you will need 16 rows for your truth table to cover all of the input combinations. It's probably quicker to just make one of these in create mode and show yourself it works.

5.2. Flexible Number of Inputs AND
You can do the exact same thing with the AND gate from section 4 as well.

. . . .

5.3. Notes
As before, hard to see inputs, blah-de-blah, etc, you get the idea...

Obviously the thermo saving of this technique should be clear to every one. More traditional methods would have a single moving part per input. By going this route we half the number of moving parts for 2 inputs, quarter it for 4 etc. etc. The bigger the gate, the more you save.


6. The Quick Reset Timer
The quick reset timer is another nice switch from the Logic Pack. It has the characteristic of moving in one direction very fast (0.05s) and back the other way as slowly as you want. Hence "quick reset".

6.1. Building the Switch
The image below shows the quick reset timer device. It's exactly the same as the AND from above, except the magnetic switch has a larger detection area - it should only activate when the key reaches the very end of its motion.

. . . .

The magnetic switch is set to inverted and the piston and winch are set up with the following settings:
 Connector  |   Min   |   Max   |   Strength   |   Time   | 
   Piston   |   0.1   |    5    |      5       |    10s   |
   Winch    |   0.1   |    5    |      10      |    0.1s  |
Connect the buttonís direction output to both the piston and the winch so they are both either extending or contracting.

6.2. How Does it Work?
When the input is activated, the input to both the piston and the winch becomes TRUE and they both start to extend. Remember that the winch cannot push, so only the piston has any effect. It pushes out slowly and takes 5 seconds to fully extend (half the time as it is only going one way)

When the input to both of the connectors becomes FALSE they start to retract. Because the winch is stronger than the piston, it can overpower it. Effectively, only the winch is taken into account, the timer pulls back in using the 0.1s timing. This gives us the quick reset. Simples

Spoiler Spoiler - geekNotes - On Connector Tweaking and Relative Power


7. Summary
Sooo... nothing actually new here, in terms of the switches, but I have surreptitiously introduced you to:
  1. Basic Winchy logic concepts
  2. How connectors interact when opposing each other.
  3. Use of mathematical analysis of designs
  4. Truth Tables
  5. A teensy bit of Boolean Theory, if you followed that geekNote under the AND gate (don't feel bad if you didn't - that part made comphermc go weak at the knees )

All of which will be important as we move forward.

7.1. Did I make a level with this stuff in?
Why of course I didn't! Not because I'm mean, I just want you to go out and make them. None of them are hard to make and the instructions are all there. If you hit any problems then I'll be glad to help out, but you need to memorise how to make these devices, and the best way to do so is by doing it yourself.

By the end of the year you will see why there is no logic in my popit (no, that's not a euphemism, tsk at you!) - everything gets build from scratch. If you are going to keep up with these blogs, it's quite important that the designs are seared into your memory.

7.2. What next?
In the next two blog posts, we will be looking at ways to reduce thermo in logic networks by analysing the interactions between multiple logic gates, rather than just reducing the thermo requirements at individual gate level. In the meantime, fool around with some wenches (that one might be a euphemism ).

Also, if this blog isn't long enough for you (oh teh lulz) and you are looking for some more reading materials, check out these other applications of winches in logic:


Updated 12-18-2009 at 11:46 AM by rtm223

Logic Blog


Page 2 of 2 FirstFirst 1 2
  1. napero7's Avatar
    I can't believe I read all that...
    Nah I'm just messing with you, I didn't. I got bored after the first two sections and didn't actually understand anything.
    Chances are I will never build such a complex level that needs lower thermo logic
  2. eggs2eggs's Avatar
    Thanks for making these logic gates! Now it will only take me 20 seconds to make a 12 input OR gate!;)
    Updated 11-11-2010 at 04:13 PM by eggs2eggs
  3. rtm223's Avatar
    No worries,

    Though once you get LBP2, you'll be making 12 input ORs in 5 seconds
  4. MacMog's Avatar
    I tried to build the set/clear device in LBP and cannot get it to work. At best I can get it to pull to the right, but not the left. If I set the Backwards option or the strength settings to certain values, the winch pulls so forcefully that the glass block flies apart. Any idea what I did wrong? :(

    The setup:
    [LIST][*] a 4 high rectangle of dark matter with a 2 high notch cut out of the center, magnetic switch on the right, similar to the screenshot[*] a piece of glass with a magnetic key attached (square to start, replaced with a circle in case the squareís corners screwed up the physics somehow)[*] two winches, both set with max length longer than the box, min length 2 (in case 0 pulled the glass block into the box), timing set to 0.1, left strength at 5 and right strength at 10 (bias towards set), flipper motion off, backwards off (seems to break more if set to on)[*] two 2-way switches, both set to on/off, each attached to one winch and a light to confirm on/off[/LIST]

    Side note: what does the Backwards option for the winch mean? I havenít found a good explanation here or on the wiki. If you understand, please explain and consider adding it to the wiki.
  5. rtm223's Avatar
    Oh my gawd, I have to think back a fair way for this one... It's all about the electronics in LBP2 now

    You've got your switches set to on/off, when they should be directional - what you are after is for the winch to pull in when the switch is "on".

    The backwards setting for the winch simply inverts it. So normally, when you activate a switch set to directional the winch would extend. Turn the switch off and it would retract. For this device you would want to it to retract when activated, so backwards is the way to go

    Let me know if that helps
  6. arronleach's Avatar
    im making a new film and it will probaly get to cool levels so just incase im telling everybody to play it i know that your thinking its noobish anyway it will be published in 2 days called the 5 most random youtube videos
Page 2 of 2 FirstFirst 1 2