## 2 DFIG and Battery Control System  
### DFIG Control System  
A DFIG, as seen in Figure 1, is made up of mechanical power, the two-mass shaft, pitch control models, the rotor-side converter (RSC), and the grid-side converter (GSC). The RSC and GSC are expressed in reference frames where the space vector of the DFIG stator voltage is lined up with the q-axis [24]. It should be noted that the reference frames for the DFIG model, RSC, and GSC controls are all aligned with the voltage of the stator. The controls of the converter can then be incorporated with the DFIG in a similar dq reference frame. The RSC and GSC are linked by a dc-link capacitor. The active and reactive power on the grid point are regulated by the RSC controller and the GSC controller adjusts the dc-link voltage (\(V_{\text{DC}}\)) and ensures a unity power factor [24]. The mechanical power (\(P_{m}\)) is illustrated as follows:  
\[ \begin{array}{l}P_{m}=\frac{\rho}{\kappa}Ac_{p}(\lambda,\beta)v_{w}^{3}\\ \lambda=\frac{\omega_{1}\sqrt{\frac{\pi}{\kappa}}}{v_{w}}\end{array}  \tag{1}\]  
where \(\rho\), \(A\), \(c_{p}\), \(\lambda\), \(\beta\), \(v_{w}\), and \(\omega_{t}\) represent the density of air, the area covered by the rotor blades, the power coefficient, the tip/speed ratio, the pitch angle, the wind speed, and the angular wind of the turbine, respectively. In [25], \(c_{p}\) is illustrated as follows:  
\[c_{p}(\lambda,\beta)=0.645\Big{[}0.00912\lambda+e^{-21\lambda_{i}}\{-5-0.4(2. 5+\beta)+1116\lambda_{i}\}\Big{]} \tag{2}\]where \(\lambda_{i}=\frac{1}{\lambda+0.08\left(2.5+\beta\right)}-\frac{0.035}{1+\left(2.5+ \beta\right)^{3}}\). In this investigation, \(\beta=0^{\circ}\), and the maximum \(c_{p}\) and optimal \(\lambda\) are selected to be 0.5 and 9.95, respectively. In addition, a drivetrain system is designed to model the dynamic operation of the wind power turbine and doubly fed induction generator, as shown in Figure 2[26]. Figure 1: A DFIG’s conventional design and pitch control approach. A two-mass shaft model is denoted by the following:  
\[\left. \begin{array}{l}2H_{t}\frac{d\omega_{t}}{dt}=T_{t}-K_{s}\theta_{s}-D_{s}( \omega_{t}-\omega_{r})-D_{t}\omega_{t}\\ 2H_{g}\frac{d\omega_{t}}{dt}=K_{s}\theta_{s}-D_{s}(\omega_{t}-\omega_{r})-D_{g }\omega_{r}-T_{g}\\ \frac{d\theta_{s}}{dt}=\omega(\omega_{t}-\omega_{r})\end{array} \right\} \tag{3}\]  
\(H_{t}\) and \(H_{g}\) denote the inertia time constants of a wind turbine and the generator mass, \(\omega_{t}\) and \(\omega_{r}\) are the angular speeds of a wind turbine and the generator mass, \(T_{t}\) and \(T_{g}\) represent the electrical torques of a wind turbine and the generator mass, and \(D_{t}\) and \(D_{g}\) denote the damping constants of a wind turbine and the generator mass [26; 27]. In addition, the shaft stiffness coefficient (\(K_{s}\)), the damping constant of the shaft in per-unit (pu) (\(D_{s}\)), the torsional twist angle in radians (rad) (\(\theta_{s}\)), and the base value of the angular speed (\(\omega=314\) rad/s) are represented accordingly [26; 27]. \(\theta_{s}\) indicates the measure of the mechanical stress from the speed difference between the shaft [24; 25]. The values chosen for the parameters in this work were \(D_{t}=0\) pu, \(D_{s}=1.5\) pu, \(D_{g}=0\) pu, \(H_{t}=4\) s, \(H_{g}=1\) s, and \(K_{s}=1.25\) pu. The MPPT control reference (\(P_{MPPT}\)) was set as in Equation (4) to maximize the power output as in [27; 28]:  
\[P_{MPPT}=\frac{1}{2}c_{\text{pmx}}\rho\pi R^{2}\left(\frac{\omega_{r}R}{\lambda _{\text{optimum}}}\right)^{3}=k_{g}\omega_{r}^{3}, \tag{4}\]  
where \(k_{g}\) is a constant expressed as in Equation (5), set as 0.512 in this investigation. \[k_{g}=\frac{1}{2}c_{\text{pmx}}\rho\pi\frac{R^{5}}{\lambda^{3}_{\text{optimum }}} \tag{5}\]  
\(R\) is the radius equal to the length of the turbine blades, \(c_{\text{pmx}}\) is the maximum power coefficient attained when the pitch angle of the blade system is (\(\beta=0^{\circ}\)), and \(\lambda_{\text{optimum}}\) is the optimum tip/speed ratio that achieves the \(c_{\text{pmx}}\).