diff --git a/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj b/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj index 30d1018..25795cc 100644 --- a/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj +++ b/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj @@ -40,7 +40,7 @@ 22322FA41068369500641384 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; }; 22322FA51068369500641384 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; }; 22322FA61068369500641384 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; }; - 22322FAA106836BC00641384 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; }; + 22322FAA106836BC00641384 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2255753F17551234009946B1 /* epanet.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F711068369500641384 /* epanet.c */; }; 2255754017551234009946B1 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F731068369500641384 /* hash.c */; }; 2255754117551234009946B1 /* hydraul.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F751068369500641384 /* hydraul.c */; }; @@ -54,6 +54,7 @@ 2255754917551234009946B1 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; }; 2255754A17551234009946B1 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; }; 2255754B17551234009946B1 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; }; + 226537E0179EDEEB00258C60 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -180,6 +181,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 226537E0179EDEEB00258C60 /* epanet2.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/include/epanet2.h b/include/epanet2.h index bf46009..5e3cef5 100644 --- a/include/epanet2.h +++ b/include/epanet2.h @@ -219,7 +219,7 @@ extern "C" { int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value); int DLLEXPORT ENgetqualtype(int *, int *); int DLLEXPORT ENgeterror(int, char *, int); - int DLLEXPORT ENgetstatistic(int code, int* value); + int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE* value); int DLLEXPORT ENgetnodeindex(char *, int *); int DLLEXPORT ENgetnodeid(int, char *); diff --git a/src/epanet.c b/src/epanet.c index 1a10546..c3297f6 100755 --- a/src/epanet.c +++ b/src/epanet.c @@ -1248,7 +1248,7 @@ int DLLEXPORT ENgeterror(int errcode, char *errmsg, int n) else return(0); } -int DLLEXPORT ENgetstatistic(int code, int* value) +int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE* value) /*---------------------------------------------------------------- ** Input: code = type of simulation statistic to retrieve ** Output: value = value of requested statistic @@ -1259,10 +1259,10 @@ int DLLEXPORT ENgetstatistic(int code, int* value) { switch (code) { case EN_ITERATIONS: - *value = _iterations; + *value = (EN_API_FLOAT_TYPE)_iterations; break; case EN_RELATIVEERROR: - *value = _relativeError; + *value = (EN_API_FLOAT_TYPE)_relativeError; break; default: break; @@ -1492,7 +1492,7 @@ int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value) v = (Tank[index-Njuncs].Hmin - Node[index].El) * Ucf[ELEV]; } break; - + case EN_MAXLEVEL: v = 0.0; if ( index > Njuncs ) diff --git a/src/hydraul.c b/src/hydraul.c index bdf0213..8ee6ff8 100755 --- a/src/hydraul.c +++ b/src/hydraul.c @@ -205,7 +205,7 @@ int runhyd(long *t) if (Statflag) writehydstat(iter,relerr); /* solution info */ - _relativeError = (int)relerr; + _relativeError = relerr; _iterations = iter; /*** Updated 3/1/01 ***/ diff --git a/src/quality.c b/src/quality.c index d17af7c..d4d3c0f 100755 --- a/src/quality.c +++ b/src/quality.c @@ -203,6 +203,8 @@ void initqual() Qtime = 0; Rtime = Rstart; Nperiods = 0; + + initsegs(); } @@ -463,12 +465,19 @@ int gethyd(long *hydtime, long *hydstep) { /* Compute reaction rate coeffs. */ - if (Reactflag && Qualflag != AGE) ratecoeffs(); - + if (Reactflag && Qualflag != AGE) { + ratecoeffs(); + } + /* Initialize pipe segments (at time 0) or */ /* else re-orient segments if flow reverses.*/ - if (Qtime == 0) initsegs(); - else reorientsegs(); + //if (Qtime == 0) + // initsegs(); + //else + if (Qtime != 0) { + reorientsegs(); + } + } return(errcode); } @@ -784,9 +793,13 @@ void accumulate(long dt) VolIn[j]++; } } - for (k=1; k<=Nnodes; k++) - if (VolIn[k] > 0.0) XC[k] = MassIn[k]/VolIn[k]; - + + for (k=1; k<=Nnodes; k++) { + if (VolIn[k] > 0.0) { + XC[k] = MassIn[k]/VolIn[k]; + } + } + /* Move mass from first segment of each pipe into downstream node */ memset(VolIn,0,(Nnodes+1)*sizeof(double)); memset(MassIn,0,(Nnodes+1)*sizeof(double)); diff --git a/src/vars.h b/src/vars.h index 4378123..a2780a0 100755 --- a/src/vars.h +++ b/src/vars.h @@ -171,7 +171,8 @@ EXTERN Svalve *Valve; /* Valve data */ EXTERN Scontrol *Control; /* Control data */ EXTERN HTtable *Nht, *Lht; /* Hash tables for ID labels */ EXTERN Padjlist *Adjlist; /* Node adjacency lists */ -EXTERN int _relativeError, _iterations; /* Info about hydraulic solution */ +EXTERN double _relativeError; +EXTERN int _iterations; /* Info about hydraulic solution */ /* ** NOTE: Hydraulic analysis of the pipe network at a given point in time