From 5caf7feda3780701a55d405eafab85872ace2ad9 Mon Sep 17 00:00:00 2001 From: Steffen Macke Date: Sat, 4 Jan 2014 08:13:50 -0800 Subject: [PATCH] Added ENgetheadcurve(), ENgetpumptype() and related constants. --- src/epanet.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/toolkit.h | 5 +++++ 2 files changed, 53 insertions(+) diff --git a/src/epanet.c b/src/epanet.c index 9e23e9f..4c8bc2e 100755 --- a/src/epanet.c +++ b/src/epanet.c @@ -2502,6 +2502,54 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, return(0); } +int DLLEXPORT ENgetheadcurve(int index, char *id) +/*---------------------------------------------------------------- +** Input: index = index of pump in list of links +** Output: id = head curve ID +** Returns: error code +** Purpose: retrieves ID of a head curve for specific link index +** +** NOTE: 'id' must be able to hold MAXID characters +**---------------------------------------------------------------- +*/ +{ + int i; + strcpy(id,""); + if (!Openflag) return(102); + for (i=1; i<=Npumps; i++) + { + if(Pump[i].Link = index) + { + strcpy(id,Curve[Pump[i].Hcurve].ID); + return(0); + } + } + return(204); +} + +int DLLEXPORT ENgetpumptype(int index, int *type) +/*---------------------------------------------------------------- +** Input: index = index of pump in list of links +** Output: type = PumpType +** Returns: error code +** Purpose: retrieves type of a pump for specific link index +** +**---------------------------------------------------------------- +*/ +{ + int i; + *type=-1; + if (!Openflag) return(102); + for (i=1; i<=Npumps; i++) + { + if(Pump[i].Link = index) + { + *type = Pump[i].Ptype; + return(0); + } + } + return(204); +} /* ---------------------------------------------------------------- diff --git a/src/toolkit.h b/src/toolkit.h index 016a31f..3dda9c2 100755 --- a/src/toolkit.h +++ b/src/toolkit.h @@ -166,6 +166,9 @@ AUTHOR: L. Rossman #define EN_INITFLOW 10 /* Re-initialize flows flag */ +#define EN_CONST_HP 0 /* constant horsepower */ +#define EN_POWER_FUNC 1 /* power function */ +#define EN_CUSTOM 2 /* user-defined custom curve */ // --- Declare the EPANET toolkit functions #if defined(__cplusplus) @@ -230,6 +233,8 @@ extern "C" { int DLLEXPORT ENgetlinkvalue(int, int, float *); int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues); + int DLLEXPORT ENgetheadcurve(int, char *); + int DLLEXPORT ENgetpumptype(int, int *); int DLLEXPORT ENgetversion(int *);