These functions are used for working with network links. More...
Functions | |
int | EN_addlink (EN_Project ph, char *id, int linkType, char *fromNode, char *toNode, int *out_index) |
Adds a new link to a project. More... | |
int | EN_deletelink (EN_Project ph, int index, int actionCode) |
Deletes a link from the project. More... | |
int | EN_getlinkindex (EN_Project ph, char *id, int *out_index) |
Gets the index of a link given its ID name. More... | |
int | EN_getlinkid (EN_Project ph, int index, char *out_id) |
Gets the ID name of a link given its index. More... | |
int | EN_setlinkid (EN_Project ph, int index, char *newid) |
Changes the ID name of a link. More... | |
int | EN_getlinktype (EN_Project ph, int index, int *out_linkType) |
Retrieves a link's type. More... | |
int | EN_setlinktype (EN_Project ph, int *inout_index, int linkType, int actionCode) |
Changes a link's type. More... | |
int | EN_getlinknodes (EN_Project ph, int index, int *out_node1, int *out_node2) |
Gets the indexes of a link's start- and end-nodes. More... | |
int | EN_setlinknodes (EN_Project ph, int index, int node1, int node2) |
Sets the indexes of a link's start- and end-nodes. More... | |
int | EN_getlinkvalue (EN_Project ph, int index, int property, double *out_value) |
Retrieves a property value for a link. More... | |
int | EN_setlinkvalue (EN_Project ph, int index, int property, double value) |
Sets a property value for a link. More... | |
int | EN_setpipedata (EN_Project ph, int index, double length, double diam, double rough, double mloss) |
Sets a group of properties for a pipe link. More... | |
int | EN_getpumptype (EN_Project ph, int linkIndex, int *out_pumpType) |
Retrieves the type of head curve used by a pump. More... | |
int | EN_getheadcurveindex (EN_Project ph, int linkIndex, int *out_curveIndex) |
Retrieves the curve assigned to a pump's head curve. More... | |
int | EN_setheadcurveindex (EN_Project ph, int linkIndex, int curveIndex) |
Assigns a curve to a pump's head curve. More... | |
int | EN_getvertexcount (EN_Project ph, int index, int *out_count) |
Retrieves the number of internal vertex points assigned to a link. More... | |
int | EN_getvertex (EN_Project ph, int index, int vertex, double *out_x, double *out_y) |
Retrieves the coordinates of a vertex point assigned to a link. More... | |
int | EN_setvertex (EN_Project ph, int index, int vertex, double x, double y) |
Sets the coordinates of a vertex point assigned to a link. More... | |
int | EN_setvertices (EN_Project ph, int index, double *x, double *y, int count) |
Assigns a set of internal vertex points to a link. More... | |
These functions are used for working with network links.
int EN_addlink | ( | EN_Project | ph, |
char * | id, | ||
int | linkType, | ||
char * | fromNode, | ||
char * | toNode, | ||
int * | out_index | ||
) |
Adds a new link to a project.
ph | an EPANET project handle. | |
id | the ID name of the link to be added. | |
linkType | The type of link being added (see EN_LinkType) | |
fromNode | The ID name of the link's starting node. | |
toNode | The ID name of the link's ending node. | |
[out] | index | the index of the newly added link. |
A new pipe is assigned a diameter of 10 inches (254 mm) and a length of 330 feet (~ 100 meters). Its roughness coefficient depends on the head loss formula in effect (see EN_HeadLossType) as follows:
All other pipe properties are set to 0.
A new pump has a status of EN_OPEN, a speed setting of 1, and has no pump curve or power rating assigned to it.
A new valve has a diameter of 10 inches (254 mm) and all other properties set to 0.
See EN_LinkProperty.
int EN_deletelink | ( | EN_Project | ph, |
int | index, | ||
int | actionCode | ||
) |
Deletes a link from the project.
ph | an EPANET project handle. |
index | the index of the link to be deleted. |
actionCode | The action taken if any control contains the link. |
If actionCode is EN_UNCONDITIONAL then the link and all simple and rule-based controls that contain it are deleted. If set to EN_CONDITIONAL then the link is not deleted if it appears in any control and error 261 is returned.
int EN_getheadcurveindex | ( | EN_Project | ph, |
int | linkIndex, | ||
int * | out_curveIndex | ||
) |
Retrieves the curve assigned to a pump's head curve.
ph | an EPANET project handle. | |
linkIndex | the index of a pump link (starting from 1). | |
[out] | curveIndex | the index of the curve assigned to the pump's head curve. |
int EN_getlinkid | ( | EN_Project | ph, |
int | index, | ||
char * | out_id | ||
) |
Gets the ID name of a link given its index.
ph | an EPANET project handle. | |
index | a link's index (starting from 1). | |
[out] | out_id | The link's ID name. |
The ID name must be sized to hold at least EN_MAXID characters.
int EN_getlinkindex | ( | EN_Project | ph, |
char * | id, | ||
int * | out_index | ||
) |
Gets the index of a link given its ID name.
ph | an EPANET project handle. | |
id | a link's ID name. | |
[out] | index | the link's index (starting from 1). |
int EN_getlinknodes | ( | EN_Project | ph, |
int | index, | ||
int * | out_node1, | ||
int * | out_node2 | ||
) |
Gets the indexes of a link's start- and end-nodes.
ph | an EPANET project handle. | |
index | a link's index (starting from 1). | |
[out] | node1 | the index of the link's start node (starting from 1). |
[out] | node2 | the index of the link's end node (starting from 1). |
int EN_getlinktype | ( | EN_Project | ph, |
int | index, | ||
int * | out_linkType | ||
) |
Retrieves a link's type.
ph | an EPANET project handle. | |
index | a link's index (starting from 1). | |
[out] | linkType | the link's type (see EN_LinkType). |
int EN_getlinkvalue | ( | EN_Project | ph, |
int | index, | ||
int | property, | ||
double * | out_value | ||
) |
Retrieves a property value for a link.
ph | an EPANET project handle. | |
index | a link's index (starting from 1). | |
property | the property to retrieve (see EN_LinkProperty). | |
[out] | value | the current value of the property. |
Values are returned in units that depend on the units used for flow rate (see Measurement Units).
int EN_getpumptype | ( | EN_Project | ph, |
int | linkIndex, | ||
int * | out_pumpType | ||
) |
Retrieves the type of head curve used by a pump.
ph | an EPANET project handle. | |
linkIndex | the index of a pump link (starting from 1). | |
[out] | pumpType | the type of head curve used by the pump (see EN_PumpType). |
int EN_getvertex | ( | EN_Project | ph, |
int | index, | ||
int | vertex, | ||
double * | out_x, | ||
double * | out_y | ||
) |
Retrieves the coordinates of a vertex point assigned to a link.
ph | an EPANET project handle. | |
index | a link's index (starting from 1). | |
vertex | a vertex point index (starting from 1). | |
[out] | x | the vertex's X-coordinate value. |
[out] | y | the vertex's Y-coordinate value. |
int EN_getvertexcount | ( | EN_Project | ph, |
int | index, | ||
int * | out_count | ||
) |
Retrieves the number of internal vertex points assigned to a link.
ph | an EPANET project handle. | |
index | a link's index (starting from 1). | |
[out] | count | the number of vertex points that describe the link's shape. |
int EN_setheadcurveindex | ( | EN_Project | ph, |
int | linkIndex, | ||
int | curveIndex | ||
) |
Assigns a curve to a pump's head curve.
ph | an EPANET project handle. |
linkIndex | the index of a pump link (starting from 1). |
curveIndex | the index of a curve to be assigned as the pump's head curve. |
int EN_setlinkid | ( | EN_Project | ph, |
int | index, | ||
char * | newid | ||
) |
Changes the ID name of a link.
ph | an EPANET project handle. |
index | a link's index (starting from 1). |
newid | the new ID name for the link. |
The ID name must not be longer than EN_MAXID characters.
int EN_setlinknodes | ( | EN_Project | ph, |
int | index, | ||
int | node1, | ||
int | node2 | ||
) |
Sets the indexes of a link's start- and end-nodes.
ph | an EPANET project handle. |
index | a link's index (starting from 1). |
node1 | The index of the link's start node (starting from 1). |
node2 | The index of the link's end node (starting from 1). |
int EN_setlinktype | ( | EN_Project | ph, |
int * | inout_index, | ||
int | linkType, | ||
int | actionCode | ||
) |
Changes a link's type.
ph | an EPANET project handle. | |
[in,out] | inout_index | the link's index before [in] and after [out] the type change. |
linkType | the new type to change the link to (see EN_LinkType). | |
actionCode | the action taken if any controls contain the link. |
If actionCode is EN_UNCONDITIONAL then all simple and rule-based controls that contain the link are deleted when the link's type is changed. If set to EN_CONDITIONAL then the type change is cancelled if the link appears in any control and error 261 is returned.
int EN_setlinkvalue | ( | EN_Project | ph, |
int | index, | ||
int | property, | ||
double | value | ||
) |
Sets a property value for a link.
ph | an EPANET project handle. |
index | a link's index. |
property | the property to set (see EN_LinkProperty). |
value | the new value for the property. |
Values are in units that depend on the units used for flow rate (see Measurement Units).
int EN_setpipedata | ( | EN_Project | ph, |
int | index, | ||
double | length, | ||
double | diam, | ||
double | rough, | ||
double | mloss | ||
) |
Sets a group of properties for a pipe link.
ph | an EPANET project handle. |
index | the index of a pipe link (starting from 1). |
length | the pipe's length. |
diam | the pipe's diameter. |
rough | the pipe's roughness coefficient. |
mloss | the pipe's minor loss coefficient. |
These properties have units that depend on the units used for flow rate (see Measurement Units).
int EN_setvertex | ( | EN_Project | ph, |
int | index, | ||
int | vertex, | ||
double | x, | ||
double | y | ||
) |
Sets the coordinates of a vertex point assigned to a link.
ph | an EPANET project handle. |
index | a link's index (starting from 1). |
vertex | a vertex point index (starting from 1). |
x | the vertex's X-coordinate value. |
y | the vertex's Y-coordinate value. |
int EN_setvertices | ( | EN_Project | ph, |
int | index, | ||
double * | x, | ||
double * | y, | ||
int | count | ||
) |
Assigns a set of internal vertex points to a link.
ph | an EPANET project handle. |
index | a link's index (starting from 1). |
x | an array of X-coordinates for the vertex points. |
y | an array of Y-coordinates for the vertex points. |
count | the number of vertex points being assigned. |
Replaces any existing vertices previously assigned to the link.