Skip to content

Commit

Permalink
Update turbine.py (WISDEM#56)
Browse files Browse the repository at this point in the history
* Update turbine.py

This add several lines for fixing the problem of repeated maximum values in the performance tables. This will cause the error (' the length of x and y is different.') of 'interpolate.interp1d.'

* Add comments and catch when there are multiple optimal pitch angles

Co-authored-by: dzalkind <dzalkind@nrel.gov>
  • Loading branch information
Seager1989 and dzalkind committed Jun 16, 2021
1 parent 8ee78e5 commit e0d001b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ROSCO_toolbox/turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,14 @@ def __init__(self,performance_table, pitch_initial_rad, TSR_initial):
# --- Find TSR ---
# Make finer mesh for Tip speed ratios at "optimal" blade pitch angle, do a simple lookup.
# -- nja: this seems to work a little better than interpolating
performance_beta_max = np.ndarray.flatten(performance_table[:,self.max_ind[1]]) # performance metric at maximizing pitch angle

# Find the 1D performance table when pitch is at the maximum part of the Cx surface:
performance_beta_max = np.ndarray.flatten(performance_table[:,self.max_ind[1][-1]]) # performance metric at the last maximizing pitch angle

# If there is more than one max pitch angle:
if len(self.max_ind[1]) > 1:
print('ROSCO_toolbox Warning: repeated maximum values in a performance table and the last one @ pitch = {} rad. was taken...'.format(self.pitch_opt[-1]))

TSR_ind = np.arange(0,len(TSR_initial))
TSR_fine_ind = np.linspace(TSR_initial[0],TSR_initial[-1],int(TSR_initial[-1] - TSR_initial[0])*100)
f_TSR = interpolate.interp1d(TSR_initial,TSR_initial,bounds_error='False',kind='quadratic') # interpolate function for Cp(tsr) values
Expand Down

0 comments on commit e0d001b

Please sign in to comment.