Skip to content

Set collab solar fraction#164

Merged
danielolsen merged 2 commits intodevelopfrom
set_collab_solar_fraction
May 12, 2020
Merged

Set collab solar fraction#164
danielolsen merged 2 commits intodevelopfrom
set_collab_solar_fraction

Conversation

@danielolsen
Copy link
Copy Markdown
Contributor

Purpose

Simplify the getting of collaborative scaling next capacities. Once targets & resources are defined, collaborative_strategy_manager.data_frame_of_next_capacities() seems to be the top-level user-facing function, but there's no input for solar_fraction there. We could add an input here, pass that input to calculate_capacity_scaling(), and then pass that input to calculate_total_added_capacity(), or we could add one call to collaborative_strategy_manager.set_solar_fraction() before calling data_frame_of_next_capacities() and then we don't have to worry about propagating an input three levels deep.

What is the code doing

  • We add a solar_fraction attribute to __init__(), defaulting to None.
  • We add a new function _check_solar_capacity() to check inputs.
  • We add a new method set_solar_fraction() which assigns values to the instance attribute.
  • We modify calculate_total_added_capacity() to not take an input for solar_fraction, but to get it from the instance attribute instead.
  • We re-use _check_solar_capacity() to replace functionality in TargetManager.__init__()

Validation

The code has been tested, and using the setter results in changes to the output capacities. The setter complains on bad inputs. All existing unit tests still pass.

Time to review

Five to fifteen minutes. This feature is not urgent, since I've already used the code for what I need it for right now, and I can always rebase and re-use it in the meantime. It would be nice to have in the codebase eventually though.

@danielolsen danielolsen force-pushed the set_collab_solar_fraction branch from 867f950 to d4d2312 Compare May 11, 2020 20:07
Copy link
Copy Markdown
Collaborator

@dmuldrew dmuldrew 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!

@danielolsen danielolsen merged commit 6855627 into develop May 12, 2020
@danielolsen danielolsen deleted the set_collab_solar_fraction branch May 12, 2020 01:58
@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.

2 participants