Samples and libraries for EPANET developers (C, C++, Java, 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
Sample projects illustrating how to compile EPANET and related software using a variety of different compilers.
Visual C++ Solution
epanet_toolkit_example_msvc_cpp.zip - Simple Visual C++ Express Edition 2010 project that illustrates how to use the EPANET Toolkit DLL in C++.
If you extract the files to c:\tmp and compile the solution successfully, you could try the following steps on commandline to test the application:
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
64-bit version of the EPANET toolkit.
Dev-C++ Projects
epanet2.dev is a Dev-C++ project to build the EPANET toolkit dll.
epanet2exe.dev is a Dev-C++ project to build epanet2.exe.
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 Patches
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
OOTEN
OOTEN is the Object-Oriented Toolkit for EPANET. It is written in C++.