OWA-EPANET Toolkit 2.3
Loading...
Searching...
No Matches
Network Node Functions

Functions

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

Overview

These functions are used for working with network nodes.

Function Documentation

◆ EN_addnode()

int DLLEXPORT EN_addnode ( EN_Project ph,
const 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]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 DLLEXPORT 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 DLLEXPORT 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]out_xthe node's X-coordinate value.
[out]out_ythe node's Y-coordinate value.
Returns
an error code.

◆ EN_getnodeid()

int DLLEXPORT 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+1 characters.

◆ EN_getnodeindex()

int DLLEXPORT EN_getnodeindex ( EN_Project ph,
const 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]out_indexthe node's index (starting from 1).
Returns
an error code

◆ EN_getnodetype()

int DLLEXPORT 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]out_nodeTypethe node's type (see EN_NodeType).
Returns
an error code.

◆ EN_getnodevalue()

int DLLEXPORT 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]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_getnodevalues()

int DLLEXPORT EN_getnodevalues ( EN_Project ph,
int property,
double * out_values )

Retrieves an array of property values for all nodes.

Parameters
phan EPANET project handle.
propertythe property to retrieve (see EN_NodeProperty).
[out]out_valuesan array of values for all nodes.
Returns
an error code.

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

◆ EN_setcoord()

int DLLEXPORT 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 DLLEXPORT EN_setjuncdata ( EN_Project ph,
int index,
double elev,
double dmnd,
const 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 DLLEXPORT EN_setnodeid ( EN_Project ph,
int index,
const 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 DLLEXPORT 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 DLLEXPORT EN_settankdata ( EN_Project ph,
int index,
double elev,
double initlvl,
double minlvl,
double maxlvl,
double diam,
double minvol,
const 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).