← All posts

Automating AEP Calculations with Python

python
yield-assessment
LCOE
A reproducible pipeline: wind rose + power curve → annual energy production.
Author

Majid Bastankhah

Published

January 28, 2026

Introduction

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.

Code
import numpy as np
from scipy import stats, integrate
Code
# Simplified power curve (MW)
v_pc = np.array([0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 25, 26])
p_pc = np.array([0, 0, 0.1, 0.3, 0.6, 1.0, 1.6, 2.3, 3.2, 4.5, 5.0, 5.0, 5.0, 0])

def power_at(v):
    return float(np.interp(v, v_pc, p_pc))
Code
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')

Conclusion

This approach gives a gross AEP figure in milliseconds. Add wake losses, availability, and electrical losses to arrive at net AEP for LCOE calculations.