コード例 #1
0
def test_neighbour_farm_speed():
    # import and setup site and windTurbines
    site = IEA37Site(16)

    # setup current, neighbour and all positions
    wt_x, wt_y = site.initial_position.T
    neighbour_x, neighbour_y = wt_x - 4000, wt_y
    all_x, all_y = np.r_[wt_x, neighbour_x], np.r_[wt_y, neighbour_y]

    windTurbines = WindTurbines.from_WindTurbines([IEA37_WindTurbines(), IEA37_WindTurbines()])
    windTurbines._names = ["Current wind farm", "Neighbour wind farm"]
    types = [0] * len(wt_x) + [1] * len(neighbour_x)

    wf_model = PropagateDownwind(site, windTurbines,
                                 wake_deficitModel=BastankhahGaussianDeficit(use_effective_ws=True),
                                 superpositionModel=LinearSum())
    # Consider wd=270 +/- 30 deg only
    wd_lst = np.arange(240, 301)

    sim_res, t = timeit(wf_model, verbose=False)(all_x, all_y, type=types, ws=9.8, wd=wd_lst)
    if 1:
        ext = 100
        flow_box = wf_model(neighbour_x, neighbour_y, wd=wd_lst).flow_box(
            x=np.linspace(min(wt_x) - ext, max(wt_x) + ext, 53),
            y=np.linspace(min(wt_y) - ext, max(wt_y) + ext, 51),
            h=[100, 110, 120])

        wake_site = XRSite.from_flow_box(flow_box)
        wake_site.save('tmp.nc')
    else:
        wake_site = XRSite.load('tmp.nc')

    wf_model_wake_site = PropagateDownwind(wake_site, windTurbines,
                                           wake_deficitModel=BastankhahGaussianDeficit(use_effective_ws=True),
                                           superpositionModel=LinearSum())

    sim_res_wake_site, _ = timeit(wf_model_wake_site, verbose=False)(wt_x, wt_y, ws=9.8, wd=wd_lst)
    npt.assert_allclose(sim_res.aep().sel(wt=np.arange(len(wt_x))).sum(), sim_res_wake_site.aep().sum(), rtol=0.0005)
    npt.assert_array_almost_equal(sim_res.aep().sel(wt=np.arange(len(wt_x))), sim_res_wake_site.aep(), 2)
コード例 #2
0
def run_wms(swc,
            test_cases=[
                'Wieringermeer-West', 'Wieringermeer-East', 'Nibe',
                'Nordtank-500', 'NREL-5MW_TIlow', 'NREL-5MW_TIhigh'
            ],
            deficit_models=[NOJDeficit(),
                            BastankhahGaussianDeficit()],
            wds=np.linspace(-30, 30, 61)):
    '''
        Run the different wake models for the specified sites and output simulation results
    '''
    swc_out = {}
    for case in test_cases:
        swc_out[case] = swc[case]
        x_j = swc[case]['sDown'] * (np.dot(
            swc[case]['xDown'][:, na],
            np.cos(wds / 180.0 * np.pi)[na, :])).flatten()
        y_j = swc[case]['sDown'] * (np.dot(
            swc[case]['xDown'][:, na],
            np.sin(wds / 180.0 * np.pi)[na, :])).flatten()
        ii, jj = len(swc[case]['xDown']), len(wds)
        swc_out[case]['x'] = x_j.reshape(ii, jj)
        swc_out[case]['y'] = y_j.reshape(ii, jj)
        swc_out[case]['wds'] = wds
        swc_out[case]['deficit_models'] = []
        for model in deficit_models:
            # set up model
            tmp = {}
            wfm = PropagateDownwind(swc[case]['site'],
                                    swc[case]['wt'],
                                    model,
                                    superpositionModel=SquaredSum(),
                                    rotorAvgModel=RotorCenter(),
                                    turbulenceModel=STF2017TurbulenceModel())
            # simulation
            sim_res = wfm([0], [0], h=[100], wd=[270])
            lw_j, WS_eff_jlk, TI_eff_jlk = wfm._flow_map(
                x_j, y_j,
                np.ones_like(x_j) * 100, sim_res)
            deficit_name = modify_deficit_name_sw(wfm.wake_deficitModel,
                                                  TI_eff_jlk)
            tmp['bar_label'] = modify_deficit_name(wfm.wake_deficitModel)
            tmp['WS_eff'] = WS_eff_jlk[:, 0, 0].reshape(ii, jj)
            tmp['TI_eff'] = TI_eff_jlk[:, 0, 0].reshape(ii, jj)
            swc_out[case][deficit_name] = tmp
            swc_out[case]['deficit_models'].append(deficit_name)

    return swc_out
コード例 #3
0
 'deficitModel,aep_ref',
 # test that the result is equal to last run (no evidens that  these number are correct)
 [
     (NOJDeficit(), (367205.0846866496, [
         9833.86287, 8416.99088, 10820.37673, 13976.26422, 22169.66036,
         25234.9215, 37311.64388, 42786.37028, 24781.33444, 13539.82115,
         14285.22744, 31751.29488, 75140.15677, 17597.10319, 11721.21226,
         7838.84383
     ])),
     (NOJLocalDeficit(), (335151.6404628441, [
         8355.71335, 7605.92379, 10654.172, 13047.6971, 19181.46408,
         23558.34198, 36738.52415, 38663.44595, 21056.39764, 12042.79324,
         13813.46269, 30999.42279, 63947.61202, 17180.40299, 11334.12323,
         6972.14345
     ])),
     (BastankhahGaussianDeficit(), (355971.9717035484, [
         9143.74048, 8156.71681, 11311.92915, 13955.06316, 19807.65346,
         25196.64182, 39006.65223, 41463.31044, 23042.22602, 12978.30551,
         14899.26913, 32320.21637, 67039.04091, 17912.40907, 12225.04134,
         7513.75582
     ])),
     (IEA37SimpleBastankhahGaussianDeficit(),
      read_iea37_windfarm(iea37_path + 'iea37-ex16.yaml')[2]),
     (FugaDeficit(LUT_path=tfp +
                  'fuga/2MW/Z0=0.00408599Zi=00400Zeta0=0.00E+00/'),
      (404441.6306021485, [
          9912.33731, 9762.05717, 12510.14066, 15396.76584, 23017.66483,
          27799.7161, 43138.41606, 49623.79059, 24979.09001, 15460.45923,
          16723.02619, 35694.35526, 77969.14805, 19782.41376, 13721.45739,
          8950.79218
      ])),
コード例 #4
0
    return all_deficit_modules


@pytest.mark.parametrize(
    'deficitModel,aep_ref',
    # test that the result is equal to last run (no evidens that  these number are correct)
    [(NOJDeficit(), (367205.0846866496, [9833.86287, 8416.99088, 10820.37673, 13976.26422, 22169.66036,
                                         25234.9215, 37311.64388, 42786.37028, 24781.33444, 13539.82115,
                                         14285.22744, 31751.29488, 75140.15677, 17597.10319, 11721.21226,
                                         7838.84383])),
     (NOJLocalDeficit(), (335151.6404628441, [8355.71335, 7605.92379, 10654.172, 13047.6971, 19181.46408,
                                              23558.34198, 36738.52415, 38663.44595, 21056.39764, 12042.79324,
                                              13813.46269, 30999.42279, 63947.61202, 17180.40299, 11334.12323,
                                              6972.14345])),

     (BastankhahGaussianDeficit(), (355971.9717035484,
                                    [9143.74048, 8156.71681, 11311.92915, 13955.06316, 19807.65346,
                                        25196.64182, 39006.65223, 41463.31044, 23042.22602, 12978.30551,
                                        14899.26913, 32320.21637, 67039.04091, 17912.40907, 12225.04134,
                                        7513.75582])),
     (IEA37SimpleBastankhahGaussianDeficit(), read_iea37_windfarm(iea37_path + 'iea37-ex16.yaml')[2]),
     (FugaDeficit(LUT_path=tfp + 'fuga/2MW/Z0=0.00014617Zi=00399Zeta0=0.00E+0/'),
      (398938.8941139709, [9632.92248, 9733.98766, 12462.98413, 15332.30502, 22199.91899,
                           27683.32851, 42975.80734, 49481.10395, 24274.96466, 15416.63681,
                           16681.20957, 35508.27583, 75263.59612, 19679.2854, 13687.14632,
                           8925.42131])),
     (GCLDeficit(), (370863.6246093183,
                     [9385.75387, 8768.52105, 11450.13309, 14262.42186, 21178.74926,
                      25751.59502, 39483.21753, 44573.31533, 23652.09976, 13924.58752,
                      15106.11692, 32840.02909, 71830.22035, 18200.49805, 12394.7626,
                      8061.6033])),
コード例 #5
0
 'deficitModel,aep_ref',
 # test that the result is equal to last run (no evidens that  these number are correct)
 [
     (NOJDeficit(), (367205.0846866496, [
         9833.86287, 8416.99088, 10820.37673, 13976.26422, 22169.66036,
         25234.9215, 37311.64388, 42786.37028, 24781.33444, 13539.82115,
         14285.22744, 31751.29488, 75140.15677, 17597.10319, 11721.21226,
         7838.84383
     ])),
     (NOJLocalDeficit(), (335151.6404628441, [
         8355.71335, 7605.92379, 10654.172, 13047.6971, 19181.46408,
         23558.34198, 36738.52415, 38663.44595, 21056.39764, 12042.79324,
         13813.46269, 30999.42279, 63947.61202, 17180.40299, 11334.12323,
         6972.14345
     ])),
     (BastankhahGaussianDeficit(), (355971.9717035484, [
         9143.74048, 8156.71681, 11311.92915, 13955.06316, 19807.65346,
         25196.64182, 39006.65223, 41463.31044, 23042.22602, 12978.30551,
         14899.26913, 32320.21637, 67039.04091, 17912.40907, 12225.04134,
         7513.75582
     ])),
     (IEA37SimpleBastankhahGaussianDeficit(),
      read_iea37_windfarm(iea37_path + 'iea37-ex16.yaml')[2]),
     (FugaDeficit(LUT_path=tfp +
                  'fuga/2MW/Z0=0.00014617Zi=00399Zeta0=0.00E+0/'),
      (398938.8941139709, [
          9632.92248, 9733.98766, 12462.98413, 15332.30502, 22199.91899,
          27683.32851, 42975.80734, 49481.10395, 24274.96466, 15416.63681,
          16681.20957, 35508.27583, 75263.59612, 19679.2854, 13687.14632,
          8925.42131
      ])),