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

Adding Hot Start File save-during-simulation feature #393

Merged
merged 10 commits into from
Jul 13, 2023

Conversation

bemcdonnell
Copy link
Member

Closes #253, Finally!

Replaces #252. I took the work for @jsadler2 and finally retooled it to bring it in to SWMM.

With this feature the users can save a HSF any time during a simulation.

@jsadler2
Copy link

Wow! I'm truly impressed you kept this alive and finally finished it after this long, @bemcdonnell!

@bemcdonnell
Copy link
Member Author

@jsadler2 trying to increase my follower count on GitHub… hahaha

@abhiramm7
Copy link
Collaborator

@bemcdonnell looks like the Mac tests are not running. We might have to revert back to the 10.14 version.

@bemcdonnell bemcdonnell requested a review from abhiramm7 June 17, 2023 00:28
@bemcdonnell
Copy link
Member Author

@abhiramm7 thanks! Once I get review from @karosc ill merge!

@@ -412,6 +412,75 @@ EXPORT_TOOLKIT int swmm_getSimulationParam(SM_SimSetting type, double *value)
return error_code;
}

EXPORT_TOOLKIT int DLLEXPORT swmm_hotstart(SM_HotStart type, const char *hsfile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove DLLEXPORT from the function declaration for this to work with the SWIG wrapper.

char fl_name[MAXFNAME];
sstrncpy(fl_name, hsfile, MAXFNAME);
Fhotstart1.mode = USE_FILE;
sstrncpy(Fhotstart1.name, addAbsolutePath(fl_name), MAXFNAME);
Copy link
Member

@karosc karosc Jul 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • When saving a hotstart, addAbsolutePath is not used...so the hotstart path is relative to the current working directory (CWD).

  • When using a hotstart, addAbsolutePath IS used...so the hotstart path becomes relative to the inp file.

This discontinuity might be confusing to users who run a pyswmm model using an input file that is not in the CWD, you'd need to either always use an absolute path to reference the HSF, or change how to reference the path to the HSF depending on whether your SAVING or USING.

I think when using the API, it makes more prescribe paths relative to the CWD, so I'd consider removing addAbsolutePath.

@bemcdonnell
Copy link
Member Author

Inspired by @jsadler2 many years ago.. It's finally time to merge it in! This feature could really change how we perform model calibrations and I am really excited to see it in action!

@bemcdonnell bemcdonnell merged commit 6e092a1 into develop Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants