Esempio n. 1
0
def test_max_turbines_per_cable(turbine_rating, expected):
    config = deepcopy(config_full_grid)
    config["array_system_design"]["cables"] = "XLPE_630mm_33kV"
    config["turbine"]["turbine_rating"] = turbine_rating
    array = ArraySystemDesign(config)
    array.run()
    assert array.cables["XLPE_630mm_33kV"].max_turbines == expected
Esempio n. 2
0
def test_grid_creation(config, shape, num_null):
    array = ArraySystemDesign(config)
    array.run()

    assert array.turbines_x.shape == shape
    assert array.turbines_y.shape == shape
    assert np.isnan(array.turbines_x).sum() == num_null
    assert np.isnan(array.turbines_y).sum() == num_null

    assert isinstance(array.oss_x, float)
    assert isinstance(array.oss_y, float)

    shape = (shape[0], shape[1] + 1, 2)
    assert array.coordinates.shape == shape
    assert np.isnan(array.coordinates).sum() == 2 * num_null
Esempio n. 3
0
def test_total_cable_length(config, total_length):
    array = ArraySystemDesign(config)
    array.run()

    val = round(sum(val.sum() for val in array.cable_lengths_by_type.values()),
                2)
    assert total_length == val

    val = round(sum(array.total_cable_length_by_type.values()), 2)
    assert total_length == val

    val = round(
        sum(length * n
            for val in array.design_result["array_system"]["cables"].values()
            for length, n in val["cable_sections"]),
        2,
    )
    assert total_length == val
Esempio n. 4
0
def test_string_creation(
    config,
    num_full_strings,
    num_partial_strings,
    num_turbines_full_string,
    num_turbines_partial_string,
):
    array = ArraySystemDesign(config)
    array.run()

    assert array

    string_properties = (
        (num_full_strings, "num_full_strings"),
        (num_partial_strings, "num_partial_strings"),
        (num_turbines_full_string, "num_turbines_full_string"),
        (num_turbines_partial_string, "num_turbines_partial_string"),
    )
    for val, name in string_properties:
        assert val == array.__getattribute__(name)
Esempio n. 5
0
def test_cable_not_found():
    array = ArraySystemDesign(config_cables_from_file_fail)
    with pytest.raises(LibraryItemNotFoundError):
        array.run()
Esempio n. 6
0
def test_array_system_creation():
    array = ArraySystemDesign(config_full_grid)
    array.run()
    assert array
Esempio n. 7
0
def test_floating_calculations():

    base = deepcopy(config_full_ring)
    base["site"]["depth"] = 50
    number = base["plant"]["num_turbines"]

    sim = ArraySystemDesign(base)
    sim.run()

    base_length = sim.total_length

    floating_no_cat = deepcopy(base)
    floating_no_cat["site"]["depth"] = 250
    floating_no_cat["array_system_design"]["touchdown_distance"] = 0

    sim2 = ArraySystemDesign(floating_no_cat)
    sim2.run()

    no_cat_length = sim2.total_length
    assert no_cat_length == pytest.approx(base_length + 2 * (200 / 1000) * number)

    floating_cat = deepcopy(base)
    floating_cat["site"]["depth"] = 250

    sim3 = ArraySystemDesign(floating_cat)
    sim3.run()

    with_cat_length = sim3.total_length
    assert with_cat_length < no_cat_length