These functions are used for working with rule-based controls. More...
Functions | |
int | EN_addrule (EN_Project ph, char *rule) |
Adds a new rule-based control to a project. More... | |
int | EN_deleterule (EN_Project ph, int index) |
Deletes an existing rule-based control. More... | |
int | EN_getrule (EN_Project ph, int index, int *out_nPremises, int *out_nThenActions, int *out_nElseActions, double *out_priority) |
Retrieves summary information about a rule-based control. More... | |
int | EN_getruleID (EN_Project ph, int index, char *out_id) |
Gets the ID name of a rule-based control given its index. More... | |
int | EN_getpremise (EN_Project ph, int ruleIndex, int premiseIndex, int *out_logop, int *out_object, int *out_objIndex, int *out_variable, int *out_relop, int *out_status, double *out_value) |
Gets the properties of a premise in a rule-based control. More... | |
int | EN_setpremise (EN_Project ph, int ruleIndex, int premiseIndex, int logop, int object, int objIndex, int variable, int relop, int status, double value) |
Sets the properties of a premise in a rule-based control. More... | |
int | EN_setpremiseindex (EN_Project ph, int ruleIndex, int premiseIndex, int objIndex) |
Sets the index of an object in a premise of a rule-based control. More... | |
int | EN_setpremisestatus (EN_Project ph, int ruleIndex, int premiseIndex, int status) |
Sets the status being compared to in a premise of a rule-based control. More... | |
int | EN_setpremisevalue (EN_Project ph, int ruleIndex, int premiseIndex, double value) |
Sets the value in a premise of a rule-based control. More... | |
int | EN_getthenaction (EN_Project ph, int ruleIndex, int actionIndex, int *out_linkIndex, int *out_status, double *out_setting) |
Gets the properties of a THEN action in a rule-based control. More... | |
int | EN_setthenaction (EN_Project ph, int ruleIndex, int actionIndex, int linkIndex, int status, double setting) |
Sets the properties of a THEN action in a rule-based control. More... | |
int | EN_getelseaction (EN_Project ph, int ruleIndex, int actionIndex, int *out_linkIndex, int *out_status, double *out_setting) |
Gets the properties of an ELSE action in a rule-based control. More... | |
int | EN_setelseaction (EN_Project ph, int ruleIndex, int actionIndex, int linkIndex, int status, double setting) |
Sets the properties of an ELSE action in a rule-based control. More... | |
int | EN_setrulepriority (EN_Project ph, int index, double priority) |
Sets the priority of a rule-based control. More... | |
These functions are used for working with rule-based controls.
int EN_addrule | ( | EN_Project | ph, |
char * | rule | ||
) |
Adds a new rule-based control to a project.
ph | an EPANET project handle. |
rule | text of the rule following the format used in an EPANET input file. |
Consult the [RULES] section of the Input File topic to learn about a rule's format. Each clause of the rule must end with a newline character \n
.
int EN_deleterule | ( | EN_Project | ph, |
int | index | ||
) |
Deletes an existing rule-based control.
ph | an EPANET project handle. |
index | the index of the rule to be deleted (starting from 1). |
int EN_getelseaction | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | actionIndex, | ||
int * | out_linkIndex, | ||
int * | out_status, | ||
double * | out_setting | ||
) |
Gets the properties of an ELSE action in a rule-based control.
ph | an EPANET project handle. | |
ruleIndex | the rule's index (starting from 1). | |
actionIndex | the index of the ELSE action to retrieve (starting from 1). | |
[out] | linkIndex | the index of the link in the action. |
[out] | status | the status assigned to the link (see EN_RuleStatus). |
[out] | setting | the value assigned to the link's setting. |
int EN_getpremise | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | premiseIndex, | ||
int * | out_logop, | ||
int * | out_object, | ||
int * | out_objIndex, | ||
int * | out_variable, | ||
int * | out_relop, | ||
int * | out_status, | ||
double * | out_value | ||
) |
Gets the properties of a premise in a rule-based control.
ph | an EPANET project handle. | |
ruleIndex | the rule's index (starting from 1). | |
premiseIndex | the position of the premise in the rule's list of premises (starting from 1). | |
[out] | logop | the premise's logical operator ( IF = 1, AND = 2, OR = 3 ). |
[out] | object | the type of object the premise refers to (see EN_RuleObject). |
[out] | objIndex | the index of the object (e.g. the index of a tank). |
[out] | variable | the object's variable being compared (see EN_RuleVariable). |
[out] | relop | the premise's comparison operator (see EN_RuleOperator). |
[out] | status | the status that the object's status is compared to (see EN_RuleStatus). |
[out] | value | the value that the object's variable is compared to. |
int EN_getrule | ( | EN_Project | ph, |
int | index, | ||
int * | out_nPremises, | ||
int * | out_nThenActions, | ||
int * | out_nElseActions, | ||
double * | out_priority | ||
) |
Retrieves summary information about a rule-based control.
ph | an EPANET project handle. | |
index | the rule's index (starting from 1). | |
[out] | nPremises | number of premises in the rule's IF section. |
[out] | nThenActions | number of actions in the rule's THEN section. |
[out] | nElseActions | number of actions in the rule's ELSE section. |
[out] | priority | the rule's priority value. |
int EN_getruleID | ( | EN_Project | ph, |
int | index, | ||
char * | out_id | ||
) |
Gets the ID name of a rule-based control given its index.
ph | an EPANET project handle. | |
index | the rule's index (starting from 1). | |
[out] | out_id | the rule's ID name. |
The ID name must be sized to hold at least EN_MAXID characters.
int EN_getthenaction | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | actionIndex, | ||
int * | out_linkIndex, | ||
int * | out_status, | ||
double * | out_setting | ||
) |
Gets the properties of a THEN action in a rule-based control.
ph | an EPANET project handle. | |
ruleIndex | the rule's index (starting from 1). | |
actionIndex | the index of the THEN action to retrieve (starting from 1). | |
[out] | linkIndex | the index of the link in the action (starting from 1). |
[out] | status | the status assigned to the link (see EN_RuleStatus) |
[out] | setting | the value assigned to the link's setting. |
int EN_setelseaction | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | actionIndex, | ||
int | linkIndex, | ||
int | status, | ||
double | setting | ||
) |
Sets the properties of an ELSE action in a rule-based control.
ph | an EPANET project handle. |
ruleIndex | the rule's index (starting from 1). |
actionIndex | the index of the ELSE action being modified (starting from 1). |
linkIndex | the index of the link in the action (starting from 1). |
status | the new status assigned to the link (see EN_RuleStatus) |
setting | the new value assigned to the link's setting. |
int EN_setpremise | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | premiseIndex, | ||
int | logop, | ||
int | object, | ||
int | objIndex, | ||
int | variable, | ||
int | relop, | ||
int | status, | ||
double | value | ||
) |
Sets the properties of a premise in a rule-based control.
ph | an EPANET project handle. |
ruleIndex | the rule's index (starting from 1). |
premiseIndex | the position of the premise in the rule's list of premises. |
logop | the premise's logical operator ( IF = 1, AND = 2, OR = 3 ). |
object | the type of object the premise refers to (see EN_RuleObject). |
objIndex | the index of the object (e.g. the index of a tank). |
variable | the object's variable being compared (see EN_RuleVariable). |
relop | the premise's comparison operator (see EN_RuleOperator). |
status | the status that the object's status is compared to (see EN_RuleStatus). |
value | the value that the object's variable is compared to. |
int EN_setpremiseindex | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | premiseIndex, | ||
int | objIndex | ||
) |
Sets the index of an object in a premise of a rule-based control.
ph | an EPANET project handle. |
ruleIndex | the rule's index (starting from 1). |
premiseIndex | the premise's index (starting from 1). |
objIndex | the index of the premise's object (e.g. the index of a tank). |
int EN_setpremisestatus | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | premiseIndex, | ||
int | status | ||
) |
Sets the status being compared to in a premise of a rule-based control.
ph | an EPANET project handle. |
ruleIndex | the rule's index (starting from 1). |
premiseIndex | the premise's index (starting from 1). |
status | the status that the premise's object status is compared to (see EN_RuleStatus). |
int EN_setpremisevalue | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | premiseIndex, | ||
double | value | ||
) |
Sets the value in a premise of a rule-based control.
ph | an EPANET project handle. |
ruleIndex | the rule's index (staring from 1). |
premiseIndex | the premise's index (starting from 1). |
value | The value that the premise's variable is compared to. |
int EN_setrulepriority | ( | EN_Project | ph, |
int | index, | ||
double | priority | ||
) |
Sets the priority of a rule-based control.
ph | an EPANET project handle. |
index | the rule's index (starting from 1). |
priority | the priority value assigned to the rule. |
int EN_setthenaction | ( | EN_Project | ph, |
int | ruleIndex, | ||
int | actionIndex, | ||
int | linkIndex, | ||
int | status, | ||
double | setting | ||
) |
Sets the properties of a THEN action in a rule-based control.
ph | an EPANET project handle. |
ruleIndex | the rule's index (starting from 1). |
actionIndex | the index of the THEN action to modify (starting from 1). |
linkIndex | the index of the link in the action. |
status | the new status assigned to the link (see EN_RuleStatus). |
setting | the new value assigned to the link's setting. |