Example of using the peak-shaving turbine operation model.

Example of using the peak-shaving turbine operation model.#

"""Example of using the peak-shaving turbine operation model.

This example demonstrates how to use the peak-shaving operation model in FLORIS.
The peak-shaving operation model allows the user to a thrust reduction near rated wind speed to
reduce loads on the turbine. The power is reduced accordingly, and wind turbine wakes
are shallower due to the reduced thrust.

"""

import matplotlib.pyplot as plt
import numpy as np

from floris import FlorisModel, TimeSeries


fmodel = FlorisModel("../inputs/gch.yaml")
fmodel.set(layout_x=[0, 1000.0], layout_y=[0.0, 0.0])
wind_speeds = np.linspace(0, 30, 100)
fmodel.set(
    wind_data=TimeSeries(
        wind_directions=270 * np.ones_like(wind_speeds),
        wind_speeds=wind_speeds,
        turbulence_intensities=0.10, # High enough to engage peak shaving
    )
)

# Start with "normal" operation under the simple turbine operation model
fmodel.set_operation_model("simple")
fmodel.run()
powers_base = fmodel.get_turbine_powers()/1000
thrust_coefficients_base = fmodel.get_turbine_thrust_coefficients()

# Switch to the peak-shaving operation model
fmodel.set_operation_model("peak-shaving")
fmodel.run()
powers_peak_shaving = fmodel.get_turbine_powers()/1000
thrust_coefficients_peak_shaving = fmodel.get_turbine_thrust_coefficients()

# Compare the power and thrust coefficients of the upstream turbine
fig, ax = plt.subplots(2,1,sharex=True)
ax[0].plot(
    wind_speeds,
    thrust_coefficients_base[:,0],
    label="Without peak shaving",
    color="black"
)
ax[0].plot(
    wind_speeds,
    thrust_coefficients_peak_shaving[:,0],
    label="With peak shaving",
    color="C0"
)
ax[1].plot(
    wind_speeds,
    powers_base[:,0],
    label="Without peak shaving",
    color="black"
)
ax[1].plot(
    wind_speeds,
    powers_peak_shaving[:,0],
    label="With peak shaving",
    color="C0"
)
ax[1].grid()
ax[0].grid()
ax[0].legend()
ax[0].set_ylabel("Thrust coefficient [-]")
ax[1].set_xlabel("Wind speed [m/s]")
ax[1].set_ylabel("Power [kW]")

# Look at the total power across the two turbines for each case
fig, ax = plt.subplots(2,1,sharex=True,sharey=True)
ax[0].fill_between(
    wind_speeds,
    0,
    powers_base[:, 0]/1e6,
    color='C0',
    label='Turbine 1'
)
ax[0].fill_between(
    wind_speeds,
    powers_base[:, 0]/1e6,
    powers_base[:, :2].sum(axis=1)/1e6,
    color='C1',
    label='Turbine 2'
    )
ax[0].plot(
    wind_speeds,
    powers_base[:,:2].sum(axis=1)/1e6,
    color='k',
    label='Farm'
)
ax[1].fill_between(
    wind_speeds,
    0,
    powers_peak_shaving[:, 0]/1e6,
    color='C0',
    label='Turbine 1'
)
ax[1].fill_between(
    wind_speeds,
    powers_peak_shaving[:, 0]/1e6,
    powers_peak_shaving[:, :2].sum(axis=1)/1e6,
    color='C1',
    label='Turbine 2'
    )
ax[1].plot(
    wind_speeds,
    powers_peak_shaving[:,:2].sum(axis=1)/1e6,
    color='k',
    label='Farm'
)
ax[0].legend()
ax[0].set_title("Without peak shaving")
ax[1].set_title("With peak shaving")
ax[0].set_ylabel("Power [MW]")
ax[1].set_ylabel("Power [MW]")
ax[0].grid()
ax[1].grid()

ax[1].set_xlabel("Free stream wind speed [m/s]")

plt.show()
import warnings
warnings.filterwarnings('ignore')
/home/runner/work/floris/floris/floris/core/wake_deflection/gauss.py:328: RuntimeWarning: invalid value encountered in divide
  val = 2 * (avg_v - v_core) / (v_top + v_bottom)
/home/runner/work/floris/floris/floris/core/wake_deflection/gauss.py:163: RuntimeWarning: invalid value encountered in divide
  C0 = 1 - u0 / freestream_velocity
/home/runner/work/floris/floris/floris/core/wake_velocity/gauss.py:80: RuntimeWarning: invalid value encountered in divide
  sigma_z0 = rotor_diameter_i * 0.5 * np.sqrt(uR / (u_initial + u0))
../../_images/0bff6cbb0d67d0cf9df6a8e091d7c82f16f4f8ceb1f580a47d6bfbde395969bb.png ../../_images/34045b62fa704ab18dbb026523210b39b982d84f348bdb72524d72d418e2fbe2.png