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.

Difference between revisions of "User:Jyppa/Clock"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Work in progress, needs illustration and proper crediting=
 
 
 
==An accurate water clock==
 
==An accurate water clock==
  
Line 9: Line 7:
 
The repeater is a series of pumps pushing a single tile of water in circles. At each step along the way, a pressure plate is depressed, and the next pump in sequence is disconnected, leading to a 100 step delay between jumps, the exact reset time of a pressure plate. By extending the cycle to cover 1200 steps, one dwarf day, and synchronizing it with the game calendar, you will have created the foundation for a fully accurate, robust and compact clock, that can be designed to trigger certain fortress function at set intervals. For details on how to construct the basic repeater, refer to [[User:MrFake/NStepCyclicRepeater|the original design by MrFake]] or [[User:Hussell/ClockRepeater|Hussell's version]]. Each repeater needs to be powered separately.
 
The repeater is a series of pumps pushing a single tile of water in circles. At each step along the way, a pressure plate is depressed, and the next pump in sequence is disconnected, leading to a 100 step delay between jumps, the exact reset time of a pressure plate. By extending the cycle to cover 1200 steps, one dwarf day, and synchronizing it with the game calendar, you will have created the foundation for a fully accurate, robust and compact clock, that can be designed to trigger certain fortress function at set intervals. For details on how to construct the basic repeater, refer to [[User:MrFake/NStepCyclicRepeater|the original design by MrFake]] or [[User:Hussell/ClockRepeater|Hussell's version]]. Each repeater needs to be powered separately.
  
To create the clockwork for the simplest possible year cycle, you will need four repeaters, of 14, 14, 8 and 6 steps respectively, corresponding to hours, years, days and weeks in that order. The excess steps are necessary for holding the trigger plate that activates another repeater at the end of the cycle, thus allowing 12*100 steps to increase a single step on the "days" counter, etc. If you wish to build a clock on these specifications, you should start by constructing you basic timekeeping cycle, the 12-step repeater that cycles each day. Remember to add the two extra pumps to allow for the trigger mechanism.
+
To create the clockwork for the simplest possible year cycle, you will need four repeaters, of 14, 14, 8 and 6 steps respectively, corresponding to hours, months, days and weeks in that order. The excess steps are necessary for holding the trigger plate that activates another repeater at the end of the cycle, thus allowing 12*100 steps to increase a single step on the "days" counter, etc. If you wish to build a clock on these specifications, you should start by constructing you basic timekeeping cycle, the 12-step repeater that cycles each day. Remember to add the two extra pumps to allow for the trigger mechanism.
  
 
[Illustrate and explain in more detail how the trigger is set up]
 
[Illustrate and explain in more detail how the trigger is set up]
Line 32: Line 30:
  
 
Another way to link everything up, is by linking the year increase trigger to only one resistor chamber, say that one of the 11-year cycle. If you then link the 11 year trigger to the resistor chamber of the other cycle (in this case, the 7-cycle), that will only trigger after it's been triggered 7 times. For this, the 11 cycle needs to go round 7 times. For this, the year cycle needs to go around 11 times for one 11 cycle or 11 times 7, 77 times. Which corresponds to 77 years. Instead of linking both the 7 and the 11 cycles, in combination with the week and month cycle, only link the trigger of the last cycle (in this case, the 7 cycle) with your entrance. In the given example, you want it to happen in week 3 of Galena, every 77 years. So, it should be in week 3 AND in month 6 (Galena) AND when the plate of the 7 cycle has been trigged. From there on, it's a 'simple' use of logic gates.
 
Another way to link everything up, is by linking the year increase trigger to only one resistor chamber, say that one of the 11-year cycle. If you then link the 11 year trigger to the resistor chamber of the other cycle (in this case, the 7-cycle), that will only trigger after it's been triggered 7 times. For this, the 11 cycle needs to go round 7 times. For this, the year cycle needs to go around 11 times for one 11 cycle or 11 times 7, 77 times. Which corresponds to 77 years. Instead of linking both the 7 and the 11 cycles, in combination with the week and month cycle, only link the trigger of the last cycle (in this case, the 7 cycle) with your entrance. In the given example, you want it to happen in week 3 of Galena, every 77 years. So, it should be in week 3 AND in month 6 (Galena) AND when the plate of the 7 cycle has been trigged. From there on, it's a 'simple' use of logic gates.
 
===Some examples of Fun things to do with your new toys===
 
 
[Put best ideas from suggestion thread here.]
 
  
 
==Simplified mechanical logic==
 
==Simplified mechanical logic==

Latest revision as of 11:06, 9 December 2010

An accurate water clock[edit]

This is a basic guide to constructing the clock system described in [this|http://www.bay12games.com/forum/index.php?topic=49193.0 this] forum thread. In a nutshell, it is a series of pump based repeaters, as described by MrFake, only modified to serve as counters rather than regular repeaters. For another clock design, check this one built by Hussell.

Basics[edit]

The repeater is a series of pumps pushing a single tile of water in circles. At each step along the way, a pressure plate is depressed, and the next pump in sequence is disconnected, leading to a 100 step delay between jumps, the exact reset time of a pressure plate. By extending the cycle to cover 1200 steps, one dwarf day, and synchronizing it with the game calendar, you will have created the foundation for a fully accurate, robust and compact clock, that can be designed to trigger certain fortress function at set intervals. For details on how to construct the basic repeater, refer to the original design by MrFake or Hussell's version. Each repeater needs to be powered separately.

To create the clockwork for the simplest possible year cycle, you will need four repeaters, of 14, 14, 8 and 6 steps respectively, corresponding to hours, months, days and weeks in that order. The excess steps are necessary for holding the trigger plate that activates another repeater at the end of the cycle, thus allowing 12*100 steps to increase a single step on the "days" counter, etc. If you wish to build a clock on these specifications, you should start by constructing you basic timekeeping cycle, the 12-step repeater that cycles each day. Remember to add the two extra pumps to allow for the trigger mechanism.

[Illustrate and explain in more detail how the trigger is set up]

Using mechanical resistance for triggered increments[edit]

In order to link two repeaters in such a fashion that one takes a single step for each full circle the other completes, it is necessary to make a few modifications of the design. This could be accomplished in different ways, but the one I found simplest is what basically equates to a crude NOT mechanical logic gate. The repeater you wish to link to a faster cycle needs to be powered separately, ideally using only the minimum amount of power required to run the entire repeater without interruption. Next, you need to create a mechanical resistance that keeps the repeater from running at regular 100-step pace. This can be accomplished simply by carving a small chamber next to the repeater and filling it with gears or other components that require power to operate. Connect this "resistor" to the repeater and make sure that it drains enough power to completely deactivate the entire repeater plus 30 power, representing the two pumps with attached gears that will normally be disconnected at any given time.

Connect the resistor to the repeater with a single gear. When given an on signal, the gear will disconnect, powering the repeater and allowing it to run at normal operation until connected again. When making a clock, you simply need to connect a trigger plate as described above. Since the trigger plate is only briefly skipped past by the water, it will keep the triggered repeater moving for almost exactly 100 steps, depending on what sequence you built the different repeaters (building in any other order than that of pumps->gears->plates will introduce a slight delay in the system, see Hussell's full explanation in the article linked earlier). However, after the water tile leaves the trigger in the fast repeater, there will be several ticks before the slow repeater pumps its water tile from its previous position. Since that will cause the resistor to be reconnected before the repeater 100 step delay kicks in (to take another jump), we have effectively increased the slower repeater by one.

[Illustration of resistor setup here, maybe?]

Building the basic clockwork[edit]

Once you have a repeater representing your shortest unit of measured time, and have understood how to use the resistance-based trigger mechanism as described above, you are ready to build a working clock. First, connect the 12+2 step main cycle trigger to the resistor of the 7+1 step "week" cycle, to increase the day count by one each time the main cycle completes a pass (one day). After that, connect the 7+1 step cycle's trigger to the resistor of the 4+2 step "month" cycle which will count off your weeks. Lastly, connect the trigger of that cycle to your 12+2 "year" cycle, and you have a clock that knows the current day, week and month, allowing you to plan your nefarious doomsday mechanism to work on a yearly basis.

Expanding the system[edit]

The clock function is actually a very specific use of repeater-based "dwarfputing". Since you now know the principles of triggered increments, you can create new repeater cycles counting anything from a few hours to millennia without too much effort. Suppose, for example, that you wish to open the inner sanctum of your grand temple of Armok only for one week every 77 years, say week 3 of Galena. What you would do is find the lowest prime factors of 77, being 7 and 11. Then you would build two new cycles counting those numbers (feel free to use them for other things as well, they serve just as well as 7 and 11 year cycles once built), remembering to make place for a trigger plate in each cycle, thus making them effectively 8 and 12 steps long. Next connect the year increase trigger to both resistor chambers, making both increase by one each year.

Next, design your temple entrance. Exactly how you wish to have it open/close/sacrifice children is up to you, but if it's very complex, you might have to be innovative with the triggering mechanism. Lastly, connect the plate representing the third week of the month, the plate representing the month of Galena and both end points of the 7 and 11 year cycles to a logic equivalent of week AND month AND year AND year. You can use regular AND gates for this (see computing), or use something like the simplified logic system described below. In the original thread, Kidiri drew up a basic schematic for a similar system, which illustrates the basic concept.

Another way to link everything up, is by linking the year increase trigger to only one resistor chamber, say that one of the 11-year cycle. If you then link the 11 year trigger to the resistor chamber of the other cycle (in this case, the 7-cycle), that will only trigger after it's been triggered 7 times. For this, the 11 cycle needs to go round 7 times. For this, the year cycle needs to go around 11 times for one 11 cycle or 11 times 7, 77 times. Which corresponds to 77 years. Instead of linking both the 7 and the 11 cycles, in combination with the week and month cycle, only link the trigger of the last cycle (in this case, the 7 cycle) with your entrance. In the given example, you want it to happen in week 3 of Galena, every 77 years. So, it should be in week 3 AND in month 6 (Galena) AND when the plate of the 7 cycle has been trigged. From there on, it's a 'simple' use of logic gates.

Simplified mechanical logic[edit]

As previously mentioned, there are many other potential uses for repeaters, mostly as simpler versions of more general computing components. For example, they make very good counters as long as they don't need to operate at a higher frequency than 200 steps. If you want to store a value that can tolerate the need to count up from zero, it's a fairly easy solution, working with any number base. For decimal values, as an example, you simply build N 10+2 jump repeaters, each representing the 10^(N-1) part of the stored number. You may also want to design more complex interactions than simple "on" or "off" signals, requiring computer logic. I will here detail my usual "hack" for making simple AND, OR and NOT gates with minimal fuss. The primary benefit is simple, logic gates require space. You can consider this a "dirty" approach to Mechanical logic.

Resistance-based logic[edit]

If you aren't familiar with dwarfputing, or just don't want to design your magnificent Turing complete dwarfputer today, there are several little hook-ups you can use to imitate the functionality of a logic operation. This is really nothing remarkable, but I felt it deserved a little section for its usefulness in building timed mechanisms. They are all based on connecting/disconnecting a machine from either its power source or an inhibiting resistor as used in the clock design described here.

Single gear as limited OR[edit]

By connecting a resistor to several inputs that will not be active at the same time, you get the equivalent of an OR operation. However, if either on trigger could possibly turn OFF while the other is still ON, the gear will still recieve an OFF signal and stop the machine. This can be used to keep a bridge closed during certain months, for example. NB, if you do this with consecutive months without somehow delaying the process, the new month plate will activate before the old one resets, resulting in what the internets describe as "epic fail" and fortresseers as "Fun".

[Illustration here]

Sequenced gears as OR[edit]

By connecting a resistor with two gears in sequence, you have created a "true" OR gate. Linking them to the power source will create an opposite effect, NOT, making the system power off if either gear is turned on.

[Illustration here]

Parallel gears as AND[edit]

Two gears connected in parallel between the resistor and the powered function will act as a natural AND, as long as they both can relay the power all the way from the power source to the resistor. Placed between the power source and the function, they act as NAND.