EPANet and Matlab

A visitor that came to this blog from Demetriosֲ Eliades’sֲ web site reminded me of the EPANet and Matlab issue. About 3 years ago I was busy preparing for the Battle of the Water Sensor Networks (BWSN). A few people helped me test and debug the software utilities for the battle. One of them was Philip Jonkergouwֲ from the University of Exeter. One of the methods we used to validate theֲ programs was to independently write the code and compare results. I developed the programs in Visual Basic and Philip used Matlab.

The programs we wrote had to call the EPANet toolkit.ֲ Both of us spent a lot of time setting up the programsֲ to work correctly according to the BWSN rules. When it did work we compared the results, fixed the bugs and the BWSN is history.

Calling EPANet from Matlab is still a task people are looking for help with. Philip postedֲ a Matlab file and shared his experience. Some time later Demetrios publishedֲ an “enhanced modified version” with some technical explanation for beginners.

More information regarding EPANet and Matlab integration can be found by searching the Water Simulation Forum.

I have met Demetrios in August 2006 at the WDSA 2006 and even had a good time. Who said water engineers can’t party?


From right to left: Ami Preis, Demetriosֲ Eliades, Lina Perelman, yours truly and a Colombian guy that I can’t remember his name.

Tagged with:
16 comments on “EPANet and Matlab
  1. Santosh Kumar Sahu says:

    I am using EPANET and LOOP-4 for distribution network for Government projects of INDIA. I want to sharpen my knowledge with your team.
    Thanking you.

  2. Demetrios Eliades says:

    This is a great photo Elad!!! I still have the hat 🙂

  3. Hi Demetrios, hope you are fine.

    I have the hat too 🙂

  4. Abrahan lopez says:

    i like to know how is the integration epanet -mathlab it seem interesting
    if this is realy congratulations
    i like to get more information about that.

  5. mohammadreza says:

    Hi dears
    I’d be glad to be in connection with you and know as much as possible about EPANet features
    I’m ms student of university of tehran,iran

  6. hacene says:

    I want to display the results of pressure from some nodes with their ID
    (Of course from a Matlab

  7. hacene says:

    I want to display the results of pressure from some nodes with their ID(Of course from a Matlab)

  8. Ayoub says:


    I would like to know how to use the various types of pointers to have the values of nodes for example.
    I tested with the pointer of the type “int32Ptr”, but I received an error message ”Pointer types must match data type“.

    I have then to test another types of pointers (as indicated in the file epanet2.h), float, double,… and that did not go.

    I thus do not know how to make, it is very urgent for me to finish the program.

    thank you to propose a solution to me.


  9. eshe says:

    I am conducting a research on the application of Extended compact genetic algorithm(ECGA)for the optimization of pipe network systems. I have got a general ECGA code on Matlab. I have used Epanet software to simulate the hydraulics of the network. Epanet_matlab toolkit is available for the analysis of the hydraulics. However, I have got difficulties in integrating the two codes on Matlab to optimize the pipe network system. I kindly request you to show/highlight the basic concept to integrate the two codes.
    Thank you in advance

  10. Dhafar says:

    hi, I was trying to assign three different pump patterns to three pumps in the network model I worked on. Those patterns are chnaged, and I am willing to analyze the hydraulic behavior of the model for each time. I was trying to use setdata”EN_Pattern” but it seems it does not work. any sugeestion on how to set pump pattern for each pump outside the .inp file

  11. Dhafar – what error do you get with ENsetpatternvalue?

  12. Sravan says:

    Sir how to make animations(water flow animation) in epanet software

  13. sahrim says:

    Hi!I’m very new with epanet matlab toolkit.
    I’m student from Malaysia.
    can anyone share with me how to simulate different emitter coefficient to epanet with matlab to selected node and retun the pressure and flow value to matlab?


  14. slv says:

    is any toolkit is available for epanet emitter?

  15. MATTRX says:

    I’m interested too in Epanet toolkit for Matlab. But i’m new, and I’m looking for some materials that can help me to learn something more. Are there available some good slide? I’m looking for some help in detection leakeage with emitter coeff in epanet and fields misure of pressure and flow. Please help me.

  16. kikou says:


    I would like to retrieve the settings of parameter nodes or arcs over a period of 24 simulation.

    I presume that you must use functions (initH, Runh or nextH)??

    my question is: what is the syntax for data recovery simulation 24hrs

    thank you very much for your help

    Best regards,


Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.