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

When calculating MW-miles of transmission upgrades, exclude some branches #118

Merged
merged 2 commits into from
Aug 26, 2020

Conversation

danielolsen
Copy link
Contributor

@danielolsen danielolsen commented May 28, 2020

Purpose

When calculating MW-miles of transmission upgrades, exclude some branches. I have found this to be very useful for analyzing offshore wind scenarios, where we want to separate onshore branch upgrades and offshore branch upgrades.

What is the code doing

Functional change in calculation loop in mwmiles.py:

if b in exclude_branches:
   continue

Everything else is input checking, docstring updates, and new tests.

Usage example

Scenario 564 (Collaborative Offshore Anchor). Offshore branches were consciously all given capacity of 100 MW, even if the offshore plants were expected to be much bigger, since we knew that we could up-size them automatically via renewable stub scaling. However, that leads to the calculation of very large upgrade totals, which are not meaningful for this scenario.

>>> upgrades = calculate_mw_miles(scenario)
>>> print('total MW-miles:', '{:,.0f}'.format(upgrades['mw_miles'] + upgrades['transformer_mw']))
total MW-miles: 584,058
>>> print('total lines:', '{:.0f}'.format(upgrades['num_lines'] + upgrades['num_transformers']))
total lines: 305

>>> exclude_branches = list(range(104121,104168))    #offshore branches
>>> upgrades = calculate_mw_miles(scenario, exclude_branches=exclude_branches)
>>> print('total MW-miles:', '{:,.0f}'.format(upgrades['mw_miles'] + upgrades['transformer_mw']))
total MW-miles: 54,746
>>> print('total lines:', '{:.0f}'.format(upgrades['num_lines'] + upgrades['num_transformers']))
total lines: 291

Time to review

15 minutes. This is a low priority to review/merge, I can keep using it in my local branch in the meantime.

@danielolsen danielolsen force-pushed the mwmiles_exclude_branches branch from c4367dc to f410277 Compare June 1, 2020 23:58
@danielolsen danielolsen force-pushed the mwmiles_exclude_branches branch from f410277 to 96c2233 Compare June 11, 2020 20:08
@danielolsen danielolsen force-pushed the mwmiles_exclude_branches branch 6 times, most recently from 7483182 to 4fa8739 Compare July 11, 2020 02:24
@danielolsen danielolsen force-pushed the mwmiles_exclude_branches branch from 4fa8739 to fa58e48 Compare August 8, 2020 04:08
@danielolsen danielolsen force-pushed the mwmiles_exclude_branches branch from fa58e48 to e75338e Compare August 26, 2020 16:07
@danielolsen
Copy link
Contributor Author

This PR has been sitting for nearly three months now. Can I get a thumbs up or thumbs down so that I can stop rebasing and pushing?

base_branch = original_grid.branch
upgraded_branches = ct["branch"]["branch_id"]
for b, v in upgraded_branches.items():
if b in exclude_branches:
continue
# 'upgraded' capacity is v-1 because a scale of 1 = an upgrade of 0
upgraded_capacity = base_branch.loc[b, "rateA"] * (v - 1)
Copy link
Collaborator

@rouille rouille Aug 26, 2020

Choose a reason for hiding this comment

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

Just by curiosity, what happens if b, a branch that is part of the grid used for the scenario, is not in the base grid because the latter has been updated since the scenario has ran? In other words, should we have a if or try/except statement here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting thought. If we remove a branch from the base grid, but this branch is present in the change table of previous scenarios, I think it will indeed cause an error. So far I don't think we've removed any branches, only added them, and even then we have only added them for the offshore wind generators, nowhere else.

Just thinking out loud here: if we do add an if or a try/except, it could avoid this hypothetical but we may accidentally ignore similar problems that we would want to throw an exception for.

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.

Looks good. Always a good thing to have options.

@danielolsen danielolsen force-pushed the mwmiles_exclude_branches branch from e75338e to 2c77648 Compare August 26, 2020 17:30
@danielolsen danielolsen merged commit 7b90943 into develop Aug 26, 2020
@danielolsen danielolsen deleted the mwmiles_exclude_branches branch August 26, 2020 17:38
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants