Closed LRossman closed 1 year ago
Hi @LRossman, I think that by utilizing the EN_setflowunits(units) function, the network data changes (including basedemands, elevations, etc.). However, maybe it is better with adding a new function like EN_convertunits(), as it's more clear!
https://github.com/OpenWaterAnalytics/EPANET/issues/125
https://github.com/OpenWaterAnalytics/EPANET/commit/d2503bc0355029cb8aff87577aa5d739ff4585fe
Thanks @Mariosmsk for correcting me. I forgot that all of a network's existing data (except for curves) were already converted to feet or CFS when they were first read in from a file or were set using a toolkit function, and therefore don't need to be converted when flow units are changed. However I believe there still exists one case (aside from curves) where a units conversion is still needed. That would be for rule based controls where the values used in premise conditions are not converted into feet/CFS when first read in. Could someone please confirm this. If true, then one could encounter a case where a rule's original pressure limit in psi is being compared to a computed pressure expressed in meters after EN_setflowunits
changes the unit system to SI.
This issue has been resolved by PR #719 and can be closed.
I thought this issue might have been raised before but I couldn't find it in the open issue list.
Currently when
EN_setflowunits()
is used to switch flow units it only updates the units of Curve data. Other flow data, such as demands, are not changed. It also doesn't change other non-flow data, such as pipe diameters and distances, node elevations, tank dimensions, etc., when the flow units change causes a change between US and metric units.What about adding a new function,
EN_convertunits()
, that takes the desired flow units as an argument (and possibly the desired pressure units as well) and does a global conversion of all network data, including the values used in controls, rules, and analysis options.