pyswmm / Stormwater-Management-Model

PySWMM Stormwater Management Model repository
Other
99 stars 77 forks source link

Improvements to CLI functionality #304

Closed michaeltryby closed 3 years ago

michaeltryby commented 3 years ago

It would be nice if the command line interface provided more meaningful information to the user about the progress of the simulation. I propose the following:

 \> ... Running [========================>                            ]  48.3% [   7.25s]

From left to right, this displays the current status, graphical and numerical representations of the percent completion, and a count down timer with a time to completion estimate. This functionality would require adding a callback to swmm_run().

Other improvements to the CLI can also be bundled in -- see Issue #151.

Just had an itch to do this. Any thoughts?

dickinsonre commented 3 years ago

Yes, this is a great idea but based on past experience the time to completion estimate can be problematical - especially with typical SCS Rainfall Distributions with flooding at hour 12 to hour 13.

michaeltryby commented 3 years ago

@dickinsonre good point. Could you share an SCS input with flooding that I could use for testing my time to completion estimate?

dickinsonre commented 3 years ago

Hello, @michaeltryby here is an example based on the classic Extran Examples (with hydrology), I used an SCS1 hyetograph with a total rainfall of 10 inches. It floods a lot around the 12 mark of the simulation.
SCS_Rainfall__Extran_Master_Hydrology.inp.txt

michaeltryby commented 3 years ago

@dickinsonre Thanks!

When I run it the progress bar hangs at 16% jumps to 67% and then completes. The time remaining estimate is < 1.00s and the simulation completes in 1.33s. Honestly, though my use case for this is simulations that run a very long time. The idea is to provide simple feedback to the user that the simulation is running successfully and provide a reasonable estimate when it will complete.

What you see in PR #305 is a first cut implementation. I didn't want to introduce threading to make the progress bar update more smooth. I am using a naive approach to estimate time remaining. I leave these on the table as improvements that can be made at a later time.