File Exchange

image thumbnail


version 2.1.7 (16 MB) by Demetrios Eliades
A Matlab class for EPANET water distribution simulation libraries


Updated 25 Apr 2021

From GitHub

View Version History

View license on GitHub

The EPANET-Matlab Toolkit is an open-source software, originally developed by the KIOS Research Center for Intelligent Systems and Networks of the University of Cyprus which operates within the Matlab environment, for providing a programming interface for the latest version of EPANET, a hydraulic and quality modeling software created by the US EPA, with Matlab, a high-level technical computing software. The goal of the EPANET Matlab Toolkit is to serve as a common programming framework for research and development in the growing field of smart water networks. The EPANET-Matlab Toolkit features easy to use commands/wrappers for viewing, modifying, simulating and plotting results produced by the EPANET libraries. For support, please use the OWA community forum :

Cite As

D.G. Eliades, M. Kyriakou, S. Vrachimis and M.M. Polycarpou, "EPANET-MATLAB Toolkit: An Open-Source Software for Interfacing EPANET with MATLAB", in Proc. 14th International Conference on Computing and Control for the Water Industry (CCWI), The Netherlands, Nov 2016, p.8. (doi:10.5281/zenodo.831493)

Comments and Ratings (32)

Pedram Jazayeri

Two question were made.
1-How I can assign a different Preq,Pmin,Pexp for every node in PDA analysis with epanet dll 2.2?
2-When I run Net1.inp for 24hr-period, outputs concluded by "d.getComputedHydraulicTimeSeries" shown in 27 time periods ,why it happened?

Marios Kyriakou

How to use EPANET-MATLAB-Toolkit

yiduo yao

Hi, I have already install the MinGW64. However, when I type 'd = epanet ()', the result showed that epanet is undefined variable. Could you please help me figure it out?
Thank you!

prerna pandey

I am not able to change the setting of the valve (Linked with the Epanet) in Matlab. Can anyone suggest the command for changing the setting of valve for the static condition. Thank you so much in advance.

Pedram Jazayeri

Thank you for your practical Toolkit.
Why EX19~EX25 do not exist in the downloaded toolkit?
Even, it can not be reachable in the "functions" part!
Thanks a lot

Pedram Jazayeri


Hi everyone,
I have to use the Epanet Toolkit to analyse the simple water supply network. While using the toolkit, initially i have run the model successfully. I have to model the leakage in the pipe by using the Emitter Coefficient for a given node. So, after changing the value of emitter coefficient in the input file, the toolkit is unable to incorporate the changes in the result(toolkit is not using the emitter coefficient in the hydraulic solution).
I am loading the input file using "Bin", as i am unable to install any supported SDK or compiler. The syntax is as:
to get the result, the command which i am using is

I am using Matlab 2016a. I have tried mingw-w64 c/c++ compiler, but i am not able to install and use.

Please help me in this regard.

devang singh

Sir i have lodes the network in toolkit successfully but i am not able to tum hydraulic analysis by command in matlab ,plz help

Marios Kyriakou

For support, please use the OWA community forum:

Jorge Pesantez

I have downloaded the toolkit and when I want to the hydraulic analysis (EX2_Hydraulic_Analysis) on a network but it seems that the code doesn't read the control rules and I don't get the correct data. Is there any possible solution?


I have downloaded this file but I can't install it on Windows 7
the exe file relate to 64bit can't open
can you help me?


i am using epanet matlab toolkit to analyse a water distribution network and the code is as below:
x=[110 112 113 114 115]';
for i= 1:1
a = x(:,i)
g = epanet('network1.inp');
for m = 1:5;
RC = g.getLinkRoughnessCoeff;
RC(5) = a(m,1);
LF = g.getBinComputedLinkFlow
Q (m,1) = LF (1,5)

but, the link roughness coefficient is not getting updated in the epanet and i am getting link flow for the initial value of pipe roughness coefficient only. how can this be solved?

Abdulaziz Alqahtani

I am new to this toolkit and tried to start it and got the message
Error using epanet (line 477)
Could not open the file, please check INP file.

This happens when I run d=epanet('Net1.inp');
any idea how to solve this?


Alexis Kyriacou

Great Matlab Toolkit. Thank you !

Ungtae Kim

I ran RunTests.m and got the following message.

Index exceeds matrix dimensions.
Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 527)
Error in loadlibrary (line 263)
Error in epanet>ENLoadLibrary (line 6917)
Error in epanet (line 463)

Any idea to figure out this?

hima bindu

how can i write code in matlab
instead of ENsolveQ

Can i apply the fuzzy logic in matlab to epanet? for example, use fuzzy logic control pump station

Demetrios Eliades

@Very Tary, EPANET splits the time step when a hydraulic change is made. So you may have extra instances (e.g. 12:00, 13:00, 13:15, 14:00) if at time 13:15 a tank status has changed. Please keep track of the time using the toolkit.

Veronica Taurino

Hi! Great tool!
I'm trying the example script "simepa.m" (folder "example"). I wonder the difference between the output data in the workspace "hydraulics" and "results". Why the "hydraulics" struct has more rows then "results" struct, even if the time series is fixed?

Thank you for your effort!

Stelios Vrachimis


Thank you for your efforts and I'd like to receive your advice.
When I run EPANET-Matlab-Toolkit, the error message is occurred as below,

Warning : Folder "64bit" does not exit.
> In epanet (line 408)

What's is the problem?



any one have tutoriel to call epanet in matlab


how to call epanet in matlab

Demetrios Eliades

@Karwan Ali: you need to run

>>mex -setup

and select a compiler (e.g. Microsoft Windows SDK 7.1)

Have a look at this link:

Karwan Ali

Please,I have the following error, what does it means?. Thank you

Error using loadlibrary (line 254)
A 'Selected' compiler was not found. You may need to run mex -setup.

Error in epanetloadfile (line 3)

Chris Kelley

Thank you for this tool. I've noticed that the full hydraulic analysis report output by the toolkit (set with ENsetstatusreport(2)) seems to be very different from the full report output by EPANET (in Report >> Full...). Is there an easy way to get all the data in the EPANET full report via this toolkit?

Your advice is greatly appreciated.



i want to use optimization also here, i want to keep the elevation of the nodes and the diameter of the pipes as variables in the input file. How can i do it?


can you tell me how to install this file?


fantastic tool!

Kegong Diao

Thanks a lot!

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: getwdsdata.m

Inspired: KIOS-Research/EpaGui, EPANET Info from INP files

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!