## 3 Methodology
### Hierarchical Fuzzy Logic Controller  
An FLC is developed in three stages [13; 14; 15]. 1. [label=(0)]
2. Fuzzification, converts the numerical value of the input variables into functions of belonging, based on intuition, deduction, data classification, or inductive reasoning. 3. Fuzzy rules, using simple language statements, typically described in the Mamdani inference method, which is described by the following equation: \[If\ \ \ X_{1}=A_{1}\ \ and\ \ X_{2}=A_{2}\ \ then\ \ \ Y=B\] (14) where the input variables \(X_{1}\) and \(X_{2}\) with constant values \(A_{1}\) and \(A_{2}\), respectively, generate the output variable \(Y\) with a constant value \(B\). 4. Defuzzification, converts the result of fuzzy rules to a numerical value of the output variable. In this proposed hierarchical fuzzy logic controller (HFLC), the inputs for the controller are the value of wind speed \(v\), the value of the change in wind speed \(\Delta v\), the error between rotor speed \(\omega_{gen}\) and MPPT rotor speed \(\omega_{ref}\), and the variation in error of generator speed \(\Delta\omega_{gen}\). The input variables are described in the following equations:  
\[\Delta v=v(t)-v(t-1) \tag{15}\]  
\[\omega_{gen}=\omega_{gen}-\omega_{ref} \tag{16}\]  
\[\Delta e\omega_{gen}=\omega_{gen}(t)-\omega_{gen}(t-1) \tag{17}\]  
The proposed HFLC scheme for the pitch angle is shown in Figure 10.  
Figure 10: Proposed hierarchical fuzzy logic controller (HFLC) scheme for the pitch angle. Figure 9: Scale perspective of the wind turbine and nearby buildings. (**a**) Side view, (**b**) front view. In this HFLC strategy, different levels of control are proposed. When the anemometer detects higher than nominal wind speeds in advance, or a significant change in wind speed, the controller anticipates the angle position. The closed loop of the rotor shaft speed determines the fine adjustment. First level. According to the wind speed, the turbine's operating region is located. Three linguistic levels are assigned for each region of operation with the following names: Region 1 (R_1), Region 2 y 3 (R_23), and Region 4 (R_4). The membership functions for wind speed are shown in Figure 11.  
Second level. According to the magnitude of the change in wind speed. In region 2 and 3, it is important to consider changes in wind speed, as an abrupt change can accelerate the rotor and cause current spikes, saturate the generator, or physically damage the wind turbine. When a change in wind speed is detected in the anemometer at 450 m, the pitch angle moves in advance depending on the value of the magnitude of the change. Five linguistic levels are assigned for each magnitude of the change with the following names: Negative big (NB_C), negative small (NS_C), Zero (ZE_C), positive small (PS_C), and positive big (PB_C). The membership functions for changes in wind speed value are shown in Figure 12.  
Third level. If there is no significant wind speed change, the level of control is based on finding the optimum angle to generate as much energy as possible, for which it considers the rotation speed error between the rotor speed and nominal speed, as well as the magnitude of the variation in the same error. Five linguistic levels are assigned according to the magnitude of the error with the following names: Negative big (NB_E), negative small (NS_E), Zero (ZE_E), positive small (PS_E), and positive big (PB_E). In addition, five linguistic levels are assigned according to the magnitude of the change in error value with the following names: Negative big (NB_D), negative small (NS_D), Zero (ZE_D), positive small (PS_D), and positive big (PB_D). These membership functions are shown in Figure 13.  
\[\Delta v=v(t)-v(t-1) \tag{15}\]0 Membership functions for wind speed. \[\Delta v=v(t)-v(t-1) \tag{15}\]1 Membership functions for changes in wind speed value. The output value has five linguistic levels with the following names: Negative big (NB_O), negative small (NS_O), Zero (ZE_O), positive small (PS_O), and positive big (PB_O).