Adds tank overflow feature

This commit is contained in:
Lew Rossman
2019-06-17 09:16:04 -04:00
parent fe92a99554
commit 9669742ab3
7 changed files with 151 additions and 7 deletions

View File

@@ -138,7 +138,8 @@ int tankdata(Project *pr)
int i, // Node index
n, // # data items
pattern = 0, // Time pattern index
curve = 0; // Curve index
curve = 0, // Curve index
overflow = FALSE;// Overflow indicator
double el = 0.0, // Elevation
initlevel = 0.0, // Initial level
minlevel = 0.0, // Minimum level
@@ -185,12 +186,20 @@ int tankdata(Project *pr)
if (n >= 7 && !getfloat(parser->Tok[6], &minvol)) return setError(parser, 6, 202);
// If volume curve supplied check it exists
if (n == 8)
if (n >= 8)
{
curve = findcurve(net, parser->Tok[7]);
if (curve == 0) return setError(parser, 7, 206);
net->Curve[curve].Type = VOLUME_CURVE;
if (strlen(parser->Tok[7]) > 0 && *(parser->Tok[7]) != '*')
{
curve = findcurve(net, parser->Tok[7]);
if (curve == 0) return setError(parser, 7, 206);
net->Curve[curve].Type = VOLUME_CURVE;
}
}
// Parse overflow indicator if present
if (n >= 9 && match(parser->Tok[8], w_YES))
overflow = TRUE;
if (initlevel < 0.0) return setError(parser, 2, 209);
if (minlevel < 0.0) return setError(parser, 3, 209);
if (maxlevel < 0.0) return setError(parser, 4, 209);
@@ -216,6 +225,7 @@ int tankdata(Project *pr)
tank->A = diam;
tank->Pat = pattern;
tank->Kb = MISSING;
tank->CanOverflow = overflow;
//*******************************************************************
// NOTE: The min, max, & initial volumes set here are based on a