-
Notifications
You must be signed in to change notification settings - Fork 13
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
Calculate capacity value #114
Conversation
# Then calculate capacity value | ||
plant_groupby = grid.plant.groupby('type') | ||
plant_indices = sum( | ||
[plant_groupby.get_group(r).index.tolist() for r in resources], []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice trick
I don't understand why PyCharm complains about the type of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually, I'm happy with this. Those tests might look counterintuitive (capacity value decreases with fewer hours), but I'm seeing similar results with data from Western and Texas. Once Ben's adjustments are addressed, I support Approving this PR.
@rouille I don't know what PyCharm's issue is. For our MockScenario, we redefine the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I agree with the calculation. All tests pass.
I think PyCharm looks at the docstring and see that the |
1e14ce9
to
cf08f94
Compare
I added one more calculation method based on conversations with @danlivengood and @yixingxu and generalized the code a bit to be a little less repetitive, now that we have two different methods. The new method is also tested. If y'all liked the old one, you probably still like this too, but I'll leave this open until Monday night to give you a chance to register objections or extra approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Second function makes sense. All tests pass.
:param powersimdata.scenario.scenario.Scenario scenario: analyzed scenario. | ||
:param (str/list/tuple/set) resources: one or more resources to analyze. | ||
:param int hours: number of hours to analyze. | ||
:return: (*float*) -- difference between peak demand and peak net demand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nitpicky change request: This looks like a copy/paste from the NLDC function. However, I believe the return for calculate_net_load_peak
is returning the resource capacity during the hours of net demand, not the differential.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed!
88d3cc2
to
09a1891
Compare
Purpose
Calculate the capacity value for one or more resources. This is defined by the difference between the average demand over the top N hours and the average net demand over the top N hours (with N hours selected independently in each case, since the set of hours may differ).
Closes #80.
What is the code doing
capacity_value.py
defines the calculation function.test_capacity_value.py
tests the calculation function.Time to review
Half an hour. Actual calculations are ~10 lines, the rest is input checking and tests.