v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

v0.31:Pre-Toggled Mechanical Logic

From Dwarf Fortress Wiki
Revision as of 22:02, 26 April 2010 by Jjdorf (talk | contribs) (Initial Edit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This article is about an older version of DF.

Template:Elven Recently some research on mechanical logic offered a new viewpoint of dealing with the limitations of this variety of logic. By including a concept called pre-toggling, one can construct nearly any conceivable logic circuit, with surmountable exceptions. From this, Pre-Toggled Mechanical Logic was born. Due to the nature of gear assemblies, circuitry using this method can be exceptionally fast for certain purposes, and can be made 100% fluid conserving in all cases, allowing it to be isolated from an infinite water supply.

Design Guidelines

There are a few guidelines for working with PTML circuits.

  • Levers and pressure plates should be linked to a gear assembly in the on state. For reference, a lever is off when built.
  • A gear may be designated as undriven, non-toggled, or pre-toggled.
    • Undriven gears are never linked to. They merely transfer what power is available to them.
    • Non-toggled gears are linked to by a lever or pressure plate, and left alone. They transfer power when their truth state is true.
    • Pre-toggled gears are linked to by a lever or pressure plate, then pre-toggled. To pre-toggle a gear, you build a lever, link it to the gear to pre-toggle, then flip the lever and dismantle it. As such, pre-toggled gears cost an extra mechanism. Pre-toggled gears flip the logical truth state of their inputs.
  • Two gears are considered directly connected if they are either adjacent, or if they are separated by only axles and/or undriven gears.
  • Two driven connected gears form an AND gate. A gear one z-level above another one is adjacent only if the floor between them has been channeled out. Power can flow through an AND gate only if both driven gears are in the true truth state.
  • A single undriven gear connected to two or more driven input gears forms an OR gate. Power will flow through this gear if at least one of the driven source gears is in the true truth state.
  • A single gear can be driven by multiple inputs to form an XOR or NXOR gate. For even numbers of inputs, the gear must be pre-toggled to form an XOR gate, non-toggled to form an NXOR gate. For odd numbers of inputs, the gear must be non-toggled to form an XOR gate, pre-toggled to form an NXOR gate. Power will flow through this gear only if it is in the true truth state.
  • Two connected driven gears, both having identical input links, with one being non-toggled, and the other being pre-toggled, are called out-of-phase. Out-of-phase gears will never transfer power through their connections.
  • Determining the qualities of a PTML circuit can be done on paper or in a spreadsheet. Truth formulas for each gear can be devised to determine whether they are engaged or disengaged. This need only be done for driven gears. Power can only flow through true gears (engaged gears). An output undriven gear will have power if an orthogonal line can be drawn from the power through any series of true gears. This does not require the circuit to be built in game to verify that it works.
  • Hybrid circuitry exists to allow the output of a gear train to be used to toggle other gears, or to open or close mechanically linked buildings, such as drawbridges, doors, floodgates, etc. This hybrid circuitry uses water and pressure plates as a rotation sensor