Skip to content

Commit

Permalink
Support for multiple turbine types in calculate_horizontal_plane_with…
Browse files Browse the repository at this point in the history
…_turbines() (NREL#781)

* Update calculate_horizontal_plane_with_turbines.

Add support for multiple turbine types by modifying copy of input turbine type list.

* Fix linting

* Linting: remove trailing whitespace

* Handle turbine_type len 1 case

---------

Co-authored-by: Rafael M Mudafort <[email protected]>
Co-authored-by: Paul <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2024
1 parent b88dc7b commit a88a154
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion floris/tools/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,20 @@ def calculate_horizontal_plane_with_turbines(
# Grab the turbine layout
layout_x = copy.deepcopy(fi.layout_x)
layout_y = copy.deepcopy(fi.layout_y)
turbine_types = copy.deepcopy(fi.floris.farm.turbine_type)
D = fi.floris.farm.rotor_diameters_sorted[0, 0, 0]

# Declare a new layout array with an extra turbine
layout_x_test = np.append(layout_x,[0])
layout_y_test = np.append(layout_y,[0])

# Declare turbine types with an extra turbine in
# case of special one type useage
if len(layout_x) > 1 and len(turbine_types) == 1:
# Convert to list length len(layout_x) + 1
turbine_types_test = [turbine_types[0] for i in range(len(layout_x))] + ['nrel_5MW']
else:
turbine_types_test = np.append(turbine_types, 'nrel_5MW').tolist()
yaw_angles = np.append(yaw_angles, np.zeros([len(wd), len(ws), 1]), axis=2)

# Get a grid of points test test
Expand Down Expand Up @@ -694,7 +703,11 @@ def calculate_horizontal_plane_with_turbines(
# Place the test turbine at this location and calculate wake
layout_x_test[-1] = x
layout_y_test[-1] = y
fi.reinitialize(layout_x = layout_x_test, layout_y = layout_y_test)
fi.reinitialize(
layout_x=layout_x_test,
layout_y=layout_y_test,
turbine_type=turbine_types_test
)
fi.calculate_wake(yaw_angles=yaw_angles)

# Get the velocity of that test turbines central point
Expand Down

0 comments on commit a88a154

Please sign in to comment.