Welcome to the windpowerlib documentation!

Contents:

Getting started

Introduction

The windpowerlib is a library that provides a set of functions and classes to calculate the power output of wind turbines. It was originally part of the feedinlib (windpower and photovoltaic) but was taken out to build up a community concentrating on wind power models.

For a quick start see the Examples and basic usage section.

Documentation

Full documentation can be found at readthedocs.

Use the project site of readthedocs to choose the version of the documentation. Go to the download page to download different versions and formats (pdf, html, epub) of the documentation.

Installation

If you have a working Python 3 environment, use pypi to install the latest windpowerlib version. We highly recommend to use virtual environments.

pip install windpowerlib

The windpowerlib is designed for Python 3 and tested on Python >= 3.5. Please see the installation page of the oemof documentation for complete instructions on how to install python and a virtual environment on your operating system.

For retrieving power (coefficient) curves from the OpenEnergy Database (oedb) the python package requests will be installed with your windpowerlib installation. The windpowerlib was tested with requests version 2.20.1 but might work with lower versions.

Optional Packages

To see the plots of the windpowerlib example in the Examples and basic usage section you should install the matplotlib package. Matplotlib can be installed using pip3 though some Linux users reported that it is easier and more stable to use the pre-built packages of your Linux distribution.

Examples and basic usage

The basic usage of the windpowerlib is shown in the ModelChain example. The presented example is available as jupyter notebook and python script. You can download them along with example weather data:

To run the examples you first have to install the windpowerlib. To run the notebook you also need to install notebook using pip3. To launch jupyter notebook type jupyter notebook in terminal. This will open a browser window. Navigate to the directory containing the notebook to open it. See the jupyter notebook quick start guide for more information on how to install and how to run jupyter notebooks.

Further functionalities, like the modelling of wind farms and wind turbine clusters, are shown in the TurbineClusterModelChain example. As the ModelChain example it is available as jupyter notebook and as python script. The weather data in this example is the same as in the example above.

You can also look at the examples in the Examples section.

Contributing

We are warmly welcoming all who want to contribute to the windpowerlib. If you are interested in wind models and want to help improving the existing model do not hesitate to contact us via github or email (windpowerlib@rl-institut.de).

Clone: https://github.com/wind-python/windpowerlib and install the cloned repository using pip:

pip install -e /path/to/the/repository

As the windpowerlib started with contributors from the oemof developer group we use the same developer rules.

How to create a pull request:

  • Fork the windpowerlib repository to your own github account.
  • Change, add or remove code.
  • Commit your changes.
  • Create a pull request and describe what you will do and why.
  • Wait for approval.

Generally the following steps are required when changing, adding or removing code:

  • Add new tests if you have written new functions/classes.
  • Add/change the documentation (new feature, API changes …).
  • Add a whatsnew entry and your name to Contributors.
  • Check if all tests still work by simply executing pytest in your windpowerlib directory:
pytest

Citing the windpowerlib

We use the zenodo project to get a DOI for each version. Search zenodo for the right citation of your windpowerlib version.

License

Copyright (C) 2017 oemof developing group

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Examples

ModelChain example

This example shows you the basic usage of the windpowerlib by using the ModelChain class. There are mainly three steps. First you have to import your weather data, then you need to specify your wind turbine, and in the last step call the windpowerlib functions to calculate the feed-in time series.

Before you start you have to import the packages needed for these steps.

Import necessary packages and modules

[1]:
__copyright__ = "Copyright oemof developer group"
__license__ = "GPLv3"

import os
import pandas as pd

from windpowerlib.modelchain import ModelChain
from windpowerlib.wind_turbine import WindTurbine
from windpowerlib import wind_turbine as wt

You can use the logging package to get logging messages from the windpowerlib. Change the logging level if you want more or less messages.

[2]:
import logging
logging.getLogger().setLevel(logging.DEBUG)

Import weather data

In order to use the windpowerlib you need to at least provide wind speed data for the time frame you want to analyze. The function below imports example weather data from the weather.csv file provided along with the windpowerlib. The data includes wind speed at two different heights in m/s, air temperature in two different heights in K, surface roughness length in m and air pressure in Pa.

To find out which weather data in which units need to be provided to use the ModelChain or other functions of the windpowerlib see the individual function documentation.

[3]:
def get_weather_data(filename='weather.csv', **kwargs):
    r"""
    Imports weather data from a file.

    The data include wind speed at two different heights in m/s, air
    temperature in two different heights in K, surface roughness length in m
    and air pressure in Pa. The file is located in the example folder of the
    windpowerlib. The height in m for which the data applies is specified in
    the second row.

    Parameters
    ----------
    filename : string
        Filename of the weather data file. Default: 'weather.csv'.

    Other Parameters
    ----------------
    datapath : string, optional
        Path where the weather data file is stored.
        Default: 'windpowerlib/example'.

    Returns
    -------
    weather_df : pandas.DataFrame
        DataFrame with time series for wind speed `wind_speed` in m/s,
        temperature `temperature` in K, roughness length `roughness_length`
        in m, and pressure `pressure` in Pa.
        The columns of the DataFrame are a MultiIndex where the first level
        contains the variable name (e.g. wind_speed) and the second level
        contains the height at which it applies (e.g. 10, if it was
        measured at a height of 10 m).

    """

    if 'datapath' not in kwargs:
        kwargs['datapath'] = os.path.join(os.path.split(
            os.path.dirname(__file__))[0], 'example')
    file = os.path.join(kwargs['datapath'], filename)
    # read csv file
    weather_df = pd.read_csv(file, index_col=0, header=[0, 1])
    # change type of index to datetime and set time zone
    weather_df.index = pd.to_datetime(weather_df.index).tz_localize(
        'UTC').tz_convert('Europe/Berlin')
    # change type of height from str to int by resetting columns
    weather_df.columns = [weather_df.axes[1].levels[0][
                              weather_df.axes[1].labels[0]],
                          weather_df.axes[1].levels[1][
                              weather_df.axes[1].labels[1]].astype(int)]
    return weather_df


# Read weather data from csv
weather = get_weather_data(filename='weather.csv', datapath='')
print(weather[['wind_speed', 'temperature', 'pressure']][0:3])
variable_name             wind_speed          temperature         pressure
height                            10       80          2       10       0
2010-01-01 00:00:00+01:00    5.32697  7.80697      267.60  267.57  98405.7
2010-01-01 01:00:00+01:00    5.46199  7.86199      267.60  267.55  98382.7
2010-01-01 02:00:00+01:00    5.67899  8.59899      267.61  267.54  98362.9

Initialize wind turbine

To initialize a specific turbine you need a dictionary that contains the basic parameters. A turbine is defined by its nominal power, hub height, rotor diameter, and power or power coefficient curve.

There are three ways to initialize a WindTurbine object in the windpowerlib. You can either specify your own turbine, as done below for ‘my_turbine’, or fetch power and/or power coefficient curve data from data files provided by the windpowerlib, as done for the ‘enercon_e126’, or provide your turbine data in csv files as done for the ‘dummy_turbine’ with an example file.

You can execute the following to get a table of all wind turbines for which power and/or power coefficient curves are provided.

[4]:
# get power curves
# get names of wind turbines for which power curves and/or are provided
# set print_out=True to see the list of all available wind turbines
df = wt.get_turbine_types(print_out=False)

# find all Enercons
print(df[df["manufacturer"].str.contains("Enercon")])
INFO:root:Data base connection successful.
   manufacturer turbine_type  has_power_curve  has_cp_curve
1       Enercon   E-101/3050             True          True
2       Enercon   E-101/3500             True          True
3       Enercon   E-115/3000             True          True
4       Enercon   E-115/3200             True          True
5       Enercon   E-126/4200             True          True
6       Enercon   E-141/4200             True          True
7       Enercon     E-53/800             True          True
8       Enercon    E-70/2000             True          True
9       Enercon    E-70/2300             True          True
10      Enercon    E-82/2000             True          True
11      Enercon    E-82/2300             True          True
12      Enercon    E-82/2350             True          True
13      Enercon    E-82/3000             True          True
14      Enercon    E-92/2350             True          True
15      Enercon   E/126/7500             True         False
16      Enercon      E48/800             True          True
[32]:
# find all Enercon 101 turbines
print(df[df["turbine_type"].str.contains("E-101")])
  manufacturer turbine_type  has_power_curve  has_cp_curve
1      Enercon   E-101/3050             True          True
2      Enercon   E-101/3500             True          True
[33]:
# specification of own wind turbine (Note: power coefficient values and
# nominal power have to be in Watt)
my_turbine = {
    'name': 'myTurbine',
    'nominal_power': 3e6,  # in W
    'hub_height': 105,  # in m
    'rotor_diameter': 90,  # in m
    'power_curve': pd.DataFrame(
            data={'power': [p * 1000 for p in [
                      0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]],  # in W
                  'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]})  # in m/s
    }
# initialisze WindTurbine object
my_turbine = WindTurbine(**my_turbine)
[6]:
# specification of wind turbine where power curve is provided
# if you want to use the power coefficient curve change the value of
# 'fetch_curve' to 'power_coefficient_curve'
enercon_e126 = {
        'name': 'E-126/4200',  # turbine type as in register #
        'hub_height': 135,  # in m
        'rotor_diameter': 127,  # in m
        'fetch_curve': 'power_curve',  # fetch power curve #
        'data_source': 'oedb'  # data source oedb or name of csv file
    }
# initialize WindTurbine object
e126 = WindTurbine(**enercon_e126)
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): oep.iks.cs.ovgu.de:80
DEBUG:urllib3.connectionpool:http://oep.iks.cs.ovgu.de:80 "GET //api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1" 301 438
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): openenergy-platform.org:80
DEBUG:urllib3.connectionpool:http://openenergy-platform.org:80 "GET /api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1" 200 150623
INFO:root:Data base connection successful.
[35]:
# specification of wind turbine where power coefficient curve is provided
# by a csv file
source = 'data/example_power_coefficient_curves.csv'
dummy_turbine = {
    'name': 'DUMMY 1',  # turbine type as in file #
    'hub_height': 100,  # in m
    'rotor_diameter': 70,  # in m
    'fetch_curve': 'power_coefficient_curve',  # fetch cp curve #
    'data_source': source  # data source
}
# initialize WindTurbine object
dummy_turbine = WindTurbine(**dummy_turbine)

Use the ModelChain to calculate turbine power output

The ModelChain is a class that provides all necessary steps to calculate the power output of a wind turbine. If you use the ‘run_model’ method first the wind speed and density (if necessary) at hub height are calculated and then used to calculate the power output. You can either use the default methods for the calculation steps, as done for ‘my_turbine’, or choose different methods, as done for the ‘e126’. Of course, you can also use the default methods while only changing one or two of them, as done for ‘dummy_turbine’.

[7]:
# power output calculation for my_turbine
# initialize ModelChain with default parameters and use run_model
# method to calculate power output
mc_my_turbine = ModelChain(my_turbine).run_model(weather)
# write power output time series to WindTurbine object
my_turbine.power_output = mc_my_turbine.power_output
DEBUG:root:Calculating wind speed using logarithmic wind profile.
DEBUG:root:Calculating power output using power curve.
[8]:
# power output calculation for e126
# own specifications for ModelChain setup
modelchain_data = {
    'wind_speed_model': 'logarithmic',      # 'logarithmic' (default),
                                            # 'hellman' or
                                            # 'interpolation_extrapolation'
    'density_model': 'ideal_gas',           # 'barometric' (default), 'ideal_gas'
                                            #  or 'interpolation_extrapolation'
    'temperature_model': 'linear_gradient', # 'linear_gradient' (def.) or
                                            # 'interpolation_extrapolation'
    'power_output_model': 'power_curve',    # 'power_curve' (default) or
                                            # 'power_coefficient_curve'
    'density_correction': True,             # False (default) or True
    'obstacle_height': 0,                   # default: 0
    'hellman_exp': None}                    # None (default) or None

# initialize ModelChain with own specifications and use run_model method to
# calculate power output
mc_e126 = ModelChain(e126, **modelchain_data).run_model(
    weather)
# write power output time series to WindTurbine object
e126.power_output = mc_e126.power_output
DEBUG:root:Calculating wind speed using logarithmic wind profile.
DEBUG:root:Calculating temperature using temperature gradient.
DEBUG:root:Calculating density using ideal gas equation.
DEBUG:root:Calculating power output using power curve.
[38]:
# power output calculation for example_turbine
# own specification for 'power_output_model'
mc_example_turbine = ModelChain(
    dummy_turbine,
    power_output_model='power_coefficient_curve').run_model(weather)
dummy_turbine.power_output = mc_example_turbine.power_output
DEBUG:root:Calculating wind speed using logarithmic wind profile.
DEBUG:root:Calculating temperature using temperature gradient.
DEBUG:root:Calculating density using barometric height equation.
DEBUG:root:Calculating power output using power coefficient curve.

Plot results

If you have matplotlib installed you can visualize the calculated power output and used power (coefficient) curves.

[9]:
# try to import matplotlib
try:
    from matplotlib import pyplot as plt
    # matplotlib inline needed in notebook to plot inline
    %matplotlib inline
except ImportError:
    plt = None
DEBUG:matplotlib:CACHEDIR=/home/sabine/.cache/matplotlib
DEBUG:matplotlib.font_manager:Using fontManager instance from /home/sabine/.cache/matplotlib/fontlist-v300.json
DEBUG:matplotlib.pyplot:Loaded backend module://ipykernel.pylab.backend_inline version unknown.
DEBUG:matplotlib.pyplot:Loaded backend module://ipykernel.pylab.backend_inline version unknown.
DEBUG:matplotlib.pyplot:Loaded backend module://ipykernel.pylab.backend_inline version unknown.
[10]:
# plot turbine power output
if plt:
    e126.power_output.plot(legend=True, label='Enercon E126')
    my_turbine.power_output.plot(legend=True, label='myTurbine')
    dummy_turbine.power_output.plot(legend=True, label='dummyTurbine')
    plt.show()
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.font_manager:findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0 to DejaVu Sans ('/home/sabine/virtualenvs/windpowerlib/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf') with score of 0.050000.
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
_images/modelchain_example_notebook_20_1.png
[11]:
# plot power (coefficient) curves
if plt:
    if e126.power_coefficient_curve is not None:
        e126.power_coefficient_curve.plot(
            x='wind_speed', y='power coefficient', style='*',
            title='Enercon E126 power coefficient curve')
        plt.show()
    if e126.power_curve is not None:
        e126.power_curve.plot(x='wind_speed', y='power', style='*',
                              title='Enercon E126 power curve')
        plt.show()
    if my_turbine.power_coefficient_curve is not None:
        my_turbine.power_coefficient_curve.plot(
            x='wind_speed', y='power coefficient', style='*',
            title='myTurbine power coefficient curve')
        plt.show()
    if my_turbine.power_curve is not None:
        my_turbine.power_curve.plot(x='wind_speed', y='power', style='*',
                                    title='myTurbine power curve')
        plt.show()
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.font_manager:findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0 to DejaVu Sans ('/home/sabine/virtualenvs/windpowerlib/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf') with score of 0.050000.
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
_images/modelchain_example_notebook_21_1.png
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
_images/modelchain_example_notebook_21_3.png

TurbineClusterModelChain example

This example shows you how to calculate the power output of wind farms and wind turbine clusters with the windpowerlib. A cluster can be useful if you want to calculate the feed-in of a region for which you want to use one single weather data point.

Functions that are used in the ModelChain example, like the initialization of wind turbines, are imported and used without further explanations.

Imports and initialization of wind turbines

The import of weather data and the initialization of wind turbines is done as in the modelchain_example.

[1]:
__copyright__ = "Copyright oemof developer group"
__license__ = "GPLv3"

import modelchain_example as mc_e
from windpowerlib.turbine_cluster_modelchain import TurbineClusterModelChain
from windpowerlib.wind_turbine_cluster import WindTurbineCluster
from windpowerlib.wind_farm import WindFarm

import logging
logging.getLogger().setLevel(logging.DEBUG)
[2]:
# Get weather data
weather = mc_e.get_weather_data('weather.csv')
print(weather[['wind_speed', 'temperature', 'pressure']][0:3])

# Initialize wind turbines
my_turbine, e126, dummy_turbine = mc_e.initialize_wind_turbines()
print()
print('nominal power of my_turbine: {}'.format(my_turbine.nominal_power))
variable_name             wind_speed          temperature         pressure
height                            10       80          2       10       0
2010-01-01 00:00:00+01:00    5.32697  7.80697      267.60  267.57  98405.7
2010-01-01 01:00:00+01:00    5.46199  7.86199      267.60  267.55  98382.7
2010-01-01 02:00:00+01:00    5.67899  8.59899      267.61  267.54  98362.9
INFO:root:Data base connection successful.

nominal power of my_turbine: 3000000.0

Initialize wind farm

To initialize a specific wind farm you can use a dictionary that contains the basic parameters. A wind farm is defined by its name, wind turbine fleet, and optionally also by a wind farm efficiency and the wind farm’s location.

A wind farm efficiency can be a constant value or be dependent on the wind speed. The coordinates are not being used here but are necessary if you need to assign your wind farm to a certain weather data point.

[3]:
# specification of wind farm data
example_farm_data = {
    'name': 'example_farm',
    'wind_turbine_fleet': [{'wind_turbine': my_turbine,
                            'number_of_turbines': 6},
                           {'wind_turbine': e126,
                            'number_of_turbines': 3}
                           ]}

# initialize WindFarm object
example_farm = WindFarm(**example_farm_data)
[4]:
# specification of wind farm data (2) containing a wind farm efficiency
# and coordinates
example_farm_2_data = {
    'name': 'example_farm_2',
    'wind_turbine_fleet': [{'wind_turbine': my_turbine,
                            'number_of_turbines': 6},
                           {'wind_turbine': e126,
                            'number_of_turbines': 3}],
    'efficiency': 0.9,
    'coordinates': [52.2, 13.1]}

# initialize WindFarm object
example_farm_2 = WindFarm(**example_farm_2_data)

print('nominal power of first turbine type of example_farm_2: {}'.format(
    example_farm_2.wind_turbine_fleet[0]['wind_turbine'].nominal_power))
nominal power of first turbine type of example_farm_2: 3000000.0

Initialize wind turbine cluster

Like for a wind farm for the initialization of a wind turbine cluster you can use a dictionary that contains the basic parameters. A wind turbine cluster is defined by its name, wind farms and optionally by its location.

[5]:
# specification of cluster data
example_cluster_data = {
    'name': 'example_cluster',
    'wind_farms': [example_farm, example_farm_2],
    'coordinates': [52.2, 13.1]}

# initialize WindTurbineCluster object
example_cluster = WindTurbineCluster(**example_cluster_data)

Use the TurbineClusterModelChain to calculate power output

The TurbineClusterModelChain is a class that provides all necessary steps to calculate the power output of a wind farm or wind turbine cluster.

Like the ModelChain (see basic example) you can use the TurbineClusterModelChain with default parameters as shown here for the wind farm or specify custom parameters as done here for the cluster. If you use the ‘run_model’ method first the aggregated power curve and the mean hub height of the wind farm/cluster is calculated, then inherited functions of the ModelChain are used to calculate the wind speed and density (if necessary) at hub height. After that, depending on the parameters, wake losses are applied and at last the power output is calulated.

[6]:
# power output calculation for example_farm
# initialize TurbineClusterModelChain with default parameters and use
# run_model method to calculate power output
mc_example_farm = TurbineClusterModelChain(example_farm).run_model(weather)
# write power output time series to WindFarm object
example_farm.power_output = mc_example_farm.power_output
DEBUG:root:Wake losses considered by dena_mean wind efficiency curve.
DEBUG:root:Aggregated power curve smoothed by method: turbulence_intensity
DEBUG:root:Calculating wind speed using logarithmic wind profile.
DEBUG:root:Calculating power output using power curve.
[7]:
# set efficiency of example_farm to apply wake losses
example_farm.efficiency = 0.9

# power output calculation for turbine_cluster
# own specifications for TurbineClusterModelChain setup
modelchain_data = {
        'wake_losses_model': 'constant_efficiency',  #
                                           # 'dena_mean' (default), None,
                                           # 'power_efficiency_curve',
                                           # 'constant_efficiency' or name of
                                           #  a wind efficiency curve
                #  see :py:func:`~.wake_losses.get_wind_efficiency_curve`
        'smoothing': True,  # False (default) or True
        'block_width': 0.5,  # default: 0.5
        'standard_deviation_method': 'Staffell_Pfenninger',  #
                                            # 'turbulence_intensity' (default)
                                            # or 'Staffell_Pfenninger'
        'smoothing_order': 'wind_farm_power_curves',  #
                                        # 'wind_farm_power_curves' (default) or
                                        # 'turbine_power_curves'
        'wind_speed_model': 'logarithmic',  # 'logarithmic' (default),
                                            # 'hellman' or
                                            # 'interpolation_extrapolation'
        'density_model': 'ideal_gas',  # 'barometric' (default), 'ideal_gas' or
                                       # 'interpolation_extrapolation'
        'temperature_model': 'linear_gradient',  # 'linear_gradient' (def.) or
                                                 # 'interpolation_extrapolation'
        'power_output_model': 'power_curve',  # 'power_curve' (default) or
                                              # 'power_coefficient_curve'
        'density_correction': True,  # False (default) or True
        'obstacle_height': 0,  # default: 0
        'hellman_exp': None}  # None (default) or None
# initialize TurbineClusterModelChain with own specifications and use
# run_model method to calculate power output
mc_example_cluster = TurbineClusterModelChain(
        example_cluster, **modelchain_data).run_model(weather)
# write power output time series to WindTurbineCluster object
example_cluster.power_output = mc_example_cluster.power_output
DEBUG:root:Wake losses considered with constant_efficiency.
DEBUG:root:Aggregated power curve smoothed by method: Staffell_Pfenninger
DEBUG:root:Calculating wind speed using logarithmic wind profile.
DEBUG:root:Calculating temperature using temperature gradient.
DEBUG:root:Calculating density using ideal gas equation.
DEBUG:root:Calculating power output using power curve.

Plot results

If you have matplotlib installed you can visualize the calculated power output.

[8]:
# try to import matplotlib
try:
    from matplotlib import pyplot as plt
    # matplotlib inline needed in notebook to plot inline
    %matplotlib inline
except ImportError:
    plt = None
DEBUG:matplotlib.pyplot:Loaded backend module://ipykernel.pylab.backend_inline version unknown.
[9]:
# plot turbine power output
if plt:
    example_cluster.power_output.plot(legend=True, label='example cluster')
    example_farm.power_output.plot(legend=True, label='example farm')
    plt.show()
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.font_manager:findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0 to DejaVu Sans ('/home/sabine/virtualenvs/windpowerlib/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf') with score of 0.050000.
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
DEBUG:matplotlib.axes._base:update_title_pos
_images/turbine_cluster_modelchain_example_notebook_14_1.png
[ ]:

Model description

Wind power plants

The windpowerlib provides three classes for modelling wind power as wind turbines (WindTurbine), wind farms (WindFarm) and wind turbine clusters (WindTurbineCluster).

Descisptions can also be found in the sections Wind turbine data, Wind farm calculations and Wind turbine cluster calculations.

Height correction and conversion of weather data

Weather data is usually available for a restricted amount of heights above ground. However, for wind feed-in time series calculations weather data is needed at hub height of the examined wind turbines. Thus, the windpowerlib provides functions for the height correction of weather data.

Functions for the height correction of wind speed to the hub height of a wind turbine are described in the Wind speed module. Respectively a function for the height correction of temperature data is provided in the Temperature module. Functions for density calculations can be found in the Density module.

If weather data is available for at least two different heights the respective figure at hub height can be determined by using linear or logarithmic inter-/extrapolation functions of the Tools module.

Power output calculations

Wind feed-in time series can be calculated via power curves and power coefficient curves in the windpowerlib. Functions for power output calculations are described in the Power output module.

Wake losses

The windpowerlib provides two options for the consideration of wake losses in wind farms: reduction of wind speeds and wind farm efficiency (reduction of power in power curves).

For the first option wind efficiency curves are provided which determine the average reduction of wind speeds within a wind farm induced by wake losses depending on the wind speed. These curves were taken from the dena-Netzstudie II and the dissertation of Kaspar Knorr (for references see get_wind_efficiency_curve()). The following graph shows all provided wind efficiency curves. The mean wind efficiency curves were calculated in the dena-Netzstudie II and by Kaspar Knorr by averaging wind efficiency curves of 12 wind farms distributed over Germany (dena) or respectively of over 2000 wind farms in Germany (Knorr). Curves with the appendix ‘extreme’ are wind efficiency curves of single wind farms that are extremely deviating from the respective mean wind efficiency curve.

Wind efficiency curves

The second option of considering wake losses is applying them to power curves by reducing the power values by a constant or on a wind speed depending wind farm efficiency (see wake_losses_to_power_curve()). Applying the wind farm efficiency (curve) to power curves instead of to feed-in time series has the advantage that the power curves can further be aggregated to achieve turbine cluster power curves (see WindTurbineCluster).

Smoothing of power curves

To account for the spatial distribution of wind speeds within an area the windpowerlib provides a function for power curve smoothing and uses the approach of Nørgaard and Holttinen (for references see smooth_power_curve()).

The modelchains

The modelchains are implemented to ensure an easy start into the Windpowerlib. They work like models that combine all functions provided in the library. Via parameteres desired functions of the windpowerlib can be selected. For parameters not being specified default parameters are used. The ModelChain is a model to determine the output of a wind turbine while the TurbineClusterModelChain is a model to determine the output of a wind farm or wind turbine cluster. The usage of both modelchains is shown in the Examples section.

What’s New

These are new features and improvements of note in each release

v0.1.1 (January 31, 2019)

Other changes

  • Adapted csv reading to pandas API change
  • Removed logging message for successful database connection
  • Added system exit and error message in case a non-existing power (coefficient) curve of an existing turbine type is tried to be used

Contributors

  • Uwe Krien
  • Sabine Haas

v0.1.0 (January 17, 2019)

ATTENTION: From v0.1.0 on power (coefficient) curves are provided by the OpenEnergy Database (oedb) instead of in csv files (v0.6.0 and lower) due to legal reasons. Use get_turbine_types() to check whether the turbine types you need are included in the database. If your turbine type is not included you can either use your own csv file or open an issue.

New classes

  • WindFarm class for modelling a wind farm. Defines a standard set of wind farm attributes, for example aggregated power curve and wind farm efficiency to take wake losses into account.
  • WindTurbineCluster class for modelling a turbine cluster that contains several wind turbines and/or wind farms. This class is useful for gathering all wind turbines in a weather data grid cell. An aggregated power curve can be calculated which considers the wake losses of the wind farms by a set efficiency if desired.
  • TurbineClusterModelChain class shows the usage of new functions and classes of windpowerlib v.0.1 and is based on the ModelChain class.

New functions

Testing

  • added continuous integration to automatically test the windpowerlib for different python versions and to check the test coverage

Documentation

  • added second example section and jupyter notebook
  • added model description

API changes

  • renamed attribute turbine_name of WindTurbine class to name to match with name attribute of WindFarm and WindTurbineCluster class
  • renamed basic_example to modelchain_example
  • renamed column ‘values’ of power (coefficient) curves to ‘value’ to prevent errors using df.value(s)
  • renamed run_basic_example() to run_example() in modelchain_example
  • renamed parameter wind_turbine of ModelChain object to power_plant
  • removed parameter density_correction from power_plant.power_coefficient()

Other changes

  • removed deprecated attributes (.ix)
  • added turbine_cluster_modelchain_example showing the usage of the TurbineClusterModelChain

Contributors

  • Sabine Haas
  • Uwe Krien
  • Birgit Schachler

v0.0.6 (July 07, 2017)

Documentation

  • added basic usage section and jupyter notebook

Testing

  • added tests for different data types and wind_turbine module
  • added example to tests
  • added and fixed doctests

Other changes

  • various API changes due to having better comprehensible function and variable names
  • renamed Modelchain to ModelChain
  • moved functions for temperature calculation to temperature module
  • new function for interpolation and extrapolation

Contributors

  • Sabine Haas
  • Birgit Schachler
  • Uwe Krien

v0.0.5 (April 10, 2017)

New features

  • complete restructuring of the windpowerlib
  • power curves for numerous wind turbines are provided
  • new function for calculation of air density at hub height (rho_ideal_gas)
  • new function for calculation of wind speed at hub height (v_wind_hellman)
  • density correction for calculation of power output
  • modelchain for convenient usage

Documentation

  • added references

Testing

  • tests for all modules were added

Contributors

  • Sabine Haas
  • Birgit Schachler
  • Uwe Krien

API

Classes

wind_turbine.WindTurbine(name, hub_height[, …]) Defines a standard set of wind turbine attributes.
wind_farm.WindFarm(name, wind_turbine_fleet) Defines a standard set of wind farm attributes.
wind_turbine_cluster.WindTurbineCluster(…) Defines a standard set of wind turbine cluster attributes.
modelchain.ModelChain(power_plant[, …]) Model to determine the output of a wind turbine
turbine_cluster_modelchain.TurbineClusterModelChain(…) Model to determine the output of a wind farm or wind turbine cluster.

Temperature

Function for calculating air temperature at hub height.

temperature.linear_gradient(temperature, …) Calculates the temperature at hub height using a linear gradient.

Density

Functions for calculating air density at hub height.

density.barometric(pressure, …) Calculates the density of air at hub height using the barometric height equation.
density.ideal_gas(pressure, pressure_height, …) Calculates the density of air at hub height using the ideal gas equation.

Wind speed

Functions for calculating wind speed at hub height.

wind_speed.logarithmic_profile(wind_speed, …) Calculates the wind speed at hub height using a logarithmic wind profile.
wind_speed.hellman(wind_speed, …[, …]) Calculates the wind speed at hub height using the hellman equation.

Wind turbine data

Functions and methods to obtain the nominal power as well as power curve or power coefficient curve needed by the WindTurbine class.

wind_turbine.WindTurbine.fetch_turbine_data(…) Fetches data of the requested wind turbine.
wind_turbine.get_turbine_data_from_file(…) Fetches power (coefficient) curve data from a csv file.
wind_turbine.get_turbine_data_from_oedb(…) Gets turbine data from the OpenEnergy Database (oedb).
wind_turbine.load_turbine_data_from_oedb() Loads turbine data from the OpenEnergy Database (oedb).
wind_turbine.get_turbine_types([print_out]) Get the names of all possible wind turbine types for which the power coefficient curve or power curve is provided in the OpenEnergy Data Base (oedb).

Wind farm calculations

Functions and methods to calculate the mean hub height, installed power as well as the aggregated power curve of a WindFarm object.

wind_farm.WindFarm.mean_hub_height() Calculates the mean hub height of the wind farm.
wind_farm.WindFarm.get_installed_power() Calculates the installed power of the wind farm.
wind_farm.WindFarm.assign_power_curve([…]) Calculates the power curve of a wind farm.

Wind turbine cluster calculations

Functions and methods to calculate the mean hub height, installed power as well as the aggregated power curve of a WindTurbineCluster object. This is realized in a new module as the functions differ from the functions in the WindFarm class.

wind_turbine_cluster.WindTurbineCluster.mean_hub_height() Calculates the mean hub height of the wind turbine cluster.
wind_turbine_cluster.WindTurbineCluster.get_installed_power() Calculates the installed power of a wind turbine cluster.
wind_turbine_cluster.WindTurbineCluster.assign_power_curve([…]) Calculates the power curve of a wind turbine cluster.

Power output

Functions for calculating power output of a wind power plant.

power_output.power_coefficient_curve(…) Calculates the turbine power output using a power coefficient curve.
power_output.power_curve(wind_speed, …[, …]) Calculates the turbine power output using a power curve.
power_output.power_curve_density_correction(…) Calculates the turbine power output using a density corrected power curve.

Alteration of power curves

Functions for smoothing power curves or applying wake losses to a power curve.

power_curves.smooth_power_curve(…[, …]) Smooths the input power curve values by using a Gauss distribution.
power_curves.wake_losses_to_power_curve(…) Reduces the power values of a power curve by an efficiency (curve).

Wake losses

Functions for applying wake losses to a wind speed time series.

wake_losses.reduce_wind_speed(wind_speed[, …]) Reduces wind speed by a wind efficiency curve.
wake_losses.get_wind_efficiency_curve([…]) Reads wind efficiency curve(s) specified in curve_name.

ModelChain

Creating a ModelChain object.

modelchain.ModelChain(power_plant[, …]) Model to determine the output of a wind turbine

Running the ModelChain.

modelchain.ModelChain.run_model(weather_df) Runs the model.

Methods of the ModelChain object.

modelchain.ModelChain.temperature_hub(weather_df) Calculates the temperature of air at hub height.
modelchain.ModelChain.density_hub(weather_df) Calculates the density of air at hub height.
modelchain.ModelChain.wind_speed_hub(weather_df) Calculates the wind speed at hub height.
modelchain.ModelChain.calculate_power_output(…) Calculates the power output of the wind power plant.

TurbineClusterModelChain

The TurbineClusterModelChain inherits all functions from the ModelChain.

Creating a TurbineClusterModelChain object.

turbine_cluster_modelchain.TurbineClusterModelChain(…) Model to determine the output of a wind farm or wind turbine cluster.

Running the TurbineClusterModelChain.

turbine_cluster_modelchain.TurbineClusterModelChain.run_model(…) Runs the model.

Methods of the TurbineClusterModelChain object.

turbine_cluster_modelchain.TurbineClusterModelChain.assign_power_curve(…) Calculates the power curve of the wind turbine cluster.
turbine_cluster_modelchain.TurbineClusterModelChain.temperature_hub(…) Calculates the temperature of air at hub height.
turbine_cluster_modelchain.TurbineClusterModelChain.density_hub(…) Calculates the density of air at hub height.
turbine_cluster_modelchain.TurbineClusterModelChain.wind_speed_hub(…) Calculates the wind speed at hub height.
turbine_cluster_modelchain.TurbineClusterModelChain.calculate_power_output(…) Calculates the power output of the wind power plant.

Tools

Additional functions used in the windpowerlib.

tools.linear_interpolation_extrapolation(df, …) Linear inter- or extrapolates between the values of a data frame.
tools.logarithmic_interpolation_extrapolation(df, …) Logarithmic inter- or extrapolates between the values of a data frame.
tools.gauss_distribution(function_variable, …) Gauss distribution.
tools.estimate_turbulence_intensity(height, …) Estimate turbulence intensity by the roughness length.

ModelChain example

The modelchain_example consists of the following functions.

modelchain_example.get_weather_data([filename]) Imports weather data from a file.
modelchain_example.initialize_wind_turbines() Initializes two WindTurbine objects.
modelchain_example.calculate_power_output(…) Calculates power output of wind turbines using the ModelChain.
modelchain_example.plot_or_print(my_turbine, …) Plots or prints power output and power (coefficient) curves.
modelchain_example.run_example() Runs the basic example.

TurbineClusterModelChain example

The turbine_cluster_modelchain_example consists of the following functions as well as it uses functions of the modelchain_example.

turbine_cluster_modelchain_example.initialize_wind_farms(…) Initializes two WindFarm objects.
turbine_cluster_modelchain_example.initialize_wind_turbine_cluster(…) Initializes a WindTurbineCluster object.
turbine_cluster_modelchain_example.calculate_power_output(…) Calculates power output of wind farms and clusters using the TurbineClusterModelChain.
turbine_cluster_modelchain_example.plot_or_print(…) Plots or prints power output and power (coefficient) curves.
turbine_cluster_modelchain_example.run_example() Runs the example.

Indices and tables