This example illustrates how the Toolkit could be used to develop a hydrant rating curve used in fire flow studies. This curve shows the amount of flow available at a node in the system as a function of pressure. The curve is generated by running a number of steady state hydraulic analyses with the node of interest subjected to a different demand in each analysis. For this example we assume that the ID label of the node of interest is MyNode
and that N
different demand levels stored in the array D
need to be examined. The corresponding pressures will be stored in P
. To keep the code more readable, no error checking is made on the results returned from the Toolkit function calls.
void HydrantRating(char *MyNode, int N, double D[], double P[])
{
int i, nodeindex;
long t;
double pressure;
EN_open(ph,
"example2.inp",
"example2.rpt",
"");
for (i=1; i<N; i++)
{
P[i] = pressure;
}
}
int EN_getnodeindex(EN_Project ph, char *id, int *out_index)
Gets the index of a node given its ID name.
int EN_runH(EN_Project ph, long *out_currentTime)
Computes a hydraulic solution for the current point in time.
int EN_closeH(EN_Project ph)
Closes the hydraulic solver freeing all of its allocated memory.
int EN_open(EN_Project ph, const char *inpFile, const char *rptFile, const char *outFile)
Opens an EPANET input file & reads in network data.
int EN_getnodevalue(EN_Project ph, int index, int property, double *out_value)
Retrieves a property value for a node.
int EN_setnodevalue(EN_Project ph, int index, int property, double value)
Sets a property value for a node.
struct Project * EN_Project
The EPANET Project wrapper object.
Definition: epanet2_2.h:49
Primary demand baseline value.
Definition: epanet2_enums.h:40
int EN_createproject(EN_Project *ph)
Creates an EPANET project.
Current computed pressure (read only)
Definition: epanet2_enums.h:50
int EN_openH(EN_Project ph)
Opens a project's hydraulic solver.
int EN_deleteproject(EN_Project ph)
Deletes a currently opened EPANET project.
int EN_initH(EN_Project ph, int initFlag)
Initializes a network prior to running a hydraulic analysis.