This example shows how a network can be built just through toolkit function calls, eliminating the need to always use an EPANET formatted input file. This creates opportunities to use other sources of network data in one's code, such as relational database files or GIS/CAD files.
Below is a schematic of the network to be built.
void netbuilder()
{
int index;
}
Pipe.
Definition: epanet2_enums.h:187
int EN_addlink(EN_Project ph, char *id, int linkType, char *fromNode, char *toNode, int *out_index)
Adds a new link to a project.
Elevation.
Definition: epanet2_enums.h:39
int EN_addcurve(EN_Project ph, char *id)
Adds a new data curve to a project.
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.
int EN_setjuncdata(EN_Project ph, int index, double elev, double dmnd, char *dmndpat)
Sets a group of properties for a junction node.
int EN_saveinpfile(EN_Project ph, const char *filename)
Saves a project's data to an EPANET-formatted text file.
int EN_setlinkvalue(EN_Project ph, int index, int property, double value)
Sets a property value for a link.
Reservoir node.
Definition: epanet2_enums.h:177
Pump head v. flow curve index.
Definition: epanet2_enums.h:95
int EN_setnodevalue(EN_Project ph, int index, int property, double value)
Sets a property value for a node.
Pump.
Definition: epanet2_enums.h:188
Gallons per minute.
Definition: epanet2_enums.h:268
struct Project * EN_Project
The EPANET Project wrapper object.
Definition: epanet2_2.h:49
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.
int EN_addnode(EN_Project ph, char *id, int nodeType, int *out_index)
Adds a new node to a project.
int EN_createproject(EN_Project *ph)
Creates an EPANET project.
Storage tank node.
Definition: epanet2_enums.h:178
int EN_init(EN_Project ph, const char *rptFile, const char *outFile, int unitsType, int headLossType)
Initializes an EPANET project.
Hazen-Williams.
Definition: epanet2_enums.h:254
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.
int EN_deleteproject(EN_Project ph)
Deletes a currently opened EPANET project.
Junction node.
Definition: epanet2_enums.h:176