Add emitter backflow option

Adds a global hydraulic option to allow backflow or not through emitter elements. To maintain backward compatibility the default is YES.
This commit is contained in:
Lew Rossman
2023-02-05 15:16:20 -05:00
parent 9814564e29
commit 847fa82139
13 changed files with 55 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ Description: parses network data from a line of an EPANET input file
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 08/13/2022
Last Updated: 02/05/2023
******************************************************************************
*/
@@ -25,6 +25,7 @@ Last Updated: 08/13/2022
extern char *MixTxt[];
extern char *Fldname[];
extern char *DemandModelTxt[];
extern char *BackflowTxt[];
// Exported functions
int powercurve(double, double, double, double, double, double *, double *,
@@ -1759,6 +1760,7 @@ int optionchoice(Project *pr, int n)
** UNBALANCED STOP/CONTINUE {Niter}
** PATTERN id
** DEMAND MODEL DDA/PDA
** EMITTER BACKFLOW YES/NO
**--------------------------------------------------------------
*/
{
@@ -1896,6 +1898,16 @@ int optionchoice(Project *pr, int n)
if (choice < 0) return setError(parser, 2, 213);
hyd->DemandModel = choice;
}
// EMITTER BACKFLOW
else if (match(parser->Tok[0], w_EMITTER))
{
if (n < 2) return 0;
if (!match(parser->Tok[1], w_BACKFLOW)) return -1;
choice = findmatch(parser->Tok[2], BackflowTxt);
if (choice < 0) return setError(parser, 2, 213);
hyd->EmitBackFlag = choice;
}
// Return -1 if keyword did not match any option
else return -1;