-
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.
Rename floris.simulation, floris.tools to floris.core, floris (#830)
* Rename floris.simulation to floris.core * Move floris.tools to top level * Propogate name change in floris/ * Rename FlorisInterface to Floris, Floris to Core # Conflicts: # floris/core/core.py * Rename core object on Floris * Update tests * Update a subset of examples * Rename floris.floris module to floris.floris_model * Update after mergre from v4 branch * Clean up * .floris -> .core * Update test nomenclature * Update profiling nomenclature * Update nomenclature * Update example 01 * Update example nomenclature * fi_subset -> fmodel_subset * fix fi_ instances * fix line length * isort * Update profiling * Update F841 locations * Update quality metrics * Old refs to simulation/ * Remove bad links to old tools folder * Examples FlorisInterface to FlorisModel updates * Update syntax and docstrings * Update documentation notebooks * Add TI as input for calculate plane functions * Add to “with turbines” function * Update getting started notebook * Update turbine previewer and notebook * Update API docs file references * Update README * isort * File and class name changes. * Rename instantiated XFlorisModel objects. * Added tests for unc+parallel model; currently failing. * Reconfigure get_turbine_powers on UncertaintyFlorisModel for external use; access from ParallelFlorisModel. * get_farm_AEP method updated and tested; remove cut_in and cut_out ws options. * Ruff. * Remove _load_local_floris_object function. * Conform to requirement to pass turbulence_intensities. --------- Co-authored-by: Paul <[email protected]> Co-authored-by: misi9170 <[email protected]>
- Loading branch information
1 parent
96384d0
commit e31a4e9
Showing
142 changed files
with
2,393 additions
and
2,242 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,62 @@ | ||
"""Example 1: Opening FLORIS and Computing Power | ||
import numpy as np | ||
|
||
from floris.tools import FlorisInterface | ||
This first example illustrates several of the key concepts in FLORIS. It: | ||
|
||
""" | ||
This example creates a FLORIS instance | ||
1) Makes a two-turbine layout | ||
2) Demonstrates single ws/wd simulations | ||
3) Demonstrates mulitple ws/wd simulations | ||
1) Initializing FLORIS | ||
2) Changing the wind farm layout | ||
3) Changing the incoming wind speed, wind direction and turbulence intensity | ||
4) Running the FLORIS simulation | ||
5) Getting the power output of the turbines | ||
Main concept is introduce FLORIS and illustrate essential structure of most-used FLORIS calls | ||
""" | ||
|
||
# Initialize FLORIS with the given input file via FlorisInterface. | ||
# For basic usage, FlorisInterface provides a simplified and expressive | ||
# entry point to the simulation routines. | ||
fi = FlorisInterface("inputs/gch.yaml") | ||
|
||
# Convert to a simple two turbine layout | ||
fi.set(layout_x=[0, 500.0], layout_y=[0.0, 0.0]) | ||
import numpy as np | ||
|
||
# Single wind speed and wind direction | ||
print("\n========================= Single Wind Direction and Wind Speed =========================") | ||
from floris import FlorisModel | ||
|
||
# Get the turbine powers assuming 1 wind direction and speed | ||
# Set the yaw angles to 0 with 1 wind direction and speed | ||
fi.set(wind_directions=[270.0], wind_speeds=[8.0], yaw_angles=np.zeros([1, 2])) | ||
|
||
fi.run() | ||
# Initialize FLORIS with the given input file. | ||
# The Floris class is the entry point for most usage. | ||
fmodel = FlorisModel("inputs/gch.yaml") | ||
|
||
# Get the turbine powers | ||
turbine_powers = fi.get_turbine_powers() / 1000.0 | ||
# Changing the wind farm layout uses FLORIS' set method to a two-turbine layout | ||
fmodel.set(layout_x=[0, 500.0], layout_y=[0.0, 0.0]) | ||
|
||
print("The turbine power matrix should be of dimensions 1 findex X 2 Turbines") | ||
print(turbine_powers) | ||
print("Shape: ", turbine_powers.shape) | ||
# Changing wind speed, wind direction, and turbulence intensity using the set method | ||
# as well. Note that the wind_speeds, wind_directions, and turbulence_intensities | ||
# are all specified as arrays of the same length. | ||
fmodel.set(wind_directions=np.array([270.0]), | ||
wind_speeds=[8.0], | ||
turbulence_intensities=np.array([0.06])) | ||
|
||
# Single wind speed and multiple wind directions | ||
print("\n========================= Single Wind Direction and Multiple Wind Speeds ===============") | ||
|
||
wind_speeds = np.array([8.0, 9.0, 10.0]) | ||
wind_directions = np.array([270.0, 270.0, 270.0]) | ||
turbulence_intensities = np.array([0.06, 0.06, 0.06]) | ||
|
||
# 3 wind directions/ speeds | ||
fi.set( | ||
wind_speeds=wind_speeds, | ||
wind_directions=wind_directions, | ||
turbulence_intensities=turbulence_intensities, | ||
yaw_angles=np.zeros([3, 2]) | ||
) | ||
fi.run() | ||
turbine_powers = fi.get_turbine_powers() / 1000.0 | ||
print("The turbine power matrix should be of dimensions 3 findex X 2 Turbines") | ||
print(turbine_powers) | ||
print("Shape: ", turbine_powers.shape) | ||
# Note that typically all 3, wind_directions, wind_speeds and turbulence_intensities | ||
# must be supplied to set. However, the exception is if not changing the lenght | ||
# of the arrays, then only one or two may be supplied. | ||
fmodel.set(turbulence_intensities=np.array([0.07])) | ||
|
||
# Multiple wind speeds and multiple wind directions | ||
print("\n========================= Multiple Wind Directions and Multiple Wind Speeds ============") | ||
# The number of elements in the wind_speeds, wind_directions, and turbulence_intensities | ||
# corresponds to the number of conditions to be simulated. In FLORIS, each of these are | ||
# tracked by a simple index called a findex. There is no requirement that the values | ||
# be unique. Internally in FLORIS, most data structures will have the findex as their | ||
# 0th dimension. The value n_findex is the total number of conditions to be simulated. | ||
# This command would simulate 4 conditions (n_findex = 4). | ||
fmodel.set(wind_directions=np.array([270.0, 270.0, 270.0, 270.0]), | ||
wind_speeds=[8.0, 8.0, 10.0, 10.0], | ||
turbulence_intensities=np.array([0.06, 0.06, 0.06, 0.06])) | ||
|
||
# To consider each combination, this needs to be broadcast out in advance | ||
# After the set method, the run method is called to perform the simulation | ||
fmodel.run() | ||
|
||
wind_speeds = np.tile([8.0, 9.0, 10.0], 3) | ||
wind_directions = np.repeat([260.0, 270.0, 280.0], 3) | ||
turbulence_intensities = np.tile([0.06, 0.06, 0.06], 3) | ||
# There are functions to get either the power of each turbine, or the farm power | ||
turbine_powers = fmodel.get_turbine_powers() / 1000.0 | ||
farm_power = fmodel.get_farm_power() / 1000.0 | ||
|
||
fi.set( | ||
wind_directions=wind_directions, | ||
wind_speeds=wind_speeds, | ||
turbulence_intensities=turbulence_intensities, | ||
yaw_angles=np.zeros([9, 2]) | ||
) | ||
fi.run() | ||
turbine_powers = fi.get_turbine_powers() / 1000.0 | ||
print("The turbine power matrix should be of dimensions 9 WD/WS X 2 Turbines") | ||
print("The turbine power matrix should be of dimensions 4 (n_findex) X 2 (n_turbines)") | ||
print(turbine_powers) | ||
print("Shape: ", turbine_powers.shape) | ||
|
||
print("The farm power should be a 1D array of length 4 (n_findex)") | ||
print(farm_power) | ||
print("Shape: ", farm_power.shape) |
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.