After noting the idea cropping up in
this thread I gave some thought to how you'd actually build such a device. The idea, in short, is a lever which the dwarves have to keep pulling to
prevent some catastrophe from occuring.
This is what I came up with.
Basically, you have a pump feeding the "fill tank" from the "water in" tile - said tank can have any geometry you want really. It exists purely to hold water, and has only two necessary features: it drains through a floodgate at the bottom into the drain tank, and the highest point in the tank is adjacent to a 1x1 room with a pressure plate in it. More on that later.
The drain tank itself contains another pressure plate, and a hatch (or alternately, another floodgate) through which water exits the system. I suggest a hatch just to make things go smoothly but it's probably not necessary.
Technically, this could be a closed system (the water out loops back to water in) but that always has the potential to get weird, and also requires a fair bit of calculation. You may also have to calibrate it in that case, as it's hard to predict ahead of time how much water might lounge around in the drain tank.
The lever in question is connected to both the floodgate and the hatch. The floodgate begins closed, the hatch begins open - when the lever is pulled, the drain tank begins to fill. The drain plate is triggered once the water level reaches a certain height, and the floodgate and hatch are returned to starting position. Basically all that means is that the drain tank is used to take measured amounts of water out of the fill tank, identical for each lever pull.
The output plate at the top of the fill tank is only triggered if the tank fills completely and water spills over into the plate's room. You can set it for any degree of sensitivity you like, but I'd probably use 3/7 or more just to be sure nothing strange happens.
That's the basic design. The the amount of total time it takes for negligence of the lever to trigger the output is based on the
absolute size of the fill tank, and the amount of extra time granted (related to how frequently the lever needs to be pulled) is proportional to the
relative volumes of the fill and drain tank i.e. the larger the drain tank's percentage of the fill tank's size, the less often the lever must be pulled.
There's one wrinkle in the system, which is this scenario: imagine Urist comes along and pulls the lever. The drain room begins filling, but before it's finished a whole fill/drain cycle, Cog comes along and pulls the lever again. This interrupts the process. It doesn't
break anything per se, but it makes the whole thing a bit less elegant, and also removes the equal weight of each lever pull.
The way most of the fluid logic guys would fix this is probably with a latch; they'd create a stored memory bit that the lever triggers to the "ON" position and which gets reset to "OFF" when the drain cycle finishes. While it's pretty awesome that that can be done, I think there's a simpler way to handle it in this particular case without having to resort to true logic systems.
X = wall
+ = floor
D = door
L = lever
P = pressure plate
XXXXX
XXLXX
PD+D+
XXXXX
Basically, the door on the right is the "in" door. The left door is the "out" door. Initially, the in door is unlocked. A dwarf enters the in door and pulls the lever. The lever toggles both doors - now the out door is open, and the in is locked. He leaves through the out door, and the pressure plate outside the out door locks it behind him. Effectively this bars any further input (lever pulling) until the drain cycle finishes and unlocks the in door again.
So, with that out there - does anyone have some good suggestions on how to employ this delightful invention? Or has anyone noted some problems in the design which might allow for unfortunate accidents? I do know that this design relies on the output plate being on the same z level as the pump
and that pumps still pressurize water up to their own z level. I'm told that latter half is a bug (by the wiki) but that seems unlikely to actually be a bug.