From 7a0dd5ec6d4efc34f115d11371b25927b298ae0e Mon Sep 17 00:00:00 2001 From: sam hatchett Date: Mon, 4 Feb 2013 21:28:27 -0500 Subject: [PATCH] removed files --- .../epanet/epanet.xcodeproj/project.pbxproj | 10 - src/lemontiger.c | 288 ------------------ src/lemontiger.h | 241 --------------- src/testLT.c | 112 ------- 4 files changed, 651 deletions(-) delete mode 100644 src/lemontiger.c delete mode 100644 src/lemontiger.h delete mode 100644 src/testLT.c diff --git a/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj b/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj index 9bd2890..2a4b1da 100644 --- a/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj +++ b/build/Xcode/epanet/epanet.xcodeproj/project.pbxproj @@ -42,8 +42,6 @@ 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 */; }; - 2298EBE116B17E440088A6DC /* lemontiger.c in Sources */ = {isa = PBXBuildFile; fileRef = 2298EBDF16B17E440088A6DC /* lemontiger.c */; }; - 2298EBE216B17E440088A6DC /* lemontiger.h in Headers */ = {isa = PBXBuildFile; fileRef = 2298EBE016B17E440088A6DC /* lemontiger.h */; }; 22EF555716BC744C00F3988A /* testLemonTiger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22EF555516BC744C00F3988A /* testLemonTiger.cpp */; }; 22EF555A16BC7FF500F3988A /* libepanet.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC0630554660B00DB518D /* libepanet.dylib */; }; /* End PBXBuildFile section */ @@ -101,9 +99,6 @@ 22322F831068369500641384 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../../../src/types.h; sourceTree = SOURCE_ROOT; }; 22322F841068369500641384 /* vars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vars.h; path = ../../../src/vars.h; sourceTree = SOURCE_ROOT; }; 22322FA9106836B000641384 /* epanet2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = epanet2.h; path = ../../../include/epanet2.h; sourceTree = SOURCE_ROOT; }; - 2298EBDC16B17DCE0088A6DC /* testLT.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testLT.c; path = ../../../src/testLT.c; sourceTree = ""; }; - 2298EBDF16B17E440088A6DC /* lemontiger.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lemontiger.c; path = ../../../src/lemontiger.c; sourceTree = ""; }; - 2298EBE016B17E440088A6DC /* lemontiger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lemontiger.h; path = ../../../src/lemontiger.h; sourceTree = ""; }; 22EF554C16BC740400F3988A /* TestLemonTiger */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestLemonTiger; sourceTree = BUILT_PRODUCTS_DIR; }; 22EF555516BC744C00F3988A /* testLemonTiger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testLemonTiger.cpp; path = ../../../src/testLemonTiger.cpp; sourceTree = ""; }; 22EF555616BC744C00F3988A /* testLemonTiger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testLemonTiger.h; path = ../../../src/testLemonTiger.h; sourceTree = ""; }; @@ -196,9 +191,6 @@ 2298EBDB16B17DBD0088A6DC /* LemonTiger */ = { isa = PBXGroup; children = ( - 2298EBDF16B17E440088A6DC /* lemontiger.c */, - 2298EBE016B17E440088A6DC /* lemontiger.h */, - 2298EBDC16B17DCE0088A6DC /* testLT.c */, 22EF555516BC744C00F3988A /* testLemonTiger.cpp */, 22EF555616BC744C00F3988A /* testLemonTiger.h */, ); @@ -221,7 +213,6 @@ 22322F971068369500641384 /* toolkit.h in Headers */, 22322F981068369500641384 /* types.h in Headers */, 22322F991068369500641384 /* vars.h in Headers */, - 2298EBE216B17E440088A6DC /* lemontiger.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -352,7 +343,6 @@ 22322F931068369500641384 /* report.c in Sources */, 22322F941068369500641384 /* rules.c in Sources */, 22322F951068369500641384 /* smatrix.c in Sources */, - 2298EBE116B17E440088A6DC /* lemontiger.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/src/lemontiger.c b/src/lemontiger.c deleted file mode 100644 index c4a2ed8..0000000 --- a/src/lemontiger.c +++ /dev/null @@ -1,288 +0,0 @@ -#include "types.h" -#include "vars.h" -#include "funcs.h" -#include "toolkit.h" - -extern char OutOfMemory; -extern int Haltflag; - - -int DLLEXPORT ENopeninitHQ() { - int errcode = 0; - - if (Hstep % Qstep) { - errcode = 401; - errmsg(errcode); - return errcode; - } - - Statflag = TRUE; //disable status report - - if (errcode = ENopenH()) return errcode; - - // Open WQ solver, but don't check SaveHflag as in ENopenQ() - ERRCODE(openqual()); - if (!errcode) OpenQflag = TRUE; - else { - errmsg(errcode); - return errcode; - } - - if (errcode = ENinitH(1)) return errcode; - if (errcode = ENinitQ(0)) return errcode; - - Rtime = Rstep; //use ENinitH()'s setup - return errcode; -} - -long timestepLT(); -/* computes the length of the time step to next hydraulic simulation, but don't - update tank volumne and tank levels. During a sync HQ simulation, - nextqual() will update the tank vols */ - -int nexthydLT(long *tstep); -/* finds length of next time step but don't save - results to hydraulics file. ignore reporting functions. */ - -void updateTanklevels(); -//Prior to running hydraulic simulation, update the tank levels. - - -/*! - \fn int ENrunnextHQ( long* simTimePtr, long* timeStepPtr ) - \brief equivalent of ENnextQ, hydraulic solver is called on-demand - \param simTimePtr Simulation time (output variable). - \param timeStepPtr Time to next time step boundary (output variable). - \return on error, an error code - */ -int DLLEXPORT ENrunnextHQ(long* simTimePtr, long* timeStepPtr) { - /* The lemonTiger equivalent of ENnextQ, hydraulic solver is called on-demand*/ - long hydtime; /* Hydraulic solution time */ - long hydstep; /* Hydraulic time step */ - int errcode = 0; - - /* if needed, push forward hydraulic simulation, similar to runqual() */ - if (Qtime == Htime) - { - if ( (errcode = runhyd(&hydtime)) || (errcode = nexthydLT(&hydstep)) ) { - return errcode; - } - /* If simulating WQ: */ - if (Qualflag != NONE && Qtime < Dur) { - - /* Compute reaction rate coeffs. */ - 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(); - } - Htime = hydtime + hydstep; - } - *simTimePtr = Htime; - hydstep = Htime - Qtime; - - /* Perform water quality routing over this time step */ - if (Qualflag != NONE && hydstep > 0) transport(hydstep); - - updateTanklevels(); - /* Update current time */ - if (OutOfMemory) errcode = 101; - if (!errcode) *timeStepPtr = hydstep; - Qtime += hydstep; - - /* Save final output if no more time steps */ - if (!errcode && Saveflag && *timeStepPtr == 0) errcode = savefinaloutput(); - return(errcode); - -} - -int DLLEXPORT ENrunstepHQ(long* pstime /* Simulation time pointer */ - ,long* ptleft /* Time left in the simulation*/) { - -/* The LemonTiger equivalence of ENstepQ, hydraulic solver is called on-demand */ - - long hydtime; /* Hydraulic solution time */ - long hydstep; /* Hydraulic time step */ - int errcode = 0; - long dt, hstep, tstep; - - /* if needed, push forward hydraulic simulation, similar to runqual() */ - if (Qtime == Htime) - { - if ( (errcode = runhyd(&hydtime)) || - (errcode = nexthydLT(&hydstep)) - ) return errcode; - /* If simulating WQ: */ - if (Qualflag != NONE && Qtime < Dur) { - - /* Compute reaction rate coeffs. */ - 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(); - } - Htime = hydtime + hydstep; - } - - /* run WQ simulation, similar to stepqual() */ - tstep = Qstep; - - do { - dt = tstep; - hstep = Htime - Qtime; - if (hstep < dt) {/* Htime is closer */ - dt = hstep; - if (Qualflag != NONE) transport(dt); - Qtime += dt; - - updateTanklevels(); - /* if needed, push forward hydraulic simulation */ - if ( (errcode = runhyd(&hydtime)) || - (errcode = nexthydLT(&hydstep)) - ) return errcode; - if (Qualflag != NONE && Qtime < Dur) { - - /* Compute reaction rate coeffs. */ - 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(); - } - Htime = hydtime + hydstep; - Qtime = hydtime; - - } else { /* Qtime is closer */ - if (Qualflag != NONE) transport(dt); - Qtime += dt; - } - tstep -= dt; - if (OutOfMemory) errcode = 101; - } while (!errcode && tstep > 0); /*do it until Qstep is elapsed.*/ - - *ptleft = Dur - Qtime; - if (!errcode && Saveflag && *ptleft == 0) errcode = savefinaloutput(); - - /* if needed, push forward hydraulic simulation again, so that hyd and wq states are consistent. */ - if (Qtime == Htime && Htime < Dur) { - updateTanklevels(); - if ( (errcode = runhyd(&hydtime)) || - (errcode = nexthydLT(&hydstep)) - ) return errcode; - // If simulating WQ: - if (Qualflag != NONE && Qtime < Dur) { - - // Compute reaction rate coeffs. - 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(); - } - Htime = hydtime + hydstep; - } - - - /* Update reported simulation time */ - *pstime = Qtime; - - return(errcode); -} - - -int DLLEXPORT ENcloseHQ() { - int errcode = 0; - if ( (errcode = ENcloseQ()) || (errcode = ENcloseH()) ) - return errcode; - return errcode; -} - - - - -long timestepLT(void) { -/* computes time step to advance hydraulic simulation, but don't - update tank levels. Instead, let nextqual() do the job. */ - long n,t,tstep; - - /* Normal time step is hydraulic time step */ - tstep = Hstep; - - /* Revise time step based on time until next demand period */ - n = ((Htime+Pstart)/Pstep) + 1; /* Next pattern period */ - t = n*Pstep - Htime; /* Time till next period */ - if (t > 0 && t < tstep) tstep = t; - - /* Revise time step based on time until next reporting period */ - t = Rtime - Htime; - if (t > 0 && t < tstep) tstep = t; - - /* Revise time step based on smallest time to fill or drain a tank */ - tanktimestep(&tstep); - - /* Revise time step based on smallest time to activate a control */ - controltimestep(&tstep); - - /* Evaluate rule-based controls (which will also update tank levels) */ - if (Nrules > 0) ruletimestep(&tstep); - - return(tstep); -} - - -int nexthydLT(long *tstep) { -/* finds length of next time step but don't updates tank volumnes and tank - levels and rule-based contol actions. don't save - results to hydraulics file. don't consider Report time. */ - long hydstep; /* Actual time step */ - int errcode = 0; /* Error code */ - - if (Haltflag) Htime = Dur; - - /* Compute next time step & update tank levels */ - *tstep = 0; - hydstep = 0; - if (Htime < Dur) hydstep = timestepLT(); - - /* Compute pumping energy */ - if (Dur == 0) addenergy(0); - else if (Htime < Dur) addenergy(hydstep); - - /* Update current time. */ - if (Htime < Dur) /* More time remains */ - { - Htime += hydstep; - } - else - { - Htime++; /* Force completion of analysis */ - } - *tstep = hydstep; - return(errcode); -} - - -void updateTanklevels() { //Prior to doing hydraulic simulation, update the tank levels - int i,n; - for (i=1; i<=Ntanks; i++) { - /* Skip reservoirs */ - if (Tank[i].A == 0.0) continue; - - n = Tank[i].Node; - /* Check if tank full/empty within next second */ - if (Tank[i].V + D[n] >= Tank[i].Vmax) Tank[i].V = Tank[i].Vmax; - if (Tank[i].V - D[n] <= Tank[i].Vmin) Tank[i].V = Tank[i].Vmin; - - H[n] = tankgrade(i,Tank[i].V); - } -} - - - - \ No newline at end of file diff --git a/src/lemontiger.h b/src/lemontiger.h deleted file mode 100644 index cdb6585..0000000 --- a/src/lemontiger.h +++ /dev/null @@ -1,241 +0,0 @@ -#ifndef LEMONTIGER_H -#define LEMONTIGER_H - -/*The header file to be included for USING Epanet LemonTiger DLL on WINDOWS platforms, -all original Epanet functions remain intact, and the new LT_functions are added. */ - -/*Note that this file is not used by the functions in the toolkit itself. -Refer to toolkit.h for the internally used function declarations. */ -#ifdef __APPLE__ - #define DLLIMPORT -#else - #define DLLIMPORT __declspec(dllimport) -#endif -// --- Define the EPANET toolkit constants - -#define EN_ELEVATION 0 /* Node parameters */ -#define EN_BASEDEMAND 1 -#define EN_PATTERN 2 -#define EN_EMITTER 3 -#define EN_INITQUAL 4 -#define EN_SOURCEQUAL 5 -#define EN_SOURCEPAT 6 -#define EN_SOURCETYPE 7 -#define EN_TANKLEVEL 8 -#define EN_DEMAND 9 -#define EN_HEAD 10 -#define EN_PRESSURE 11 -#define EN_QUALITY 12 -#define EN_SOURCEMASS 13 -#define EN_INITVOLUME 14 -#define EN_MIXMODEL 15 -#define EN_MIXZONEVOL 16 - -#define EN_TANKDIAM 17 -#define EN_MINVOLUME 18 -#define EN_VOLCURVE 19 -#define EN_MINLEVEL 20 -#define EN_MAXLEVEL 21 -#define EN_MIXFRACTION 22 -#define EN_TANK_KBULK 23 - -#define EN_TANKVOLUME 24 /* TNT */ - -#define EN_DIAMETER 0 /* Link parameters */ -#define EN_LENGTH 1 -#define EN_ROUGHNESS 2 -#define EN_MINORLOSS 3 -#define EN_INITSTATUS 4 -#define EN_INITSETTING 5 -#define EN_KBULK 6 -#define EN_KWALL 7 -#define EN_FLOW 8 -#define EN_VELOCITY 9 -#define EN_HEADLOSS 10 -#define EN_STATUS 11 -#define EN_SETTING 12 -#define EN_ENERGY 13 -#define EN_LINKQUAL 14 /* TNT */ - -#define EN_DURATION 0 /* Time parameters */ -#define EN_HYDSTEP 1 -#define EN_QUALSTEP 2 -#define EN_PATTERNSTEP 3 -#define EN_PATTERNSTART 4 -#define EN_REPORTSTEP 5 -#define EN_REPORTSTART 6 -#define EN_RULESTEP 7 -#define EN_STATISTIC 8 -#define EN_PERIODS 9 -#define EN_STARTTIME 10 /* Added TNT 10/2/2009 */ - -#define EN_NODECOUNT 0 /* Component counts */ -#define EN_TANKCOUNT 1 -#define EN_LINKCOUNT 2 -#define EN_PATCOUNT 3 -#define EN_CURVECOUNT 4 -#define EN_CONTROLCOUNT 5 - -#define EN_JUNCTION 0 /* Node types */ -#define EN_RESERVOIR 1 -#define EN_TANK 2 - -#define EN_CVPIPE 0 /* Link types */ -#define EN_PIPE 1 -#define EN_PUMP 2 -#define EN_PRV 3 -#define EN_PSV 4 -#define EN_PBV 5 -#define EN_FCV 6 -#define EN_TCV 7 -#define EN_GPV 8 - -#define EN_NONE 0 /* Quality analysis types */ -#define EN_CHEM 1 -#define EN_AGE 2 -#define EN_TRACE 3 - -#define EN_CONCEN 0 /* Source quality types */ -#define EN_MASS 1 -#define EN_SETPOINT 2 -#define EN_FLOWPACED 3 - -#define EN_CFS 0 /* Flow units types */ -#define EN_GPM 1 -#define EN_MGD 2 -#define EN_IMGD 3 -#define EN_AFD 4 -#define EN_LPS 5 -#define EN_LPM 6 -#define EN_MLD 7 -#define EN_CMH 8 -#define EN_CMD 9 - -#define EN_TRIALS 0 /* Misc. options */ -#define EN_ACCURACY 1 -#define EN_TOLERANCE 2 -#define EN_EMITEXPON 3 -#define EN_DEMANDMULT 4 - -#define EN_LOWLEVEL 0 /* Control types */ -#define EN_HILEVEL 1 -#define EN_TIMER 2 -#define EN_TIMEOFDAY 3 - -#define EN_AVERAGE 1 /* Time statistic types. */ -#define EN_MINIMUM 2 -#define EN_MAXIMUM 3 -#define EN_RANGE 4 - -#define EN_MIX1 0 /* Tank mixing models */ -#define EN_MIX2 1 -#define EN_FIFO 2 -#define EN_LIFO 3 - -#define EN_NOSAVE 0 /* Save-results-to-file flag */ -#define EN_SAVE 1 -#define EN_INITFLOW 10 /* Re-initialize flow flag */ - -// --- declare the EPANET toolkit functions - -#ifdef __cplusplus -extern "C" { -#endif - - int DLLIMPORT ENepanet(char *, char *, char *, void (*) (char *)); - int DLLIMPORT ENopen(char *, char *, char *); - int DLLIMPORT ENsaveinpfile(char *); - int DLLIMPORT ENclose(void); - - int DLLIMPORT ENsolveH(void); - int DLLIMPORT ENsaveH(void); - int DLLIMPORT ENopenH(void); - int DLLIMPORT ENinitH(int); - int DLLIMPORT ENrunH(long *); - int DLLIMPORT ENnextH(long *); - int DLLIMPORT ENcloseH(void); - int DLLIMPORT ENsavehydfile(char *); - int DLLIMPORT ENusehydfile(char *); - - int DLLIMPORT ENsolveQ(void); - int DLLIMPORT ENopenQ(void); - int DLLIMPORT ENinitQ(int); - int DLLIMPORT ENrunQ(long *); - int DLLIMPORT ENnextQ(long *); - int DLLIMPORT ENstepQ(long *); - int DLLIMPORT ENcloseQ(void); - - int DLLIMPORT ENwriteline(char *); - int DLLIMPORT ENreport(void); - int DLLIMPORT ENresetreport(void); - int DLLIMPORT ENsetreport(char *); - - int DLLIMPORT ENgetcontrol(int, int *, int *, float *, - int *, float *); - int DLLIMPORT ENgetcount(int, int *); - int DLLIMPORT ENgetoption(int, float *); - int DLLIMPORT ENgettimeparam(int, long *); - int DLLIMPORT ENgetflowunits(int *); - int DLLIMPORT ENgetpatternindex(char *, int *); - int DLLIMPORT ENgetpatternid(int, char *); - int DLLIMPORT ENgetpatternlen(int, int *); - int DLLIMPORT ENgetpatternvalue(int, int, float *); - int DLLIMPORT ENgetqualtype(int *, int *); - int DLLIMPORT ENgeterror(int, char *, int); - - int DLLIMPORT ENgetnodeindex(char *, int *); - int DLLIMPORT ENgetnodeid(int, char *); - int DLLIMPORT ENgetnodetype(int, int *); - int DLLIMPORT ENgetnodevalue(int, int, float *); - - int DLLIMPORT ENgetnumdemands(int, int *); - int DLLIMPORT ENgetbasedemand(int, int, float *); - int DLLIMPORT ENgetdemandpattern(int, int, int *); - - int DLLIMPORT ENgetlinkindex(char *, int *); - int DLLIMPORT ENgetlinkid(int, char *); - int DLLIMPORT ENgetlinktype(int, int *); - int DLLIMPORT ENgetlinknodes(int, int *, int *); - int DLLIMPORT ENgetlinkvalue(int, int, float *); - - int DLLIMPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues); - - int DLLIMPORT ENgetversion(int *); - - int DLLIMPORT ENsetcontrol(int, int, int, float, int, float); - int DLLIMPORT ENsetnodevalue(int, int, float); - int DLLIMPORT ENsetlinkvalue(int, int, float); - int DLLIMPORT ENaddpattern(char *); - int DLLIMPORT ENsetpattern(int, float *, int); - int DLLIMPORT ENsetpatternvalue(int, int, float); - int DLLIMPORT ENsettimeparam(int, long); - int DLLIMPORT ENsetoption(int, float); - int DLLIMPORT ENsetstatusreport(int); - int DLLIMPORT ENsetqualtype(int, char *, char *, char *); - - //LemonTiger functions - /* See testLT.c for a LemonTiger test */ - - //LT equivalent to ENopenH() + ENopenQ() + ENinitH() + ENinitQ() - int DLLIMPORT ENopeninitHQ(); - - //LT equivalent to ENrunQ() + ENnextQ(); - int DLLIMPORT ENrunnextHQ(long*, long*); - - //LT equivalent to ENrunQ() + ENstepQ(); - int DLLIMPORT ENrunstepHQ(long*, long*); - - //LT equivalent to ENcloseH() + ENcloseQ(); - int DLLIMPORT ENcloseHQ(); - - -#ifdef __cplusplus -}; -#endif - - - -#endif //LEMONTIGER_H - - - diff --git a/src/testLT.c b/src/testLT.c deleted file mode 100644 index 3af7b68..0000000 --- a/src/testLT.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Test file for epanet LemonTiger - Jinduan's version - The extension enables syncronized computation of hydraulics - and water quality */ - -#include -#include "types.h" -#include "vars.h" -#include "lemontiger.h" - - - - -int main(int argc, char* argv[]) { - int err = 0; //error code - long stime = 0; //simulation time point, = t = Htime - long step = 1; //time to next time point, = tstep = hydstep - long tleft = 0; //time left in the simulation - int id, id2, id3; // some node id - float value; // some node/link value - int TIME_A = 3600*3; - int TIME_B = 3600*6; //two time points for testing - int TIME_C = 3600*10; - - - /* Asychronous solver (old epanet) */ - printf("*****Original EPANET results******\n"); - - if (err=ENopen(argv[1], argv[2], "")) return err; - ENgetnodeindex("184", &id); // a node far away from water source - ENgetlinkindex("101", &id2); // a link close to the lake - ENgetnodeindex("199", &id3); // a node close to the lake (tracer point) - - for (ENopenH(), ENinitH(1), step=1; - // must save intermediate results to disk (initH(1)), otherwise WQ solver won't execute - step>0; ENnextH(&step)) { - - ENrunH(&stime); - - - if (stime == TIME_A || stime == TIME_B || stime == TIME_C) { // grab some results - printf("Hydraulic simulation time = %d sec, step = %d sec.\n", stime, step); - - ENgetnodevalue(id, EN_HEAD, &value); - printf("Node 184's head = \t%f.\n", value); - ENgetlinkvalue(id2, EN_FLOW, &value); - printf("Link 101's flowrate = \t%f. \n", value); - ENgetnodevalue(id3, EN_HEAD, &value); - printf("Node 199's head = \t%f.\n", value); - } - } - ENcloseH(); - - printf("\nReset time pointer and run WQ.\n"); - for (step=1, ENopenQ(), ENinitQ(0); // this operation resets the internal time pointer (back to 0) - step>0; ENnextQ(&step)) { - - ENrunQ(&stime); - - - // grab some results - if (stime == TIME_A || stime == TIME_B || stime == TIME_C) { - printf("WQ simulation time = %d sec, step = %d sec.\n", stime, step); - - ENgetnodevalue(id, EN_QUALITY, &value); - printf("Node 184's quality = \t%f.\n", value); - ENgetnodevalue(id3, EN_QUALITY, &value); - printf("Node 199's quality = \t%f.\n", value); - } - } - ENcloseQ(); - ENclose(); - - - /* Sychronous solver (LemonTiger) */ - printf("\n\n*****LemonTiger results******\n\n"); - - if (err=ENopen(argv[1], argv[2], "")) return err; - - for (ENopeninitHQ(), tleft=Dur; tleft>0; ) { - - //ENrunstepHQ(&stime, &tleft); - ENrunnextHQ(&stime, &tleft); //well I know it should be tstep - - if (stime == TIME_A || stime == TIME_B || stime == TIME_C) { - //if (! (stime%1800)){ - printf("Simulation = %d sec, time left = %d sec.\n", stime, tleft); - ENgetnodevalue(id, EN_HEAD, &value); - printf("Node 184's head = \t%f.\n", value); - - ENgetnodevalue(id, EN_QUALITY, &value); - printf("Node 184's quality = \t%f.\n", value); - - ENgetnodevalue(id3, EN_HEAD, &value); - printf("Node 199's head = \t%f.\n", value); - - ENgetnodevalue(id3, EN_QUALITY, &value); - printf("Node 199's quality = \t%f.\n", value); - - ENgetlinkvalue(id2, EN_FLOW, &value); - printf("Link 101's flowrate = \t%f. \n", value); - - - printf("\n"); - } - } - ENcloseHQ(); - ENclose(); - - -} - -