An Improved Frequency Measurement Method from the Digital PLL Structure for Single-Phase Grid-Connected PV Applications

Abstract: The Phase Locked Loop (PLL) technique has been studied to obtain the phase and frequency information in grid-connected distributed generations for the sake of synchronizing the grid voltage and the inverter output current. In particular, the line frequency information, such as the anti-islanding function, is very important for the grid connection requirement. This paper presents a novel frequency measurement method from the digital PLL control structure for single-phase grid-connected PV applications. The conventional PLL controller uses the phase information to calculate the frequency of PV inverter output voltage after every line cycle and has shown a relatively low accuracy. This paper uses the angular frequency to directly measure the frequency after every line cycle. To verify the validity of the proposed method compared with the conventional method, a simulation was conducted. According to the simulation results, the measurement error of the proposed method is 80 times lower than the conventional one.


Introduction
The grid interactive PV system has the fastest growth rate in the world energy industry and has started to play the dominant role in that industry [1][2][3].To obtain grid synchronization between the grid voltage and the inverter output current, it is very important to obtain grid voltage information, such as the phase, frequency, and magnitude [3][4][5][6][7][8][9].The frequency measurement, used in the PV inverter controller, is especially important, since it plays a key role in the inverter current command, such as the anti-islanding function [10][11][12][13][14][15].
In general, PLL control methods are commonly used to estimate the phase and frequency of PV inverter output voltage in order to synchronize them with the utility voltage in distributed power systems.The simple Zero Crossing Detection (ZCD) method has been used to obtain voltage phase information by detecting the zero-crossing points of the PV inverter output voltage [16,17].The ZCD method has several disadvantages, such as low detection speed and possible inaccurate phase information between the two crossing points [16][17][18].Another method, called the digital PLL, uses the quadrature of the input waveform, shifted by 90 degrees, and has been studied widely until the present day [18].In a three-phase system, the dq transformation of the three-phase variables has the same properties as the digital PLL, and the PLL can be implemented easily [18].However, in a single-phase system, it must achieve an additional signal, introducing a phase shift of 90 degrees with respect to the fundamental frequency of the power system.Single-phase PV systems have received considerable attention because of their emerging applications, such as PV micro-inverter systems, as well as vehicle-to-grid and grid-to-vehicle connections [19,20].
Usually, PLL is used to detect voltage information [21,22].The conventional PLL controller uses phase information to calculate the frequency of PV inverter output voltage after every line cycle, and has shown a relatively low accuracy [23][24][25][26][27][28].This paper presents a novel frequency measurement method, with high accuracy, from the digital PLL control structure for single-phase grid-connected PV applications.Unlike the conventional PLL technique, the PLL method proposed in this paper uses the angular frequency to directly measure the frequency after every line cycle.
This paper consists of three sections.Firstly, the control system for a digital PLL, using an all pass filer, is described.Secondly, the proposed PLL method for a novel line frequency measurement is explained, analyzed, and compared with the conventional method.Lastly, a frequency measurement performance comparison between the proposed method and the conventional one, is discussed through several simulation results for a 350 W single-phase PV micro-inverter.

System Configuration
In a three-phase system, utility voltage information, such as the magnitude and angle of the grid-voltage vector, can easily be obtained.In a single-phase system, the grid voltage information is obtained by detecting the zero-crossing point.However, the zero-crossing detection method is not practical due to its sensitivity to noise.Therefore, two virtual phases of PLL operation must be used for a single-phase system.
To use the reference frame theory for a simple control, the single-phase voltage should be virtual two-phase voltage that has a 90-degree out-of-phase component.Based on this concept, the PLL for a single-phase system consists of two stages: A two-phase generator and a phase controller, as shown in Figure 1.
Electronics 2018, 7, x FOR PEER REVIEW 2 of 11 considerable attention because of their emerging applications, such as PV micro-inverter systems, as well as vehicle-to-grid and grid-to-vehicle connections [19,20].Usually, PLL is used to detect voltage information [21,22].The conventional PLL controller uses phase information to calculate the frequency of PV inverter output voltage after every line cycle, and has shown a relatively low accuracy [23][24][25][26][27][28].This paper presents a novel frequency measurement method, with high accuracy, from the digital PLL control structure for single-phase grid-connected PV applications.Unlike the conventional PLL technique, the PLL method proposed in this paper uses the angular frequency to directly measure the frequency after every line cycle.
This paper consists of three sections.Firstly, the control system for a digital PLL, using an all pass filer, is described.Secondly, the proposed PLL method for a novel line frequency measurement is explained, analyzed, and compared with the conventional method.Lastly, a frequency measurement performance comparison between the proposed method and the conventional one, is discussed through several simulation results for a 350 W single-phase PV micro-inverter.

System Configuration
In a three-phase system, utility voltage information, such as the magnitude and angle of the gridvoltage vector, can easily be obtained.In a single-phase system, the grid voltage information is obtained by detecting the zero-crossing point.However, the zero-crossing detection method is not practical due to its sensitivity to noise.Therefore, two virtual phases of PLL operation must be used for a single-phase system.
To use the reference frame theory for a simple control, the single-phase voltage should be virtual two-phase voltage that has a 90-degree out-of-phase component.Based on this concept, the PLL for a single-phase system consists of two stages: A two-phase generator and a phase controller, as shown in Figure 1.

Two-Phase Generator
In Figure 1, Vqs is defined as a 90-degree lagging component of Vds.There are a few ways to calculate Vqs.In this paper, an all-pass filter is used to achieve the 90-degree out-of-phase component in the utility voltage, as shown in Figure 2. When the input resistance Ri is equal to the feedback resistance Rf, there is no magnitude attenuation.12 12

Two-Phase Generator
In Figure 1, V qs is defined as a 90-degree lagging component of V ds .There are a few ways to calculate V qs .In this paper, an all-pass filter is used to achieve the 90-degree out-of-phase component in the utility voltage, as shown in Figure 2. When the input resistance R i is equal to the feedback resistance R f , there is no magnitude attenuation.The output voltage phase will be changed to the transfer function in (1), based on the input voltage.
( ) After applying a bilinear transformation of (5) into (4), the discrete all-pass filter equation can be drawn as Equations ( 6) and (7).21 1 where Ts is the sampling period To obtain a 90-degree out-of-phase component from the input voltage, the filter resistance and capacitance should be determined by (3).If the filter resistance is 1 kΩ, then the filter capacitance will be 1.5315 μF.In that case, the β is 0.963, and it can be simulated based on (7), as shown in Figure 3. Obviously, the output signal has a 90-degree out-of-phase lag with respect to the input voltage.
With the grid voltage Vds and the calculated 90-degree out-of-phase lagging voltage Vqs, the active and reactive component in the reference frame can be drawn by applying the reverse Park transformation as (8).In ( 8) and ( 9), the rotating reference frame is based on the estimated phase angle  ̂ and the estimated frequency  ̂, as shown in Figure 4.The output voltage phase will be changed to the transfer function in (1), based on the input voltage.
After applying a bilinear transformation of ( 5) into ( 4), the discrete all-pass filter equation can be drawn as Equations ( 6) and (7).
where T s is the sampling period To obtain a 90-degree out-of-phase component from the input voltage, the filter resistance and capacitance should be determined by (3).If the filter resistance is 1 kΩ, then the filter capacitance will be 1.5315 µF.In that case, the β is 0.963, and it can be simulated based on (7), as shown in Figure 3. Obviously, the output signal has a 90-degree out-of-phase lag with respect to the input voltage.
With the grid voltage V ds and the calculated 90-degree out-of-phase lagging voltage V qs , the active and reactive component in the reference frame can be drawn by applying the reverse Park transformation as (8).In ( 8) and ( 9), the rotating reference frame is based on the estimated phase angle θ and the estimated frequency ω, as shown in Figure 4.
cos sin sin cos cos sin sin( )

Phase Controller
As shown in (9), the reactive voltage component Vde should be maintained at zero for the unity power factor of the estimated phase angle  ̂ to be equal to the real phase angle θ.To control the estimated phase angle error, Δω is obtained using a PI controller.Δω is added to the initial value ωff to achieve the estimated frequency  ̂ and the estimated phase angle  ̂, as shown in Figure 1.cos sin sin cos cos sin sin( )

Phase Controller
As shown in (9), the reactive voltage component Vde should be maintained at zero for the unity power factor of the estimated phase angle  ̂ to be equal to the real phase angle θ.To control the estimated phase angle error, Δω is obtained using a PI controller.Δω is added to the initial value ωff to achieve the estimated frequency  ̂ and the estimated phase angle  ̂, as shown in Figure 1.

Phase Controller
As shown in (9), the reactive voltage component V de should be maintained at zero for the unity power factor of the estimated phase angle θ to be equal to the real phase angle θ.To control the estimated phase angle error, ∆ω is obtained using a PI controller.∆ω is added to the initial value ω ff to achieve the estimated frequency ω and the estimated phase angle θ, as shown in Figure 1.

The Line Frequency Measurement Techniques from the Digital PLL
The accurate line frequency information from the PLL controller is very significant for the evaluation of the system's safety status, which is required to meet national and international grid code requirements [29][30][31].In addition, this information is used to generate the PV inverter controller command, such as the anti-islanding function and the Active Frequency Drift (AFD) method [10][11][12]14].This section discusses both the conventional PLL technique and the proposed one to calculate the line frequency.

The Conventional Method
The operational principle of the conventional PLL technique to calculate the line frequency of PV inverter output voltage is shown in Figure 5. Angular frequency information ( ω), as shown in Figure 1, is also used to calculate phase information.Based on the phase information, the line frequency is calculated by the relationship between the sampling frequency (f sampling ) and the number of the counter (F_N) during a line cycle, as shown in Figure 5.After a line cycle, the phase information (wt_vco) does not match the exact one-line cycle phase 2π, because the incremental phase (dwt_vco) is not small enough.Since the sampling frequency is limited by the microcontroller performance, it is hard to increase the sampling frequency.In other words, the incremental phase is not small enough.Thus, the amount of error caused by the phase difference between wt_vco, after a line cycle, and 2π has a negative effect on the calculated line frequency measurement.Thus, the conventional PLL technique to measure the line frequency has shown low accuracy.

The Line Frequency Measurement Techniques from the Digital PLL
The accurate line frequency information from the PLL controller is very significant for the evaluation of the system's safety status, which is required to meet national and international grid code requirements [29][30][31].In addition, this information is used to generate the PV inverter controller command, such as the anti-islanding function and the Active Frequency Drift (AFD) method [10][11][12]14].This section discusses both the conventional PLL technique and the proposed one to calculate the line frequency.

The Conventional Method
The operational principle of the conventional PLL technique to calculate the line frequency of PV inverter output voltage is shown in Figure 5. Angular frequency information ( ̂), as shown in Figure 1, is also used to calculate phase information.Based on the phase information, the line frequency is calculated by the relationship between the sampling frequency (fsampling) and the number of the counter (F_N) during a line cycle, as shown in Figure 5.After a line cycle, the phase information (wt_vco) does not match the exact one-line cycle phase 2π, because the incremental phase (dwt_vco) is not small enough.Since the sampling frequency is limited by the microcontroller performance, it is hard to increase the sampling frequency.In other words, the incremental phase is not small enough.Thus, the amount of error caused by the phase difference between wt_vco, after a line cycle, and 2π has a negative effect on the calculated line frequency measurement.Thus, the conventional PLL technique to measure the line frequency has shown low accuracy.

The Proposed Method
The operational principle of the proposed PLL technique to calculate the line frequency of PV inverter output voltage is shown in Figure 6.Unlike the conventional method, this method uses the angular frequency to directly measure the frequency after every line cycle.As shown in Figure 6, by summing the angular frequency (wt_vco) during a single line cycle, the summation of angular frequency wt_vco_s can be achieved.After a line cycle, the averaged angular frequency information can be generated by dividing the number of the counter F_N for a line cycle.It could be converted to

The Proposed Method
The operational principle of the proposed PLL technique to calculate the line frequency of PV inverter output voltage is shown in Figure 6.Unlike the conventional method, this method uses the angular frequency to directly measure the frequency after every line cycle.As shown in Figure 6, by summing the angular frequency (wt_vco) during a single line cycle, the summation of angular frequency wt_vco_s can be achieved.After a line cycle, the averaged angular frequency information can be generated by dividing the number of the counter F_N for a line cycle.It could be converted to the line frequency with an appropriate scaling factor k. The scaling factor k is related to several parameters, such as the sampling frequency of the microcontroller, the nominal line frequency, etc.In this paper, the scaling factor k was easily determined by using only one example case.Unlike the conventional method, there is little relationship between the proposed method and the phase error, causing a phase difference between wt_vco and 2π.With the proposed method, the phase error only affects the number of the counter, and its impact is negligible.Therefore, the averaged angular frequency information is quite reliable for calculating the line frequency.
Electronics 2018, 7, x FOR PEER REVIEW 6 of 11 the line frequency with an appropriate scaling factor k. The scaling factor k is related to several parameters, such as the sampling frequency of the microcontroller, the nominal line frequency, etc.In this paper, the scaling factor k was easily determined by using only one example case.Unlike the conventional method, there is little relationship between the proposed method and the phase error, causing a phase difference between wt_vco and 2π.With the proposed method, the phase error only affects the number of the counter, and its impact is negligible.Therefore, the averaged angular frequency information is quite reliable for calculating the line frequency.

Simulation Results
To verify the performance accuracy of the proposed PLL method, a simulation was conducted using a 350 W grid-connected PV micro-inverter application, as shown in Figure 7.Further electrical specifications of the simulation circuit are shown in Table 1.According to the related international standards, such as IEEE Std.1547, the normal frequency range was determined to be between 59.3 Hz and 60.5 Hz [21].
First, the steady-state responses were discussed.Throughout the normal frequency range, measured line frequency information was obtained using both the conventional PLL technique and the proposed one, shown in Figures 8-12.In these figures, the actual frequency means the frequency command of the grid voltage Vgrid, as shown in Figure 7.As shown in Figure 8, when the grid voltage source is operated at 60 Hz, the PV inverter output current is maintained in phase with the PV inverter output voltage.The line frequencies are measured by two different PLL techniques, as shown in Figure 8.While the measurement error of the line frequency using the conventional method changes from −0.048 Hz to +0.096 Hz, the measurement error of the line frequency using the proposed method varies from -0.004 Hz to +0.003 Hz.Obviously, the proposed method shows a measurement error at least 10 times smaller than that of the conventional method.Similarly, the measured line frequencies, when the grid frequencies are 60.5 Hz and 59.3 Hz, are shown in Figures 9 and 10.According to the results shown in Figures 9 and 10, the proposed method shows higher accuracies than the conventional one.The quantitative analysis of the accuracy of both PLL techniques is summarized in Table 2. Using the proposed method, the measurement error is around 80 times lower that using the conventional one.

Simulation Results
To verify the performance accuracy of the proposed PLL method, a simulation was conducted using a 350 W grid-connected PV micro-inverter application, as shown in Figure 7.Further electrical specifications of the simulation circuit are shown in Table 1.According to the related international standards, such as IEEE Std.1547, the normal frequency range was determined to be between 59.3 Hz and 60.5 Hz [21].
First, the steady-state responses were discussed.Throughout the normal frequency range, measured line frequency information was obtained using both the conventional PLL technique and the proposed one, shown in Figures 8-12.In these figures, the actual frequency means the frequency command of the grid voltage V grid , as shown in Figure 7.As shown in Figure 8, when the grid voltage source is operated at 60 Hz, the PV inverter output current is maintained in phase with the PV inverter output voltage.The line frequencies are measured by two different PLL techniques, as shown in Figure 8.While the measurement error of the line frequency using the conventional method changes from −0.048 Hz to +0.096 Hz, the measurement error of the line frequency using the proposed method varies from -0.004 Hz to +0.003 Hz.Obviously, the proposed method shows a measurement error at least 10 times smaller than that of the conventional method.Similarly, the measured line frequencies, when the grid frequencies are 60.5 Hz and 59.3 Hz, are shown in Figures 9 and 10.According to the results shown in Figures 9 and 10, the proposed method shows higher accuracies than the conventional one.The quantitative analysis of the accuracy of both PLL techniques is summarized in Table 2. Using the proposed method, the measurement error is around 80 times lower that using the conventional one.
Secondly, the transient responses using both PLL techniques were analyzed when the voltage frequency was changing dramatically.It was assumed that the grid voltage frequency was changing from the nominal frequency 60 Hz to two other states, 60.5 Hz and 59.3 Hz.This condition can be implemented by changing the frequency command of the grid voltage V grid at 0.3 s, as shown in Figure 8.The key waveforms of the PV inverter, when the grid voltage frequency is changing rapidly from 60 Hz to 60.5 Hz at 0.3 s, are shown in Figure 11.Both methods have the same transient time of 0.179 s.Similarly, both methods have the same transient time of 0.290 s when the grid voltage frequency is changing rapidly from 60 Hz to 59.3 Hz at 0.3 s, as shown in Figure 12.This is because both methods have the same sampling counter for detecting a line cycle.
According to the simulation results, it can be stated that the proposed PLL technique has a higher accuracy than the conventional one and the same transient response time.Secondly, the transient responses using both PLL techniques were analyzed when the grid voltage frequency was changing dramatically.It was assumed that the grid voltage frequency was changing from the nominal frequency 60 Hz to two other states, 60.5 Hz and 59.3 Hz.This condition can be implemented by changing the frequency command of the grid voltage Vgrid at 0.3 s, as shown in Figure 8.The key waveforms of the PV inverter, when the grid voltage frequency is changing rapidly from 60 Hz to 60.5 Hz at 0.3 s, are shown in Figure 11.Both methods have the same transient time of 0.179 s.Similarly, both methods have the same transient time of 0.290 s when the grid voltage frequency is changing rapidly from 60 Hz to 59.3 Hz at 0.3 s, as shown in Figure 12.This is because both methods have the same sampling counter for detecting a line cycle.
According to the simulation results, it can be stated that the proposed PLL technique has a higher accuracy than the conventional one and the same transient response time.

Conclusions
In this paper, a novel frequency measurement method for the digital PLL control structure for single phase grid-connected PV applications is presented.While the conventional PLL controller uses phase information to calculate the frequency of PV inverter output voltage after every line cycle, this paper uses the angular frequency to directly measure the frequency after every line cycle.Thus, the measured frequency of the proposed method is more accurate than that of the conventional one.According to the corresponding simulation, measuring the line frequency, the measurement error of the proposed method around 80 times less than that of the conventional one.By using the proposed PLL technique, a more accurate line frequency can be achieved, and a more accurate control command, such as the anti-islanding function and over/under frequency protection, can be generated.

Figure 1 .
Figure 1.Block diagram of PLL for a single-phase PV inverter controller.

Figure 1 .
Figure 1.Block diagram of PLL for a single-phase PV inverter controller.

Figure 3 .
Figure 3. Digital all-pass filter simulation results for 90-degree out-of-phase lagging.

Figure 4 .
Figure 4.Estimated reference frame for a single-phase system.

Figure 5 .
Figure 5. Flowchart of the conventional PLL technique to calculate the line frequency.

Figure 5 .
Figure 5. Flowchart of the conventional PLL technique to calculate the line frequency.

Figure 6 .
Figure 6.Flowchart of the proposed PLL technique to calculate the line frequency.

Figure 6 .
Figure 6.Flowchart of the proposed PLL technique to calculate the line frequency.

Figure 7 .
Figure 7. Simulation circuit of a single-phase PV micro-inverter for evaluating the grid-connection.Figure 7. Simulation circuit of a single-phase PV micro-inverter for evaluating the grid-connection.

Figure 7 .
Figure 7. Simulation circuit of a single-phase PV micro-inverter for evaluating the grid-connection.Figure 7. Simulation circuit of a single-phase PV micro-inverter for evaluating the grid-connection.

Electronics 2018, 7 , 11 Figure 8 .
Figure 8. Key waveforms of the PV inverter when the grid voltage is 60 Hz.

Figure 9 .
Figure 9. Key waveforms of the PV inverter when the grid voltage frequency is 60.5 Hz.

Figure 10 .
Figure 10.Key waveforms of the PV inverter when the grid voltage frequency is 59.3 Hz.

Figure 8 . 11 Figure 8 .
Figure 8. Key waveforms of the PV inverter when the grid voltage frequency is 60 Hz.

Figure 9 .
Figure 9. Key waveforms of the PV inverter when the grid voltage frequency is 60.5 Hz.

Figure 10 .
Figure 10.Key waveforms of the PV inverter when the grid voltage frequency is 59.3 Hz.

Figure 9 . 11 Figure 8 .
Figure 9. Key waveforms of the PV inverter when the grid voltage frequency is 60.5 Hz.

Figure 9 .
Figure 9. Key waveforms of the PV inverter when the grid voltage frequency is 60.5 Hz.

Figure 10 .
Figure 10.Key waveforms of the PV inverter when the grid voltage frequency is 59.3 Hz.

Figure 10 .Figure 11 .
Figure 10.Key waveforms of the PV inverter when the grid voltage frequency is 59.3 Hz.

Figure 12 .
Figure 12.Key waveforms of the PV inverter when the grid voltage frequency is rapidly changing from 60 Hz to 59.3 Hz.

Figure 11 . 11 Figure 11 .
Figure 11.Key waveforms of the PV inverter when the grid voltage frequency is rapidly changing from 60 Hz to 60.5 Hz.

Figure 12 .
Figure 12.Key waveforms of the PV inverter when the grid voltage frequency is rapidly changing from 60 Hz to 59.3 Hz.

Figure 12 .
Figure 12.Key waveforms of the PV inverter when the grid voltage frequency is rapidly changing from 60 Hz to 59.3 Hz.

Table 1 .
Electrical specification of the simulation circuit.

Table 2 .
Measurement error using two different PLL techniques.

Table 1 .
Electrical specification of the simulation circuit.

Table 2 .
Measurement error using two different PLL techniques.