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

Enabling layout optimization for value #862

Merged
merged 13 commits into from
Apr 4, 2024

Conversation

ejsimley
Copy link
Collaborator

@ejsimley ejsimley commented Apr 3, 2024

Enabling layout optimization for value

This PR adds the capability to perform layout optimization to maximize the expected value of the energy produced (e.g., the electricity market value), using the "value" array stored in a WindData object. In addition to the layout optimization enhancement, methods are also added to compute expected value and annual value production (AVP), and to allow value to be added to a WindData object as a function of wind speed and/or direction. Note that the option to optimize for value was not added to the yaw optimization classes because optimizing for value would be equivalent to optimizing for energy - since yaw offsets are optimized for each wind condition independently, maximizing the value of the energy for a particular wind condition would be the same as maximizing the energy produced (assuming value is greater than or equal to zero).

Specific enhancements include:

  • In floris_model.py, there are two new methods get_expected_farm_value and get_farm_AVP for getting the expected value produced by the wind farm and the annual value production, similar to get_expected_farm_power and get_farm_AEP.
  • All of the WindData classes now include the method assign_value_using_wd_ws_function for assigning value using an arbitrary function and the method assign_value_piecewise_linear for specifying value using a piecewise linear function of wind speed. The piecewise linear approach was inspired by the mean electricity price vs. wind speed plots from Simley et al. "The value of wake steering wind farm flow control in US energy markets," Wind Energy Science, 2024. The default parameters are meant to approximate the curve for the SPP market region. The WindRose and WindTIRose classes also have a function for plotting value vs. TI.
  • In "layout_optimization_base.py", the LayoutOptimization class now has an argument use_value to determine whether the objective is maximum energy or value.
  • In "layout_optimization_pyoptsparse.py" and "layout_optimization_scipy.py", the optimization objective functions will call get_farm_AEP or get_farm_AVP depending on the boolean use_value argument.
  • Tests are added for get_expected_farm_value, get_farm_AVP, and LayoutOptimizationScipy, for the case when use_value is True.

I have an example ready too, but was thinking I'd wait to add it to PR #843

As discussed with @paulf81 and @misi9170, I added the value-based layout optimization regression test to the existing "scipy_layout_opt_regression.py" file. However, we noticed that the tests in this file weren't getting run because the file name was missing the "_test" suffix. I renamed the file so it gets run now, but the original test_scipy_layout_opt test fails. I'll mark this as a draft PR until we resolve this. @bayc, are you familiar with this test? Do you think we should just update the baseline results (although they don't match perfectly, they are very close to the actual results that get computed), or was there a reason for removing this test from the regression test list maybe?

@ejsimley ejsimley added enhancement An improvement of an existing feature v4 Focus of FLORIS v4 labels Apr 3, 2024
Copy link
Collaborator

@paulf81 paulf81 left a comment

Choose a reason for hiding this comment

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

@ejsimley , this is nicely done and really elegant! I agree with deferring adding the example until after the examples refactor PR is in. Only comments:

  1. On the scipy reg test, my vote would be we just go ahead and fix it, I'm assuming this was just an oversight (but maybe @rafmudaf you remember differently?)
  2. I think I can write the two missing docstrings if you like (see comments)

@ejsimley
Copy link
Collaborator Author

ejsimley commented Apr 3, 2024

@ejsimley , this is nicely done and really elegant! I agree with deferring adding the example until after the examples refactor PR is in. Only comments:

  1. On the scipy reg test, my vote would be we just go ahead and fix it, I'm assuming this was just an oversight (but maybe @rafmudaf you remember differently?)
  2. I think I can write the two missing docstrings if you like (see comments)

@paulf81, thanks for working on the docstrings. For comment 1, I just updated the test results with the values I got locally. We'll see if the test passes here too. Hopefully we'll get some more input on those results, but I agree, probably fine to just fix it now. The small changes in the results could be relate to a dependency version.

@rafmudaf
Copy link
Collaborator

rafmudaf commented Apr 3, 2024

However, we noticed that the tests in this file weren't getting run because the file name was missing the "_test" suffix.

Good catch @ejsimley. This file was added in #819, and looking back at that PR I do think it was a typo @misi9170.

@ejsimley ejsimley marked this pull request as ready for review April 3, 2024 21:49
@bayc
Copy link
Collaborator

bayc commented Apr 3, 2024

PR I
@ejsimley @rafmudaf

Yea, that was my bad. I added that test and didn't catch the missing _test (6c8d39f). I think with the small values that it is fine to just update the baseline results.

@ejsimley ejsimley merged commit 27fe153 into NREL:v4 Apr 4, 2024
8 checks passed
@misi9170 misi9170 mentioned this pull request Apr 8, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature v4 Focus of FLORIS v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants