# Adaptive Neural Network for a Stabilizing Shunt Active Power Filter in Distorted Weak Grids
## 2 System Configuration
### Robust Synchronizer Quasi-Static Filter (RSQSF) PLL Model for WEAK-GRID Conditions
#### 2.5.2 PLL Model Considering the Grid Impedance  
According to Figure 1, which shows the three-phase SAPF, \(Z_{S}\) represents the grid impedance under stiff-grid conditions (\(Z_{S}=0\)) and \(\theta_{C}\) is equal to \(\theta_{s}\). Considering Figure 2, and based on the superposition principle, \(V_{C}\) is the combination of three voltage responses \(v_{C1},v_{C2}\), and \(v_{C3}\):  
\[\widetilde{v}_{C}=\widetilde{v}_{C1}+\widetilde{v}_{C2}+\widetilde{v}_{C3}= \frac{Z_{sh}}{Z_{sh}+Z_{s}}\widetilde{v}_{s}+\frac{Z_{sh}Z_{s}}{Z_{sh}+Z_{s}} \widetilde{l}_{L}+\frac{Z_{s}}{Z_{s}+Z_{sh}}i_{inj} \tag{22}\]  
Figure 4: Conventional PLL. Figure 5: Linearized PLL model. \[\widetilde{v}_{\text{C}}=\bigg{|}\frac{Z_{sh}}{Z_{sh}+Z_{s}}\bigg{|}V_{s}e^{j( \theta_{s}+\theta_{1})}+\bigg{|}\frac{Z_{sh}Z_{s}}{Z_{sh}+Z_{s}}\bigg{|}I_{L}e^{ i(\theta_{L}+\theta_{2})}+\bigg{|}\frac{Z_{s}}{Z_{s}+Z_{sh}}\bigg{|}i_{inj}e^{i( \theta_{C}+\theta_{3})} \tag{23}\]  
\[\theta_{1}=\measuredangle\frac{Z_{sh}}{Z_{sh}+Z_{s}},\ \theta_{2}=\measuredangle\bigg{(}\frac{Z_{sh}Z_{s}}{Z_{sh}+Z_{s}} \bigg{)},\ \theta_{3}=\measuredangle\bigg{(}\frac{Z_{s}}{Z_{s}+Z_{sh}}\bigg{)} \tag{24}\]  
where \(\theta_{1}\), \(\theta_{2}\) and \(\theta_{3}\) are the phase shift angles at line frequency due to the presence of the reactive components in \(Z_{s}\) and \(Z_{L}\). Figure 6 shows the PLL structure considering the interaction between the grid and SAPF. The parameters in Figure 6 are shown in Equation (25). \[\left\{ \begin{array}{c}K_{1}(\omega_{s})=\bigg{|}\frac{Z_{sh}(\omega_{s})}{Z _{sh}(\omega_{s})+Z_{s}(\omega_{s})}\bigg{|}\\ K_{2}(\omega_{s})=\bigg{|}\frac{Z_{sh}(\omega_{s})Z_{s}(\omega_{s})}{Z_{sh}+Z_ {s}}\bigg{|}\\ K_{3}(\omega_{\text{C}})=\bigg{|}\frac{Z_{s}(\omega_{\text{C}})}{Z_{s}(\omega_ {\text{C}})+Z_{s}\eta(\omega_{\text{C}})}\bigg{|}\end{array} \right.\ \ \ \begin{array}{c}\theta_{1}(\omega_{s})=\bigg{\langle}\Big{(}\frac{Z_{sh}( \omega_{s})}{Z_{sh}(\omega_{s})+Z_{s}(\omega_{s})}\Big{)}\\ \theta_{2}(\omega_{s})=\bigg{\langle}\Big{(}\frac{Z_{sh}(\omega_{s})Z_{s}( \omega_{s})}{Z_{sh}(\omega_{s})+Z_{s}(\omega_{s})}\Big{)}\\ \theta_{3}(\omega_{\text{C}})=\bigg{\langle}\Big{(}\frac{Z_{s}(\omega_{\text{ C}})}{Z_{s}(\omega_{\text{C}})+Z_{s}\eta(\omega_{\text{C}})}\Big{)}\end{array} \right. \tag{25}\]  
Figure 7 shows a small signal model of the PLL with added grid synchronization and self-synchronization signals by considering the interaction between the grid and SAPF (\(\theta_{SS}=\theta_{S}+\theta_{1}\)). According to (26), it is observed that the intensity of the disturbance is determined by \(I_{inj}\), \(K_{3}\) and \(\theta_{3}\). The higher voltage of SAPF, bigger grid impedance, and bigger reactive components or bigger \(\theta_{3}\) give a stronger disturbance to the PLL or give a stronger self-synchronization loop effect. Because of the presence of LF in the PLL structure, the PLL is stable only when \(v_{q}=0\); therefore, the absolute value of the difference between the output of the synchronization loop and the output of the self-synchronization loop must be equal. The synchronization loop achieves this goal by automatically adjusting the error signal between the \(\theta_{SS}\) and \(\theta_{C}\). Due to the presence of the PD, the output of the synchronization loop \(v_{-}\) is limited by \(K_{1}\) and \(V_{S}\), according to (27). \[-V_{S}K_{1}-I_{L}K_{2}\leq\ v_{-}\ \leq V_{S}K_{1}+I_{L}K_{2} \tag{27}\]  
Figure 6: PLL model by considering system operation and grid impedance. When \(v_{+}\) is larger than the maximum amount of \(v_{-}\), according to Figure 7, \(v_{q}\) cannot be zero and it makes the PLL unstable. Therefore, the large-signal stability requirement can be derived in (28). \[