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.
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.
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
#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
-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 to link with libtoolkit.a
. Consult the manual page of GCC for details.
libtoolkit.a are copied
I strongly discourage, the library still needs to be mentioned when
$ 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.
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.
The source distribution now comes with a few
examples. To build the examples, move into the
directory and execute:
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:
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-ibanezmanchester.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.
* 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.