diff --git a/include/epanet2.bas b/include/epanet2.bas index 0826a3b..615f045 100644 --- a/include/epanet2.bas +++ b/include/epanet2.bas @@ -154,6 +154,13 @@ Public Const EN_INITFLOW = 10 ' Re-initialize flow flag Public Const EN_CONST_HP = 0 ' constant horsepower Public Const EN_POWER_FUNC = 1 ' power function Public Const EN_CUSTOM = 2 ' user-defined custom curve +Public Const EN_NOCURVE = 3 ' no curve + +Public Const EN_V_CURVE = 0 ' volume curve +Public Const EN_P_CURVE = 1 ' pump curve +Public Const EN_E_CURVE = 2 ' efficiency curve +Public Const EN_H_CURVE = 3 ' head loss curve +Public Const EN_G_CURVE = 4 ' General\default curve 'These are the external functions that comprise the DLL diff --git a/include/epanet2.h b/include/epanet2.h index 81b469e..b41ae0f 100644 --- a/include/epanet2.h +++ b/include/epanet2.h @@ -224,8 +224,6 @@ typedef enum { EN_TIMEOFDAY = 3 } EN_ControlType; - - typedef enum { EN_AVERAGE = 1, /* Time statistic types. */ EN_MINIMUM = 2, /* See TstatType in TYPES.H */ @@ -233,8 +231,6 @@ typedef enum { EN_RANGE = 4 } EN_StatisticType; - - typedef enum { EN_MIX1 = 0, /* Tank mixing models */ EN_MIX2 = 1, @@ -242,8 +238,6 @@ typedef enum { EN_LIFO = 3 } EN_MixingModel; - - typedef enum { EN_NOSAVE = 0, EN_SAVE = 1, @@ -251,8 +245,6 @@ typedef enum { EN_SAVE_AND_INIT = 11 } EN_SaveOption; - - typedef enum { EN_CONST_HP = 0, /* constant horsepower */ EN_POWER_FUNC = 1, /* power function */ @@ -260,6 +252,13 @@ typedef enum { } EN_CurveType; +typedef enum { + EN_V_CURVE = 0, /* volume curve */ + EN_P_CURVE = 1, /* pump curve */ + EN_E_CURVE = 2, /* efficiency curve */ + EN_H_CURVE = 3, /* head loss curve */ + EN_G_CURVE = 4 /* General\default curve */ +} EN_CurveType; // --- Declare the EPANET toolkit functions #if defined(__cplusplus) diff --git a/src/epanet.c b/src/epanet.c index f0f0ff8..72f59d8 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -2933,7 +2933,7 @@ int DLLEXPORT EN_addcurve(EN_Project *p, char *id) { strcpy(tmpCur[n].ID, id); tmpCur[n].Npts = 1; - tmpCur[n].Type = -1; + tmpCur[n].Type = G_CURVE; tmpCur[n].X = (double *)calloc(tmpCur[n].Npts, sizeof(double)); tmpCur[n].Y = (double *)calloc(tmpCur[n].Npts, sizeof(double)); if (tmpCur[n].X == NULL) @@ -2974,9 +2974,7 @@ int DLLEXPORT EN_addcurve(EN_Project *p, char *id) { int DLLEXPORT EN_setcurve(EN_Project *p, int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n) { EN_Network *net = &p->network; - Scurve *Curve = net->Curve; - - + Scurve *Curve = net->Curve; int j; /* Check for valid arguments */ @@ -3007,12 +3005,9 @@ int DLLEXPORT EN_setcurve(EN_Project *p, int index, EN_API_FLOAT_TYPE *x, EN_API int DLLEXPORT EN_setcurvevalue(EN_Project *p, int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y) { EN_Network *net = &p->network; - Scurve *Curve = net->Curve; - const int Ncurves = net->Ncurves; - if (!p->Openflag) return (102); if (index <= 0 || index > Ncurves) @@ -3713,7 +3708,7 @@ int allocdata(EN_Project *p) } for (n = 0; n <= par->MaxCurves; n++) { net->Curve[n].Npts = 0; - net->Curve[n].Type = -1; + net->Curve[n].Type = G_CURVE; net->Curve[n].X = NULL; net->Curve[n].Y = NULL; } diff --git a/src/types.h b/src/types.h index a039d8c..be6e6fa 100755 --- a/src/types.h +++ b/src/types.h @@ -151,8 +151,9 @@ typedef enum { V_CURVE, /* volume curve */ P_CURVE, /* pump curve */ E_CURVE, /* efficiency curve */ - H_CURVE -} CurveType; /* head loss curve */ + H_CURVE, /* head loss curve */ + G_CURVE /* General\default curve */ +} CurveType; typedef enum { CONST_HP, /* constant horsepower */