EPANET
Functions
Time Pattern Functions

These functions are used for working with time patterns. More...

Functions

int DLLEXPORT EN_deletepattern (EN_Project ph, int index)
 Deletes a time pattern from a project. More...
 
int DLLEXPORT EN_getpatternid (EN_Project ph, int index, char *out_id)
 Retrieves the ID name of a time pattern given its index. More...
 
int DLLEXPORT EN_getpatternlen (EN_Project ph, int index, int *out_len)
 Retrieves the number of time periods in a time pattern. More...
 
int DLLEXPORT EN_getpatternvalue (EN_Project ph, int index, int period, double *out_value)
 Retrieves a time pattern's factor for a given time period. More...
 
int DLLEXPORT EN_setpatternvalue (EN_Project ph, int index, int period, double value)
 Sets a time pattern's factor for a given time period. More...
 
int DLLEXPORT EN_getaveragepatternvalue (EN_Project ph, int index, double *out_value)
 Retrieves the average of all pattern factors in a time pattern. More...
 
int DLLEXPORT EN_setpattern (EN_Project ph, int index, double *values, int len)
 Sets the pattern factors for a given time pattern. More...
 

Detailed Description

These functions are used for working with time patterns.

Function Documentation

◆ EN_deletepattern()

int EN_deletepattern ( EN_Project  ph,
int  index 
)

Deletes a time pattern from a project.

Parameters
phan EPANET project handle.
indexthe time pattern's index (starting from 1).
Returns
an error code.

◆ EN_getaveragepatternvalue()

int EN_getaveragepatternvalue ( EN_Project  ph,
int  index,
double *  out_value 
)

Retrieves the average of all pattern factors in a time pattern.

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
[out]valueThe average of all of the time pattern's factors.
Returns
an error code.

◆ EN_getpatternid()

int EN_getpatternid ( EN_Project  ph,
int  index,
char *  out_id 
)

Retrieves the ID name of a time pattern given its index.

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
[out]out_idthe time pattern's ID name.
Returns
an error code.

The ID name must be sized to hold at least EN_MAXID+1 characters.

◆ EN_getpatternlen()

int EN_getpatternlen ( EN_Project  ph,
int  index,
int *  out_len 
)

Retrieves the number of time periods in a time pattern.

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
[out]lenthe number of time periods in the pattern.
Returns
an error code.

◆ EN_getpatternvalue()

int EN_getpatternvalue ( EN_Project  ph,
int  index,
int  period,
double *  out_value 
)

Retrieves a time pattern's factor for a given time period.

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
perioda time period in the pattern (starting from 1).
[out]valuethe pattern factor for the given time period.
Returns
an error code.

◆ EN_setpattern()

int EN_setpattern ( EN_Project  ph,
int  index,
double *  values,
int  len 
)

Sets the pattern factors for a given time pattern.

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
valuesan array of new pattern factor values.
lenthe number of factor values supplied.
Returns
an error code.

values is a zero-based array that contains len elements.

Use this function to redefine (and resize) a time pattern all at once; use EN_setpatternvalue to revise pattern factors one at a time.

◆ EN_setpatternvalue()

int EN_setpatternvalue ( EN_Project  ph,
int  index,
int  period,
double  value 
)

Sets a time pattern's factor for a given time period.

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
perioda time period in the pattern (starting from 1).
valuethe new value of the pattern factor for the given time period.
Returns
an error code.