Data Structures | |
struct | SPLL_1PH_NOTCH_COEFF |
Defines the SPLL_1PH_NOTCH_COEFF structure. More... | |
struct | SPLL_1PH_NOTCH_LPF_COEFF |
Defines the SPLL_1PH_NOTCH_LPF_COEFF structure. More... | |
struct | SPLL_1PH_NOTCH |
Defines the SPLL_1PH_NOTCH structure. More... | |
Functions | |
static void | SPLL_1PH_NOTCH_reset (SPLL_1PH_NOTCH *spll_obj) |
Resets internal data to zero,. More... | |
static void | SPLL_1PH_NOTCH_coeff_calc (SPLL_1PH_NOTCH *spll_obj, float32_t c1, float32_t c2) |
Calculates the coefficients for SPLL_1PH_NOTCH filter. More... | |
static void | SPLL_1PH_NOTCH_config (SPLL_1PH_NOTCH *spll_obj, float32_t acFreq, float32_t isrFrequency, float32_t lpf_b0, float32_t lpf_b1, float32_t c1, float32_t c2) |
Configures the SPLL_1PH_NOTCH module. More... | |
static void | SPLL_1PH_NOTCH_run (SPLL_1PH_NOTCH *spll_obj, float32_t acValue) |
Runs the SPLL_1PH_NOTCH module. More... | |
Typedefs | |
typedef float | float32_t |
typedef long double | float64_t |
Macros | |
#define | C2000_IEEE754_TYPES |
The Software Phase Lock Loop for Single Phase Grid with NOTCH filter (SPLL_1PH_NOTCH) API provides a set of functions that calculate the instantaneous phase of a single phase grid. It also computes the sine and cosine values of the grid that can then be used in the closed loop control.
A functional diagram of a PLL is shown in the Figure 7.2, which consists of a phase detect (PD), a loop filter (LPF) and a voltage controlled oscillator (VCO) block
A sinusoidal measured value of the grid is given by,
Now let the VCO output be,
Phase Detect block multiplies the VCO output and the measured input value to get,
The output of PD block has information of the phase difference. However, it has a high frequency component as well.
Thus the second block the loop filter, which is nothing but a PI controller is used which to low pass filter the high frequency components. Thus the output of the PI is
For steady state operation, ignore the term, and sin(Θ) = Θ the linearized error is given as,
Small signal analysis is done using the network theory, where the feedback loop is broken to get the open loop transfer equation and then the closed loop transfer function is given by
Thus the PLL transfer function can be written as follows
The closed loop phase transfer function represents a low pass filter characteristics, which helps in attenuating the higher order harmonics. From the error transfer function it is clear that there are two poles at the origin which means that it is able to track even a constant slope ramp in the input phase angle without any steady state error.
Comparing the closed loop phase transfer function to the generic second order system transfer function
Now comparing this with the closed loop phase transfer function, we can get the natural frequency and the damping ration of the linearalized PLL.
Note in the PLL the PI serves dual purpose
Now if the carrier is high enough in frequency, the low pass characteristics of the PI are good enough and one does not have to worry about low frequency passing characteristics of the LPF and only tune for the dynamic response of the PI. However as the grid frequency is very low (50Hz-60Hz) the roll off provided by the PI is not satisfactory enough and introduces high frequency element to the loop filter output, which affects the performance of the PLL.
Therefore a notch filter is used at the output of the Phase Detect block which attenuates the twice the grid frequency component very well. An adaptive notch filter is used to selectively notch the exact frequency in case there are variations in the grid frequency.
In this case, the PI tuning can be done solely based on dynamic response of the PLL and not worry about the LPF characteristics.
The Loop Filter or PI is implemented as a digital controller with the following equation
Using Z transform, this equation can be written as
Now the laplace transform of the loop filter from the analog domain is
Now using Bi-linear transformation =>
where T = Sampling Time
Now the question is how to select an appropriate value for the proportional and integral gain. Now the step response to a general second order equation i.e.
is given as:
Ignoring the LHP zero from the above equation, now the settling time is given as the time it takes for the response to settle between an error band, let's say this error is ∂, then
Where and and
Now using settling time to be 30ms and the error band to be 5% and damping ratio to be 0.7 we can obtain the natural frequency to be 119.014 and then back substituting we get and
Back substituting these values into the digital loop filter coefficients, we get:
Now for 50Khz run rate for the PLL, B0= 166.877556 and B1= -166.322444
The software module provides the structure for a software based PLL to be used in a single phase grid tied application using the method described in the Software Phase PLL with Notch Filter figure.
Design of the notch filter is achieved using discretizing the notch filter equation from s domain: where
Using zero order hold i.e. we get
Hence, the coefficients for the notch filter can be adaptively changed as the grid frequency varies. The coefficients are chosen such that attenuation at twice the grid frequency is steep without affecting other frequencies.
Taking , and and , the response of the notch is as shown below for 50 and 60Hz grid where the coefficients are calculated based on the grid frequency estimate.
The following is a sequence of steps that can be followed to use the SPLL_1PH_notch API library functions in an existing C program. For a set of code examples that illustrates the use of this library, see the examples in the Digial Power SDK.
Before you can using the library you must add the libraries directory path as a searchable directory in the project include options. This can be done by right-clicking on the project in the Project Explorer window, selecting "Properties". In the window that opens, navigate to "Build, C2000 Compiler, Include Options". In the include path
window, click on the green add directory path button on the right and enter the path to the Digital Power SDK libraries directory.
There is only one module in this package, the APIs can be referenced at SPLL_1PH_NOTCH. The module headers are located at spll_1ph_notch.h.
#define C2000_IEEE754_TYPES |
Definition at line 48 of file spll_1ph_notch.h.
typedef float float32_t |
Definition at line 53 of file spll_1ph_notch.h.
typedef long double float64_t |
Definition at line 54 of file spll_1ph_notch.h.
|
inlinestatic |
Resets internal data to zero,.
*spll_obj | The SPLL_1PH_NOTCH structure pointer |
Definition at line 106 of file spll_1ph_notch.h.
|
inlinestatic |
Calculates the coefficients for SPLL_1PH_NOTCH filter.
*spll_obj | The SPLL_1PH_NOTCH structure pointer |
c1 | c1 Notch paramater |
c2 | c2 Notch Parameter |
Definition at line 136 of file spll_1ph_notch.h.
|
inlinestatic |
Configures the SPLL_1PH_NOTCH module.
*spll_obj | The SPLL_1PH_NOTCH structure pointer |
acFreq | Nominal AC frequency for the SPLL Module |
isrFrequency | Nominal AC frequency for the SPLL Module |
lpf_b0 | B0 coefficient of LPF of SPLL |
lpf_b1 | B1 coefficient of LPF of SPLL |
c1 | c1 Notch paramater |
c2 | c2 Notch Parameter |
Definition at line 174 of file spll_1ph_notch.h.
|
inlinestatic |
Runs the SPLL_1PH_NOTCH module.
*spll_obj | The SPLL_1PH_NOTCH structure pointer |
acValue | AC grid voltage in per unit (pu) |
Definition at line 199 of file spll_1ph_notch.h.