# Adaptive PI + VPI Harmonic Current Compensation Strategy under Weak Grid Conditions
## 4 Adaptive VPI Current Tracking Control System  
### Mathematical Modeling of Digital Frequency Adaptive VPI Current Tracking Controller  
As an extension and improvement of PR control, VPI control has the advantage of eliminating the peak of the closed-loop response and compensating for the delay in the system. The combination of the PI controller and VPI controller can achieve a better compensation effect [18]. The proposed frequency adaptive VPI current control scheme in this paper is shown in Figure 12. The PI controller is used to adjust the DC side voltage; the tracking output of the harmonic reference current is realized; and the harmonic compensation current is output from the PCC point. The DC side voltage regulator adopts a discrete PI integral controller, and the transfer function is \(PI_{\text{dc}}(z)\). \(k_{\text{pdc}}\) and \(k_{\text{iddc}}\) are the proportional and integral gain of the controller, respectively. After bilinear transformation, the digital transfer function can be expressed as Equation (43).  
\[PI_{\text{dc}}(z)=k_{\text{pdc}}\cdot(1+k_{\text{iddc}}\frac{T_{s}}{2}\frac{1+ z^{-1}}{1-z^{-1}}) \tag{43}\]  
The current tracking control adopts the adaptive PI + VPI control method, and the transfer functions are \(G_{\text{d}}^{\text{PI+VPI}}(z)\) and \(G_{\text{d}}^{\text{PI+VPI}}(z)\), respectively. The decoupled \(d\)-axis small signal current control loop is shown in Figure 13. The \(q\)-axis current control is equivalent to the \(d\)-axis in the small signal model and analysis design. Taking the \(d\)-axis as an example, \(G_{\text{d}}^{\text{PI+VPI}}(z)=G_{\text{d}}^{\text{PI}}(z)+G_{\text{d}}^{ \text{VPI}}(z)\), where the structure and parameters of the \(G_{\text{d}}^{\text{PI}}(z)\) controller  
Figure 11: Bode plot of the open-loop transfer function from disturbance \(p\) to estimator \(\hat{\theta}\).  
Figure 12: Adaptive PI + VPI harmonic current tracking controller.  
are consistent with Equation (43). The transfer function of the continuous VPI controller is shown in Equation (26). Equation (44) gives the transfer function after discretization by forward Euler and backward Euler transformation. \(T_{\text{s}}\) is the sampling frequency of the digital controller, \(H=\{2,\,6,\,12,\,18\}\). The above discretization is a nonlinear mapping relationship for frequency, which will lead to the offset of the resonant pole of the controller and reduce the harmonic compensation ability of the resonant controller. Therefore, the cosine function term is introduced to replace the \(z^{-1}\) term coefficient to readjust the resonance pole position of the VPI transfer function to obtain the expected harmonic tracking performance [30]. The adjusted transfer function is shown in Equation (45). At this time, accurate mapping of the resonant frequency can be achieved. However, digitization contains a cosine function term, and online calculation means large resource consumption. Therefore, through the fourth-order Taylor series approximation, as shown in Equation (46), the maximum error of the frequency mapping generated at this time can be calculated in the 12 th harmonic VPI control link. The relative error is less than \(1.9\times 10^{-4}\), and its digital implementation frame is shown in Figure 14.  
\[G_{\text{d}}^{\text{VPI}}(z)=\sum_{h\in H}\frac{k_{ph}+(k_{rh}T_{s}-2k_{ph})z^{ -1}-(k_{rh}T_{s}-k_{ph})z^{-2}}{1-(1-h^{2}\hat{\omega}^{2}T_{s}^{2}/2)z^{-1}+z ^{-2}} \tag{44}\]  
\[G_{\text{d}}^{\text{VPI}}(z)=\sum_{h\in H}\frac{k_{ph}+(k_{rh}T_{s}-2k_{ph})z^{ -1}-(k_{rh}T_{s}-k_{ph})z^{-2}}{1-2\cos\,\left(\ h\hat{\omega}T_{s}\ \right)z^{-1}+z^{-2}} \tag{45}\]  
\[G_{\text{d}}^{\text{VPI}}(z)=\sum_{h\in H}\frac{k_{ph}+(k_{rh}T_{s}-2k_{ph})z^ {-1}-(k_{rh}T_{s}-k_{ph})z^{-2}}{1-(1-h^{2}\hat{\omega}^{2}T_{s}^{2}/2+h^{4} \hat{\omega}^{4}T_{s}^{4}/24)z^{-1}+z^{-2}} \tag{46}\]