Merge pull request #768 from OpenWaterAnalytics/dev-tank_validation_bug_fix

Update validate.c
This commit is contained in:
Lew Rossman
2024-01-25 12:34:20 -05:00
committed by GitHub

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE License: see LICENSE
Last Updated: 09/28/2023 Last Updated: 01/25/2024
****************************************************************************** ******************************************************************************
*/ */
@@ -38,6 +38,7 @@ int validatetanks(Project *pr)
char errmsg[MAXMSG+1] = ""; char errmsg[MAXMSG+1] = "";
Stank *tank; Stank *tank;
Scurve *curve; Scurve *curve;
double elev;
for (j = 1; j <= net->Ntanks; j++) for (j = 1; j <= net->Ntanks; j++)
{ {
@@ -52,13 +53,14 @@ int validatetanks(Project *pr)
) levelerr = 1; ) levelerr = 1;
// Check that tank heights are within volume curve // Check that tank heights are within volume curve
elev = net->Node[tank->Node].El;
i = tank->Vcurve; i = tank->Vcurve;
if (i > 0) if (i > 0)
{ {
curve = &net->Curve[i]; curve = &net->Curve[i];
n = curve->Npts - 1; n = curve->Npts - 1;
if (tank->Hmin * pr->Ucf[ELEV] < curve->X[0] || if ((tank->Hmin - elev) * pr->Ucf[ELEV] < curve->X[0] ||
tank->Hmax * pr->Ucf[ELEV]> curve->X[n]) (tank->Hmax - elev) * pr->Ucf[ELEV]> curve->X[n])
{ {
levelerr = 1; levelerr = 1;
} }