|  | 
|  | 1 | +{ | 
|  | 2 | + "cells": [ | 
|  | 3 | +  { | 
|  | 4 | +   "cell_type": "markdown", | 
|  | 5 | +   "id": "ab10767e", | 
|  | 6 | +   "metadata": {}, | 
|  | 7 | +   "source": [ | 
|  | 8 | +    "# Multidimensional Wind Turbine\n", | 
|  | 9 | +    "\n", | 
|  | 10 | +    "Many external factors can affect the power and thrust curves of wind turbines. FLORIS supports the\n", | 
|  | 11 | +    "ability to define \"multidimensional\" wind turbines, where the power and thrust curves are defined\n", | 
|  | 12 | +    "as a function of external parameters. To enable this functionality, rather than defining `power`\n", | 
|  | 13 | +    "and `thrust_coefficient` as a function of `wind_speed` on the `power_thrust_table`, users should\n", | 
|  | 14 | +    "instead provide a path to a data file (described below) as `power_thrust_data_file`. Additionally,\n", | 
|  | 15 | +    "users must set the `multi_dimensional_cp_ct` option on the turbine definition to `True`.\n", | 
|  | 16 | +    "\n", | 
|  | 17 | +    "The power thrust data file should be a CSV file with the following columns:\n", | 
|  | 18 | +    "(`<external_parameter_1>`, `<external_parameter_2>`, ..., `ws`, `power`,\n", | 
|  | 19 | +    "`thrust_coefficient`). The external parameters can be any relevant factors that affect the turbine\n", | 
|  | 20 | +    "performance, and the values to be used will be specified at run time or in the FLORIS input file.\n", | 
|  | 21 | +    "For example, the external parameters could be air density, wave height, etc. The `ws` column should\n", | 
|  | 22 | +    "contain the wind speed values for specification of the power and thrust coefficient (stored in the\n", | 
|  | 23 | +    "`power` and `thrust_coefficient` columns, respectively). The wind speed, power, and thrust\n", | 
|  | 24 | +    "coefficient values should be defined for each combination of the external parameters.\n", | 
|  | 25 | +    "\n", | 
|  | 26 | +    "The user can then specify the values of the external parameters either on the FLORIS input file\n", | 
|  | 27 | +    "or using the `multidim_conditions` argument of `FlorisModel.set()`. The power and thrust coefficient\n", | 
|  | 28 | +    "are determined based on the specified conditions using a nearest-neighbor approach.\n", | 
|  | 29 | +    "\n", | 
|  | 30 | +    "The following code snippet shows an example of a multidimensional wind turbine definition and its\n", | 
|  | 31 | +    "corresponding power thrust data file." | 
|  | 32 | +   ] | 
|  | 33 | +  }, | 
|  | 34 | +  { | 
|  | 35 | +   "cell_type": "code", | 
|  | 36 | +   "execution_count": null, | 
|  | 37 | +   "id": "cc97a774", | 
|  | 38 | +   "metadata": {}, | 
|  | 39 | +   "outputs": [], | 
|  | 40 | +   "source": [ | 
|  | 41 | +    "import numpy as np\n", | 
|  | 42 | +    "import matplotlib.pyplot as plt\n", | 
|  | 43 | +    "\n", | 
|  | 44 | +    "from floris import FlorisModel, TimeSeries\n", | 
|  | 45 | +    "\n", | 
|  | 46 | +    "n_wind_speeds = 100\n", | 
|  | 47 | +    "wind_speeds = np.linspace(0.1, 30, n_wind_speeds)\n", | 
|  | 48 | +    "\n", | 
|  | 49 | +    "fmodel = FlorisModel(\"defaults\") # Defaults to NREL 5MW turbine\n", | 
|  | 50 | +    "fmodel.set(\n", | 
|  | 51 | +    "    wind_data=TimeSeries(\n", | 
|  | 52 | +    "        wind_directions=np.zeros(n_wind_speeds),\n", | 
|  | 53 | +    "        wind_speeds=wind_speeds,\n", | 
|  | 54 | +    "        turbulence_intensities=0.06\n", | 
|  | 55 | +    "    ),\n", | 
|  | 56 | +    "    layout_x=[0],\n", | 
|  | 57 | +    "    layout_y=[0],\n", | 
|  | 58 | +    "    wind_shear=0.0,\n", | 
|  | 59 | +    "    turbine_type=[\"iea_15MW_floating_multi_dim_cp_ct\"],\n", | 
|  | 60 | +    "    reference_wind_height=-1,\n", | 
|  | 61 | +    ")\n", | 
|  | 62 | +    "\n", | 
|  | 63 | +    "# Now, we need to specify what external parameters to run the model for\n", | 
|  | 64 | +    "fmodel.set(multidim_conditions={\"Tp\": 2, \"Hs\": 1})\n", | 
|  | 65 | +    "fmodel.run()\n", | 
|  | 66 | +    "\n", | 
|  | 67 | +    "powers = fmodel.get_turbine_powers()\n", | 
|  | 68 | +    "thrust_coefficients = fmodel.get_turbine_thrust_coefficients()\n", | 
|  | 69 | +    "\n", | 
|  | 70 | +    "fig, ax = plt.subplots(2, 1, sharex=True)\n", | 
|  | 71 | +    "ax[0].plot(wind_speeds, powers, label=\"First condition\")\n", | 
|  | 72 | +    "ax[0].grid()\n", | 
|  | 73 | +    "ax[0].set_ylabel(\"Power [kW]\")\n", | 
|  | 74 | +    "ax[1].plot(wind_speeds, thrust_coefficients)\n", | 
|  | 75 | +    "ax[1].grid()\n", | 
|  | 76 | +    "ax[1].set_ylabel(\"Thrust coefficient [-]\")\n", | 
|  | 77 | +    "ax[1].set_xlabel(\"Wind speed [m/s]\")\n", | 
|  | 78 | +    "ax[1].set_xlim([0, 30])\n", | 
|  | 79 | +    "\n", | 
|  | 80 | +    "# Set a second multidimensional condition and rerun\n", | 
|  | 81 | +    "fmodel.set(multidim_conditions={\"Tp\": 4, \"Hs\": 5})\n", | 
|  | 82 | +    "fmodel.run()\n", | 
|  | 83 | +    "\n", | 
|  | 84 | +    "powers = fmodel.get_turbine_powers()\n", | 
|  | 85 | +    "thrust_coefficients = fmodel.get_turbine_thrust_coefficients()\n", | 
|  | 86 | +    "ax[0].plot(wind_speeds, powers, label=\"Second condition\")\n", | 
|  | 87 | +    "ax[0].legend(loc=\"upper left\")\n", | 
|  | 88 | +    "ax[1].plot(wind_speeds, thrust_coefficients)" | 
|  | 89 | +   ] | 
|  | 90 | +  }, | 
|  | 91 | +  { | 
|  | 92 | +   "cell_type": "markdown", | 
|  | 93 | +   "id": "98fd51f6", | 
|  | 94 | +   "metadata": {}, | 
|  | 95 | +   "source": [ | 
|  | 96 | +    "Note that this example is not meant to be represntative of a real turbine, but rather to illustrate\n", | 
|  | 97 | +    "the functionality. At this time, FLORIS only support a single external condition combination at a\n", | 
|  | 98 | +    "time, but multiple combinations can be run sequentially as is shown above." | 
|  | 99 | +   ] | 
|  | 100 | +  }, | 
|  | 101 | +  { | 
|  | 102 | +   "cell_type": "markdown", | 
|  | 103 | +   "id": "8c21f432", | 
|  | 104 | +   "metadata": {}, | 
|  | 105 | +   "source": [] | 
|  | 106 | +  } | 
|  | 107 | + ], | 
|  | 108 | + "metadata": { | 
|  | 109 | +  "kernelspec": { | 
|  | 110 | +   "display_name": "floris", | 
|  | 111 | +   "language": "python", | 
|  | 112 | +   "name": "python3" | 
|  | 113 | +  }, | 
|  | 114 | +  "language_info": { | 
|  | 115 | +   "codemirror_mode": { | 
|  | 116 | +    "name": "ipython", | 
|  | 117 | +    "version": 3 | 
|  | 118 | +   }, | 
|  | 119 | +   "file_extension": ".py", | 
|  | 120 | +   "mimetype": "text/x-python", | 
|  | 121 | +   "name": "python", | 
|  | 122 | +   "nbconvert_exporter": "python", | 
|  | 123 | +   "pygments_lexer": "ipython3", | 
|  | 124 | +   "version": "3.13.2" | 
|  | 125 | +  } | 
|  | 126 | + }, | 
|  | 127 | + "nbformat": 4, | 
|  | 128 | + "nbformat_minor": 5 | 
|  | 129 | +} | 
0 commit comments