Skip to content

feat: scale hydro stub branches#163

Merged
danielolsen merged 4 commits intodevelopfrom
add_hydro_to_stub_scaling
May 5, 2020
Merged

feat: scale hydro stub branches#163
danielolsen merged 4 commits intodevelopfrom
add_hydro_to_stub_scaling

Conversation

@danielolsen
Copy link
Copy Markdown
Contributor

Purpose

Never again have to manually scale stub branches to deal with hydro. This is in conjunction with #162, to get accurate Pmax values for hydro plants into the base grid.

What is the code doing

One line change, adding 'hydro' to the list of renewable plant types to perform renewable stub scaling on.

Time to review

5 minutes.

Copy link
Copy Markdown
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.

Indeed.

@danielolsen danielolsen force-pushed the add_hydro_to_stub_scaling branch from e24c00f to 155fa45 Compare May 5, 2020 00:54
@danielolsen
Copy link
Copy Markdown
Contributor Author

I relaxed the Pmax = 0 check because it was complaining about a few hydro plants with 0 capacity in Montana Eastern. Here are the new warnings:

hydro plant 10378 at bus 69975 has 0 Pmax!
hydro plant 10379 at bus 69976 has 0 Pmax!
hydro plant 10380 at bus 69978 has 0 Pmax!
hydro plant 10381 at bus 69978 has 0 Pmax!
hydro plant 10382 at bus 69979 has 0 Pmax!

@danielolsen
Copy link
Copy Markdown
Contributor Author

@BainanXia, I refactored the warning logic a bit in this last commit, now it should only warn if scaling for a given plant == 1 when considering both plant_id scaling and zone_id scaling. Does this make the logic more clear? Are there other places where you think I should update the documentation?

Comment thread powersimdata/design/transmission.py Outdated
if stub_degree > 0:
ren_capacity = _find_capacity_at_bus(ref_plant, bus_id, r)
assert ren_capacity > 0
try:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reading through the code to understand the logic. Is there a specific reason that we are not using if/else instead of try, assert, except AssertionError?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

...only because it was an assert before, and this was a quick fix. I agree, your proposal is cleaner, I will change it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

except KeyError:
pass
if (gen_scale_factor == 1) and (verbose == True):
print(f'no scaling factor for {r}, {zone_id}, plant {p}')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm trying to understand whether this is a common situation or not, in other words, how often is a plant of type 'r' not being scaled neither via 'zone_id' nor 'plant_id', given you are looping through all the plants of such type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess that depends on the scenario in question. In our Eastern 2030 Independent OB1, when we are loading capacities from a change table and then turning off offshore_wind, we have scaling factors for all plants/types. But I can imagine other scenarios which would not have scale factors for all types, where we would maybe still run renewable stub scaling.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Then in such scenario we are going to have a lot of such warnings for each plant of 'r'+'zone_id'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe it makes more sense to turn verbose off by default instead of on? The user can always specify from the change_table.scale_renewable_stubs() call whether they want these warnings or not.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agree. Otherwise user like me would be anxious in seeing so many warnings and suspecting something seriously is going wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, with an update to the docstring as well.

@BainanXia
Copy link
Copy Markdown
Collaborator

BainanXia commented May 5, 2020

Let me confirm with you regarding the logic

I relaxed the Pmax = 0 check because it was complaining about a few hydro plants with 0 capacity in Montana Eastern. Here are the new warnings:

Does this happen after we reset the Pmax of hydro generators according to the maximum of the corresponding profiles, which implies we have a bunch of 'dummy' hydro plants with zero capacities and all zero profiles?

@danielolsen
Copy link
Copy Markdown
Contributor Author

Does this happen after we reset the Pmax of hydro generators according to the maximum of the corresponding profiles?

Unfortunately, yes. I think all these generators were scaled down to zero when we rebased from our Eastern cost curve tuning process, so the Pmax is 0 and the profiles are [0, 0, 0, ...].

@BainanXia
Copy link
Copy Markdown
Collaborator

@danielolsen I don't remember we ever turned any hydro plants from TAMU network down before. Is it because they shouldn't there according to the external references and we turn them off by scaling capacities of those plants down to zero? Or, they come with zero capacity generators from TAMU network originally.

@danielolsen
Copy link
Copy Markdown
Contributor Author

@BainanXia when we were running cost curve tests, we scaled plants based on excel spreadsheets, and the entry for hydro in Montana was 0. Results/Scenarios/ScenarioRuns/EasternCostCurveTests/Eastern_generator_capacity_2016_322.xlsx

Then we rebased the grid based on one of those scenarios.

@BainanXia
Copy link
Copy Markdown
Collaborator

@danielolsen I see. RIP for those hydro plants. It is what it is. Probably in the future when we are cleaning up the grid, we could erase them together with those dummy branches.

Copy link
Copy Markdown
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

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

Thanks for walking through the logic.

@danielolsen danielolsen force-pushed the add_hydro_to_stub_scaling branch from 02336c0 to 9cf58b9 Compare May 5, 2020 20:09
@danielolsen danielolsen merged commit 4ee456f into develop May 5, 2020
@danielolsen danielolsen deleted the add_hydro_to_stub_scaling branch May 5, 2020 20:11
@ahurli ahurli mentioned this pull request Mar 11, 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