def test_with_all_deficit_models(WFM, deficitModel): site = IEA37Site(16) windTurbines = IEA37_WindTurbines() wfm = WFM(site, windTurbines, wake_deficitModel=deficitModel, rotorAvgModel=RotorCenter(), superpositionModel=LinearSum(), deflectionModel=None, turbulenceModel=STF2017TurbulenceModel()) wfm2 = WFM(site, windTurbines, wake_deficitModel=deficitModel, rotorAvgModel=EqGridRotorAvg(1), superpositionModel=LinearSum(), deflectionModel=None, turbulenceModel=STF2017TurbulenceModel()) kwargs = { 'x': [0, 0, 500, 500], 'y': [0, 500, 0, 500], 'wd': [0], 'ws': [8] } npt.assert_equal(wfm.aep(**kwargs), wfm2.aep(**kwargs))
def test_RotorGridAvg_deficit(): site = IEA37Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines() wfm = IEA37SimpleBastankhahGaussian(site, windTurbines) flow_map = wfm([0, 500], [0, 0], wd=270, ws=10).flow_map(HorizontalGrid(x=[500], y=np.arange(-100, 100))) plt.plot(flow_map.Y[:, 0], flow_map.WS_eff_xylk[:, 0, 0, 0]) R = windTurbines.diameter() / 2 for name, rotorAvgModel, ref1 in [ ('RotorCenter', RotorCenter(), 7.172723970425709), ('RotorGrid2', EqGridRotorAvg(2), 7.495889360682771), ('RotorGrid3', EqGridRotorAvg(3), 7.633415167369133), ('RotorGrid4', EqGridRotorAvg(4), 7.710215921858325), ('RotorGrid100', EqGridRotorAvg(100), 7.820762402628349), ('RotorGQGrid_4,3', GQGridRotorAvg(4, 3), 7.826105012683896), ('RotorCGI4', CGIRotorAvg(4), 7.848406907726826), ('RotorCGI4', CGIRotorAvg(7), 7.819900693605533), ('RotorCGI4', CGIRotorAvg(9), 7.82149363932618), ('RotorCGI4', CGIRotorAvg(21), 7.821558905416136)]: # test with PropagateDownwind wfm = IEA37SimpleBastankhahGaussian(site, windTurbines, rotorAvgModel=rotorAvgModel) sim_res = wfm([0, 500], [0, 0], wd=270, ws=10) npt.assert_almost_equal(sim_res.WS_eff_ilk[1, 0, 0], ref1) # test with All2AllIterative wfm = All2AllIterative(site, windTurbines, IEA37SimpleBastankhahGaussianDeficit(), rotorAvgModel=rotorAvgModel, superpositionModel=SquaredSum()) sim_res = wfm([0, 500], [0, 0], wd=270, ws=10) npt.assert_almost_equal(sim_res.WS_eff_ilk[1, 0, 0], ref1) plt.plot([-R, R], [sim_res.WS_eff_ilk[1, 0, 0]] * 2, label=name) if 0: plt.legend() plt.show() plt.close('all')
def test_RotorGridAvg_ti(): site = IEA37Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines() wfm = IEA37SimpleBastankhahGaussian(site, windTurbines, turbulenceModel=STF2017TurbulenceModel()) flow_map = wfm([0, 500], [0, 0], wd=270, ws=10).flow_map(HorizontalGrid(x=[500], y=np.arange(-100, 100))) plt.plot(flow_map.Y[:, 0], flow_map.TI_eff_xylk[:, 0, 0, 0]) R = windTurbines.diameter() / 2 for name, rotorAvgModel, ref1 in [ ('RotorCenter', RotorCenter(), 0.22292190804089568), ('RotorGrid2', EqGridRotorAvg(2), 0.2111162769995657), ('RotorGrid3', EqGridRotorAvg(3), 0.2058616982653193), ('RotorGrid4', EqGridRotorAvg(4), 0.2028701990648858), ('RotorGrid100', EqGridRotorAvg(100), 0.1985255601976247), ('RotorGQGrid_4,3', GQGridRotorAvg(4, 3), 0.1982984399750206)]: # test with PropagateDownwind wfm = IEA37SimpleBastankhahGaussian(site, windTurbines, rotorAvgModel=rotorAvgModel, turbulenceModel=STF2017TurbulenceModel()) sim_res = wfm([0, 500], [0, 0], wd=270, ws=10) npt.assert_almost_equal(sim_res.TI_eff_ilk[1, 0, 0], ref1) # test with All2AllIterative wfm = All2AllIterative(site, windTurbines, IEA37SimpleBastankhahGaussianDeficit(), rotorAvgModel=rotorAvgModel, superpositionModel=SquaredSum(), turbulenceModel=STF2017TurbulenceModel()) sim_res = wfm([0, 500], [0, 0], wd=270, ws=10) npt.assert_almost_equal(sim_res.TI_eff_ilk[1, 0, 0], ref1) plt.plot([-R, R], [sim_res.TI_eff_ilk[1, 0, 0]] * 2, label=name) if 0: plt.legend() plt.show() plt.close('all')
def test_RotorEqGridAvg(): m = EqGridRotorAvg(3) npt.assert_array_almost_equal(m.nodes_x, [-0.5, 0.0, 0.5, -0.5, 0.0, 0.5, -0.5, 0.0, 0.5], 2) npt.assert_array_almost_equal(m.nodes_y, [-0.5, -0.5, -0.5, 0.0, 0.0, 0.0, 0.5, 0.5, 0.5], 2) if 0: for v in [m.nodes_x, m.nodes_y]: print(np.round(v, 2).tolist()) plt.scatter(m.nodes_x, m.nodes_y, c=m.nodes_weight) plt.axis('equal') plt.gca().add_artist(plt.Circle((0, 0), 1, fill=False)) plt.ylim([-1, 1]) plt.show()
def test_RotorAvg_deficit(): site = IEA37Site(16) windTurbines = IEA37_WindTurbines() wfm = IEA37SimpleBastankhahGaussian(site, windTurbines, turbulenceModel=STF2017TurbulenceModel()) flow_map = wfm([0, 500], [0, 0], wd=270, ws=10).flow_map(HorizontalGrid(x=[500], y=np.arange(-100, 100))) plt.plot(flow_map.Y[:, 0], flow_map.TI_eff_xylk[:, 0, 0, 0]) R = windTurbines.diameter() / 2 for name, rotorAvgModel, ref1 in [ ('None', None, 0.22292190804089568), ('RotorCenter', RotorCenter(), 0.22292190804089568), ('RotorGrid100', EqGridRotorAvg(100), 0.1989725533174574), ('RotorGQGrid_4,3', GQGridRotorAvg(4, 3), 0.19874837617113356), ('RotorCGI4', CGIRotorAvg(4), 0.19822024411411204), ('RotorCGI4', CGIRotorAvg(21), 0.1989414764606653)]: # test with PropagateDownwind wfm = IEA37SimpleBastankhahGaussian(site, windTurbines, turbulenceModel=STF2017TurbulenceModel(rotorAvgModel=rotorAvgModel)) sim_res = wfm([0, 500], [0, 0], wd=270, ws=10) npt.assert_almost_equal(sim_res.TI_eff_ilk[1, 0, 0], ref1, err_msg=name) # test with All2AllIterative wfm = All2AllIterative(site, windTurbines, IEA37SimpleBastankhahGaussianDeficit(), turbulenceModel=STF2017TurbulenceModel(rotorAvgModel=rotorAvgModel), superpositionModel=SquaredSum()) sim_res = wfm([0, 500], [0, 0], wd=270, ws=10) npt.assert_almost_equal(sim_res.TI_eff_ilk[1, 0, 0], ref1) plt.plot([-R, R], [sim_res.WS_eff_ilk[1, 0, 0]] * 2, label=name) if 0: plt.legend() plt.show() plt.close()