Cost Component
CostModelComponent
- class topfarm.cost_models.cost_model_wrappers.CostModelComponent(input_keys, n_wt, cost_function, cost_gradient_function=None, output_keys=['Cost'], output_unit='', additional_input=[], additional_output=[], max_eval=None, objective=True, maximize=False, output_vals=[0.0], input_units=[], step={}, use_constraint_violation=True, **kwargs)[source]
Wrapper for pure-Python cost functions
__init__
(input_keys, n_wt, cost_function[, ...])Initialize wrapper for pure-Python cost function
compute
(inputs, outputs)Compute cost model
compute_partials
(inputs, J)Compute sub-jacobian parts.
- __init__(input_keys, n_wt, cost_function, cost_gradient_function=None, output_keys=['Cost'], output_unit='', additional_input=[], additional_output=[], max_eval=None, objective=True, maximize=False, output_vals=[0.0], input_units=[], step={}, use_constraint_violation=True, **kwargs)[source]
Initialize wrapper for pure-Python cost function
- Parameters
n_wt (int) – Number of wind turbines
cost_function (function handle) – Function to evaluate cost
cost_gradient_function (function handle, optional) – Function to evaluate gradient of the cost function
output_key (list) – Name of output key
output_unit (str) – Units of output of cost function
additional_input (list of str) –
Other (non-design-variable) inputs required by the cost function
Gradients will not be computed for these inputs
additional_output (list of str or list of tuples) –
Other outputs to request
if list of str: [‘add_out_name’,…]
if list of tuples [(‘add_out_name’, val),…], where val is a template value of the output The cost function must return: cost, {‘add_out1_name’: add_out1, …}
max_eval (int) – Maximum number of function evaluations
objective (boolean) – Must be True for standalone CostModelComponents and the final component in a TopFarmGroup
maximize (boolean) –
If True: objective is maximised during optimization
If False: Objective is minimized during optimization
output_vals (float or array_like) – Format of output
input_units (list of str) – Units of the respective input_keys
step (dict of {str : float}) – Finite difference step size for each input key, e.g. {input_key : step_size, input_key2 : step_size2}
AEPCostModelComponent
- class topfarm.cost_models.cost_model_wrappers.AEPCostModelComponent(input_keys, n_wt, cost_function, cost_gradient_function=None, output_unit='', additional_input=[], additional_output=[], max_eval=None, output_key='AEP', **kwargs)[source]
Wrapper for pure-Python cost functions
__init__
(input_keys, n_wt, cost_function[, ...])Initialize Sub class of the CostModelComponent for AEP maximization
- __init__(input_keys, n_wt, cost_function, cost_gradient_function=None, output_unit='', additional_input=[], additional_output=[], max_eval=None, output_key='AEP', **kwargs)[source]
Initialize Sub class of the CostModelComponent for AEP maximization
- Parameters
n_wt (int) – Number of wind turbines
cost_function (function handle) – Function to evaluate cost
cost_gradient_function (function handle, optional) – Function to evaluate gradient of the cost function
output_key (list) – Name of output key, default is AEP
output_unit (str) – Units of output of cost function
additional_input (list of str) –
Other (non-design-variable) inputs required by the cost function
Gradients will not be computed for these inputs
additional_output (list of str or list of tuples) –
Other outputs to request
if list of str: [‘add_out_name’,…]
if list of tuples [(‘add_out_name’, val),…], where val is a template value of the output The cost function must return: cost, {‘add_out1_name’: add_out1, …}
max_eval (int) – Maximum number of function evaluations
AEPMaxLoadCostModelComponent
- class topfarm.cost_models.cost_model_wrappers.AEPMaxLoadCostModelComponent(input_keys, n_wt, aep_load_function, max_loads, aep_load_gradient=None, output_keys=['AEP', 'loads'], step={}, maximize=True, **kwargs)[source]
Wrapper for pure-Python cost functions
__init__
(input_keys, n_wt, ...[, ...])Initialize Sub class of the CostModelComponent for AEP maximization and load constraints
- __init__(input_keys, n_wt, aep_load_function, max_loads, aep_load_gradient=None, output_keys=['AEP', 'loads'], step={}, maximize=True, **kwargs)[source]
Initialize Sub class of the CostModelComponent for AEP maximization and load constraints
- Parameters
n_wt (int) – Number of wind turbines
aep_load_function (function handle) – Function to evaluate cost
aep_load_gradient (function handle, optional) – Function to evaluate gradient of the cost function
output_keys (list) – Name of output key, default is AEP and loads
step (dict of {str : float}) – Finite difference step size for each input key, e.g. {input_key : step_size, input_key2 : step_size2}
maximize (boolean) –
If True: objective is maximised during optimization
If False: Objective is minimized during optimization
PyWakeAEPCostModelComponent
- class topfarm.cost_models.py_wake_wrapper.PyWakeAEPCostModelComponent(windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=<function autograd>, n_cpu=1, **kwargs)[source]
TOPFARM wrapper for PyWake AEP calculator
__init__
(windFarmModel, n_wt[, wd, ws, ...])Initialize wrapper for PyWake AEP calculator
get_aep4smart_start
([ws, wd, type])Compute AEP with a smart start approach
- __init__(windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=<function autograd>, n_cpu=1, **kwargs)[source]
Initialize wrapper for PyWake AEP calculator
- Parameters
windFarmModel (DeficitModel) – Wake deficit model used
n_wt (int) – Number of wind turbines
wd (array_like) – Wind directions to study
ws (array_like) – Wind speeds to study
max_eval (int) – Maximum number of function evaluations
grad_method (function handle) – Selected method to calculate gradients, default is autograd