adds api support for enabling/disabling controls and rules

This commit is contained in:
Sam Hatchett
2023-09-12 14:51:44 -04:00
parent 630eed4369
commit 06a43cdb4e
9 changed files with 161 additions and 1 deletions

View File

@@ -391,6 +391,9 @@ extern "C" {
int DLLEXPORT ENsetcontrol(int index, int type, int linkIndex,
EN_API_FLOAT_TYPE setting, int nodeIndex, EN_API_FLOAT_TYPE level);
int DLLEXPORT ENgetcontrolenabled(int index, int *out_enabled);
int DLLEXPORT ENsetcontrolenabled(int index, int enabled);
/********************************************************************
@@ -436,6 +439,10 @@ extern "C" {
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
int DLLEXPORT ENgetruleenabled(int index, int *out_enabled);
int DLLEXPORT ENsetruleenabled(int index, int enabled);
#if defined(__cplusplus)
}
#endif

View File

@@ -1640,6 +1640,23 @@ typedef struct Project *EN_Project;
int DLLEXPORT EN_setcontrol(EN_Project ph, int index, int type, int linkIndex,
double setting, int nodeIndex, double level);
/**
@brief Gets the enabled status of a simple control.
@param ph an EPANET project handle.
@param index the control's index (starting from 1).
@param out_enabled the control will be either enabled or disabled.
@return an error code.
*/
int DLLEXPORT EN_getcontrolenabled(EN_Project ph, int index, int *out_enabled);
/**
@brief Sets the enabled status of a simple control.
@param ph an EPANET project handle.
@param index the control's index (starting from 1).
@param enabled set the control to either enabled or disabled.
@return an error code.
*/
int DLLEXPORT EN_setcontrolenabled(EN_Project ph, int index, int enabled);
/********************************************************************
@@ -1824,6 +1841,24 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_setrulepriority(EN_Project ph, int index, double priority);
/**
@brief Gets the enabled status of a rule-based control.
@param ph an EPANET project handle.
@param index the rule's index (starting from 1).
@param out_enabled the rule will be either enabled or disabled.
@return an error code.
*/
int DLLEXPORT EN_getruleenabled(EN_Project ph, int index, int *out_enabled);
/**
@brief Sets the enabled status of a rule-based control.
@param ph an EPANET project handle.
@param index the rule's index (starting from 1).
@param enabled set the rule to either enabled or disabled.
@return an error code.
*/
int DLLEXPORT EN_setruleenabled(EN_Project ph, int index, int enabled);
#if defined(__cplusplus)
}
#endif