EPANET
|
These functions are used for working with network links. More...
Functions | |
int DLLEXPORT | EN_deletelink (EN_Project ph, int index, int actionCode) |
Deletes a link from the project. More... | |
int DLLEXPORT | EN_getlinkindex (EN_Project ph, const char *id, int *out_index) |
Gets the index of a link given its ID name. More... | |
int DLLEXPORT | EN_getlinkid (EN_Project ph, int index, char *out_id) |
Gets the ID name of a link given its index. More... | |
int DLLEXPORT | EN_setlinkid (EN_Project ph, int index, const char *newid) |
Changes the ID name of a link. More... | |
int DLLEXPORT | EN_getlinktype (EN_Project ph, int index, int *out_linkType) |
Retrieves a link's type. More... | |
int DLLEXPORT | EN_setlinktype (EN_Project ph, int *inout_index, int linkType, int actionCode) |
Changes a link's type. More... | |
int DLLEXPORT | 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 DLLEXPORT | EN_setlinknodes (EN_Project ph, int index, int node1, int node2) |
Sets the indexes of a link's start- and end-nodes. More... | |
int DLLEXPORT | EN_getlinkvalue (EN_Project ph, int index, int property, double *out_value) |
Retrieves a property value for a link. More... | |
int DLLEXPORT | EN_getlinkvalues (EN_Project ph, int property, double *out_values) |
Retrieves an array of property values for all links. More... | |
int DLLEXPORT | EN_setlinkvalue (EN_Project ph, int index, int property, double value) |
Sets a property value for a link. More... | |
int DLLEXPORT | 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 DLLEXPORT | EN_getpumptype (EN_Project ph, int linkIndex, int *out_pumpType) |
Retrieves the type of head curve used by a pump. More... | |
int DLLEXPORT | EN_getheadcurveindex (EN_Project ph, int linkIndex, int *out_curveIndex) |
Retrieves the curve assigned to a pump's head curve. More... | |
int DLLEXPORT | EN_setheadcurveindex (EN_Project ph, int linkIndex, int curveIndex) |
Assigns a curve to a pump's head curve. More... | |
int DLLEXPORT | EN_getvertexcount (EN_Project ph, int index, int *out_count) |
Retrieves the number of internal vertex points assigned to a link. More... | |
int DLLEXPORT | 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 DLLEXPORT | 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 DLLEXPORT | 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_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] | 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+1 characters.
int EN_getlinkindex | ( | EN_Project | ph, |
const 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] | 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] | out_node1 | the index of the link's start node (starting from 1). |
[out] | 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] | 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] | 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_getlinkvalues | ( | EN_Project | ph, |
int | property, | ||
double * | out_values | ||
) |
Retrieves an array of property values for all links.
ph | an EPANET project handle. | |
property | the property to retrieve (see EN_LinkProperty). | |
[out] | out_values | an array of values for all links. |
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] | 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] | out_x | the vertex's X-coordinate value. |
[out] | 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] | 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, | ||
const 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.
To only change a valve's type (such as from PRV to PSV) use EN_setlinkvalue with property EN_VALVE_TYPE
whose value is selected from the valves in EN_LinkType.
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.