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 v0.31:Mechanical 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.

You are editing a page for an older version of Dwarf Fortress ("Main" is the current version, not "v0.31"). Please make sure you intend to do this. If you are here by mistake, see the current page instead.

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 7: Line 7:
 
{{av}}
 
{{av}}
  
Mechanical logic is one discipline of [[computing]] using mechanical [[power]] to perform logical operations. In this case powered or unpowered [[machine component|machine components]] represent the binary information.
+
Mechanical logic is one discipline of {{l|computing}} using mechanical {{l|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.
  
The principles of mechanical logic are simple. [[Gear assembly|Gear assemblies]] linked to [[trigger]]s will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from [[windmill]]s or [[water wheel]]s to specially arranged gears to build logic gates.
+
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger}}s will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill}}s or {{l|water wheel}}s to specially arranged gears to build logic gates.
  
 
== Mechanical logic versus fluid logic ==
 
== Mechanical logic versus fluid logic ==
* Mechanical logic is very fast. Gears don't have a reaction delay of 100 steps like most other components used by [[fluid logic]]. So if a gear is toggled the flow of power will change immediately.
+
* Mechanical logic is very fast. Gears don't have a reaction delay of 100 steps like most other components used by {{l|fluid logic}}. So if a gear is toggled the flow of power will change immideately.
 
* Mechanical logic is very flexible. Gears can toggle, so inverting signals is easy and you don't have to deal with different machine components.
 
* Mechanical logic is very flexible. Gears can toggle, so inverting signals is easy and you don't have to deal with different machine components.
* Mechanical logic is very reconfigurable. You don't have to deal with [[creature|creatures]] or fluid before changing anything.
+
* Mechanical logic is very reconfigurable. You don't have to deal with {{l|creature|creatures}} or fluid before changing anything.
  
  
* Mechanical logic needs a substantial amount of wood to create and transmit power. (So what?)
+
* Mechanical logic needs a substancial amount of wood to create and transmit power. (So what?)
* Mechanical logic still needs [[water|fluid]] to build converter to trigger something else than machine components. (If you really want to be fluid free you'll have to stick to [[animal logic]].)
+
* Mechanical logic still needs {{l|water|fluid}} to build converter to trigger something else than machine components. (If you really want to be fluid free you'll have to stick to {{l|animal logic}}.)
* <s>Mechanical logic needs a substantial amount of mechanism.</s> (Only if you stick to [[mechanical logic#Load based|load based mechanical logic]].)
+
* <s>Mechanical logic needs a substancial amount of mechanism.</s> (Only if you stick to {{l|mechanical logic#Load based|load based mechanical logic}}.)
 
 
 
== General concepts ==
 
== General concepts ==
 
There are two general conceps. The older and inadvisable one is the so called load based mechanical logic. The other one is the so called toggle based mechanical logic.
 
There are two general conceps. The older and inadvisable one is the so called load based mechanical logic. The other one is the so called toggle based mechanical logic.
 
=== Load based ===
 
=== Load based ===
Load based mechanical logic uses single logic gates with a defined amount of power. They have an additional amount of load in terms of mechanism or other machine components, consuming all of the power if connected. The gates are designed in a way that the load is disconnected while the output shall be true, and connected when the output shall be false. Every logic gate has to have its own power supply. Compact complex logic gates are very hard to design, utterly impossible.
+
Load based mechanical logic uses single logic gates with a defined amount of power. They have an additional amount of load in terms of mechanism or other machine components, consuming all of the power if connected. The gates are designed in a way that the load is disconnected while the output shall be true, and connected when the output shall be false. Every logic gate has to have it's own power supply. Compact complex logic gates are very hard to design, utterly impossible.
 
 
 
=== Toggle based ===
 
=== Toggle based ===
Toggle based mechanical logic works more like [[fluid logic]], not controlling the flow of fluid but the flow of power. It uses the fact that gears don't have a defined state when recieving an on or an off signal, but toggle between connected and dismanteled, independent of the type of signal. It normaly uses a central power supply. It is quite easy to create very complex gates with multiple output signals like for example a binary to decimal converter.
+
Toggle based mechanical logic works more like {{l|fluid logic}}, not controlling the flow of fluid but the flow of power. It uses the fact that gears don't have a defined state when recieving an on or an off signal, but toggle between connected and dismanteled, independent of the type of signal. It normaly uses an central power supply. It is quite easy to create very complex gates with multiple output signals like for example a binary to decimal converter.
 
 
 
=== Example ===
 
=== Example ===
The first example shows a load based XOR gate. It takes input signals from two different triggers. It's output gear (<span style="color:#FFFF44">O</span>) is powered when exactly one of the two input triggers is on and the other one is off. This is done as follows:<br />The power will be connected to the gear with the <span style="color:#44FF44">P</span> (from the bottom of the diagram or another z-level). One input is linked to gear <span style="color:#FF44FF">1</span> the other to gear <span style="color:#FF44FF">2</span>. This way power will flow from <span style="color:#44FF44">P</span> to <span style="color:#FFFF44">O</span> if either one of the input signals is off. Aditionally both inputs are linked to gear <span style="color:#FF44FF">3</span>, that is connected to the load <span style="color:#FF4444">L</span>. Since gears toggle the gear will be active if both singals where off (or on), and the load will stop any flow of power then. You can build this on top of a [[Mechanical logic#Power to signal converter|power to signal converter]] as shown on this page.<br />As you can see you will need many mechanism to build this gate. 5 for the gears, 8 to connect to the input in addition to all the components needed for the converter and the load.
+
The first example shows a load based XOR gate. It takes input signals from two different triggers. It's output gear (<span style="color:#FFFF44">O</span>) is powered when exactly one of the two input triggers is on and the other one is off. This is done as follows:<br />The power will be connected to the gear with the <span style="color:#44FF44">P</span> (from the bottom of the diagram or another z-level). One input is linked to gear <span style="color:#FF44FF">1</span> the other to gear <span style="color:#FF44FF">2</span>. This way power will flow from <span style="color:#44FF44">P</span> to <span style="color:#FFFF44">O</span> if either one of the input signals is off. Aditionally both inputs are linked to gear <span style="color:#FF44FF">3</span>, that is connected to the load <span style="color:#FF4444">L</span>. Since gears toggle the gear will be active if both singals where off (or on), and the load will stop any flow of power then. You can build this on top of a {{l|Mechanical logic#Power to signal converter|power to signal converter}} as shown on this page.<br />As you can see you will need many mechanism to build this gate. 5 for the gears, 8 to connect to the input in addition to all the components needed for the converter and the load.
 
<div style="width:1px; white-space:nowrap;">
 
<div style="width:1px; white-space:nowrap;">
 
'''load based XOR'''
 
'''load based XOR'''
Line 90: Line 87:
 
|}
 
|}
 
</div>
 
</div>
Yes, that's right. You'll need only one gear. This is how it works:<br />Connect it to your source of power, and link it to one of your input triggers. Build a temporary lever anywhere and connect it, too. Pull the lever once. You can deconstruct the temporary lever now. Now the gear is dismanteled, and you link the second input trigger to it. Since gears toggle, everytime your trigger changes state and sends a signal the gear will change state. Initially both triggers are off, and the gear is dismanteled. When one trigger changes state, it will activate gear. Independent of whitch trigger changes next, both will have the same state afterwards, and the gear will be dismanteled again. So the gear will transport power when both input troggers are at different state: XOR. You can build this on top of a [[Mechanical logic#Power to signal converter|power to signal converter]] as shown on this page.<br />As you can see you will need little mechanism to build this gate. 1 for the gear, 4 to connect to the input and 1 will be lost after disconnecting the temporarry lever (that needs 3 temporarry). And of course you will need all the components for the converter, but no load.
+
Yes, that's right. You'll need only one gear. This is how it works:<br />Connect it to your source of power, and link it to on of your input triggers. Build a temporary lever anywhere and connect it, too. Pull the lever once. You can deconstruct the temporary lever now. Now the gear is dismanteled, and you link the second input trigger to it. Since gears toggle, everytime your trigger changes state and sends a signal the gear will change state. Initially both triggers are off, and the gear is dismanteled. When one trigger changes state, it will activate gear. Independent of whitch trigger changes next, both will have the same state afterwards, and the gear will be dismanteled again. So the gear will transport power when both input troggers are at different state: XOR. You can build this on top of a {{l|Mechanical logic#Power to signal converter|power to signal converter}} as shown on this page.<br />As you can see you will need little mechanism to build this gate. 1 for the gear, 4 to connect to the input and 1 will be lost after disconnecting the temporarry lever (that needs 3 temporarry). And of course you will need all the components for the converter, but no load.
 
 
 
== Power to signal converter ==
 
== Power to signal converter ==
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any [[trigger]] in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.
+
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.
 
<div style="width:1px; white-space:nowrap;">
 
<div style="width:1px; white-space:nowrap;">
 
'''Z 0'''
 
'''Z 0'''
Line 260: Line 256:
 
[#000].[#000].[#ff0]O[#aaf]I
 
[#000].[#000].[#ff0]O[#aaf]I
 
[#000].[#000].¦
 
[#000].[#000].¦
[#0f0]P[#aaf]-*
+
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P
[#000].[#000].[#aaf]i
 
 
[#000].[#000].[#aaf]i
 
[#000].[#000].[#aaf]i
 +
[#000].[#000].¦
 
[#000].[#000].[#0f0]P}}
 
[#000].[#000].[#0f0]P}}
  
Line 285: Line 281:
 
| Yes
 
| Yes
 
| Yes
 
| Yes
| No
+
| Half
 
| 0
 
| 0
 
|-
 
|-
Line 292: Line 288:
 
| Yes
 
| Yes
 
| Yes
 
| Yes
| No
+
| Half
 
| 0
 
| 0
 
|-
 
|-
Line 299: Line 295:
 
| Yes
 
| Yes
 
| Yes
 
| Yes
| Yes
+
| Full
 
| 1
 
| 1
 
|}  
 
|}  
Line 305: Line 301:
 
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.
 
* 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!
 
* 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 extra P below them is additional power source, ideally only one windmill.
+
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.
* Here's where it gets complicated. The load has to be sufficient to shut down the system when additional power supply is disconnected. However, when BOTH inputs are on, there needs to be enough power from additional P to bring the system back online.
+
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps 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.
 
* 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.
  
 
{{Category|Computing}}
 
{{Category|Computing}}

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)