WindFarmModel

class py_wake.wind_farm_models.wind_farm_model.WindFarmModel(site, windTurbines)[source]

Base class for RANS and engineering flow models

__call__(x, y[, h, type, wd, ws, time, ...])

Run the wind farm simulation

calc_wt_interaction(x_ilk, y_ilk[, h_i, ...])

Calculate effective wind speed, turbulence intensity, power and thrust coefficient, and local site parameters

__call__(x, y, h=None, type=0, wd=None, ws=None, time=False, verbose=False, n_cpu=1, wd_chunks=None, ws_chunks=1, return_simulationResult=True, **kwargs)[source]

Run the wind farm simulation

Parameters:
  • x (array_like) – Wind turbine x positions

  • y (array_like) – Wind turbine y positions

  • h (array_like, optional) – Wind turbine hub heights

  • type (int or array_like, optional) – Wind turbine type, default is 0

  • wd (int or array_like) – Wind direction(s)

  • ws (int, float or array_like) – Wind speed(s)

  • yaw (int, float, array_like or None, optional) – Yaw misalignement, Positive is counter-clockwise when seen from above. May be - constant for all wt and flow cases or dependent on - wind turbine(i), - wind turbine and wind direction(il) or - wind turbine, wind direction and wind speed (ilk)

  • tilt (array_like or None, optional) – Tilt angle of rotor shaft. Normal tilt (rotor center above tower top) is positivie May be - constant for all wt and flow cases or dependent on - wind turbine(i), - wind turbine and wind direction(il) or - wind turbine, wind direction and wind speed (ilk)

  • time (boolean or array_like) – If False (default), the simulation will be computed for the full wd x ws matrix If True, the wd and ws will be considered as a time series of flow conditions with time stamp 0,1,..,n If array_like: same as True, but the time array is used as flow case time stamp

  • n_cpu (int or None, optional) – Number of CPUs to be used for execution. If 1 (default), the execution is not parallized If None, the available number of CPUs are used

  • wd_chunks (int or None, optional) – The wind directions are divided into <wd_chunks> chunks. More chunks reduces the memory usage and allows parallel execution if n_cpu>1. If wd_chunks is None, wd_chunks is set to the number of CPUs used, i.e. 1 if n_cpu is not specified

  • ws_chunks (int, optional) – The wind speeds are divided into <ws_chunks> chunks. More chunks reduces the memory usage and allows parallel execution if n_cpu>1.

  • return_simulationResult (boolean, optional) – see Returns

Returns:

  • If return_simulationResult is True a SimulationResult (xarray Dataset) is returned

  • If return_simulationResult is False the functino returns a tuple of

  • WS_eff_ilk, TI_eff_ilk, power_ilk, ct_ilk, localWind, kwargs_ilk

aep(x, y, h=None, type=0, wd=None, ws=None, normalize_probabilities=False, with_wake_loss=True, n_cpu=1, wd_chunks=None, ws_chunks=1, **kwargs)[source]

Anual Energy Production (sum of all wind turbines, directions and speeds) in GWh.

the typical use is: >> sim_res = windFarmModel(x,y,…) >> sim_res.aep()

This function bypasses the simulation result and returns only the total AEP, which makes it slightly faster for small problems. >> windFarmModel.aep(x,y,…)

Parameters:
  • x (array_like) – Wind turbine x positions

  • y (array_like) – Wind turbine y positions

  • h (array_like, optional) – Wind turbine hub heights

  • type (int or array_like, optional) – Wind turbine type, default is 0

  • wd (int or array_like) – Wind direction(s)

  • ws (int, float or array_like) – Wind speed(s)

  • yaw (int, float, array_like or None, optional) – Yaw misalignement, Positive is counter-clockwise when seen from above. May be - constant for all wt and flow cases or dependent on - wind turbine(i), - wind turbine and wind direction(il) or - wind turbine, wind direction and wind speed (ilk)

  • tilt (array_like or None, optional) – Tilt angle of rotor shaft. Normal tilt (rotor center above tower top) is positivie May be - constant for all wt and flow cases or dependent on - wind turbine(i), - wind turbine and wind direction(il) or - wind turbine, wind direction and wind speed (ilk)

  • n_cpu (int or None, optional) – Number of CPUs to be used for execution. If 1 (default), the execution is not parallized If None, the available number of CPUs are used

  • wd_chunks (int or None, optional) – The wind directions are divided into <wd_chunks> chunks. More chunks reduces the memory usage and allows parallel execution if n_cpu>1. If wd_chunks is None, wd_chunks is set to the number of CPUs used, i.e. 1 if n_cpu is not specified

  • ws_chunks (int, optional) – The wind speeds are divided into <ws_chunks> chunks. More chunks reduces the memory usage and allows parallel execution if n_cpu>1.

Return type:

AEP in GWh

aep_gradients(gradient_method=<function autograd>, wrt_arg=['x', 'y'], gradient_method_kwargs={}, n_cpu=1, wd_chunks=None, ws_chunks=None, **kwargs)[source]

Method to compute the gradients of the AEP with respect to wrt_arg using the gradient_method

Note, this method has two behaviours: 1) Without specifying additional key-word arguments, kwargs, the method returns the function to compute the gradients of the aep: gradient_function = wfm.aep_gradietns(autograd, [‘x’,’y’]) gradients = gradient_function(x,y) This behaiour only works when wrt_arg is one or more of [‘x’,’y’,’h’,’wd’, ‘ws’]

2) With additional key-word arguments, kwargs, the method returns the gradients of the aep: gradients = wfm.aep_gradients(autograd,[‘x’,’y’],x=x,y=y) This behaviour also works when wrt_arg is a keyword argument, e.g. yaw

Parameters:
  • gradient_method (gradient function, {fd, cs, autograd}) – gradient function

  • wrt_arg ({'x', 'y', 'h', 'wd', 'ws', 'yaw','tilt'} or list of these arguments, e.g. ['x','y']) – argument to compute gradients of AEP with respect to

  • gradient_method_kwargs (dict, optional) – additional arguments for the gradient method, e.g. step size

  • n_cpu (int or None, optional) – Number of CPUs to be used for execution. If 1 (default), the execution is not parallized If None, the available number of CPUs are used

  • wd_chunks (int or None, optional) – If n_cpu>1, the wind directions are divided into <wd_chunks> chunks and executed in parallel. If wd_chunks is None, wd_chunks is set to the available number of CPUs

  • ws_chunks (int or None, optional) – If n_cpu>1, the wind speeds are divided into <ws_chunks> chunks and executed in parallel. If ws_chunks is None, ws_chunks is set to 1

abstract calc_wt_interaction(x_ilk, y_ilk, h_i=None, type_i=0, wd=None, ws=None, time=False, n_cpu=1, wd_chunks=None, ws_chunks=None, **kwargs)[source]

Calculate effective wind speed, turbulence intensity, power and thrust coefficient, and local site parameters

Typical users should not call this function directly, but by calling the windFarmModel object (invokes the __call__() function above) which returns a nice SimulationResult object

Parameters:
  • x_ilk (array_like) – X position of wind turbines

  • y_ilk (array_like) – Y position of wind turbines

  • h_i (array_like or None, optional) –

    Hub height of wind turbines

    If None, default, the standard hub height is used

  • type_i (array_like or None, optional) –

    Wind turbine types

    If None, default, the first type is used (type=0)

  • wd (int, float, array_like or None) –

    Wind directions(s)

    If None, default, the wake is calculated for site.default_wd

  • ws (int, float, array_like or None) –

    Wind speed(s)

    If None, default, the wake is calculated for site.default_ws

  • n_cpu (int or None, optional) – Number of CPUs to be used for execution. If 1 (default), the execution is not parallized If None, the available number of CPUs are used

  • wd_chunks (int or None, optional) – If n_cpu>1, the wind directions are divided into <wd_chunks> chunks and executed in parallel. If wd_chunks is None, wd_chunks is set to the available number of CPUs

  • ws_chunks (int or None, optional) – If n_cpu>1, the wind speeds are divided into <ws_chunks> chunks and executed in parallel. If ws_chunks is None, ws_chunks is set to 1

Returns:

  • WS_eff_ilk (array_like) – Effective wind speeds [m/s]

  • TI_eff_ilk (array_like) – Effective turbulence intensities [-]

  • power_ilk (array_like) – Power productions [w]

  • ct_ilk (array_like) – Thrust coefficients

  • localWind (LocalWind) – Local free-flow wind