OWA-EPANET Toolkit 2.3
Loading...
Searching...
No Matches
Nodal Demand Functions

Functions

int DLLEXPORT 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.
 
int DLLEXPORT EN_setdemandmodel (EN_Project ph, int type, double pmin, double preq, double pexp)
 Sets the type of demand model to use and its parameters.
 
int DLLEXPORT EN_adddemand (EN_Project ph, int nodeIndex, double baseDemand, const char *demandPattern, const char *demandName)
 appends a new demand to a junction node demands list.
 
int DLLEXPORT EN_deletedemand (EN_Project ph, int nodeIndex, int demandIndex)
 deletes a demand from a junction node.
 
int DLLEXPORT EN_getdemandindex (EN_Project ph, int nodeIndex, const char *demandName, int *out_demandIndex)
 Retrieves the index of a node's named demand category.
 
int DLLEXPORT EN_getnumdemands (EN_Project ph, int nodeIndex, int *out_numDemands)
 Retrieves the number of demand categories for a junction node.
 
int DLLEXPORT EN_getbasedemand (EN_Project ph, int nodeIndex, int demandIndex, double *out_baseDemand)
 Gets the base demand for one of a node's demand categories.
 
int DLLEXPORT EN_setbasedemand (EN_Project ph, int nodeIndex, int demandIndex, double baseDemand)
 Sets the base demand for one of a node's demand categories.
 
int DLLEXPORT 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.
 
int DLLEXPORT 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.
 
int DLLEXPORT EN_getdemandname (EN_Project ph, int nodeIndex, int demandIndex, char *out_demandName)
 Retrieves the name of a node's demand category.
 
int DLLEXPORT EN_setdemandname (EN_Project ph, int nodeIndex, int demandIdx, const char *demandName)
 Assigns a name to a node's demand category.
 

Overview

These functions are used for managing nodal demands.

Function Documentation

◆ EN_adddemand()

int DLLEXPORT EN_adddemand ( EN_Project ph,
int nodeIndex,
double baseDemand,
const char * demandPattern,
const char * demandName )

appends a new demand to a junction node demands list.

Parameters
phan EPANET project handle.
nodeIndexthe index of a node (starting from 1).
baseDemandthe demand's base value.
demandPatternthe name of a time pattern used by the demand
demandNamethe name of the demand's category
Returns
an error code.

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.

◆ EN_deletedemand()

int DLLEXPORT EN_deletedemand ( EN_Project ph,
int nodeIndex,
int demandIndex )

deletes a demand from a junction node.

Parameters
phan EPANET project handle.
nodeIndexthe index of a node (starting from 1).
demandIndexthe position of the demand in the node's demands list (starting from 1).
Returns
an error code.

◆ EN_getbasedemand()

int DLLEXPORT EN_getbasedemand ( EN_Project ph,
int nodeIndex,
int demandIndex,
double * out_baseDemand )

Gets the base demand for one of a node's demand categories.

Parameters
phan EPANET project handle.
nodeIndexa node's index (starting from 1).
demandIndexthe index of a demand category for the node (starting from 1).
[out]out_baseDemandthe category's base demand.
Returns
an error code.

◆ EN_getdemandindex()

int DLLEXPORT EN_getdemandindex ( EN_Project ph,
int nodeIndex,
const char * demandName,
int * out_demandIndex )

Retrieves the index of a node's named demand category.

Parameters
phan EPANET project handle.
nodeIndexthe index of a node (starting from 1)
demandNamethe name of a demand category for the node
[out]out_demandIndexthe index of the demand being sought
Returns
an error code

◆ EN_getdemandmodel()

int DLLEXPORT 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.

Parameters
phan EPANET project handle.
[out]out_typeType of demand model (see EN_DemandModel).
[out]out_pminPressure below which there is no demand.
[out]out_preqPressure required to deliver full demand.
[out]out_pexpPressure exponent in demand function.
Returns
an error code.

Parameters out_pmin, out_preq, and out_pexp are only used when the demand model is EN_PDA.

◆ EN_getdemandname()

int DLLEXPORT EN_getdemandname ( EN_Project ph,
int nodeIndex,
int demandIndex,
char * out_demandName )

Retrieves the name of a node's demand category.

Parameters
phan EPANET project handle.
nodeIndexa node's index (starting from 1).
demandIndexthe index of one of the node's demand categories (starting from 1).
[out]out_demandNameThe name of the selected category.
Returns
an error code.

out_demandName must be sized to contain at least EN_MAXID+1 characters.

◆ EN_getdemandpattern()

int DLLEXPORT 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.

Parameters
phan EPANET project handle.
nodeIndexthe node's index (starting from 1).
demandIndexthe index of a demand category for the node (starting from 1).
[out]out_patIndexthe index of the category's time pattern.
Returns
an error code.

A returned pattern index of 0 indicates that no time pattern has been assigned to the demand category.

◆ EN_getnumdemands()

int DLLEXPORT EN_getnumdemands ( EN_Project ph,
int nodeIndex,
int * out_numDemands )

Retrieves the number of demand categories for a junction node.

Parameters
phan EPANET project handle.
nodeIndexthe index of a node (starting from 1).
[out]out_numDemandsthe number of demand categories assigned to the node.
Returns
an error code.

◆ EN_setbasedemand()

int DLLEXPORT EN_setbasedemand ( EN_Project ph,
int nodeIndex,
int demandIndex,
double baseDemand )

Sets the base demand for one of a node's demand categories.

Parameters
phan EPANET project handle.
nodeIndexa node's index (starting from 1).
demandIndexthe index of a demand category for the node (starting from 1).
baseDemandthe new base demand for the category.
Returns
an error code.

◆ EN_setdemandmodel()

int DLLEXPORT EN_setdemandmodel ( EN_Project ph,
int type,
double pmin,
double preq,
double pexp )

Sets the type of demand model to use and its parameters.

Parameters
phan EPANET project handle.
typeType of demand model (see EN_DemandModel).
pminPressure below which there is no demand.
preqPressure required to deliver full demand.
pexpPressure exponent in demand function.
Returns
an error code.

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 0 when pressure is below pmin, is at full demand when pressure is above preq, or is otherwise computed as:
Dfull * [ (P - pmin) / (preq - pmin) ] ^ pexp
where Dfull is the full demand and P is the current pressure.

A valid value for preq must be at least 0.1 pressure units larger than pmin.

◆ EN_setdemandname()

int DLLEXPORT EN_setdemandname ( EN_Project ph,
int nodeIndex,
int demandIdx,
const char * demandName )

Assigns a name to a node's demand category.

Parameters
phan EPANET project handle.
nodeIndexa node's index (starting from 1).
demandIdxthe index of one of the node's demand categories (starting from 1).
demandNamethe new name assigned to the category.
Returns
an error code.

The category name must contain no more than EN_MAXID characters.

◆ EN_setdemandpattern()

int DLLEXPORT 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.

Parameters
phan EPANET project handle.
nodeIndexa node's index (starting from 1).
demandIndexthe index of one of the node's demand categories (starting from 1).
patIndexthe index of the time pattern assigned to the category.
Returns
an error code.

Specifying a pattern index of 0 indicates that no time pattern is assigned to the demand category.