Calling EPANET From Matlab



Comments



Description

Calling EPANET from Matlab | Demetrios G.Eliades http://eldemet.wordpress.com/2008/08/14/epanet-and-matlab/ Demetrios G. Eliades 14aug08 About The easy  these  way  ads  to  use (htt p://en.wordpress.com/about EPANET (http://www.epa.gov/nrmrl/wswrd/dw/epanet.html) ‐these‐ads/)  with Matlab, is to DOWNLOAD this set of Matlab methods (http://goo.gl/uEN07). This is an “enhanced modified” version of the ones originally posted by Philip Jonkergouw (http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15502& objectType=FILE). Please cite the authors of the codes – you are entitled to modify and use the code as you wish. Use with caution, and verify the algorithms. In case you find bugs, have any remarks or need extra information, please do not hesitate to contact ([email protected]) me. For EPANET questions you can always refer to the Water Simulation Forum (http://www.water‐simulation.com/wsp/bb/). In more detail now, for “lower‐lever” programming, the first thing one must do is to put epanet2.dll and epanet2.h in a new folder and setup Matlab to work within that folder. The library files can be imported in Matlab using the loadlibrary (http://www.mathworks.com/access/helpdesk/help/techdoc /index.html?/access/helpdesk/help/techdoc/ref/loadlibrary.html&http://www.google.com /search?q=loadlibrary++matlab&ie=utf‐8&oe=utf‐8&aq=t&rls=org.mozilla:en‐GB:official& client=firefox‐a) command. To see the functions included in the library, use the libfunctions (http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc /ref/libfunctions.html&http://www.google.com/search?q=libfunctions+matlab&ie=utf‐8&oe=utf‐ 8&aq=t&rls=org.mozilla:en‐GB:official&client=firefox‐a) command. For calling a method, use the calllib (http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc /ref/calllib.html&http://www.google.com/search?q=calllib++matlab&ie=utf‐8&oe=utf‐8&aq=t& rls=org.mozilla:en‐GB:official&client=firefox‐a) command with the same arguments as described in the toolkit. When you have reference to pointers, you must use the libpointer (http://www.mathworks.com /access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/libpointer.html&http: //www.google.com/search?q=libpointer+matlab&ie=utf‐8&oe=utf‐8&aq=t&rls=org.mozilla:en‐ GB:official&client=firefox‐a) command. Example code for use with net1.inp from EPANET package: 1 of 9 4/22/2013 6:08 PM %unload library unloadlibrary epanet2 Filed under: Tools   |   27 Comments Feed for this Entry   Trackback Address 1 Hamid on 25 October.'ENsolveH').dll and .'ENgetcount'. 'net1. %run quality simulations and save in output file (after ENsolveH) calllib('epanet2'. set output file eg. 2008 said: Hello at what time after time 0 we can find the real chlorine quantity ? how can I determine global balk coefficent ? 2 of 9 4/22/2013 6:08 PM .'net1. %for methods with pointers (returning values in arguments) %setup a pointer with th nnodes = libpointer('int32Ptr'. 'epanet2') %display library's functions libfunctions epanet2 ‐full %open network file.Calling EPANET from Matlab | Demetrios G.inp calllib('epanet2'. %run hydraulic simulation and save in output file calllib('epanet2'. %calls the method calllib('epanet2'.'ENreport'). %write a formated text report in output file calllib('epanet2'.com/2008/08/14/epanet-and-matlab/ %MATLAB CODE %load epanet2.txt'. Eliades http://eldemet.wordpress. 'ENopen'. 'ENclose').'Value'). 0 .inp'. nnodes). %close toolkit calllib('epanet2'.'').h loadlibrary('epanet2'. net1. %returns the values stored in the pointer get(nnodes.'ENsolveQ').0). ly/gRzc Regards. 2009 said: Announcement: I have updated the Matlab files so that is easier to operate EPANET. 2010 said: Dear Demetris.inp file. 2010 said: For some reason the factorial method requires a “double” number. there for I should link EPANET with MATLAB for this purpose. I don’t understand what the problem is.Calling EPANET from Matlab | Demetrios G.This variable is an int32 and has a numeric value of 19 for a certain . 3 of 9 4/22/2013 6:08 PM . So factorial(19) has a result but q=factorial(m) has no result. You can download the zipped folder with the Matlab code from http://bit. I used some function of your . Can anybody expalin how to link Epanet & Matlab with simple example.m files but there was a problem. Eliades http://eldemet.I think the solution is to inject chlorine in some junctions and this junctions should be fond via genetic algorithm method.com/2008/08/14/epanet-and-matlab/ how can I show and run an inline chlorinator in EPANET ? this means how I can modelling chlorine injection in a junction? abot your programs: My main quastion is to find new point to inject chlorine in order to solve the problem of dead points. your program work correctly ! but I dont know that’ outputs !!! Plaese help me. q=factorial(m). I receive this error: ??? Error using ==> factorial at 17 N must be a matrix of non‐negative integers. Could you please help me whit this matter? I’m looking forward for your answer. therefore you could use q=factorial(double(m)) demetris 5 SHIBU A. on 2 April. thanks in advance Reply 2 Demetrios Eliades on 21 August. When I use getdata(‘En_nodcount’) as bellow: m=getdata(‘EN_NODECOUNT’).wordpress. Demetris Reply 3 Mahdi on 27 February. 2010 said: Hi. I check m. Sincerely Mahdi Reply 4 Demetrios Eliades on 27 February.  2011 said: Dear Sir. please help me to understand this. I have tried the method.0 (R2010b) in 64‐bit Windowns 7. ‐Also the matlab code to run the simulation(snap shot)and also for extended period simulation & ‐to plot the time series plots ‐to save the output to a prticular file.net). you could try the following: 1.h’). Run matlab and file‐open the Example.in Expecting favourable reply at the earlist.kr/aquatic/knowledge/soft/epanetdoc/toolkit_help. demands. But I saw errors like this: ??? Error using ==> loadlibrary at 279 Microsoft Visual C++ 2005 or 2008 is required to use this feature. With warm Regards. for using EPANET and Matlab.mathworks. quality characteristics. such as pipe flows.ac. Thank you in advance. I don’t know how to solve this problem.com/2008/08/14/epanet-and-matlab/ Reply 6 Demetrios Eliades on 2 April. 2010 said: Shibu.m in Matlab as your instruction. So. Eliades http://eldemet. I use Matlab 7.com/matlabcentral/fileexchange /25100‐epanet‐matlab‐toolkit 2. Press F5 4. 2010 said: Hi Demetrios Eliades. SETDATA is to change/add certain parameters in the network. GETDATA is a function to call EPANET. You can find the EN_XXX codes in the EPANET Toolkit Reference. Error in ==> epanetloadfile at 30 if ~libisloaded(‘epanet2′) loadlibrary(‘epanet2′. which can be found in http://env1. to edit/change the data in matlab particularly for the network given in epanet examples(Net1.Calling EPANET from Matlab | Demetrios G.kangwon. Sincerely. 2010 said: 4 of 9 4/22/2013 6:08 PM . 5. which returns various parameters. Shibu Shibu 8 minchu on 15 April. but it is showing some error. end Error in ==> Example at 20 epanetloadfile(wdsfile). Thanking you. In the code. download and extract the toolkit in http://www.m 3. ‘epanet2. I will be very grateful to you if you can send the matlab code to view/see the data.wordpress. on 12 April. Minchu 9 Demetrios Eliades on 12 April.pdf d Reply 7 SHIBU A. My email id: [email protected]. I run the Example. com/2008/08/14/epanet-and-matlab/ Shibu. and I cannot give proper feedback until I understand where’s the problem “is showing some error”: Can you please tell be what error it says? Can you please describe the steps you took? demetris Reply 10 Hacene on 10 August. but I receive an error message “Pointer types must match data type. you do not know how you do good Reply 11 b_mesfi[email protected] on 14 September. The distribution network will be used for drinking water supply.Calling EPANET from Matlab | Demetrios G. Your code helped me a lot. 2010 said: Hello Mr. My name is Birhanu.com on 7 October.wordpress. 2010 said: I want the results of pressure for some nodes with their ID (I want to thank you for your help. I was wondering if your code is helpful to call EPANET in Matlab and use it for the purpose mentioned above? Thank you. I was trying to call EPANET in Matlab for my optimization model in water distribution network design. you did a great job.…)? if the answer is “yes”. Eliades http://eldemet. based on your description. I am trying to couple optimization model with the hydraulic simulation model (EPANET). The objective is to select a set of pipe sizes and pressure generating devices that minimizes the total cost. Eliades. Birhanu. All the information is within the file in the toolkit link. I thank you in advance. Birhanu. Reply 12 b_mesfin2002@yahoo. Reply 14 masoume on 16 January. single value. 2010 said: I am glad I figured it out. Reply 13 Ayoub on 28 September. 2010 said: hello I used the pointer of the int32Prt type to have the pressures of a node whose index is known. vector. which are the various types of pointers used for EPANET/MATLAB. 2011 said: dear demetris i went link epanet to matlab for using genetic algoright pleaze explain method linking tanks 5 of 9 4/22/2013 6:08 PM . I have to tell you.” my question is: does there exist a relation between the type of pointer used and the natrue of the required data (matrix. I am afraid I do not understand where the problem exists. Thanks Kenneth Reply 20 Bruno Brentan on 14 September. when I try to compile my programm. I receive a menssage: ” ??? Error using ==> loadlibrary at 441 Building epanet2_thunk_pcwin64 failed.com really appreciate it! Reply 18 Upendranath Bhupal on 25 August. 2011 said: How do we model a reservoir with multiple outlets (like in a natural draught cooling tower) in EPANET? Reply 19 Kenneth Muniina on 6 February. Compiler output is: cl ‐I”C:\Program Files\MATLAB\R2011a\extern\include” /Zp8 /W3 6 of 9 4/22/2013 6:08 PM . pump speed. I tried the Example. 2011 said: You can share with me one example of the application which do change parameters such as diameters. I am working on optimizing WDS. could you share some idea with me? my email address is qixuewei@gmail. Reply 17 Xuewei on 17 November. 2012 said: Hi. Thank you very very much.Calling EPANET from Matlab | Demetrios G.m in Matlab R2011b installed on a Windows 7(win64) system. Eliades http://eldemet.” Meanwhile. 2012 said: Hi. and willing to know how to read pump patterns and pass them to the . the file was compiled successfully. 2011 said: I am still working on this problem. thanks for your effort to make this code free for general use.dll is not a valid Win32 application. 2011 said: Hi.wordpress.com/2008/08/14/epanet-and-matlab/ Reply 15 Dhafar on 24 July. First. Any suggestions … I want to use the Windows 7(win64) system for my “large” modelling work. among others. and got the following error: ” Error using loadlibrary (line 421) … There was an error loading the library …epanet2.inp model? suppose I have three pumps and willing to import their patterns every optimization iteration to the network model to check whether the new pumps scheduling are feasible or not? any kind suggestion! Regards Reply 16 Misuzy on 9 August. But I have no idea about how to wirte the INP file (to change the pipe size or other parameters)during each loop. have you figured it out? I am trying to change the pipe size during the loop of my optimizatio algorithm. I run the same file on a Matlab R2009b in a Windows 7(win32) system. My queries are as follows…. file for 7 times and load 7 input files in the concerned directory. it is a great service you did for the entire technocrats and academician related with water distribution network problem.html.wordpress.c epanet2_thunk_pcwin64. 2012 said: I believe you should use the 64‐bit version of epanet (http://epanet.c(65) : error C2014: preprocessor command must start as first nonwhite space” I use a pc 64bits with Visual Studio 2008.c” ‐LD ‐Fe”epanet2_thunk_pcwin64. I downloaded the SDK tools. I am using your epanet _matlab tool kit function for a couple of days . #1. epanetloadfile(wdsfile).de/developer/64bit. Eliades http://eldemet.c(51) : error C2014: preprocessor command must start as first nonwhite space epanet2_thunk_pcwin64. I have changed the required properties in inp.dll” epanet2_thunk_pcwin64. For example. 2012 said: Dear Demetrios Eliades Sir. For this.Sivakumar on 2 December. 2012 said: I haven’t used Simulink for matlab. I called it in the matlab file for 7 times with wdsfile=’Net1. 7 of 9 4/22/2013 6:08 PM . 2012 said: Hi.inp’. If yes. anybudy can help me? Thank you!! Bruno Reply 21 Demetrios Eliades on 7 December. I don´t know how to solve this problem.c(52) : error C2059: syntax error : ‘{‘ epanet2_thunk_pcwin64. how to modify the toolkit function programme in matlab files ? #2.com/2008/08/14/epanet-and-matlab/ /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /nologo ‐I”F:\Epanet_Matlab_Toolkit\Epanet_Matlab_Toolkit” ‐I”F:\Epanet_Matlab_Toolkit \Epanet_Matlab_Toolkit” “epanet2_thunk_pcwin64. Is it possible?How? Thank you Reply 23 Demetrios Eliades on 7 December. and I can´t still compile my programm. but is something I will try to work on in the future. Reply 24 P. I want to change the node property (like emitter) or link property ( like roughness) of a simple network with 7 junction nodes . EPANET is working under the principle Demand Driven Analysis(DDA) or Flow Dependent Analysis (FDA).en) Reply 22 Alecs on 22 October. Is it possible to use Epanet with Simulink tool of Matlab? I have to introduce a PID control and I would like to run Epanet in Simulink and not with Matlab script.Calling EPANET from Matlab | Demetrios G. Can we do Pressure Driven Analysis (PDA) or Pressure Driven Demand(PDD) or Head Dependent Analysis (HDA) with your toolkit .  2012 said: Hi Sivakumar. How to link EPANET matlab toolkit with optimazation solvers like GA (ACO.Sivakumar Reply 27 P. Eliades http://eldemet.co. Wish you a Happy Christmas and New year. 1.Sivakumar on 4 February. Thank you for your valuable comments on my earlier query in time. value=single(value).en) or EPANET‐emitter (http://assela. 2.com/2008/08/14/epanet-and-matlab/ It is not that much tedious for simple network.net/EPANET‐Emitter)..html.wordpress.index. I had try to change the Node/link parameter according to your reply in 2 nd paragraph on 7th December 2012. with triangular and trapezoidal membership function) ? I am expecting your early advise.’ENsetlinkvalue’. Please check the epanet toolkit helpfile for more information. 2013 said: Dear Demetrios Eliades Sir. 8 of 9 4/22/2013 6:08 PM .Calling EPANET from Matlab | Demetrios G. however I haven’t tested any of that. But it is impossible for large networks. This is only possible through OOTEN (http://epanet. You can use MATLAB to modify these parameters.Sivakumar on 19 January. instead of loading a new file each time. 2013 said: Dear Demetrios Eliades Sir. My e mail id :‐ siva_nerist@yahoo. % the link index paramcode=int32(paramcode). paramcode=2.com Thanking you sir P. It is not possible to run PDF/PDD/HDA with this toolkit. Is there any method or programme to modify the changing property with single input file for large networks? I am expecting your advise .Sivakumar Reply 25 Demetrios Eliades on 7 December.nerist@gmail. Thank you with love P. PSO) and fuzzy logic ( to calculate the uncertainty problems like nodal demands. value). % the new roughness value calllib(‘epanet2′. Hope these helps Reply 26 P. %for roughness.pathirana. For example index=int32(index). pipe roughness etc.de/developer/ooten.in and psiva. paramcode. I have got the result.  • Theme: Unsleepable by Ben Gray. please advise me.wordpress. Is there any method to set my problem ? If yes.com/2008/08/14/epanet-and-matlab/ But I want to change the more than five nodes/links with a single parameter like roughness etc. 9 of 9 4/22/2013 6:08 PM . at a time instead single node/link.Sivakumar Reply Blog at WordPress.com. with warm regards P.Calling EPANET from Matlab | Demetrios G. Eliades http://eldemet. Thank you..
Copyright © 2024 DOKUMEN.SITE Inc.