OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
273 stars 203 forks source link

API cannot set PDA pressure limits #735

Closed LRossman closed 1 year ago

LRossman commented 1 year ago

The minimum and required pressure limits and the pressure exponent for Pressure Driven Analysis can be specified in an EPANET input file but there is currently no way to get/set their values using the API. This can be fixed by adding EN_MIN_PRESS, EN_REQ_PRESS, and EN_PRESS_EXPON to the EN_OPTION enumeration in _epanet2enums.h and using the existing functions EN_getoption and EN_setoption to get/set their values.

lbutler commented 1 year ago

Can this not already be done with EN_getdemandmodel() and EN_setdemandmodel()?

I remember using them as part of a test when adding support for changing pressure units. Admittedly, it has to be done in bulk, and maybe you would want to set them individually

https://github.com/OpenWaterAnalytics/EPANET/blob/1ff1e8fdfc5c6ee3a1482e3004cf61bd0c655a72/tests/test_units.cpp#L123-L140

LRossman commented 1 year ago

Thank you @lbutler . Perhaps this is a sign that there are too many API functions and it's hard to remember them all or that my brain is turning to mush (more likely the latter).