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.

Editing Fluid logic

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.

If you are creating a redirect to the current version's page, do not use any namespace. For example: use #REDIRECT [[Cat]], not #REDIRECT [[Main:Cat]] or #REDIRECT [[cv:Cat]]. See DF:Versions for more information.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{migrated article}}
+
{{Migrated_article}}
{{Quality|Unrated}}
+
{{quality|unrated}}
{{av}}{{Computing}}
+
{{av}}
'''Fluid logic''' is a form of [[computing]] which uses a fluid (generally [[water]]), controlled by various means, to trigger [[pressure plate]]s and hopefully accomplish some desirable result.
+
Fluid logic is a form of [[computing]] which uses a fluid (generally [[water]]), controlled by various means, to trigger [[pressure plate]]s and hopefully accomplish some desirable result.
  
 
==Infinite Flow Gates==
 
==Infinite Flow Gates==
Line 168: Line 168:
  
 
===Examples===
 
===Examples===
In the following examples, {{Tile|X|#000|#888}} is a floodgate, and {{Tile|╬|#FFF|#000}} is a drawbridge. Red ones are connected to input A and green ones to input B.
+
In the following examples, {{Tile|X|#000|#888}} is a floodgate, and {{Tile|╬|#FFF|#000}} is a drawbridge. Red ones are connected to input A, green ones to input B and blue ones to input C.
  
 
====NOT====
 
====NOT====
Line 304: Line 304:
 
|}
 
|}
  
If both inputs have the same value (both on or off), the two closed floodgates or raised bridges will form an impassable wall, blocking inflow of water. The second row of floodgates "behind" the pressure plate ensures that when the gate is deactivated by an "on" signal raising bridges, there is still space opened for water to spread into and lower fluid level. Either combination of one "on" with one "off" input opens a direct path for water to enter. The pressure plate must be set to react to 7/7 fluid, anything less can result in false positives.
+
If both inputs have the same value (both on or off), the two closed floodgates or raised bridges will form an impassable wall, blocking inflow of water. The second row of floodgates "behind" the pressure plate ensures that when the gate is deactivated by an "on" signal raising bridges, there is still space opened for water to spread into and lower fluid level. Either combination of one "on" with one "off" input opens a direct path for water to enter. The pressure plate must be set to react to 7/7 fluid, anything less can result in false positives.  
  
 
===Advantages And Disadvantages===
 
===Advantages And Disadvantages===
Line 311: Line 311:
 
The disadvantage is that it requires more resources to construct, and more careful planning, since floodgates tend to block paths. The presented drain-less gates depend on precise fluid depth and require that all incoming logic fluid is at the full 7/7 depth. This may necessitate building a reservoir or pumping system to compensate for flow irregularities or overcome the sluggishness of otherwise pressureless fluids. That's especially true when you decide to use [[magma|magma/lava]] as fluid.
 
The disadvantage is that it requires more resources to construct, and more careful planning, since floodgates tend to block paths. The presented drain-less gates depend on precise fluid depth and require that all incoming logic fluid is at the full 7/7 depth. This may necessitate building a reservoir or pumping system to compensate for flow irregularities or overcome the sluggishness of otherwise pressureless fluids. That's especially true when you decide to use [[magma|magma/lava]] as fluid.
  
==Speed Improvements==
+
===Faster Version===
 
The main factors that affect the speed of these gates are the delays of floodgates and bridges, and the switch-off delay of pressure plates. These cannot be eliminated, although designs that seek to replace as many buildings as possible with doors and hatches may minimize delays.
 
The main factors that affect the speed of these gates are the delays of floodgates and bridges, and the switch-off delay of pressure plates. These cannot be eliminated, although designs that seek to replace as many buildings as possible with doors and hatches may minimize delays.
  
Another factor is the flowing speed of the water. It can be improved. First, the water should flow in from a reservoir a few z-levels higher than the gates themselves (the more the better). This way, water will flow in much faster. In infinite-flow gates, you can then replace the pressure plates with up stairs, and make a 2x1 room one z-level above. On one tile is a down stair, and on the other is the pressure plate. Now the water will also flow out faster, or at least the pressure plate will switch off sooner.  To minimize latency when deactivated, assuming sufficient inflow, the pressure plate can be set to trigger only on a full 7 units of water.  This increases the water consumption a bit, but it still remains relatively low.
+
Another factor is the flowing speed of the water. It can be improved. First, the water should flow in from a reservoir a few z-levels higher than the gates themselves (the more the better). This way, water will flow in much faster. Next, replace the pressure plates with up stairs, and make a 2x1 room one z-level above. On one tile is a down stair, and on the other is the pressure plate. Now the water will also flow out faster, or at least the pressure plate will switch off sooner.  To minimize latency when deactivated, assuming sufficient inflow, the pressure plate can be set to trigger only on a full 7 units of water.  This increases the water consumption a bit, but it still remains relatively low.
  
 
==Edge Detector==
 
==Edge Detector==
Line 408: Line 408:
  
 
Each time the input trigger is toggled, the appropriate pressure plate will activate, remain active until the water finishes flowing, then deactivate after about 100 steps.
 
Each time the input trigger is toggled, the appropriate pressure plate will activate, remain active until the water finishes flowing, then deactivate after about 100 steps.
 
An edge detector can be realized very space efficient in advanced complementary fluid logic (as long as both pressure plates are linked to a single item). Input goes to floodgate and bridge, the pressure plates are working on 0-5 and 6-7, respectively.
 
 
{| style="border-spacing: 0"
 
|colspan="5"|
 
|-
 
|{{H2O}}
 
|{{RTF|╔}}
 
|{{RTF|═}}
 
|{{RTF|═}}
 
|{{RTF|═}}
 
|{{RTF|╗}}
 
|-
 
|{{H2O}}
 
|{{RT|X|#FFF|#800}}
 
|{{RT|^|5:1}}
 
|{{RT|^|#808}}
 
|{{RT|╬|#800}}
 
|{{RTF|║}}
 
|-
 
|{{H2O}}
 
|{{RTF|╚}}
 
|{{RTF|═}}
 
|{{RTF|═}}
 
|{{RTF|═}}
 
|{{RTF|╝}}
 
|}
 
 
==Memory Cells==
 
 
Fluid logic offers options for comparatively small [[Memory_(computing)|memory]] cells requiring very few mechanisms. They are usually quite primitive, so that more complicated memory manipulation requires additional machinery, but for simply "holding" a bit of information, they are hard to beat in compactness.
 
 
====S/R Latch====
 
 
{| style="border-spacing: 0"
 
|-
 
|{{888}}
 
|{{888}}
 
|{{888}}
 
|{{888}}
 
|{{888}}
 
|-
 
|{{H2O}}
 
|{{RT0|┼|#0F0}}
 
|{{RT0|^|#F0F}}
 
|{{RT0|┼|#F00}}
 
|{{888}}
 
|-
 
|{{888}}
 
|{{888}}
 
|{{888}}
 
|{{888}}
 
|{{888}}
 
|}
 
 
Design by [[User:Hussell/SetResetLatch|Hussell]].
 
 
A "set/reset" latch will activate when it receives a "set" signal - opening the door {{Tile|┼|#0F0}} , letting in water and triggering the pressure plate reacting to liquid of levels 5-7 - and stays active when the set signal turns off again. It will only deactivate when it receives an explicit "reset" signal - opening the door {{Tile|┼|#F00}}
 
behind the plate, allowing water to spread off the plate, lowering liquid depth enough to fall under the activation threshold. Further activity of the reset signal will, once again, not change the cell's state once it has been reset.
 
 
As usual in real-world set/reset latches, the inputs should not both be "on" at the same time.
 
 
====D-Latch====
 
 
{| style="border-spacing: 0"
 
|{{H2O}}
 
|{{H2O}}
 
|{{H2O}}
 
|-
 
|{{RTF|╗}}
 
|{{RT|┼|#FFF|#800}}
 
|{{RTF|╔}}
 
|-
 
|{{RTF|║}}
 
|{{RT|┼|#FFF|#080}}
 
|{{RTF|║}}
 
|-
 
|{{RTF|║}}
 
|{{RT0|^|#808}}
 
|{{RTF|║}}
 
|-
 
|{{RTF|╚}}
 
|{{RTF|═}}
 
|{{RTF|╝}}
 
|-
 
|}
 
 
This cell "tests" the state of the "Data" (hence D ) input controlling the door {{Tile|┼|#FFF|#800}} and the pressure plate (set to trigger on 5-7 liquid) will take on that input's state when the "enable" input opens door {{Tile|┼|#FFF|#080}}: if the data input is on, water can pass from the source to the pressure plate and fills the cell. If the data input is off, water will spread from the plate to the door's tile and lower liquid depth over the plate.
 
 
This cell will turn "on" whenever both data and enable input are on, but will only turn "off" when the data input is off at the moment the enable input ''switches'' from off to on, making it a hybrid of a Latch (reacts to changes in data as long as enabled) and a flipflop (only reacts to data state the moment enable changes from off to on). While this is clearly a weakness of the design, it is very compact and uncomplicated, needing a mere four mechanisms to link the doors to the inputs.
 
 
====Toggle Flipflop====
 
 
{| style="border-spacing: 0"
 
|{{H2O}}
 
|{{H2O}}
 
|{{H2O}}
 
|-
 
|{{RTF|╗}}
 
|{{RT|╬|#FFF|#800}}
 
|{{RTF|╔}}
 
|-
 
|{{RTF|║}}
 
|{{RT|┼|#FFF|#080}}
 
|{{RTF|║}}
 
|-
 
|{{RTF|║}}
 
|{{RT0|^|#808}}
 
|{{RTF|║}}
 
|-
 
|{{RTF|╚}}
 
|{{RTF|═}}
 
|{{RTF|╝}}
 
|-
 
|}
 
 
This is a cell which changes state to the opposite whenever its "control" input switches from off to on. The door {{Tile|┼|#FFF|#080}} is activated by the control input, and both the door and the bridge {{Tile|╬|#FFF|#800}} are linked to the pressure plate (triggering on 5-7 water).
 
 
The operation is not immediately obvious, thus a breakdown, beginning with the cell in the "off" state:
 
 
Water on the plate is 4 or less, the bridge is lowered. When the "clock/control" turns on, the door opens and water rushes onto the plate. The plate triggers and sends "on" signals to both bridge and door. The signal to the door is ignored, since the door's already open. The bridge receives a "raise" signal and reacts to it with a 100 step delay. Neither the bridge raising nor the door closing (when the control turns off again) does anything to the pressure plate's state, it remains "on".
 
 
Water on the plate is 5 or more (usually 7), the bridge is raised. When the clock turns on, water spreads from the plate to the door's tile. Water level on the plate falls under the activation threshold. After the normal pressure plate reset delay of 99 steps, "off" signals are sent to the door and the bridge. The door will immediately close, the bridge will lower 100 steps later. The cell is "off" and will remain so until the clock turns on again.
 
 
  
 
{{Category|Constructions}}
 
{{Category|Constructions}}
 
{{Category|Computing}}
 
{{Category|Computing}}
 
{{Category|Logic}}
 
{{Category|Logic}}
[[ru:Fluid logic]]
 

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

Templates used on this page:

This page is a member of 1 hidden category: