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.

User:Jjdorf/Logic Gates

From Dwarf Fortress Wiki
Revision as of 04:19, 23 April 2010 by Jjdorf (talk | contribs) (More notes...)
Jump to navigation Jump to search

I'll be using this as a spot to keep all my preferred logic designs in one spot. Each design will specify the power requirements, build materials (excluding walls if constructing rather than digging), and build order, including the points when an input or output needs to be hooked up to things. For the most part, I will be using DF2010:Mechanical logic for my basic logic gates, due to the fact that I want to completely avoid the need for an infinite water source.

Buffer/Rotation Sensor

Modified slightly from: DF2010:Mechanical logic

   XXX       XXX
 S%>#D     .  .
   XXX       XXX

XXXXXX    XXXXXX
Xo   D    Xo   D
XXXXXX    XXXXXX

Both doors (D) are ordinarily forbidden under normal operation. A water drain path is a good idea if maintenance is ever necessary on the bottom floor. The mechanical input (S) provides the power to the pump. Enough power must be available at this point to drive the pump (10 units) when the signal gear or axle is functioning. The pressure plate (o) on the bottom layer is set to 0-3 water level. The screw pump (%>) pumps away from the signal mechanism, towards a floor grate (#).

Building

  • First, construct or dig the walls and floors. If constructing, do NOT build floors at the empty space tiles (.), channel the same tiles if digging from the rock.
  • Build the pressure plate on the bottom layer, then link it to whatever is needed. Forbid the Bottom level door. Build the grate.
  • Build the screw pump, pumping toward the grate and away from the signal line direction.
  • Designate a pond at the grate tile, filling the bottom layer full (all four tiles to 7/7 water).
  • Hook the pump up to the signal mechanism. Test with whatever logic is needed if desired. The sensor is finished.

Bill of Materials

(Excluding the signal source and pressure plate linkage) 2 Doors 1 Mechanism 1 Corckscrew 1 Pipe Section 1 Block 1 Grate

Inverter

An inverter can be built with identical properties and build sequence by simply changing the pressure plate to trigger on 4-7 water.

Notes

A Rotation sensor can also be considered a simple Buffer. Buffers in actual electronics circuits are often used to increase the number of gates an output signal can be connected to, often by much more than the standard gate output can do. Thus, I consider mechanical logic and fluid logic to be two different types of gates, and you use the gate that is best suited for the specific job. Since fluid logic has a greater fan-out than mechanical logic, the fluid buffer can reset the power needed, since fundamentally, multiple mechanical gates can be connected together without issue until power runs out or you need to use load gear assemblies such as in an XOR or XNOR gate.

TODO

Verify that a signal gear or axle can be placed at (S) and still allow water to be pumped. If this is not possible, adjust the design to put the gear one z-level above the pump, making sure to channel the floor to allow power transfer.

Pros/Cons

The pressure plate requires 100 steps to switch off, but switches on immediately. The sensor is water tight and should not evaporate under normal operation, allowing it to be disconnected from an infinite water source.

How It Works

When the source gear or axle is disabled, so will the pump be. In this state, the water level in the bottom reservoir will be a constant 7/7, thus disabling the pressure plate (set to 0-3). When the pump turns on, however, it pumps from the pressure plate tile constantly. Thus will shift the water in that tile to the rear reservoir in the top level, keeping the plate clear of water, thus triggering the plate. Since no tile of water will ever be less than 2/7 water at any time, no evaporation is possible (theoretically).

RAM

Random Access Memory, basic cell structure:

  PXXX       XXX
 H%>#D     . .. 
   XXX       XXX

XXXXXX    XXXXXX
Do<%HD        . 
XXXXXX    XXXXXX

   XXX       XXX
  MX D       X  
   XXX       XXX

Each door (D) is a simple access door for internal maintenance. Under normal circumstances, they should be forbidden entirely. The grate (#) is there for completeness and safety when priming the cell with water. If desired it could be omitted. The pumps (%> and <%, pointing the direction of pumping, specifically, the % tile is walkable) are simple constructions, no special qualities. Make them of whatever material is available. The top level hatch (H) is the RESET signal (R). The pressure plate (o) is set to detect only 7-7 water. The middle level hatch is the SET signal (S). The walls (X) can be carved from rock or constructed as needed. Power (P) is supplied through axles or gears. The cell draws 21 units of power when connected with an axle, 25 when using a gear. The output gear of the memory (M) can technically be placed wherever you need it to be.

Building

  • The first step is to construct the walls and floor, or carve the same. If constructing, you should NOT build floors in the empty spaces (. on the right floor plan layout). If digging from solid rock, channel open space at those places instead. If constructing, you can build a wall instead of a door on the bottom layer.
  • Build all doors, forbidding the bottom most door, the top level hatch and grate and the pressure plate. Build the screw pump on the middle z-level.
  • Build the screw pump on the top z-level only after the first pump. Meanwhile, fill the bottom most tile with water by designating a pond on the location the hatch goes in the middle layer. Fill the bottom tile to 7 water, then remove the pond designation.
  • Build the hatch on the middle layer.
  • Link the pressure plate to the output gear (M). Link the SET and RESET hatches, remembering that the SET hatch turns the memory on, and the CLEAR hatch turns it off. Forbid the doors on the middle layer.
  • Fill the middle layer with water from the grate tile on the top layer, until the open spot of the pump and the SET hatch are both covered in 7 water, then remove the pond designation.
  • Forbid the door on the top layer, Connect to a power source that provides at least 20 + your connector, then stick a fork in it. It's done.

Bill of Materials

(Excluding power source gear or axle and hatch source links) 3-4 Doors 2 Hatch Covers 2 Corkscrews 2 Pipe Sections 2 Blocks 1 Grate 4 Mechanisms

Maintenance

You can adjust the connections of the hatches as well as the pressure plate as needed. Constructing some extra levers, even if on demand, will allow you to easily adjust things. If you build a water drainage system, you won't even have to worry about the excess water in the system when you open the hatch side of the middle layer. Just remember to refill the cell if you had to go in there.

Notes

This cell does not have any "circuitry" to disable or enable the output of the cell based on addressing concerns, so if you add this to an addressable memory system, that gearing will be needed. It should be, simply, an addition of another gear before a rotation sensor.

Pros/Cons

The most important benefit of this design is the complete lack of evaporation, negating the need for an infinite water supply under routine operation. The water in this cell will never be at less than 3/7 if properly constructed. Not needing an infinite water supply means you can move this to a safely walled off portion of the map, preventing all building destroyers from infiltrating through it. It is also somewhat more compact within a z-level than other designs. Finally, the cell is, fundamentally, only two tiles wide, not considering power hookup. The walls can be shared with adjacent memory cells or other constructions. The drawbacks are twofold: it requires more power to operate, and it requires three z-levels.

How It Works

At its starting state, the pressure plate tile has no water, and thus the output of the cell is off, or 0. Both hatches are initially closed. When the SET hatch gets its signal, it opens up and the constantly running pump pulls water from the main reservoir and puts it into the pressure plate cell. The plate triggers and the memory cell is effectively on, or 1. The SET signal can (and should) clear at this time, closing the hatch. The rear reservoir now contains 7/7 at the lowest tile, and 3/7 and 4/7 fluctuating in the second layer, over the hatch and the walkable portion of the pump. The water in the cell reservoir cannot drain, and will not be pumped out. Until, of course, the CLEAR hatch gets a signal. At this point the top pump will be able to pull the water out of the cell reservoir (If it was there when the signal was sent), returning the cell to its original state. The only state that has not been considered is when both hatches are open at once. When this occurs, the output of the pressure plate will be unknown at any given point. Water will be cycling constantly through the cell, and the cell will be, for all purposes, unusable. Obviously, this is a condition we want to avoid.

Electrical Similarities

This memory cell design is almost identical to a standard RS Flip-Flop circuit. The exceptions are that it only provides one output, and the SET and RESET signals are default HIGH (on) in the electrical version. The implementation is also somewhat different as well, but that is not particularly important.

RAM Byte (Including Power Supply)

An extension of the above, with an expanded Dwarven Water Reactor to provide power.

XDXDXDXDXDXDXDXDX
X#X#X#X#X#X#X#X#X
X^X^X^X^X^X^X^X^X *
 %-%-%-%-%-%-%-%--*
 H H H H H H H H
XDXDXDXDXDXDXDXDXXXXXXX
XHXHXHXHXHXHXHXHXW W WX
X%X%X%X%X%X%X%X%XW^W^WX
XvXvXvXvXvXvXvXvXW%W%W
XoXoXoXoXoXoXoXoX # #
XDXDXDXDXDXDXDXDX
XDXDXDXDXDXDXDXDXXXXXXX
X X X X X X X X X X X X
XXXXXXXXXXXXXXXXX X X X
 M M M M M M M MX X X X
                XX X XX
                 XXXXX

Notes

The Water Reactor used here will provide exactly 250 excess power. The memory cells themselves will cost 160, leaving 90 for the power train. The power train consists of two gears and 9 axle tiles, for 19 power, leaving 71 wasted power. The output gears are not considered part of the power train, as they will typically be used in other logic circuits, and will likely need more than 71 power to run whatever they are intended for.