1+ """
2+ The ``wake_losses`` module contains functions to TODO: add
3+
4+ """
5+
6+ __copyright__ = "Copyright oemof developer group"
7+ __license__ = "GPLv3"
8+
9+ import numpy as np
10+ import pandas as pd
11+ import os
12+
13+ try :
14+ from matplotlib import pyplot as plt
15+ except ImportError :
16+ plt = None
17+
18+ def reduce_wind_speed (wind_speed , wind_efficiency_curve = 'dena_mean' ):
19+ """
20+ Reduces wind speed by a wind efficiency curve.
21+
22+ The wind efficiency curves are provided in the windpowerlib and were
23+ calculated in the dena-Netzstudie II and in the work of Knorr
24+ (see references).
25+
26+ Parameters
27+ ----------
28+ wind_speed
29+
30+ wind_efficiency_curve
31+
32+ Returns
33+ -------
34+ reduced_wind_speed : pd.Series or np.array
35+ By wind efficiency curve reduced wind speed.
36+
37+ TODO add references
38+ """
39+ # Get wind efficiency curve
40+ wind_efficiency_curve = get_wind_efficiency_curve (
41+ curve_name = wind_efficiency_curve )
42+ # Get by wind efficiency reduced wind speed
43+ reduced_wind_speed = wind_speed * np .interp (wind_speed , wind_efficiency_curve ['wind_speed' ], wind_efficiency_curve ['efficiency' ])
44+ if isinstance (wind_speed , pd .Series ):
45+ reduced_wind_speed = pd .Series (data = wind_speed , index = wind_speed .index ,
46+ name = 'reduced_wind_speed' )
47+ return reduced_wind_speed
48+
49+
50+ def get_wind_efficiency_curve (curve_name = 'dena_mean' ):
51+ r"""
52+ Reads the in `curve_name` specified wind efficiency curve.
53+
54+ Parameters
55+ ----------
56+ curve_name : String
57+ Specifies the curve.
58+ Possibilities: 'dena_mean', 'knorr_mean', 'dena_extreme1',
59+ 'dena_extreme2', 'knorr_extreme1', 'knorr_extreme2', 'knorr_extreme3'.
60+ Default: 'dena_mean'.
61+ plot : Boolean
62+ If True the wind efficiency curve is plotted. Default: False.
63+
64+ Returns
65+ -------
66+ efficiency_curve : pd.DataFrame
67+ Wind efficiency curve. Contains 'wind_speed' and 'efficiency' columns
68+ with wind speed in m/s and wind farm efficiency (dimensionless).
69+
70+ Notes
71+ -----
72+ The wind efficiency curves were calculated in the "Dena Netzstudie" and in
73+ the disseration of Kaspar Knorr. For more information see [1]_ and [2]_.
74+
75+ References
76+ ----------
77+ .. [1] Kohler et.al.: "dena-Netzstudie II. Integration erneuerbarer
78+ Energien in die deutsche Stromversorgung im Zeitraum 2015 – 2020
79+ mit Ausblick 2025.", Deutsche Energie-Agentur GmbH (dena),
80+ Tech. rept., 2010, p. 101
81+ .. [2] Knorr, K.: "Modellierung von raum-zeitlichen Eigenschaften der
82+ Windenergieeinspeisung für wetterdatenbasierte
83+ Windleistungssimulationen". Universität Kassel, Diss., 2016,
84+ p. 124
85+
86+ """
87+ path = os .path .join (os .path .dirname (__file__ ), 'data' ,
88+ 'wind_efficiency_curves_{}.csv' .format (
89+ curve_name .split ('_' )[0 ]))
90+ # Read all curves from file
91+ wind_efficiency_curves = pd .read_csv (path )
92+ efficiency_curve = wind_efficiency_curves [['wind_speed' , curve_name ]]
93+ efficiency_curve .columns = ['wind_speed' , 'efficiency' ]
94+ return efficiency_curve
95+
96+
97+ def display_wind_efficiency_curves ():
98+ r"""
99+ Plots or prints all efficiency curves available in the windpowerlib.
100+
101+ Notes
102+ -----
103+ The wind efficiency curves were calculated in the "Dena Netzstudie" and in
104+ the disseration of Kaspar Knorr. For more information see [1]_ and [2]_.
105+
106+ References
107+ ----------
108+ .. [1] Kohler et.al.: "dena-Netzstudie II. Integration erneuerbarer
109+ Energien in die deutsche Stromversorgung im Zeitraum 2015 – 2020
110+ mit Ausblick 2025.", Deutsche Energie-Agentur GmbH (dena),
111+ Tech. rept., 2010, p. 101
112+ .. [2] Knorr, K.: "Modellierung von raum-zeitlichen Eigenschaften der
113+ Windenergieeinspeisung für wetterdatenbasierte
114+ Windleistungssimulationen". Universität Kassel, Diss., 2016,
115+ p. 124
116+
117+ """
118+ path = os .path .join (os .path .dirname (__file__ ), 'data' ,
119+ 'wind_efficiency_curves.csv' )
120+ # Read all curves from file
121+ wind_efficiency_curves = pd .read_csv (path )
122+ # Initialize data frame for plot
123+ curves_df = pd .DataFrame ()
124+ for curve_name in [col for col in list (wind_efficiency_curves ) if
125+ 'x_' not in col ]:
126+ # Get wind efficiency curve for standard wind speeds from
127+ # read_wind_efficiency_curve() and add to data frame
128+ efficiency_curve = get_wind_efficiency_curve (
129+ curve_name ).rename (
130+ columns = {'efficiency' : curve_name .replace ('_' , ' ' ),
131+ 'wind_speed' : 'wind speed m/s' }).set_index (
132+ 'wind speed m/s' )
133+ curves_df = pd .concat ([curves_df , efficiency_curve ], axis = 1 )
134+ # Create separate data frames for origin of curve
135+ knorr_df = curves_df [[column_name for column_name in curves_df if
136+ 'knorr' in column_name ]]
137+ dena_df = curves_df [[column_name for column_name in curves_df if
138+ 'dena' in column_name ]]
139+ if plt :
140+ fig , ax = plt .subplots ()
141+ dena_df .plot (ax = ax , legend = True , marker = 'x' , markersize = 3 )
142+ knorr_df .plot (ax = ax , legend = True , marker = 'o' , markersize = 3 )
143+ plt .ylabel ('Wind farm efficiency' )
144+ plt .show ()
145+ else :
146+ print (dena_df )
147+ print (knorr_df )
148+
149+ if __name__ == "__main__" :
150+ display_wind_efficiency_curves ()
0 commit comments