Use of EPANET solver to manage water distribution in Smart City

Paper presents a method of using EPANET solver to support manage water distribution system in Smart City. The main task is to develop the application that allows remote access to the simulation model of the water distribution network developed in the EPANET environment. Application allows to perform both single and cyclic simulations with the specified step of changing the values of the selected process variables. In the paper the architecture of application was shown. The application supports the selection of the best device control algorithm using optimization methods. Optimization procedures are possible with following methods: brute force, SLSQP (Sequential Least SQuares Programming), Modified Powell Method. Article was supplemented by example of using developed computer tool.


Introduction
Water supply systems are constantly changing and developing.From ancient times until now, significant advances have been made in the field of mathematical approaches, hydraulic modelling, optimization and last monitoring.The devices have become more sophisticated thanks to advances in computers and telecommunications [1].At present not only scientists but also practitioners need to be familiar with the latest ICT technologies supporting water distribution systems.
Particularly in recent years there has been a lot of paper taking into account modern "smart water management system" includes smart meters, smart valves, intelligent pumps and analysis models of operating in the smart cities ecosystems [2][3][4][5].Making all these elements work together is a real challenge.There are various aspects and possibilities using smart technologies.In this context, it is necessary to continually present the possibilities o f using knowledge and experience with the advanced technologies that can be operated on commonly available PC and mobile devices.
Utilization intelligent water distribution management systems is not only about convenience and quickness in decision-making, but above all the need to reduce water and energy consumption.
In 2014, there were nearly 3.9 billion people in cities and 54% in the global population, and by 2050 two thirds of the global population will live in cities, which will increase 55% of additional world water demand [6].Water management taking into account the aspect of energy consumption is currently one of the priorities of the most cities.It's because of the reliability and water-quality performance of a city's water system which requires a lot of energy.Therefore, to solve such problems, it is proposed to use the planning and management of water supply systems in a coordinated and interdisciplinary manner [7,8,9,10].One of the most important elements of this approach in Smart Cities development is the use of "ICT for sustainable growth" with the ambition to lead innovation at the worldwide scale [11].The example of the synergy ICT and Smart City for water distribution management it was featured in this publication by application using Epanet solver.
Environmental Protection Agency [12,13].Epanet is commonly use for analyse municipal water distribution network.Modelling process allows determine pressures in all nodes and flow in all pipesin the network, under set of boundary conditions and parameters.During the process the set of linear mass continuity equations, non-linear energy continuity equations and are calculated.The undoubted advantage of using Epanet is the possibility to test various scenario of system operation eg.control scenarios, design variants, etc.This makes that Epanet can be use for decision support in Smart Water Network.

Research objectives
The aim of the paper is to develop a method of using EPANET solver to perform simulations allowing to choice the best scenario operation of the water supply network according to a specified criterion.For this purpose web based application was developed.Application allows remote access to the simulation model of the water distribution network developed in the EPANET environment.The application perform both single and cyclic simulations with the specified step of changing the values of the selected process variables (pump performance, valve opening rate, etc.).

Tools
The created application enables simulations of hydraulic systems and was built using Python scripting with Flask framework, EPANET .DLL file (Dynamic-Link Library) and PostgreSQL PostGIS database system(Figure 1).
Flask extends Python's capabilities for Web-based solutions, but does not includes many components like database abstraction layer or validation.This issue can be solved by using one of the many extensions, which provides modules that greatly increase its capabilities.This allows for saving time needed to produce application and also reduce amount of code lines.Choosing Flask allows to place computing algorithms and scripts used to process network models on the server side (backend) and presentation layer to users web browser (frontend).Implemented PostgreSQL database is one of the object-relational database management system (ORDBMS).PostGis extension allows to support for geographic objects (Postgis Web) Simulations of water network can be performed using computing engine EPANET, developed by United States Environmental Protection Agency (EPA) Water Supply and Water Resources Division.Program computes i.e. pipes and nodes pressure, energy usage of control components, it can performs hydraulic and water quality simulations and also allows to modify parameters of water supply network elements.In this work we use EPANETTOOLS [14] which is a module prepared to use EPANET computing capabilities in Python.Hydraulic models of water supply networks in EPANET are provided in files with *.inp extension, it contains characteristic of pipes, nodes, water tanks and control components (pumps and valves).The application uses the settings of the hydraulic network stored in the database, also allowing for modification.

Fig. 1. Logical scheme of developed application
User communicates with application through web browser, where is possible to change basic simulation parameters (i.e.pump efficiency, energy costs) and allows to modify optimization objective (i.e.minimization of costs, minimization of energy usage).It can choose one of the implemented optimization methods: • SLSQP (Sequential Least SQuares Programming), • Modified non-gradient method extreme function of many variables Neldera-Meada [15,16] • Modified Powell method [17,18].The brute-force method despite of the guarantee of finding the optimum solution, because of high computational complexity and long of computation time.This method is only valid for simple and uncomplicated hydraulic models.The first method of optimization available from the application level is the Nellander-Mead Creeping Simplex method (which has been modified to take account of limitations).The next two methods of optimization with limitations are the SLSQP method [19] and Powell.

Criteria and limits for control algorithms
Various criteria and constraints must be taken into account in determining the control algorithms.Main limitations in control are due to the technical feasibility of the equipment and the water supply network.The requirements may include criteria related to environmental and economic aspects.Legal restrictions are also important.The implementation of specific requirements makes it possible to conclude that the conditions required for sustainable development are met.The work defined goal functions that indicate the main criterion for which optimization was performed.The aim is to minimize the total costs associated with the water supply network, which includes the cost of electricity The purpose of the water supply system is to provide for customer the right amount of water with certain quality at the right pressure.This condition can be fulfilled through different pumps settings. where: -pressure in k-node [mH2O], -required minimal water pressure in each node[mH2O] The described criterion and limitation were taken into account in the created algorithm, whose execution indicated device settings.

Results
The result of the work is the computer environment for support decision-making in water supply systems control.The scope of work is limited to selecting the optimal settings of relative pumps speed.The operator need to load the file (file with Epanet model) and select the control range: minimum and maximal relative speed of pumps.Relative speed changes during the optimization process, due to selected optimization method.These values are determined in the technical characteristic of pumps.User also need to define operational cost and energy cost.Operating costs depend on water treatment technology, environmental fees, etc.Energy costs are set out in the contract with the energy provider (cost of energy may vary for different pumping stations because of the tariff).In the application also constraints for optimization needs to be determined.The operator enters the minimum pressure requirements for all nodes and relative speed pump setting step.Pump setting step is related with technical capabilities of the devices.Before running the simulation procedure, user chooses which optimization method will be appliedThe application interface is web responsive, which ensured its mobility, legible on the different devices like smartphones, tablets, laptops.

Case study
The web application was tested on a computer module of water distribution system which consist of: 15 junction, 2 pumps, 17 pipes and two sources of water (Figure 3).After the necessary data and constraints were entered the optimization procedure were performed.The result for one of optimization method is presented in figure 4. Result presents minimal operation, energy cost and sums it up.The value of selected pumps settings were presented as well.The web application also allows analysing results on surface graphs (Figure 5).The chart contains information about: value of pump 1 setting (x-axis), value of pump 2 setting (yaxis) and value of cost (z-axis).On the graphs cut off those solutions that did not meet the optimization criteria (minimal require pressure in all nodes).The graph was made for the brute-force method.

Conclusion
The use of mobile application running using solver EPANET contributes to minimizing energy consumption and thus greenhouse gas emissions, without affecting the quality of drinking water.A similar system using the EPANET solver has recently been tested by other researchers who have demonstrated that its use reduces per capita water consumption and energy consumption by approximately 6-10% and by 0.5-6.2%,respectively [21].
In the paper the system for support the decision about the pump settings was presented.The system uses a well-known tool for new tasks -supporting the management of the water distribution network.Using this type of architecture allows to create complex computer tools to manage water distribution system in Smart City.Used modules of IT tools has open architectures.It also should be emphasized that all of used tools was developed under Open Source license.

Fig. 2 .
Fig. 2.The scheme of analysed water supply system model.
and operational costs (consists of environmental fee for raw water, processes of water treatment).Mathematically, this task can be written as follows: purchase