These functions are used for managing nodal demands. More...
Functions | |
int | EN_getdemandmodel (EN_Project ph, int *out_type, double *out_pmin, double *out_preq, double *out_pexp) |
Retrieves the type of demand model in use and its parameters. More... | |
int | EN_setdemandmodel (EN_Project ph, int type, double pmin, double preq, double pexp) |
Sets the type of demand model to use and its parameters. More... | |
int | EN_adddemand (EN_Project ph, int nodeIndex, double baseDemand, char *demandPattern, char *demandName) |
appends a new demand to a junction node demands list. More... | |
int | EN_deletedemand (EN_Project ph, int nodeIndex, int demandIndex) |
deletes a demand from a junction node. More... | |
int | EN_getdemandindex (EN_Project ph, int nodeIndex, char *demandName, int *out_demandIndex) |
Retrieves the index of a node's named demand category. More... | |
int | EN_getnumdemands (EN_Project ph, int nodeIndex, int *out_numDemands) |
Retrieves the number of demand categories for a junction node. More... | |
int | EN_getbasedemand (EN_Project ph, int nodeIndex, int demandIndex, double *out_baseDemand) |
Gets the base demand for one of a node's demand categories. More... | |
int | EN_setbasedemand (EN_Project ph, int nodeIndex, int demandIndex, double baseDemand) |
Sets the base demand for one of a node's demand categories. More... | |
int | EN_getdemandpattern (EN_Project ph, int nodeIndex, int demandIndex, int *out_patIndex) |
Retrieves the index of a time pattern assigned to one of a node's demand categories. More... | |
int | EN_setdemandpattern (EN_Project ph, int nodeIndex, int demandIndex, int patIndex) |
Sets the index of a time pattern used for one of a node's demand categories. More... | |
int | EN_getdemandname (EN_Project ph, int nodeIndex, int demandIndex, char *out_demandName) |
Retrieves the name of a node's demand category. More... | |
int | EN_setdemandname (EN_Project ph, int nodeIndex, int demandIdx, char *demandName) |
Assigns a name to a node's demand category. More... | |
These functions are used for managing nodal demands.
int EN_adddemand | ( | EN_Project | ph, |
int | nodeIndex, | ||
double | baseDemand, | ||
char * | demandPattern, | ||
char * | demandName | ||
) |
appends a new demand to a junction node demands list.
ph | an EPANET project handle. |
nodeIndex | the index of a node (starting from 1). |
baseDemand | the demand's base value. |
demandPattern | the name of a time pattern used by the demand |
demandName | the name of the demand's category |
A NULL or blank string can be used for demandPattern
and for demandName
to indicate that no time pattern or category name is associated with the demand.
int EN_deletedemand | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIndex | ||
) |
deletes a demand from a junction node.
ph | an EPANET project handle. |
nodeIndex | the index of a node (starting from 1). |
demandIndex | the position of the demand in the node's demands list (starting from 1). |
int EN_getbasedemand | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIndex, | ||
double * | out_baseDemand | ||
) |
Gets the base demand for one of a node's demand categories.
ph | an EPANET project handle. | |
nodeIndex | a node's index (starting from 1). | |
demandIndex | the index of a demand category for the node (starting from 1). | |
[out] | baseDemand | the category's base demand. |
int EN_getdemandindex | ( | EN_Project | ph, |
int | nodeIndex, | ||
char * | demandName, | ||
int * | out_demandIndex | ||
) |
Retrieves the index of a node's named demand category.
ph | an EPANET project handle. | |
nodeIndex | the index of a node (starting from 1) | |
demandName | the name of a demand category for the node | |
[out] | demandIndex | the index of the demand being sought |
int EN_getdemandmodel | ( | EN_Project | ph, |
int * | out_type, | ||
double * | out_pmin, | ||
double * | out_preq, | ||
double * | out_pexp | ||
) |
Retrieves the type of demand model in use and its parameters.
ph | an EPANET project handle. | |
[out] | type | Type of demand model (see EN_DemandModel). |
[out] | pmin | Pressure below which there is no demand. |
[out] | preq | Pressure required to deliver full demand. |
[out] | pexp | Pressure exponent in demand function. |
Parameters pmin, preq, and pexp are only used when the demand model is EN_PDA.
int EN_getdemandname | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIndex, | ||
char * | out_demandName | ||
) |
Retrieves the name of a node's demand category.
ph | an EPANET project handle. | |
nodeIndex | a node's index (starting from 1). | |
demandIndex | the index of one of the node's demand categories (starting from 1). | |
[out] | out_demandName | The name of the selected category. |
demandName must be sized to contain at least EN_MAXID characters.
int EN_getdemandpattern | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIndex, | ||
int * | out_patIndex | ||
) |
Retrieves the index of a time pattern assigned to one of a node's demand categories.
ph | an EPANET project handle. | |
nodeIndex | the node's index (starting from 1). | |
demandIndex | the index of a demand category for the node (starting from 1). | |
[out] | patIndex | the index of the category's time pattern. |
A returned pattern index of 0 indicates that no time pattern has been assigned to the demand category.
int EN_getnumdemands | ( | EN_Project | ph, |
int | nodeIndex, | ||
int * | out_numDemands | ||
) |
Retrieves the number of demand categories for a junction node.
ph | an EPANET project handle. | |
nodeIndex | the index of a node (starting from 1). | |
[out] | numDemands | the number of demand categories assigned to the node. |
int EN_setbasedemand | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIndex, | ||
double | baseDemand | ||
) |
Sets the base demand for one of a node's demand categories.
ph | an EPANET project handle. |
nodeIndex | a node's index (starting from 1). |
demandIndex | the index of a demand category for the node (starting from 1). |
baseDemand | the new base demand for the category. |
int EN_setdemandmodel | ( | EN_Project | ph, |
int | type, | ||
double | pmin, | ||
double | preq, | ||
double | pexp | ||
) |
Sets the type of demand model to use and its parameters.
ph | an EPANET project handle. |
type | Type of demand model (see EN_DemandModel). |
pmin | Pressure below which there is no demand. |
preq | Pressure required to deliver full demand. |
pexp | Pressure exponent in demand function. |
Set type to EN_DDA for a traditional demand driven analysis (in which case the remaining three parameter values are ignored) or to EN_PDA for a pressure driven analysis. In the latter case a node's demand is computed as:
Dfull * [ (P - pmin) / (preq - pmin) ] ^ pexp
where Dfull
is the full demand and P
is the current pressure.
Setting preq equal to pmin will result in a solution with the smallest amount of demand reductions needed to insure that no node delivers positive demand at a pressure below pmin.
int EN_setdemandname | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIdx, | ||
char * | demandName | ||
) |
Assigns a name to a node's demand category.
ph | an EPANET project handle. |
nodeIndex | a node's index (starting from 1). |
demandIdx | the index of one of the node's demand categories (starting from 1). |
demandName | the new name assigned to the category. |
The category name must contain no more than EN_MAXID characters.
int EN_setdemandpattern | ( | EN_Project | ph, |
int | nodeIndex, | ||
int | demandIndex, | ||
int | patIndex | ||
) |
Sets the index of a time pattern used for one of a node's demand categories.
ph | an EPANET project handle. |
nodeIndex | a node's index (starting from 1). |
demandIndex | the index of one of the node's demand categories (starting from 1). |
patIndex | the index of the time pattern assigned to the category. |
Specifying a pattern index of 0 indicates that no time pattern is assigned to the demand category.