**4. Methodology**

The proposed methodology for the optimization of the use of wind energy for the generation of electric energy through a PI controller with variable gains includes the following steps. First, know the available wind resource by making a preliminary study of the historical records of the climatic conditions at the installation site, as well as having physical knowledge of the wind turbine. This will allow us to characterize the wind behavior statistically to know the limits of wind conditions. Second, design a PI controller for the pitch angle, tuned for a response speed according to the sensitivity presented by the system, in a range of nominal wind speed values. This allows us to keep the controller in a stable state with typical winds. Third, once the response values of the controller are in their stable state, the limitations and operating ranges of the controller are proposed to establish the optimization parameters of the TLBO algorithm, which will improve the response of the controlled when atypical winds occur, such as bursts or turbulence.

#### *4.1. Wind Resourse and Wind Turbine Specifications*

The wind turbine used for experimentation is located at the UAQ, airport campus, road to Chichimequillas s/n, Ejido Bolaños, Querétaro, Qro. Z.C. 76140. The geographic location 20◦37'24.1" North and 100◦22'06.0" West and an altitude of 1969 m a.s.l. Figure 5 is an image of the airport campus of the autonomous university of Queretaro, where the wind turbine and the adjacent buildings are shown.

**Figure 5.** Universidad Autónoma de Querétaro, airport campus.

This research incorporates aerodynamic modeling based on a meteorological study with data collected in the weather station #76628 SMN-CONAGUA network, located in the place, with stored data from the last five years. The average annual recorded speed is 3.9 m/s, and the range of recorded wind speed values is between 0 and 15.69 m/s.

This wind turbine is a NACA 6812 airfoil with two blades of 6.4 m in length and 1.2 m at their widest point, constructed of fiberglass and polyester resin, weighing 260 kg each. The height of the tower is 18 meters. There is a multiplier box with a ratio of 1: 2.1, and a permanent magne<sup>t</sup> generator with a rated power of 14 KW at 14.6 rad/s speed.

#### *4.2. Pitch Control*

To form the plant to be controlled, the di fferent mathematical models were integrated, in the dynamic model, the input data is wind speed that is the disturbance of the system and the pitch angle that is a variable that is originated in the controller, the output is the mechanical torque of the low-speed shaft. The information we obtained from the mechanical model is the rotation speed of the shaft at the output of the multiplier box or high-speed shaft. In the generator model, the generated electrical power was calculated and due to its electromagnetic properties, the torque of the generator, which in turn is a force opposing the rotor torque. The controlled variable is the speed of rotation of the rotor. The limitation in this control model is the speed of rotation of the blade, the maximum speed is 1.5 ◦/s because a 0.5 HP motor mechanically spins a reducer with a 60:1 ratio, which increases the torque to counteract the e ffects of air on the blade, but greatly decreases the speed. The control model that describes the operation of the systems is shown in Figure 6.

**Figure 6.** Proportional-integral (PI) pitch control model.

The controller gains were established empirically by performing various simulations in MatLab-Simulink R2018b V9.5.0.944444 program. The wind speed from 0 m/s to 15.69 m/s, maximum wind speed at the site, was used as an input variable. The setpoint for the controller is the rotation speed of the nominal generator shaft of 14.6 rad/s.

The system is limited to a wind speed between the starting speed and the cutting speed, within these limits the system must be stable. Tuning was performed by applying a step input with the value of the nominal wind speed, which means the maximum value of an accepted disturbance. With respect to the sensitivity of the system at di fferent wind speeds, the system must not have an over impulse greater than 20%, so a range of PI gains from the controller that were within the limits of this condition was obtained. Therefore, the controller can minimize the error of the controlled variable under these disturbance conditions and ensuring that the system is stable. The gain values obtained using the Ziegler–Nichols method for PI controller and experimentally adjusted are *Kp* = 2.2 and *Ki* = 0.1, gain values *Kp* = 10 and *Ki* = 0.01 were also obtained for a system with 20% overshoot and *Kp* = 1 and *Ki* = 1 for an overdamped system.

Figure 7 shows the behavior of generator shaft speed with the gain values obtained for a stable system, a system with overshoot, and an overdamped system. Figure 8 contains the pitch angle movement for all cases.

**Figure 7.** Gain values obtained for a stable system, a system with overshoot, and an overdamped system.

**Figure 8.** Pitch angle movement with di fferent gains of PI controller.

#### *4.3. TLBO Algorithm Application.*

According to the analysis performed in the process of tuning a PI controller, in point 4.2, the optimization parameters were defined:

Population size (5), a small number of initial random solutions for each design variable is proposed, which reduces the convergence time, in addition, there is the possibility of increasing the search space since the switching between student-teacher phase is carried out faster and new random solutions can be evaluated and no time is spent evaluating the same solutions among themselves.

Number of generations (100), the maximum number of interactions was proposed after verifying that for this case study the convergence of a solution was obtained around 50 interactions.

Termination criteria: If there are more than 25 interactions without having a better profit proposal, the search process ends.

Design variables ( *Kp, Ki*), controller gains.

Limits of design variables, 0 ≤ *Kp* ≤ 10, 0 ≤ *Ki* ≤ 1 the limits were established based on knowing the optimal values of the design variables for the overshoot system and overdamped system, for nominal wind speed ranges.

Objective function, *f(x)* = mathematical model, this model was described in Section 2 of this publication.

Define the problem: minimize *e(k),* the objective is to find a solution that reduces the error between the nominal rotation speed of the generator shaft and the measured speed.

The calculation of the new gains was made every second, since the execution time of the algorithm was less than this time. MatLab-Simulink R2018b V9.5.0.944444 program was used to run the algorithm on an HP Workstation i-7 processor and 32 Gb RAM (64 bit). The experimentation was performed by programming a PIC16F87A using the Dev C ++ V5.0.0.4 software. The control model proposed proportional-integral with teaching–learning based optimization (PI-TLBO) is shown in Figure 9.

**Figure 9.** PI-TLBO model for pitch control.
