Skip to content

Commit c241b2a

Browse files
committed
Merge branch 'dev' into oedb_wind_turbine_data_contribution
2 parents 44da97d + 021abd1 commit c241b2a

15 files changed

+269
-172
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ pip-delete-this-directory.txt
3636

3737
# Doc
3838
doc/temp/*
39-
!doc/temp/windpowerlib.wind_farm.WindFarm.rst
40-
!doc/temp/windpowerlib.wind_turbine_cluster.WindTurbineCluster.rst
4139
.doctrees
4240
.buildinfo
4341

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
# Add any paths that contain custom static files (such as style sheets) here,
158158
# relative to this directory. They are copied after the builtin static files,
159159
# so a file named "default.css" will overwrite the builtin "default.css".
160-
html_static_path = ['_static']
160+
html_static_path = []
161161

162162
# Add any extra paths that contain custom files (such as robots.txt or
163163
# .htaccess) here, relative to this directory. These files are copied

doc/getting_started.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ The basic usage of the windpowerlib is shown in the ModelChain example that is a
5555
To run the example you need the example weather and turbine data used:
5656

5757
* :download:`Example weather data file <../example/weather.csv>`
58-
* :download:`Example power curve data file <../example/data/example_power_curves.csv>`
59-
* :download:`Example power coefficient curve data file <../example/data/example_power_coefficient_curves.csv>`
60-
* :download:`Example nominal power data file <../example/data/example_turbine_data.csv>`
58+
* :download:`Example power curve data file <../example/data/power_curves.csv>`
59+
* :download:`Example power coefficient curve data file <../example/data/power_coefficient_curves.csv>`
60+
* :download:`Example nominal power data file <../example/data/turbine_data.csv>`
6161

6262
Furthermore, you have to install the windpowerlib and to run the notebook you also need to install `notebook` using pip3. To launch jupyter notebook type ``jupyter notebook`` in the terminal.
6363
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 <http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/install.html>`_ and

doc/modules.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,26 @@ Wind turbine data
6363
Functions and methods to obtain the nominal power as well as
6464
power curve or power coefficient curve needed by the :py:class:`~.wind_turbine.WindTurbine` class.
6565

66-
6766
.. autosummary::
6867
:toctree: temp/
6968

7069
wind_turbine.get_turbine_data_from_file
7170
wind_turbine.load_turbine_data_from_oedb
7271
wind_turbine.get_turbine_types
7372

73+
.. _create_input_types_label:
74+
75+
Data Container
76+
=====================
77+
78+
Create data container to be used as an input in classes und functions.
79+
80+
.. autosummary::
81+
:toctree: temp/
82+
83+
wind_turbine.WindTurbineGroup
84+
wind_turbine.WindTurbine.to_group
85+
7486
.. _wind_farm_label:
7587

7688
Wind farm calculations
@@ -233,4 +245,4 @@ TurbineClusterModelChain example
233245
The ``turbine_cluster_modelchain_example`` consists of the following functions
234246
as well as it uses functions of the ``modelchain_example``.
235247

236-
.. include:: example_2.rst
248+
.. include:: example_2.rst

doc/temp/windpowerlib.wind_farm.WindFarm.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

doc/temp/windpowerlib.wind_turbine_cluster.WindTurbineCluster.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

example/modelchain_example.ipynb

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"source": [
158158
"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.\n",
159159
"\n",
160-
"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.\n",
160+
"There are three ways to initialize a WindTurbine object in the windpowerlib. You can either use turbine data from the OpenEnergy Database (oedb) turbine library that is provided along with the windpowerlib, as done for the 'enercon_e126', or specify your own turbine by directly providing a power (coefficient) curve, as done below for 'my_turbine', or provide your own turbine data in csv files, as done for 'dummy_turbine'.\n",
161161
"\n",
162162
"You can execute the following to get a table of all wind turbines for which power and/or power coefficient curves are provided."
163163
]
@@ -228,28 +228,6 @@
228228
"print(df[df[\"turbine_type\"].str.contains(\"E-101\")])"
229229
]
230230
},
231-
{
232-
"cell_type": "code",
233-
"execution_count": 33,
234-
"metadata": {},
235-
"outputs": [],
236-
"source": [
237-
"# specification of own wind turbine (Note: power coefficient values and\n",
238-
"# nominal power have to be in Watt)\n",
239-
"my_turbine = {\n",
240-
" 'name': 'myTurbine',\n",
241-
" 'nominal_power': 3e6, # in W\n",
242-
" 'hub_height': 105, # in m\n",
243-
" 'rotor_diameter': 90, # in m\n",
244-
" 'power_curve': pd.DataFrame(\n",
245-
" data={'value': [p * 1000 for p in [\n",
246-
" 0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]], # in W\n",
247-
" 'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}) # in m/s\n",
248-
" } \n",
249-
"# initialisze WindTurbine object\n",
250-
"my_turbine = WindTurbine(**my_turbine)"
251-
]
252-
},
253231
{
254232
"cell_type": "code",
255233
"execution_count": 6,
@@ -270,13 +248,10 @@
270248
"source": [
271249
"# specification of wind turbine where power curve is provided in the \n",
272250
"# oedb turbine library\n",
273-
"# if you want to use the power coefficient curve change the value of\n",
274-
"# 'power_coefficient_curve' to 'oedb'.\n",
251+
"\n",
275252
"enercon_e126 = {\n",
276253
" 'turbine_type': 'E-126/4200', # turbine type as in oedb turbine library\n",
277-
" 'hub_height': 135, # in m\n",
278-
" 'rotor_diameter': 127, # in m (only needs to be provided when calculating the power \n",
279-
" # output using the power coefficient curve)\n",
254+
" 'hub_height': 135 # in m\n",
280255
" }\n",
281256
"# initialize WindTurbine object\n",
282257
"e126 = WindTurbine(**enercon_e126)"

example/modelchain_example.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ def initialize_wind_turbines():
9494
Initializes three :class:`~.wind_turbine.WindTurbine` objects.
9595
9696
This function shows three ways to initialize a WindTurbine object. You can
97-
either specify your own turbine by directly providing a power (coefficient)
98-
curve, as done below for 'my_turbine', or provide your own turbine data in
99-
csv files as done for 'dummy_turbine', or you can use power and/or power
100-
coefficient curve data from the OpenEnergy Database
101-
(oedb) turbine library that is provided along with the windpowerlib,
102-
as done for the 'enercon_e126'. Execute
103-
``windpowerlib.wind_turbine.get_turbine_types()`` to get a table
104-
including all wind turbines for which power and/or power coefficient curves
105-
are provided.
97+
either use turbine data from the OpenEnergy Database (oedb) turbine library
98+
that is provided along with the windpowerlib, as done for the
99+
'enercon_e126', or specify your own turbine by directly providing a power
100+
(coefficient) curve, as done below for 'my_turbine', or provide your own
101+
turbine data in csv files, as done for 'dummy_turbine'.
102+
103+
To get a list of all wind turbines for which power and/or power coefficient
104+
curves are provided execute `
105+
`windpowerlib.wind_turbine.get_turbine_types()``.
106106
107107
Returns
108108
-------
@@ -112,6 +112,15 @@ def initialize_wind_turbines():
112112
113113
"""
114114

115+
# specification of wind turbine where data is provided in the oedb
116+
# turbine library
117+
enercon_e126 = {
118+
'turbine_type': 'E-126/4200', # turbine type as in register
119+
'hub_height': 135 # in m
120+
}
121+
# initialize WindTurbine object
122+
e126 = WindTurbine(**enercon_e126)
123+
115124
# specification of own wind turbine (Note: power values and nominal power
116125
# have to be in Watt)
117126
my_turbine = {
@@ -137,18 +146,6 @@ def initialize_wind_turbines():
137146
# initialize WindTurbine object
138147
dummy_turbine = WindTurbine(**dummy_turbine)
139148

140-
# specification of wind turbine where power curve is provided in the oedb
141-
# turbine library
142-
# if you want to use the power coefficient curve change the value of
143-
# 'power_coefficient_curve' to True.
144-
enercon_e126 = {
145-
'turbine_type': 'E-126/4200', # turbine type as in register
146-
'hub_height': 135, # in m
147-
'rotor_diameter': 127, # in m
148-
}
149-
# initialize WindTurbine object
150-
e126 = WindTurbine(**enercon_e126)
151-
152149
return my_turbine, e126, dummy_turbine
153150

154151

example/turbine_cluster_modelchain_example.ipynb

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"__copyright__ = \"Copyright oemof developer group\"\n",
3030
"__license__ = \"GPLv3\"\n",
3131
"\n",
32+
"import pandas as pd\n",
33+
"\n",
3234
"import modelchain_example as mc_e\n",
3335
"from windpowerlib import TurbineClusterModelChain, WindTurbineCluster, WindFarm\n",
3436
"\n",
@@ -92,19 +94,19 @@
9294
"metadata": {},
9395
"outputs": [],
9496
"source": [
95-
"# specification of wind farm\n",
96-
"example_farm_data = {\n",
97-
" 'name': 'example_farm',\n",
98-
" 'wind_turbine_fleet': [{'wind_turbine': my_turbine, # as windpowerlib.WindTurbine\n",
99-
" 'number_of_turbines': 6}, # number of `my_turbine` turbines in farm (float \n",
100-
" # values are possible as well)\n",
101-
" {'wind_turbine': e126,\n",
102-
" 'total_capacity': 12.6e6} # installed capacity of `my_turbine` turbines \n",
103-
" # in farm in Watt\n",
104-
" ]}\n",
105-
"\n",
97+
"# specification of wind farm data where turbine fleet is provided in a\n",
98+
"# pandas.DataFrame\n",
99+
"# for each turbine type you can either specify the number of turbines of\n",
100+
"# that type in the wind farm (float values are possible as well) or the\n",
101+
"# total installed capacity of that turbine type in W\n",
102+
"wind_turbine_fleet = pd.DataFrame(\n",
103+
" {'wind_turbine': [my_turbine, e126], # as windpowerlib.WindTurbine\n",
104+
" 'number_of_turbines': [6, None],\n",
105+
" 'total_capacity': [None, 12.6e6]}\n",
106+
" )\n",
106107
"# initialize WindFarm object\n",
107-
"example_farm = WindFarm(**example_farm_data)"
108+
"example_farm = WindFarm(name='example_farm',\n",
109+
" wind_turbine_fleet=wind_turbine_fleet)"
108110
]
109111
},
110112
{
@@ -128,13 +130,12 @@
128130
}
129131
],
130132
"source": [
131-
"# specification of wind farm (2) with a wind farm efficiency\n",
133+
"# specification of wind farm data (2) containing a wind farm efficiency\n",
134+
"# wind turbine fleet is provided using the to_group function\n",
132135
"example_farm_2_data = {\n",
133136
" 'name': 'example_farm_2',\n",
134-
" 'wind_turbine_fleet': [{'wind_turbine': my_turbine,\n",
135-
" 'number_of_turbines': 6},\n",
136-
" {'wind_turbine': e126,\n",
137-
" 'number_of_turbines': 3}],\n",
137+
" 'wind_turbine_fleet': [my_turbine.to_group(6),\n",
138+
" e126.to_group(total_capacity=12.6e6)],\n",
138139
" 'efficiency': 0.9}\n",
139140
"\n",
140141
"# initialize WindFarm object\n",
@@ -176,7 +177,7 @@
176177
"\n",
177178
"The TurbineClusterModelChain is a class that provides all necessary steps to calculate the power output of a wind farm or wind turbine cluster. \n",
178179
"\n",
179-
"Like the ModelChain (see [basic example](modelchain_example.ipynb)) you can use the TurbineClusterModelChain with default parameters as shown in this example for the wind farm or specify custom parameters as done here for the cluster.\n",
180+
"Like the ModelChain (see [basic example](modelchain_example_notebook.ipynb)) you can use the TurbineClusterModelChain with default parameters as shown in this example for the wind farm or specify custom parameters as done here for the cluster.\n",
180181
"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 calculated."
181182
]
182183
},

example/turbine_cluster_modelchain_example.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
__copyright__ = "Copyright oemof developer group"
1313
__license__ = "GPLv3"
1414

15+
import pandas as pd
16+
1517
try:
1618
from matplotlib import pyplot as plt
1719
except ImportError:
@@ -53,28 +55,26 @@ def initialize_wind_farms(my_turbine, e126):
5355
5456
"""
5557

56-
# specification of wind farm data
57-
example_farm_data = {
58-
'name': 'example_farm',
59-
'wind_turbine_fleet': [
60-
{'wind_turbine': my_turbine, # as windpowerlib.WindTurbine
61-
'number_of_turbines': 6}, # number of `my_turbine` turbines in
62-
# farm (float values are possible as
63-
# well)
64-
{'wind_turbine': e126,
65-
'total_capacity': 12.6e6 # installed capacity of `my_turbine`
66-
# turbines in farm in Watt
67-
}]}
58+
# specification of wind farm data where turbine fleet is provided in a
59+
# pandas.DataFrame
60+
# for each turbine type you can either specify the number of turbines of
61+
# that type in the wind farm (float values are possible as well) or the
62+
# total installed capacity of that turbine type in W
63+
wind_turbine_fleet = pd.DataFrame(
64+
{'wind_turbine': [my_turbine, e126], # as windpowerlib.WindTurbine
65+
'number_of_turbines': [6, None],
66+
'total_capacity': [None, 12.6e6]}
67+
)
6868
# initialize WindFarm object
69-
example_farm = WindFarm(**example_farm_data)
69+
example_farm = WindFarm(name='example_farm',
70+
wind_turbine_fleet=wind_turbine_fleet)
7071

7172
# specification of wind farm data (2) containing a wind farm efficiency
73+
# wind turbine fleet is provided using the to_group function
7274
example_farm_2_data = {
7375
'name': 'example_farm_2',
74-
'wind_turbine_fleet': [{'wind_turbine': my_turbine,
75-
'number_of_turbines': 6},
76-
{'wind_turbine': e126,
77-
'number_of_turbines': 3}],
76+
'wind_turbine_fleet': [my_turbine.to_group(6),
77+
e126.to_group(total_capacity=12.6e6)],
7878
'efficiency': 0.9}
7979
# initialize WindFarm object
8080
example_farm_2 = WindFarm(**example_farm_2_data)

0 commit comments

Comments
 (0)