diff --git a/doc/modules_controls.dox b/doc/modules_controls.dox new file mode 100644 index 0000000..a9897a6 --- /dev/null +++ b/doc/modules_controls.dox @@ -0,0 +1,16 @@ +/** + +@defgroup Controls Managing Controls + + + + + + +@addtogroup Controls +@{ +@enum EN_ControlType +@fn int ENgetcontrol(int controlIndex, int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level) +@fn int ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level) +@} +*/ \ No newline at end of file diff --git a/doc/modules_filemanagement.dox b/doc/modules_filemanagement.dox index 06931aa..8e826f2 100644 --- a/doc/modules_filemanagement.dox +++ b/doc/modules_filemanagement.dox @@ -15,5 +15,6 @@ @fn int ENsetreport (char *reportFormat) @fn int ENopen (char *inpFile, char *rptFile, char *binOutFile) @fn int ENsaveinpfile (char *filename) +@fn int ENclose() @} */ \ No newline at end of file diff --git a/doc/modules_hydraulicfunctions.dox b/doc/modules_hydraulicfunctions.dox index a6abb82..028cac6 100644 --- a/doc/modules_hydraulicfunctions.dox +++ b/doc/modules_hydraulicfunctions.dox @@ -7,16 +7,15 @@ 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); +if (!errcode) { + errcode = ENinitH(EN_SAVE); + if (!errcode) { + do { + tstep = 0; + ERRCODE(ENrunH(&t)); + ERRCODE(ENnextH(&tstep)); + } while (tstep > 0); + } } ENcloseH(); diff --git a/include/epanet2.h b/include/epanet2.h index c326ec9..5b6f20a 100755 --- a/include/epanet2.h +++ b/include/epanet2.h @@ -692,22 +692,21 @@ extern "C" { @return Error code. */ int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues); - int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex); - int DLLEXPORT ENgetpumptype(int index, int *type); /** - @brief Get the string ID of the head curve assigned to a pump. - @param linkIndex The index of a pump - @param[out] curveId The string ID of a curve. Must be preallocated by the client for at least MAXID characters. + @brief Retrieves the curve index for a specified pump index. + @param pumpIndex The index of a pump + @param[out] curveIndex The index of the curve used by the pump. @return Error code. */ - int DLLEXPORT ENgetheadcurve(int linkIndex, char *curveId); + int DLLEXPORT ENgetheadcurveindex(int pumpIndex, int *curveIndex); /** @brief Get the type of pump @param linkIndex The index of the pump element - @param outType The integer-typed pump type signifier (output parameter) + @param[out] outType The integer-typed pump curve type signifier (output parameter) @return Error code + @see EN_CurveType */ int DLLEXPORT ENgetpumptype(int linkIndex, int *outType); @@ -796,79 +795,111 @@ extern "C" { int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v); /** - @brief - @param - @return + @brief Sets the level of hydraulic status reporting. + @param code Status reporting code. + @return Error code. */ int DLLEXPORT ENsetstatusreport(int code); /** - @brief - @param - @return + @brief Sets type of quality analysis called for + @param qualcode WQ parameter code, EN_QualityType + @param chemname Name of WQ constituent + @param chemunits Concentration units of WQ constituent + @param tracenode ID of node being traced (if applicable) + @return Error code. + @see EN_QualityType + + chemname and chemunits only apply when WQ analysis is for chemical. tracenode only applies when WQ analysis is source tracing. */ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, char *tracenode); /** - @brief - @param - @return + @brief Get quality analysis information (type, chemical name, units, trace node ID) + @param[out] qualcode The EN_QualityType code being used. + @param[out] chemname The name of the WQ constituent. + @param[out] chemunits The cencentration units of the WQ constituent. + @param[out] tracenode The trace node ID. + @return Error code. + @see EN_QualityType */ int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits, int *tracenode); /** - @brief - @param - @return + @brief Sets the node's base demand for a category. + @param nodeIndex The index of a node. + @param demandIdx The index of a demand category. + @param baseDemand The base demand multiplier for the selected category. + @return Error code. + @see ENgetbasedemand */ int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand); /** - @brief - @param - @return + @brief Retrieves index of curve with specific ID. + @param id The ID of a curve. + @param[out] index The index of the named curve + @return Error code. + @see ENgetcurveid */ int DLLEXPORT ENgetcurveindex(char *id, int *index); /** - @brief - @param - @return + @brief Retrieves ID of a curve with specific index. + @param index The index of a curve. + @param[out] id The ID of the curve specified. + @return Error code. + @see ENsetcurveindex + + NOTE: 'id' must be able to hold MAXID characters */ int DLLEXPORT ENgetcurveid(int index, char *id); /** - @brief - @param - @return + @brief Retrieves number of points in a curve + @param index The index of a curve. + @param[out] len The length of the curve coordinate list + @return Error code. + @see ENgetcurvevalue */ int DLLEXPORT ENgetcurvelen(int index, int *len); /** - @brief - @param - @return + @brief retrieves x,y point for a specific point number and curve + @param curveIndex The index of a curve + @param pointIndex The index of a point in the curve + @param[out] x The x-value of the specified point. + @param[out] y The y-value of the specified point. + @return Error code. + @see ENgetcurvelen ENsetcurvevalue */ - int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y); + int DLLEXPORT ENgetcurvevalue(int curveIndex, int pointIndex, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y); /** - @brief - @param - @return + @brief Sets x,y point for a specific point and curve. + @param curveIndex The index of a curve. + @param pointIndex The index of a point in the curve. + @param x The x-value of the point. + @param y The y-value of the point. + @return Error code. */ - int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y); + int DLLEXPORT ENsetcurvevalue(int curveIndex, int pointIndex, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y); /** - @brief - @param - @return + @brief Sets x,y values for a specified curve. + @param index The index of a curve. + @param x An array of x-values for the curve. + @param y An array of y-values for the curve. + @param len The length of the arrays x and y. + @return Error code. */ int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int len); /** - @brief - @param - @return + @brief Adds a new curve appended to the end of the existing curves. + @param id The name of the curve to be added. + @return Error code. + @see ENgetcurveindex ENsetcurve */ int DLLEXPORT ENaddcurve(char *id); diff --git a/src/epanet.c b/src/epanet.c index 799fa20..ea3662e 100755 --- a/src/epanet.c +++ b/src/epanet.c @@ -930,13 +930,6 @@ int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetcurveindex(char *id, int *index) -/*---------------------------------------------------------------- -** Input: id = curve ID -** Output: *index = index of curve in list of curves -** Returns: error code -** Purpose: retrieves index of curve with specific ID -**---------------------------------------------------------------- -*/ { int i; *index = 0; @@ -955,15 +948,6 @@ int DLLEXPORT ENgetcurveindex(char *id, int *index) int DLLEXPORT ENgetcurveid(int index, char *id) -/*---------------------------------------------------------------- -** Input: index = index of curve -** Output: id = curve ID -** Returns: error code -** Purpose: retrieves ID of a curve with specific index -** -** NOTE: 'id' must be able to hold MAXID characters -**---------------------------------------------------------------- -*/ { strcpy(id,""); if (!Openflag) return(102); @@ -974,13 +958,6 @@ int DLLEXPORT ENgetcurveid(int index, char *id) int DLLEXPORT ENgetcurvelen(int index, int *len) -/*---------------------------------------------------------------- -** Input: index = index of curve -** Output: *len = curve length (number of points in curve) -** Returns: error code -** Purpose: retrieves number of points in a curve -**---------------------------------------------------------------- -*/ { if (!Openflag) return(102); if (index < 1 || index > Ncurves) return(206); @@ -990,17 +967,7 @@ int DLLEXPORT ENgetcurvelen(int index, int *len) int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y) -/*---------------------------------------------------------------- -** Input: index = index of curve -** pnt = curve's point number -** Output: *x = curve x value -** curve y value -** Returns: error code -** Purpose: retrieves x,y point for a specific point number -** and curve -**---------------------------------------------------------------- -*/ -{ +{ *x = 0.0; *y = 0.0; if (!Openflag) return(102); @@ -1500,18 +1467,6 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues) -/*---------------------------------------------------------------- - ** Input: curveIndex = curve index - ** Output: *nValues = number of points on curve - ** id = curve ID - ** *xValues = values for x - ** *yValues = values for y - ** Returns: error code - ** Purpose: retrieves curve id, number of values and (x,y) values - ** - ** NOTE: 'id' must be able to hold MAXID characters - **---------------------------------------------------------------- - */ { int iPoint, nPoints; Scurve curve; @@ -2047,14 +2002,6 @@ int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value int DLLEXPORT ENaddcurve(char *id) -/*---------------------------------------------------------------- -** Input: id = ID name of the new curve -** Output: none -** Returns: error code -** Purpose: adds a new curve appended to the end of the -** existing curves. -**---------------------------------------------------------------- -*/ { int i, j, n, err = 0; Scurve *tmpCur; @@ -2134,16 +2081,6 @@ int DLLEXPORT ENaddcurve(char *id) int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n) -/*---------------------------------------------------------------- -** Input: index = curve index -** *x = array of x points -** *y = array of y points -** n = number of points in curve -** Output: none -** Returns: error code -** Purpose: sets x,y values for a specific curve -**---------------------------------------------------------------- -*/ { int j; @@ -2170,16 +2107,6 @@ int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y) -/*---------------------------------------------------------------- -** Input: index = curve index -** pnt = curve's point number -** x = curve x value -** y = curve y value -** Output: none -** Returns: error code -** Purpose: sets x,y point for a specific point and curve -**---------------------------------------------------------------- -*/ { if (!Openflag) return(102); if (index <= 0 || index > Ncurves) return(206); @@ -2320,13 +2247,6 @@ int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v) int DLLEXPORT ENsetstatusreport(int code) -/*---------------------------------------------------------------- -** Input: code = status reporting code (0, 1, or 2) -** Output: none -** Returns: error code -** Purpose: sets level of hydraulic status reporting -**---------------------------------------------------------------- -*/ { int errcode = 0; if (code >= 0 && code <= 2) Statflag = (char)code; @@ -2335,22 +2255,7 @@ int DLLEXPORT ENsetstatusreport(int code) } -int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, - char *chemunits, char *tracenode) -/*---------------------------------------------------------------- -** Input: qualcode = WQ parameter code (see EPANET2.H) -** chemname = name of WQ constituent -** chemunits = concentration units of WQ constituent -** tracenode = ID of node being traced -** Output: none -** Returns: error code -** Purpose: sets type of quality analysis called for -** -** NOTE: chemname and chemunits only apply when WQ analysis -** is for chemical. tracenode only applies when WQ -** analysis is source tracing. -**---------------------------------------------------------------- -*/ +int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, char *tracenode) { /*** Updated 3/1/01 ***/ double ccf = 1.0; @@ -2398,14 +2303,6 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, } int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex) -/*---------------------------------------------------------------- -** Input: index = index of pump in list of links -** Output: curveindex = head curve index -** Returns: error code -** Purpose: retrieves index of a head curve for specific link index -** -**---------------------------------------------------------------- -*/ { if (!Openflag) return(102); if (index < 1 || index > Nlinks || PUMP != Link[index].Type) return(204); @@ -3191,14 +3088,6 @@ int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE * int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand) -/*---------------------------------------------------------------- - ** Input: nodeIndex = index of node - ** demandIdx = index of demand category - ** baseDemand = base demand for selected category - ** Returns: error code - ** Purpose: sets the node's base demand for a category - **---------------------------------------------------------------- - */ { Pdemand d; int n=1;