USEPA / SWMM-EPANET_User_Interface

User interface for the Stormwater-Management-Model
111 stars 67 forks source link

MTP5r1 example 5/6 crash during simulation #295

Closed schoeller closed 4 years ago

schoeller commented 5 years ago

Dear all,

thanks for making MTP5r1 happening. GUI is launching without error. Examples 1-6 are loading fine. Running example 1,2 is fine, example 3 is taking long for calculation, but finished. I would suggest to add a status feedback similar to

image

Example 4 finishes, example 5 and 6 crash without message. I have attached example 5/6.

Best regards

Sebastian examples5-6.zip

TongZhai commented 5 years ago

@schoeller per examples 5 and 6, it appears the models run to completion, but the program fails immediately afterwards. It failed when output api is accessing units (_get_units), sizes (_get_sizes), and/or times (_get_times). We would perhaps need to enlist @michaeltryby to look into this issue from the output api side. @michaeltryby if you get a chance, could you look at SMOutputSWIG.py to see if the swmm.output api is used correctly.

michaeltryby commented 5 years ago

@TongZhai Trying to debug this. I added unit tests to cover the functions you are calling in swmm.output. Everything seems fine.

I updated OSGeo4W in my development setup. I am trying to debug in PyCharm but running frmMainSWMM.py fails and Python is crashing all of the time.

When I run python from the command prompt I get the following message:

C:\Users\mtryby>where python
C:\OSGeo4W64\bin\python.exe
C:\OSGeo4W64\apps\Python37\python.exe

C:\Users\mtryby>python
  File "C:\OSGeo4W64\apps\Python37\lib\site.py", line 177
    file=sys.stderr)
        ^
SyntaxError: invalid syntax
michaeltryby commented 5 years ago

@TongZhai Looks like the the application is running SWMM v5.1.11. The Stormwater Calculator had a binary file bug related to v5.1.11. I wonder if this is related ...

The latest version of SWMM is v5.1.13. We should switch over to using the swmm.toolkit package to manage this dependency.

TongZhai commented 5 years ago

@michaeltryby I will check out the swmm.toolkit package, is it only for output?

michaeltryby commented 5 years ago

swmm.output is for output and swmm.toolkit is for the toolkit.

TongZhai commented 5 years ago

@michaeltryby so do you see this is an output api issue?

michaeltryby commented 5 years ago

@TongZhai I'm still investigating. Having trouble getting a handle on it cause I can't debug the application.

TongZhai commented 5 years ago

@michaeltryby did you use C:\OSGeo4W64\apps\Python37\python.exe as interpreter in PyCharm?

michaeltryby commented 5 years ago

@TongZhai Yes, I did configure PyCharm to use OSGeo4W Python37.

michaeltryby commented 5 years ago

@TongZhai I set up my environment according to the wiki. There are two different versions of Python on my path (Python 2.7 located in C:\OSGeo4W64\bin and Python 3.7 located in C:\OSGeo4W64\apps\Python37). The instructions say to configure PyCharm to use Python 2.7 but I thought we are supposed to be using Python 3.7. So I guess I'm confused. Which version should I be using?

TongZhai commented 5 years ago

definitely use Python3.7, I'll update the wiki.

michaeltryby commented 5 years ago

@TongZhai One of the problems seems to be that the instructions say to add C:\OSGeo4W64\bin to the path, but it contains Python 2.7 and Python 3.7.

michaeltryby commented 5 years ago

@TongZhai I determined the cause of the crash. It is a manifestation of a known Issue with version SWMM v5.1.11. Under certain circumstances it writes a binary file with an error in the format.

I diagnosed this bug by writing a test that makes the same calls as SMOutputSWIG.py. Then I generated two binary files, one using the SWMM UI v5.1.11 and the other using the SWMM command line tool for v5.1.13. When I ran the test on the v5.1.11 binary file it crashed and when I ran it on the v5.1.13 binary file it passed.

This bug can be fixed by updating the SWMM version currently bundled with the UI project. Something that needs to be done anyway.

michaeltryby commented 5 years ago

BTW still can't get the project running under the development environment. Python keeps crashing.

TongZhai commented 5 years ago

@michaeltryby thanks for debugging this. So, we will need a new _x64 dll for swmm5.1.13 then. Where do we get the latest?

For development environment failure, perhaps start a new thread and let's figure out why.

michaeltryby commented 5 years ago

@TongZhai Just grab the latest swmm.toolkit wheel and you should be good to go.

michaeltryby commented 5 years ago

@TongZhai I created a release containing the dlls for your convenience.

TongZhai commented 5 years ago

@michaeltryby I've downloaded the latest swmm5.dll from the release from your link and used it in the program, now other example inputs are failing as well. It is failing at the same place, i.e. SWMMOutputObject's _get_units() function. Again, I noticed that same delay effect, means that if I break right before output file access and wait for a few moment, it will pass, but it will fail at run time, almost seems that the output file is not ready to be read immediately after model finishes execution.

michaeltryby commented 5 years ago

@TongZhai sorry to hear that. I was hoping that upgrading would do the trick. Will have a look Monday.

michaeltryby commented 5 years ago

@TongZhai I have confirmed that the UI is still crashing with the updated version of the swmm5.dll. It is very difficult to debug this since I am not able to get my development environment up and running in PyCharm. I opened up Issue #296 describing the problem.

michelleannesimon commented 5 years ago

I also tested the six examples, 1-4 ran, 5&6 had successful runs but the circle continued to churn and eventually, I got this screen:

image

TongZhai commented 4 years ago

This issue is resolved via update to swmm output api, see #310