NREL / reV

Renewable Energy Potential (reV) Model
https://nrel.github.io/reV/
BSD 3-Clause "New" or "Revised" License
107 stars 24 forks source link

reV Losses Module #362

Closed ppinchuk closed 2 years ago

ppinchuk commented 2 years ago

Added a new reV module for calculating losses. This module facilitates the addition of losses to generation outputs that are more sophisticated than simple haircut losses. Two new types of losses are added in particular.

Power Curve Losses (Wind only)

Users can now specify a target loss percentage and a type of power curve transformation. reV will then attempt to apply the transformation in order to reach the target loss percentage given the annual wind distribution at each site. This results in different transformations for each site.

~Currently, a horizontal power curve translation is the only kind of transformation that is implemented.~ JK, I added a total of three :). I think the latter two should make Owen much happier. New transformations can easily be implemented by sub classing PowerCurveTransfromation and implementing an apply method that calculates the transformation using a single tunable variable, and a bounds property that sets the limits on that transformation variable (and also register the new class to the TRASNFORMATIONS dictionary).

Stochastically Scheduled Outages (Wind and Solar)

Users can now specify information about a set of outages, which reV then attempts to schedule stochastically. Details for each outage include

Notes

ppinchuk commented 2 years ago

Feel free to wait until after our discussion on Tuesday to review.

codecov-commenter commented 2 years ago

Codecov Report

Merging #362 (034c734) into main (a947b6b) will increase coverage by 1.19%. The diff coverage is 98.16%.

@@            Coverage Diff             @@
##             main     #362      +/-   ##
==========================================
+ Coverage   79.14%   80.34%   +1.19%     
==========================================
  Files         135      142       +7     
  Lines       18211    19409    +1198     
==========================================
+ Hits        14414    15595    +1181     
- Misses       3797     3814      +17     
Flag Coverage Δ
unittests 80.34% <98.16%> (+1.19%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tests/test_losses_utils.py 94.91% <94.91%> (ø)
reV/losses/utils.py 96.29% <96.29%> (ø)
tests/test_losses_scheduled.py 96.75% <96.75%> (ø)
tests/test_losses_power_curve.py 98.34% <98.34%> (ø)
reV/SAM/generation.py 93.59% <100.00%> (+0.08%) :arrow_up:
reV/losses/__init__.py 100.00% <100.00%> (ø)
reV/losses/power_curve.py 100.00% <100.00%> (ø)
reV/losses/scheduled.py 100.00% <100.00%> (ø)
reV/utilities/exceptions.py 100.00% <100.00%> (ø)
reV/config/project_points.py 85.41% <0.00%> (+0.04%) :arrow_up:
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a947b6b...034c734. Read the comment docs.

ppinchuk commented 2 years ago

Going to add a few more things while testing this out with Owen so no rush really

grantbuster commented 2 years ago

It looks really good based on my verification of the outputs. My only real concern on the technology side is that it respects the cutout speeds even when shifted.

ppinchuk commented 2 years ago

Yea, so I perform that check in multiple places https://github.com/NREL/reV/blob/3313b708e4b00ebf6ec76367b0b086a9b131b501/reV/losses/power_curve.py#L152

and also: https://github.com/NREL/reV/blob/3313b708e4b00ebf6ec76367b0b086a9b131b501/reV/losses/power_curve.py#L613 which has the following code:

new_gen = self.power_curve(
    self.power_curve.wind_speed - transformation_var
)
mask = (
    self.power_curve.wind_speed >= self.power_curve.cutoff_wind_speed
)
new_gen[mask] = 0

That all being said, I am adding some more commits below to verify and ensure this behavior moving forward