Closed LRossman closed 1 year ago
An alternative that preserves backward compatibility is to #define
two new constants, EN_SET_CLOSED
as -1e10 and EN_SET_OPEN
as +1e10, to use as the setting argument to EN_addcontrol
andEN_setcontrol
to indicate that a valve has a fixed setting (since it's highly unlikely that someone would use these particular values for an actual valve flow or pressure setting).
This issue has been addressed with PR #732 and can be closed now.
This issue was previously identified in #677 which was closed but never completely resolved.
The
EN_addcontrol
andEN_setcontrol
API functions are unable to set the status of a FCV, PRV, or PSV to be fixedOPEN
orCLOSED
. The functions only accept a numerical value for the flow or pressure setting of these types of valves while assigning their status toACTIVE
. This prohibits the API from building a model that could mimic an EPANET .inp file where the [CONTROLS] section has entries that assign a fixed status to such valves.One possible fix would be to add an additional Status argument to these functions (as well as the EN_getcontrol function) so that a valve's status could be fixed
OPEN
orCLOSED
. Another possibility is to change the existing Setting argument to be a character string instead of a double which the functions could then interpret as either a fixed status or numerical setting. The downside of both options is that they would break backward compatibility.