Farm

class onwards.Farm(data_dir: str, af_name: str, snrs_args: dict, est_args: dict, model_args: dict, grid_args: dict = {}, wt_cherry_picking: List[int] = None, out_dir: str = None, enable_logger: bool = True)

Bases: object

Inits Farm.

The Farm object interfaces together the different modules of the OnWaRDS toolbox (eg: turbine state estimation, flow modeling, data i/o, plotting) 1 2 3.

A Farm consists of a series of Turbine (self.wts). Each wind turbine is associated to a Sensors object that gathers its measurements, m_wt, at a prescribed time, t. These measurements are then translated into the estimated turbine state, s_wt, using its built-in Estimator.

The wind turbine states, s_wt, are eventually fed to self.lag_solver, the LagSolver (written in c and interfaced with main python code using ctypes) that uses them to estimate the flow state, s_flow.

\[\mathbf{m}_{wt} \rightarrow \mathbf{\hat{s}}_{wt} \rightarrow \mathbf{\hat{s}}_{flow}\]

Once initialized, a Farm object can be temporally iterated over using the built-in for loop. Memory cleaning is automatically handled using the with statement.

Plotting is handled by self.viz and custom user plot can added using Farm.viz_add().

Parameters
  • data_dir (str) – Path to the wind farm data.

  • af_name (str) – Name of the airfoil used (eg: NREL).

  • snrs_args (dict) – Dictionary containing the parameters used for the turbines Sensors initialization (refer to Sensors).

  • est_args (dict) – Dictionary containing the parameters used for the turbines Estimators initialization (refer to Estimator).

  • model_args (dict) – Dictionary containing the parameters used for the Lagrangian flow model’s initialization (refer to LagSolver).

  • grid_args (dict, optional) – Dictionary containing the parameters used for the Grid’s initialization (refer to Grid).

  • wt_cherry_picking (List[int], optional) – Each element corresponds to a wind turbine index (allows to pick only the desired turbines), if None (by default), all turbines are modeled..

  • out_dir (str, optional) – Export directory name where figures and data are saved. If '', all exports are disabled; if None (by default), default export directory name onwards_run_id.

  • enable_logger (bool, optional) – If True (by default), logs are saved to the export directory.

Raises

TypeError – If wt_cherry_picking is not a list of valid turbines indices.

Example

Typical OnWaRDS initialization:

>>> from onwards import Farm
>>> with Farm() as f:
>>>    v.viz_add('MyViz')
>>>    for t in f:
>>>        print(f'Current time is {t}.')
>>>    f.plot()

References

1
  1. Lejeune, M. Moens, and P. Chatelain. A meandering-capturing wake model coupled to rotor-based flow-sensing for operational wind farm flow prediction. Frontiers in Energy Research, 10, jul 2022.

2
  1. Lejeune, M. Moens, and P. Chatelain. Extension and validation of an operational dynamic wake model to yawed configurations. Journal of Physics: Conference Series, 2265(2):022018, may 2022.

3
  1. Lejeune, M. Moens, M. Coquelet, N. Coudou, and P. Chatelain. Data assimilation for the prediction of wake trajectories within wind farms. Journal of Physics: Conference Series, 1618:062055, sep 2020.

export_geo()
get_restart() None
iterate()

Updates the Farm

Successively updates the sensor states, m_wt, wind turbine states, s_wt, and flow model states, s_flow.

If an Estimator/LagSolver was performed as part of the current timestep, the corresponding update_states_flag/update_LagSolver_flag is set to True.

Raises

Exception – If the time is not consistent across the different turbines.

reset(model_args: dict, rst: dict = {})

Resets the wind turbines and flow states to the initial configuration and updates the Lagrangian flow model parameters.

Parameters
  • model_args (dict) – Dictionary containing the parameters of the Lagrangian flow model that needs to be updated (refer to LagSolver)

  • ini_states (dict[str, float], optional) – {'s_wt': v} maps the wind turbine state, s_wt, to its initial value, v.

viz_add(viz_type: str, *args, **kwargs)

Adds a Viz object to the farm

Parameters

viz_type (str) – Name of the Viz object

Raises

Exception – If viz_type is not recognized.

Note

The user can implement his own Viz objects following the Viz prototype class. These Viz subclass should be named Viz_myname and saved to a file named onwards_viz_myname.py available in the python path.

See also

Viz, Farm.viz_plot()

viz_plot()

Iteratively calls the plot methods of the Viz objects added to the Farm.