OWA-EPANET Toolkit 2.3
Loading...
Searching...
No Matches
Time Pattern Functions

Functions

int DLLEXPORT EN_addpattern (EN_Project ph, const char *id)
 Adds a new time pattern to a project.
 
int DLLEXPORT EN_deletepattern (EN_Project ph, int index)
 Deletes a time pattern from a project.
 
int DLLEXPORT EN_getpatternid (EN_Project ph, int index, char *out_id)
 Retrieves the ID name of a time pattern given its index.
 
int DLLEXPORT EN_setpatternid (EN_Project ph, int index, const char *id)
 Changes the ID name of a time pattern given its index.
 
int DLLEXPORT EN_getpatternlen (EN_Project ph, int index, int *out_len)
 Retrieves the number of time periods in a time pattern.
 
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.
 
int DLLEXPORT EN_setpatternvalue (EN_Project ph, int index, int period, double value)
 Sets a time pattern's factor for a given time period.
 
int DLLEXPORT EN_getaveragepatternvalue (EN_Project ph, int index, double *out_value)
 Retrieves the average of all pattern factors in a time pattern.
 
int DLLEXPORT EN_setpattern (EN_Project ph, int index, double *values, int len)
 Sets the pattern factors for a given time pattern.
 
int DLLEXPORT EN_loadpatternfile (EN_Project ph, const char *filename, const char *id)
 Loads time patterns from a file into a project under a specific pattern ID.
 

Overview

These functions are used for working with time patterns.

Function Documentation

◆ EN_addpattern()

int DLLEXPORT EN_addpattern ( EN_Project ph,
const 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 DLLEXPORT 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 DLLEXPORT 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]out_valueThe average of all of the time pattern's factors.
Returns
an error code.

◆ EN_getpatternid()

int DLLEXPORT 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 DLLEXPORT 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]out_lenthe number of time periods in the pattern.
Returns
an error code.

◆ EN_getpatternvalue()

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.

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

◆ EN_loadpatternfile()

int DLLEXPORT EN_loadpatternfile ( EN_Project ph,
const char * filename,
const char * id )

Loads time patterns from a file into a project under a specific pattern ID.

Parameters
phan EPANET project handle.
filenamethe name of the file containing pattern data.
idthe ID name of the new pattern to load.
Returns
an error code.

◆ EN_setpattern()

int DLLEXPORT 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 DLLEXPORT EN_setpatternid ( EN_Project ph,
int index,
const 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 DLLEXPORT 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.