{
"cells": [
{
"cell_type": "markdown",
"id": "097ddd3c",
"metadata": {},
"source": [
"# Example of using the peak-shaving turbine operation model."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b7ecd57",
"metadata": {},
"outputs": [],
"source": [
"\"\"\"Example of using the peak-shaving turbine operation model.\n",
"\n",
"This example demonstrates how to use the peak-shaving operation model in FLORIS.\n",
"The peak-shaving operation model allows the user to a thrust reduction near rated wind speed to\n",
"reduce loads on the turbine. The power is reduced accordingly, and wind turbine wakes\n",
"are shallower due to the reduced thrust.\n",
"\n",
"\"\"\"\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from floris import FlorisModel, TimeSeries\n",
"\n",
"\n",
"fmodel = FlorisModel(\"../inputs/gch.yaml\")\n",
"fmodel.set(layout_x=[0, 1000.0], layout_y=[0.0, 0.0])\n",
"wind_speeds = np.linspace(0, 30, 100)\n",
"fmodel.set(\n",
" wind_data=TimeSeries(\n",
" wind_directions=270 * np.ones_like(wind_speeds),\n",
" wind_speeds=wind_speeds,\n",
" turbulence_intensities=0.10, # High enough to engage peak shaving\n",
" )\n",
")\n",
"\n",
"# Start with \"normal\" operation under the simple turbine operation model\n",
"fmodel.set_operation_model(\"simple\")\n",
"fmodel.run()\n",
"powers_base = fmodel.get_turbine_powers()/1000\n",
"thrust_coefficients_base = fmodel.get_turbine_thrust_coefficients()\n",
"\n",
"# Switch to the peak-shaving operation model\n",
"fmodel.set_operation_model(\"peak-shaving\")\n",
"fmodel.run()\n",
"powers_peak_shaving = fmodel.get_turbine_powers()/1000\n",
"thrust_coefficients_peak_shaving = fmodel.get_turbine_thrust_coefficients()\n",
"\n",
"# Compare the power and thrust coefficients of the upstream turbine\n",
"fig, ax = plt.subplots(2,1,sharex=True)\n",
"ax[0].plot(\n",
" wind_speeds,\n",
" thrust_coefficients_base[:,0],\n",
" label=\"Without peak shaving\",\n",
" color=\"black\"\n",
")\n",
"ax[0].plot(\n",
" wind_speeds,\n",
" thrust_coefficients_peak_shaving[:,0],\n",
" label=\"With peak shaving\",\n",
" color=\"C0\"\n",
")\n",
"ax[1].plot(\n",
" wind_speeds,\n",
" powers_base[:,0],\n",
" label=\"Without peak shaving\",\n",
" color=\"black\"\n",
")\n",
"ax[1].plot(\n",
" wind_speeds,\n",
" powers_peak_shaving[:,0],\n",
" label=\"With peak shaving\",\n",
" color=\"C0\"\n",
")\n",
"ax[1].grid()\n",
"ax[0].grid()\n",
"ax[0].legend()\n",
"ax[0].set_ylabel(\"Thrust coefficient [-]\")\n",
"ax[1].set_xlabel(\"Wind speed [m/s]\")\n",
"ax[1].set_ylabel(\"Power [kW]\")\n",
"\n",
"# Look at the total power across the two turbines for each case\n",
"fig, ax = plt.subplots(2,1,sharex=True,sharey=True)\n",
"ax[0].fill_between(\n",
" wind_speeds,\n",
" 0,\n",
" powers_base[:, 0]/1e6,\n",
" color='C0',\n",
" label='Turbine 1'\n",
")\n",
"ax[0].fill_between(\n",
" wind_speeds,\n",
" powers_base[:, 0]/1e6,\n",
" powers_base[:, :2].sum(axis=1)/1e6,\n",
" color='C1',\n",
" label='Turbine 2'\n",
" )\n",
"ax[0].plot(\n",
" wind_speeds,\n",
" powers_base[:,:2].sum(axis=1)/1e6,\n",
" color='k',\n",
" label='Farm'\n",
")\n",
"ax[1].fill_between(\n",
" wind_speeds,\n",
" 0,\n",
" powers_peak_shaving[:, 0]/1e6,\n",
" color='C0',\n",
" label='Turbine 1'\n",
")\n",
"ax[1].fill_between(\n",
" wind_speeds,\n",
" powers_peak_shaving[:, 0]/1e6,\n",
" powers_peak_shaving[:, :2].sum(axis=1)/1e6,\n",
" color='C1',\n",
" label='Turbine 2'\n",
" )\n",
"ax[1].plot(\n",
" wind_speeds,\n",
" powers_peak_shaving[:,:2].sum(axis=1)/1e6,\n",
" color='k',\n",
" label='Farm'\n",
")\n",
"ax[0].legend()\n",
"ax[0].set_title(\"Without peak shaving\")\n",
"ax[1].set_title(\"With peak shaving\")\n",
"ax[0].set_ylabel(\"Power [MW]\")\n",
"ax[1].set_ylabel(\"Power [MW]\")\n",
"ax[0].grid()\n",
"ax[1].grid()\n",
"\n",
"ax[1].set_xlabel(\"Free stream wind speed [m/s]\")\n",
"\n",
"plt.show()\n",
"import warnings\n",
"warnings.filterwarnings('ignore')"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}