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:]
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:]