from abc import abstractmethod
from foxes.utils import new_instance
from .model import Model
[docs]
class WakeSuperposition(Model):
"""
Abstract base class for wake superposition models.
Note that it is a matter of the wake model
if superposition models are used, or if the
wake model computes the total wake result by
other means.
:group: core
"""
[docs]
@abstractmethod
def add_wake(
self,
algo,
mdata,
fdata,
tdata,
downwind_index,
st_sel,
variable,
wake_delta,
wake_model_result,
):
"""
Add a wake delta to previous wake deltas,
at rotor points.
Parameters
----------
algo: foxes.core.Algorithm
The calculation algorithm
mdata: foxes.core.MData
The model data
fdata: foxes.core.FData
The farm data
tdata: foxes.core.TData
The target point data
downwind_index: int
The index of the wake causing turbine
in the downwind order
st_sel: numpy.ndarray of bool
The selection of targets, shape: (n_states, n_targets)
variable: str
The variable name for which the wake deltas applies
wake_delta: numpy.ndarray
The original wake deltas, shape:
(n_states, n_targets, n_tpoints, ...)
wake_model_result: numpy.ndarray
The new wake deltas of the selected rotors,
shape: (n_st_sel, n_tpoints, ...)
Returns
-------
wdelta: numpy.ndarray
The updated wake deltas, shape:
(n_states, n_targets, n_tpoints, ...)
"""
pass
[docs]
@abstractmethod
def calc_final_wake_delta(
self,
algo,
mdata,
fdata,
variable,
amb_results,
wake_delta,
):
"""
Calculate the final wake delta after adding all
contributions.
Parameters
----------
algo: foxes.core.Algorithm
The calculation algorithm
mdata: foxes.core.MData
The model data
fdata: foxes.core.FData
The farm data
variable: str
The variable name for which the wake deltas applies
amb_results: numpy.ndarray
The ambient results at targets,
shape: (n_states, n_targets, n_tpoints)
wake_delta: numpy.ndarray
The wake deltas at targets, shape:
(n_states, n_targets, n_tpoints)
Returns
-------
final_wake_delta: numpy.ndarray
The final wake delta, which will be added to the ambient
results by simple plus operation. Shape:
(n_states, n_targets, n_tpoints)
"""
pass
[docs]
@classmethod
def new(cls, superp_type, *args, **kwargs):
"""
Run-time wake superposition model factory.
Parameters
----------
superp_type: str
The selected derived class name
args: tuple, optional
Additional parameters for constructor
kwargs: dict, optional
Additional parameters for constructor
"""
return new_instance(cls, superp_type, *args, **kwargs)