Update validate.c

Fixes false negative when checking if a tank's min/max levels fall within its volume curve (see issue #767 ).
This commit is contained in:
Lew Rossman
2024-03-19 14:38:47 -04:00
parent 6b72b0a21c
commit c24f334208

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: 01/25/2024 Last Updated: 03/18/2024
****************************************************************************** ******************************************************************************
*/ */
@@ -59,12 +59,13 @@ int validatetanks(Project *pr)
{ {
curve = &net->Curve[i]; curve = &net->Curve[i];
n = curve->Npts - 1; n = curve->Npts - 1;
if ((tank->Hmin - elev) * pr->Ucf[ELEV] < curve->X[0] || if ((tank->Hmin - elev) * pr->Ucf[ELEV] < curve->X[0] - TINY ||
(tank->Hmax - elev) * pr->Ucf[ELEV]> curve->X[n]) (tank->Hmax - elev) * pr->Ucf[ELEV] > curve->X[n] + TINY)
{ {
levelerr = 1; levelerr = 1;
} }
} }
// Report error in levels if found // Report error in levels if found
if (levelerr) if (levelerr)
{ {