-
Notifications
You must be signed in to change notification settings - Fork 134
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
added SWMM5 engine selector #78
Conversation
Also Covers #74 |
I think that this is not really a good solution in general :-\ The real need here is that people need to have the correct vs runtime. This is out of the scope for a python package, so this should be fixed by telling people on the readme to install the correct runtime for the specific version. |
@goanpeca, I'm not sure what you mean by correct vs runtime. Could you elaborate? This is sort of like matplotlib giving you the option to select a backend. My company has a version of swmm that has expanded capability beyond standard EPASWMM. I want the option to use either the SWMM that gets distributed with pyswmm or my company's version of swmm. |
Maybe I didn't describe what this is doing well enough. This let's you choose what swmm dll you want to use... Maybe you interpreted this as adding runtime libs to support the swmm.dll? Nope :-) If the user has a special version of swmm, they drop their version in the lib/windows folder and then call the 'pyswmm.lib.use("swmm5-extended")' |
@goanpeca this feature has lots of uses too. We can use pyswmm to run regression tests to compare old swmm engine output to new. The ability to choose an engine was an original request of @michaeltryby. |
@bemcdonnell One problem with using older engines of SWMM5 is that in some but not many cases the data on the line that has to be parsed is different. I do have good success with newer SWMM5 models in older versions but the SWMM5 inp file usually has to pass through the older version GUI to iron out inp problems. |
@dickinsonre, you certainly raise a good point. In your experience, how many versions back to SWMM5.0 would you say there has been consistency in the structure? Assuming we can get the correct structure in place for each respective model, unless the inflow equations change fundamentally, we should be able to understand and quantify the changes in engine behavior. At the same time, that might be a "risky" exercise. This discussion might be better suited for the SWMM repo |
I just tried a few of the older versions with a new inp file and you are okay going back to 5.0.020 at least but older version of SWMM5 had problems with the INFIL section and other sections and did run. The pascal uexport.pas code is available for all all versions so a universal exporter may be possible (if desired). |
@bemcdonnell I still don't understand how
If it is special and adds extra methods, well then the whole pyswmm needs to account for these extra stuff. For older versions, its similar but I can understand this use case better. |
@goanpeca, pyswmm is independent. No features will be added to pyswmm that will not work with the "common" distributed version of swmm with pyswmm. We have compiled the toolkit API into previous versions of swmm and want to take advantage of that. I see lots of value to this feature. This is also for the "power users". The discussion is not so much on "does this add value" but more so does the implementation fit with the project. Having moved most of the Mechanics to pyswmm.lib.init.py, I have enabled us to be able to plan for future OS/ARCH and Thererin allows you to use your version of swmm. One other great point. If you want to run your project in an older version of EPASWMM that does not have the toolkit API, the basic functionally will still work. "swmm_open" "swmm_run" have been standard entry points since swmm 5.0. My implementation here provides a much cleaner way to select which engine you want to use. All the paths are handled automagicaly as long as your version of swmm is sitting next to the binaries that come with pyswmm. |
Sure go ahead, was just asking to understand better ;-) |
pyswmm/lib/__init__.py
Outdated
|
||
# Platform Detection | ||
def _platform(): | ||
""" Folder based on platform """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Folder based on platform."""
pyswmm/lib/__init__.py
Outdated
class _DllPath(object): | ||
""" | ||
DllPath Object. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""DllPath Object."""
pyswmm/lib/__init__.py
Outdated
def dll_loc(self): | ||
"""Get/set DLL Name """ | ||
return self._dll_loc | ||
@dll_loc.setter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space here
pyswmm/lib/__init__.py
Outdated
""" | ||
def __init__(self): | ||
self._dll_loc = LIB_SWMM | ||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space here
pyswmm/lib/__init__.py
Outdated
self._dll_loc = LIB_SWMM | ||
@property | ||
def dll_loc(self): | ||
"""Get/set DLL Name """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Get/set DLL Name."""
pyswmm/lib/__init__.py
Outdated
return self._dll_loc | ||
@dll_loc.setter | ||
def dll_loc(self, value): | ||
"""Set DLL Name """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Set DLL Name."""
pyswmm/lib/__init__.py
Outdated
"""Set DLL Name """ | ||
self._dll_loc = value | ||
def __call__(self): | ||
""" """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
pyswmm/lib/__init__.py
Outdated
|
||
def use(arg): | ||
""" | ||
Set the SWMM5 DLL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the SWMM5 DLL.
(the period!)
Covers Issue #77
So put your DLL in the lib folder and run the following: