flasc.model_fitting.floris_tuning#

Module for tuning FLORIS to SCADA data.

Functions

evaluate_overall_wake_loss

Evaluate the overall wake loss from pow_ref to pow_test as percent reductions.

select_best_wake_model_parameter

Determine the best fit with respect to squared error.

select_best_wd_std

Consider wd_std and determine the best fit with respect to squared error.

sweep_deflection_parameter_for_total_uplift

Sweep values of the deflection parameter in FLORIS and compare to SCADA.

sweep_velocity_model_parameter_for_overall_wake_losses

Sweep the parameter in FLORIS using the values in value_candidates.

sweep_wd_std_for_er

Determine the best-fit wd_std for FLORIS by comparison with energy ratio plots.

flasc.model_fitting.floris_tuning.evaluate_overall_wake_loss(df_, df_freq=None)[source]#

Evaluate the overall wake loss from pow_ref to pow_test as percent reductions.

Parameters:
  • df (pl.DataFrame) -- Polars dataframe possibly containing Null values

  • df_freq (Dataframe) -- Not yet used

Returns:

Overall wake losses

Return type:

float

flasc.model_fitting.floris_tuning.sweep_velocity_model_parameter_for_overall_wake_losses(parameter, value_candidates, df_scada_in, fm_in, ref_turbines, test_turbines, param_idx=None, yaw_angles=None, wd_min=0.0, wd_max=360.0, ws_min=0.0, ws_max=50.0, df_freq=None)[source]#

Sweep the parameter in FLORIS using the values in value_candidates.

Compare to SCADA data in df_scada_in using the overall_wake_loss

Parameters:
  • parameter (str) -- The parameter to sweep

  • value_candidates (list) -- The values to sweep

  • df_scada_in (DataFrame) -- The SCADA data

  • fm_in (floris.tools.Floris) -- The FLORIS model

  • ref_turbines (list) -- The reference turbines

  • test_turbines (list) -- The test turbines

  • param_idx (int) -- The parameter index

  • yaw_angles (np.ndarray) -- The yaw angles

  • wd_min (float) -- The minimum wind direction

  • wd_max (float) -- The maximum wind direction

  • ws_min (float) -- The minimum wind speed

  • ws_max (float) -- The maximum wind speed

  • df_freq (DataFrame) -- The frequency data

Returns:

A tuple (np.ndarray, np.ndarray) where the first element is the FLORIS wake losses and the second element is the SCADA wake losses

flasc.model_fitting.floris_tuning.select_best_wake_model_parameter(floris_results, scada_results, value_candidates, ax=None)[source]#

Determine the best fit with respect to squared error.

Parameters:
  • floris_results (np.ndarray) -- The FLORIS wake losses

  • scada_results (np.ndarray) -- The SCADA wake losses

  • value_candidates (np.ndarray) -- The parameter values

  • ax (Axes) -- The axes to plot on. If None, no plot is made. Default is None.

Returns:

best fit parameter value

Return type:

float

flasc.model_fitting.floris_tuning.sweep_wd_std_for_er(value_candidates, df_scada_in, df_approx_, ref_turbines, test_turbines, yaw_angles=None, wd_step=2.0, wd_min=0.0, wd_max=360.0, ws_step=1.0, ws_min=0.0, ws_max=50.0, bin_cols_in=['wd_bin', 'ws_bin'], weight_by='min', df_freq=None, remove_all_nulls=False)[source]#

Determine the best-fit wd_std for FLORIS by comparison with energy ratio plots.

TODO: Reimplement that comparison only takes place when FLORIS value is below some threshold

Parameters:
  • value_candidates (list) -- The values to sweep

  • df_scada_in (DataFrame) -- The SCADA data

  • df_approx (DataFrame) -- The FLORIS approximation data

  • ref_turbines (list) -- The reference turbines

  • test_turbines (list) -- The test turbines

  • yaw_angles (np.ndarray) -- The yaw angles

  • wd_step (float) -- The wind direction step

  • wd_min (float) -- The minimum wind direction

  • wd_max (float) -- The maximum wind direction

  • ws_step (float) -- The wind speed step

  • ws_min (float) -- The minimum wind speed

  • ws_max (float) -- The maximum wind speed

  • bin_cols_in (list) -- The bin columns

  • weight_by (str) -- The weight method. Can be 'min' or 'sum'. Default is 'min'.

  • df_freq (DataFrame) -- The frequency data

  • remove_all_nulls (bool) -- Remove all nulls. Default is False.

Returns:

The first element is the FLORIS energy ratio errors

and the second element is the dataframes.

Return type:

A tuple (np.ndarray, list)

flasc.model_fitting.floris_tuning.select_best_wd_std(er_results, value_candidates, ax=None)[source]#

Consider wd_std and determine the best fit with respect to squared error.

Parameters:
  • er_results (np.ndarray) -- The energy ratio errors

  • value_candidates (np.ndarray) -- The parameter values

  • ax (Axes) -- The axes to plot on. If None, no plot is made. Default is None.

Returns:

The best parameter value

Return type:

float

flasc.model_fitting.floris_tuning.sweep_deflection_parameter_for_total_uplift(parameter, value_candidates, df_scada_baseline_in, df_scada_wakesteering_in, fm_in, ref_turbines, test_turbines, yaw_angles_baseline=None, yaw_angles_wakesteering=None, wd_step=2.0, wd_min=0.0, wd_max=360.0, ws_step=1.0, ws_min=0.0, ws_max=50.0, bin_cols_in=['wd_bin', 'ws_bin'], weight_by='min', df_freq=None, remove_all_nulls=False)[source]#

Sweep values of the deflection parameter in FLORIS and compare to SCADA.

Comparison is made wrt overall uplift.

Parameters:
  • parameter (str) -- The parameter to sweep

  • value_candidates (list) -- The values to sweep

  • df_scada_baseline_in (DataFrame) -- The baseline SCADA data

  • df_scada_wakesteering_in (DataFrame) -- The wake steering SCADA data

  • fm_in (floris.tools.Floris) -- The FLORIS model

  • ref_turbines (list) -- The reference turbines

  • test_turbines (list) -- The test turbines

  • yaw_angles_baseline (np.ndarray) -- The yaw angles for the baseline

  • yaw_angles_wakesteering (np.ndarray) -- The yaw angles for the wake steering

  • wd_step (float) -- The wind direction step

  • wd_min (float) -- The minimum wind direction

  • wd_max (float) -- The maximum wind direction

  • ws_step (float) -- The wind speed step

  • ws_min (float) -- The minimum wind speed

  • ws_max (float) -- The maximum wind speed

  • bin_cols_in (list) -- The bin columns

  • weight_by (str) -- The weight method. Can be 'min' or 'sum'. Default is 'min'.

  • df_freq (DataFrame) -- The frequency data

  • remove_all_nulls (bool) -- Remove all nulls. Default is False.

Returns:

A typle (np.ndarray, np.ndarray) where the first element is the FLORIS total uplifts and the second element is the SCADA total uplifts