Samples and libraries for EPANET developers (C, C++, Java, Python, Visual Basic)
- C: EPANET is written in C, the EPANET sources and the EPANET programmers toolkit provide an excellent starting point for C developers. Additional information, build files and patches are available on this page.
- C++ programmers have the choice between using the EPANET Toolkit functionality in C++ or OOTEN, the fully object oriented toolkit for EPANET.
- Java is supported by the Baseform-Epanet-Java-Library.
- Visual Basic programmers can use the EPANET toolkit. The use is illustrated in a sample solution.
Sample projects illustrating how to compile EPANET and related software using a variety of different compilers.
Visual Basic Solution
epanet_toolkit_example_vb.zip - Simple Visual Basic Express Edition 2010 project that illustrates how to use the EPANET Toolkit DLL in Visual Basic.
You should extract the files to c:\tmp in order to compile it successfully.
64-bit version of the EPANET toolkit.
Dev-C++ is a free C/C++ development environment for Windows.
Simply install Dev-C++ and copy epanet2.dev into the folder containing the EPANET sources.
epanet_pump.diff is a unified diff file against epanet.c and toolkit.h that adds the following functions, allowing to access pump data through the toolkit:
- int ENgetheadcurve(int, char *);
- int ENgetpumptype(int, int *);
Likewise, epanet_toolkit_pump.diff is a unified diff file against epanet2.h that adds the two functions.
The unified diff format is self explanatory. Further reference can be found in Wikipedia's unified diff format entry.
The patch command can be used to apply the source code changes. Windows users can download a version of the patch program from the GNUWin32 project: patch.
To apply the patch(es), follow the steps below:
- Copy epanet_pump.diff to the folder containing your EPANET sources
- Make sure that the patch command is in the PATH
- Run the following command: patch < epanet_pump.diff