NREL / ROSCO_toolbox

A repository for generating ROSCO controller input files and more.
http://rosco-toolbox.readthedocs.io/
Apache License 2.0
23 stars 20 forks source link

The issue due to the same values in the performance table #55

Closed Seager1989 closed 3 years ago

Seager1989 commented 3 years ago

Hi, This is a small bug and discussion regarding the code.

I am using the ROSCO_toolbox and found a problem, which causes the failure of turbine load from the FAST model. The error is the x and y should be the same length in 'interpolate.interp1d'. I checked the code and found the problem as follows.

1) In turbine.RotorPerformance(), self.max_ind = np.where(performance_table == np.amax(performance_table)) is used to found the maximum location. 2) performance_beta_max = np.ndarray.flatten(performance_table[:,self.max_ind[1]]) takes the column number. However, if there same values in performance_table (may be caused by numerical precision), the length of self.max_ind[1] is not one and the error will appear as above.

I am thinking about a suitable solution to this problem. Maybe, increasing the precision of the performance table is good, but it may not always available. Also, taking only one value from self.max_ind[1] may be a good solution currently? I just propose this minor issue here and it may or may not included in the codes.

dzalkind commented 3 years ago

I have come across a similar problem when the Cp table only has zeros and the code doesn't make it clear what the source of the problem is.

I think your solution makes sense. If you'd like to submit a PR with that fix, I would be happy to check it out and merge it.

dzalkind commented 3 years ago

This was resolved in #56. Closing.