Skip to content

Commit

Permalink
Add example of optimizing with disabled turbines.
Browse files Browse the repository at this point in the history
  • Loading branch information
misi9170 committed Nov 15, 2024
1 parent f1a6760 commit fb4313c
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Example: Optimizing yaw angles with disabled turbines
This example demonstrates how to optimize yaw angles in FLORIS, when some turbines are disabled.
The example optimization is run using both YawOptimizerSR and YawOptimizerGeometric, the two
yaw optimizers that support disabling turbines.
"""

import numpy as np

from floris import FlorisModel
from floris.optimization.yaw_optimization.yaw_optimizer_geometric import YawOptimizationGeometric
from floris.optimization.yaw_optimization.yaw_optimizer_sr import YawOptimizationSR

# Load a 3-turbine model
fmodel = FlorisModel("../inputs/gch.yaml")

# Set wind conditions to be the same for two cases
fmodel.set(wind_directions=[270.]*2, wind_speeds=[8.]*2, turbulence_intensities=[.06]*2)

# Disable turbines (different pattern for each of the two cases)
# First case: disable the middle turbine
# Second case: disable the front turbine
fmodel.set_operation_model('mixed')
fmodel.set(disable_turbines=np.array([[False, True, False], [True, False, False]]))

# Run optimizations and print results
yaw_opt = YawOptimizationSR(fmodel)
df_opt = yaw_opt.optimize()
print("Serial Refine optimized yaw angles [deg]:\n", df_opt.yaw_angles_opt)

yaw_opt = YawOptimizationGeometric(fmodel)
df_opt = yaw_opt.optimize()
print("\nGeometric optimized yaw angles [deg]:\n", df_opt.yaw_angles_opt)

0 comments on commit fb4313c

Please sign in to comment.