Skip to content

Commit

Permalink
Merge branch 'develop' into parallel-model-rework
Browse files Browse the repository at this point in the history
  • Loading branch information
misi9170 committed Sep 24, 2024
2 parents 86d6238 + a1c2134 commit 28a5cff
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 28a5cff

Please sign in to comment.