def test_regression_triangle_farm():
    """
    Triangle farm where wind direction of 270 and 360 should result in the same power
    """
    test_class = JensenJimenezRegressionTest()
    distance = 5 * \
        test_class.input_dict["turbine"]["properties"]["rotor_diameter"]
    test_class.input_dict["farm"]["properties"]["layout_x"] = [
        0.0, distance, 0.0
    ]
    test_class.input_dict["farm"]["properties"]["layout_y"] = [
        distance, distance, 0.0
    ]
    floris = Floris(input_dict=test_class.input_dict)

    ### unrotated
    floris.farm.flow_field.calculate_wake()

    # turbine 1 - unwaked
    turbine = floris.farm.turbine_map.turbines[0]
    local = (turbine.Cp, turbine.Ct, turbine.power, turbine.aI,
             turbine.average_velocity)
    assert pytest.approx(local) == test_class.baseline(0)

    # turbine 2 - waked
    turbine = floris.farm.turbine_map.turbines[1]
    local = (turbine.Cp, turbine.Ct, turbine.power, turbine.aI,
             turbine.average_velocity)
    assert pytest.approx(local) == test_class.baseline(1)

    # turbine 3 - unwaked
    turbine = floris.farm.turbine_map.turbines[2]
    local = (turbine.Cp, turbine.Ct, turbine.power, turbine.aI,
             turbine.average_velocity)
    assert pytest.approx(local) == test_class.baseline(0)

    ### rotated
    floris.farm.flow_field.reinitialize_flow_field(wind_direction=360)
    floris.calculate_wake()

    # turbine 1 - unwaked
    turbine = floris.farm.turbine_map.turbines[0]
    local = (turbine.Cp, turbine.Ct, turbine.power, turbine.aI,
             turbine.average_velocity)
    assert pytest.approx(local) == test_class.baseline(0)

    # turbine 2 - unwaked
    turbine = floris.farm.turbine_map.turbines[1]
    local = (turbine.Cp, turbine.Ct, turbine.power, turbine.aI,
             turbine.average_velocity)
    assert pytest.approx(local) == test_class.baseline(0)

    # turbine 3 - waked
    turbine = floris.farm.turbine_map.turbines[2]
    local = (turbine.Cp, turbine.Ct, turbine.power, turbine.aI,
             turbine.average_velocity)
    assert pytest.approx(local) == test_class.baseline(1)
Esempio n. 2
0
specific language governing permissions and limitations under the License.
"""
from floris import Floris

# import sys
# sys.path.append('../floris')
from floris.floris import Floris
import OptModules
import numpy as np
from scipy.optimize import minimize
import warnings

warnings.simplefilter('ignore', RuntimeWarning)

# load floris
floris = Floris()

# setup floris and process input file
floris.process_input("floris.json")

# plot initial flow field
floris.farm.flow_field.plot_z_planes([0.5])

# initialize
turbines      = [turbine for _, turbine in floris.farm.flow_field.turbine_map.items()]
power_initial = np.sum([turbine.power for turbine in turbines])  # determine initial power production

# enter min and max yaw angles for the optimization  
minimum_yaw_angle = 0.0
maximum_yaw_angle = 20.0
Esempio n. 3
0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from floris import Floris
import floris.optimization as flopt
import numpy as np

# Setup floris with the Gauss velocity and deflection models
floris = Floris("example_input.json")
floris.farm.set_wake_model("gauss")

# Run floris with no yaw
floris.farm.set_yaw_angles(0.0, calculate_wake=True)

# Determine initial power production
power_initial = np.sum([turbine.power for turbine in floris.farm.turbines])

# Set bounds for the optimization on the yaw angles (deg)
minimum_yaw, maximum_yaw = 0.0, 25.0

# Compute the optimal yaw angles
opt_yaw_angles = flopt.wake_steering(floris, minimum_yaw, maximum_yaw)
print('Optimal yaw angles for:')
for i, yaw in enumerate(opt_yaw_angles):