EPANET
Functions
Hydraulic Analysis

~~~~~~~~~~~~~~~{.c} int errcode; long t, tstep; More...

Functions

int DLLEXPORT ENsolveH ()
 Solves the network hydraulics for all time periods. More...
 
int DLLEXPORT ENsaveH ()
 Saves hydraulic results to binary file. More...
 
int DLLEXPORT ENopenH ()
 Sets up data structures for hydraulic analysis. More...
 
int DLLEXPORT ENinitH (int initFlag)
 Initializes hydraulic analysis. More...
 
int DLLEXPORT ENrunH (long *currentTime)
 Run a hydraulic solution period. More...
 
int DLLEXPORT ENnextH (long *tStep)
 Determine time (in seconds) until next hydraulic event. More...
 
int DLLEXPORT ENcloseH ()
 Frees data allocated by hydraulics solver. More...
 
int DLLEXPORT ENsavehydfile (char *filename)
 Copies binary hydraulics file to disk. More...
 
int DLLEXPORT ENusehydfile (char *filename)
 Opens previously saved binary hydraulics file. More...
 
int DLLEXPORT ENgetstatistic (int code, EN_API_FLOAT_TYPE *value)
 Get hydraulic simulation statistic. More...
 

Detailed Description

~~~~~~~~~~~~~~~{.c} int errcode; long t, tstep;

errcode = ENopenH(); if (!errcode) { errcode = ENinitH(EN_SAVE); if (!errcode) { do { tstep = 0; ERRCODE(ENrunH(&t)); ERRCODE(ENnextH(&tstep)); } while (tstep > 0); } }

ENcloseH(); ~~~~~~~~~~~~~~~

Function Documentation

§ ENcloseH()

int ENcloseH ( )

Frees data allocated by hydraulics solver.

Returns
Error code

§ ENgetstatistic()

int ENgetstatistic ( int  code,
EN_API_FLOAT_TYPE *  value 
)

Get hydraulic simulation statistic.

Parameters
codeThe type of statistic to get
[out]valueThe value of the statistic
Returns
Error code

§ ENinitH()

int ENinitH ( int  initFlag)

Initializes hydraulic analysis.

Parameters
initFlag2-digit initialization flag
Returns
Error code

The initialization flag is a two digit number where the 1st (left) digit indicates if link flows should be re-initialized (1) or not (0), and the 2nd digit indicates if hydraulic results should be saved to file (1) or not (0).

§ ENnextH()

int ENnextH ( long *  tStep)

Determine time (in seconds) until next hydraulic event.

Parameters
[out]tStepTime (seconds) until next hydraulic event. 0 marks end of simulation period.
Returns
Error code

This function is used in a loop with ENrunH() to run an extended period hydraulic simulation. See ENsolveH() for an example.

§ ENopenH()

int ENopenH ( )

Sets up data structures for hydraulic analysis.

Returns
Error code

§ ENrunH()

int ENrunH ( long *  currentTime)

Run a hydraulic solution period.

Parameters
[out]currentTimeThe current simulation time in seconds
Returns
Error or warning code
See also
ENsolveH

This function is used in a loop with ENnextH() to run an extended period hydraulic simulation. See ENsolveH() for an example.

§ ENsaveH()

int ENsaveH ( )

Saves hydraulic results to binary file.

Returns
Error code

Must be called before ENreport() if no WQ simulation has been made. Should not be called if ENsolveQ() will be used.

§ ENsavehydfile()

int ENsavehydfile ( char *  filename)

Copies binary hydraulics file to disk.

Parameters
filenameName of file to be created
Returns
Error code

§ ENsolveH()

int ENsolveH ( )

Solves the network hydraulics for all time periods.

Returns
Error code

§ ENusehydfile()

int ENusehydfile ( char *  filename)

Opens previously saved binary hydraulics file.

Parameters
filenameName of file to be used
Returns
Error code