Skip to content

maulviazmi/pywake-simulation-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wind Farm Zone Simulation — wind_farm_framework.ipynb

This repository contains a compact Jupyter notebook, wind_farm_framework.ipynb, for running simplified wind-farm analyses across multiple zones using PyWake's engineering wake models (or a minimal fallback when PyWake is unavailable).

Basic capabilities

  • Load zone layouts (turbine coordinates) from Zone Layout UTM.txt (tab-separated).
  • Load per-zone wind conditions (Weibull parameters, mean direction, U10) from Zone Wind Conditions.txt if present.
  • Build a simple wind-farm model (default: IEA37Site + PropagateDownwind + BastankhahGaussianDeficit + LinearSum) and compute per-turbine AEP (GWh) using:
  • An integration over a Weibull-distributed wind speed grid (discrete ws grid by default)
  • Produce per-zone diagnostic flow maps (best-effort; falls back to a per-turbine scatter plot if PyWake plotting APIs differ).
  • Export per-zone summaries and capacity factors to zone_results.csv.

Inputs

  • Zone Layout UTM.txt (tab-separated): expected to contain at least columns matching OBJECTID, Zone, x_coordinate, y_coordinate. The loader tries case-insensitive and partial matches for these column names.
  • Zone Wind Conditions.txt (tab-separated, optional): first column should match zone name; other columns can contain mean wind (U10), mean direction (wd), Weibull shape (k / weibull_k) and scale (A / weibull_a) values. The loader uses reasonable fallbacks if columns are named differently.

How it computes power and AEP (single turbine, no wakes)

  • Hub wind speed is estimated using a power-law shear:

    U_hub = U10 * (z_hub / z_ref)^alpha

  • Wind speed distribution is assumed Weibull with shape k and scale A:

    f_W(w) = (k / A) (w / A)^{k-1} exp[-(w / A)^k]

  • Turbine electrical power P(w) is taken from the turbine model (GenericWindTurbine / PyWake). The notebook numerically integrates mean power:

    AEP (GWh) = H / 1e9 * sum_i P(w_i) f_W(w_i) delta_w

    where H = 8760 hours/year.

Requirements

  • Python 3.8+ recommended.
  • (for full functionality): PyWake installed in the kernel environment. The notebook imports:
    • py_wake.wind_turbines.generic_wind_turbines.GenericWindTurbine
    • py_wake.wind_turbines.WindTurbines
    • py_wake.examples.data.iea37.IEA37Site (default site)
    • py_wake.wind_farm_models.engineering_models.PropagateDownwind
    • py_wake.deficit_models.gaussian.BastankhahGaussianDeficit
    • py_wake.superposition_models.LinearSum
  • Python packages: numpy, pandas, matplotlib, scipy

Install PyWake per the PyWake documentation (conda/pip as appropriate). If PyWake is not available, the notebook raises an informative ImportError at import time.

Usage

  1. Open wind_farm_framework.ipynb in Jupyter (or JupyterLab).
  2. Run Cell 1 (setup) to configure the turbine and model factory.
  3. Edit or run Cell 2 to load zone layouts and optional wind condition files.
  4. Run Cell 3 (core helpers) and Cell 4 (batch driver) to compute AEP and save diagnostics. For a fast preview set calculate_aep=False in the driver.
  5. Use Cell 5 to view summary plots and export results.

Limitations and known issues

  • PyWake API differences: PyWake's SimulationResult and site objects may change between PyWake versions. The notebook includes robust fallbacks, but some advanced site-specific plotting or windrose extraction may fail depending on PyWake version.
  • Flow maps: rendering PyWake flow maps to static PNGs is best-effort — some PyWake plot methods don't render directly into Matplotlib figures without specific arguments. The notebook attempts multiple strategies (explicit ax/fig, canvas draw, fallback scatter) but you may still need to inspect results interactively.
  • Performance: A full AEP computation per zone performs model runs across a ws grid or a 2D wd/ws frequency matrix — this may become CPU-intensive for many zones or turbines. Run long computations in a powerful environment or limit the ws grid resolution.
  • Single-turbine vs farm interactions: The notebook numerically integrates per-turbine power including wake effects when multiple turbines are simulated. If you want pure single-turbine power curves without wakes, run the model on a single turbine layout or use the turbine's power curve directly.
  • Inputs format: The TXT loaders try to be permissive but rely on reasonable column naming. If your TXT uses different column names, update the loader cell accordingly.

Contact & license

For questions or collaboration, contact Maulvi Azmiwinata: https://www.linkedin.com/in/maulvi-azmiwinata/

License: This project is released under the MIT License. See LICENSE for details.

About

This repo provides a simplistic framework for estimating annual energy production of windfarms utilizing 15MW turbines using PyWake.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors