Membrane computing with water

We introduce water tank systems as a new class of membrane systems inspired by a decentrally controlled circulation of water or other liquids throughout cells called tanks and capillaries called pipes. To our best knowledge, this is the first proposal addressing the behavioural principle of floating and stored water for modelling of information processing in terms of membrane computing. The volume of water within a tank stands for a non-negative rational value when acting in an analogue computation or it can be interpreted in a binary manner by distinction of “(nearly) full” or “(nearly) empty”. Water tanks might be interconnected by pipes for directed transport of water. Each pipe can be equipped with valves which in turn either fully open or fully close the hosting pipe according to permanent measurements whether the filling level in a dedicated water tank exceeds a certain threshold or not. We demonstrate dedicated water tank systems together with simulation case studies: a ring oscillator for generation of clock signals and for iteratively making available amounts of water in a cyclic scheme, analogue arithmetics by implementation of addition, non-negative subtraction, division, and multiplication complemented by systems in binary mode for implementation of selected logic gates.


Introduction
Visualisation of computing processes in detail is an important and demanding task for teaching to students of engineering.Having an experimental setup at hand, the students can observe and trace the course of signals throughout a computation.They understand the occurrence of delays and latencies in signal processing along with the necessity of synchronisation in order to keep signals in a valid state.Moreover, the students get sensibilised for imprecision and slight deviation of signal levels to cope with for successful hardware implementations.They learn about advantages and disadvantages of analogue and digital modes of computation and resulting consequences in algorithmic design and hardware development [15].State-of-the-art computers utilise electrical signals.In spite of their preference in practice, electrical signals turn out to be invisible and more or less cumbersome in teaching at the beginners level.
In this context, it is an obvious idea to apply an alternative floating medium.Pure water in its liquid form seems to be an ideal candidate.On the one hand, underlying natural principles of floating water in comparison to the flow of electricity show a close relationship when replacing the current by volumetric flow rate and after substitution of voltage by pressure.On the other hand, floating and stored water enriched with a dye and passing through a macroscopic environment is easily visible.
Beyond its usefulness for teaching, such a system can be implemented in a decentralised manner inspired by a tissue of biological cells.Indeed, higher organisms incorporate mechanisms of computing with water, for instance the control loop for adjustment of the human intraocular pressure [10] or for setting a local specific pH environment by purposive dilution in which enzymes exhibit their maximum activity [21].Regulated transportation of water enriched with reactive substances throughout and across tissues together with a blood stream complemented by temporal storage and processing within cells is a crucial part in numerous biological control loops [2,12].A first step towards corresponding models and simulation environments consists in consideration of systems for computing with water which promises a fascinating potential worth to be tackled.
The idea to employ water for information processing is not new.First attempts date back more than 2000 years.The ancient water cascade [14] for soil irrigation gives an illustrative example in which an initial pool of water becomes separated into nearly equal portions by passing a sequence of water tanks whose overflow forwards the water to the next tank after the portion has been collected; see Fig. 1.In the 1930s, the first real water-based analogue computer called water integrator had been invented in the Soviet Union and applied for numerical solution of ordinary differential equation systems [1,13,24].This computer comes with an external manual control and utilises mechanical elements for individual regulation of the volumetric flow rate in each of the pipes.Fine-grained variation of flow rates can be seen as a characteristic attribute of this computer whose constituents comprise many expensive movable mechanical elements, but nearly no sensors for measurement of filling levels or other parameters.Later, hydraulic systems came into the focus to mimic a computer [3,4,20].Their principle of operation is mainly based on adjustment of pressure throughout the system in order to gain the intended functionality [23,25].
Tom Head and his co-workers successfully initiated and developed microflow systems [6,7].They have in common that they employ the flow of water in order to bring together substances for chemical reactions carried out in so-called micro-chambers.To do so, they are optimised to manage on a minimum of water.In addition to their microscaled size, they utilise single droplets of water able to hit each other causing an interaction [17,22].Microflow systems complement the water droplets by reactants and ingredients to achieve the capacity of information processing [5,11].Indeed, modelling of spatially distributed reaction systems along with the exchange of molecules and their application for information processing is a keystone of membrane computing [16,19].More general, the field of membrane computing includes identification and formalisation of principles for information processing found in nature and in biological systems [18].Although chemical reactions represent many aspects of biological information processing, decentrally controlled storage and circulation of water considered as a physical phenomenon without any chemistry embodies also an issue worth attracting attention within membrane computing.
Our approach to construct a water-based computer is inspired by the objective to have no central control, and instead, we envisage a distributed system in which the flow of water is exclusively managed by local measurements of filling levels.To this end, we introduce the framework of water tank systems as a new class of membrane systems.Its main ingredient is a finite number of water tanks.A water tank can contain an initial volume of water and it is able to store and to collect an amount of water up to a maximum volume.The volume of water in a tank serves as data carrier and as a medium of data processing by variation of this volume over time.To do so, water tanks might be interconnected via pipes.A pipe enables the directed transport of water from a tank to another one if opened.A pipe is allowed to be equipped with one or more freely configurable valves.Each valve either fully opens or fully closes its hosting pipe depending on the permanent measurement of the filling level in a dedicated water tank whether or not it exceeds a given threshold or indicates an empty or nearly empty tank.Please note that a valve is restricted to distinguish merely two states "fully open" and "fully closed", there are no states in between.This setting allows for equal volumetric flow rates in all pipes within a water tank system opened for water transport and supplied by non-empty tanks.A pipe transports water if and only if all of its valves are fully opened and the tank acting as water supply is not empty.Moreover, the entrance of a pipe might be placed at an arbitrary filling level of its supply tank in a fixed position.So, this tank needs to contain a minimum amount of water before filling the pipe.The mentioned assumptions and prerequisites for our water tank systems have been selected in a way to keep the construction simple and free from any central control.
The resulting water tank systems autonomously operate in a decentralised manner based on local measurements of filling levels without the need of an external control.To our best knowledge, this is the first contribution addressing this type of behaviour for computing purpose.Since a water tank can be seen as a membrane permeable to inflow and/or outflow of water molecules whose presence is dynamically regulated by local measurements (interaction rules), our approach fits into the scope of membrane systems.For technical reasons, each water tank system comprises a special water tank called reservoir which stands for a huge amount of water responsible for supply if needed and subsuming excessive water collected from overflow pipes of the tanks.
For better visibility, we allow a water tank system to start its activities at a configurable point in time.So, the initial water volumes of the tanks can be noticed prior to successive modification.To do so, all outward flow pipes of water tanks acting as inputs or those initially non-empty and employed for auxiliary usage, consistently get a uniform start valve that opens as soon as the entire water tank system is set into operation.A water tank system might operate either in analogue or in binary mode.In analogue mode, the volume of water within a tank represents a non-negative rational value.For this purpose, we introduce water tank systems for arithmetic operations addition, non-negative subtraction, division, and multiplication.They can be assembled for performing sequenced or nested computations.In addition, a ring oscillator consisting of a cyclic structure with at least three water tanks emulates a clock signal.In binary mode, an empty or nearly empty water tank refers to the logical value "0" and a full or nearly full one to "1" with latencies when the tank gets filled or emptied.We define logic gates OR, AND, and a bit duplicator.Waterbased logic gates can be connected towards Boolean circuits equipped with the capability of inherent self-synchronisation without external control striving for construction of any register machine known to be a Turing-complete model of computation, shown for example (with chemical logic gates and an oscillating species concentration interpreted as clock) in [8].All water tank systems presented throughout this paper come with simulation case studies revealing system's temporal behaviour in detail.The underlying simulation source code complements our ongoing project on a Java Environment for Nature-inspired Approaches (JENA) [9].
The paper is structured as follows: in Sect.2, we familiarise the reader with the description and formal definition of water tank systems and their behaviour.Hereafter, three case studies selected from different application scenarios demonstrate its practicability.First, as an introductory example, we shed light on a ring oscillator in Sect. 3 followed by analogue arithmetics in Sect. 4. The third study is dedicated to emulation of combinable logic gates together with a bit duplicator by water tank systems in binary mode in Sect. 5. A discussion concludes the benefits and challenges raising open questions for future work.

Water tank systems
Let A and B be arbitrary sets, ∅ the empty set, ℕ the set of natu- ral numbers including zero, ℚ the set of rational numbers, and ℚ + the set of non-negative rational numbers.The Cartesian product Multisets in general can be written as an elementwise enumeration of the form A water tank system ∼ is a construct with its components W ∶ ⟶ ℚ + ∪ {+∞} . . . . . . . . . . . . . . .finite frac- tional multiset of water tanks Let be an alphabet of water tank identifier symbols.w ∈ specifies a water tank whose initial volume of water is given by W(w) .A water tank is allowed to be initially empty.A water tank r ∈ acting as reservoir is characterised by W(r) = + ∞ .The volume of water contained in a water tank w at time t ∈ ℕ is captured by

. finite set of valves
Let w ∈ be a water tank identifier, ∈ ℚ + a thresh- old value, and t ∈ ℕ a point in time.A valve (also called actor) is a function ∶ ℕ ⟶ {0, 1} having one of the forms 0 otherwise, meaning that 1 marks the valve to be fully open and 0 fully closed, respectively.

finite set of pipes
Let s ∈ and w ∈ with s ≠ w be water tanks, B ⊆ A a set of valves, ∈ B the start valve, ̇v ∈ ℚ + with ̇v > 0 a volumetric flow rate, and s ∈ ℚ + the mini- mum volume of water required in s to supply.A pipe p = (s, w, B, ̇v,  s ) ∈ P enables the directed transport of the volume portion ̇v of water from s to w within one time step if and only if conditions mean that all valves placed at the pipe have to be open, the supply tank must contain at least the required portion ̇v of water, and-in case the entry of the pipe is placed at a higher filling level than 0-the supply tank must even contain at least s volume units of water.

Systems behaviour
The spatiotemporal behaviour of a water tank system aims at tracing of the water volumes in each water tank successively over time.To this end, we assume a global clock t ∈ ℕ start- ing with t = 0 .Each discrete processing step increases the clock by 1 until the point in time to terminate t end is reached.A configuration of a water tank system is defined by the water volume (non-negative rational value) in each water tank, formally expressed by Initially, we set V w (0) = W(w) for all w ∈ .A processing step results from the following update scheme in which the water tank volumes V w (t + 1) will be obtained from V w (t) taking into consideration the measurements of filling levels and corresponding states of the valves available within the system.The update scheme reads as follows: The water volume in the reservoir persists at +∞ for the entire time span in which the system is in operation.For passage of water throughout a pipe, we assume no additional consumption of time beyond one processing step having in mind that pipes typically bridge short distances and an extra delay is seen to be neglectable in comparison to the time needed to fill or to empty a water tank.

Ring oscillator
For generation of self-sustained clock signals able to synchronise computing processes and for iteratively making available an amount of water in order to control a primitive recursion, an oscillatory course of the water volume within a tank is required.Hence, we enrich the pool of water tank systems by a module acting as ring oscillator.To do so, a cyclic scheme consisting of at least three water tanks suffices; see the left part of Fig. 2.An amount of water initially placed in one of these tanks rotates from one tank to the next one over time.The inflow of a tank inside the cycle might get opened as soon as the tank ahead from the tank before has been emptied.For instance, in the cycle w 1 → w 2 → w 3 , water tank w 2 can be filled after w 3 has been emptied since w 1 is completely filled at this point in time.By placing the corresponding valves, we achieve an autonomous principle of operation.Complementing the cyclic scheme, we add an output water tank y whose temporal course of the water volume becomes managed by w 1 .In the same way, further output tanks beyond y can be integrated if necessary.
Our water tank system that mimics a ring oscillator can be formalised by RO .We assign a water volume of 10 units to indicate a full tank.All filled pipes share a common volumetric flow rate ̇v = 0.1 .The system is started at t = 0:

Emulation of analogue arithmetics
Studying concepts of analogue computing embodies an inspirational field in computer science, and it promises to gain enduring insights for education.Commonly, analogue computers feature by a simple setup and by an illustrative principle of operation close to the adopted mechanisms.In comparison to digital information processing, arithmetics can be directly implemented in an easy way without taking care of distinction between single digits.Analogue computing based on water utilises the volume of water within a tank directly to represent a non-negative rational value able to be measured and modified.In consequence, analogue  RO =(W, A, P, 0, 800) with W ={(w 1 , 10), (w 2 , 0), (w 3 , 0), (y, 0), (reservoir, +∞)} computers have to cope with slight imprecisions in processing and they tend to be prone to perturbations.Water tank systems operating in analogue mode make use of a uniform volumetric flow rate in all pipes flooded by water.This assumption turns out to be helpful in order to keep the systems small and effective.We focus on analogue water tank systems for addition, non-negative subtraction, integer division, and integer multiplication in a way that the output of an operation can act as an input for a downstream operation which enables evaluation of composed terms.

Addition
Addition of non-negative rational numbers belongs to the simplest tasks when carried out by a water-based analogue machine.We expect both of the input summands to be available as volumes of water in tanks x and y.For summation, a union of these water volumes into a common output tank z = x + y suffices.Figure 3 illustrates in its left part the underlying scheme.
A formal specification of the corresponding water tank system is given below.We exemplify an instance in which the sum 2 + 3 = 5 is calculated.This implies initial water volumes V x (0) = 2 and V y (0) = 3 .The system is set into operation at t = 25 by opening the start valves and it is con- figured to terminate at t = 200 .Furthermore, we uniformly assign a volumetric flow rate ̇v = 0.1 to all filled pipes.The overflow pipes in all tanks have been placed in a way to enable the handling of numbers within a range between 0 and 90.
The simulation results shown in Fig. 3 (right part) disclose a duration of 30 time steps to conduct the calculation.After both of the input water tanks x and y have been completely emptied, the output water volume might be transferred for downstream usage.

Non-negative subtraction
For emulation of a non-negative subtraction , we make use of a strategy Having this feature at hand, we construct the system beginning with two separate input tanks x and y whose start valves can be opened at the same time.Along with this, the water simultaneously runs from x and from y to the reservoir until y is (nearly) empty.As soon as all water has vanished from y, the outflow of x immediately switches over to fill z from now on.In this way, the desired difference expressed by the portion of the initial water volume in x exceeding those in y has accumulated in z; see left part of Fig. 4. The visualisation is done by a system instance to compute 5 −2 = 3 in which the start takes place at t = 25 .All filled pipes possess a uniform volumetric flow rate ̇v = 0.1 .Each overflow pipe gets supplied in case that a tank contains at least 90 volume units of water.In addition to the start valves, two auxiliary valves yempty and ynotempty are required indicating the empty and non-empty state of tank y.

Integer division
Implementation of integer division by means of a water tank system requires a well-elaborated algorithmic strategy.We decided to employ the recursive definition in which x, y ∈ ℕ and y ≥ 1 holds.For emulation of the recursive scheme, we adapt the ring oscillator and combine it with a subtractor.To this end, we place two separate input tanks x and y complemented by a tank x − y whose con- tents corresponds to the non-negative subtraction x −y as described before.Via the intermediate tank x − yd , we trans- port the water volume representing x − y back to tank x com- pleting a cycle.Each iteration of water throughout this cycle diminishes its rotating volume by y until no water remains and all three tanks x, x − y , and x − yd forming the cycle have been emptied.In each iteration, the portion y of water is needed again in order to execute the subtraction.So, we have to take care that y gets restored along with the iteration.For this purpose, we implement a second cycle consisting of three tanks y, y 2 , and y 3 .The iterations in both cycles run simultaneously in a self-synchronised manner controlled by cross-placed valves; see upper part of Fig. 5.The underlying division is done by a separate auxiliary tank called inc with a storing capacity of exactly one volume unit of water.Each iteration opens the supply of tank inc for a short moment to refill.Finally, this amount of one unit of water moves to the output water tank z = x∕y which in turn accumulates these portions over the time spent for iterations.After that, the output tank contains the desired division result.
The formal specification of a water tank system for integer division comprises eight tanks in total.Moreover, nine types of valves are required and 17 pipes manage the transport of water.The system instance given below is dedicated to the division example 20∕4 = 5 .We assign a common vol- umetric flow rate ̇v = 0.1 to all filled pipes.All water tanks except inc have a capacity of 90 volume units.We start the system at t = 25 and observe it for 1600 time steps: Fig. 6 Water tank scheme for integer multiplication with input tanks x, y and output tank z = x × y .After input tank x and auxiliary tanks x − 1 , x − 1d , and yc have been completely emptied, the output water volume V x×y (t) is ready for further processing Figure 5 shows in its lower part two simulation runs reflecting the divisions 20∕4 = 5 and 12∕4 = 3 .The successive reduction of the water volume available in tank x along with each iteration and the accumulation of the water portions of 1 volume unit becomes apparent from the diagrams.After the tanks inc and x together with its successors x − y and x − yd are empty at the same time, the output has been final- ised and can be utilised for further processing.
Div = (W, A, P, 25, 1600) with W ={(x, 20), (y, 4), (x − y, 0), (x − yd, 0), (y 2 , 0), (y 3 , 0), (inc, 0), (x∕y, 0), (reservoir, +∞)} whereas x, y ∈ ℕ and x ≥ 1 .This approach needs to combine a ring oscillator with a subtractor responsible for the decrement to control the descent of x into x − 1 when successively tracing the recursion.In consequence, we construct a cycle consisting of three water tanks called x, x − 1 , and x − 1d for this purpose; see upper left part of Fig. 6.A second cycle composed of three tanks called one, o 2 , and o 3 manages the iterated presence of the subtrahend 1 to turn x into x − 1 by subtraction.The iterations in both need to be synchronised to each other.This is done by cross-placement of valves.Along with each iteration, a water volume of y units has to be made available and successively accumulated to obtain the final multiplication result.This requirement implies a third cycle formed by three tanks called y, y 2 , and y 3 .An initial water volume of y units rotates along these tanks simultaneously to the iterations taking place in either aforementioned cycles.We need to place additional valves to synchronise this cycle as well.The water with a volume of y units periodically present in tank y controls the supply of a separate tank named yc to provide a copy of the water volume y.As soon as an iteration has finished, this volume gets added to the water volume in the output tank x × y .Along with each iteration, a portion of y units is summed up.After all water vanished from x by a number of cycles, the desired calculation result x × y persists in the correspondent output tank.We exemplify the calculation 5 × 4 = 20 for formulation of a system instance.It is composed of 11 water tanks, 13 types of valves, and 23 pipes in total.A volumetric flow rate ̇v = 0.1 has been assigned to all filled pipes.A uniform rate is mandatory to ensure the function of the entire system.Moreover, we place the overflow pipes in a way to handle water volumes up to 90 units except tank one whose capacity is restricted to 1 unit.The system starts at t = 25 and its temporal behaviour has been observed for 700 time steps.Accordingly, the formal specification reads:  The lower part of Fig. 6 shows simulation results for the calculations 5 × 4 = 20 and 3 × 4 = 12 .The courses of the water volumes in the tanks x, y, yc, and x × y have been depicted over time.The successive increase of the water volume in x × y by portions of y becomes evident while the water volume in x gets diminished by 1 within each iteration.The final result is available for downstream usage after the tanks x, x − 1 , x − 1d , and yc have been emptied at the same time.

Emulation of logic gates
For acting in binary mode, a water tank w ∈ constitutes a binary variable whereas an empty or nearly empty tank with V w (t) < v refers to the logical value "0" and a high filling level V w (t) ≥ 100 × ̇v encodes "1", respectively.The time span to fill or to empty a water tank implies a latency in which its logical value is invalid.
In addition to possible outflow pipe(s) applied for information processing, a water tank incorporates an overflow pipe whose entrance position corresponds to the desired high filling level.The overflow pipe leads excessive water from the tank into the reservoir; see Fig. 7.

OR gate
The disjunction OR is the simplest logic gate to be implemented by a water tank system since a merge of both input water volumes providing their union as output suffices in principle.To do so, we place two input water tanks called x and y whose outflows feed the output water tank z = x ∨ y , depicted in Fig. 8 (upper part).By opening the start valves, the system is set into operation.
In order to keep the water volume representing the logical value "1" globally uniform within the entire system, we need to take care that the output water volume gets accordingly reduced in case of supplied by either input tanks to calculate 1 ∨ 1 = 1 .For this purpose, we place an overflow pipe for transportation of all excessive water to the reservoir.Figure 8 (lower part) shows simulation results for a system instance in which a water volume of 10 units represents "1" and the start is done at t = 25 .We assign a volumetric flow rate ̇v = 0.1 to all filled pipes.The formal system's descrip- tion (initialisation for 1 ∨ 1 = 1 ) is: The simulation studies exhibit the most effort for performing the calculation 1 ∨ 1 = 1 since it consumes much time and the result is obtained after t = 174 .When using the out- put z as an input for downstream logic gates, it is valid as soon as both input tanks are empty or nearly empty and z is not overfilled.A pipe processing the output needs to be controlled by corresponding valves xempty (open if and only if V x (t) < v ), yempty ( V y (t) < v ), and znotoverfilled ( V z (t) ≤ 10 ), respectively.

AND gate
The topology of our water-based AND gate (conjunction) resembles its counterpart from disjunction but it incorporates a crucial difference.Since both of the input water tanks x and y must have a high filling level at the logical value "1" to generate the output result "1", their contents is merged and collected in an oversized auxiliary water tank a able to store the double amount of water in comparison to x and y.After a has been filled more than half, the inflow of the output tank z gets opened, supplied by the reservoir.As soon as z has reached its high filling level to encode "1", tank a is emptied again.In case that merely one or none of the input tanks x, y is set to "1", a cannot collect enough water to flood z which implies the desired output of "0" leaving z in empty state.In order to prepare the system for subsequent operation, all water is finally removed from a. Figure 9 (upper part) illustrates the water tank system.
For simulation, we assign 10 volume units of water to represent "1".Furthermore, all filled pipes constitute ̇v = 0.1 .We expect the system to start at t = 25 .The corresponding formal description initialised to calculate 1 ∧ 1 = 1 reads: with a delay of 100 time steps when deviating from being empty.As soon as each of the output tanks y 1 , y 2 is com- pletely empty or completely filled, its contents is available for usage in downstream logic gates.

Conclusions
Water tank systems open an inspirational and interesting concept for modelling and visualisation of computational processes.A crucial feature of a water tank system lies in its ability to function without any central or external control.By means of valves that fully open or fully close the hosting pipes according to the filling levels in dedicated water tanks, a self-synchronisation can be obtained supported by waterbased modules like a ring oscillator.Cycles composed of at least three tanks in which a volume of water can successively rotate provide a powerful instrument to describe iterations also sufficient for trace of primitive recursion schemes.In our opinion, water tank systems convince due to their simplicity and by their clear operation making all details visible.All Java source codes for the simulation studies presented throughout this paper are available from the first author upon request.Future work is directed to obtain a direct of a NOT gate and evaluation of composed logic expressions which includes three tasks: (1) termination detectiona control tank that will be filled exactly when the whole evaluation is completed (regardless if the result is empty or not).( 2) System reset-to prepare the next evaluation.(3) Simplifying the control valves on output pipes on multistage expression directed acyclic graphs-at any level, only one or two control valves, thus avoiding a combinatorial explosion on the number of valves.
We are aware of the fact that water tank systems in the present form are away from any deployment outside academics, but they could be a prototype in artificial life when equipped with biochemical reactions and substrates residing in the tanks which in turn forms a blood circulation affected by organs.Particularly, description, modelling, and exploration of biological control loops are seen as a promising field of research to be tackled by water tank systems with appropriate extensions.

Fig. 3
Fig. 3 Analogue implementation of water-based addition with input tanks x, y, and output tank z = x + y whose resulting water volume is available for downstream usage as soon as both input tanks are emptied

Fig. 4 3 P
Fig.4 Water tank scheme for non-negative subtraction with input tanks x, y and output tank z = x −y .After both input tanks have been completely emptied, the output water volume V z (t) is ready for further processing

Fig. 5
Fig.5 Water tank scheme for integer division with input tanks x, y and output tank z = x∕y .After input tank x and auxiliary tanks x − y , x − yd , and inc have been completely emptied, the output water volume V x∕y (t) is ready for further processing

Fig. 7
Fig. 7 Representation of logical values by a water tank

Fig. 8 1 Fig. 9
Fig.8 Schematic representation of a water tank system which mimics an OR gate by z = x ∨ y .The contents of the output tank z is valid and can be employed for downstream logic gates as soon as both input tanks x, y are empty and tank z is not overfilled any more

Fig. 10
Fig.10 Scheme of a water tank system acting as bit duplicator y i = x with i = 1, 2 .The contents of each output tank y i can be accessed as soon it is full or empty