Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

setting Subcatchment Parameters for calibration purposes #246

Closed
bjamali opened this issue Jul 13, 2020 · 19 comments
Closed

setting Subcatchment Parameters for calibration purposes #246

bjamali opened this issue Jul 13, 2020 · 19 comments

Comments

@bjamali
Copy link

bjamali commented Jul 13, 2020

It seems that Subcatchment parameters that can be set by user are limited to width, area, fracImperv, slope and curbLength (see class SubcParams(Enum) in toolkitapi.py).

For calibration of a SWMM model it is usually necessary to change parameters such as previous and impervious roughness, infiltration rates, depression storage, etc. Is this functionality already available?

@jennwuu
Copy link
Contributor

jennwuu commented Jul 13, 2020

Are you looking to change these parameters before simulation starts?

@bjamali
Copy link
Author

bjamali commented Jul 13, 2020 via email

@jennwuu
Copy link
Contributor

jennwuu commented Jul 13, 2020

I don't think this feature is available in the SWMM toolkitapi, which is what pyswmm use. I would make the request here: https://github.com/OpenWaterAnalytics/Stormwater-Management-Model/issues

@yangdong963
Copy link

Hello, I am studying pyswmm recently, and I have a question to ask you. The parameter of changing the impervious area of the subcatchment cannot be modified. Is it my code problem? ‘’‘S1.percent_impervious = 10’

@yangdong963
Copy link

code:print(s1.percent_impervious)
s1.percent_impervious = 10
print(s1.percent_impervious)
output:
0.29
0.29

@katmratliff
Copy link
Contributor

Hi @yangdong963, can you please post a larger portion of your code? Thanks!

@yangdong963
Copy link

yangdong963 commented Jul 22, 2020 via email

@yangdong963
Copy link

yangdong963 commented Jul 22, 2020 via email

@katmratliff
Copy link
Contributor

thanks @yangdong963. As @bemcdonnell pointed out here, this feature is not yet available. From the comments in the code, it looks like this may be a more challenging setter to implement, as it will require recalculation of other parameters after setting. I believe @jennwuu is working on some of the subcatchment parameters, but I'm not sure about this one (?)

@yangdong963
Copy link

yangdong963 commented Jul 22, 2020 via email

@bemcdonnell
Copy link
Member

@yangdong963, would you be interested in contributing these features?

@yangdong963
Copy link

yangdong963 commented Jul 22, 2020 via email

@jennwuu
Copy link
Contributor

jennwuu commented Jul 22, 2020

@yangdong963 yes, N-Imperv, N-perv, Dstore-imperv, and Dstore-perv are parameters I am planning to expand in subcatchment getters and setters.

I did not evaluate the complexity of adding impervious fraction yet. I may include this parameter as well.

@tamaddun
Copy link

@yangdong963 Are you aware of any update on this?

@jennwuu
Copy link
Contributor

jennwuu commented Feb 26, 2021

@tamaddun I am still working on this feature. It's more complex than I originally thought and that's why it is delayed.

@tamaddun
Copy link

@jennwuu Thank you. Rooting for you!

@BuczynskiRafal
Copy link

Hi
I was trying to fix the percent_impervious setter today.
I thoroughly debugged the code looking for where the bug is.
Unfortunately, I am not able to fix the operation of this stetter.
It seems to me that I do not fully understand the operation of the following function form _solver.py file.

def subcatch_set_parameter(*args, **kwargs): # real signature unknown
    """
    Set a property value for specified subcatchment.
    
    Parameters
    ----------
    index: int
        The index of a subcatchment
    param: SM_SubcProperty
        The property type code (See :ref: SM_SubcProperty)
    value: double
        The new value of the subcatchment's property
    """
    pass

What exactly does it do with the passed arguments to function subcatch_set_parameter from solver.py file?

def subcatch_set_parameter(index: "int", param: "SM_SubcProperty", value: "double") -> "int":
    r"""
    Set a property value for specified subcatchment.

    Parameters
    ----------
    index: int
        The index of a subcatchment
    param: SM_SubcProperty
        The property type code (See :ref: SM_SubcProperty)
    value: double
        The new value of the subcatchment's property

    """
    return _solver.subcatch_set_parameter(index, param, value)

I also noticed that changing the numbering in the SubcParams class as below setter works. This class in toolkitapi.py. The simulation executes correctly. Can someone direct me why there is a problem with key 2 and where can I look for a solution?

class SubcParams(Enum):
    width = 0  # double
    area = 2  # double
    fracImperv = 1  # double
    slope = 3  # double
    curbLength = 4  # double
    # initBuildup = 5  # double

@BuczynskiRafal
Copy link

BuczynskiRafal commented Nov 2, 2022

Okay, I see what the problem is.
The validation in question is planned to be on the PySWMM side? I might be able to help implement this?

                break; //Subcatch[index].fracImperv; break;
                // Cannot Open Function just yet.  Need
                // to adjust some internal functions to
                // ensure parameters are recalculated
                // = MIN(value, 100.0) / 100.0; break;

@bemcdonnell
Copy link
Member

@BuczynskiRafal, if you scroll down to the bottom of this page it will show you the links to the various repositories and how the project is architected.

https://www.pyswmm.org/

I’m going to convert the issue to a discussion until we find units of work to work on

@pyswmm pyswmm locked and limited conversation to collaborators Nov 2, 2022
@bemcdonnell bemcdonnell converted this issue into discussion #378 Nov 2, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

7 participants