Instead of changing block out status checking routine, water quality module considers pipe 'closed' status in the routine bypassing flow information just like tank volume changes.
This commit is contained in:
@@ -276,6 +276,9 @@
|
|||||||
/* Begin PBXProject section */
|
/* Begin PBXProject section */
|
||||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
LastUpgradeCheck = 0460;
|
||||||
|
};
|
||||||
buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "epanet" */;
|
buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "epanet" */;
|
||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
developmentRegion = English;
|
developmentRegion = English;
|
||||||
@@ -366,10 +369,10 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
EXECUTABLE_PREFIX = lib;
|
EXECUTABLE_PREFIX = lib;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
|
||||||
GCC_MODEL_TUNING = G5;
|
GCC_MODEL_TUNING = G5;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
@@ -383,6 +386,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
EXECUTABLE_PREFIX = lib;
|
EXECUTABLE_PREFIX = lib;
|
||||||
GCC_MODEL_TUNING = G5;
|
GCC_MODEL_TUNING = G5;
|
||||||
@@ -397,15 +401,19 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = macinclude;
|
HEADER_SEARCH_PATHS = macinclude;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PREBINDING = NO;
|
SDKROOT = macosx;
|
||||||
SDKROOT = macosx10.6;
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@@ -413,13 +421,17 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = macinclude;
|
HEADER_SEARCH_PATHS = macinclude;
|
||||||
PREBINDING = NO;
|
SDKROOT = macosx;
|
||||||
SDKROOT = macosx10.6;
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@@ -429,14 +441,12 @@
|
|||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
|
||||||
GCC_MODEL_TUNING = G5;
|
GCC_MODEL_TUNING = G5;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = CLE;
|
GCC_PREPROCESSOR_DEFINITIONS = CLE;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||||
INSTALL_PATH = /usr/local/bin;
|
INSTALL_PATH = /usr/local/bin;
|
||||||
PREBINDING = NO;
|
|
||||||
PRODUCT_NAME = runepanet;
|
PRODUCT_NAME = runepanet;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@@ -447,13 +457,11 @@
|
|||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
|
||||||
GCC_MODEL_TUNING = G5;
|
GCC_MODEL_TUNING = G5;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = CLE;
|
GCC_PREPROCESSOR_DEFINITIONS = CLE;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||||
INSTALL_PATH = /usr/local/bin;
|
INSTALL_PATH = /usr/local/bin;
|
||||||
PREBINDING = NO;
|
|
||||||
PRODUCT_NAME = runepanet;
|
PRODUCT_NAME = runepanet;
|
||||||
ZERO_LINK = NO;
|
ZERO_LINK = NO;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1668,9 +1668,8 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, float *value)
|
|||||||
case EN_FLOW:
|
case EN_FLOW:
|
||||||
|
|
||||||
/*** Updated 10/25/00 ***/
|
/*** Updated 10/25/00 ***/
|
||||||
//if (S[index] <= CLOSED) v = 0.0;
|
if (S[index] <= CLOSED) v = 0.0;
|
||||||
|
else v = Q[index]*Ucf[FLOW];
|
||||||
/*else*/ v = Q[index]*Ucf[FLOW];
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_VELOCITY:
|
case EN_VELOCITY:
|
||||||
|
|||||||
@@ -161,8 +161,9 @@ int savehyd(long *htime)
|
|||||||
/* Force flow in closed links to be zero then save flows */
|
/* Force flow in closed links to be zero then save flows */
|
||||||
for (i=1; i<=Nlinks; i++)
|
for (i=1; i<=Nlinks; i++)
|
||||||
{
|
{
|
||||||
//if (S[i] <= CLOSED) x[i] = 0.0f;
|
if (S[i] <= CLOSED) x[i] = 0.0f;
|
||||||
/*else*/ x[i] = (REAL4)Q[i];
|
else x[i] = (REAL4)Q[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
fwrite(x+1,sizeof(REAL4),Nlinks,HydFile);
|
fwrite(x+1,sizeof(REAL4),Nlinks,HydFile);
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ void initqual()
|
|||||||
if (Node[i].S != NULL) Node[i].S->Smass = 0.0;
|
if (Node[i].S != NULL) Node[i].S->Smass = 0.0;
|
||||||
|
|
||||||
QTankVolumes = calloc(Ntanks, sizeof(double)); // keep track of previous step's tank volumes.
|
QTankVolumes = calloc(Ntanks, sizeof(double)); // keep track of previous step's tank volumes.
|
||||||
|
QLinkFlow = calloc(Nlinks, sizeof(double)); // keep track of previous step's link flows.
|
||||||
|
|
||||||
/* Set WQ parameters */
|
/* Set WQ parameters */
|
||||||
Bucf = 1.0;
|
Bucf = 1.0;
|
||||||
@@ -230,10 +231,18 @@ int runqual(long *t)
|
|||||||
Htime = hydtime + hydstep;
|
Htime = hydtime + hydstep;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// stepwise
|
// stepwise calculation
|
||||||
for (int i=1; i<= Ntanks; ++i) {
|
for (int i=1; i<= Ntanks; ++i) {
|
||||||
QTankVolumes[i-1] = Tank[i].V;
|
QTankVolumes[i-1] = Tank[i].V;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i=1; i<= Nlinks; ++i)
|
||||||
|
{
|
||||||
|
if (S[i] <= CLOSED) {
|
||||||
|
QLinkFlow[i-1] = Q[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(errcode);
|
return(errcode);
|
||||||
@@ -256,9 +265,14 @@ int nextqual(long *tstep)
|
|||||||
|
|
||||||
/* Determine time step */
|
/* Determine time step */
|
||||||
*tstep = 0;
|
*tstep = 0;
|
||||||
hydstep = Htime - Qtime;
|
|
||||||
|
// hydstep = Htime - Qtime;
|
||||||
|
|
||||||
|
if (Htime <= Dur) hydstep = Htime - Qtime;
|
||||||
|
else hydstep = 0;
|
||||||
|
|
||||||
double *tankVolumes;
|
double *tankVolumes;
|
||||||
|
|
||||||
// if we're operating in stepwise mode, capture the tank levels so we can restore them later.
|
// if we're operating in stepwise mode, capture the tank levels so we can restore them later.
|
||||||
if (OpenHflag) {
|
if (OpenHflag) {
|
||||||
tankVolumes = calloc(Ntanks, sizeof(double));
|
tankVolumes = calloc(Ntanks, sizeof(double));
|
||||||
@@ -267,6 +281,7 @@ int nextqual(long *tstep)
|
|||||||
tankVolumes[i-1] = Tank[i].V;
|
tankVolumes[i-1] = Tank[i].V;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore the previous step's tank volumes
|
// restore the previous step's tank volumes
|
||||||
for (int i=1; i<=Ntanks; i++) {
|
for (int i=1; i<=Ntanks; i++) {
|
||||||
if (Tank[i].A != 0) { // skip reservoirs again
|
if (Tank[i].A != 0) { // skip reservoirs again
|
||||||
@@ -275,9 +290,16 @@ int nextqual(long *tstep)
|
|||||||
H[n] = tankgrade(i,Tank[i].V);
|
H[n] = tankgrade(i,Tank[i].V);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restore the previous step's pipe link flows
|
||||||
|
for (int i=1; i<=Nlinks; i++) {
|
||||||
|
if (S[i] <= CLOSED) {
|
||||||
|
Q[i] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Perform water quality routing over this time step */
|
/* Perform water quality routing over this time step */
|
||||||
if (Qualflag != NONE && hydstep > 0) transport(hydstep);
|
if (Qualflag != NONE && hydstep > 0) transport(hydstep);
|
||||||
|
|
||||||
@@ -298,6 +320,13 @@ int nextqual(long *tstep)
|
|||||||
H[n] = tankgrade(i,Tank[i].V);
|
H[n] = tankgrade(i,Tank[i].V);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i=1; i<=Nlinks; ++i) {
|
||||||
|
if (S[i] <= CLOSED) {
|
||||||
|
Q[i] = QLinkFlow[i-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(tankVolumes);
|
free(tankVolumes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,6 +398,7 @@ int closequal()
|
|||||||
free(R);
|
free(R);
|
||||||
free(XC);
|
free(XC);
|
||||||
free(QTankVolumes);
|
free(QTankVolumes);
|
||||||
|
free(QLinkFlow);
|
||||||
return(errcode);
|
return(errcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,8 +497,6 @@ void transport(long tstep)
|
|||||||
{
|
{
|
||||||
long qtime, dt;
|
long qtime, dt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Repeat until elapsed time equals hydraulic time step */
|
/* Repeat until elapsed time equals hydraulic time step */
|
||||||
|
|
||||||
AllocSetPool(SegPool); //(2.00.11 - LR)
|
AllocSetPool(SegPool); //(2.00.11 - LR)
|
||||||
@@ -485,7 +513,6 @@ void transport(long tstep)
|
|||||||
}
|
}
|
||||||
updatesourcenodes(tstep); /* Update quality at source nodes */
|
updatesourcenodes(tstep); /* Update quality at source nodes */
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
14
src/testLemonTiger.cpp
Normal file → Executable file
14
src/testLemonTiger.cpp
Normal file → Executable file
@@ -1,6 +1,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "testLemonTiger.h"
|
#include "testLemonTiger.h"
|
||||||
#include "toolkit.h"
|
#include "toolkit.h"
|
||||||
|
|
||||||
@@ -135,7 +137,7 @@ int main(int argc, char * argv[]) {
|
|||||||
|
|
||||||
|
|
||||||
// summarize the results
|
// summarize the results
|
||||||
//printResults(&epanetResults, &lemonTigerResults, cout);
|
printResults(&epanetResults, &lemonTigerResults, cout);
|
||||||
compare(&epanetResults, &lemonTigerResults, cout);
|
compare(&epanetResults, &lemonTigerResults, cout);
|
||||||
|
|
||||||
} catch (int err) {
|
} catch (int err) {
|
||||||
@@ -181,8 +183,10 @@ void printResults(result_t* results1, result_t* results2, std::ostream &out) {
|
|||||||
for (resultIterator = (*results1).begin(); resultIterator != (*results1).end(); ++resultIterator) {
|
for (resultIterator = (*results1).begin(); resultIterator != (*results1).end(); ++resultIterator) {
|
||||||
// get the current frame
|
// get the current frame
|
||||||
const long time = resultIterator->first;
|
const long time = resultIterator->first;
|
||||||
const networkNodeState_t nodeState1 = resultIterator->second.nodeState;
|
const networkNodeState_t networkNodeState1= resultIterator->second.nodeState;
|
||||||
const networkLinkState_t linkState1 = resultIterator->second.linkState;
|
//nodeState1 = resultIterator->second.nodeState;
|
||||||
|
const networkLinkState_t networkLinkState1 = resultIterator->second.linkState;
|
||||||
|
//linkState1 = resultIterator->second.linkState;
|
||||||
|
|
||||||
// see if this time is indexed in the second state container
|
// see if this time is indexed in the second state container
|
||||||
if ((*results2).find(time) == (*results2).end()) {
|
if ((*results2).find(time) == (*results2).end()) {
|
||||||
@@ -207,7 +211,7 @@ void printResults(result_t* results1, result_t* results2, std::ostream &out) {
|
|||||||
|
|
||||||
// loop through the nodes in the networkState objs, and print out the results for this time period
|
// loop through the nodes in the networkState objs, and print out the results for this time period
|
||||||
networkNodeState_t::const_iterator networkNodeIterator;
|
networkNodeState_t::const_iterator networkNodeIterator;
|
||||||
for (networkNodeIterator = nodeState1.begin(); networkNodeIterator != nodeState1.end(); ++networkNodeIterator) {
|
for (networkNodeIterator = networkNodeState1.begin(); networkNodeIterator != networkNodeState1.end(); ++networkNodeIterator) {
|
||||||
int nodeIndex = networkNodeIterator->first;
|
int nodeIndex = networkNodeIterator->first;
|
||||||
// trusting that all nodes are present...
|
// trusting that all nodes are present...
|
||||||
const nodeState_t nodeState1 = networkNodeIterator->second;
|
const nodeState_t nodeState1 = networkNodeIterator->second;
|
||||||
@@ -230,7 +234,7 @@ void printResults(result_t* results1, result_t* results2, std::ostream &out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
networkLinkState_t::const_iterator networkLinkIterator;
|
networkLinkState_t::const_iterator networkLinkIterator;
|
||||||
for (networkLinkIterator = linkState1.begin(); networkLinkIterator != linkState1.end(); ++networkLinkIterator) {
|
for (networkLinkIterator = networkLinkState1.begin(); networkLinkIterator != networkLinkState1.end(); ++networkLinkIterator) {
|
||||||
int linkIndex = networkLinkIterator->first;
|
int linkIndex = networkLinkIterator->first;
|
||||||
// trusting that all nodes are present...
|
// trusting that all nodes are present...
|
||||||
const linkState_t linkState1 = networkLinkIterator->second;
|
const linkState_t linkState1 = networkLinkIterator->second;
|
||||||
|
|||||||
0
src/testLemonTiger.h
Normal file → Executable file
0
src/testLemonTiger.h
Normal file → Executable file
@@ -154,6 +154,7 @@ AUTHOR: L. Rossman
|
|||||||
*XC; /* General Purpose array - WQ */
|
*XC; /* General Purpose array - WQ */
|
||||||
double *H; /* Node heads */
|
double *H; /* Node heads */
|
||||||
double *QTankVolumes;
|
double *QTankVolumes;
|
||||||
|
double *QLinkFlow; //woohn 03112013
|
||||||
STmplist *Patlist; /* Temporary time pattern list */
|
STmplist *Patlist; /* Temporary time pattern list */
|
||||||
STmplist *Curvelist; /* Temporary list of curves */
|
STmplist *Curvelist; /* Temporary list of curves */
|
||||||
Spattern *Pattern; /* Time patterns */
|
Spattern *Pattern; /* Time patterns */
|
||||||
|
|||||||
Reference in New Issue
Block a user