def test_twotype_windturbines(): v80 = V80() def power(ws, types): power = v80.power(ws) # add 10% type 1 turbines power[types == 1] *= 1.1 return power power_curve = hornsrev1.power_curve wts = WindTurbines(names=['V80', 'V88'], diameters=[80, 88], hub_heights=[70, 77], ct_funcs=[v80.ct_funcs[0], v80.ct_funcs[0]], power_funcs=[lambda ws, yaw: np.interp(ws, power_curve[:, 0], power_curve[:, 1]), lambda ws, yaw: np.interp(ws, power_curve[:, 0], power_curve[:, 1]) * 1.1], power_unit='w' ) import matplotlib.pyplot as plt types0 = [0] * 9 types1 = [0, 0, 0, 1, 1, 1, 0, 0, 0] types2 = [1] * 9 wts.plot(wt9_x, wt9_y, types1) wfm = NOJ(Hornsrev1Site(), wts) npt.assert_array_equal(wts.types(), [0, 1]) npt.assert_almost_equal(wfm.aep(wt9_x, wt9_y, type=types0), 81.2066072392765) npt.assert_almost_equal(wfm.aep(wt9_x, wt9_y, type=types1), 83.72420504573488) npt.assert_almost_equal(wfm.aep(wt9_x, wt9_y, type=types2), 88.87227386796884) if 0: plt.show()
def test_aep(): site = UniformSite([1], ti=0) windTurbines = IEA37_WindTurbines() wfm = NOJ(site, windTurbines) sim_res = wfm([0], [0], wd=270) npt.assert_almost_equal(sim_res.aep().sum(), 3.35 * 24 * 365 / 1000) npt.assert_almost_equal(sim_res.aep(normalize_probabilities=True).sum(), 3.35 * 24 * 365 / 1000) npt.assert_equal(sim_res.aep().data.sum(), wfm.aep([0], [0], wd=270)) npt.assert_almost_equal(sim_res.aep(normalize_probabilities=True).sum(), wfm.aep([0], [0], wd=270, normalize_probabilities=True)) npt.assert_almost_equal(sim_res.aep(with_wake_loss=False).sum(), wfm.aep([0], [0], wd=270, with_wake_loss=False))
def test_DeprecatedWindTurbines(): for wts in [ V80Deprecated(), WindTurbines( names=['V80'], diameters=[80], hub_heights=[70], ct_funcs=[ lambda ws: np.interp(ws, hornsrev1.ct_curve[:, 0], hornsrev1.ct_curve[:, 1]) ], power_funcs=[ lambda ws: np.interp(ws, hornsrev1.power_curve[:, 0], hornsrev1.power_curve[:, 1]) ], power_unit='w') ]: types0 = [0] * 9 wfm = NOJ(Hornsrev1Site(), wts) npt.assert_array_equal(wts.types(), [0]) npt.assert_almost_equal(wfm.aep(wt9_x, wt9_y, type=types0), 81.2066072392765)