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

feat: wecc congestion stats #20

Merged
merged 8 commits into from
Nov 7, 2019
Merged

feat: wecc congestion stats #20

merged 8 commits into from
Nov 7, 2019

Conversation

victoriahunt
Copy link
Contributor

WECC congestion statistics code added to transmission.py.
Function to generate utilization as proportion of capacity (power flow divided by capacity) added to transmission.py.

@victoriahunt victoriahunt added new feature Feature that is currently in progress. congestion labels Jul 31, 2019
@victoriahunt victoriahunt requested review from kasparm and rouille July 31, 2019 16:16
@victoriahunt victoriahunt self-assigned this Jul 31, 2019
@victoriahunt
Copy link
Contributor Author

I'm currently adding a version of the wecc congestion stats that will allow the user to pick the congestion thresholds. Will commit to the branch as this work is completed.

@rouille
Copy link
Collaborator

rouille commented Jul 31, 2019

I believe your branch should be merged to develop and not master. If @kasparm agrees, you will need to edit your PR. Also you have pushed a lot of binary files (in the pycache folder), would you mind removing them?

@victoriahunt victoriahunt changed the base branch from master to develop July 31, 2019 19:49
@victoriahunt
Copy link
Contributor Author

victoriahunt commented Jul 31, 2019

I changed the branch to merge into to develop. Also removed the pycache binary files.

postreise/analyze/transmission.py Outdated Show resolved Hide resolved
postreise/analyze/transmission.py Outdated Show resolved Hide resolved
postreise/analyze/transmission.py Outdated Show resolved Hide resolved
postreise/analyze/transmission.py Outdated Show resolved Hide resolved
Copy link
Contributor

@kasparm kasparm left a comment

Choose a reason for hiding this comment

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

Also, create a function that only takes an instance of the scenario object and returns the congestion analysis.

postreise/analyze/transmission.py Outdated Show resolved Hide resolved
postreise/analyze/transmission.py Outdated Show resolved Hide resolved
@victoriahunt
Copy link
Contributor Author

I've fixed several of the issues identified: removing name from input parameter, removing function from within the function, and adding doc strings to all the functions for documentation. I am still working on 'create a function that only takes an instance of the scenario object and returns the congestion analysis"

@victoriahunt
Copy link
Contributor Author

I've successfully created a function that only takes an instance of the scenario object and returns the congestion analysis.

It's a bit slow, taking 5 min or so to run -- I will work on speeding it up.

@kasparm kasparm self-requested a review August 20, 2019 18:56
@victoriahunt
Copy link
Contributor Author

Per conversation earlier today with Kaspar, I've put the mapping function into transmission.py, and a demo in the demo folder. I removed the outdated p-value based function, and associated notebooks (mapping and analysis).

@victoriahunt
Copy link
Contributor Author

Per conversation today with Kaspar, will move the mapping function to it's own py script in the analyze folder of PostREISE. Also will remove unnecessary imports and will adhere to punctuation conventions using spaces etc.

@rouille
Copy link
Collaborator

rouille commented Oct 10, 2019

In function generate_cong_df, the branch data frame is modified (a new column capacity is added). Data frames are mutable meaning that the original data frame will be in turn modified. I believe this should not be the case.

branch data frame before call to generate_cong_df:

grid.branch.columns
Index(['from_bus_id', 'to_bus_id', 'r', 'x', 'b', 'rateA', 'rateB', 'rateC',
       'ratio', 'angle', 'status', 'angmin', 'angmax', 'Pf', 'Qf', 'Pt', 'Qt',
       'mu_Sf', 'mu_St', 'mu_angmin', 'mu_angmax', 'branch_device_type',
       'interconnect', 'from_lat', 'from_lon', 'to_lat', 'to_lon',
       'from_zone_id', 'to_zone_id', 'from_zone_name', 'to_zone_name'],
      dtype='object')

branch data frame after call to generate_cong_df:

grid.branch.columns
Index(['from_bus_id', 'to_bus_id', 'r', 'x', 'b', 'rateA', 'rateB', 'rateC',
       'ratio', 'angle', 'status', 'angmin', 'angmax', 'Pf', 'Qf', 'Pt', 'Qt',
       'mu_Sf', 'mu_St', 'mu_angmin', 'mu_angmax', 'branch_device_type',
       'interconnect', 'from_lat', 'from_lon', 'to_lat', 'to_lon',
       'from_zone_id', 'to_zone_id', 'from_zone_name', 'to_zone_name',
       'capacity'],
      dtype='object')

If you want to learn more about passage by copy/reference, mtability/immutability, I recommend these two blog posts:
https://medium.com/@tyastropheus/tricky-python-i-memory-management-for-mutable-immutable-objects-21507d1e5b95
https://medium.com/@tyastropheus/tricky-python-ii-parameter-passing-for-mutable-immutable-objects-10e968cbda35

I am going to rewrite this function.

@victoriahunt
Copy link
Contributor Author

update: I spoke with Ben about this and agree that rewriting to not directly modify the dataframe (preserve original) makes sense. Also that rateA == 0 capacity should be NA as it isn't applicable. When rateA == 0 that means capacity is unconstrained on branch. It will not be congested and therefore isn't included in congestion analyses.

@kasparm
Copy link
Contributor

kasparm commented Nov 4, 2019

Waiting for changes by @victoriahunt and @danielolsen before merging into develop.

@victoriahunt
Copy link
Contributor Author

victoriahunt commented Nov 4, 2019

Confirmed with Ben last week that his code calculates same values that mine did. It is ready to be merged.

@danielolsen
Copy link
Contributor

I talked to @kasparm and @rouille and @victoriahunt and didn't learn of any changes that I need to make to this branch.

@rouille
Copy link
Collaborator

rouille commented Nov 7, 2019

The las commit reorganize the modules: mapping is moved in plot/ as test_transmission. Docstrings have been written and demo notebook illustrates the analysis. Interactive rebase will be down tomorrow morning and merge into develop. Thanks to @victoriahunt for her patience. Great job.

Copy link
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

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

I will do the rebase tomorrow and merge into develop.

@rouille rouille merged commit a9348ab into develop Nov 7, 2019
@rouille rouille deleted the add_wecc_congest branch November 7, 2019 18:22
@kasparm kasparm restored the add_wecc_congest branch November 11, 2019 17:13
@ahurli ahurli mentioned this pull request Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Feature that is currently in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants