**1. Introduction**

Electricity is indispensable for the growth of a country, so it is essential to increase energy generation and meet the growing demand. Generating energy by traditional means such as petroleum products compromises the ecological balance of future generations. To take advantage of the natural resources that exist locally is to o ffer the population economic growth possibilities, wind energy is an alternative, using the force of the wind to convert it into electricity through a wind turbine [1]. Globally, wind energy has been booming, the Global Wind Energy Council (GWEC) in February 2018 reported that in 2017, more than 54 GW of wind energy were installed in more than 90 countries, nine of them with more than 10,000 MW installed and 29 that have now exceeded 1000 MW, increasing the accumulated capacity to 486.8 GW, 12.6% more than in 2016 [2]. In Mexico, the wind resource is currently being investigated [3], wind infrastructure has grown 300% in the last six years, the Asociación Mexicana de Energía Eólica (AMDEE) estimates that in 2024, 10,000 MW [4] will be reached and predicted that by 2031 14,000 MW [5] will be generated. The city of Querétaro has considerable wind potential [6], with an average annual wind speed of 7.3 m/s, NE/SW direction with a probability of the presence of 26% that defines it as a viable candidate for the incorporation of small wind turbines [7]. The Universidad Autónoma de Querétaro (UAQ) is working on the technological development of wind turbines with the design of its blades and the control of its systems, by now, three 14 KW wind turbines with two and three blades have been installed [8].

The amount of energy that can be obtained from a wind turbine is a function of the size of the rotor. The greater the length of the blades, the more energy is produced, so the capacity and size of wind turbines have increased exponentially in the last decade. The commonly used wind turbine has a diameter of 125 m sweeping area capable of producing up to 7.5 MW [9]. However, since 2016, it is more common to see wind turbines with a nominal power of 9.5 MW [10]. The V164-10 model capable of generating up to 10 MW is available for sale now and can be delivered for commercial installation until 2021 [11].

Technological advances in wind power generation systems focus on increasing the size of the rotor, which requires large plains, with a considerable wind resource. However, in complex terrain with hills, trees or buildings, where the wind resource is smaller, the installation of "small wind turbines" is necessary [12]. The international standard IEC 61400-1: 2014 defines "small wind turbines" those with an area of the rotor sweep less than or equal to 200 m<sup>2</sup> and a generation voltage less than 1000 V AC or 1500 V DC for both on-grid and off-grid applications [13].

The problem of installing wind turbines in this type of places is the randomness of the wind, it is necessary to use turbines that operate with different speeds to take full advantage of this natural resource, so it follows that for each wind speed there is an ideal rotation speed. This is called the optimum tip speed ratio (TSR), and it is different for each wind turbine according to its size and aerodynamic model [14]. The angle of inclination of the blade should be controlled in a wind turbine to maximize energy production, regulate the speed of rotation of the rotor, mitigate dynamic loads and ensure a continuous supply of energy to the network [15].

The pitch angle controller is based on rotating the blades simultaneously, with an independent or shared actuator. The angle used with the wind speed below the nominal value is zero, and then the angle increases when the wind speed is greater than the nominal speed [16]. The control method for the classic pitch angle is the PI [17,18]. The control strategy works correctly when the dynamics of the system is stable, however, the sensitivity of the generator's rotation speed to the pitch angle varies differently. If the wind speed is close to the nominal speed, the sensitivity of the generator shaft speed to the pitch angle is very small. Therefore, a higher response speed is required than at higher wind speeds, where a small change in the angle can have a large effect on the speed of the generator shaft. Nonlinear variation of the pitch angle versus wind speed implies the need for non-linear control, which means a constant change in the response speed of the controller according to the wind speed and the value of the change in the speed of the wind [19].

A literature review was carried out and it was found that there are different authors who have worked to solve the problem of nonlinearity for pitch control in a wind turbine [20]. In [21–23] a fuzzy logic control (FLC) was combined with proportional-integral-derivative control (PID), FLC is the means to change previously calculated PID gains according to the process variable error, if the error is negative or positive or if the measured value greatly exceeds. In [24], a control method based on an artificial neural networks (ANN) adapter was presented in which the parameters of the PID neural network were automatically regulated. The improved gradient descent method was used to optimize the weights of the networks and to avoid the weights of the neural network. In [25], a PID control model was designed, a gain programming procedure was planned using differential evolution optimization algorithm to apply to the appropriate controller as the operating point changes. In [17,26], the authors used a PI controller, however, the proportional gain *Kp* and the integral gain *Ki* were adjusted through the particle swarm optimization algorithm. In [27], a pitch controller based on the moth-flame optimization algorithm was proposed, the candidate solutions were moths and the PID parameters were the position of the moths in the search space. Therefore, moths can fly in a 3D space that represents the three parameters of the controller *Kp*, *Ki,* and *Kd* with the change of their position vectors.

In this document, we propose a PI controller, an optimization algorithm based on teaching–learning was developed that calculates the optimal gains for any change in wind speed. PI controller uses the error value between the measured speed of the generator shaft and the optimum value according to the wind speed, to determine the reference value of the inclination angle. The wind speed and the value of the magnitude of the change between each speed are evaluated in the proposed algorithm to calculate the value of the PI gains suitable for the adequate response time of the controller, so it can be adapted to any sudden changes in wind speed.

The implementation of the teaching–learning optimization method applied to the pitch control of a wind turbine is an important innovation for this type of application. Unlike the controllers mentioned above, this control model o ffers to researchers in this field a control alternative, with an algorithm that adjusts to wind conditions and converges on a solution in a shorter time because it uses the best solution of the iteration to change the existing solution in the population, in addition to using a minimum of computer resources since it only uses simple arithmetic operations such as sums and divisions, so the controller suppresses transitory excursions and achieve a good and fast regulation in the operation of the stable state.

Di fferent simulations of the dynamic model were carried out to preset initial values of the control algorithm, and they were adjusted experimentally with a 14 KW wind turbine, two blades, 12 m in diameter, with a permanent magne<sup>t</sup> synchronous generator (PMSG) installed at the UAQ airport campus.

#### **2. Wind Turbines**

The turbines are composed of three main parts, the rotor of blades that converts the kinetic energy from the wind to mechanical energy, the gearbox that multiplies the speed of the rotor and transmits it to the rotational shaft of the generator, and the electric generator [28]. Additionally, some systems convert AC to DC using a rectifier and convert DC back to AC to match the frequency and phase of the network [29]. A diagram of a wind turbine is shown in Figure 1.

**Figure 1.** Parts of a wind turbine.

#### *2.1. Mathematical Model*

The mathematical model of the wind turbine is made by subsystems, the aerodynamic model of the rotor, the mechanical model and the electric model of the generator are determined.

To perform an aerodynamic analysis of how to extract the maximum power of the wind that passes through a turbine, the wind that crosses the sweeping area of the rotor is determined. The rotor power *Protor* extracted by the blades is described with the Equation (1) [30].

$$P\_{rotor} = \frac{1}{2} \rho \, A \, V^{\beta} \, \mathbb{C}\_p \tag{1}$$

where the wind density is ρ*, A* is the swept area, *V* is the wind speed before the turbine. *Cp* is the power coefficient, which can be expressed in approximate method depending on tip speed ratio λ, that is the ratio between the tangential speed of the tip of a blade and the actual speed of the wind and on the pitch angle of the blade β, based on the characteristics of the turbine [31,32]. *Cp* is defined as:

$$\mathbb{C}\_{p}(\lambda,\beta) = 0.5176 \Big( \frac{116}{\lambda\_{i}} - 0.4\beta - 5 \Big) e^{-\frac{21}{\lambda\_{i}}} + 0.0068\lambda \tag{2}$$

where:

$$
\lambda\_i = \left[ \left( \frac{1}{\lambda + 0.08\beta} \right) - \left( \frac{0.035}{\beta^3 + 1} \right) \right]^{-1} \tag{3}
$$

$$
\lambda = \frac{\Omega R}{V} = \frac{2\pi nR}{60V} \tag{4}
$$

Ω is the rotation frequency in rad/sec, *n* is the speed of rotation in rpm and *R* is the radius of the rotor. Once the *Cp* has been calculated, it is possible to determine the torque of the rotor *Trotor* with the following equation: [33,34].

$$T\_{\text{rotor}} = \frac{1}{2} \rho \text{ } \pi \text{ } \text{R}^3 \text{V}^2 \text{ C}\_t \tag{5}$$

where torque coefficient *Ct* is defined as:

$$\mathbf{C}\_{l} = \frac{\mathbf{C}\_{p}}{\lambda} \tag{6}$$

The mechanical system transmits the mechanical torque of the rotor, multiplies the speed of the rotor shaft *n* times towards the generator shaft. The mathematical model of the mechanical system can be simplified throughout the system into a two masses model, which is the most common model for wind turbine transmissions and can be used without losing accuracy [35,36]. In the mechanical model, the aerodynamic torque of the wind turbine rotor and the electromechanical torque of the generator act in opposition to each other and are the inputs to the model, while the rotation speeds are the output [37,38]. The mathematical model is represented by the Equations (7) y (8). The model of two masses proposed by [19] is shown in Figure 2.

**Figure 2.** Two masses model of a wind turbine.

$$-2H\_{\rm rotor} \frac{dw\_{\rm rotor}}{dt} = T\_{\rm rotor} - d\_{\rm sh} \left(w\_{\rm rotor} - w\_{\rm gm}\right) - k\_{\rm sh} \left(\theta\_{\rm rotor} - \theta\_{\rm gm}\right) \tag{7}$$

$$2H\_{\text{gen}}\frac{dw\_{\text{gen}}}{dt} = d\_{\text{sh}}(w\_{\text{rotor}} - w\_{\text{gen}}) + k\_{\text{sh}}(\theta\_{\text{rotor}} - \theta\_{\text{gen}}) - T\_{\text{gen}} \tag{8}$$

where the inertial constant depends exclusively on the geometry and distribution of the mass of the element. The elasticity between adjacent masses is expressed by the spring constant *ksh* and the mutual damping between adjacent masses is expressed by *dsh* [36,37]. θ*rotor* is the rotor angular position and <sup>θ</sup>*gen* is the generator angular position. *Hrotor* and *Hgen* are the rotor inertia and generator inertia, respectively.

The inertial moments *Hrotor* and *Hgen* are calculated according to:

$$H\_{rotor} = \frac{J\_{rotor} \cdot w\_{rotor}^2}{2 \ P\_n} \tag{9}$$

$$H\_{\text{\ $^{\text{eu}}}} = \frac{J\_{\text{\$ ^{\text{eu}}}} \cdot w\_{\text{\ $^{\text{eu}}}}^2}{2 \, P\_{\text{\$ ^{\text{eu}}}}} \tag{10}$$

*Jgen* is the inertia of the generator and is regularly provided by the manufacturer. In the case of the inertia of the rotor *Jrotor* it can be approximated according to:

$$J\_{ntor} = \frac{1}{8} m\_r R^2 \tag{11}$$

where *mr* represents the mass of the rotor (includes the mass of the blades).

The generator is electromechanical equipment that converts mechanical power into electrical power, uses a stator and a rotor. The stator is a housing with coils mounted around it. The rotor is the rotating part and is responsible for producing a magnetic field, it can be a permanent magne<sup>t</sup> or an electromagnet. When rotating, its magnetic field is induced to the stator windings causing a voltage at the stator terminals [28]. According to the needs of the market, the synchronous permanent magne<sup>t</sup> generator (PMSG) is used commonly because of its adaptation to variable-speed turbines [38]. The PMSG has a high efficiency since its excitation is provided without any power supply. It requires the use of an AC/DC/AC power converter to adjust voltage and frequency to the supply network [39].

For the mathematical modeling of a PMSG, the three phases are transformed into an equivalent of two axes. This is because each one acts in a defined geometric space of the air gap. With the direct axis (*d*) in phase with the winding of the rotor field and the quadrature or displacement axis (*q*), 90 electrical degrees forward in a synchronous rotating *d-q* reference frame. Magnetic flux waves due to the winding of the stator are presented in two sinusoidal waves distributed rotating with a synchronous speed such that one is the maximum point on the axis *d,* and the other is the maximum point on the axis *q*. The stator output voltages *d-q* of this generator are given respectively by Equations (12) and (13) [40].

$$dV\_d = R\_d I + L\_d \frac{dI\_d}{dt} - \omega\_{\text{gcn}} L\_d I\_q \tag{12}$$

$$V\_q = R\_q I\_q + L\_q \frac{dI\_q}{dt} + \omega\_{\text{gen}} \left( L\_d I\_d + q c\_f \right) \tag{13}$$

where *L* are the inductances of the generator, *R* is the resistance and *I* is the currents in the axes *d* and *q,* respectively. ϕ*f* is the permanent magnetic flux. <sup>ω</sup>*gen* is the rotation speed of the PMSG.

$$
\omega\_{\mathcal{S}^{en}} = P\_p \omega\_{ref} \tag{14}
$$

*Pp* is the number of pairs of poles. Electromechanical torque *Tgen* can be express as:

$$T\_{\mathcal{S}^{\rm ren}} = \frac{3}{2} P\_{\mathcal{P}} \alpha\_{\rm ref} \left( \left( L\_{\rm q} - L\_{\rm d} \right) i\_{\rm d} i\_{\rm q} + q \rho\_f i\_{\rm q} \right) \tag{15}$$

<sup>ω</sup>*ref* is the reference speed to control the speed of the generator shaft. The model reference speed is normally 120% but is reduced for power levels below 46% [41]. This behavior is represented in the model by using the following equation:

$$w\_{ref} = -0.75P^2 + 1.59P + 0.63\tag{16}$$

*P* is the electric power. In the controller, the speed reference is not directly a function of power, but the overall e ffect on the speed/power relationship is similar.

#### *2.2. Control System*

The complexity of modern wind turbines forces its control systems to ensure safe and e fficient operation. The objective of control systems is to ensure a continuous supply of energy to the grid, maximize energy production, and mitigate dynamic and static mechanical loads. The pitch angle of the blade, the torque of the generator, and the frequency on the grid are the main parameters that must be controlled [42].

The definition of the control objectives depends on the operating regions of the wind turbine. These are closely related to wind speed, and one can identify four operating regions according to the wind speed. Region I represents the wind speed at which the rotor cannot move, so the rotation speed is zero. When the rotor begins to rotate, enters region II, this region is limited by the starting speed and wind speed where the generator rotates at its nominal speed. The objective of control in this region is to maximize energy production through MPPT strategies. Region III starts from the nominal speed to the stopping speed, which is the design speed limit and is required to stop rotation for safety. To maintain the constant nominal rotation speed, the pitch control is used. However, MPPT control is also used in this region to smooth out abrupt changes in wind speed, where the mechanical restrictions of the pitch system do not allow a rapid response. Finally, region IV is where the wind turbine must be stopped even with a mechanical brake [42,43].

The pitch control system in a wind turbine is used to regulate the power of the rotor, control its speed of rotation and stop the rotor out of the action of the wind. In region III, during high-burst winds, it is necessary to control the rotation speed of the rotor to protect the generator and electronic equipment from overloads. The inertia of the large rotors in acceleration and deceleration must be considered to decrease the dynamic mechanical stresses in the blades and the tower. The speed of rotation is variable with the angle of incidence. This angle is formed between the line of direction of the wind and line that marks the side of the blade. This angle of incidence is increased to take advantage of the wind speed and is reduced when the speed of rotation increases. The adjustment of this angle is made to keep the power captured by the wind constant. The angle of incidence changes with the pitch angle, which is the angle of rotation of the blade with respect to its axis. Consequently, the power coe fficient is a ffected by the evolution of the pitch angle [44].

In Figure 3, the power coe fficient curves with di fferent values of the pitch angle are shown. When the angle value increases, the power coe fficient decreases, the captured wind power is reduced, and there is a reduction in the rotor velocity.

**Figure 3.** Power coe fficient curves for di fferent pitch angle values (β).

The control model used is a PI controller with feedback [17]. The purpose of a feedback control system is to reduce the error *e(k)* to zero between the variable to control and its reference value as quickly as possible. The error is expressed as:

$$
\sigma(k) = \omega\_{nf} - \omega\_{rotor}(t) \tag{17}
$$

The pitch control signal *u(t)* to the plant is equal to the proportional gain *Kp* times the magnitude of the error plus the integral gain *Ki* times the sum of the errors of samples, *k* is the sample number from a total of *ksim* samples.

$$
\mu(t) = K\_p \varepsilon(k) + K\_i \sum\_{k=1}^{k\_{\rm sim}} \varepsilon(t) \tag{18}
$$

To select the parameters of the *Kp* and *Ki* controller that comply with the presumed behavior of the system, it is proposed to follow the tuning rules of Ziegler–Nichols [45] based on the experimental responses to a step input. However, there may be a large overshoot in your response that is unacceptable, so a series of fine adjustments is necessary until the desired result is obtained.

The pitch angle command activates a mechanic system back and forth for the pitch control system. The faster the settling, the lesser the mechanical stress on the turbine and structure.

#### **3. Intelligent Search Algorithms Teaching–Learning**

Teaching–learning-based optimization (TLBO) is based on the teaching and learning process in a classroom. In each generation, the best candidate solution in the population is considered the teacher, and the other candidate solutions are considered learners. The learners mostly accept instruction from the teacher, but also learn from each other. The score of an academic subject is analogous to the value of an independent variable or candidate solution feature [46,47]. The steps of the algorithm are described below.

Step 1: Define the optimization parameters.

Population size (*Pn*), Number of generations (*Gn*), Number of design variables (*Dn*), Limits of design variables (*LU, LL*). Objective function *f (x)* Define the problem: Maximize *f (x),* minimize *f (x).* X is a vector of design variables such that:

$$L\_{L,i} \le \mathbf{x}\_i \le L\_{L,i} \qquad : \qquad X\_i \in \mathbf{x}\_i = \mathbf{1}, \mathbf{2}, \dots, Dn$$

Step 2: Initialize the population.

Generate a random population according to the size of the population and the number of design variables. For TLBO, the size of the population indicates the number of students, and the design variables indicate the subjects that are o ffered. This population is expressed as:

$$Population = \begin{bmatrix} \mathbf{x}\_{1,1} & \mathbf{x}\_{1,2} & & \cdots & \mathbf{x}\_{1,D} \\ & \mathbf{x}\_{2,1} & \mathbf{x}\_{2,2} & & \cdots & \mathbf{x}\_{2,D} \\ & & \vdots & & \vdots & \vdots \\ & & \mathbf{x}\_{Pn,1} & \mathbf{x}\_{Pn,2} & & \cdots & \mathbf{x}\_{Pn,D} \end{bmatrix} \tag{19}$$

Step 3: Teacher Phase.

Calculate the average of the population, which will give the average for the subject as:

$$M\_D = [m\_1, m\_2, m\_3, \dots, m\_D] \tag{20}$$

The best solution *Tf(x)max,min* will be teacher *Tteacher* for that iteration

$$T\_{\text{teacher}} = T\_{f(\mathbf{x}) = \text{max}, \text{min}} \tag{21}$$

The teacher will change the mean of *MD* to *Xteacher*, which will act as a new average for the iteration.

$$M\_{\text{unr},D} = X\_{\text{triangle},D} \tag{22}$$

The di fference between two means is expressed as:

$$Difference\_D = r(M\_{new\_\iota D} - T\_F M\_D) \tag{23}$$

*r* is a random number in a range [0,1]. The value of *TF* is selected as 1 or 2. Teaching value that decides the value of the mean to be changed. No design value is random, given by the algorithm:

$$T\_F = round[1 + rand(0, 1)(2 - 1)]\tag{24}$$

The di fference obtained is added to the current solution to update its values using:

$$X\_{new,D} = X\_{old,D} + Difference\_D \tag{25}$$

Accept *Xnew* if you give the function a better value.

Step 4: Learning Phase.

A student interacts randomly with other students. A student learns something new if the other student has more knowledge than he does. Randomly select two learners *Xi* and *Xj*, where *i* - *j*.

The knowledge of both students is compared.

$$\text{IF } \ f(X\_i) < f(X\_j) \quad \rightarrow \quad X\_{new,i} = X\_{old,i} + r\_i(X\_i - X\_j) \tag{26}$$

$$\text{IF } \ f(X\_i) > f(X\_j) \quad \rightarrow \quad X\_{new,i} = X\_{old,i} + r\_i(X\_j - X\_i) \tag{27}$$

When all the students have interacted, accept *Xnew* if you give the function a better value. Step 5: Termination criterion.

Stop if the maximum generation number is reached, otherwise, repeat from step 3. Figure 4 shows a flow diagram of this algorithm.

**Figure 4.** Flow chart for teaching–learning-based optimization.

This optimization method was selected since it converges on a solution in a shorter time compared to other known algorithms, this is because it uses the best iteration solution to change the optimal reference solution existing in the population, in addition to using a minimum of computer resources since it only uses simple arithmetic operations such as sums and divisions.

A performance analysis of the proposed algorithm was developed and compared with other intelligent search techniques such as genetic algorithm (GA) [48], simulated annealing (SA) [46], ant colony optimization (ACO) [46], di fferential evolution (DE) [46], and firefly algorithm (FA) [46], particle swarm optimization (PSO) [26], moth flame optimization (MFO) [27]. Test functions (28) suggested in [48] were used.

$$f(\mathbf{x}\_1, \mathbf{x}\_2) = (\mathbf{x}\_1 - 10)^3 + (\mathbf{x}\_2 - 20)^3 \tag{28}$$

$$\text{for } 13 \le \mathbf{x}\_1 \le 100 \quad \& \quad 0 \le \mathbf{x}\_2 \le 100 \tag{29}$$

This equation was selected due to its similarity to the objective function, since it has higher and non-linear terms of order, in addition to being initialized at a starting point (first solution). Another important feature is the mathematical minimization problem with two variables, as in the application of the wind turbine, it is necessary to find the value of the variables *kp, ki* that minimize the error in the controlled variable. Table 1 lists the specifications with which the test was performed.



From this analysis, the computation time for the search for each optimal solution was obtained. The computational resource was an HP Workstation i-7 processor and 32Gb RAM, 64bit, for all tests. The optimum value is:

$$f(\mathbf{x}\_1, \mathbf{x}\_2) = -6961.8138\tag{30}$$

$$\text{for } \ge\_1 = 14.095 \text{ \&\ } \text{ \&\ } \ge\_2 = 0.84296\tag{31}$$

Table 2 shows this comparison, where it is evident that the teaching–learning algorithm obtained a better performance.


**Table 2.** Performance analysis of the teaching–learning algorithm compared with other intelligent search techniques.

According to the results presented in the previous table, the TLBO algorithm had better results in the computation time and obtained a minor error in relation to the exact known solution, this is due to the advantages of the algorithm. The advantages of the algorithm are that it does not require any parameters to adjust, which simplifies the implementation, uses the best solution of the iteration to change the existing solution in the population which increases the convergence rate. TLBO does not divide the population as other algorithms do, but it uses two di fferent phases, the "teacher phase" and the "student phase", so that new random solutions can be evaluated, and no time is spent evaluating the same solutions among themselves. The disadvantage is that no measures are taken to handle the limitations of the problem. Solution selection is only done in a heuristic way by comparing two solutions.
