lsmatott / ostrich-swmm

A toolset for connecting the OSTRICH optimization software toolkit with the SWMM simulation model.
GNU General Public License v2.0
32 stars 19 forks source link

Update to use pyswmm #30

Open bemcdonnell opened 2 years ago

bemcdonnell commented 2 years ago

Hey all,

I was just poking around your repo this morning and I think I can help. I'd be happy to help migrate the core to use PySWMM. This would ease the cross-platform / cross architecture compatibility. Rather than the user declaring the path to SWMM to run on the command line, pyswmm (and a small wrapper which I propose to add to your repo) would manage the simulations. PySWMM is already cross-platform/arch friendly. Furthermore, the way I am proposing to implement it still uses the subprocess which inherently covers SWMM's lack of thread-safety limitations.

This proposal would effect the following lines of your code base:

https://github.com/ubccr/ostrich-swmm/blob/b55c59e2ebe4454ce48db65e71e782b8ecfdb520/ostrich_swmm/run.py#L36-L40

Also, I would add a file call pyswmm_wrapper.py which is what I provided to swmmio this morning. Have a look at this new module. This change in SWMMIO solves the exact same problem you have in OSTRICH-SWMM.

https://github.com/bemcdonnell/swmmio/blob/725330bb81665f738f19d679fffdaeefabdddd76/swmmio/wrapper/pyswmm_wrapper.py#L22-L63

Let me know if this is something you'd be open to these changes and I can make them! It would be a pretty straight-forward thing to do and it would not compromise the underlying tool.

@kmmacro, HI!

lsmatott commented 2 years ago

Hi Bryant,

That would be great! Also great if you could provide some GI examples that could be used in PySWMM documentation. Think we only have examples for rain barrel and porous pavement at the moment.

Thanks,

--- Shawn

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Bryant E. McDonnell @.> Sent: Wednesday, September 28, 2022 6:49:58 AM To: ubccr/ostrich-swmm @.> Cc: Subscribed @.***> Subject: [ubccr/ostrich-swmm] Update to use pyswmm (Issue #30)

Hey all,

I was just poking around your repo this morning and I think I can help. I'd be happy to help migrate the core to use PySWMM. This would ease the cross-platform / cross architecture compatibility. Rather than the user declaring the path to SWMM to run on the command line, pyswmm (and a small wrapper which I propose to add to your repo) would manage the simulations. PySWMM is already cross-platform/arch friendly. Furthermore, the way I am proposing to implement it still uses the subprocess which inherently covers SWMM's lack of thread-safety limitations.

This proposal would effect the following lines of your code base:

https://github.com/ubccr/ostrich-swmm/blob/b55c59e2ebe4454ce48db65e71e782b8ecfdb520/ostrich_swmm/run.py#L36-L40https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fubccr%2Fostrich-swmm%2Fblob%2Fb55c59e2ebe4454ce48db65e71e782b8ecfdb520%2Fostrich_swmm%2Frun.py%23L36-L40&data=05%7C01%7Clsmatott%40buffalo.edu%7Cb6f830d467214e2c48ac08daa13f30bf%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637999590032358387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VHsAuZZy058ofMyUhh2LfCylkHkj%2FRq6%2FWae6PJWrwM%3D&reserved=0

Also, I would add a file call pyswmm_wrapper.py which is what I provided to swmmio this morning. Have a look at this new module. This change in SWMMIO solves the exact same problem you have in OSTRICH-SWMM.

https://github.com/bemcdonnell/swmmio/blob/725330bb81665f738f19d679fffdaeefabdddd76/swmmio/wrapper/pyswmm_wrapper.py#L22-L63https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbemcdonnell%2Fswmmio%2Fblob%2F725330bb81665f738f19d679fffdaeefabdddd76%2Fswmmio%2Fwrapper%2Fpyswmm_wrapper.py%23L22-L63&data=05%7C01%7Clsmatott%40buffalo.edu%7Cb6f830d467214e2c48ac08daa13f30bf%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637999590032358387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jzRmvkBOXWMDLgJErtU5iH6MhG%2FhmWDf3gkJS46H7Ig%3D&reserved=0

Let me know if this is something you'd be open to these changes and I can make them! It would be a pretty straight-forward thing to do and it would not compromise the underlying tool.

@kmmacrohttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkmmacro&data=05%7C01%7Clsmatott%40buffalo.edu%7Cb6f830d467214e2c48ac08daa13f30bf%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637999590032358387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tFLNKXYuc%2BydWHnoZAvx3CtYOyAs%2B81rXyDM7wIUjI0%3D&reserved=0, HI!

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fubccr%2Fostrich-swmm%2Fissues%2F30&data=05%7C01%7Clsmatott%40buffalo.edu%7Cb6f830d467214e2c48ac08daa13f30bf%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637999590032358387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=czv5FKNmZkdSc6MY3nGHEVffmm563rCgOKELhqgCcFo%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB6LJVCVT6GBU4PLZJG6763WAQPFNANCNFSM6AAAAAAQXUWHLM&data=05%7C01%7Clsmatott%40buffalo.edu%7Cb6f830d467214e2c48ac08daa13f30bf%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637999590032358387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=J0Aq4hrigeOEkg5ECz7a4uW%2Fo4g8K3xFfOajgoJQb%2BU%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>