@@ -84,14 +84,13 @@ def initialize_wind_turbines():
8484 r"""
8585 Initializes two :class:`~.wind_turbine.WindTurbine` objects.
8686
87- Function shows two ways to initialize a WindTurbine object. You can either
88- specify your own turbine, as done below for 'myTurbine', or fetch power
89- and/or power coefficient curve data from data files provided by the
90- windpowerlib, as done for the 'enerconE126'.
91- Execute ``windpowerlib.wind_turbine.get_turbine_types()`` or
92- ``windpowerlib.wind_turbine.get_turbine_types(
93- filename='power_coefficient_curves.csv')`` to get a list of all wind
94- turbines for which power and power coefficient curves respectively are
87+ Function shows three ways to initialize a WindTurbine object. You can
88+ either specify your own turbine, as done below for 'myTurbine', or fetch
89+ power and/or power coefficient curve data from the Open Energy Database
90+ (oedb), as done for the 'enerconE126', or provide your turbine data in csv
91+ files as done for 'dummyTurbine' with an example file.
92+ Execute ``windpowerlib.wind_turbine.get_turbine_types()`` to get a list of
93+ all wind turbines for which power and power coefficient curves are
9594 provided.
9695
9796 Returns
@@ -100,8 +99,8 @@ def initialize_wind_turbines():
10099
101100 """
102101
103- # specification of own wind turbine (Note: power coefficient values and
104- # nominal power have to be in Watt)
102+ # specification of own wind turbine (Note: power values and nominal power
103+ # have to be in Watt)
105104 myTurbine = {
106105 'name' : 'myTurbine' ,
107106 'nominal_power' : 3e6 , # in W
@@ -115,30 +114,45 @@ def initialize_wind_turbines():
115114 # initialize WindTurbine object
116115 my_turbine = WindTurbine (** myTurbine )
117116
118- # specification of wind turbine where power curve is provided
117+ # specification of wind turbine where power curve is provided in the oedb
119118 # if you want to use the power coefficient curve change the value of
120119 # 'fetch_curve' to 'power_coefficient_curve'
121120 enerconE126 = {
122- 'name' : 'ENERCON E 126 7500 ' , # turbine name as in register
121+ 'name' : 'E- 126/4200 ' , # turbine type as in register #
123122 'hub_height' : 135 , # in m
124123 'rotor_diameter' : 127 , # in m
125- 'fetch_curve' : 'power_curve' # fetch power curve
124+ 'fetch_curve' : 'power_curve' , # fetch power curve #
125+ 'data_source' : 'oedb' # data source oedb or name of csv file
126126 }
127127 # initialize WindTurbine object
128128 e126 = WindTurbine (** enerconE126 )
129129
130- return my_turbine , e126
130+ # specification of wind turbine where power coefficient curve is provided
131+ # by a csv file
132+ dummyTurbine = {
133+ 'name' : 'DUMMY 1' , # turbine type as in file #
134+ 'hub_height' : 100 , # in m
135+ 'rotor_diameter' : 70 , # in m
136+ 'fetch_curve' : 'power_coefficient_curve' , # fetch cp curve #
137+ 'data_source' : 'example_power_coefficient_curves.csv' # data source
138+ }
139+ # initialize WindTurbine object
140+ dummy_turbine = WindTurbine (** dummyTurbine )
141+
142+ return my_turbine , e126 , dummy_turbine
131143
132144
133- def calculate_power_output (weather , my_turbine , e126 ):
145+ def calculate_power_output (weather , my_turbine , e126 , dummy_turbine ):
134146 r"""
135147 Calculates power output of wind turbines using the
136148 :class:`~.modelchain.ModelChain`.
137149
138150 The :class:`~.modelchain.ModelChain` is a class that provides all necessary
139151 steps to calculate the power output of a wind turbine. You can either use
140152 the default methods for the calculation steps, as done for 'my_turbine',
141- or choose different methods, as done for the 'e126'.
153+ or choose different methods, as done for the 'e126'. Of course, you can
154+ also use the default methods while only changing one or two of them, as
155+ done for 'dummy_turbine'.
142156
143157 Parameters
144158 ----------
@@ -147,8 +161,9 @@ def calculate_power_output(weather, my_turbine, e126):
147161 my_turbine : WindTurbine
148162 WindTurbine object with self provided power curve.
149163 e126 : WindTurbine
150- WindTurbine object with power curve from data file provided by the
151- windpowerlib.
164+ WindTurbine object with power curve from the Open Energy Database.
165+ dummy_turbine : WindTurbine
166+ WindTurbine object with power coefficient curve from example file.
152167
153168 """
154169
@@ -180,10 +195,17 @@ def calculate_power_output(weather, my_turbine, e126):
180195 # write power output time series to WindTurbine object
181196 e126 .power_output = mc_e126 .power_output
182197
198+ # power output calculation for example_turbine
199+ # own specification for 'power_output_model'
200+ mc_example_turbine = ModelChain (
201+ dummy_turbine ,
202+ power_output_model = 'power_coefficient_curve' ).run_model (weather )
203+ dummy_turbine .power_output = mc_example_turbine .power_output
204+
183205 return
184206
185207
186- def plot_or_print (my_turbine , e126 ):
208+ def plot_or_print (my_turbine , e126 , dummy_turbine ):
187209 r"""
188210 Plots or prints power output and power (coefficient) curves.
189211
@@ -194,17 +216,21 @@ def plot_or_print(my_turbine, e126):
194216 e126 : WindTurbine
195217 WindTurbine object with power curve from data file provided by the
196218 windpowerlib.
219+ dummy_turbine : WindTurbine
220+ WindTurbine object with power coefficient curve from example file.
197221
198222 """
199223
200224 # plot or print turbine power output
201225 if plt :
202226 e126 .power_output .plot (legend = True , label = 'Enercon E126' )
203227 my_turbine .power_output .plot (legend = True , label = 'myTurbine' )
228+ dummy_turbine .power_output .plot (legend = True , label = 'dummyTurbine' )
204229 plt .show ()
205230 else :
206231 print (e126 .power_output )
207232 print (my_turbine .power_output )
233+ print (dummy_turbine .power_output )
208234
209235 # plot or print power (coefficient) curve
210236 if plt :
@@ -239,9 +265,9 @@ def run_example():
239265
240266 """
241267 weather = get_weather_data ('weather.csv' )
242- my_turbine , e126 = initialize_wind_turbines ()
243- calculate_power_output (weather , my_turbine , e126 )
244- plot_or_print (my_turbine , e126 )
268+ my_turbine , e126 , dummy_turbine = initialize_wind_turbines ()
269+ calculate_power_output (weather , my_turbine , e126 , dummy_turbine )
270+ plot_or_print (my_turbine , e126 , dummy_turbine )
245271
246272
247273if __name__ == "__main__" :
0 commit comments