Stormwater-Management-Model icon indicating copy to clipboard operation
Stormwater-Management-Model copied to clipboard

Allow users to save hotstart files for specified times

Open cbuahin opened this issue 2 years ago • 13 comments

Currently, hotstart files are saved at the simulation end time. There are several application instances where one might want to save hotstart files for specific times within a simulation period. An optional time field is to be appended to the save hotstart file section that will indicate the time to persist model state.

cbuahin avatar Nov 09 '23 16:11 cbuahin

@cbuahin as you know, I just implemented that in SWMM for pyswmm. Have you all figured out how I could submit a pull request and get this work acknowledged?

bemcdonnell avatar Nov 09 '23 16:11 bemcdonnell

@bemcdonnell, unfortunately, we are still working through the process of allowing external contributions. We do not have approval as of yet. This feature is, however, sorely needed in some of our internal research and is a feature that has been requested by users very often. If we are to implement it, we could cite/acknowledge pyswmm's/your efforts in this area if we adopt the same or similar code. I am all for giving folks credit for ideas and contributions.

cbuahin avatar Nov 09 '23 16:11 cbuahin

@cbuahin that would be greatly appreciated. That seems like a positive step! Code, like journal published research, can easily be treated equally. :-)

bemcdonnell avatar Nov 09 '23 16:11 bemcdonnell

I need to add that SWMM's code will remain in the public domain.

cbuahin avatar Nov 09 '23 17:11 cbuahin

Finished the multiple hotstart implementation and would welcome inputs/suggestions.

cbuahin avatar Jan 25 '24 16:01 cbuahin

Speaking from my personal experience and what I hear from coworkers, I don't see the value of this feature. It is already possibly to save a hotstart at any point within a simulation using File | Export | Hot Start in the GUI. It sounds reasonably harmless to add a similar feature to the engine, but at the cost of added complexity for what seems to me a highly esoteric feature.

MitchHeineman avatar Jan 25 '24 16:01 MitchHeineman

I appreciate your insights Mitch. Others have expressed a different opinion. The File | Export | Hot Start feature exports the state at the end of the simulation and is therefore a different feature. From my own experience in developing real-time applications and optimization applications, this feature will be invaluable in generating initial conditions for different events in one go. The only added complexity is specifying the timestamp to save the hotstart in the GUI. If not specified, the hotstart is saved at the end of simulation.

cbuahin avatar Jan 25 '24 16:01 cbuahin

@cbuahin how does it look in the INP?

bemcdonnell avatar Jan 25 '24 17:01 bemcdonnell

@bemcdonnell, great question. I have attached an example snippet.

[FILES]
;;Interfacing Files
SAVE HOTSTART "tests1.hsf"  01/01/2024  02:00:00
SAVE HOTSTART "tests2.hsf"  01/01/2024  04:00:00
SAVE HOTSTART "tests3.hsf"  
USE  HOTSTART "tests4.hsf"

cbuahin avatar Jan 25 '24 17:01 cbuahin

@cbuahin nice. That’s exactly what I was imaging you’d do. Good work!

bemcdonnell avatar Jan 25 '24 17:01 bemcdonnell

@cbuahin I don't really have a strong opinion on the matter, but I think you're mistaken about the hot start save feature in the GUI. I haven't checked the Delphi code but have used the feature a bit and am pretty sure it saves at the current timestep shown in the Map panel. This concurs with the User's Manual, which states (emphasis added) "One can also use the File >> Export >> Hot Start File Main Menu command to save the results of a current run at any particular time period to a hot start file. However, in this case only the results for nodes, links and groundwater elevation will be saved."

MitchHeineman avatar Jan 25 '24 18:01 MitchHeineman

@MitchHeineman, you are absolutely right. I have checked the code and it does indeed write at the current timestep but without the comprehensive list of variables from the engine. I am learning new things about SWMM each day.

cbuahin avatar Jan 25 '24 18:01 cbuahin

Yes, that has been a limitation for SWMM5. The intermediate hsf file is not as complete as the ending hsf file and is does get saved at current time step in the Map dialog.

dickinsonre avatar Jan 26 '24 23:01 dickinsonre