Esempio n. 1
0
 def __init__(self, site, windTurbines, rotorAvgModel=RotorCenter(), superpositionModel=LinearSum(),
              deflectionModel=None, turbulenceModel=None):
     PropagateDownwind.__init__(self, site, windTurbines, wake_deficitModel=GCLDeficit(),
                                rotorAvgModel=rotorAvgModel, superpositionModel=superpositionModel,
                                deflectionModel=deflectionModel, turbulenceModel=turbulenceModel)
Esempio n. 2
0
def test_check_model():
    check_model(LinearSum(), SuperpositionModel)
Esempio n. 3
0
 def get_wf_model(cls):
     return cls(site, NibeA0, wake_deficitModel=NoWakeDeficit(),
                superpositionModel=LinearSum(),
                turbulenceModel=STF2017TurbulenceModel())
Esempio n. 4
0
def main():
    if __name__ == '__main__':
        import matplotlib.pyplot as plt
        from py_wake.examples.data.hornsrev1 import Hornsrev1Site
        from py_wake.examples.data import hornsrev1
        from py_wake.superposition_models import LinearSum
        from py_wake.wind_farm_models import All2AllIterative

        site = Hornsrev1Site()
        windTurbines = hornsrev1.HornsrevV80()
        ws = 10
        D = 80
        R = D / 2
        WS_ilk = np.array([[[ws]]])
        D_src_il = np.array([[D]])
        ct_ilk = np.array([[[.8]]])
        ss = SelfSimilarityDeficit()
        ss20 = SelfSimilarityDeficit2020()

        x, y = -np.arange(200), np.array([0])
        # original model
        deficit = ss.calc_deficit(WS_ilk=WS_ilk,
                                  D_src_il=D_src_il,
                                  dw_ijlk=x.reshape((1, len(x), 1, 1)),
                                  cw_ijlk=y.reshape((1, len(y), 1, 1)),
                                  ct_ilk=ct_ilk)
        # updated method
        deficit20 = ss20.calc_deficit(WS_ilk=WS_ilk,
                                      D_src_il=D_src_il,
                                      dw_ijlk=x.reshape((1, len(x), 1, 1)),
                                      cw_ijlk=y.reshape((1, len(y), 1, 1)),
                                      ct_ilk=ct_ilk)
        plt.figure()
        plt.title('Fig 11 from [1]')
        plt.xlabel('x/R')
        plt.ylabel('a')
        plt.plot(x / R, deficit[0, :, 0, 0] / ws, label='original')
        plt.plot(x / R, deficit20[0, :, 0, 0] / ws, '--', label='updated')
        plt.legend()

        plt.figure()
        x, y = np.array([-2 * R]), np.arange(200)
        deficit = ss.calc_deficit(WS_ilk=WS_ilk,
                                  D_src_il=D_src_il,
                                  dw_ijlk=x.reshape((1, len(x), 1, 1)),
                                  cw_ijlk=y.reshape((1, len(y), 1, 1)),
                                  ct_ilk=ct_ilk)
        deficit20 = ss20.calc_deficit(WS_ilk=WS_ilk,
                                      D_src_il=D_src_il,
                                      dw_ijlk=x.reshape((1, len(x), 1, 1)),
                                      cw_ijlk=y.reshape((1, len(y), 1, 1)),
                                      ct_ilk=ct_ilk)
        plt.title('Fig 10 from [1]')
        r12 = ss.r12(x / R)
        r12_20 = ss20.r12(x / R)
        plt.xlabel('y/R12 (epsilon)')
        plt.ylabel('f')
        plt.plot((y / R) / r12,
                 deficit[0, :, 0, 0] / deficit[0, 0, 0, 0],
                 label='original')
        plt.plot((y / R) / r12_20,
                 deficit20[0, :, 0, 0] / deficit20[0, 0, 0, 0],
                 '--',
                 label='updated')
        plt.legend()

        plt.figure()
        noj_ss = All2AllIterative(site,
                                  windTurbines,
                                  wake_deficitModel=NoWakeDeficit(),
                                  superpositionModel=LinearSum(),
                                  blockage_deficitModel=ss)
        noj_ss20 = All2AllIterative(site,
                                    windTurbines,
                                    wake_deficitModel=NoWakeDeficit(),
                                    superpositionModel=LinearSum(),
                                    blockage_deficitModel=ss20)
        flow_map = noj_ss(x=[0], y=[0], wd=[270], ws=[10]).flow_map()
        flow_map20 = noj_ss20(x=[0], y=[0], wd=[270], ws=[10]).flow_map()
        clevels = [.9, .95, .98, .99, .995, .998, .999, 1., 1.01, 1.02, 1.03]
        flow_map.plot_wake_map()
        plt.contour(flow_map.x,
                    flow_map.y,
                    flow_map.WS_eff[:, :, 0, -1, 0] / 10,
                    levels=clevels,
                    colors='k',
                    linewidths=0.5)
        plt.contour(flow_map.x,
                    flow_map.y,
                    flow_map20.WS_eff[:, :, 0, -1, 0] / 10,
                    levels=clevels,
                    colors='r',
                    linewidths=0.5)
        plt.title('Original (black) vs updated (red)')
        plt.show()

        from py_wake.examples.data.iea37._iea37 import IEA37Site
        from py_wake.examples.data.iea37._iea37 import IEA37_WindTurbines

        # setup site, turbines and wind farm model
        site = IEA37Site(16)
        x, y = site.initial_position.T
        windTurbines = IEA37_WindTurbines()

        noj_ss = All2AllIterative(site,
                                  windTurbines,
                                  wake_deficitModel=NoWakeDeficit(),
                                  superpositionModel=LinearSum(),
                                  blockage_deficitModel=ss)
        noj_ss20 = All2AllIterative(site,
                                    windTurbines,
                                    wake_deficitModel=NoWakeDeficit(),
                                    superpositionModel=LinearSum(),
                                    blockage_deficitModel=ss20)
        # run wind farm simulation
        sim_res = noj_ss(x, y, wd=[0, 30, 45, 60, 90], ws=[5, 10, 15])
        sim_res20 = noj_ss20(x, y, wd=[0, 30, 45, 60, 90], ws=[5, 10, 15])

        # calculate AEP
        aep = sim_res.aep().sum()
        aep20 = sim_res20.aep().sum()

        # plot wake map
        fig, (ax1, ax2) = plt.subplots(1,
                                       2,
                                       figsize=(9, 4.5),
                                       tight_layout=True)
        levels = np.array(
            [.9, .95, .98, .99, .995, .998, .999, 1., 1.01, 1.02, 1.03]) * 10.
        print(noj_ss)
        flow_map = sim_res.flow_map(wd=30, ws=10.)
        flow_map.plot_wake_map(levels=levels, ax=ax1, plot_colorbar=False)
        ax1.set_title('Original Self-Similar, AEP: %.3f GWh' % aep)

        # plot wake map
        print(noj_ss20)
        flow_map = sim_res20.flow_map(wd=30, ws=10.)
        flow_map.plot_wake_map(levels=levels, ax=ax2, plot_colorbar=False)
        ax2.set_title('Self-Similar 2020, AEP: %.3f GWh' % aep20)
        plt.show()