Code
import numpy as np
from scipy import stats, integrateMajid Bastankhah
January 28, 2026
AEP = ∫ P(v) · f(v) dv · 8760 h/yr. This notebook wraps that integral in a clean Python function that accepts any power curve and Weibull parameters.
def aep_mwh(k, A, n_turbines=1):
"""Annual energy production in MWh."""
def integrand(v):
pdf = stats.weibull_min.pdf(v, k, scale=A)
return power_at(v) * pdf
energy, _ = integrate.quad(integrand, 0, 30)
return energy * 8760 * n_turbines
print(f'Single turbine AEP: {aep_mwh(k=2.2, A=9.5):,.0f} MWh/yr')
print(f'10-turbine farm AEP: {aep_mwh(k=2.2, A=9.5, n_turbines=10):,.0f} MWh/yr')This approach gives a gross AEP figure in milliseconds. Add wake losses, availability, and electrical losses to arrive at net AEP for LCOE calculations.