def main(): if __name__ == '__main__': from py_wake.aep_calculator import AEPCalculator from py_wake.examples.data.iea37 import iea37_path from py_wake.examples.data.iea37._iea37 import IEA37_Site from py_wake.examples.data.iea37._iea37 import IEA37_WindTurbines # setup site, turbines and wakemodel site = IEA37_Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines(iea37_path + 'iea37-335mw.yaml') from py_wake.tests.test_files import tfp path = tfp + 'fuga/2MW/Z0=0.03000000Zi=00401Zeta0=0.00E+0/' wake_model = Fuga(path, windTurbines) # calculate AEP aep_calculator = AEPCalculator(site, windTurbines, wake_model) aep = aep_calculator.calculate_AEP(x, y)[0].sum() # plot wake map import matplotlib.pyplot as plt aep_calculator.plot_wake_map(wt_x=x, wt_y=y, wd=[0], ws=[9]) plt.title('AEP: %.2f GWh' % aep) windTurbines.plot(x, y) plt.show()
def run_NOJ(): windTurbines = IEA37_WindTurbines() site = IEA37_Site(64) wake_model = NOJ(windTurbines) aep_calculator = AEPCalculator(site, windTurbines, wake_model) x, y = site.initial_position.T print(aep_calculator.calculate_AEP(x, y).sum())
def test_wake_map(): site = IEA37_Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines() wake_model = NOJ(windTurbines) aep = AEPCalculator(site, windTurbines, wake_model) x_j = np.linspace(-1500, 1500, 200) y_j = np.linspace(-1500, 1500, 100) X, Y, Z = aep.wake_map(x_j, y_j, 110, x, y, wd=[0], ws=[9]) if 0: import matplotlib.pyplot as plt c = plt.contourf(X, Y, Z) # , np.arange(2, 10, .01)) plt.colorbar(c) windTurbines.plot(x, y) plt.show() ref = [ 3.27, 3.27, 9.0, 7.46, 7.46, 7.46, 7.46, 7.31, 7.31, 7.31, 7.31, 8.3, 8.3, 8.3, 8.3, 8.3, 8.3 ] npt.assert_array_almost_equal(Z[49, 100:133:2], ref, 2)
def test_IEA37SimpleBastankhahGaussian_wake_map(): site = IEA37_Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines(iea37_path + 'iea37-335mw.yaml') wake_model = IEA37SimpleBastankhahGaussian(windTurbines) aep = AEPCalculator(site, windTurbines, wake_model) x_j = np.linspace(-1500, 1500, 200) y_j = np.linspace(-1500, 1500, 100) X, Y, Z = aep.wake_map(x_j, y_j, 110, x, y, wd=[0], ws=[9]) # test that the result is equal to last run (no evidens that these number are correct) ref = [ 3.32, 4.86, 7.0, 8.1, 7.8, 7.23, 6.86, 6.9, 7.3, 7.82, 8.11, 8.04, 7.87, 7.79, 7.85, 8.04, 8.28 ] npt.assert_array_almost_equal(Z[49, 100:133:2], ref, 2) if 0: import matplotlib.pyplot as plt c = plt.contourf(X, Y, Z, np.arange(2, 9.1, .01)) plt.colorbar(c) site.plot_windturbines(x, y) plt.plot(X[49, 100:133:2], Y[49, 100:133:2], '-.') plt.show()
def test_BastankhahGaussian_wake_map(): site = IEA37_Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines(iea37_path + 'iea37-335mw.yaml') wake_model = BastankhahGaussian(windTurbines) aep = AEPCalculator(site, windTurbines, wake_model) x_j = np.linspace(-1500, 1500, 200) y_j = np.linspace(-1500, 1500, 100) X, Y, Z = aep.wake_map(x_j, y_j, 110, x, y, wd=[0], ws=[9]) # test that the result is equal to last run (no evidens that these number are correct) ref = [ 0.18, 3.6, 7.27, 8.32, 7.61, 6.64, 5.96, 6.04, 6.8, 7.69, 8.08, 7.87, 7.59, 7.46, 7.55, 7.84, 8.19 ] if 0: import matplotlib.pyplot as plt c = plt.contourf(X, Y, Z, np.arange(-.25, 9.1, .01)) plt.colorbar(c) windTurbines.plot(x, y) plt.show() npt.assert_array_almost_equal(Z[49, 100:133:2], ref, 2)
def test_BastankhahGaussian_ex16(): site = IEA37_Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines(iea37_path + 'iea37-335mw.yaml') wake_model = BastankhahGaussian(windTurbines) if 0: import matplotlib.pyplot as plt windTurbines.plot(x, y) plt.show() aep = AEPCalculator(site, windTurbines, wake_model) aep_ilk = aep.calculate_AEP(x, y, wd=np.arange(0, 360, 22.5), ws=[9.8]) aep_MW_l = aep_ilk.sum((0, 2)) * 1000 # test that the result is equal to last run (no evidens that these number are correct) aep_ref = (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 ]) npt.assert_almost_equal(aep_MW_l.sum(), aep_ref[0], 5) npt.assert_array_almost_equal(aep_MW_l, aep_ref[1], 5)
def test_aep_map(): site = IEA37_Site(16) x = [0, 0] y = [0, 200] windTurbines = IEA37_WindTurbines(iea37_path + 'iea37-335mw.yaml') wake_model = IEA37SimpleBastankhahGaussian(windTurbines) aep = AEPCalculator(site, windTurbines, wake_model) # print(aep.calculate_AEP([0], [0]).sum()) x_j = np.arange(-150, 150, 20) y_j = np.arange(-250, 250, 20) X, Y, Z = aep.aep_map(x_j, y_j, 0, x, y, wd=[0], ws=np.arange(3, 25)) # print(y_j) if 0: import matplotlib.pyplot as plt c = plt.contourf(X, Y, Z, 100) # , np.arange(2, 10, .01)) plt.colorbar(c) windTurbines.plot(x, y) plt.show() # print(np.round(Z[17], 2).tolist()) ref = [ 21.5, 21.4, 21.02, 20.34, 18.95, 16.54, 13.17, 10.17, 10.17, 13.17, 16.54, 18.95, 20.34, 21.02, 21.4 ] npt.assert_array_almost_equal(Z[17], ref, 2)
def main(): if __name__ == '__main__': from py_wake.aep_calculator import AEPCalculator from py_wake.examples.data.iea37 import iea37_path from py_wake.examples.data.iea37._iea37 import IEA37_Site from py_wake.examples.data.iea37._iea37 import IEA37_WindTurbines # setup site, turbines and wakemodel site = IEA37_Site(16) x, y = site.initial_position.T windTurbines = IEA37_WindTurbines(iea37_path + 'iea37-335mw.yaml') wake_model = IEA37SimpleBastankhahGaussian(windTurbines) # calculate AEP aep_calculator = AEPCalculator(site, windTurbines, wake_model) aep = aep_calculator.calculate_AEP(x, y)[0].sum() # plot wake mape import matplotlib.pyplot as plt aep_calculator.plot_wake_map(wt_x=x, wt_y=y, wd=[0], ws=[9]) plt.title('AEP: %.2f GWh' % aep) windTurbines.plot(x, y) plt.show()