more stepwise mods
This commit is contained in:
@@ -56,13 +56,6 @@
|
|||||||
remoteGlobalIDString = D2AAC0620554660B00DB518D;
|
remoteGlobalIDString = D2AAC0620554660B00DB518D;
|
||||||
remoteInfo = epanet;
|
remoteInfo = epanet;
|
||||||
};
|
};
|
||||||
22EF555816BC7FCC00F3988A /* PBXContainerItemProxy */ = {
|
|
||||||
isa = PBXContainerItemProxy;
|
|
||||||
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
|
|
||||||
proxyType = 1;
|
|
||||||
remoteGlobalIDString = D2AAC0620554660B00DB518D;
|
|
||||||
remoteInfo = epanet;
|
|
||||||
};
|
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
@@ -256,7 +249,6 @@
|
|||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
22EF555916BC7FCC00F3988A /* PBXTargetDependency */,
|
|
||||||
);
|
);
|
||||||
name = TestLemonTiger;
|
name = TestLemonTiger;
|
||||||
productName = TestLemonTiger;
|
productName = TestLemonTiger;
|
||||||
@@ -364,11 +356,6 @@
|
|||||||
target = D2AAC0620554660B00DB518D /* epanet */;
|
target = D2AAC0620554660B00DB518D /* epanet */;
|
||||||
targetProxy = 22322FAF1068370B00641384 /* PBXContainerItemProxy */;
|
targetProxy = 22322FAF1068370B00641384 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
22EF555916BC7FCC00F3988A /* PBXTargetDependency */ = {
|
|
||||||
isa = PBXTargetDependency;
|
|
||||||
target = D2AAC0620554660B00DB518D /* epanet */;
|
|
||||||
targetProxy = 22EF555816BC7FCC00F3988A /* PBXContainerItemProxy */;
|
|
||||||
};
|
|
||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
/* Begin XCBuildConfiguration section */
|
||||||
|
|||||||
@@ -1049,14 +1049,23 @@ void tanklevels(long tstep)
|
|||||||
|
|
||||||
/* Update the tank's volume & water elevation */
|
/* Update the tank's volume & water elevation */
|
||||||
n = Tank[i].Node;
|
n = Tank[i].Node;
|
||||||
dv = D[n]*tstep;
|
|
||||||
Tank[i].V += dv;
|
// only adjust tank volume if we're in sequential mode.
|
||||||
|
// otherwise, the tankmixing function will do it for us.
|
||||||
|
if (!OpenQflag) {
|
||||||
|
dv = D[n]*tstep;
|
||||||
|
Tank[i].V += dv;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Updated 6/24/02 ***/
|
/*** Updated 6/24/02 ***/
|
||||||
/* Check if tank full/empty within next second */
|
/* 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].Vmax) {
|
||||||
if (Tank[i].V - D[n] <= Tank[i].Vmin) Tank[i].V = Tank[i].Vmin;
|
Tank[i].V = Tank[i].Vmax;
|
||||||
|
}
|
||||||
|
else if (Tank[i].V - D[n] <= Tank[i].Vmin) {
|
||||||
|
Tank[i].V = Tank[i].Vmin;
|
||||||
|
}
|
||||||
|
|
||||||
H[n] = tankgrade(i,Tank[i].V);
|
H[n] = tankgrade(i,Tank[i].V);
|
||||||
}
|
}
|
||||||
} /* End of tanklevels */
|
} /* End of tanklevels */
|
||||||
|
|||||||
@@ -1005,21 +1005,28 @@ void updatetanks(long dt)
|
|||||||
/* Examine each reservoir & tank */
|
/* Examine each reservoir & tank */
|
||||||
for (i=1; i<=Ntanks; i++)
|
for (i=1; i<=Ntanks; i++)
|
||||||
{
|
{
|
||||||
|
n = Tank[i].Node;
|
||||||
|
|
||||||
/* Use initial quality for reservoirs */
|
/* Use initial quality for reservoirs */
|
||||||
if (Tank[i].A == 0.0)
|
if (Tank[i].A == 0.0)
|
||||||
{
|
{
|
||||||
n = Tank[i].Node;
|
|
||||||
C[n] = Node[n].C0;
|
C[n] = Node[n].C0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update tank WQ based on mixing model */
|
/* Update tank WQ based on mixing model */
|
||||||
else switch(Tank[i].MixModel)
|
else {
|
||||||
{
|
switch(Tank[i].MixModel)
|
||||||
case MIX2: tankmix2(i,dt); break;
|
{
|
||||||
case FIFO: tankmix3(i,dt); break;
|
case MIX2: tankmix2(i,dt); break;
|
||||||
case LIFO: tankmix4(i,dt); break;
|
case FIFO: tankmix3(i,dt); break;
|
||||||
default: tankmix1(i,dt); break;
|
case LIFO: tankmix4(i,dt); break;
|
||||||
|
default: tankmix1(i,dt); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're operating in stepwise mode, we'll need to update tank head conditions
|
||||||
|
if (OpenHflag) {
|
||||||
|
H[n] = tankgrade(i,Tank[i].V);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1076,10 +1083,7 @@ void tankmix1(int i, long dt)
|
|||||||
/* Determine tank & volumes */
|
/* Determine tank & volumes */
|
||||||
vold = Tank[i].V;
|
vold = Tank[i].V;
|
||||||
n = Tank[i].Node;
|
n = Tank[i].Node;
|
||||||
if (!OpenHflag) {
|
Tank[i].V += D[n]*dt;
|
||||||
Tank[i].V += D[n]*dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
vin = VolIn[n];
|
vin = VolIn[n];
|
||||||
|
|
||||||
/* Compute inflow concen. */
|
/* Compute inflow concen. */
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void checkErr(int err, std::string function);
|
void checkErr(int err, std::string function);
|
||||||
void stats();
|
void hydStats();
|
||||||
|
void qualStats();
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ int main(int argc, char * argv[]) {
|
|||||||
checkErr( ENrunH(&simulationTime), "ENrunH" );
|
checkErr( ENrunH(&simulationTime), "ENrunH" );
|
||||||
checkErr( ENnextH(&nextEventH), "ENnextH" );
|
checkErr( ENnextH(&nextEventH), "ENnextH" );
|
||||||
|
|
||||||
stats();
|
hydStats();
|
||||||
|
|
||||||
// gather hydraulic results
|
// gather hydraulic results
|
||||||
|
|
||||||
@@ -51,23 +52,11 @@ int main(int argc, char * argv[]) {
|
|||||||
checkErr( ENinitQ(EN_SAVE), "ENinitQ" );
|
checkErr( ENinitQ(EN_SAVE), "ENinitQ" );
|
||||||
|
|
||||||
do {
|
do {
|
||||||
//long htime;
|
|
||||||
|
|
||||||
//ENgettimeparam(EN_HTIME, &htime);
|
|
||||||
//cout << "Htime = " << htime << endl;
|
|
||||||
|
|
||||||
checkErr( ENrunQ(&simulationTime), "ENrunQ" );
|
checkErr( ENrunQ(&simulationTime), "ENrunQ" );
|
||||||
|
|
||||||
//ENgettimeparam(EN_HTIME, &htime);
|
|
||||||
//cout << "Htime = " << htime << endl;
|
|
||||||
|
|
||||||
checkErr( ENnextQ(&nextEventH), "ENstepQ" );
|
checkErr( ENnextQ(&nextEventH), "ENstepQ" );
|
||||||
|
|
||||||
//ENgettimeparam(EN_HTIME, &htime);
|
qualStats();
|
||||||
//cout << "Htime = " << htime << endl;
|
|
||||||
|
|
||||||
// wq results
|
|
||||||
//cout << simulationTime << "\t\t" << nextEventH << endl;
|
|
||||||
|
|
||||||
} while (nextEventH > 0);
|
} while (nextEventH > 0);
|
||||||
// water quality is done
|
// water quality is done
|
||||||
@@ -85,7 +74,7 @@ int main(int argc, char * argv[]) {
|
|||||||
/* stepwise solver (LemonTiger) */
|
/* stepwise solver (LemonTiger) */
|
||||||
cout << "*****LemonTiger results******" << endl;
|
cout << "*****LemonTiger results******" << endl;
|
||||||
|
|
||||||
checkErr( ENopen(argv[1], argv[2], "out2.bin"), "ENopen" );
|
checkErr( ENopen(argv[1], argv[2], (char*)"out2.bin"), "ENopen" );
|
||||||
|
|
||||||
checkErr( ENopenH(), "ENopenH" );
|
checkErr( ENopenH(), "ENopenH" );
|
||||||
checkErr( ENinitH(EN_NOSAVE), "ENinitH" );
|
checkErr( ENinitH(EN_NOSAVE), "ENinitH" );
|
||||||
@@ -105,7 +94,8 @@ int main(int argc, char * argv[]) {
|
|||||||
checkErr( ENnextH(&nextEventH), "ENnextH" );
|
checkErr( ENnextH(&nextEventH), "ENnextH" );
|
||||||
checkErr( ENnextQ(&nextEventQ), "ENstepQ" );
|
checkErr( ENnextQ(&nextEventQ), "ENstepQ" );
|
||||||
|
|
||||||
stats();
|
//hydStats();
|
||||||
|
qualStats();
|
||||||
|
|
||||||
// wq results
|
// wq results
|
||||||
//cout << simulationTime << "\t\t" << nextEventH << endl;
|
//cout << simulationTime << "\t\t" << nextEventH << endl;
|
||||||
@@ -126,14 +116,24 @@ int main(int argc, char * argv[]) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void stats() {
|
void hydStats() {
|
||||||
long htime;
|
long htime;
|
||||||
int nodeIndex;
|
int nodeIndex;
|
||||||
float head, volume;
|
float head;
|
||||||
ENgettimeparam(EN_HTIME, &htime);
|
ENgettimeparam(EN_HTIME, &htime);
|
||||||
ENgetnodeindex((char*)"1", &nodeIndex);
|
ENgetnodeindex((char*)"1", &nodeIndex);
|
||||||
ENgetnodevalue(nodeIndex, EN_HEAD, &head);
|
ENgetnodevalue(nodeIndex, EN_HEAD, &head);
|
||||||
cout << htime << "\t\t" << head << endl;
|
cout << htime << "\t\th = " << head << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void qualStats() {
|
||||||
|
long htime;
|
||||||
|
int nodeIndex;
|
||||||
|
float quality;
|
||||||
|
ENgettimeparam(EN_HTIME, &htime);
|
||||||
|
ENgetnodeindex((char*)"1", &nodeIndex);
|
||||||
|
ENgetnodevalue(nodeIndex, EN_QUALITY, &quality);
|
||||||
|
cout << htime << "\t\tc = " << quality << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ Link 330 OPEN IF Node 1 ABOVE 19.1
|
|||||||
[QUALITY]
|
[QUALITY]
|
||||||
;Node InitQual
|
;Node InitQual
|
||||||
|
|
||||||
|
|
||||||
[SOURCES]
|
[SOURCES]
|
||||||
;Node Type Quality Pattern
|
;Node Type Quality Pattern
|
||||||
|
|
||||||
@@ -331,7 +332,7 @@ Link 330 OPEN IF Node 1 ABOVE 19.1
|
|||||||
;Tank Model
|
;Tank Model
|
||||||
|
|
||||||
[TIMES]
|
[TIMES]
|
||||||
Duration 6:00
|
Duration 24:00
|
||||||
Hydraulic Timestep 1:00
|
Hydraulic Timestep 1:00
|
||||||
Quality Timestep 0:05
|
Quality Timestep 0:05
|
||||||
Pattern Timestep 1:00
|
Pattern Timestep 1:00
|
||||||
|
|||||||
Reference in New Issue
Block a user