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:Mechanical logic

From Dwarf Fortress Wiki
Revision as of 02:21, 10 April 2010 by SL (talk | contribs)
Jump to navigation Jump to search

Mechanical logic uses axles, gears, power, and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.

The principles powering mechanical logic are simple: Gears linked to triggers will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.

One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.

Mechanical signal-input power-output gates

  • These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.
  • There are certain things important to all the gates:
  • Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.
  • In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The 'w's are gears with windmills on top of them, and ║ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).
  • Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.
  • If your windmills produce no power, the diagrams are basically useless to you since you'll have to come up with some way to use water wheels for power instead.
  • You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.

Mechanical identity gate

(Example diagram, yours will vary based on how much power is needed)

O I - - w - - w - - w - - w
  • This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.
  • Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).
  • When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.

Mechanical NOT gate

(Example diagram, yours will vary based on how much power is needed)

O I g g g g g
w - - w - - w - - w
  • When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.

Mechanical NAND gate

(Example diagram, yours will vary based on how much power is needed)

O I I g g g g g
w - - w - - w - - w
  • This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.

Mechanical AND gate

(Example diagram, yours will vary based on how much power is needed)

O I I - - w - - w - - w - - w
  • This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.

Mechanical OR gate

(Example diagram, yours will vary based on how much power is needed)

O I
I * - - w - - w - - w - - w
  • This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.

Mechanical NOR gate

(Example diagram, yours will vary based on how much power is needed)


I * g g g g g
O I
w - - w - - w - - w - - w
  • This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'g's will be connected to the system, pushing power requirements higher than power supply, shutting it down (if you've built it with the amount of windmills and gears/pumps needed to power it and to shut it down when an input turns on).

Mechanical XOR gate

(Example diagram, yours will vary based on how much power is needed)

O I
I * - - w - - w - - w i g g g
. . . . . . . . . . i
. . . . . . . . . . g g g


  • Except for the 'i's and 'g's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.
  • This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the gs are gear trains, however, neither gear train by itself should be enough to shut down the system. However, you need to make the gear trains large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.

Mechanical XNOR gate

(Example diagram, yours will vary based on how much power is needed)

I * g g g g g g
O I
w - - w - - w i - w
. . . . . . i
. . . . . .
. . . . . . w
A B Drain Power Extra Power Result
0 0 No No No 1
0 1 Yes Yes Half 0
1 0 Yes Yes Half 0
1 1 Yes Yes Full 1
  • The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.
  • This gate may be even more complicated to build than the XOR gate!
  • First, your 'i's are again gears connected to your two inputs. The ws to the right and below them are additional windmills.
  • Here's where it gets complicated. The gear trains have to be sufficient to shut down the system even when ONE of the inputs' additional windmills are connected. However, when BOTH inputs are on, there needs to be enough power from the additional windmills to bring the system back online.
  • Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.