These functions are used for working with time patterns.
More...
|
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 *out_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 *out_len) |
| Retrieves the number of time periods in a time pattern. More...
|
|
int | 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 | 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 *out_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...
|
|
These functions are used for working with time patterns.
◆ EN_addpattern()
Adds a new time pattern to a project.
- Parameters
-
ph | an EPANET project handle. |
id | the 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()
Deletes a time pattern from a project.
- Parameters
-
ph | an EPANET project handle. |
index | the 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
-
| ph | an EPANET project handle. |
| index | a time pattern index (starting from 1). |
[out] | value | The 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
-
| ph | an EPANET project handle. |
| index | a time pattern index (starting from 1). |
[out] | out_id | the 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 * |
out_index |
|
) |
| |
Retrieves the index of a time pattern given its ID name.
- Parameters
-
| ph | an EPANET project handle. |
| id | the ID name of a time pattern. |
[out] | index | the time pattern's index (starting from 1). |
- Returns
- an error code.
◆ EN_getpatternlen()
int EN_getpatternlen |
( |
EN_Project |
ph, |
|
|
int |
index, |
|
|
int * |
out_len |
|
) |
| |
Retrieves the number of time periods in a time pattern.
- Parameters
-
| ph | an EPANET project handle. |
| index | a time pattern index (starting from 1). |
[out] | len | the 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
-
| ph | an EPANET project handle. |
| index | a time pattern index (starting from 1). |
| period | a time period in the pattern (starting from 1). |
[out] | value | the 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
-
ph | an EPANET project handle. |
index | a time pattern index (starting from 1). |
values | an array of new pattern factor values. |
len | the 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
-
ph | an EPANET project handle. |
index | a time pattern index (starting from 1). |
id | the 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
-
ph | an EPANET project handle. |
index | a time pattern index (starting from 1). |
period | a time period in the pattern (starting from 1). |
value | the new value of the pattern factor for the given time period. |
- Returns
- an error code.