## 3 Theoretical Framework  
### Wind Turbines and DFIG Systems  
DFIGs have received much attention in recent years [49; 50; 51]. The benefits of a DFIG include the low cost of electronic power converters, reduced power losses, variable speed performance, and active and reactive power control, to name a few. Drawbacks include the presence of slip rings, commutation, and its complex model and control scheme. However, controlling the output active and reactive power of a DFIG requires predicting and regulating its electromagnetic characteristics, such as flux and torque. Therefore, various control methods for DFIGs have been introduced [52]. Cascading linear controllers are among the most basic control methods but come with numerous disadvantages. Modern controllers compatible with optimization algorithms are designed to enhance the control performance of these machines, which respond well to traditional methods. The adaptive network-based fuzzy inference system is one of these modern DFIG controllers. The main difficulty in designing an ANFIS is deciding on its primary parameters, such as membership functions and initial rules. The controller brings the initial selection parameters of membership functions based on the appropriate point of the system's status in the proposed solution. Finally, the controller reduces the torque by selecting the proper torque reference value. The ANFIS controller is recommended for direct power control to reduce torque oscillations at high switching frequencies, which is a significant issue with this method. It also increases the system's resistance to errors and disturbances and the uncertainty of the loads applied. The wind turbine and DFIG included in the system under study were selected based on a typical case [53; 54]; Figure 1. In the block diagram in Figure 1, the stator is connected to the grid, while a back-to-back converter connects the rotor. In typical configurations of the DFIG system, the converters are regulated by a series of proportional-integral (PI) control systems. However, the stability of the PI controller in wind turbines is highly threatened by the increasing system complexity and wind speed deviations. To solve this issue, simultaneous control of the rotor and grid side converters can be used, including a PI controller and an ANFIS method, as proposed in [53]. The wind turbine/DFIG system is fully controllable using the [53] method. A model for a DFIG can be defined by a fourth-order differential equation using the \(q-d\) coordinate system; Figure 2:  
\[V_{qs}=R_{s}i_{qs}+\omega_{e}\lambda_{ds}+\frac{d}{dt}\lambda_{qs}, \tag{1}\]  
\[V_{ds}= R_{s}i_{ds}-\omega_{e}\lambda_{qs}+\frac{d}{dt}\lambda_{ds}, \tag{2}\]  
\[V_{qr}= R_{r}i_{qr}+(\omega_{e}-\omega_{r})\lambda_{ds}+\frac{d}{dt}\lambda_{qr}, \tag{3}\]  
Figure 1: Block diagram of the wind turbine and DFIG system studied in this work. \[V_{dr}= R_{r}i_{dr}-(\omega_{e}-\omega_{r})\lambda_{qr}+\frac{d}{dt}\lambda_{dr}, \tag{4}\]  
where \(V_{qs},i_{qs},V_{ds},i_{ds},V_{qr},\ i_{qr},\ i_{qr},\ V_{dr}\), and \(I_{dr}\) denote the voltages and currents of the stator and rotor in \(q\) and \(d\) axes, \(\lambda_{qs},\lambda_{ds},\lambda_{qr}\), and \(\lambda_{dr}\) denote the similar fluxes of the stator and rotor along \(q\) and \(d\) axes, \(\omega_{e}\) denotes the angular (synchronous) speed of the rotary reference frame, \(\omega_{r}\) denotes the rotor angular speed, and \(R_{s}\) and \(R_{r}\) denote the stator and rotor resistors, respectively. The linear equations of the currents based on fluxes are as follows:  
\[\lambda_{qs}= L_{s}i_{qs}+L_{m}i_{qr}, \tag{5}\] \[\lambda_{ds}= L_{s}i_{ds}+L_{m}i_{dr},\] (6) \[\lambda_{qr}= L_{r}i_{qs}+L_{m}i_{qr},\] (7) Figure 2:0  
where \(L_{s}\), \(L_{r}\) _and_\(L_{m}\) denote the stator, rotor, and mutual inductance. By solving Equations (5) to (8), the currents can be obtained as follows:  
Figure 2:1 Figure 2:2 (10) Figure 2:3 (11) Figure 2:4  
where \(\sigma\) is defined as the leakage factor:  
Figure 2:5  
Figure 2:6 Equivalent circuit of a DFIG.