Merge pull request #750 from OpenWaterAnalytics/dev-trace_node_fix

Fix trace node id parser error
This commit is contained in:
Lew Rossman
2023-09-11 18:43:04 -04:00
committed by GitHub
3 changed files with 9 additions and 11 deletions

View File

@@ -44,4 +44,5 @@ This document describes the changes and updates that have been made in version 2
- Only non-zero demands are now included in the `[DEMANDS]` section of the input file produced by `EN_saveinpfile`.
- `EN_SET_CLOSED` and `EN_SET_OPEN` constants were added that can be used with `EN_setcontrol` to fix the status of pipes and valves to completely closed or completely open.
- `EN_EMITTERFLOW` can now be used with `EN_getnodevalue` to retrieve a node's emitter flow rate.
- `EN_STATUS_REPORT` can now be used with `EN_getoption` and `EN_setoption` to get or set the type of status report that EPANET will generate (`EN_NO_REPORT`, `EN_NORMAL_REPORT` or `EN_FULL_REPORT`).
- `EN_STATUS_REPORT` can now be used with `EN_getoption` and `EN_setoption` to get or set the type of status report that EPANET will generate (`EN_NO_REPORT`, `EN_NORMAL_REPORT` or `EN_FULL_REPORT`).
- A possible parser error that could result in a Trace Node ID in an input file not being recognized was fixed.

View File

@@ -3,7 +3,7 @@ unit epanet2;
{ Declarations of imported procedures from the EPANET PROGRAMMERs TOOLKIT }
{ (EPANET2.DLL) }
{Last updated on 05/13/2023}
{Last updated on 09/11/2023}
interface
@@ -12,9 +12,9 @@ const
{ These are codes used by the DLL functions }
EN_MAXID = 31; { Max. # characters in ID name }
EN_MAXMSG = 255; { Max. # characters in strings }
EN_MISSING = -1.E10;
EN_SET_CLOSED = -1.E10;
EN_SET_OPEN = 1.E10;
EN_MISSING = -1.0E10;
EN_SET_CLOSED = -1.0E10;
EN_SET_OPEN = 1.0E10;
EN_ELEVATION = 0; { Node parameters }
EN_BASEDEMAND = 1;
@@ -271,8 +271,8 @@ const
EN_R_IS_CLOSED = 2;
EN_R_IS_ACTIVE = 3;
{$ifdef WINDOWS}
EpanetLib = 'epanet2.dll';
{$ifdef MSWINDOWS}
EpanetLib = 'epanet2.dll';
{$else}
EpanetLib = 'libepanet2.so';
{$endif}

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: 02/05/2023
Last Updated: 09/11/2023
******************************************************************************
*/
@@ -1842,10 +1842,7 @@ int optionchoice(Project *pr, int n)
}
if (qual->Qualflag == TRACE)
{
// Copy Trace Node ID to parser->Tok[0] for error reporting
strcpy(parser->Tok[0], "");
if (n < 2) return 201;
strcpy(parser->Tok[0], parser->Tok[2]);
qual->TraceNode = findnode(net, parser->Tok[2]);
if (qual->TraceNode == 0) return setError(parser, 2, 212);
strncpy(qual->ChemName, u_PERCENT, MAXID);