# Tri-Iron Tank Management Controls System

#### namiasdf

##### New Member
So I was playing around with CC, BC logic gates in attempts to find a solution for this problem:

This can be adapted to any tri-liquid system where you are concerned with the drainage of two slow accumulation liquids, while stopping another. Specifically:

[honey]/[applejuice]/[water] ------> fermenter

I needed a control system to decide when to send honey, apple juice or water to my fermenters. The condition was when either the honey or apple juice tank is full, stop the water and send either of the two.

An issue with this is if both tanks are full during the others drain cycle, due to the behaviour of the CC computers, several control systems need to be implemented. This also allows for a liquid specific stream ONLY to occur. i.e. honey, apple juice and water will not mix.

Requirements:

Two computers, 2x AND autarchic gates, (x = number of output valves)

set1 autarchic gates are responsible for the outflow of liquid from tank. Each set1 gate requires a set2 gate for the simultaneous full situation.

Solution:

set1: [autarchic gates]:
(1a) redstone = pulsar
(1b) blue/green signal off = pulsar (opposite colour to below statement)
(1c) liquid flow = blue/green signal on (opposite colour to above statement)
(1d) liquid flow = red signal on (shuts off water source)

set2: [autarchic gates]:
(2a) tank full = redstone
(2b) blue/green signal off = redstone (opposite colour to (1b), same colour as (1c) above)

Code:

//sideA = tank full signal source
//sideB = send signal to autarchic gates
//sideC = send signal to other computer

while true do

--redstone.setOuput("sideA", false) //resets parameters to be safe
--redstone.setOuput("sideC", false)

--os.pullEvent("redstone") //start stuff when redstone signal is received

--if redstone.getInput("sideA") == true //if receive tank full signal
----redstone.setOutput("sideB", true) //turn on autarchic gates
----redstone.setOutput("sideC", true) //sleep other computer
----sleep(5) //small break
----redstone.setOutput("sideC", false) //turn off signal to sleep other computer to prevent redstone issues
----sleep(x) //sleep computer for x, where x is estimated drain time

--elseif redstone.getInput("sideC") == true //if receive signal from other computer, i.e. other system is draining
----sleep(x+10) //sleep computer for x+10, where x is estimated drain time

--end

end

Examples:

e.g. If honey full:

start: all signals off, we set (1b) for honey to blue, (1c) for honey to green
(1b) for apple to green, (1c) for apple to blue

1. redstone signal to computer
2. computer send redstone signal to other computer, sleeps it
3. computer send redstone signal to honey autarchic set1 gate, activates it
4. gate activates green signal -> since (1b) for apple is true, its set1 gate cannot activate (prevents parallel draining)
4b. gate activates red signal -> water gates set to off, if red, turning off water flow

e.g. If honey full while apple draining

start: (1c) for apple means blue signal ON = (1b) for honey, deactivate set1 honey autarchic gate, (2b) for honey, deactivate set2 honey autarchic gate

1. set2 autarchic gate: tank full, but blue (2b) signal is on, wait until apple juice flow is over
2. when blue signal off, set2 gate will pump out one tick worth of liquid, resetting tankfull status for honey tank
3. this will activate honey computer, start draining sequence

The reason why this sequence is needed, is if honey becomes full during apple, its computer will be slept. Once its computer awakens, even if the "tank full" signal is still active, it will not read it. i.e. The computer will only read signals sent after its awaken, so if we do not perform this small reset, honey's computer will never acknowledge that its tank is full.

[Pictures soon:]

#### gattsuru

##### Well-Known Member
If you have ThermalExpansion, you can also do this without ComputerCraft. Set the Fruit Juice and Honey tanks to your squeezer or an intermediary small tank with Liquiducts set to always on. Use "Tank Empty" -> Redstone signal from each of the honey and fruit juice tanks, run to a redstone AND gate, and then run redstone from the AND gate to an Aqueous Accumulator set to "Signal Required : High". If the tanks are only one block away from each other, you can actually use a single BuildCraft gate on some pipe scaffolding with the "Liquid in Tank" condition running to an Aqueous Accumulator set to "Signal Required: Low".

No Ender Pearls or ComputerCraft required.

It can be helpful to have an intermediary 1x1 tank, if your squeezer is a long way off, to act as a filter.

#### namiasdf

##### New Member
Thing is, how can you maintain the signal from "tank empty" once a little bit of liquid has entered the tank. In all cases using "tank full" or "tank empty" you need a timer. That's where the CC comes in. It's only a timer, heh.

#### namiasdf

##### New Member
A substitute for the timer is a latch, but I found those to be unreliable. Especially if there is back up fluid in the input pipes to the tank. You could activate the "tank full" or in the cases of output>input when empty, "tank empty" too many times and reverse the logic.

This way is flawless and self recovering. I like to have a bit of security and redundancy to my systems, heh. Engineer stuff.