Example: Gridded layout design

Example: Gridded layout design#

"""Example: Gridded layout design
This example shows a layout optimization that places as many turbines as
possible into a given boundary using a gridded layout pattern.
"""

import matplotlib.pyplot as plt
import numpy as np

from floris import FlorisModel, WindRose
from floris.optimization.layout_optimization.layout_optimization_gridded import (
    LayoutOptimizationGridded,
)


if __name__ == '__main__':
    # Load the Floris model
    fmodel = FlorisModel('../inputs/gch.yaml')

    # Set the boundaries
    # The boundaries for the turbines, specified as vertices
    boundaries = [(0.0, 0.0), (0.0, 1000.0), (1000.0, 1000.0), (1000.0, 0.0), (0.0, 0.0)]

    # Set up the optimization object with 5D spacing
    layout_opt = LayoutOptimizationGridded(
        fmodel,
        boundaries,
        min_dist_D=5., # results in spacing of 5*125.88 = 629.4 m
        min_dist=None, # Alternatively, can specify spacing directly in meters
    )

    layout_opt.optimize()

    # Note that the "initial" layout that is provided with the fmodel is
    # not used by the layout optimization.
    layout_opt.plot_layout_opt_results()

    plt.show()
import warnings
warnings.filterwarnings('ignore')
floris.optimization.layout_optimization.layout_optimization_gridded.LayoutOptimizationGridded WARNING Running layout optimization without a WindData object (e.g. TimeSeries, WindRose, WindTIRose). We suggest that the user set the wind conditions (and if applicable, frequencies and values) on the FlorisModel using the wind_data keyword argument for layout optimizations to capture frequencies and the value of the energy production accurately. If a WindData object is not defined, uniform frequencies will be assumed. If use_value is True and a WindData object is not defined, a value of 1 will be used for each wind condition and layout optimization will simply be performed to maximize AEP.
floris.floris_model.FlorisModel WARNING Computing AEP with uniform frequencies. Results results may not reflect annual operation.
../../_images/17c245f94d23f12fb79eaba0048d68b2d272d1bfe2c570649a15613e58ee7300.png