OWA-EPANET Toolkit  2.2
Data Curve Functions

These functions are used for working with data curves. More...

Functions

int EN_addcurve (EN_Project ph, char *id)
 Adds a new data curve to a project. More...
 
int EN_deletecurve (EN_Project ph, int index)
 Deletes a data curve from a project. More...
 
int EN_getcurveindex (EN_Project ph, char *id, int *index)
 Retrieves the index of a curve given its ID name. More...
 
int EN_getcurveid (EN_Project ph, int index, char *out_id)
 Retrieves the ID name of a curve given its index. More...
 
int EN_setcurveid (EN_Project ph, int index, char *id)
 Changes the ID name of a data curve given its index. More...
 
int EN_getcurvelen (EN_Project ph, int index, int *len)
 Retrieves the number of points in a curve. More...
 
int EN_getcurvetype (EN_Project ph, int index, int *type)
 Retrieves a curve's type. More...
 
int EN_getcurvevalue (EN_Project ph, int curveIndex, int pointIndex, double *x, double *y)
 Retrieves the value of a single data point for a curve. More...
 
int EN_setcurvevalue (EN_Project ph, int curveIndex, int pointIndex, double x, double y)
 Sets the value of a single data point for a curve. More...
 
int EN_setcurve (EN_Project ph, int index, double *xValues, double *yValues, int nPoints)
 assigns a set of data points to a curve. More...
 

Overview

These functions are used for working with data curves.

Function Documentation

◆ EN_addcurve()

int EN_addcurve ( EN_Project  ph,
char *  id 
)

Adds a new data curve to a project.

Parameters
phan EPANET project handle.
idThe ID name of the curve to be added.
Returns
an error code.

The new curve contains a single data point (1.0, 1.0).

◆ EN_deletecurve()

int EN_deletecurve ( EN_Project  ph,
int  index 
)

Deletes a data curve from a project.

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

◆ EN_getcurveid()

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

Retrieves the ID name of a curve given its index.

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

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

◆ EN_getcurveindex()

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

Retrieves the index of a curve given its ID name.

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

◆ EN_getcurvelen()

int EN_getcurvelen ( EN_Project  ph,
int  index,
int *  len 
)

Retrieves the number of points in a curve.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
[out]lenThe number of data points assigned to the curve.
Returns
an error code.

◆ EN_getcurvetype()

int EN_getcurvetype ( EN_Project  ph,
int  index,
int *  type 
)

Retrieves a curve's type.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
[out]typethe curve's type (see EN_CurveType).
Returns
an error code.

◆ EN_getcurvevalue()

int EN_getcurvevalue ( EN_Project  ph,
int  curveIndex,
int  pointIndex,
double *  x,
double *  y 
)

Retrieves the value of a single data point for a curve.

Parameters
phan EPANET project handle.
curveIndexa curve's index (starting from 1).
pointIndexthe index of a point on the curve (starting from 1).
[out]xthe point's x-value.
[out]ythe point's y-value.
Returns
an error code.

◆ EN_setcurve()

int EN_setcurve ( EN_Project  ph,
int  index,
double *  xValues,
double *  yValues,
int  nPoints 
)

assigns a set of data points to a curve.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
xValuesan array of new x-values for the curve.
yValuesan array of new y-values for the curve.
nPointsthe new number of data points for the curve.
Returns
an error code.

xValues and yValues are zero-based arrays that contains nPoints elements.

Use this function to redefine (and resize) a curve all at once; use EN_setcurvevalue to revise a curve's data points one at a time.

◆ EN_setcurveid()

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

Changes the ID name of a data curve given its index.

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

The new ID name must not exceed EN_MAXID characters.

◆ EN_setcurvevalue()

int EN_setcurvevalue ( EN_Project  ph,
int  curveIndex,
int  pointIndex,
double  x,
double  y 
)

Sets the value of a single data point for a curve.

Parameters
phan EPANET project handle.
curveIndexa curve's index (starting from 1).
pointIndexthe index of a point on the curve (starting from 1).
xthe point's new x-value.
ythe point's new y-value.
Returns
an error code.