The use of mathematical modelling to analyse the process of mixing waters from different sources in water supply system

One of the processes that significantly determines the quality of water to consumers is the process of mixing water from different sources in the water mains. Put to the network two or more chemically and biologically stable waters may result in the formation of water that will be deprived of these features. This article presents the german guidelines for analysing water quality for mixing waters from different sources, in various proportions. Then performed an analysis of utility the mathematical models, including quality criteria, for use in network control. An IT tool has been developed to manage selected water quality processes using mathematical modeling. The basis for implementing the tool was a network model created in Epanet integrated with the Matlab.


Introduction
The quality of tap water depends on many processes during its intake, treatment and distribution.From many factors influencing water quality in supply network, hydraulic parameters -such as: pressure gradients, flow velocities, water age -are particularly important.Parameters of water pumped into network such as chemical and biological stability, are also important.Process management can be understood as all activities directed for fulfilling the aims and objectives of a company.One of the processes, which influence the tap water quality is mixing of the water from different sources.This process occurs commonly in the water distribution system and contributes to lots of problems in the network [1][2][3].The complexity of this problem results from the fact that the quality of water after mixing is a result of both -the parameters of water quality before mixing and the mixing proportion.To analyse the quality of water before mixing, the German DVGW guideline [4] can be used.
Ensuring good hydraulic parameters is possible due to using the tools for water distribution system control.The main aim of network control is to determine and correct the settings of the actuators.Hydraulic modelling tools can be used for supporting this process.Hydraulic modelling of water distribution system consists of solving mass and energy continuity equations for different sets of boundary conditions.
Practically, equations systems are solved using numerical methods (eg.gradient methods) in computer software, e. g.EPANET [5,6].Using the results from hydraulic modelling calculations, it is possible to calculate the quality of water after mixing.The process of mixing water in the nodes, where it is assumed that water flows from two or more sources and is completely mixed, shall be described by the mass balance in the node represented by the equation ( 1): where: C oj -concentration of a substance in water leaving the junction j, g/m 3 , O j -for links, in which water outflow from junction j, Dj -for links, in which water inflow to junction, Q ij -flux of water inflow to junction j from i'th pipes m 3 /s, C Di -concentration in water inflow to i'th links g/m 3 , U j -concentration in j'th junction g/m 3 [6][7].
Mixing of water in storage points (tanks) is calculated by the weight balance.In case where water inflows to the tank it is assumed that it mixes fully.It can be described by the equation (2): where: C k -concentration in k'th tanks, g/m 3 , C Di(t)concentration in i'th pipe from which water inflow to tanks in times t, g/m 3 , Q ik -flux of water inflow to k'th tank form i'th links, m 3 /s, V k -volume of k'th tank , m 3 , θ(C k ) -reaction factor, g/m 3 ⋅s [6][7].Described equations are the basis for modelling water quality in EPANET software that were used in the developed environment.The main task of the developed tools is to calculate the proportion of water mixing in each node (which is not possible directly in EPANET software).Calculated proportions provide the basis for water quality assessment in the context of water mixing.The article also describes standards for assessing the effects of mixing water on its quality.Developed tools can be used to determine control scenarios which minimize the negative effects of water mixing.

Modelling of water quality during its mixing in distribution system
The basis for modelling changes in water quality parameters in water supply networks are data on pressure and flow in pipelines.Often as a basis for analysis of water quality changes in the network is also used to analyze the water age in the system.Quality modelling process itself is a very complex task due to the multitude of individual processes, which must be taken into account in mathematical equations.Among the equations, one must find: (1) equations describing the reaction kinetics model, taking into account their order, (2) equations describing bulk and wall reactions, (3) equations describing fast and slow reactions in system.At present, many researchers are making efforts to generate equations that might have been applied for water quality models like EPANET-MSX, to provide an adequate reflection of processes that shape water quality in the system.So far, the most work is on models describing disinfection processes in the networkchlorine decay model and by-products formation.Single works deal with other issues for example arsenate transport in network.However, the utility and universality of many of the proposed equations have not yet been confirmed in water supply modelling [8][9].
An important issue in analyzing changes in water quality in the network is the analysis of the influence of the mixing of waters from different sources on tap water quality.Numerous literature data [1][2][3] state that such mixing, as well as replacing one water source with another, might result in deterioration of water quality in the system.For a long time, as the main reason for problems with maintaining the quality of water mixed in the water supply system, the lack of carbon balance was considered [10].At present, the analysis of water quality changes during its transport, focuses on the analysis of the anti-corrosion protective layers, formed on the surfaces of materials, that come into contact with water.In cases where water is supplied to the system from more than one source, the process of forming this layer is disturbed, which may result in intensification of corrosion processes occurring in the network and deterioration of water quality [10].This issue has been analyzed in detail in the German Guideline DVGW W216, concerning of supplying to the network the water of variable quality from one source or waters from two and more sources and an attempt to model a process of mixing waters from different sources can also be found in EPANET-MSX [4].
The guideline W216 [4] indicates the parameters (temperature, oxygen, pH, mineral acidity to pH = 4,3, chlorides, sulphates, nitrates, phosphates, dissolved organic carbon, nitrogen, potassium, calcium, magnesium), and the possibility of variations in their concentrations for two and more different waters, to guarantee good water quality in the network.Analysis of two or more waters for their stability during mixing should take into account three main criteria: corrosivechemistry criterion according to W216, calcium carbonate solubility assessment, and a microbiological criterion.There should be no conclusions about the stability of mixing waters only on the basis of one of these three mentioned criterions.In the case of the microbiological criterion, there are no binding stabilityvalue that would indicate that two waters after mixing in the network won't generate microbial problems.The only way is to perform a detailed evaluation of microbiological regrowth potential for analyzed system.In the case of mixing waters from different sources, depending on the quality of the water before mixing and the mixing ratio, water of stable or temporally variable quality can be achieved.If for each of the analyzed in W 216 parameters, in each mixing ratio, we obtain stable water, it can be mixed in any proportion, if not, the ratios of mixing need to be establish to maintain stability of water during its distribution.In the case of mixing the three waters containing the S component at the starting concentration of S a , S b , S c , with their share in the total volume of mixed water respectively x a , x b , x c , then the concentration of this component in mixed water will be (3): According to the equation ( 3), the composition of water mixed in case of anions, cations, dissolved inorganic carbon, acidity, alkalinity, ionic strength and temperature can be determined.For substances that react during the mixing process, i.e. hydrogen ions, acidic carbonate ions, carbonate ions, carbon dioxide, their concentrations after mixing must be determined only after taking into account the chemical equilibrium.
Also in the EPANET-MSX, creators declare the possibility of water quality modelling in situations, when waters from different sources and different quality are delivered to the water supply network.However, the literature shows, that verification of the model's performance in this task is usually based on the reaction of chlorine decay in the network, i.e. reaction which are relatively simple to modelling, compared to other reactions in the water supply network.In addition to this, the main and significant simplification of this analysis is that in EPANET-MSX it is assumed that the reaction rate coefficient for mixed water is the weighted average of reaction rate coefficients for two mixing waters.That's why, the results of the analyzes are often unsatisfactory and show significant differences with actual chlorine concentrations measured in the distribution system.For example, Grayman with the team [9] has attempted to use the EPANET-MSX capability to determine the chlorine bulk decay coefficient to individual pipes for networks.This method determines the percentage of water from each source of water reaching the individual pipes in the individual time steps, as illustrated in equation ( 4): where: Kb(i,t) -bulk coefficient for pipe i at time t, KB1 -bulk coefficient for water from source 1, KB2 -bulk coefficient for water from source 2, TR1(i,t) -fraction of water in pipe i from source 1 at timet, TR2 (i,t) -fraction of water in pipe i from source 2 at timet, and TR1 (i, t) + TR2 (i, t) = 1 [9].
The method can be generalized for any number of water sources, but the results reached from network have prompted the authors to draw the conclusion that further work is needed to adapt the equations for modelling mixing of waters from several sources [9].

Developed environment
EPANET allows the user to perform three types of basic qualitative analyzes, such as: water age, tracking of the spread of the substance and calculation of changes in chemical concentration.TRACE functions can be used in the water mixing analyzes to determine how much water comes from a selected water source, at any node of the network.The EPANET GUI limitation is that this feature allows you to check only one source on each node for one simulation run.This means that checking the mixing ratios of water from more sources can be problematic.To define ratios of water from each source, the user needs to perform separate simulations, in which mixing water ratio for one reservoir can be read.Applying this solution can be time-consuming and will require running many separate simulations controlled by the user.From the point of view of the results analysis, it is also important to be able to present data in a variety of forms, such as graphical charts of the mixing ratios values.The possibilities are very limited in EPANET GUI.The purpose of the work was to prepare an environment that would allow the user to analyze the mixing of water in the network in one simulation run, to present results in graphical form and to compare the mixing parameters for various variants of system operation.For the purpose of analyzing the mixing ratios of all power sources in the individual nodes of the water supply model, an environment integrating EPANET functions with MATLAB was used.
This was possible with the available source code and the Programmer's Toolkit [12], including the DLL library.
They were used to create classes that call EPANET functions from MATLAB [11].The water supply model for the analyzed sample was created in the EPANET GUI from where it was exported to the INP file.The model in this text file was read in a Matlab environment where multiple simulations with automatically changing parameters were performed and the results were saved for further processed (Fig. 1).
Fig. 1.The concept of integration tools in the developed simulation environment [11].
The set Quality Type function was used to perform the analysis.Iteratively, using it, the modelling mode was specified with an indication of each tracked source.For a given simulation time, water quality was measured at each node, saving the results for each hour.

Case study
The prepared environment allows to check the mixing ratio of water from different sources in each node.In the analyzed example, modelled a simple annular watersupply system supplied from three sources.Fig. 2 shows a diagram of the network and the results of simulations in which the determined amount of mixing water in the nodes presenting a pie charts, the ratio of water from each source.In the prepared environment it is possible to calculate the water mixing value for each node over time.This value can vary depending on the adopted water change demand pattern or the pump control schedule.
Fig. 3 shows the variation in water volume ratio from each source for one selected node.Note that the EPANET program assumes that at time 0 (at the beginning of the calculation) the network is filled with water, for which the parameters are assumed as if the water did not come from any source.It follows that the results of calculations become reliable only after a certain time, after which the water exchange in the whole water supply network will take place.For example, for the analyzed network, reliable results can only be considered after the second day.After this time, the cyclicality in the repetition of the results is noted.It should be noted that the mixing ratio of water in the network is variable in time, e.g. during the night hours only water from two sources is mixed.The situation resulting from this analysis may be the basis for deciding to change the pump control algorithms.
In the prepared environment you can see how the water mixing ratio in the node changes due to other pump control.An exemplary case in which a reduced rotational speed of the pump motor, pumps water from a source 3 shown in Fig. 4. In the developed environment it is possible to test many -freely prepared scenarios.The use of this type of solution can be helpful in the selection of optimal scenarios and to locate zones where most of the time will not reach the water supply from various sources, which can help reduce the negative effects of mixing water of different quality.

Conclusions
A review of literature and the feature's library of EPANET-MSX shows that there is still no possibility to fully model of water quality in network, especially when the waters from two or more different sources are mixed in system.The limitation is that, (1) there are still no enough resources of equations, describing network reactions, (2) there are problems in determining the rate coefficient of reaction (especially for wall reactions for pipes, which are located in the mixing zone), and (3) limited effectiveness of hydraulic models in variable pressures.
The paper presents an analysis of mixing water process, in situation when waters from two or more sources supply the network, based on the German DVGW guidelines and EPANET program.The proposed configuration of analyzes enables forecasting changes in water quality in the network resulting from its mixing process, among other things based on the nomograms contained in the guidelines.The information tool provided facilitates the control of the water supply network in the case, when the quality of the water, which is mixed in the network and the proportion of this mixing is an important criterion of decisive.

Fig. 2 .
Fig. 2. Mixing ratios of water in nodes for three sources.

Fig. 3 .
Fig. 3.The proportion of water from various sources in the selected node-I supply pattern.

Fig. 4 .
Fig. 4. The proportion of water from various sources in the selected node -II supply pattern.