# Water-logic: introduction

Pumps and narrowed-down pieces of pipe are not enough to implement Boolean logic using water.

That's why the valve is introduced as switching element, allowing a pressure-difference in a circuit to affect a pressure-difference somewhere else in the circuit.

By combining several valves, more complex logic-blocks can be created.

# The valve

Imagine taking a closed hollow cylinder with a hole in one end, and 2 more holes in the hull, near the opposite end. Inside this cylinder, a spring pushes a hollow piston towards the end with the hole.

In rest, assume that the piston-and-spring construction blocks the path between both holes in the hull.

However, when pushed in, the hollow piston gets positioned so that water can flow into one hole in the hull, through the piston, and out the other hole in the hull.

By varying the water-pressure at the hole in the cylinder-end, the piston can be moved. Thus, a pressure at one point determines whether water can flow through the cylinder or not - that is, whether it "conducts" water or not. (For the sake of simplicity, only states "conducting" and "non-conducting" are considered - nothing in between.)

In case the cylinder doesn't conduct, there can be a pressure-difference between both holes in the cylinder-hull, for example generated by a pump. When the cylinder conducts, the pressure-difference between both of these holes is considered to be zero.

Therefore, using this kind of valve, a pressure-difference in a circuit can control a pressure-difference elsewhere in the circuit.

# Making a NOT-block

One of the most basic applications of this valve is to apply a pressure-difference by removing a pressure-difference elsewhere, or vice versa - removing a pressure-difference by applying a pressure-difference elsewhere.

To see how this works, consider a valve placed behind a narrowed-down piece of pipe. Water can flow through the narrowed-down piece of pipe only if the valve conducts. The piston of the valve is controlled by a secondary pump.

(Remember that water flowing through a narrowed-down piece of pipe causes a pressure-difference over it. However, if no water flows through it, the pressure is the same at both of its ends.)

If the secondary pump is powered off, no water-pressure is applied at the valve's piston, and the valve doesn't conduct. If in addition the primary pump is powered on, it creates a pressure-difference that has to fall over the combination of narrowed-down piece of pipe and valve.

Since no water can flow through the narrowed-down piece of pipe (because the valve behind it doesn't conduct), the pressure is the same at both of its ends. The full pressure-difference caused by the primary pump falls over the closed valve instead, and the pressure at the location indicated by the arrow is high (red).

Thus, the secondary pump can be turned off to cause a pressure at the indicated location.

Likewise, when the secondary pump is switched on, it applies a pressure at the valve's piston, causing the valve to conduct.

Now that the valve conducts, water can flow through the narrowed-down piece of pipe, causing a pressure-difference over it.

(Or put differently, there is no pressure-difference over the valve anymore, so the primary pump's total pressure-difference falls over the narrowed-down piece of pipe instead.)

The pressure at the indicated location is now effectively atmospheric (blue) - the same as in the reservoir.

Thus, the secondary pump can be turned on to remove a pressure at the indicated location.

The circuit shown here effectively implements a NOT-block (or "inverter") using water.

# Making a NOR-block

The NOR-block is quite similar to the NOT-block. Remember that the NOR-function works as follows: the output is True only when neither of the 2 inputs are True. So the NOR-block, like the NOT-block above, has an inverting nature.

All that's necessary to convert a NOT-block to a NOR-block, is adding an extra valve and pump, parallel to the already present valve.

That is, behind the narrowed-down piece of pipe, the circuit splits into 2 valve-and-pump sections.

In rest (both valve-pumps are powered off), no water can flow through the narrowed-down piece of pipe, because neither valve conducts. The full pressure-difference caused by the primary pump then falls over the parallel valves, and the pressure at the indicated location is high.

(Or put differently, there is no water-flow through the narrowed-down piece of pipe, so the pressure is the same at both of its ends.)

Thus, if both valves are off, the pressure at the indicated location is high.

As soon as one valve-pump is turned on, the corresponding valve starts to conduct, causing water to flow through the narrowed-down piece of pipe.

Because both valves are placed in parallel, one valve always experiences the same pressure-difference as the other one. Therefore, from a functional point of view, it doesn't make a difference if only one, or both valves conduct.

The full pressure-difference caused by the primary pump now falls over the narrowed-down piece of pipe, and the pressure is the same at both ends of the valves - namely atmospheric (blue) - the same as the pressure at the indicated location.

Thus, if either valve is on, the pressure at the indicated location is low. Or put differently: the pressure at the indicated location is only high when both valves are off/closed.

This is exactly the behaviour of the NOR-block.