# Enhanced Quasi Type-1 PLL-Based Multi-Functional Control of Single-Phase Dynamic Voltage Restorer
## 3 Reference Signal Generator
### Implementation in PLL  
The previous two subsections detailed the procedure for obtaining DC offset eliminated signal \(v_{g}^{\emptyset}\) and its orthogonal component \(v_{g}^{\emptyset\perp}\). These signals can be used as the input to PLL. The overall block diagram of the proposed PLL is provided in Figure 3. This section details the operating principle of this PLL. Before describing the phase detector operation of this PLL in our case, let us consider APF-filtered signals in the steady-state:  
\[v_{\bar{\theta}}(t) =-V_{p}\cos(\theta_{g}+\delta_{\phi}), \tag{18}\] \[v_{g}^{\prime\emptyset}(t) =-V_{p}\sin(\theta_{g}+2\delta_{\phi}), \tag{19}\]  
where \(\delta_{\phi}\) is the off-nominal frequency phase attenuation by each stage of the APF. As per Figure 3, using the signal \(v_{g}^{\emptyset}(t)\) and \(v_{g}^{\prime}(t)\), \(v_{a}(t)\) is obtained as follows.  
\[v_{a}(t) =\frac{v_{g}^{\emptyset}(t)-v_{g}^{\prime\emptyset}(t)}{2},\] \[\approx V_{p}\sin(\theta_{g})+\delta_{\phi}\cos(\theta_{g}). \tag{20}\]  
Figure 3: Overall block diagram of the proposed PLL.  
The phase detector of the considered PLL is provided by the following.  
\[\left[\begin{array}{c}v_{d}\\ v_{q}\end{array}\right]=\left[\begin{array}{cc}\cos(\hat{\omega}t)&\sin(\hat{ \omega}t)\\ -\sin(\hat{\omega}t)&\cos(\hat{\omega}t)\end{array}\right]\left[\begin{array}{c }v_{\alpha}\\ v_{\beta}\end{array}\right]. \tag{21}\]  
Then, direct-axis and quadrature-axis voltages can be obtained directly from (21). By applying a quasi-locked condition, i.e., \(\omega-\hat{\omega}\approx 0\), the direct-axis and quadrature-axis voltages can be rewritten as follows.  
\[v_{d} = v_{\alpha}\cos(\hat{\omega}t)+v_{\beta}\sin(\hat{\omega}t), \tag{22}\] \[= \frac{V_{p}}{2}(\sin((\omega+\hat{\omega})t+\phi)+\sin((\omega- \hat{\omega})t+\phi))+\frac{\delta_{\phi}}{2}(\cos((\omega-\hat{\omega})t+ \phi))\] \[-\frac{V_{p}}{2}(\sin((\omega+\hat{\omega})t+\phi+2\delta_{\phi})- \sin((\omega-\hat{\omega})t+\phi+2\delta_{\phi}))\] \[+\frac{V_{p}}{2}\frac{\delta_{\phi}}{2}(\cos((\omega+\hat{\omega })t+\phi)),\] \[\approx \frac{V_{p}}{2}(\sin(\phi)+\sin(\phi+\delta_{\phi}))+\frac{V_{p} }{2}\big{(}\sin(2\hat{\omega}t+\phi)-\sin(2\hat{\omega}t+\phi+\delta_{\phi}) \big{)}\] \[+\frac{\delta_{\phi}}{2}\cos(\phi)+\frac{\delta_{\phi}}{2}(\cos(2 \hat{\omega}t+\phi)).\]  
\[v_{q} = -v_{\alpha}\sin(\hat{\omega}t)+v_{\beta}\cos(\hat{\omega}t), \tag{23}\] \[= \frac{V_{p}}{2}(\cos((\omega+\hat{\omega})t+\phi)+\cos((\omega- \hat{\omega})t+\phi))-\frac{\delta_{\phi}}{2}(\sin((\omega+\hat{\omega})t+ \phi))\] \[-\frac{V_{p}}{2}\big{(}\cos((\omega+\hat{\omega})t+\phi+\delta_{ \phi})-\cos((\omega-\hat{\omega})t+\phi+\delta_{\phi})\big{)}\] \[+\frac{V_{p}}{2}\frac{\delta_{\phi}}{2}(\sin((\omega-\hat{\omega })t+\phi)),\] \[\approx \frac{V_{p}}{2}\big{(}\cos(\phi)+\cos(\phi+\delta_{\phi})\big{)} +\frac{V_{p}}{2}\big{(}\cos(2\hat{\omega}t+\phi)-\cos(2\hat{\omega}t+\phi+ \delta_{\phi})\big{)}\] \[+\frac{\delta_{\phi}}{2}\sin(\phi)+\frac{\delta_{\phi}}{2}\sin(2 \hat{\omega}t+\phi).\]  
Double frequency components in (22) and (23) can easily be filtered by applying moving average filter (MAF) with half-cycle window length. The transfer functions of MAF in continuous and discrete domain are provided by the following.  
\[\mathrm{MAF}(s) = \frac{1-e^{-t_{d}s}}{t_{d}s}, \tag{24}\] \[\mathrm{MAF}(z) = \frac{1}{N}\frac{1-z^{-N_{d}}}{1-z^{-1}}. \tag{25}\]  
By applying MAF to (22) and (23) and also assuming negligible off-nominal frequency phase shift, filtered \(v_{d}\) and \(v_{q}\) can be approximated as follows.  
\[v^{\prime}_{d} = V_{p}\sin(\phi), \tag{26}\] \[v^{\prime}_{q} = V_{p}\cos(\phi). \tag{27}\]  
Filtered voltages are then fed to the loop-filter of QT1-PLL, as shown in Figure 3.