EPANET/Matlab error message

Hi
I am using matlab 2015a with windows 8.1 64 bit. I followed the procedure that is here : https://eldemet.wordpress.com/2014/07/04/how-to-compile-epanet-on-64-bit-windows-matlab/ and after i set path the folder with the .dll and .h files with matlab and also the set path to the epanet-matlab class folder i get this error message :
loadlibrary(‘epanet2.dll’,‘epanet2.h’)
Warning: The data type ‘FcnPtr’ used by function ENepanet does not exist.

In loadlibrary (line 431)
Warning: The function ‘ENgetaveragepatternvalue’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetstatistic’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetcoord’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetnumdemands’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetbasedemand’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetdemandpattern’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetcurve’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENgetqualinfo’ was not found in the library
In loadlibrary (line 431)
Warning: The function ‘ENsetbasedemand’ was not found in the library
In loadlibrary (line 431)
Thank you!
Alexandroz

Hi @Alexandroz, can you please try the following:

download this version: https://github.com/OpenWaterAnalytics/EPANET/archive/dev-2.1-win-makefile.zip

unzip, go to the folder /build/WinSDK/ and execute Makefile.bat

This will create a “64bit” folder with the compiled DLL/H of the latest epanet version.

Let me know if this works, and if it loads in Matlab correctly using the loadlibrary command.

The folder that is created its a .def file also with the 64bit folder .Do i have to copy only the 64 bit folder that has an epanet2.h file only inside or should i set path to work with matlab in the hole folder? Sorry for my ignorance but i cant figure out what should i do.
Thank you!
Alexandroz

@Alexandroz, normally you don’t need to do anything as all the necessary files are copied in the folder. However this is an experimental feature, so there may be some bugs.

Can you please clarify the following:

  1. after downloading and unziping, when you execute the Makefile.bat (directly from Windows or by using the cmd environment), does it execute correctly, thus producing all 3 folders (\64bit, \32bitVB,\32bit)?
  2. In the \64bit folder, do you see the 3 files epanet2.dll, epanet2.exe and epanet2.h?

In case something has not worked right, can you please execute Makefile.bat using the command line cmd and see if there is an error message?

Those 3 folders exist and also the 32bit and 64 bit have only an epanet2.h and the 32bitVB its empty. I tried it as admin and it runs but there is a message Access Denied in in most of them.

@Alexandroz, can you also clarify whether you are using Windows SDK 8.1 or SDK 7.1?

Also can you please confirm which compiler you are using with Matlab (e.g. by executing mex -setup)

Note that currently we have tested EPANET and Matlab with Windows SDK 7.1.

for our reference: list of compilers supported by Matlab http://www.mathworks.com/support/compilers/R2015b/index.html

I am using windows SDK 7.1 and when i type mex -setup this mesage appears :
MEX configured to use ‘Microsoft Windows SDK 7.1 (C++)’ for C++ language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at.

Can u send me a link with epanet 2.00.13 version .
I wonder maybe the problem is caused because of the version of epanet i was using (2.00.12).
Thank for your help !

Ok @Alexandroz, this makes sense, perhaps you were using a different .h file.

If that’s ok with you I would like to help me understand why compiling using the Makefile.bat does not work in your case.

  • do you have administrator rights on your computer?
  • is the architecture intel or amd?

You can find the latest 64bit build in the link below (the link will expire in a week)

Let me know if this works.

Demetrios i set path again to the 64 bit folder you send me and now the error is again in the 431 line but only one :
Warning: The data type ‘FcnPtr’ used by function ENepanet does not exist.

In loadlibrary (line 431) .

My architecture is intel and i have admin rights in my pc.

This warning does not affect the library, it has been correctly uploaded to Matlab, and you can start using the library.

you can try this:
[err ver]=calllib('epanet2','ENgetversion',0)

you can also use the epanet-matlab class.

I am still curious why the makefile.bat did not work; could you please try and see if you can find the error?

thanks,

Demetrios

Demetrios my problem is solved. Thank you very much for your time and help!.This is the message i get when i run it :

[err ver]=calllib(‘epanet2’,‘ENgetversion’,0)

err =

 0

ver =

   20100

.I can run the .bat now but i deleted the Windows SDK 8.1 i think this was the problem because i had install both of windows SDK 7.1 and SDK 8.1. I remember that the bat file was running but in most of the commands was an acces denied message.
Happy New Year!

Dear Demetrios,
I have a new issue with the the TEST.m file when i try the run command i get this message :

Warning: The data type ‘FcnPtr’ used by function ENepanet does not exist.

In loadlibrary (line 431)
In epanet>ENLoadLibrary (line 2341)
In epanet>ENopen (line 2365)
In epanet/LoadInpFile (line 385)
In epanet (line 238)
In TEST (line 17)
In run (line 96)
Is this what is supposed to be shown? I use the epanet- matlab-class- master.
Thank You!

Hi Alexandroz,
It’s a warning in matlab, you can ignore this.

Thank you Mariosmsk.I am already trying to learn how to use the toolkit :smile:

1 Like

Dear Marios
Do you know why do i get errorcode=302 which is in the toolkit manual : 302 Cannot open input file.

           [errorcode] = calllib('epanet2',                
            'ENopen','Net1_Rossman2000.inp','Net1_Rossman2000.txt','Net1_Rossman2000.bin')

I have tried it with different .inp files also but i et the same error message.
Thank you !

Dear Alexandroz,

Try this example:

d=epanet(‘Net1_Rossman2000.inp’)

d.getNodeCount

d.getNodeElevations

I have tried it and it start running but the only thin that was showin was a warning message like above :

Warning: The data type ‘FcnPtr’ used by function ENepanet does not exist.

In loadlibrary (line 431)
In epanet>ENLoadLibrary (line 2341)
In epanet>ENopen (line 2365)
In epanet/LoadInpFile (line 385)
In epanet (line 238)
Operation terminated by user during epanet2_proto (line 94)

In loadlibrary (line 403)

In epanet>ENLoadLibrary (line 2341)
loadlibrary(‘epanet2’,‘epanet2.h’)

In epanet>ENopen (line 2365)
ENLoadLibrary;

In epanet/LoadInpFile (line 385)
[errcode] = ENopen(inpname,repname,binname);

In epanet (line 238)
obj.LoadInpFile([pwd,’\NETWORKS’,inpfile],[pwd,’\RESULTS\temp.txt’], [pwd,’\RESULTS\temp.out’]);

Maybe you need to run “mex -setup” and select compiler (e.g. Microsoft Windows SDK 7.1), then try again the above example.

I have selected the compiler (Microsoft Windows SDK 7.1) and have tested also in C and C++ but i get the same warning/error.I use epanet class master.

Hi Alexandroz,

Here is the final version so far which I am working on right now:

You can try running the ‘test.m’ which is included in the link above(>>test). The result is showed in the screenshot below.

If this is not displayed correctly you can sent back to me.

Thanks