OWA-EPANET Toolkit  2.2
Time Pattern Functions

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

Functions

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

Overview

These functions are used for working with time patterns.

Function Documentation

◆ EN_addpattern()

int EN_addpattern ( EN_Project  ph,
char *  id 
)

Adds a new time pattern to a project.

Parameters
phan EPANET project handle.
idthe ID name of the pattern to add.
Returns
an error code.

The new pattern contains a single time period whose factor is 1.0.

◆ 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 *  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 characters.

◆ EN_getpatternindex()

int EN_getpatternindex ( EN_Project  ph,
char *  id,
int *  index 
)

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

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

◆ EN_getpatternlen()

int EN_getpatternlen ( EN_Project  ph,
int  index,
int *  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 *  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_setpatternid()

int EN_setpatternid ( EN_Project  ph,
int  index,
char *  id 
)

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

Parameters
phan EPANET project handle.
indexa time pattern index (starting from 1).
idthe time pattern's new ID name.
Returns
an error code.

The new ID name must not exceed EN_MAXID characters.

◆ 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.