floris.uncertain_floris_model#
Functions
Calculates the power at each turbine in the wind farm based on uncertainty weights. |
Classes
|
The ApproxFlorisModel overloads the UncertainFlorisModel with the special case that the wd_sample_points = [0]. |
|
An interface for handling uncertainty in wind farm simulations. |
- class floris.uncertain_floris_model.UncertainFlorisModel(configuration, wd_resolution=1.0, ws_resolution=1.0, ti_resolution=0.01, yaw_resolution=1.0, power_setpoint_resolution=100, awc_amplitude_resolution=0.1, wd_std=3.0, wd_sample_points=None, fix_yaw_to_nominal_direction=False, verbose=False)[source]#
An interface for handling uncertainty in wind farm simulations.
This class contains a FlorisModel object and adds functionality to handle uncertainty in wind direction. It is designed to be used similarly to FlorisModel. In the model, the turbine powers are computed for a set of expanded wind conditions, given by wd_sample_points, and then the powers are computed as a gaussian blend of these expanded conditions.
To reduce computational costs, the wind directions, wind speeds, turbulence intensities, yaw angles, and power setpoints are rounded to specified resolutions. Only unique conditions from within the expanded set of conditions are run.
- Args:
- configuration (dict | str | Path | FlorisModel | ParFlorisModel): The configuration
for the wind farm. This can be a dictionary, a path to a yaml file, or a FlorisModel or ParFlorisModel object. If dict, str or Path, a new FlorisModel object is created. If a FlorisModel or ParFlorisModel object a copy of the object is made.
- wd_resolution (float, optional): The resolution of wind direction for generating
gaussian blends, in degrees. Defaults to 1.0.
ws_resolution (float, optional): The resolution of wind speed, in m/s. Defaults to 1.0. ti_resolution (float, optional): The resolution of turbulence intensity.
Defaults to 0.01.
- yaw_resolution (float, optional): The resolution of yaw angle, in degrees.
Defaults to 1.0.
- power_setpoint_resolution (int, optional): The resolution of power setpoints, in kW.
Defaults to 100.
wd_std (float, optional): The standard deviation of wind direction. Defaults to 3.0. wd_sample_points (list[float], optional): The sample points for wind direction.
If not provided, defaults to [-2 * wd_std, -1 * wd_std, 0, wd_std, 2 * wd_std].
- fix_yaw_to_nominal_direction (bool, optional): Fix the yaw angle to the nominal
direction? When False, the yaw misalignment is the same across the sampled wind directions. When True, the turbine orientation is fixed to the nominal wind direction such that the yaw misalignment changes depending on the sampled wind direction. Defaults to False.
verbose (bool, optional): Verbosity flag for printing messages. Defaults to False.
- Parameters:
configuration (dict | str | Path | FlorisModel | ParFlorisModel)
- set(**kwargs)[source]#
Set the wind farm conditions in the UncertainFlorisModel.
See FlorisModel.set() for details of the contents of kwargs.
- Args:
**kwargs: The wind farm conditions to set.
- get_turbine_powers()[source]#
- Calculate the power at each turbine in the wind farm. If WindRose or
WindTIRose is passed in, result is reshaped to match
- Returns:
NDArrayFloat: An array containing the powers at each turbine for each findex.
- 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.
- 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)
- 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 unique wind conditions.
- Returns:
int: Number of unique wind conditions.
- property n_turbines#
Number of turbines in the wind farm.
- Returns:
int: Number of turbines in the wind farm.
- property core#
Returns the core of the unexpanded model.
- Returns:
Floris: The core of the unexpanded model.
- floris.uncertain_floris_model.map_turbine_powers_uncertain(unique_turbine_powers, map_to_expanded_inputs, weights, n_unexpanded, n_sample_points, n_turbines)[source]#
Calculates the power at each turbine in the wind farm based on uncertainty weights.
This function calculates the power at each turbine in the wind farm, considering the underlying turbine powers and applying a weighted sum to handle uncertainty.
- Args:
- unique_turbine_powers (NDArrayFloat): An array of unique turbine powers from the
underlying FlorisModel
- map_to_expanded_inputs (NDArrayFloat): An array of indices mapping the unique powers to
the expanded powers
weights (NDArrayFloat): An array of weights for each wind direction sample point n_unexpanded (int): The number of unexpanded conditions n_sample_points (int): The number of wind direction sample points n_turbines (int): The number of turbines in the wind farm
- Returns:
NDArrayFloat: An array containing the powers at each turbine for each findex.
- class floris.uncertain_floris_model.ApproxFlorisModel(configuration, wd_resolution=1.0, ws_resolution=1.0, ti_resolution=0.01, yaw_resolution=1.0, power_setpoint_resolution=100, awc_amplitude_resolution=0.1, verbose=False)[source]#
The ApproxFlorisModel overloads the UncertainFlorisModel with the special case that the wd_sample_points = [0]. This is a special case where no uncertainty is added but the resolution of the values wind direction, wind speed etc are still reduced by the specified resolution. This allows for cases to be reused and a faster approximate result computed
- Parameters:
configuration (dict | str | Path)