Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening/parsing an uncompleted INP file with the Toolkit #746

Open
JPL-BELG opened this issue Aug 17, 2023 · 2 comments
Open

Opening/parsing an uncompleted INP file with the Toolkit #746

JPL-BELG opened this issue Aug 17, 2023 · 2 comments

Comments

@JPL-BELG
Copy link

I often need to open a INP text file including one or more “errors” (for example : models under construction with uncompleted data).

  1. When opening it in EPANET stand-alone, there is no problem to open and display it in the map even if the file is very uncompleted. Errors occur only when trying to run the model (errors can be seen in the report file).
  2. Using the toolkit, it seems that the only way to open the same INP file is to use the ENopen function. It immediately returns an error code. The error messages appearing in the report file are the same as in EPANET stand-alone. After that error message, it unfortunately seems impossible to use any other toolkit function to access data, such as ENgetnodevalue or any else function.
    I don’t believe that there are available parsing functions in the Toolkit to read INP files with errors. My question : is it not possible to let the ENopen function returning a warning code in place of an error code, letting the user access data even if they are not completed/fully correct?

Thank you for your opinion and advices.

@LRossman
Copy link
Collaborator

This is a relevant issue that was only partly addressed by issue #579 and PR #580. The ENopen function in v2.3 dev now allows a partly constructed network (i.e., with unconnected nodes and no tanks or reservoirs) to be accepted. But input files with other format errors, such as duplicate ID names, undefined link end nodes, missing parameter values or illegal numerical tokens, will still cause ENopen to fail. Here are some suggestions that would allow ENopen to accommodate such errors without failing (while writing an error message to the report file as is currently done):

  1. If an element has a duplicate ID it is not added to the database.
  2. If a link's end node ID doesn't exist then the link is not added to the database.
  3. If a node or link has an incomplete set of parameters or an invalid parameter value it is still added to the database but uses the default set of parameter values used by ENaddnode and ENaddlink.
  4. If an option is assigned an incorrect keyword or value then the internally defined default value is assigned to it.
  5. If a demand is assigned to a non-existent node or has a non-existent pattern then it is ignored.
  6. If an initial status/setting is assigned to a non-existent link or has an illegal value then it is ignored.
  7. If a pattern multiplier or curve data point have illegal values then they are ignored.
  8. If there is an error in a simple or rule-based control statement then the entire statement is ignored.

Again, each of these conditions would be flagged with a message added to the Status Report. Did I miss anything?

@JPL-BELG
Copy link
Author

Thanks @LRossman for the answer and comments. Sorry I didn’t see previous issues related to the same topic.

I sometimes encounter another case where an error can occur : when a custom section (enclosed in brackets) is present in the INP file with a keyword not allowed in EPANET (that can occur when I receive an INP file created by a third-party software creating a special section in its INP file format to store additional data).
“As usual”, EPANET opens the INP file (with a 201 error message) but ENOpen report 201 and 200 error codes and does not open it.

Example : imagine that you have additional data added to pumps inside an [ADP] section inserted just after the [PUMP] section in the INP file.

  1. Messages sent by EPANET when importing the INP file :
    Error 201 at line 3478:
    [PUMPS]
    [ADP]
  2. Messages sent by the Toolkit with ENOpen :
    Error 201: syntax error in [PUMPS] section:
    [ADP]
    Error 200: one or more errors in input file

Of course the extra-sections can be manually deleted but it is easier if the ENopen function could directly manage the issue.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants