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

[BUGFIX] Gridded layout opt incorrectly generating spanning grid #984

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(
if min_dist_D is not None and min_dist is None:
if min_dist_D < 0: # Default to 5D
min_dist_D = 5.0
min_dist = min_dist_D * fmodel.core.farm.rotor_diameters[0]
min_dist = min_dist_D * fmodel.core.farm.rotor_diameters.flat[0]
if len(np.unique(fmodel.core.farm.rotor_diameters)) > 1:
self.logger.warning((
"Found multiple turbine diameters. Using diameter of first turbine to set"
Expand All @@ -83,7 +83,7 @@ def __init__(
if translation_step_D is not None and translation_step is None:
if translation_step_D < 0: # Default to 1D
translation_step_D = 1.0
translation_step = translation_step_D * fmodel.core.farm.rotor_diameters[0]
translation_step = translation_step_D * fmodel.core.farm.rotor_diameters.flat[0]
if len(np.unique(fmodel.core.farm.rotor_diameters)) > 1:
self.logger.warning((
"Found multiple turbine diameters. Using diameter of first turbine to set"
Expand All @@ -107,7 +107,7 @@ def __init__(
# Create the default grid

# use min_dist, hexagonal packing, and boundaries to create a grid.
d = 1.1 * np.sqrt((self.xmax**2 - self.xmin**2) + (self.ymax**2 - self.ymin**2))
d = 1.1 * np.sqrt((self.xmax - self.xmin)**2 + (self.ymax - self.ymin)**2)
grid_1D = np.arange(0, d+min_dist, min_dist)
if hexagonal_packing:
x_locs = np.tile(grid_1D.reshape(1,-1), (len(grid_1D), 1))
Expand Down Expand Up @@ -196,7 +196,7 @@ def optimize(self):
x, y in zip(x_opt_all, y_opt_all)]

# Save best layout, along with the number of turbines in bounds, and return
self.n_turbines_max = turbines_in_bounds[idx_max]
self.n_turbines_max = round(turbines_in_bounds[idx_max])
self.x_opt = x_opt_all[mask_in_bounds]
self.y_opt = y_opt_all[mask_in_bounds]
return self.n_turbines_max, self.x_opt, self.y_opt
Expand Down
Loading