-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from NREL/develop
v3.2
- Loading branch information
Showing
98 changed files
with
3,020 additions
and
1,166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright 2022 NREL | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# See https://floris.readthedocs.io for documentation | ||
|
||
|
||
import numpy as np | ||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
from scipy.interpolate import NearestNDInterpolator | ||
from floris.tools import FlorisInterface, WindRose, wind_rose | ||
|
||
""" | ||
This example demonstrates how to calculate the Annual Energy Production (AEP) | ||
of a wind farm using wind rose information stored in a .csv file. | ||
The wind rose information is first loaded, after which we initialize our Floris | ||
Interface. A 3 turbine farm is generated, and then the turbine wakes and powers | ||
are calculated across all the wind directions. Finally, the farm power is | ||
converted to AEP and reported out. | ||
""" | ||
|
||
# Read in the wind rose using the class | ||
wind_rose = WindRose() | ||
wind_rose.read_wind_rose_csv("inputs/wind_rose.csv") | ||
|
||
# Show the wind rose | ||
wind_rose.plot_wind_rose() | ||
|
||
# Load the FLORIS object | ||
fi = FlorisInterface("inputs/gch.yaml") # GCH model | ||
# fi = FlorisInterface("inputs/cc.yaml") # CumulativeCurl model | ||
|
||
# Assume a three-turbine wind farm with 5D spacing. We reinitialize the | ||
# floris object and assign the layout, wind speed and wind direction arrays. | ||
D = 126.0 # Rotor diameter for the NREL 5 MW | ||
fi.reinitialize( | ||
layout=[[0.0, 5* D, 10 * D], [0.0, 0.0, 0.0]] | ||
) | ||
|
||
# Compute the AEP using the default settings | ||
aep = fi.get_farm_AEP_wind_rose_class(wind_rose=wind_rose) | ||
print("Farm AEP (default options): {:.3f} GWh".format(aep / 1.0e9)) | ||
|
||
# Compute the AEP again while specifying a cut-in and cut-out wind speed. | ||
# The wake calculations are skipped for any wind speed below respectively | ||
# above the cut-in and cut-out wind speed. This can speed up computation and | ||
# prevent unexpected behavior for zero/negative and very high wind speeds. | ||
# In this example, the results should not change between this and the default | ||
# call to 'get_farm_AEP()'. | ||
aep = fi.get_farm_AEP_wind_rose_class( | ||
wind_rose=wind_rose, | ||
cut_in_wind_speed=3.0, # Wakes are not evaluated below this wind speed | ||
cut_out_wind_speed=25.0, # Wakes are not evaluated above this wind speed | ||
) | ||
print("Farm AEP (with cut_in/out specified): {:.3f} GWh".format(aep / 1.0e9)) | ||
|
||
# Finally, we can also compute the AEP while ignoring all wake calculations. | ||
# This can be useful to quantity the annual wake losses in the farm. Such | ||
# calculations can be facilitated by enabling the 'no_wake' handle. | ||
aep_no_wake = fi.get_farm_AEP_wind_rose_class(wind_rose=wind_rose, no_wake=True) | ||
print("Farm AEP (no_wake=True): {:.3f} GWh".format(aep_no_wake / 1.0e9)) | ||
|
||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Copyright 2022 NREL | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# See https://floris.readthedocs.io for documentation | ||
|
||
|
||
import numpy as np | ||
import pandas as pd | ||
from floris.tools import FlorisInterface | ||
import matplotlib.pyplot as plt | ||
|
||
""" | ||
This example demonstrates how to use turbine_wieghts to define a set of turbines belonging to a neighboring farm which | ||
impacts the power production of the farm under consideration via wake losses, but whose own power production is not | ||
considered in farm power / aep production | ||
The use of neighboring farms in the context of wake steering design is considered in example examples/10_optimize_yaw_with_neighboring_farm.py | ||
""" | ||
|
||
|
||
# Instantiate FLORIS using either the GCH or CC model | ||
fi = FlorisInterface("inputs/gch.yaml") # GCH model matched to the default "legacy_gauss" of V2 | ||
|
||
# Define a 4 turbine farm turbine farm | ||
D = 126. | ||
layout_x = np.array([0, D*6, 0, D*6]) | ||
layout_y = [0, 0, D*3, D*3] | ||
fi.reinitialize(layout_x = layout_x, layout_y = layout_y) | ||
|
||
# Define a simple wind rose with just 1 wind speed | ||
wd_array = np.arange(0,360,4.) | ||
fi.reinitialize(wind_directions=wd_array, wind_speeds=[8.]) | ||
|
||
|
||
# Calculate | ||
fi.calculate_wake() | ||
|
||
# Collect the farm power | ||
farm_power_base = fi.get_farm_power() / 1E3 # In kW | ||
|
||
# Add a neighbor to the east | ||
layout_x = np.array([0, D*6, 0, D*6, D*12, D*15, D*12, D*15]) | ||
layout_y = np.array([0, 0, D*3, D*3, 0, 0, D*3, D*3]) | ||
fi.reinitialize(layout_x = layout_x, layout_y = layout_y) | ||
|
||
# Define the weights to exclude the neighboring farm from calcuations of power | ||
turbine_weights = np.zeros(len(layout_x), dtype=int) | ||
turbine_weights[0:4] = 1.0 | ||
|
||
# Calculate | ||
fi.calculate_wake() | ||
|
||
# Collect the farm power with the neightbor | ||
farm_power_neighbor = fi.get_farm_power(turbine_weights=turbine_weights) / 1E3 # In kW | ||
|
||
# Show the farms | ||
fig, ax = plt.subplots() | ||
ax.scatter(layout_x[turbine_weights==1],layout_y[turbine_weights==1], color='k',label='Base Farm') | ||
ax.scatter(layout_x[turbine_weights==0],layout_y[turbine_weights==0], color='r',label='Neighboring Farm') | ||
ax.legend() | ||
|
||
# Plot the power difference | ||
fig, ax = plt.subplots() | ||
ax.plot(wd_array,farm_power_base,color='k',label='Farm Power (no neighbor)') | ||
ax.plot(wd_array,farm_power_neighbor,color='r',label='Farm Power (neighboring farm due east)') | ||
ax.grid(True) | ||
ax.legend() | ||
ax.set_xlabel('Wind Direction (deg)') | ||
ax.set_ylabel('Power (kW)') | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.