The EPANET Toolkit supports many programming languages:
- 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++ developers have the choice between using the EPANET C Toolkit functionality in C++, EPANET-RTX or OOTEN, the fully object oriented toolkit for EPANET.
- C# is also supported.
- Haskell users could install epanet-haskell using cabal.
- Java is supported by the Baseform-Epanet-Java-Library.
- MATLAB users have several options to use the EPANET Toolkit.
- Python is also supported.
- Visual Basic developers can use the EPANET toolkit. The use is illustrated in a sample solution.
EPANET and C
Sample projects illustrating how to compile EPANET and related software using a variety of different compilers.
Orwell Dev-C++ Projects
Orwell Dev-C++ is a popular open source C/C++ IDE for Windows.
Dev-C++ EPANET Toolkit example (C)
A very simple example that illustrates how to import the 32-bit EPANET Toolkit DLL into a Dev-C++ project and link a console application against it.
Simply download and unzip epanet_toolkit_example_devcpp_c.zip. Open the Dev-C++ project, build and run. Sample INP file and relevant EPANET Toolkit files are included. Note how Net1.txt and Net1.inp are generated in the build folder when running the application.
Build the EPANET toolkit DLL
Simply install Dev-C++ and copy epanet2.dev into the folder containing the EPANET sources.
Simply install Dev-C++ and copy epanet2exe.dev into the folder containing the EPANET sources.
Patches to the EPANET C 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
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.