Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Automated obsidian farm grumbles....  (Read 2266 times)

jcochran

  • Bay Watcher
    • View Profile
Automated obsidian farm grumbles....
« on: November 09, 2013, 11:29:01 am »

I've made an obsidian farm on my last few fortresses and in every case, it's gone rather smoothly. So I decide to automate the sequence this time. Surprisingly, the logic I constructed worked flawlessly.But Murphy reared his ugly head causing his own brand of fun.

First, the overall design of the factory.
Just a simple 20x20 pit a few Z levels deep. Each level has a drawbridge granting access (the bottom level has 2 drawbridges. One granting access to the fortress proper, the other granting access to the caverns. That way if something nasty spawns down there, I can use the obsidian farm as a killing chamber for unwelcome guests). At the very top of the pit is 4 10x10 retracting bridges. At two corners on the same edge are 1x1 drawbridges acting as floodgates for magma and water. At the opposite corner of each of those drawbridges are fluid sensors which will be described later.

In any case, the operation goes as follows.
1. Close the entrances to the pit and close the retracting bridges at the top.
2. Open the drawbridge for magma until the top is completely full of 7/7 magma.
3. Close the magma drawbridge, and open the retracting bridges.
4. Close the retracting bridges and open the drawbridge for water. Wait until full of 7/7 water.
5. Close the water drawbridge, open the retracting bridges.
6. Finally, open the entrances to the pit and proceed to mine the newly created obsidian.
Have done the above many times without a problem. So I figured automation was the next step. Upon consideration, I decided that the logic involved 5 states. For this description, the following terms are used:

Drop bridge - The retracting bridges that support the fluid while it's being supplied. These bridges are magma safe.
Magma source - The bridge controlling the flow of magma onto the drop bridge. Open = magma flowing.
Water source - The bridge controlling the flow of water onto the drop bridge.
Entrances - All bridges granting access to the casting chamber. Will control them as a single unit.

1. Idle - Entrances open. Magma and water sources closed. Don't care about the drop bridge.
    Transition to Magma fill when control lever is toggled.
2. Magma fill. Entrances closed. Drop bridge closed. Magma source open. Water source closed.
    Transition to Magma drop when full of magma.
3. Magma drop. Entrances closed. Drop bridge open. Magma and water sources closed.
    Transition to Water fill when empty of magma.
4. Water fill. Entrances closed. Drop bridge closed. Magma source closed. Water source open.
    Transition to Water drop when full of water.
5. Water drop. Entrances closed. Drop bridge open. Magma and water sources closed.
    Transition to Idle when empty of water plus a delay long enough for stuff at bottom of pit to be converted to obsidian.
    (e.g. long enough to the water to actually hit the bottom of the pit).

Nice and easy. Looking at the opening and closing of the drop bridge, it became fairly obvious that since the magma and water source bridges were both drawbridges and the drop bridge a retracting bridge that I could simple connect the drop bridge to the same triggers as I connect the magma source bridge and the water source bridge. So when the trigger for the magma source goes "off" the magma source is actually open, while the drop bridge is closed. So with two triggers (one for magma, and one for water), I could link each trigger to the appropriate source bridge and both triggers to the drop bridge and the drop bridge is handled automatically. No need to handle it separately.

Detecting full and empty required a couple of fluid sensors. I wanted them to reliably detect when the drop bridge was full, not merely covered with some depth of fluid. The random "skittering" of fluid levels was my concern. So I placed each fluid sensor at the opposite corner of the drop bridge from the fluid source that it was detecting. And Has flow going into the sensor via a diagonal connection. I figured that by doing that, I wouldn't get 7/7 fluid unless that corner of the drop bridge has been covered with 7/7 fluid for quite a while. The design was

######
#X^╬##       Floodgate, pressure plate (set to trigger on 7/7 fluid), drawbridge.
####╔═
####║+      Corner of drop bridge

The drawbridge and floodgate are controlled by the same trigger so when one is open, the other is closed. Happily, they're also connected to the same trigger as what controls the fluid. So when magma is pouring in, the appropriate fluid sensor has its diagonal connection open and visa-versa.

So I figured that to detect a full condition, all I needed to do was see the appropriate pressure plate go active. As for the empty condition, simply detecting that the pressure plate was inactive wasn't enough. I had to detect the falling edge of the pressure plate. So the overall set of logic constructions I needed were 6 in all.

3 newton cradle memory cells. Instead of using power, gears and rollers, I instead used a 2x1 pit with a hatch cover at each end to provide the needed movement. A nice simple design using no power. One cradle was linked to the magma source and drop bridges. Another to the water source and drop bridges. And the third to the entrance bridges.

1 edge detector triggering on either edge of the control lever. So when the control lever was toggled, a single pulse would be sent out. For this I used the design at http://dwarffortresswiki.org/index.php/User:Larix/MPL/3#Double-action_switch
The pulse generated was sent to activate the entrance bridges newton cradle and the magma source newton cradle.
1 falling edge detector triggered by the magma sensor. For this I used the same design as above except I split track leading from the NW hatch cover & pit into two paths using derailment so I could place a pressure plate on the return track and only get a pulse when the magma sensor went inactive. That pulse was sent to activate the water newton cradle. The magma sensor was also connected to the magma newton cradle to deactivate it when the sensor tripped.
1 falling edge detector triggered by the water sensor. Same design as above. It's output was linked to deactivate the entrances newton cradle. And the water sensor was also connected directly to the water newton cradle to deactivate it as well.

So. Now for the introduction of Murphy.....
Throw the lever. The newton cradles for the magma source and the entrances both toggle, the appropriate bridges open and close and magma starts to fill. Nice.
Soon after the drop bridge is covered with magma, the magma source cradle toggles, appropriate bridges open and close and magma drops to the bottom of the pit. Soon afterward, the water cradle toggles, bridges open and close, then water begins to flow. Nice again.
Soon after the drop bridge is covered with water, the water source cradle toggles, bridges open and close. And water begins to drop. Going according to plan.

A SECTION OF THE CAVERN HAS COLLAPSED

WTF?!?!?! I've never gotten that warning before on my obsidian farm. Something odd is going on. Hit space to unpause things and let 'em continue.
After a few more COLLAPSED messages, things settle down and I can examine the situation.

The newton cradles and all the bridges, floodgates, and whatnot are all set as expected. The thing actually went through the complete cycle flawlessly. But the expected layer of 20x20 obsidian isn't quite right. It's mostly obsidian, but there are randomly scattered pockets of 7/7  magma within it. And on the Z level above, there's a few bits of 1/7 magma also randomly scattered. Hmm. I've never seen this before with my manually controlled obsidian farms. So I contemplated the situation and tried to figure out what happened.....

Well, when I was controlling things manually, I would notice after a magma drop that at the bottom, I would mostly see 7/7 magma with a few 6/7 magma tiles randomly skittering about while on the Z level above, there would be a few 1/7 magma tiles also randomly skittering about. Eventually, the 6/7 and 1/7 tiles would sit on top of each other and convert to 7/7 tiles until the bottom layer become full of 7/7 magma tiles with no 6/7's or 1/7's skittering about. So I think that when I was controlling things manually, there was enough time for this consolation to occur, while the automated system was too fast and the water dropped, reacting with the 1/7 tiles a Z level too high, causing the cavein notices when the newly formed obsidian blocks fell 1 Z level. This also caused the consumption of water so there were a few tiles in the main pool that didn't get wet and solidify. Ugly.

Now what to do to solve this problem? I see several different solutions. Each with advantages and drawbacks.
1. Put a longer delay between the dropping of magma and dropping of water. This would replicate what happened with I was doing things manually, but getting the delay right would be problematical.
2. Don't drop the magma. Instead have it sourced at the bottom of the pit in the first place. This would prevent two layers from being formed even temporary and avoid the problem entirely. However, it would limit me to casting a single layer of obsidian only and I sometimes would cast 2 or 3 layers on top of each other, then mine them all out. This would work with the minimum amount of effort, but limits flexibility.
3. Drop less magma. If enough magma was dropped so that the pit would be covered with at least 2/7 magma, but not enough to be covered with 7/7 magma, a second layer of 1/7 skitters ought not to last long enough for the water to fill up. This would allow me to cast multiple layers before digging. But creating the "short drop" is a problem.

I'm going to attempt to use solution 3. The "short drop" will be by having a 16x16 drop bridge placed 1 Z level about the current 20x20 drop bridge. I'll treat the 16x16 bridge just for magma and the 20x20 bridge just for water. Since the bridges are open when the appropriate fluid source is closed, the magma drop should just pass through the empty space that the water drop bridge occupies and it ought to be able to flow the 2 tiles to completely cover the bottom of the pit and in doing so result in an average fluid level between 4/7 and 5/7 which shouldn't be able to support a second later of skittering 1/7's for any reasonable length of time. No logic changes needed.

Logged

Merendel

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #1 on: November 09, 2013, 08:30:35 pm »

Probably your number 3 is the best option.  Just be sure  you have enough of a delay between the magma drop fireing and the water bridge closeing for its fill.  you really dont want that bridge to close before the magma has fallen past all the way.

As a potential alternitive you could keep both at 20x20 but use an alternitive fill method for the magma.  build a second 20x20 room as a priming chamber for your magma drop bridge. This chamber is seperated by a wall/floodgate from the drop bridge.  Fill priming chamber to full.  Stop filling priming chamber and then open gate into the drop chamber.  When the fluid levels equalize you should have 3/7-4/7 accross the whole area.  Reseal the gate to the drop chamber (you can begin refilling priming chamber at this point).  Drop magma,  drop water. reset and start from the begining.  there are probably a few other more space efficent methods of injecting a mesured amount of magma in as well.

If you dont mind cavein warnings you could also just fill a 22x22 shaft of whatever hight with water and just repeatedly fill and drop the magma chamber.  When you've reached the desired amount of stacks let the remaning water drain into the caverns or wherever and have bridges along a side so your miners can access the new stack of obsidian.
Logged

Larix

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #2 on: November 10, 2013, 09:57:32 am »

Yeah, going for less magma to drop sounds like the best approach. I've never done proper farming, but filled a mined-out 20x20x20 block with obsidian. I wasn't automating that at all, just monitored it and ordered the magma and water supplies cut whenever the fluid had reached 3/7 filling height in the corners (filling in water from the centre and magma from one side). I only got irregular obsidian generation once, when i didn't pay attention and got too much of one liquid.
I think you'd only need to rebuild the pressure plate measuring magma level with a lower trigger threshold.

Oh, and you managed to decipher some of my massive user page ramblings? I'm impressed, and a little relieved  - apparently, sufficiently clever people _can_ understand and replicate that stuff. (I guess i just had the bad luck of discovering the game when the big computing research was done already; of course, fiendishly overcomplicated stuff like my multiplication device are probably too outlandish for wide appeal anyway.)
« Last Edit: November 10, 2013, 10:00:27 am by Larix »
Logged

jcochran

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #3 on: November 10, 2013, 01:53:02 pm »

Probably your number 3 is the best option.  Just be sure  you have enough of a delay between the magma drop fireing and the water bridge closeing for its fill.
Well, since the water bridge doesn't close until the edge trigger on the magma sensor trips, I think I have enough delay.

1. Magma bridge opens. At the same moment, the bridge on the magma sensor closes and the floodgate opens. This, within a tick or two, will cause the 7/7 magma on the pressure plate to drop to 3/7 or 4/7.  Now a 100 tick delay starts while the pressure plate twiddles its figurative thumb before sending an off notice to the edge trigger.

2. Edge trigger finally get the word some 100+ ticks after the magma started falling. Some ticks later (exact number depends upon where in the loop the minecart is) its pressure plate gets run over by a minecart. Call it somewhere between 20 and 50 ticks give or take.

3. The water drop bridge gets notice to close.... And takes 100 ticks to do so. So finally, that bridge is closed and water starts to pour in. This activity starts about 200+ ticks after the magma had started falling from 1 Z level above. I'm pretty sure that the magma will have safely fallen past the water drop bridge.

Mine, this doesn't count the delay in the newton cradle. Haven't bothered to examine it, but given the experience I've had with a 2x1 ramped pit on a repeater, I would expect that device to have about a 15 to 20 tick delay after getting notice to toggle state.
Logged

jcochran

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #4 on: November 10, 2013, 02:27:13 pm »

I think you'd only need to rebuild the pressure plate measuring magma level with a lower trigger threshold.

I considered lowering the threshold for the magma sensor and possibly relocating the magma sensor to be closer to the magma source, but decided that wouldn't work for several reasons unless a LOT of experimentation was done.

1. No matter what, there would be a 100+ tick delay between the plate triggering and the magma being cut off.

2. My magma source has a VERY HIGH throughput. Yes, magma doesn't follow pressure mechanics like water does, but it does obey gravity. And my magma source is as follows.
   a. Have a nice magma pipe leading towards the surface. I've tapped said pipe about 20 or so levels below its top. The tapping went as follows.
       Dig channels next to the obsidian wall surrounding the magma pipe. This channel is only 2 tiles away from magma at any point.
       Cover the channels with retracting bridges.
       Dig up and diagonally to remove the obsidian wall separating the bridges from the magma. In reality, this means that about 1/2 of the circumference of the magma pipe has now been dug out so it can flow a mere 2 tiles. And since there's a lot of magma directly overhead the tiles where the pipe originally existed always have 7/7 magma within a tick of being drained. So the tiles next to them get filled up extremely rapidly. And the same goes for the tiles only 2 spaces away from the main pipe.
       1 Z level about the bridges are the screw pumps with their inlets covered with grates (to keep any magma beauties from getting access) There are 7 screw pumps on this level (their power is obtained via a gear and axial train 1 Z level above them. And since the tile that the pump is sucking from gets refilled rapidly, those pumps can push a lot of magma. All 7 of them pump into a common manifold.
Finally, a conventional pump stack drawing from the manifold. This stack will usually push 7/7 magma per tick. For pretty much as long as I want. I estimate that it would cover an area about 16K tiles full of 7/7 magma before it slows down assuming I could find enough open area for it to pump to.

Given that rate of flow, I'm somewhat wary of attempting to anticipate when to close the valve to cease the flow of magma in time to leave a partial drop. Merely increasing the plates sensitivity is definitely not going to work since by the time it sees only 1/7 magma, it's highly likely that the drop bridge has already been completely covered with 7/7 magma and if it hasn't, it will be within a few ticks at most (this is because I'm feeding magma in at a corner, and the sensor is at the opposite corner). So I'd have to relocate the sensor.

As for my water supply, it also has an equally rapid delivery rate. But not quite as much burst capacity as my magma. For water I take advantage of pressure mechanics and instead dig a cistern at the bottom of the stack This cistern is 10x10x7 which actually means that it's effective capacity is about 600 tiles of 7/7 water (I don't count the bottom layer of the cistern since that layer is restricted to flow mechanics which is a lot slower than pressure mechanics). The bottom pump of my pump stack has it's input sourced from the bottom of the cistern which does mean that little room is flooded in use because the pressure does force the water up. But that also means it always has 7/7 water every tick to push on its way. The cistern is filled at the top using a few more pumps pulling un-pressurized water up through grates as a critter barrier. Their throughput isn't anything to write home about and they definitely can't keep up with the main pump stack, but the cistern does tend to get topped off in a timely fashion when demand permits.

I find that having the cistern at the bottom of a pump stack instead of at the top has quite a few advantages.
1. I get a large burst flow rate at every level of my pump stack.
2. Since I'm not tapping into a pipe from a water source above me, that burst rate doesn't come with the cost of over-pressurized water. Water that I tap directly from the pump stack won't attempt to flow upwards any higher than at the point where I tapped it. With an elevated cistern, I'd need to worry about that or I'd need to use a diagonal pressure reducer. And using a pressure reducer would totally kill the flow rate that I currently enjoy.
Logged

Xob Ludosmbax

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #5 on: November 10, 2013, 04:08:03 pm »

The way I do it is a bit simpler.

Dig out a 9x10x10 chamber.  At the top layer, build a bridge such that when it opens, it will block the water supply.  Attach this to the trigger lever.  Four levels under that, do the same thing with magma.  (IIRC, it was 3 levels minimum).  Attach the bridge to the same trigger lever.  And you need at least one level of air gap between the bridge and the casting chamber, (so that no floor is generated under the bridge).  I always add a few extra layers of air gap to account for accidents.

Water Supply____________|
              |.........|
              |.........|
              |.........|
              |.........|
Magma Supply____________|
              |.........|
              |.........|
              |.........|
Entrance______O_________|


Bridges are in red.  Pull the lever, bridges raise, and you get:

Water Supply__|.........|
              |.........|
              |.........|
              |.........|
              |.........|
Magma Supply__|.........|
              |.........|
              |.........|
              |.........|
Entrance______O_________|


Both water and magma can be pressurized to fill the chamber more quickly.  Magma under pressure floods more quickly but doesn't flow up. 

taptap

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #6 on: December 14, 2014, 03:42:16 pm »

I am working on a single-lever-pull obsidian farm at the moment.

A lot of the problems reported in this thread can be avoided by just filling in one fluid in the empty casting chamber
(from the side) and have the other one contained on a bridge above. Easy with 1 tile depth, more elaborate with higher depth. May need fiddling with the detectors.

Larix

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #7 on: December 14, 2014, 04:44:27 pm »

It can be done much easier. A minimal obsidian farm needs a couple of doors, and one lever and one pressure plate for operation, with liquid supplies just one level apart. What i built was simply

z+0: magma inlet (pumped) behind a floodgate and a raising drawbridge(only the floodgate/door is actually required). In the corner furthest away from the inlet, a single magmaproof pressure plate reacting to 2-7 magma, linked to both floodgate and drawbridge.
z+1: water inlet (pumped) behind doors or floodgates, once again linked to the pressure plate below.

The operation lever just switches the floodgates holding back the magma.
Operation: lever gets pulled, floodgate opens, magma pours in. Once magma reaches the pressure plate and establishes 2 height over it, the plate triggers, raises the bridge (stopping magma inflow) and opens the water gates. Water flowing on top of magma obsidianises. Once the magma over the pressure plate is turned to obsidian, the trigger condition is no longer met, the pressure plate resets and shuts off both the water and magma doors/floodgates; magma inlet must be below closed ceiling, so the magma in its tile cannot be obsidianised, blocking the doors. The bridge lowers again, so once the obsidian is mined away, another lever-pull to open the gates starts the cycle again. I ran this through several cycles and got a reliable supply of obsidian with no misfunctions. It can obviously be built to any horizontal size you want, greater sizes just take longer to fill, to the point that additional pumps may become necessary (i ran a ~ 20x20 pan with a single water pump).

The shut-off bridge isn't actually necessary if you don't pump the magma higher than z+0.
Logged

taptap

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #8 on: December 14, 2014, 05:22:17 pm »

It can be done much easier. A minimal obsidian farm needs a couple of doors, and one lever and one pressure plate for operation, with liquid supplies just one level apart. What i built was simply

z+0: magma inlet (pumped) behind a floodgate and a raising drawbridge(only the floodgate/door is actually required). In the corner furthest away from the inlet, a single magmaproof pressure plate reacting to 2-7 magma, linked to both floodgate and drawbridge.
z+1: water inlet (pumped) behind doors or floodgates, once again linked to the pressure plate below.

The operation lever just switches the floodgates holding back the magma.
Operation: lever gets pulled, floodgate opens, magma pours in. Once magma reaches the pressure plate and establishes 2 height over it, the plate triggers, raises the bridge (stopping magma inflow) and opens the water gates. Water flowing on top of magma obsidianises. Once the magma over the pressure plate is turned to obsidian, the trigger condition is no longer met, the pressure plate resets and shuts off both the water and magma doors/floodgates; magma inlet must be below closed ceiling, so the magma in its tile cannot be obsidianised, blocking the doors. The bridge lowers again, so once the obsidian is mined away, another lever-pull to open the gates starts the cycle again. I ran this through several cycles and got a reliable supply of obsidian with no misfunctions. It can obviously be built to any horizontal size you want, greater sizes just take longer to fill, to the point that additional pumps may become necessary (i ran a ~ 20x20 pan with a single water pump).

The shut-off bridge isn't actually necessary if you don't pump the magma higher than z+0.

Wait you can actually have a pressure plate submerged in obsidian operating, i.e. sending off signal, so all external fluid detector designs I made with so much love to detail aren't even required?

Larix

  • Bay Watcher
    • View Profile
Re: Automated obsidian farm grumbles....
« Reply #9 on: December 14, 2014, 10:11:29 pm »

Haven't tried it in .40.x, but it worked perfectly in .34.11 and i don't see why it should have changed; plates in freezing/melting water turn off/on properly, too. It's not exactly intuitive that pressure plates are among the few buildings that don't deconstruct when covered with obsidian, but you never know until you try...

Bridge drops do have the notable advantage that they should be able to generate "dry" magma, while my design required a bit of water draining before mining.
Logged