Set hydraulics paramenters


#1

Hello everybody!

I’m going through all MATLAB toolkit functions and examples (which can be found here: https://github.com/OpenWaterAnalytics/EPANET-Matlab-Toolkit ) but I don’t understand how to set some specific parameters. In particular, when you open a .net file in EPANET 2, go to Project > Defaults… > Hydraulics, you can manually set e.g. Specific Gravity or Relative Viscosity. How can I do the same from MATLAB?

Thanks in advance for your help!


#2

Hi @Pisciotta, you can check here: https://github.com/OpenWaterAnalytics/EPANET-Matlab-Toolkit/tree/dev-2.2-edit

Note: This branch is a development version where we update daily.

start_toolkit;
d = epanet('Net1.inp');

d.setOptionsSpecificGravity(2);
d.getOptionsSpecificGravity

d.setOptionsSpecificViscosity(2);
d.getOptionsSpecificViscosity

#3

Thank you very much for your answer!

I had no idea about this new development version, so meanwhile I solved the problem by directly modifying the .inp file, where such parameters can be found. So I just opened the .inp file, searched below the [OPTIONS] header and changed the parameter’s value. If anybody need a general way to change parameters of this kind of format (KEY [spacing] VALUE) in Matlab, it could be useful to read my post: https://pisciottablog.wordpress.com/2019/07/07/matlab-replace-a-parameters-value-inside-text-file/#more-1046

I also suggest this tutorial on EPANET as further reading: https://www.microimages.com/documentation/Tutorials/Epanet2UserManual.pdf

Of course using commands you mentioned is the best solution. Thanks again!