Extended EPANET Toolkit

General Information

The original EPANET is a software developed by Lewis Rossman which simulates the hydraulic and water quality behaviour of Water Distribution Networks. The EPANET Toolkit allows researchers to use the simulation engine within other applications, such as optimisation algorithms. It is public domain software that may be freely copied and distributed and its original source code is available in the official EPANET site.

I have implemented some modifications on the original source code of EPANET Toolkit version 2.00.10. The main goal is to adapt the code to be compiled with GCC and used under GNU/Linux. Nonetheless, users have reported that this modified version can be successfully compiled into a Windows DLL using Visual C++ 6.0. Please let me know about your success (or problems) when compiling/using this modified version.

The purpose of publishing these modifications is that other researchers can benefit from them and test this version of EPANET. Therefore, any feedback will be welcome. In the following I will refer to this version of the EPANET Toolkit simply as EPANET, EPANET toolkit or EPANET library.

Thread-safe variant of EPANET Toolkit

I have also developed a thread-safe variant of EPANET Toolkit to be used by parallel applications based on this modified version of EPANET. However, the thread-safe variant is highly experimental and is not compatible with programs using the original EPANET Toolkit.


Using the EPANET Toolkit in your program

Building successfully a program that uses the EPANET library requires that the compiler is able to find the header file toolkit.h and the library file libtoolkit.a . The first step is accomplished by adding the line #include "toolkit.h" to your header file (e.g. yourprogram.h ). You also need to compile your program using the option -Idir where dir is the directory of toolkit.h.[*] You may also need to indicate to GCC that it should link with the mathematical library using the option -lm. For example:

$ gcc -I./toolkithdir/ -o yourprogram yourprogram.c libtoolkit.a -lm

In old versions of GCC you may need to use the options -L and -l to link with libtoolkit.a . Consult the manual page of GCC for details.

Even if toolkit.h and libtoolkit.a are copied respectively to /usr/include/ and /usr/lib/, which I strongly discourage, the library still needs to be mentioned when linking:

  $ gcc -o yourprogram yourprogram.c -ltoolkit -lm

Please, check the examples directory included with the source code.

[*] The option -Idir is not needed if toolkit.h is in the current directory.


Building the EPANET Toolkit from source

The source code contains the files necessary to build the library itself (not to build programs that use the library, that is explained in the previous paragraph). The following command will build the library and place the resulting files libtoolkit.a and toolkit.h in the parent directory:

$ make toolkit

Please check the file Makefile for more information about building the library.


Example Applications using the EPANET Toolkit

The source distribution now comes with a few examples. To build the examples, move into the examples/ directory and execute:

$ make


License

This version of EPANET is Copyright (C) 2005, 2006, 2007, 2008, 2009 Manuel López-Ibáñez.

This version of EPANET is free software (software libre); you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

This version of EPANET is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You are not allowed to use or modify this version of EPANET or its source code if you do not agree with the terms of the GNU General Public License. In that case you may prefer to use the original EPANET, which is available as public domain software.

IMPORTANT NOTE: Please be aware that the fact that this program is released as Free Software does not excuse you from scientific propriety, which obligates you to give appropriate credit! If you write a scientific paper describing research that made substantive use of this program, it is your obligation as a scientist to (a) mention the fashion in which this software was used, including the version number, in the Methods section, to allow replication; (b) mention the URL http://lopez-ibanez.eu/epanetlinux.html in the text, in a footnote or in the Acknowledgements section; (c) mention the following citation in the References section:

Manuel López-Ibáñez. Operational Optimisation of Water Distribution Networks. PhD thesis, School of Engineering and the Built Environment, Edinburgh Napier University, UK, 2009.

Moreover, as a personal note, I would appreciate it if you would email manuel.lopez-ibanez@manchester.ac.uk mentioning programs, projects and citations of papers utilizing or referencing this work so I can mention them to my funding agent and tenure committee.


Download

5 Feb 2009 Changes in version 1.5 [ Download Source ] [ Complete Changelog ]
   
 * examples/evalleveltriggers: New example application.

 * examples/evalpattern: New example application.

 * examples/getcoords: New example application.
        
 * hydraul.c (pumpswitch): Fix corner case where we will count one
   less switch than the actual number.

 * epanet.c (ENaddleveltrigger): In case that start_time > stop_time,
   it adds one rule for the interval [start_time, SECperDAY - 1] and
   another for [0, stop_time]. In case that start_time == stop_time,
   don't do anything.

 * rules.c (addlevelbasedtrigger): Return error 202 if start_time >=
   stop_time.

 * toolkit.h: New #define EPANET_VERSION

 * Makefile: make tags. Update version correctly in toolkit.h.

 * epanet.c (ENgetcontrol): Fix segmentation fault when *nindex > Nnodes.

Publications that made use of this software

  1. Manuel López-Ibáñez, T. Devi Prasad, and Ben Paechter. Representations and Evolutionary Operators for the Scheduling of Pump Operations in Water Distribution Networks. Evolutionary Computation, 19(3):429–467, 2011.
    bibtex | doi: 10.1162/EVCO_a_00035 |  instances ]
  2. Edgar Reehuis. Multiobjective Robust Optimization of Water Distribution Networks. Master's thesis, Leiden Institute of Advanced Computer Science, Leiden University, The Netherlands, 2010.
  3. Manuel López-Ibáñez, T. Devi Prasad, and Ben Paechter. Ant colony optimisation for the optimal control of pumps in water distribution networks. Journal of Water Resources Planning and Management, ASCE, 134(4):337–346, 2008.
    [ DOI ]
  4. Manuel López-Ibáñez, T. Devi Prasad, and Ben Paechter. Solving optimal pump control problem using max-min ant system. In Dirk Thierens et al., editor, Genetic and Evolutionary Computation Conference (GECCO), volume 1, page 176, London, UK, July 2007.
    [ Abstract ]
  5. Manuel López-Ibáñez, T. Devi Prasad, and Ben Paechter. Multi-objective optimisation of the pump scheduling problem using SPEA2. In IEEE Congress on Evolutionary Computation, volume 1, pages 435–442, Edinburgh, UK, September 2005.
    [ PDF ] [ Presentation (PDF) ]
  6. Manuel López-Ibáñez, T. Devi Prasad, and Ben Paechter. Optimal pump scheduling: Representation and multiple objectives. In Dragan A. Savic, Godfrey A. Walters, Roger King, and Soon Thiam-Khu, editors, Proceedings of the Eighth International Conference on Computing and Control for the Water Industry (CCWI2005), volume 1, pages 117–122, University of Exeter, UK, September 2005.
    [ PDF ]