EPANET Programmer’s Toolkit
I have mentioned the EPANET toolkit several times before but didn’t post any information about it yet. The following info is from the toolkit readme file:
EPANET is a program that analyzes the hydraulic and water quality behavior of water distribution systems. The EPANET Programmer’s Toolkit is a dynamic link library (DLL) of functions that allows developers to customize EPANET’s computational engine for their own specific needs. The functions can be incorporated into 32-bit Windows applications written in C/C++, Delphi Pascal, Visual Basic, or any other language that can call functions within a Windows DLL. The Toolkit DLL file is named EPANET2.DLL and is distributed with EPANET. The Toolkit comes with several different header files, function definition files, and .lib files that simplify the task of interfacing it with C/C++, Delphi, and Visual Basic code.
The freeware FireFlow utility was written using the EPANET toolkit.
For more information and download see EPANET web page.
sir
i want to optimise the water distribution system of our campus using ant colony optimisation.
i am with a set of equations associated with ant colony optimisation and, can you help me to develope a code to link with that of the epanet tool kit.
can it be open the epanet tool kit with that of windows xp.
lekshmibhavana,
1) The toolkit can be used in Windows XP.
2) What exactly do you need regarding the Ant Colony optimization?
Elad
sir
my project is the optimisation of water distribution system using Ant colony optimisation . Ants secreting a substance called pheromone during there way from nest to the food source. By means of these pheromone successive ants realise the shortest path and thus they can optimise their path . Like wise with the available diameters we can optimise water distribution system by keeping the minimum pressure head and other constraints.
I came to know that we can develope a programme on Epanet tool kit and can be linked. Can i downloaded that epanet tool kit for that purpose and can you give me further advices about that
yours sincerely
LEKSHMI
lekshmibhavana,
The EPANet Toolkit can be dwonloaded from here:
http://www.epa.gov/ORD/NRMRL/wswrd/EN2toolkit.zip
Elad
Sir
What should be the procedure adopted for writing a programme in c or c++ using toolkit.
I DOWNLOADED THE EPANET TOOLKIT .
Now i am with a water distribution network. From my learnings i came to know that first
1. The network should be drawn in EPANET
2. Enter the pipe lengths, water demands at all the nodes, elevations at all the nodes etc
3. Write programme in Epanet.dll by calling required outputs from the Epanet
4. Run the programme.
Now i am with a possible 11 diameters and their associated costs. Where i input the cost?
Can it be through the programme or anywhere else?
i expect all the help from you
I have a great expectation about my project
THANKING YOU
yOURS FAITHFULLY
LEKSHMIBHAVANA
I have a similar problem that LEKSHMIBHAVANA’s problem,
I desire implementing heuristic algorithms with the EPANET’s input/output, but I don’t know how make this.
Thanks and… sorry for my english
Manuel
Manuel,
If you ask a specific question I can try and help
i need example code because i writecode not work
my file in c:\EN\
in folder EN have file
epanet2.dll
epanet2vc.lib
epanet2.h
int1.inp
test.c
this is test.c code
#include
#include “epanet2.h”
void main()
{
int errcode;
errcode = ENopen(“int1.inp”,”int1.rpt”,”");
if (errcode>0)
{
printf(“cann’t run ENopen”);
ENclose();
return;
}
ENsolveH();
ENsolveQ();
ENreport();
ENclose();
}
please sent example code to my e-mail
tongirri@hotmail.com
tongirri,
What error do you get?
Please see this example:
http://www.water-simulation.com/wsp/bb/viewtopic.php?id=238
in my code
i write code follow programmer’s toolkit in page “opening and closeing the toolkit” and “ENsolveH”
after buid
VC show
——————–Configuration: test – Win32 Debug——————–
Compiling…
test.c
Linking…
test.obj : error LNK2001: unresolved external symbol _ENreport@0
test.obj : error LNK2001: unresolved external symbol _ENsolveQ@0
test.obj : error LNK2001: unresolved external symbol _ENsolveH@0
test.obj : error LNK2001: unresolved external symbol _ENclose@0
test.obj : error LNK2001: unresolved external symbol _ENopen@12
Debug/test.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.
test1.exe – 6 error(s), 0 warning(s)
————————————————-
i see example2-c in programmer’s toolkit
how i will call function “HydrantRating ()” in main program
void main()
{
.
.
.
HydrantRating (?,?,?,?);
.
.
.
}
Thanks you
Hi!
I have the same problem as tongirri, I keep on getting the error LINK for unresolved external symbol. I’m using VS.NET 2003 with C++ as a programming language, I’m including the epanet2.h, I read in another forum that I have to use the epanetvc.lib instead of the header file.
Can someone please help me????
Thanks
Hi Cynthia and Tongirri!
I hope that these advices will help you, I met the same problem and spent a week to find the solution!!!
These are the step I followed using Microsoft Visual C++:
- include epanet2.h in your source file (.cpp);
- compile the program;
- link the library epanetvc.lib in this way:
on the menu bar select
project —> add to project —> files…
To be sure that the library has been linked, control in the workspace, in “fileview” if there is the file epanetvc.lib.
- Now you can build the program and then execute it!!
If you’ll meet other problems write, I’m here!!
Bye
I am open and build the epanet2 source code in Delphi7, it’s work fine, however a save file in a project of my epanet don’t open in others versions of epanet (english and portuguese). Only when i use caracters “ֳ§ ֳ¡ ֳ© ֳ ֳ³ ֳ÷” in descrition of pump. I think that code page language or delphi are different of mine. I don’t know that do for fix this.
dear sir
my project is determining the water quality of the distribution system. especially determining the concentration at each node. i have some set of equations to find the concentration. i have drawn the network and gave all the mandated inputs. i have run the analysis also. in my analysis i am getting concentration level at the initial node(reservoir and the first node) for the others i am getting 0Mg/l. i couldnt trouble shoot the problem. i dont know how to write c code also. whether to write in c editor or any editor inside the tool kit. when i import the network an input file is created. how to take input from this file and link with c code? plz sir help me for my futher work. i have great expectations for my project. expecting for your reply
thanks and regards
P.Priya
I’m designing a geothermal community ground loop system. It’s a closed loop where I am just supplying heat pumps with water for their heat exchangers to cycle. My question is should I represent a home with a “node” or a “pump”?
Hi
I have a problem wiht MS Visual Studio 2005, I program using the Epanet Toolkit on a C files, but now i need program in C++ wiht Objects, but the MS Visual Studio sendme 55 error and 110 warnings, what hapen??
please helpme !!
Thanks
hi
i m doing my m.tech thesis on optimal design of water distribution network using lingo software and rechecking the values in epanet. i am unable to write a code in lingo for head loss in a link around a loop,and i am not able to write for hl around the loop,
Hi,
I had the same problem that Victor is talking about and here is how I fixed the problem.
If you’re using C++ on a windows machine:
Open the epanet2.h file, modify all the functions in the file from:
int DLLEXPORT function()
to
extern “C” __declspec(dllimport) int __stdcall function()
example:
int DLLEXPORT ENepanet(char *, char *, char *, void (*) (char *));
became:
extern “C” __declspec(dllimport) int __stdcall ENepanet(char *, char *, char *, void (*) (char *));
Hi there,
I’m starting to setup the EPANet toolkit and link this into to an optimisation algorithm.
I’m working in C and am having some problems calling the ENopen(“input.inp”,”input.rpt”,”") functions amongst others.
I was wondering if anyone has had the same experience. I work on a Mac so I’m not sure if this would be a problem.
Can someone in lamens terms maybe tell me where the toolkit header files etc need to be copied and other instructions?
cheers,
n
Hi
i have a big problem, a work with Epanet tool in a Genetic Algorithm in C++ with the MS visual studio 2005, when i call 32767 times to toolkit ocurrs the problem, error 305!!
some one help me!!
Thanks
victor
Hi Nehme,
I could not still figure this out. Could you please elaborate if there are any int to be declared or “;” missing.
Thanks,
Prasad
Hi Nehme,
My errors doubled from 55 to 110 and got 2 warnings instead of 110. Errors are as follows:
VICTOR, WERE YOU ABLE TO FIGURE OUT THE ERRORS?
x error : ‘int’ should be preceded by ‘;’
1>c:\program files\microsoft visual studio 9.0\vc\include\epanet2.h(164) : error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\epanet2.h(164) : warning C4091: ‘__declspec(dllimport)’ : ignored on left of ‘int’ when no variable is declared
Victor, post or email me your code
Hi Macro,
I am using VC++ express edition 2008. I was trying to follow your directions but could not get the workspace or it did not show the appropriate links. Please help!
I have to change the header file. Please let me know if anyone is interested in knowing the solution.
Usually one can call epanet source code in two ways: all explanation apply to vc++ 2008 express,
1 use the source code. You need to go to tools-> options->projects and solutions-> vc++ directories, then add the epanet source code to the include path. Or you can copy the source code to your project file, so you do not need to include the file folder,
2 use the .dll and .lib. add the following command in front of the main function, #pragma commend(lib, “epanet.lib”) #include “epanet2.h”. In the epanet2.h, you need to add #extern “C” to extern functions to resolve the external symbols, e.g. ENopen. You do not need the DLLExport now, delete all of them, and the ones in epanet.c file.
Thanks a lot Hailiang! This solves the problem. Quick question – If you can quote an example of making use of ENsameinpfile shall be great help.
Also, it would be a big help if you could provide an example of creating a report for age at nodes using toolkit
What is the best way to report the age in the rpt file using toolkit? Can someone help me with an example?
Sulfate and total hardnes are overproof, others no overproof of the standards.However, i do not know how to applying epanet to evaluate it?
Dear Elad,
I want to develop an application in order to energy optimization in pump stations maybe with Python, am I could connect to Epanet toolkit? Please help me
Thanks.
Dear Elad,
I want to develop an application in order to calibrate water network model (just simple cycle). I would like to use The EPANET Programmer’s Toolkit. Which c++ compiler is the most suitable to do that into it?
Best regard,
Alec
Hello. My name is Nakhaee. Graduate student I am a civil engineering degree. For a thesis on the application must I link epanet into Matlab and roughness of the pipe in software Matlab and I epanet about the pressure and velocity of the epanet and I use the program Matlab. I’m grateful if you can help me