OWA-EPANET Toolkit  2.2
Network Node Functions

These functions are used for working with network nodes. More...

Functions

int EN_addnode (EN_Project ph, char *id, int nodeType, int *out_index)
 Adds a new node to a project. More...
 
int EN_deletenode (EN_Project ph, int index, int actionCode)
 Deletes a node from a project. More...
 
int EN_getnodeindex (EN_Project ph, char *id, int *out_index)
 Gets the index of a node given its ID name. More...
 
int EN_getnodeid (EN_Project ph, int index, char *out_id)
 Gets the ID name of a node given its index. More...
 
int EN_setnodeid (EN_Project ph, int index, char *newid)
 Changes the ID name of a node. More...
 
int EN_getnodetype (EN_Project ph, int index, int *out_nodeType)
 Retrieves a node's type given its index. More...
 
int EN_getnodevalue (EN_Project ph, int index, int property, double *out_value)
 Retrieves a property value for a node. More...
 
int EN_setnodevalue (EN_Project ph, int index, int property, double value)
 Sets a property value for a node. More...
 
int EN_setjuncdata (EN_Project ph, int index, double elev, double dmnd, char *dmndpat)
 Sets a group of properties for a junction node. More...
 
int EN_settankdata (EN_Project ph, int index, double elev, double initlvl, double minlvl, double maxlvl, double diam, double minvol, char *volcurve)
 Sets a group of properties for a tank node. More...
 
int EN_getcoord (EN_Project ph, int index, double *out_x, double *out_y)
 Gets the (x,y) coordinates of a node. More...
 
int EN_setcoord (EN_Project ph, int index, double x, double y)
 Sets the (x,y) coordinates of a node. More...
 

Overview

These functions are used for working with network nodes.

Function Documentation

◆ EN_addnode()

int EN_addnode ( EN_Project  ph,
char *  id,
int  nodeType,
int *  out_index 
)

Adds a new node to a project.

Parameters
phan EPANET project handle.
idthe ID name of the node to be added.
nodeTypethe type of node being added (see EN_NodeType)
[out]indexthe index of the newly added node
Returns
an error code.

When a new node is created all of its properties (see EN_NodeProperty) are set to 0.

◆ EN_deletenode()

int EN_deletenode ( EN_Project  ph,
int  index,
int  actionCode 
)

Deletes a node from a project.

Parameters
phan EPANET project handle.
indexthe index of the node to be deleted.
actionCodethe action taken if any control contains the node and its links.
Returns
an error code.

If actionCode is EN_UNCONDITIONAL then the node, its incident links and all simple and rule-based controls that contain them are deleted. If set to EN_CONDITIONAL then the node is not deleted if it or its incident links appear in any controls and error code 261 is returned.

◆ EN_getcoord()

int EN_getcoord ( EN_Project  ph,
int  index,
double *  out_x,
double *  out_y 
)

Gets the (x,y) coordinates of a node.

Parameters
phan EPANET project handle.
indexa node index (starting from 1).
[out]xthe node's X-coordinate value.
[out]ythe node's Y-coordinate value.
Returns
an error code.

◆ EN_getnodeid()

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

Gets the ID name of a node given its index.

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

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

◆ EN_getnodeindex()

int EN_getnodeindex ( EN_Project  ph,
char *  id,
int *  out_index 
)

Gets the index of a node given its ID name.

Parameters
phan EPANET project handle.
ida node ID name.
[out]indexthe node's index (starting from 1).
Returns
an error code

◆ EN_getnodetype()

int EN_getnodetype ( EN_Project  ph,
int  index,
int *  out_nodeType 
)

Retrieves a node's type given its index.

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

◆ EN_getnodevalue()

int EN_getnodevalue ( EN_Project  ph,
int  index,
int  property,
double *  out_value 
)

Retrieves a property value for a node.

Parameters
phan EPANET project handle.
indexa node's index.
propertythe property to retrieve (see EN_NodeProperty).
[out]valuethe current value of the property.
Returns
an error code.

Values are returned in units that depend on the units used for flow rate (see Measurement Units).

◆ EN_setcoord()

int EN_setcoord ( EN_Project  ph,
int  index,
double  x,
double  y 
)

Sets the (x,y) coordinates of a node.

Parameters
phan EPANET project handle.
indexa node index (starting from 1).
xthe node's X-coordinate value.
ythe node's Y-coordinate value.
Returns
an error code.

◆ EN_setjuncdata()

int EN_setjuncdata ( EN_Project  ph,
int  index,
double  elev,
double  dmnd,
char *  dmndpat 
)

Sets a group of properties for a junction node.

Parameters
phan EPANET project handle.
indexa junction node's index (starting from 1).
elevthe value of the junction's elevation.
dmndthe value of the junction's primary base demand.
dmndpatthe ID name of the demand's time pattern ("" for no pattern)
Returns
an error code.

These properties have units that depend on the units used for flow rate (see Measurement Units).

◆ EN_setnodeid()

int EN_setnodeid ( EN_Project  ph,
int  index,
char *  newid 
)

Changes the ID name of a node.

Parameters
phan EPANET project handle.
indexa node's index (starting from 1).
newidthe new ID name for the node.
Returns
an error code.

The ID name must not be longer than EN_MAXID characters.

◆ EN_setnodevalue()

int EN_setnodevalue ( EN_Project  ph,
int  index,
int  property,
double  value 
)

Sets a property value for a node.

Parameters
phan EPANET project handle.
indexa node's index (starting from 1).
propertythe property to set (see EN_NodeProperty).
valuethe new value for the property.
Returns
an error code.

Values are in units that depend on the units used for flow rate (see Measurement Units).

◆ EN_settankdata()

int EN_settankdata ( EN_Project  ph,
int  index,
double  elev,
double  initlvl,
double  minlvl,
double  maxlvl,
double  diam,
double  minvol,
char *  volcurve 
)

Sets a group of properties for a tank node.

Parameters
phan EPANET project handle.
indexa tank node's index (starting from 1).
elevthe tank's bottom elevation.
initlvlthe initial water level in the tank.
minlvlthe minimum water level for the tank.
maxlvlthe maximum water level for the tank.
diamthe tank's diameter (0 if a volume curve is supplied).
minvolthe volume of the tank at its minimum water level.
volcurvethe name of the tank's volume curve ("" for no curve)
Returns
an error code.

These properties have units that depend on the units used for flow rate (see Measurement Units).