# Evaluate Average Power Delivered by Wind Turbine

This example shows how to compute the average power output of a wind turbine using Symbolic Math Toolbox™ and Statistics and Machine Learning Toolbox™. In this example, you define a parametric analytical expression that models the conversion of wind energy to turbine power. Then you evaluate the average power output by assuming that the wind speed follows a Weibull distribution.

### Define Model for Wind Turbine

You can estimate the total power delivered to a wind turbine by taking the derivative of the wind kinetic energy.

`${\mathit{P}}_{\mathit{w}}=\frac{1}{2}\text{\hspace{0.17em}}\frac{\mathit{d}}{\mathit{dt}}\left(\rho \text{\hspace{0.17em}}\mathit{A}\text{\hspace{0.17em}}\mathit{x}\right)\text{\hspace{0.17em}}{\mathit{u}}^{2}=\frac{\rho {\text{\hspace{0.17em}}\mathit{A}\text{\hspace{0.17em}}\mathit{u}}^{3}}{2}$`

The parameters of this equation are:

• $A$ – The swept area of turbine blades, in ${\mathrm{m}}^{2}$

• $\rho$ – The air density, in $\mathrm{kg}/{\mathrm{m}}^{3}$

• $u$ – The wind speed, in $\mathrm{m}/\mathrm{s}$

The process of converting wind energy to electrical power results in efficiency losses, as described in this diagram.

This equation describes the electrical power output of a practical wind turbine ${P}_{e}$.

`${\mathit{P}}_{\mathit{e}}\left(\mathit{u}\right)=\frac{{\mathit{C}}_{\mathrm{tot}}\left(\mathit{u}\right)\text{\hspace{0.17em}\hspace{0.17em}}\rho {\text{\hspace{0.17em}}\mathit{A}\text{\hspace{0.17em}}\mathit{u}}^{3}}{2}$`

where ${\mathit{C}}_{\mathrm{tot}}\left(\mathit{u}\right)={\mathit{C}}_{\mathit{p}}{\mathit{C}}_{\mathit{t}}{\mathit{C}}_{\mathit{g}}$ is the overall efficiency or conversion factor of the wind energy that depends on the wind speed.

The overall efficiency is between 0.3 and 0.5, varying with both wind speed and rotational speed of the turbine. For a fixed rotational speed, the electrical power delivered by the wind turbine reaches its maximum (${\mathit{P}}_{\mathrm{er}}$) at a rated wind speed. The overall efficiency at this rated wind speed is expressed as ${\mathit{C}}_{\mathrm{totR}}$.

`${\mathit{P}}_{\mathrm{er}}=\frac{{\mathit{C}}_{\mathrm{totR}}\text{\hspace{0.17em}\hspace{0.17em}}\rho \text{\hspace{0.17em}}\mathit{A}{\text{\hspace{0.17em}}\mathit{u}}^{3}}{2}$`

Assuming a fixed rotational speed, the electrical power output of the wind turbine depends on the wind speed. This graph estimates the profile of ${P}_{e}$ as a function of $u$.

The parameters of the graph are:

• ${\mathit{u}}_{\mathit{c}}$ – The cut-in speed, or the speed at which the electrical power output rises above zero and power production starts

• ${\mathit{u}}_{\mathit{r}}$ – The rated wind speed

• ${\mathit{u}}_{\mathit{f}}$ – The furling wind speed, or the speed at which the turbine shuts down to prevent structural damage

The profile of the power output increases between ${u}_{c}$ and ${u}_{r}$. In this region, the power output ${P}_{e}$ depends on $u$ exponentially, that is, raised to the power of $k$. In the region between ${\mathit{u}}_{\mathit{r}}$ and ${\mathit{u}}_{\mathit{f}}$, the power output is at a constant maximum value of ${P}_{er}$. For all other conditions, the power output is zero.

### Define Piecewise Function for Power Output

Describe the turbine power output by defining a piecewise function. Assume that wind speed $u$ and the parameters ${u}_{c}$, ${u}_{r}$, ${u}_{f}$, $k$, and ${P}_{er}$ are positive real numbers. Also assume that the cut-in speed is less than the rated wind speed, which is less than the furling wind speed.

```syms C_1 C_2 syms u u_c u_r u_f k P_er positive real assume(0 < u_c < u_r < u_f) Pe(u) = piecewise(u < u_c, 0, ... u_c <= u <= u_r, C_1 + C_2*u^k, ... u_r < u <= u_f, P_er, ... u_f < u, 0)```
```Pe(u) =  ```

Based on the conditions where ${P}_{e}\left({u}_{c}\right)=0$ and ${P}_{e}\left({u}_{r}\right)={P}_{er}$, solve for the coefficients ${\mathit{C}}_{1}$ and ${\mathit{C}}_{2}$.

`sol = solve([Pe(u_c) == 0; Pe(u_r) == P_er],[C_1 C_2]);`

Substitute the solutions for ${C}_{1}$ and ${C}_{2}$ into the piecewise function.

`Pe = subs(Pe,{C_1,C_2},{sol.C_1,sol.C_2})`
```Pe(u) =  ```

### Define Profile of Wind Speed

The rated power output indicates how much power a wind turbine is capable of producing. However, the turbine power output depends on the wind speed. To calculate the average power produced by the turbine, you need to account for external wind conditions. In this example, use the Weibull distribution to model the wind speed. The wind profile follows the Weibull probability density function.

`$f\phantom{\rule{-0.16666666666666666em}{0ex}}\left(u\right)=\frac{\left(\frac{b}{a}\right)\phantom{\rule{0.16666666666666666em}{0ex}}{\left(\frac{u}{a}\right)}^{b-1}}{{\mathrm{e}}^{{\left(\frac{u}{a}\right)}^{b}}}\text{\hspace{0.17em}}\mathrm{if}\text{\hspace{0.17em}}\mathit{u}\ge 0$`

The parameters $a$ and $b$ represent scale and shape, respectively. In general, a larger value of $a$ indicates a higher median wind speed, and a larger value of $b$ indicates a reduced variability in the wind speed.

To generate random numbers from the Weibull Distribution (Statistics and Machine Learning Toolbox), you can use the `wblrnd` function. For example, choose the parameters $a=12.5$ and $b=2.2$. Generate 1000 random numbers that follow the Weibull distribution. Plot these random numbers as a histogram that is normalized to the probability density function.

```a = 12.5; b = 2.2; N = 1000; r = wblrnd(a,b,[1 N]); histogram(r,15,Normalization="pdf")```

To generate the Weibull probability density function (pdf), use `wblpdf`. Plot the pdf and compare it with the histogram plot of the sampled random numbers.

```hold on x = linspace(0,34,N); y = wblpdf(x,a,b); plot(x,y,LineWidth=2) hold off title("Weibull Distribution of Wind Speeds") xlabel("Wind Speed (m/s)")```

### Calculate Average Power Output

You can calculate the average power output of a wind turbine by using this integral.

`$\stackrel{‾}{{\mathit{P}}_{\mathit{e}}}={\int }_{0}^{\infty }{P}_{\mathit{e}}\left(u\right)\phantom{\rule{0.16666666666666666em}{0ex}}f\left(u\right)\text{\hspace{0.17em}}du$`

Define the Weibull pdf analytically, and assume the parameters $a$ and $b$ are positive real numbers.

```syms a b positive real f(u) = (b/a)*(u/a)^(b-1)/exp((u/a)^b)```
```f(u) =  $\frac{b {\mathrm{e}}^{-{\left(\frac{u}{a}\right)}^{b}} {\left(\frac{u}{a}\right)}^{b-1}}{a}$```

Find the integrand you can use to evaluate the average power output.

`Pintegrand(u) = simplify(Pe(u)*f(u))`
```Pintegrand(u) =  ```

Perform the integration with respect to the wind speed $u$ with the bounds from $0$ to $\infty$ by using `int`. The resulting analytical expression represents the average power output of the wind turbine.

`Pav = int(Pintegrand,u,0,Inf)`
```Pav =  ```

To evaluate the average power output for specific parameter values, you can use the `subs` function. For example, find the average power output for these parameters.

```params.a = 12.5; params.b = 2.2; params.k = 2; params.uc = 5; params.ur = 15; params.uf = 40; params.Per = 2e5; Pav = subs(Pav,{a b k u_c u_r u_f P_er},{params.a params.b params.k params.uc params.ur params.uf params.Per})```
```Pav =  ```

The result is an exact symbolic number that involves the exponential function and the gamma function. You can use `double` to convert the symbolic number to a double-precision number.

`Pav_num = double(Pav)`
```Pav_num = 9.7744e+04 ```

You can use the parametric expression defined in this example to evaluate various wind turbine configurations and wind farm sites. For more information, see Wind Resource Assessment.