floris.wind_data#
Classes
|
The TimeSeries class is used to drive FLORIS and optimization operations in which the inflow is by a sequence of wind direction, wind speed and turbulence intensity values. |
Super class that WindRose and TimeSeries inherit from, enforcing the implementation of unpack() on the child classes and providing the general functions unpack_for_reinitialize() and unpack_freq(). |
|
|
The WindRose class is used to drive FLORIS and optimization operations in which the inflow is characterized by the frequency of binned wind speed and wind direction values. |
|
The WindRoseWRG class is a WindData object the represents a wind resource grid (WRG) file to FLORIS. |
|
WindTIRose is similar to the WindRose class, but contains turbulence intensity as an additional wind rose dimension instead of being defined as a function of wind direction and wind speed. |
- class floris.wind_data.WindDataBase[source]#
Super class that WindRose and TimeSeries inherit from, enforcing the implementation of unpack() on the child classes and providing the general functions unpack_for_reinitialize() and unpack_freq().
- abstract unpack()[source]#
Placeholder for child classes of WindDataBase, which each need to implement the unpack() method.
- check_heterogeneous_inflow_config(heterogeneous_inflow_config)[source]#
Check that the heterogeneous_inflow_config dictionary is properly formatted
- Args:
- heterogeneous_inflow_config (dict): A dictionary containing the following keys:
- 'speed_multipliers': A 2D NumPy array (size n_findex x num_points)
of speed multipliers.
'x': A 1D NumPy array (size num_points) of x-coordinates (meters).
'y': A 1D NumPy array (size num_points) of y-coordinates (meters).
- set_layout(layout_x=None, layout_y=None)[source]#
Default implementation the explicitly does nothing. Only WindData objects that depend on layout need to implement this method.
Included so that FlorisModel can call this method on the WindData object when the layout is updated.
- Args:
layout_x (list, optional): List of x-coordinates of the turbines. Defaults to None. layout_y (list, optional): List of y-coordinates of the turbines. Defaults to None.
- class floris.wind_data.WindRose(wind_directions, wind_speeds, ti_table, freq_table=None, value_table=None, compute_zero_freq_occurrence=False, heterogeneous_map=None, heterogeneous_inflow_config_by_wd=None)[source]#
The WindRose class is used to drive FLORIS and optimization operations in which the inflow is characterized by the frequency of binned wind speed and wind direction values. Turbulence intensities are defined as a function of wind direction and wind speed.
- Args:
- wind_directions: NumPy array of wind directions (NDArrayFloat). Must
be evenly spaced and monotonically increasing.
- wind_speeds: NumPy array of wind speeds (NDArrayFloat). Must be
evenly spaced and monotonically increasing.
- ti_table: Turbulence intensity table for binned wind direction, wind
speed values (float, NDArrayFloat). Can be an array with dimensions (n_wind_directions, n_wind_speeds) or a single float value. If a single float value is provided, the turbulence intensity is assumed to be constant across all wind directions and wind speeds.
- freq_table: Frequency table for binned wind direction, wind speed
values (NDArrayFloat, optional). Must have dimension (n_wind_directions, n_wind_speeds). Defaults to None in which case uniform frequency of all bins is assumed.
- value_table: Value table for binned wind direction, wind
speed values (NDArrayFloat, optional). Must have dimension (n_wind_directions, n_wind_speeds). Defaults to None in which case uniform values are assumed. Value can be used to weight power in each bin to compute the total value of the energy produced
- compute_zero_freq_occurrence: Flag indicating whether to compute zero
frequency occurrences (bool, optional). Defaults to False.
- heterogeneous_map (HeterogeneousMap, optional): A HeterogeneousMap object to define
background heterogeneous inflow condition as a function of wind direction and wind speed. Alternatively, a dictionary can be passed in to define a HeterogeneousMap object. Defaults to None.
- heterogeneous_inflow_config_by_wd (dict, optional): A dictionary containing the following
which can be used to define a heterogeneous_map object (note this parameter is kept for backwards compatibility and is not recommended for use): * 'x': A 1D NumPy array (size num_points) of x-coordinates (meters). * 'y': A 1D NumPy array (size num_points) of y-coordinates (meters). * 'speed_multipliers': A 2D NumPy array (size num_wd (or num_ws) x num_points)
of speed multipliers. If neither wind_directions nor wind_speeds are defined, then this should be a single row array
- 'wind_directions': A 1D NumPy array (size num_wd) of wind directions (degrees).
Optional.
'wind_speeds': A 1D NumPy array (size num_ws) of wind speeds (m/s). Optional.
Defaults to None.
- Parameters:
wind_directions (NDArrayFloat)
wind_speeds (NDArrayFloat)
ti_table (float | NDArrayFloat)
freq_table (NDArrayFloat | None)
value_table (NDArrayFloat | None)
compute_zero_freq_occurrence (bool)
heterogeneous_map (HeterogeneousMap | dict | None)
heterogeneous_inflow_config_by_wd (dict | None)
- unpack()[source]#
Unpack the flattened versions of the matrices and return the values accounting for the non_zero_freq_mask
- aggregate(wd_step=None, ws_step=None, inplace=False)[source]#
Wrapper for downsample method for backwards compatibility
- downsample(wd_step=None, ws_step=None, inplace=False)[source]#
Aggregates the wind rose into fewer wind direction and wind speed bins. It is necessary the wd_step and ws_step passed in are at least as large as the current wind direction and wind speed steps. If they are not, the function will raise an error.
The function will return a new WindRose object with the aggregated wind direction and wind speed bins. If inplace is set to True, the current WindRose object will be updated with the aggregated bins.
- Args:
- wd_step: Step size for wind direction resampling (float, optional).
If None, the current step size will be used. Defaults to None.
- ws_step: Step size for wind speed resampling (float, optional). If
None, the current step size will be used. Defaults to None.
- inplace: Flag indicating whether to update the current WindRose
object when True or return a new WindRose object when False (bool, optional). Defaults to False.
- Returns:
- WindRose: Aggregated wind rose based on the provided or default step
sizes. Only returned if inplace = False.
- Notes:
Returns a aggregated version of the wind rose using new ws_step and wd_step.
Uses the bin weights feature in TimeSeries to aggregated the wind rose.
If ws_step or wd_step is not specified, it uses the current values.
- resample_by_interpolation(wd_step=None, ws_step=None, method='linear', inplace=False)[source]#
Wrapper to upsample method for backwards compatibility
- upsample(wd_step=None, ws_step=None, method='linear', inplace=False)[source]#
Resample the wind rose using interpolation for upsampling. The method can be either 'linear' or 'nearest'. If inplace is set to True, the current WindRose object will be updated with the resampled bins.
- Args:
- wd_step: Step size for wind direction resampling (float, optional).
If None, the current step size will be used. Defaults to None.
- ws_step: Step size for wind speed resampling (float, optional).
If None, the current step size will be used. Defaults to None.
- method: Interpolation method to use (str, optional). Can be either
'linear' or 'nearest'. Defaults to "linear".
- inplace: Flag indicating whether to update the current WindRose
object when True or return a new WindRose object when False (bool, optional). Defaults to False.
- Returns:
- WindRose: Resampled wind rose based on the provided or default step
sizes. Only returned if inplace = False.
- plot(ax=None, color_map='viridis_r', wd_step=None, ws_step=None, legend_kwargs={'label': 'Wind speed [m/s]'})[source]#
This method creates a wind rose plot showing the frequency of occurrence of the specified wind direction and wind speed bins. If no axis is provided, a new one is created.
Note: Based on code provided by Patrick Murphy from the University of Colorado Boulder.
- Args:
- ax (
matplotlib.pyplot.axes
, optional): The figure axes on which the wind rose is plotted. Defaults to None.
color_map (str, optional): Colormap to use. Defaults to 'viridis_r'. wd_step: Step size for wind direction (float, optional). If None,
the current step size will be used. Defaults to None.
- ws_step: Step size for wind speed (float, optional).
the current step size will be used. Defaults to None.
- legend_kwargs (dict, optional): Keyword arguments to be passed to
ax.legend(). Defaults to {"label": "Wind speed [m/s]"}.
- ax (
- Returns:
matplotlib.pyplot.axes
: A figure axes object containing the plotted wind rose.
- assign_ti_using_wd_ws_function(func)[source]#
Use the passed in function to assign new values to turbulence_intensities
- Args:
- func (function): Function which accepts wind_directions as its
first argument and wind_speeds as second argument and returns turbulence_intensities
- assign_ti_using_IEC_method(Iref=0.07, offset=3.8)[source]#
Define TI as a function of wind speed by specifying an Iref and offset value as in the normal turbulence model in the IEC 61400-1 standard
- Args:
- Iref (float): Reference turbulence level, defined as the expected
value of TI at 15 m/s. Default = 0.07. Note this value is lower than the values of Iref for turbulence classes A, B, and C in the IEC standard (0.16, 0.14, and 0.12, respectively), but produces TI values more in line with those typically used in FLORIS. When the default Iref and offset are used, the TI at 8 m/s is 8.6%.
- offset (float): Offset value to equation. Default = 3.8, as defined
in the IEC standard to give the expected value of TI for each wind speed.
- plot_ti_over_ws(ax=None, marker='.', ls='None', color='k')[source]#
Scatter plot the turbulence_intensities against wind_speeds
- Args:
- ax (
matplotlib.pyplot.axes
, optional): The figure axes on which the turbulence intensity is plotted. Defaults to None.
marker (str, optional): Scatter plot marker style. Defaults to ".". ls (str, optional): Scatter plot line style. Defaults to "None". color (str, optional): Scatter plot color. Defaults to "k".
- ax (
- Returns:
matplotlib.pyplot.axes
: A figure axes object containing the plotted turbulence intensities as a function of wind speed.
- assign_value_using_wd_ws_function(func, normalize=False)[source]#
Use the passed in function to assign new values to the value table.
- Args:
- func (function): Function which accepts wind_directions as its
first argument and wind_speeds as second argument and returns values.
- normalize (bool, optional): If True, the value array will be
normalized by the mean value. Defaults to False.
- assign_value_piecewise_linear(value_zero_ws=1.425, ws_knee=4.5, slope_1=0.0, slope_2=-0.135, limit_to_zero=False, normalize=False)[source]#
Define value as a continuous piecewise linear function of wind speed with two line segments. The default parameters yield a value function that approximates the normalized mean electricity price vs. wind speed curve for the SPP market in the U.S. for years 2018-2020 from figure 7 in Simley et al. "The value of wake steering wind farm flow control in US energy markets," Wind Energy Science, 2024. https://doi.org/10.5194/wes-9-219-2024. This default value function is constant at low wind speeds, then linearly decreases above 4.5 m/s.
- Args:
- value_zero_ws (float, optional): The value when wind speed is zero.
Defaults to 1.425.
- ws_knee (float, optional): The wind speed separating line segments
1 and 2. Default = 4.5 m/s.
- slope_1 (float, optional): The slope of the first line segment
(unit of value per m/s). Defaults to zero.
slope_2 (float, optional): The slope of the second line segment (unit of value per m/s). Defaults to -0.135. limit_to_zero (bool, optional): If True, negative values will be
set to zero. Defaults to False.
- normalize (bool, optional): If True, the value array will be
normalized by the mean value. Defaults to False.
- plot_value_over_ws(ax=None, marker='.', ls='None', color='k')[source]#
Scatter plot the value of the energy generated against wind speed.
- Args:
- ax (
matplotlib.pyplot.axes
, optional): The figure axes on which the value is plotted. Defaults to None.
marker (str, optional): Scatter plot marker style. Defaults to ".". ls (str, optional): Scatter plot line style. Defaults to "None". color (str, optional): Scatter plot color. Defaults to "k".
- ax (
- Returns:
matplotlib.pyplot.axes
: A figure axes object containing the plotted value as a function of wind speed.
- static read_csv_long(file_path, ws_col='wind_speeds', wd_col='wind_directions', ti_col_or_value='turbulence_intensities', freq_col=None, sep=',')[source]#
Read a long-formatted CSV file into the wind rose object. By long, what is meant is that the wind speed, wind direction combination is given for each row in the CSV file. The wind speed, wind direction, are given in separate columns, and the frequency of occurrence of each combination is given in a separate column. The frequency column is optional, and if not provided, uniform frequency of all bins is assumed.
The value of ti_col_or_value can be either a string or a float. If it is a string, it is assumed to be the name of the column in the CSV file that contains the turbulence intensity values. If it is a float, it is assumed to be a constant turbulence intensity value for all wind speed and direction combinations.
- Return type:
- Parameters:
file_path (str)
ws_col (str)
wd_col (str)
ti_col_or_value (str | float)
freq_col (str | None)
sep (str)
- Args:
file_path (str): Path to the CSV file. ws_col (str): Name of the column in the CSV file that contains the wind speed
values. Defaults to 'wind_speeds'.
- wd_col (str): Name of the column in the CSV file that contains the wind direction
values. Defaults to 'wind_directions'.
- ti_col_or_value (str or float): Name of the column in the CSV file that contains
the turbulence intensity values, or a constant turbulence intensity value.
- freq_col (str): Name of the column in the CSV file that contains the frequency
values. Defaults to None in which case constant frequency assumed.
sep (str): Delimiter to use. Defaults to ','.
- Returns:
WindRose: Wind rose object created from the CSV file.
- class floris.wind_data.WindTIRose(wind_directions, wind_speeds, turbulence_intensities, freq_table=None, value_table=None, compute_zero_freq_occurrence=False, heterogeneous_map=None, heterogeneous_inflow_config_by_wd=None)[source]#
WindTIRose is similar to the WindRose class, but contains turbulence intensity as an additional wind rose dimension instead of being defined as a function of wind direction and wind speed. The class is used to drive FLORIS and optimization operations in which the inflow is characterized by the frequency of binned wind speed, wind direction, and turbulence intensity values.
- Args:
wind_directions: NumPy array of wind directions (NDArrayFloat). wind_speeds: NumPy array of wind speeds (NDArrayFloat). turbulence_intensities: NumPy array of turbulence intensities (NDArrayFloat). freq_table: Frequency table for binned wind direction, wind speed, and
turbulence intensity values (NDArrayFloat, optional). Must have dimension (n_wind_directions, n_wind_speeds, n_turbulence_intensities). Defaults to None in which case uniform frequency of all bins is assumed.
- value_table: Value table for binned wind direction, wind
speed, and turbulence intensity values (NDArrayFloat, optional). Must have dimension (n_wind_directions, n_wind_speeds, n_turbulence_intensities). Defaults to None in which case uniform values are assumed. Value can be used to weight power in each bin to compute the total value of the energy produced.
- compute_zero_freq_occurrence: Flag indicating whether to compute zero
frequency occurrences (bool, optional). Defaults to False.
- heterogeneous_map (HeterogeneousMap, optional): A HeterogeneousMap object to define
background heterogeneous inflow condition as a function of wind direction and wind speed. Alternatively, a dictionary can be passed in to define a HeterogeneousMap object. Defaults to None.
- heterogeneous_inflow_config_by_wd (dict, optional): A dictionary containing the following
which can be used to define a heterogeneous_map object (note this parameter is kept for backwards compatibility and is not recommended for use): * 'x': A 1D NumPy array (size num_points) of x-coordinates (meters). * 'y': A 1D NumPy array (size num_points) of y-coordinates (meters). * 'speed_multipliers': A 2D NumPy array (size num_wd (or num_ws) x num_points)
of speed multipliers. If neither wind_directions nor wind_speeds are defined, then this should be a single row array
- 'wind_directions': A 1D NumPy array (size num_wd) of wind directions (degrees).
Optional.
'wind_speeds': A 1D NumPy array (size num_ws) of wind speeds (m/s). Optional.
Defaults to None.
- Parameters:
wind_directions (NDArrayFloat)
wind_speeds (NDArrayFloat)
turbulence_intensities (NDArrayFloat)
freq_table (NDArrayFloat | None)
value_table (NDArrayFloat | None)
compute_zero_freq_occurrence (bool)
heterogeneous_map (HeterogeneousMap | dict | None)
heterogeneous_inflow_config_by_wd (dict | None)
- unpack()[source]#
Unpack the flattened versions of the matrices and return the values accounting for the non_zero_freq_mask
- aggregate(wd_step=None, ws_step=None, ti_step=None, inplace=False)[source]#
Wrapper for downsample method for backwards compatibility
- downsample(wd_step=None, ws_step=None, ti_step=None, inplace=False)[source]#
Aggregates the wind TI rose into fewer wind direction, wind speed and TI bins. It is necessary the wd_step and ws_step ti_step passed in are at least as large as the current wind direction and wind speed steps. If they are not, the function will raise an error.
The function will return a new WindTIRose object with the aggregated wind direction, wind speed and TI bins. If inplace is set to True, the current WindTIRose object will be updated with the aggregated bins.
- Args:
wd_step: Step size for wind direction resampling (float, optional). ws_step: Step size for wind speed resampling (float, optional). ti_step: Step size for turbulence intensity resampling (float, optional). inplace: Flag indicating whether to update the current WindTIRose.
Defaults to False.
- Returns:
WindTIRose: Aggregated wind TI rose based on the provided or default step sizes.
- Notes:
- Returns an aggregated version of the wind TI rose using new ws_step,
wd_step, and ti_step.
Uses the bin weights feature in TimeSeries to aggregate the wind rose.
- If ws_step, wd_step, or ti_step are not specified, it uses
the current values.
- resample_by_interpolation(wd_step=None, ws_step=None, method='linear', inplace=False)[source]#
Wrapper to upsample method for backwards compatibility
- upsample(wd_step=None, ws_step=None, ti_step=None, method='linear', inplace=False)[source]#
Resample the wind TI rose using interpolation. The method can be either 'linear' or 'nearest'. If inplace is set to True, the current WindTIRose object will be updated with the resampled bins.
- Args:
- wd_step: Step size for wind direction resampling (float, optional).
If None, the current step size will be used. Defaults to None.
- ws_step: Step size for wind speed resampling (float, optional).
If None, the current step size will be used. Defaults to None.
- ti_step: Step size for turbulence intensity resampling (float, optional).
If None, the current step size will be used. Defaults to None.
- method: Interpolation method to use (str, optional). Can be either
'linear' or 'nearest'. Defaults to "linear".
- inplace: Flag indicating whether to update the current WindRose
object when True or return a new WindRose object when False (bool, optional). Defaults to False.
- Returns:
- WindRose: Resampled wind rose based on the provided or default step
sizes. Only returned if inplace = False.
- plot(ax=None, wind_rose_var='ws', color_map='viridis_r', wd_step=15.0, wind_rose_var_step=None, legend_kwargs={'label': 'Wind speed [m/s]'})[source]#
This method creates a wind rose plot showing the frequency of occurrence of either the specified wind direction and wind speed bins or wind direction and turbulence intensity bins. If no axis is provided, a new one is created.
Note: Based on code provided by Patrick Murphy from the University of Colorado Boulder.
- Args:
- ax (
matplotlib.pyplot.axes
, optional): The figure axes on which the wind rose is plotted. Defaults to None.
- wind_rose_var (str, optional): The variable to display in the wind
rose plot in addition to wind direction. If wind_rose_var = "ws", wind speed frequencies will be plotted. If wind_rose_var = "ti", turbulence intensity frequencies will be plotted. Defaults to "ws".
color_map (str, optional): Colormap to use. Defaults to 'viridis_r'. wd_step (float, optional): Step size for wind direction. Defaults
to 15 degrees.
- wind_rose_var_step (float, optional): Step size for other wind rose
variable. Defaults to None. If unspecified, a value of 5 m/s will be used if wind_rose_var = "ws", and a value of 4% will be used if wind_rose_var = "ti".
- legend_kwargs (dict, optional): Keyword arguments to be passed to
ax.legend(). Defaults to {"label": "Wind speed [m/s]"}.
- ax (
- Returns:
matplotlib.pyplot.axes
: A figure axes object containing the plotted wind rose.
- plot_ti_over_ws(ax=None, marker='.', ls='-', color='k')[source]#
Plot the mean turbulence intensity against wind speed.
- Args:
- ax (
matplotlib.pyplot.axes
, optional): The figure axes on which the mean turbulence intensity is plotted. Defaults to None.
marker (str, optional): Scatter plot marker style. Defaults to ".". ls (str, optional): Scatter plot line style. Defaults to "None". color (str, optional): Scatter plot color. Defaults to "k".
- ax (
- Returns:
matplotlib.pyplot.axes
: A figure axes object containing the plotted mean turbulence intensities as a function of wind speed.
- assign_value_using_wd_ws_ti_function(func, normalize=False)[source]#
Use the passed in function to assign new values to the value table.
- Args:
- func (function): Function which accepts wind_directions as its
first argument, wind_speeds as its second argument, and turbulence_intensities as its third argument and returns values.
- normalize (bool, optional): If True, the value array will be
normalized by the mean value. Defaults to False.
- assign_value_piecewise_linear(value_zero_ws=1.425, ws_knee=4.5, slope_1=0.0, slope_2=-0.135, limit_to_zero=False, normalize=False)[source]#
Define value as a continuous piecewise linear function of wind speed with two line segments. The default parameters yield a value function that approximates the normalized mean electricity price vs. wind speed curve for the SPP market in the U.S. for years 2018-2020 from figure 7 in Simley et al. "The value of wake steering wind farm flow control in US energy markets," Wind Energy Science, 2024. https://doi.org/10.5194/wes-9-219-2024. This default value function is constant at low wind speeds, then linearly decreases above 4.5 m/s.
- Args:
- value_zero_ws (float, optional): The value when wind speed is zero.
Defaults to 1.425.
- ws_knee (float, optional): The wind speed separating line segments
1 and 2. Default = 4.5 m/s.
- slope_1 (float, optional): The slope of the first line segment
(unit of value per m/s). Defaults to zero.
slope_2 (float, optional): The slope of the second line segment (unit of value per m/s). Defaults to -0.135. limit_to_zero (bool, optional): If True, negative values will be
set to zero. Defaults to False.
- normalize (bool, optional): If True, the value array will be
normalized by the mean value. Defaults to False.
- plot_value_over_ws(ax=None, marker='.', ls='None', color='k')[source]#
Scatter plot the value of the energy generated against wind speed.
- Args:
- ax (
matplotlib.pyplot.axes
, optional): The figure axes on which the value is plotted. Defaults to None.
marker (str, optional): Scatter plot marker style. Defaults to ".". ls (str, optional): Scatter plot line style. Defaults to "None". color (str, optional): Scatter plot color. Defaults to "k".
- ax (
- Returns:
matplotlib.pyplot.axes
: A figure axes object containing the plotted value as a function of wind speed.
- static read_csv_long(file_path, ws_col='wind_speeds', wd_col='wind_directions', ti_col='turbulence_intensities', freq_col=None, sep=',')[source]#
Read a long-formatted CSV file into the WindTIRose object. By long, what is meant is that the wind speed, wind direction and turbulence intensities combination is given for each row in the CSV file. The wind speed, wind direction, and turbulence intensity are given in separate columns, and the frequency of occurrence of each combination is given in a separate column. The frequency column is optional, and if not provided, uniform frequency of all bins is assumed.
- Return type:
- Parameters:
file_path (str)
ws_col (str)
wd_col (str)
ti_col (str)
freq_col (str | None)
sep (str)
- Args:
file_path (str): Path to the CSV file. ws_col (str): Name of the column in the CSV file that contains the wind speed
values. Defaults to 'wind_speeds'.
- wd_col (str): Name of the column in the CSV file that contains the wind direction
values. Defaults to 'wind_directions'.
- ti_col (str): Name of the column in the CSV file that contains
the turbulence intensity values.
- freq_col (str): Name of the column in the CSV file that contains the frequency
values. Defaults to None in which case constant frequency assumed.
sep (str): Delimiter to use. Defaults to ','.
- Returns:
WindRose: Wind rose object created from the CSV file.
- class floris.wind_data.TimeSeries(wind_directions, wind_speeds, turbulence_intensities, values=None, heterogeneous_map=None, heterogeneous_inflow_config_by_wd=None, heterogeneous_inflow_config=None)[source]#
The TimeSeries class is used to drive FLORIS and optimization operations in which the inflow is by a sequence of wind direction, wind speed and turbulence intensity values. Each input of wind direction, wind speed, and turbulence intensity can be assigned as an array of values or a single value. At least one of wind_directions, wind_speeds, or turbulence_intensities must be an array. If arrays are provided, they must be the same length as the other arrays or the single values. If single values are provided, then an array of the same length as the other arrays will be created with the single value.
- Args:
- wind_directions (float, NDArrayFloat): Wind direction. Can be a single
value or an array of values.
- wind_speeds (float, NDArrayFloat): Wind speed. Can be a single value or
an array of values.
- turbulence_intensities (float, NDArrayFloat): Turbulence intensity. Can be
a single value or an array of values.
- values (NDArrayFloat, optional): Values associated with each wind
direction, wind speed, and turbulence intensity. Defaults to None.
- heterogeneous_map (HeterogeneousMap, optional): A HeterogeneousMap object to define
background heterogeneous inflow condition as a function of wind direction and wind speed. Alternatively, a dictionary can be passed in to define a HeterogeneousMap object. Defaults to None.
- heterogeneous_inflow_config_by_wd (dict, optional): A dictionary containing the following
which can be used to define a heterogeneous_map object (note this parameter is kept for backwards compatibility and is not recommended for use): * 'x': A 1D NumPy array (size num_points) of x-coordinates (meters). * 'y': A 1D NumPy array (size num_points) of y-coordinates (meters). * 'speed_multipliers': A 2D NumPy array (size num_wd (or num_ws) x num_points)
of speed multipliers. If neither wind_directions nor wind_speeds are defined, then this should be a single row array
- 'wind_directions': A 1D NumPy array (size num_wd) of wind directions (degrees).
Optional.
'wind_speeds': A 1D NumPy array (size num_ws) of wind speeds (m/s). Optional.
Defaults to None.
- heterogeneous_inflow_config (dict, optional): A dictionary containing the following keys.
Defaults to None. * 'speed_multipliers': A 2D NumPy array (size n_findex x num_points)
of speed multipliers.
'x': A 1D NumPy array (size num_points) of x-coordinates (meters).
'y': A 1D NumPy array (size num_points) of y-coordinates (meters).
- Parameters:
wind_directions (float | NDArrayFloat)
wind_speeds (float | NDArrayFloat)
turbulence_intensities (float | NDArrayFloat)
values (NDArrayFloat | None)
heterogeneous_map (HeterogeneousMap | dict | None)
heterogeneous_inflow_config_by_wd (dict | None)
heterogeneous_inflow_config (dict | None)
- assign_ti_using_wd_ws_function(func)[source]#
Use the passed in function to new assign values to turbulence_intensities
- Args:
- func (function): Function which accepts wind_directions as its
first argument and wind_speeds as second argument and returns turbulence_intensities
- assign_ti_using_IEC_method(Iref=0.07, offset=3.8)[source]#
Define TI as a function of wind speed by specifying an Iref and offset value as in the normal turbulence model in the IEC 61400-1 standard
- Args:
- Iref (float): Reference turbulence level, defined as the expected
value of TI at 15 m/s. Default = 0.07. Note this value is lower than the values of Iref for turbulence classes A, B, and C in the IEC standard (0.16, 0.14, and 0.12, respectively), but produces TI values more in line with those typically used in FLORIS. When the default Iref and offset are used, the TI at 8 m/s is 8.6%.
- offset (float): Offset value to equation. Default = 3.8, as defined
in the IEC standard to give the expected value of TI for each wind speed.
- assign_value_using_wd_ws_function(func, normalize=False)[source]#
Use the passed in function to assign new values to the value table.
- Args:
- func (function): Function which accepts wind_directions as its
first argument and wind_speeds as second argument and returns values.
- normalize (bool, optional): If True, the value array will be
normalized by the mean value. Defaults to False.
- assign_value_piecewise_linear(value_zero_ws=1.425, ws_knee=4.5, slope_1=0.0, slope_2=-0.135, limit_to_zero=False, normalize=False)[source]#
Define value as a continuous piecewise linear function of wind speed with two line segments. The default parameters yield a value function that approximates the normalized mean electricity price vs. wind speed curve for the SPP market in the U.S. for years 2018-2020 from figure 7 in Simley et al. "The value of wake steering wind farm flow control in US energy markets," Wind Energy Science, 2024. https://doi.org/10.5194/wes-9-219-2024. This default value function is constant at low wind speeds, then linearly decreases above 4.5 m/s.
- Args:
- value_zero_ws (float, optional): The value when wind speed is zero.
Defaults to 1.425.
- ws_knee (float, optional): The wind speed separating line segments
1 and 2. Default = 4.5 m/s.
- slope_1 (float, optional): The slope of the first line segment
(unit of value per m/s). Defaults to zero.
slope_2 (float, optional): The slope of the second line segment (unit of value per m/s). Defaults to -0.135. limit_to_zero (bool, optional): If True, negative values will be
set to zero. Defaults to False.
- normalize (bool, optional): If True, the value array will be
normalized by the mean value. Defaults to False.
- to_WindRose(wd_step=2.0, ws_step=1.0, wd_edges=None, ws_edges=None, bin_weights=None)[source]#
Converts the TimeSeries data to a WindRose.
- Args:
wd_step (float, optional): Step size for wind direction (default is 2.0). ws_step (float, optional): Step size for wind speed (default is 1.0). wd_edges (NDArrayFloat, optional): Custom wind direction edges. Defaults to None. ws_edges (NDArrayFloat, optional): Custom wind speed edges. Defaults to None. bin_weights (NDArrayFloat, optional): Bin weights for resampling. Note these
are primarily used by the downsample() method. Defaults to None.
- Returns:
WindRose: A WindRose object based on the TimeSeries data.
- Notes:
If wd_edges is defined, it uses it to produce the bin centers.
If wd_edges is not defined, it determines wd_edges from the step and data.
If ws_edges is defined, it uses it for wind speed edges.
If ws_edges is not defined, it determines ws_edges from the step and data.
- to_WindTIRose(wd_step=2.0, ws_step=1.0, ti_step=0.02, wd_edges=None, ws_edges=None, ti_edges=None, bin_weights=None)[source]#
Converts the TimeSeries data to a WindTIRose.
- Args:
wd_step (float, optional): Step size for wind direction (default is 2.0). ws_step (float, optional): Step size for wind speed (default is 1.0). ti_step (float, optional): Step size for turbulence intensity (default is 0.02). wd_edges (NDArrayFloat, optional): Custom wind direction edges. Defaults to None. ws_edges (NDArrayFloat, optional): Custom wind speed edges. Defaults to None. ti_edges (NDArrayFloat, optional): Custom turbulence intensity
edges. Defaults to None.
- bin_weights (NDArrayFloat, optional): Bin weights for resampling. Note these
are primarily used by the downsample() method. Defaults to None.
- Returns:
WindRose: A WindTIRose object based on the TimeSeries data.
- Notes:
If wd_edges is defined, it uses it to produce the wind direction bin edges.
If wd_edges is not defined, it determines wd_edges from the step and data.
If ws_edges is defined, it uses it for wind speed edges.
If ws_edges is not defined, it determines ws_edges from the step and data.
If ti_edges is defined, it uses it for turbulence intensity edges.
If ti_edges is not defined, it determines ti_edges from the step and data.
- class floris.wind_data.WindRoseWRG(filename, wd_step=None, wind_speeds=array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25.]), ti_table=0.06)[source]#
The WindRoseWRG class is a WindData object the represents a wind resource grid (WRG) file to FLORIS. As a WindData object it can be passed to the FlorisModel.set method. A WRG file represents a wind resource as a grid of points where each point has a separate wind rose define by the frequency of each wind direction and the Weibull parameters for each wind direction.
WindRoseWRG objects are provided the layout of a wind farm and computes a wind rose at each point in the layout. The wind rose at each point is computed by interpolating the weibull parameter in the WRG file to the point in the layout and using them to compute a WindRose object. Each WindRose object shares wind direction and wind speed, only the frequencies differ.
When running a FlorisModel with a WindRoseWRG object, most behaviors are the same except functions which compute an expected value, use separate frequencies for each turbine to weight the individual power bins.
- Args:
filename (str): The name of the WRG file to read. wd_step (float, optional): Step size to use resampling the wind directions given by the WRG
file. If None, wd_step and wind_directions are set by the number of sectors in the WRG file. Defaults to None.
- wind_speeds (NDArrayFloat, optional): Wind speeds to use in the wind rose. Defaults to
np.arange(0.0, 26.0, 1.0).
- ti_table (float, optional): Turbulence intensities table to use for each WindRose object.
As in the WindRose ti_table, this can be a single value or an array of values. If an array of values is provided, it must be (len(wind_directions) x len(wind_speeds)). Defaults to 0.06.
- read_wrg_file(filename)[source]#
Read the contents of a WRG file and store the data in the object.
- Args:
filename (str): The name of the WRG file to read.
- get_wind_rose_at_point(x, y, wind_directions=None, wind_speeds=None, ti_table=0.06)[source]#
Get the wind rose at a given x, y location. Interpolate the parameters to the point and then generate the wind rose.
- Args:
x (float): The x location to interpolate. y (float): The y location to interpolate. wind_directions (np.array): The wind directions to calculate the frequencies for.
If None, use self.wind_directions. Default is None.
- wind_speeds (np.array): The wind speeds to calculate the frequencies for.
If None, use self.wind_speeds. Default is None.
- ti_table (float): The ti_table to use in the wind rose.
Default is 0.06.
- set_wd_step(wd_step)[source]#
Set the wind directions for the WindRoseWRG object.
- Args:
wind_directions (np.array): The wind directions to use for the wind roses.
- set_wind_speeds(wind_speeds)[source]#
Set the wind speeds for the WindRoseWRG object.
- Args:
wind_speeds (np.array): The wind speeds to use for the wind roses.
- set_ti_table(ti_table)[source]#
Set the fixed turbulence intensity value for the WindRoseWRG object.
- Args:
ti_table (float): The ti_table value to use in the wind roses.
- set_layout(layout_x, layout_y)[source]#
Set the layout for the WindRoseWRG object.
- Args:
layout_x (np.array): The x coordinates of the layout. layout_y (np.array): The y coordinates of the layout.
- unpack()[source]#
Implement the unpack method for WindRoseByTurbine by calling the unpack method for each of the WindRose objects in wind_roses. Mose of the variables can be passed as is but freq_table_unpack are combined and stacked along the 1th axis
- Returns:
Tuple: Tuple containing the unpacked wind rose data.
- plot_wind_roses(axarr=None, wd_step=None, ws_step=None)[source]#
Plot the wind roses for each turbine in the WindRoseByTurbine object.
- Args:
- axarr (NDArrayAxes, optional): Array of axes to plot the wind roses on.
Defaults to None. Must have length equal to the number of wind roses.
wd_step (float, optional): Step size for wind direction. Defaults to None. ws_step (float, optional): Step size for wind speed. Defaults to None.
- get_heterogeneous_wind_rose(fmodel, wind_speeds=None, x_loc=None, y_loc=None, representative_wind_speed=8.0)[source]#
Get the heterogeneous map at each location in the grid, with the speeds ups defined relative the location indicated by gid_norm_index.
- Args:
fmodel (FlorisModel): The FlorisModel object to use to generate the power curve. wind_speeds (np.array): The wind speeds to calculate the frequencies for.
Default is np.arange(0.0, 25.0, 1.0).
- gid_norm_index (int): The index of the turbine to normalize the speed ups to.
Default is 0.
- representative_wind_speed (float): The representative wind speed to use
in the power curve.
- Returns:
HeterogeneousMap: The heterogeneous map object.