示例#1
0
def test_Turbine_calculate_powercurve_error():
    a = wp.new()
    try:
        a.Turbine.calculate_powercurve(turbine_size=1500, elevation=0, max_tip_speed=80, max_tip_sp_ratio=8, cut_in=4,
                                   cut_out=25, drive_train=0)
    except:
        assert(True)
示例#2
0
def test_Turbine_calculate_powercurve_default():
    a = wp.new()
    a.Resource.wind_resource_model_choice = 0
    a.Turbine.wind_turbine_rotor_diameter = 75
    a.Turbine.wind_turbine_max_cp = 0.45
    a.Turbine.calculate_powercurve(turbine_size=1500, elevation=0, max_tip_speed=80, max_tip_sp_ratio=8, cut_in=4,
                               cut_out=25, drive_train=0)
    assert(abs(a.Turbine.wind_turbine_powercurve_windspeeds[1] - 0.25) < 0.01)
    assert(abs(a.Turbine.wind_turbine_powercurve_powerout[17] - 64.050) < 0.01)
    assert(abs(a.Turbine.wind_turbine_powercurve_powerout[45] - 1500) < 0.01)
示例#3
0
def test_wind():
    wind = str(Path(__file__).parent / "AR Northwestern-Flat Lands.srw")
    data = tools.SRW_to_wind_data(wind)
    assert (data['fields'] == [1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3])
    assert (data['heights'] == [50, 50, 50, 50, 80, 80, 80, 80, 110, 110, 110, 110, 140, 140, 140, 140])
    assert (data['data'][0] == [9.587, 0.953420183, 173, 9.466, 10.247, 0.950086356, 174, 11.637, 10.627, 0.946649889,
                                175, 13.249, 10.997, 0.94340982, 175, 14.509])

    wind_model = wp.new()
    wind_model.Resource.wind_resource_data = data
    returned_data = wind_model.Resource.wind_resource_data['data'][0]
    for i, d in enumerate(data['data'][0]):
        assert (d == pytest.approx(returned_data[i], 1e-3))