flasc.analysis.expected_power_analysis#
Analyze SCADA data using expected power methods.
Functions
Calculate the total uplift in energy production using expected power methods. |
|
Perform a sweep over the ws_min parameter. |
- flasc.analysis.expected_power_analysis._total_uplift_expected_power_single(df_: DataFrame, test_cols: List[str], wd_cols: List[str], ws_cols: List[str], uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq_pl: DataFrame | None = None, remove_any_null_turbine_bins: bool = False) Tuple[DataFrame, DataFrame, Dict[str, float]] [source]#
Calculate the total uplift in expected power for a single run.
- Parameters:
df (pl.DataFrame) -- A polars dataframe, exported from a_in.get_df()
test_cols (List[str]) -- A list of column names to include when computing total uplift.
wd_cols (List[str]) -- A list of column names for determining the reference wind direction.
ws_cols (List[str]) -- A list of column names for determining the reference wind speed.
uplift_pairs (List[Tuple[str, str]]) -- A list of tuples containing the df_name values to compare.
uplift_names (List[str]) -- A list of names for the uplift results for each uplift pair.
wd_step (float) -- The step size for the wind direction bins. Defaults to 2.0.
wd_min (float) -- The minimum wind direction value. Defaults to 0.0.
wd_max (float) -- The maximum wind direction value. Defaults to 360.0.
ws_step (float) -- The step size for the wind speed bins. Defaults to 1.0.
ws_min (float) -- The minimum wind speed value. Defaults to 0.0.
ws_max (float) -- The maximum wind speed value. Defaults to 50.0.
bin_cols_in (List[str]) -- A list of column names to bin the dataframes by. Defaults to ["wd_bin", "ws_bin"].
weight_by (str) -- The method used to weight the bins when computing total energy if df_freq is None ("min" or "sum"). If "min", the minimum number of points in a bin over all dataframes is used. If, "sum", the sum of the points over all dataframes is used. Defaults to "min".
df_freq_pl (pl.DataFrame) -- A polars dataframe with the frequency of each bin. Defaults to None.
remove_any_null_turbine_bins (bool) -- If True, when computing farm power, remove any bins where any of the test turbines is null. Defaults to False.
df_ (DataFrame)
- Returns:
- A tuple containing the binned
dataframe, the summed dataframe, and the uplift results.
- Return type:
Tuple[pl.DataFrame, pl.DataFrame, Dict[str, float]]
- flasc.analysis.expected_power_analysis._total_uplift_expected_power_with_bootstrapping(a_in: AnalysisInput, test_cols: List[str], wd_cols: List[str], ws_cols: List[str], uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq_pl: DataFrame | None = None, remove_any_null_turbine_bins: bool = False, N: int = 1, percentiles: List[float] = [2.5, 97.5]) Tuple[DataFrame, DataFrame, Dict[str, Dict[str, float]]] [source]#
Calculate the total uplift in expected power using bootstrapping to quantify uncertainty.
- Parameters:
a_in (AnalysisInput) -- An AnalysisInput object containing the dataframes to analyze.
test_cols (List[str]) -- A list of column names to include when computing total uplift.
wd_cols (List[str]) -- A list of column names for determining the reference wind direction.
ws_cols (List[str]) -- A list of column names for determining the reference wind speed.
uplift_pairs (List[Tuple[str, str]]) -- A list of tuples containing the df_name values to compare.
uplift_names (List[str]) -- A list of names for the uplift results for each uplift pair.
wd_step (float) -- The step size for the wind direction bins. Defaults to 2.0.
wd_min (float) -- The minimum wind direction value. Defaults to 0.0.
wd_max (float) -- The maximum wind direction value. Defaults to 360.0.
ws_step (float) -- The step size for the wind speed bins. Defaults to 1.0.
ws_min (float) -- The minimum wind speed value. Defaults to 0.0.
ws_max (float) -- The maximum wind speed value. Defaults to 50.0.
bin_cols_in (List[str]) -- A list of column names to bin the dataframes by. Defaults to ["wd_bin", "ws_bin"].
weight_by (str) -- The method used to weight the bins when computing total energy if df_freq is None ("min" or "sum"). If "min", the minimum number of points in a bin over all dataframes is used. If, "sum", the sum of the points over all dataframes is used. Defaults to "min".
df_freq_pl (pl.DataFrame) -- A polars dataframe with the frequency of each bin. Defaults to None.
remove_any_null_turbine_bins (bool) -- If True, when computing farm power, remove any bins where any of the test turbines is null. Defaults to False.
N (int) -- The number of bootstrap samples. Defaults to 1.
percentiles (List[float]) -- The lower and upper percentiles for quantifying uncertainty in total uplift. Defaults to [2.5, 97.5].
- Returns:
- A tuple containing the
binned dataframe, the summed dataframe, and the uplift results.
- Return type:
Tuple[pl.DataFrame, pl.DataFrame, Dict[str, Dict[str, float]]]
- flasc.analysis.expected_power_analysis._total_uplift_expected_power_with_standard_error(df_: DataFrame, test_cols: List[str], wd_cols: List[str], ws_cols: List[str], uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq_pl: DataFrame | None = None, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero') Dict[str, Dict[str, float]] [source]#
Calculate total uplift by propagating standard errors.
Calculate the total uplift in expected power with uncertainty quantified by propagating bin-level standard errors.
- Parameters:
df (pl.DataFrame) -- A polars dataframe, exported from a_in.get_df()
test_cols (List[str]) -- A list of column names to include when computing total uplift.
wd_cols (List[str]) -- A list of column names for determining the reference wind direction.
ws_cols (List[str]) -- A list of column names for determining the reference wind speed.
uplift_pairs (List[Tuple[str, str]]) -- A list of tuples containing the df_name values to compare.
uplift_names (List[str]) -- A list of names for the uplift results for each uplift pair.
wd_step (float) -- The step size for the wind direction bins. Defaults to 2.0.
wd_min (float) -- The minimum wind direction value. Defaults to 0.0.
wd_max (float) -- The maximum wind direction value. Defaults to 360.0.
ws_step (float) -- The step size for the wind speed bins. Defaults to 1.0.
ws_min (float) -- The minimum wind speed value. Defaults to 0.0.
ws_max (float) -- The maximum wind speed value. Defaults to 50.0.
bin_cols_in (List[str]) -- A list of column names to bin the dataframes by. Defaults to ["wd_bin", "ws_bin"].
weight_by (str) -- The method used to weight the bins when computing total energy if df_freq is None ("min" or "sum"). If "min", the minimum number of points in a bin over all dataframes is used. If, "sum", the sum of the points over all dataframes is used. Defaults to "min".
df_freq_pl (pl.DataFrame) -- A polars dataframe with the frequency of each bin. Defaults to None.
percentiles (List[float]) -- The lower and upper percentiles for quantifying uncertainty in total uplift. Defaults to [2.5, 97.5].
remove_any_null_turbine_bins (bool) -- If True, when computing farm power, remove any bins where any of the test turbines is null. Defaults to False.
cov_terms (str) -- The approach for determining the power covariance terms betweens pairs of test turbines whe computing uncertainty. Can be "zero", "var" or "cov". If "zero" all covariance terms are set to zero. If "var" all covariance terms are set to the product of the square root of the variances of each individual turbine. If "cov" the computed covariance terms are used as is when enough data are present in a bin, with missing terms set to the product of the square root of the individual turbine variances. Defaults to "zero".
df_ (DataFrame)
- Returns:
A dictionary containing the uplift results with standard error.
- Return type:
Dict[str, Dict[str, float]]
- flasc.analysis.expected_power_analysis.total_uplift_expected_power(a_in: AnalysisInput, uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], test_turbines: List[int], wd_turbines: List[int] | None = None, ws_turbines: List[int] | None = None, use_predefined_wd: bool = False, use_predefined_ws: bool = False, wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq: DataFrame | None = None, use_standard_error: bool = True, N: int = 1, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero') ExpectedPowerAnalysisOutput [source]#
Calculate the total uplift in energy production using expected power methods.
- Parameters:
a_in (AnalysisInput) -- An AnalysisInput object containing the dataframes to analyze.
uplift_pairs (List[Tuple[str, str]]) -- A list of tuples containing the df_name values to compare.
uplift_names (List[str]) -- A list of names for the uplift results for each uplift pair.
test_turbines (List[int]) -- A list of turbine indices to include when computing total uplift.
wd_turbines (List[int]) -- A list of turbine indices for determining the reference wind direction. Defaults to None.
ws_turbines (List[int]) -- A list of turbine indices for determining the reference wind speed. Defaults to None.
use_predefined_wd (bool) -- Use predefined wind direction. Defaults to False.
use_predefined_ws (bool) -- Use predefined wind speed. Defaults to False.
wd_step (float) -- The step size for the wind direction bins. Defaults to 2.0.
wd_min (float) -- The minimum wind direction value. Defaults to 0.0.
wd_max (float) -- The maximum wind direction value. Defaults to 360.0.
ws_step (float) -- The step size for the wind speed bins. Defaults to 1.0.
ws_min (float) -- The minimum wind speed value. Defaults to 0.0.
ws_max (float) -- The maximum wind speed value. Defaults to 50.0.
bin_cols_in (List[str]) -- A list of column names to bin the dataframes by. Defaults to ["wd_bin", "ws_bin"].
weight_by (str) -- The method used to weight the bins when computing total energy if df_freq is None ("min" or "sum"). If "min", the minimum number of points in a bin over all dataframes is used. If, "sum", the sum of the points over all dataframes is used. Defaults to "min".
df_freq (pd.DataFrame) -- A pandas dataframe with the frequency of each bin. Defaults to None.
use_standard_error (bool) -- If True, uncertainty in the total uplift is quantified by propagating bin-level standard errors. If False, bootstrapping is used. Defaults to True.
N (int) -- The number of bootstrap samples. If use_standard_error is True, N must be 1. Defaults to 1.
percentiles (List[float]) -- The lower and upper percentiles for quantifying uncertainty in total uplift. Defaults to [2.5, 97.5].
remove_any_null_turbine_bins (bool) -- If True, when computing farm power, remove any bins where any of the test turbines is null. Defaults to False.
cov_terms (str) -- If use_standard_error is True, the approach for determining the power covariance terms betweens pairs of test turbines whe computing uncertainty. Can be "zero", "var" or "cov". If "zero" all covariance terms are set to zero. If "var" all covariance terms are set to the product of the square root of the variances of each individual turbine. If "cov" the computed covariance terms are used as is when enough data are present in a bin, with missing terms set to the product of the square root of the individual turbine variances. Defaults to "zero".
- Returns:
- An object containing the uplift results and
analysis parameters.
- Return type:
- flasc.analysis.expected_power_analysis.total_uplift_expected_power_sweep_ws_min(a_in: AnalysisInput, uplift_pairs: List[Tuple[str, str]], uplift_names: List[str], test_turbines: List[int], wd_turbines: List[int] | None = None, ws_turbines: List[int] | None = None, use_predefined_wd: bool = False, use_predefined_ws: bool = False, wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, ws_step: float = 1.0, ws_min: float = 0.0, ws_max: float = 50.0, bin_cols_in: List[str] = ['wd_bin', 'ws_bin'], weight_by: str = 'min', df_freq: DataFrame | None = None, use_standard_error: bool = True, N: int = 1, percentiles: List[float] = [2.5, 97.5], remove_any_null_turbine_bins: bool = False, cov_terms: str = 'zero', n_step: int = 10)[source]#
Perform a sweep over the ws_min parameter.
Perform a sweep over the ws_min parameter between the specified ws_min and ws_min + ws_step to determine the sensitivity of the total uplift to ws_min. Prints the total uplift for each ws_min considered.
- Parameters:
a_in (AnalysisInput) -- An AnalysisInput object containing the dataframes to analyze.
uplift_pairs (List[Tuple[str, str]]) -- A list of tuples containing the df_name values to compare.
uplift_names (List[str]) -- A list of names for the uplift results for each uplift pair.
test_turbines (List[int]) -- A list of turbine indices to include when computing total uplift.
wd_turbines (List[int]) -- A list of turbine indices for determining the reference wind direction. Defaults to None.
ws_turbines (List[int]) -- A list of turbine indices for determining the reference wind speed. Defaults to None.
use_predefined_wd (bool) -- Use predefined wind direction. Defaults to False.
use_predefined_ws (bool) -- Use predefined wind speed. Defaults to False.
wd_step (float) -- The step size for the wind direction bins. Defaults to 2.0.
wd_min (float) -- The minimum wind direction value. Defaults to 0.0.
wd_max (float) -- The maximum wind direction value. Defaults to 360.0.
ws_step (float) -- The step size for the wind speed bins. Defaults to 1.0.
ws_min (float) -- The minimum wind speed value. Defaults to 0.0.
ws_max (float) -- The maximum wind speed value. Defaults to 50.0.
bin_cols_in (List[str]) -- A list of column names to bin the dataframes by. Defaults to ["wd_bin", "ws_bin"].
weight_by (str) -- The method used to weight the bins when computing total energy if df_freq is None ("min" or "sum"). If "min", the minimum number of points in a bin over all dataframes is used. If, "sum", the sum of the points over all dataframes is used. Defaults to "min".
df_freq (pd.DataFrame) -- A pandas dataframe with the frequency of each bin. Defaults to None.
use_standard_error (bool) -- If True, uncertainty in the total uplift is quantified by propagating bin-level standard errors. If False, bootstrapping is used. Defaults to True.
N (int) -- The number of bootstrap samples. If use_standard_error is True, N must be 1. Defaults to 1.
percentiles (List[float]) -- The lower and upper percentiles for quantifying uncertainty in total uplift. Defaults to [2.5, 97.5].
remove_any_null_turbine_bins (bool) -- If True, when computing farm power, remove any bins where any of the test turbines is null. Defaults to False.
cov_terms (str) -- If use_standard_error is True, the approach for determining the power covariance terms betweens pairs of test turbines whe computing uncertainty. Can be "zero", "var" or "cov". If "zero" all covariance terms are set to zero. If "var" all covariance terms are set to the product of the square root of the variances of each individual turbine. If "cov" the computed covariance terms are used as is when enough data are present in a bin, with missing terms set to the product of the square root of the individual turbine variances. Defaults to "zero".
n_step (int) -- The number of steps to perform the minimum wind speed sweep over. Defaults to 10.
- Returns:
None