def test_gauss_to_curl_to_gauss(sample_inputs_fixture):
    """
    Start with the Gauss wake model
    Then, switch to Curl
    Then, switch back to Gauss
    """
    # Establish that the Gauss test passes
    sample_inputs_fixture.floris["wake"]["properties"][
        "velocity_model"] = "gauss_legacy"
    sample_inputs_fixture.floris["wake"]["properties"][
        "deflection_model"] = "gauss"
    floris = Floris(input_dict=sample_inputs_fixture.floris)
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i in range(len(floris.farm.turbine_map.turbines)):
        baseline = gauss_baseline
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])

    # Change the model to Curl, rerun calculate_wake, and compare to Curl
    floris.farm.set_wake_model("curl")
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i in range(len(floris.farm.turbine_map.turbines)):
        baseline = curl_baseline
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])

    # Change back to Gauss, rerun calculate_wake, and compare to gauss
    floris.farm.set_wake_model("gauss_legacy")
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i in range(len(floris.farm.turbine_map.turbines)):
        baseline = gauss_baseline
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])
Example #2
0
def test_regression_yaw(sample_inputs_fixture):
    """
    Tandem turbines with the upstream turbine yawed
    """
    sample_inputs_fixture.floris["wake"]["properties"][
        "velocity_model"
    ] = VELOCITY_MODEL
    sample_inputs_fixture.floris["wake"]["properties"][
        "deflection_model"
    ] = DEFLECTION_MODEL
    floris = Floris(input_dict=sample_inputs_fixture.floris)

    # yaw the upstream turbine 5 degrees
    floris.farm.turbines[0].yaw_angle = 5.0
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i in range(len(floris.farm.turbine_map.turbines)):
        baseline = yawed_baseline
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])
Example #3
0
def test_regression_secondary_steering(sample_inputs_fixture):
    """
    Tandem turbines with the upstream turbine yawed and yaw added recovery
    correction enabled
    """
    sample_inputs_fixture.floris["wake"]["properties"][
        "velocity_model"
    ] = VELOCITY_MODEL
    sample_inputs_fixture.floris["wake"]["properties"][
        "deflection_model"
    ] = DEFLECTION_MODEL
    floris = Floris(input_dict=sample_inputs_fixture.floris)
    floris.farm.turbines[0].yaw_angle = 5.0

    # Enable secondary steering
    floris.farm.wake.deflection_model.use_secondary_steering = True
    floris.farm.wake.velocity_model.calculate_VW_velocities = True
    floris.farm.flow_field.reinitialize_flow_field()
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i in range(len(floris.farm.turbine_map.turbines)):
        check = secondary_steering_baseline
        assert test_results[i][0] == approx(check[i][0])
        assert test_results[i][1] == approx(check[i][1])
        assert test_results[i][2] == approx(check[i][2])
        assert test_results[i][3] == approx(check[i][3])
Example #4
0
def test_change_wind_direction(sample_inputs_fixture):
    """
    Tandem turbines aligned to the wind direction, first calculated at 270 degrees wind
    direction, and then calculated at 315 degrees wind direction.
    """
    sample_inputs_fixture.floris["wake"]["properties"][
        "velocity_model"
    ] = VELOCITY_MODEL
    sample_inputs_fixture.floris["wake"]["properties"][
        "deflection_model"
    ] = DEFLECTION_MODEL
    floris = Floris(input_dict=sample_inputs_fixture.floris)
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i, turbine in enumerate(floris.farm.turbine_map.turbines):
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])

    floris.farm.wind_map.input_direction = [315.0]
    floris.farm.wind_map.calculate_wind_direction()
    floris.farm.turbine_map.reinitialize_turbines()
    floris.farm.flow_field.reinitialize_flow_field()

    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i, turbine in enumerate(floris.farm.turbine_map.turbines):
        assert test_results[i][0] == approx(wd315_baseline[i][0])
        assert test_results[i][1] == approx(wd315_baseline[i][1])
        assert test_results[i][2] == approx(wd315_baseline[i][2])
        assert test_results[i][3] == approx(wd315_baseline[i][3])
Example #5
0
def test_regression_multiple_calc_wake(sample_inputs_fixture):
    """
    Verify turbine values stay the same with repeated (3x) calculate_wake calls.
    """
    sample_inputs_fixture.floris["wake"]["properties"][
        "velocity_model"
    ] = VELOCITY_MODEL
    sample_inputs_fixture.floris["wake"]["properties"][
        "deflection_model"
    ] = DEFLECTION_MODEL
    floris = Floris(input_dict=sample_inputs_fixture.floris)
    floris.farm.flow_field.calculate_wake()
    test_results = turbines_to_array(floris.farm.turbine_map.turbines)
    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)
    for i, turbine in enumerate(floris.farm.turbine_map.turbines):
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])

    floris.farm.flow_field.calculate_wake()
    test_results = turbines_to_array(floris.farm.turbine_map.turbines)
    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)
    for i, turbine in enumerate(floris.farm.turbine_map.turbines):
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])

    floris.farm.flow_field.calculate_wake()
    test_results = turbines_to_array(floris.farm.turbine_map.turbines)
    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)
    for i, turbine in enumerate(floris.farm.turbine_map.turbines):
        assert test_results[i][0] == approx(baseline[i][0])
        assert test_results[i][1] == approx(baseline[i][1])
        assert test_results[i][2] == approx(baseline[i][2])
        assert test_results[i][3] == approx(baseline[i][3])
Example #6
0
def test_regression_tandem(sample_inputs_fixture):
    """
    Tandem turbines
    """
    sample_inputs_fixture.floris["wake"]["properties"][
        "velocity_model"
    ] = VELOCITY_MODEL
    sample_inputs_fixture.floris["wake"]["properties"][
        "deflection_model"
    ] = DEFLECTION_MODEL
    floris = Floris(input_dict=sample_inputs_fixture.floris)
    floris.farm.flow_field.calculate_wake()

    test_results = turbines_to_array(floris.farm.turbine_map.turbines)

    if DEBUG:
        print_test_values(floris.farm.turbine_map.turbines)

    for i in range(len(floris.farm.turbine_map.turbines)):
        check = baseline
        assert test_results[i][0] == approx(check[i][0])
        assert test_results[i][1] == approx(check[i][1])
        assert test_results[i][2] == approx(check[i][2])
        assert test_results[i][3] == approx(check[i][3])