floris.floris_model#
Classes
|
FlorisModel provides a high-level user interface to many of the underlying methods within the FLORIS framework. |
- class floris.floris_model.FlorisModel(configuration)[source]#
FlorisModel provides a high-level user interface to many of the underlying methods within the FLORIS framework. It is meant to act as a single entry-point for the majority of users, simplifying the calls to methods on objects within FLORIS.
- Args:
- configuration (
dict
): The Floris configuration dictionary or YAML file. - The configuration should have the following inputs specified.
flow_field: See floris.simulation.flow_field.FlowField for more details.
farm: See floris.simulation.farm.Farm for more details.
turbine: See floris.simulation.turbine.Turbine for more details.
wake: See floris.simulation.wake.WakeManager for more details.
logging: See floris.simulation.core.Core for more details.
- configuration (
- Parameters:
configuration (dict | str | Path)
- set_operation(yaw_angles=None, power_setpoints=None, awc_modes=None, awc_amplitudes=None, awc_frequencies=None, disable_turbines=None)[source]#
Apply operating setpoints to the floris object.
This function is not meant to be called directly by most users---users should instead call the set() method.
- Args:
- yaw_angles (NDArrayFloat | list[float] | None, optional): Turbine yaw angles. Defaults
to None.
- power_setpoints (NDArrayFloat | list[float] | list[float, None] | None, optional):
Turbine power setpoints. Defaults to None.
- disable_turbines (NDArrayBool | list[bool] | None, optional): Boolean array on whether
to disable turbines. Defaults to None.
- Parameters:
yaw_angles (ndarray[Any, dtype[float64]] | list[float] | None)
power_setpoints (ndarray[Any, dtype[float64]] | list[float] | list[float, None] | None)
awc_modes (ndarray[Any, dtype[str_]] | list[str] | list[str, None] | None)
awc_amplitudes (ndarray[Any, dtype[float64]] | list[float] | list[float, None] | None)
awc_frequencies (ndarray[Any, dtype[float64]] | list[float] | list[float, None] | None)
disable_turbines (ndarray[Any, dtype[bool_]] | list[bool] | None)
- set(wind_speeds=None, wind_directions=None, wind_shear=None, wind_veer=None, reference_wind_height=None, turbulence_intensities=None, air_density=None, layout_x=None, layout_y=None, turbine_type=None, turbine_library_path=None, solver_settings=None, heterogeneous_inflow_config=None, wind_data=None, yaw_angles=None, power_setpoints=None, awc_modes=None, awc_amplitudes=None, awc_frequencies=None, disable_turbines=None)[source]#
Set the wind conditions and operation setpoints for the wind farm.
- Args:
- wind_speeds (NDArrayFloat | list[float] | None, optional): Wind speeds at each findex.
Defaults to None.
- wind_directions (NDArrayFloat | list[float] | None, optional): Wind directions at each
findex. Defaults to None.
wind_shear (float | None, optional): Wind shear exponent. Defaults to None. wind_veer (float | None, optional): Wind veer. Defaults to None. reference_wind_height (float | None, optional): Reference wind height. Defaults to None. turbulence_intensities (NDArrayFloat | list[float] | None, optional): Turbulence
intensities at each findex. Defaults to None.
air_density (float | None, optional): Air density. Defaults to None. layout_x (NDArrayFloat | list[float] | None, optional): X-coordinates of the turbines.
Defaults to None.
- layout_y (NDArrayFloat | list[float] | None, optional): Y-coordinates of the turbines.
Defaults to None.
turbine_type (list | None, optional): Turbine type. Defaults to None. turbine_library_path (str | Path | None, optional): Path to the turbine library.
Defaults to None.
solver_settings (dict | None, optional): Solver settings. Defaults to None. heterogeneous_inflow_config (None, optional): heterogeneous inflow configuration.
Defaults to None.
wind_data (type[WindDataBase] | None, optional): Wind data. Defaults to None. yaw_angles (NDArrayFloat | list[float] | None, optional): Turbine yaw angles.
Defaults to None.
- power_setpoints (NDArrayFloat | list[float] | list[float, None] | None, optional):
Turbine power setpoints.
- disable_turbines (NDArrayBool | list[bool] | None, optional): NDArray with dimensions
n_findex x n_turbines. True values indicate the turbine is disabled at that findex and the power setpoint at that position is set to 0. Defaults to None.
- Parameters:
wind_speeds (list[float] | ndarray[Any, dtype[float64]] | None)
wind_directions (list[float] | ndarray[Any, dtype[float64]] | None)
wind_shear (float | None)
wind_veer (float | None)
reference_wind_height (float | None)
turbulence_intensities (list[float] | ndarray[Any, dtype[float64]] | None)
air_density (float | None)
layout_x (list[float] | ndarray[Any, dtype[float64]] | None)
layout_y (list[float] | ndarray[Any, dtype[float64]] | None)
turbine_type (list | None)
turbine_library_path (str | Path | None)
solver_settings (dict | None)
wind_data (type[WindDataBase] | None)
yaw_angles (ndarray[Any, dtype[float64]] | list[float] | None)
power_setpoints (ndarray[Any, dtype[float64]] | list[float] | list[float, None] | None)
awc_modes (ndarray[Any, dtype[str_]] | list[str] | list[str, None] | None)
awc_amplitudes (ndarray[Any, dtype[float64]] | list[float] | list[float, None] | None)
awc_frequencies (ndarray[Any, dtype[float64]] | list[float] | list[float, None] | None)
disable_turbines (ndarray[Any, dtype[bool_]] | list[bool] | None)
- reset_operation()[source]#
Instantiate a new Floris object to set all operation setpoints to their default values.
- run()[source]#
Run the FLORIS solve to compute the velocity field and wake effects.
- Return type:
None
- run_no_wake()[source]#
This function is similar to run() except that it does not apply a wake model. That is, the wind farm is modeled as if there is no wake in the flow. Operation settings may reduce the power and thrust of the turbine to where they're applied.
- Return type:
None
- get_turbine_powers()[source]#
Calculates the power at each turbine in the wind farm.
- Returns:
NDArrayFloat: Powers at each turbine.
- get_expected_turbine_powers(freq=None)[source]#
Compute the expected (mean) power of each turbine.
- Args:
- freq (NDArrayFloat): NumPy array with shape
with the frequencies of each wind direction and wind speed combination. freq is either a 1D array, in which case the same frequencies are used for all turbines, or a 2D array with shape equal to (n_findex, n_turbines), in which case each turbine has a unique set of frequencies (this is the case for example using WindRoseByTurbine).
These frequencies should typically sum across rows
up to 1.0 and are used to weigh the wind farm power for every condition in calculating the wind farm's AEP. Defaults to None. If None and a WindData object was supplied, the WindData object's frequencies will be used. Otherwise, uniform frequencies are assumed (i.e., a simple mean over the findices is computed).
- get_farm_power(turbine_weights=None, use_turbulence_correction=False)[source]#
Report wind plant power from instance of floris. Optionally includes uncertainty in wind direction and yaw position when determining power. Uncertainty is included by computing the mean wind farm power for a distribution of wind direction and yaw position deviations from the original wind direction and yaw angles.
- Args:
- turbine_weights (NDArrayFloat | list[float] | None, optional):
weighing terms that allow the user to emphasize power at particular turbines and/or completely ignore the power from other turbines. This is useful when, for example, you are modeling multiple wind farms in a single floris object. If you only want to calculate the power production for one of those farms and include the wake effects of the neighboring farms, you can set the turbine_weights for the neighboring farms' turbines to 0.0. The array of turbine powers from floris is multiplied with this array in the calculation of the objective function. If None, this is an array with all values 1.0 and with shape equal to (n_findex, n_turbines). Defaults to None.
- use_turbulence_correction: (bool, optional): When True uses a
turbulence parameter to adjust power output calculations. Defaults to False. Not currently implemented.
- Returns:
float: Sum of wind turbine powers in W.
- get_expected_farm_power(freq=None, turbine_weights=None)[source]#
Compute the expected (mean) power of the wind farm.
- Return type:
float
- Args:
- freq (NDArrayFloat): NumPy array with shape (n_findex)
with the frequencies of each wind direction and wind speed combination. These frequencies should typically sum up to 1.0 and are used to weigh the wind farm power for every condition in calculating the wind farm's AEP. Defaults to None. If None and a WindData object was supplied, the WindData object's frequencies will be used. Otherwise, uniform frequencies are assumed (i.e., a simple mean over the findices is computed).
- turbine_weights (NDArrayFloat | list[float] | None, optional):
weighing terms that allow the user to emphasize power at particular turbines and/or completely ignore the power from other turbines. This is useful when, for example, you are modeling multiple wind farms in a single floris object. If you only want to calculate the power production for one of those farms and include the wake effects of the neighboring farms, you can set the turbine_weights for the neighboring farms' turbines to 0.0. The array of turbine powers from floris is multiplied with this array in the calculation of the objective function. If None, this is an array with all values 1.0 and with shape equal to (n_findex, n_turbines). Defaults to None.
- get_farm_AEP(freq=None, turbine_weights=None, hours_per_year=8760)[source]#
Estimate annual energy production (AEP) for distributions of wind speed, wind direction, frequency of occurrence, and yaw offset.
- Return type:
float
- Args:
- freq (NDArrayFloat): NumPy array with shape (n_findex)
with the frequencies of each wind direction and wind speed combination. These frequencies should typically sum up to 1.0 and are used to weigh the wind farm power for every condition in calculating the wind farm's AEP. Defaults to None. If None and a WindData object was supplied, the WindData object's frequencies will be used. Otherwise, uniform frequencies are assumed.
- turbine_weights (NDArrayFloat | list[float] | None, optional):
weighing terms that allow the user to emphasize power at particular turbines and/or completely ignore the power from other turbines. This is useful when, for example, you are modeling multiple wind farms in a single floris object. If you only want to calculate the power production for one of those farms and include the wake effects of the neighboring farms, you can set the turbine_weights for the neighboring farms' turbines to 0.0. The array of turbine powers from floris is multiplied with this array in the calculation of the objective function. If None, this is an array with all values 1.0 and with shape equal to (n_findex, n_turbines). Defaults to None.
hours_per_year (float, optional): Number of hours in a year. Defaults to 365 * 24.
- Returns:
- float:
The Annual Energy Production (AEP) for the wind farm in watt-hours.
- get_expected_farm_value(freq=None, values=None, turbine_weights=None)[source]#
Compute the expected (mean) value produced by the wind farm. This is computed by multiplying the wind farm power for each wind condition by the corresponding value of the power generated (e.g., electricity market price per unit of energy), then weighting by frequency and summing over all conditions.
- Return type:
float
- Args:
- freq (NDArrayFloat): NumPy array with shape (n_findex)
with the frequencies of each wind condition combination. These frequencies should typically sum up to 1.0 and are used to weigh the wind farm value for every condition in calculating the wind farm's expected value. Defaults to None. If None and a WindData object is supplied, the WindData object's frequencies will be used. Otherwise, uniform frequencies are assumed (i.e., a simple mean over the findices is computed).
- values (NDArrayFloat): NumPy array with shape (n_findex)
with the values corresponding to the power generated for each wind condition combination. The wind farm power is multiplied by the value for every condition in calculating the wind farm's expected value. Defaults to None. If None and a WindData object is supplied, the WindData object's values will be used. Otherwise, a value of 1 for all conditions is assumed (i.e., the expected farm value will be equivalent to the expected farm power).
- turbine_weights (NDArrayFloat | list[float] | None, optional):
weighing terms that allow the user to emphasize power at particular turbines and/or completely ignore the power from other turbines. This is useful when, for example, you are modeling multiple wind farms in a single floris object. If you only want to calculate the value production for one of those farms and include the wake effects of the neighboring farms, you can set the turbine_weights for the neighboring farms' turbines to 0.0. The array of turbine powers from floris is multiplied with this array in the calculation of the expected value. If None, this is an array with all values 1.0 and with shape equal to (n_findex, n_turbines). Defaults to None.
- Returns:
- float:
The expected value produced by the wind farm in units of value.
- get_farm_AVP(freq=None, values=None, turbine_weights=None, hours_per_year=8760)[source]#
Estimate annual value production (AVP) for distribution of wind conditions, frequencies of occurrence, and corresponding values of power generated (e.g., electricity price per unit of energy).
- Return type:
float
- Args:
- freq (NDArrayFloat): NumPy array with shape (n_findex)
with the frequencies of each wind condition combination. These frequencies should typically sum up to 1.0 and are used to weigh the wind farm value for every condition in calculating the wind farm's AVP. Defaults to None. If None and a WindData object is supplied, the WindData object's frequencies will be used. Otherwise, uniform frequencies are assumed (i.e., a simple mean over the findices is computed).
- values (NDArrayFloat): NumPy array with shape (n_findex)
with the values corresponding to the power generated for each wind condition combination. The wind farm power is multiplied by the value for every condition in calculating the wind farm's AVP. Defaults to None. If None and a WindData object is supplied, the WindData object's values will be used. Otherwise, a value of 1 for all conditions is assumed (i.e., the AVP will be equivalent to the AEP).
- turbine_weights (NDArrayFloat | list[float] | None, optional):
weighing terms that allow the user to emphasize power at particular turbines and/or completely ignore the power from other turbines. This is useful when, for example, you are modeling multiple wind farms in a single floris object. If you only want to calculate the value production for one of those farms and include the wake effects of the neighboring farms, you can set the turbine_weights for the neighboring farms' turbines to 0.0. The array of turbine powers from floris is multiplied with this array in the calculation of the AVP. If None, this is an array with all values 1.0 and with shape equal to (n_findex, n_turbines). Defaults to None.
- hours_per_year (float, optional): Number of hours in a year.
Defaults to 365 * 24.
- Returns:
- float:
The Annual Value Production (AVP) for the wind farm in units of value.
- set_for_viz(findex, solver_settings)[source]#
Set the floris object to a single findex for visualization.
- Return type:
None
- Parameters:
findex (int)
solver_settings (dict)
- Args:
findex (int): The findex to set the floris object to. solver_settings (dict): The solver settings to use for visualization.
- calculate_cross_plane(downstream_dist, y_resolution=200, z_resolution=200, y_bounds=None, z_bounds=None, findex_for_viz=None)[source]#
Shortcut method to instantiate a
CutPlane
object containing the velocity field in a horizontal plane cut through the simulation domain at a specific height.- Args:
downstream_dist (float): Distance downstream of turbines to compute. y_resolution (float, optional): Output array resolution.
Defaults to 200 points.
- z_resolution (float, optional): Output array resolution.
Defaults to 200 points.
- y_bounds (tuple, optional): Limits of output array (in m).
Defaults to None.
- z_bounds (tuple, optional): Limits of output array (in m).
Defaults to None.
finder_for_viz (int, optional): Index of the condition to visualize.
- Returns:
CutPlane
: containing values of x, y, u, v, w
- calculate_horizontal_plane(height, x_resolution=200, y_resolution=200, x_bounds=None, y_bounds=None, findex_for_viz=None)[source]#
Shortcut method to instantiate a
CutPlane
object containing the velocity field in a horizontal plane cut through the simulation domain at a specific height.- Args:
height (float): Height of cut plane. Defaults to Hub-height. x_resolution (float, optional): Output array resolution.
Defaults to 200 points.
- y_resolution (float, optional): Output array resolution.
Defaults to 200 points.
- x_bounds (tuple, optional): Limits of output array (in m).
Defaults to None.
- y_bounds (tuple, optional): Limits of output array (in m).
Defaults to None.
finder_for_viz (int, optional): Index of the condition to visualize.
- Returns:
CutPlane
: containing values of x, y, u, v, w
- calculate_y_plane(crossstream_dist, x_resolution=200, z_resolution=200, x_bounds=None, z_bounds=None, findex_for_viz=None)[source]#
Shortcut method to instantiate a
CutPlane
object containing the velocity field in a horizontal plane cut through the simulation domain at a specific height.- Args:
height (float): Height of cut plane. Defaults to Hub-height. x_resolution (float, optional): Output array resolution.
Defaults to 200 points.
- z_resolution (float, optional): Output array resolution.
Defaults to 200 points.
- x_bounds (tuple, optional): Limits of output array (in m).
Defaults to None.
- z_bounds (tuple, optional): Limits of output array (in m).
Defaults to None.
- findex_for_viz (int, optional): Index of the condition to visualize.
Defaults to 0.
- Returns:
CutPlane
: containing values of x, y, u, v, w
- get_plane_of_points(normal_vector='z', planar_coordinate=None)[source]#
Calculates velocity values through the
FlorisModel.calculate_wake()
method at points in plane specified by inputs.- Args:
- normal_vector (string, optional): Vector normal to plane.
Defaults to z.
- planar_coordinate (float, optional): Value of normal vector
to slice through. Defaults to None.
- Returns:
pandas.DataFrame
: containing values of x1, x2, x3, u, v, w
- sample_flow_at_points(x, y, z)[source]#
Extract the wind speed at points in the flow.
- Args:
x (1DArrayFloat | list): x-locations of points where flow is desired. y (1DArrayFloat | list): y-locations of points where flow is desired. z (1DArrayFloat | list): z-locations of points where flow is desired.
- Returns:
3DArrayFloat containing wind speed with dimensions (# of findex, # of sample points)
- Parameters:
x (ndarray[Any, dtype[float64]])
y (ndarray[Any, dtype[float64]])
z (ndarray[Any, dtype[float64]])
- sample_velocity_deficit_profiles(direction='cross-stream', downstream_dists=None, profile_range=None, resolution=100, wind_direction=None, homogeneous_wind_speed=None, ref_rotor_diameter=None, x_start=0.0, y_start=0.0, reference_height=None)[source]#
Extract velocity deficit profiles at a set of downstream distances from a starting point (usually a turbine location). For each downstream distance, a profile is sampled along a line in either the cross-stream direction (x2) or the vertical direction (x3). Velocity deficit is here defined as (homogeneous_wind_speed - u)/homogeneous_wind_speed, where u is the wake velocity obtained when wind_shear = 0.0.
- Return type:
list
[DataFrame
]- Parameters:
direction (str)
downstream_dists (ndarray[Any, dtype[float64]] | list)
profile_range (ndarray[Any, dtype[float64]] | list)
resolution (int)
wind_direction (float)
homogeneous_wind_speed (float)
ref_rotor_diameter (float)
x_start (float)
y_start (float)
reference_height (float)
- Args:
- direction: At each downstream location, this is the direction in which to sample the
profile. Either cross-stream or vertical.
- downstream_dists: A list/array of streamwise locations for where to sample the profiles.
Default starting point is (0.0, 0.0, reference_height).
- profile_range: Determines the extent of the line along which the profiles are sampled.
The range is defined about a point which lies some distance directly downstream of the starting point.
resolution: Number of sample points in each profile. wind_direction: A single wind direction. homogeneous_wind_speed: A single wind speed. It is called homogeneous since 'wind_shear'
is temporarily set to 0.0 in this method.
- ref_rotor_diameter: A reference rotor diameter which is used to normalize the
coordinates.
x_start: x-coordinate of starting point. y_start: y-coordinate of starting point. reference_height: If direction is cross-stream, then reference_height defines the
height of the horizontal plane in which the velocity profiles are sampled. If direction is vertical, then the velocity is sampled along the vertical direction with the profile_range being relative to the reference_height.
- Returns:
A list of pandas DataFrame objects where each DataFrame represents one velocity deficit profile.
- get_operation_model()[source]#
Get the operation model of a FlorisModel.
- Return type:
str
- Returns:
str: The operation_model.
- set_operation_model(operation_model)[source]#
Set the turbine operation model(s).
- Args:
operation_model (str): The operation model to set.
- Parameters:
operation_model (str | List[str])
- get_param(param, param_idx=None)[source]#
Get a parameter from a FlorisModel object.
- Return type:
Any
- Parameters:
param (List[str])
param_idx (int | None)
- Args:
param (List[str]): A list of keys to traverse the FlorisModel dictionary. param_idx (Optional[int], optional): The index to get the value at. Defaults to None.
If None, the entire parameter is returned.
- Returns:
Any: The value of the parameter.
- set_param(param, value, param_idx=None)[source]#
Set a parameter in a FlorisModel object.
- Args:
param (List[str]): A list of keys to traverse the FlorisModel dictionary. value (Any): The value to set. param_idx (Optional[int], optional): The index to set the value at. Defaults to None.
- Parameters:
param (List[str])
value (Any)
param_idx (int | None)
- get_turbine_layout(z=False)[source]#
Get turbine layout
- Args:
z (bool): When True, return lists of x, y, and z coords, otherwise, return x and y only. Defaults to False.
- Returns:
- np.array: lists of x, y, and (optionally) z coordinates of
each turbine
- property layout_x#
Wind turbine coordinate information.
- Returns:
np.array: Wind turbine x-coordinate.
- property layout_y#
Wind turbine coordinate information.
- Returns:
np.array: Wind turbine y-coordinate.
- property wind_directions#
Wind direction information.
- Returns:
np.array: Wind direction.
- property wind_speeds#
Wind speed information.
- Returns:
np.array: Wind speed.
- property turbulence_intensities#
Turbulence intensity information.
- Returns:
np.array: Turbulence intensity.
- property n_findex#
Number of floris indices (findex).
- Returns:
int: Number of flow indices.
- property n_turbines#
Number of turbines.
- Returns:
int: Number of turbines.
- property reference_wind_height#
Reference wind height.
- Returns:
float: Reference wind height.
- property turbine_average_velocities: ndarray[Any, dtype[float64]]#
- property wind_data#
- static merge_floris_models(fmodel_list, reference_wind_height=None)[source]#
Merge a list of FlorisModel objects into a single FlorisModel object. Note that it uses the very first object specified in fmodel_list to build upon, so it uses those wake model parameters, air density, and so on.
- Args:
fmodel_list (list): Array-like of FlorisModel objects. reference_wind_height (float, optional): Height in meters
at which the reference wind speed is assigned. If None, will assume this value is equal to the reference wind height specified in the FlorisModel objects. This only works if all objects have the same value for their reference_wind_height.
- Returns:
- fmodel_merged (FlorisModel): The merged FlorisModel object,
merged in the same order as fmodel_list. The objects are merged on the turbine locations and turbine types, but not on the wake parameters or general solver settings.